当前位置: 首页>>代码示例>>C#>>正文


C# Communicator类代码示例

本文整理汇总了C#中Communicator的典型用法代码示例。如果您正苦于以下问题:C# Communicator类的具体用法?C# Communicator怎么用?C# Communicator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Communicator类属于命名空间,在下文中一共展示了Communicator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    public static void Main(string[] args)
    {
        Console.WriteLine("GoBang 0.001");
        string host;
        int port;
        if (args.Length < 2)
        {
            host = "localhost";
            port = 7777;

        }
        else
        {
            host = args[0];
            port = int.Parse(args[1]);
        }
        Player one = new NewAiPlayer();
        //Player two = new NewAiPlayer();
        Player two = new Communicator(host, port);

        string color = two.AskColor();
        int size = two.AskSize();

        if (color == "white")
        {
            one.SetColor("white");
            two.SetColor("black");
        }
        else
        {
            Player tmp = one;
            one = two;
            two = tmp;
            one.SetColor("white");
            two.SetColor("black");
        }
        one.SetSize(size);
        two.SetSize(size);

        int[,] board = new int[size, size];
        Coordinate move;
        while (true) {
            move = one.GetMove();
            Console.WriteLine("Got move from player 1: {0}", move);
            if (!valid(board,move))
                throw new Exception("Invalid move " + move);
            board[move.X, move.Y] = 1;
            printBoard(board);
            if (winning(board, 1)) throw new Exception("white has won");
            two.RegOppMove(move);
            move = two.GetMove();
            Console.WriteLine("Got move from player 2: {0}", move);
            if (!valid(board,move))
                throw new Exception("Invalid move " + move);
            board[move.X, move.Y] = -1;
            printBoard(board);
            if (winning(board, -1)) throw new Exception("black has won");
            one.RegOppMove(move);
        }
    }
开发者ID:gomoku,项目名称:Stahlfaust---Gomoku-AI-player,代码行数:60,代码来源:GoBang.cs

示例2: Operations

        public Operations(Communicator communicator)
        {
            this.communicator = communicator;

            databaseConnectionSessionID = this.communicator.CurrentSessionID;
            databaseConnectionCallback = this.communicator.ClientList[databaseConnectionSessionID];
        }
开发者ID:ieuan0928,项目名称:vumva,代码行数:7,代码来源:Operations.cs

示例3: MainWindow

 public MainWindow()
     : base(Gtk.WindowType.Toplevel)
 {
     Build ();
     this._com = new Communicator (new TcpClient ("192.168.0.10", 8888));
     this._vm = new ValueManager (555);
 }
开发者ID:TheOperator,项目名称:OperatorServer,代码行数:7,代码来源:MainWindow.cs

示例4: Main

        static void Main()
        {
            try
            {
                _log.InfoFormat("User: {0}", Environment.UserName);

                while (CommunicatorNotRunning())
                {
                    _log.Info("Communicator is not running. Will try again in 5 seconds");
                    System.Threading.Thread.Sleep(5000);
                }

                var communicator = new Communicator(GetRecordHistoryInterval());
                communicator.ConversationEnded += (s, e) => new SaveConversationToFile(_historyFile).Save(e.EventData);

                var notifyIcon = MakeNotifyIcon();
                notifyIcon.Visible = true;
                Application.Run();
                notifyIcon.Visible = false;
                communicator.Dispose();
            }
            catch (Exception e)
            {
                _log.Error("Exception caught", e);
            }
        }
开发者ID:paulyoder,项目名称:CommunicatorHistory,代码行数:26,代码来源:Program.cs

示例5: MessageHandler

 // Receive in a seperate thread
 public MessageHandler(MainGrid active_grid)
 {
     c = Communicator.GetInstance(active_grid);
     ThreadStart ts = new ThreadStart(c.ReceiveData);
     Thread t = new Thread(ts,50000000);
     t.Start();
 }
开发者ID:anuradhawick,项目名称:NukeIt-Tanker-Game,代码行数:8,代码来源:MessageHandler.cs

示例6: PluginManagerI

 public PluginManagerI(Communicator communicator)
 {
     _communicator = communicator;
     _plugins = new Hashtable();
     _initOrder = new ArrayList();
     _initialized = false;
 }
开发者ID:bholl,项目名称:zeroc-ice,代码行数:7,代码来源:PluginManagerI.cs

示例7: TempCommunicator

        public TempCommunicator(string configFileClasspath)
        {
            log("Constructor called");
            try
            {
                InitializationData initData = new InitializationData();
                initData.properties = Util.createProperties();
                initData.properties.load(configFileClasspath);
                communicator = Util.initialize(initData);
                log("Properties Loaded!");
            }
            catch (Exception e)
            {
                log(e.ToString());
                throw e;
            }
            string proxy1 = "'::TeRK::TeRKUser':tcp -h 127.0.0.1 -p 10101";
            log("Calling stringToProxy on " + proxy1);
            communicator.stringToProxy(proxy1);
            log("Complete!");

            string proxy2 = "'::TeRK::TeRKUser':tcp -h 192.168.0.16 -p 10101";
            log("Calling stringToProxy on " + proxy2);
            communicator.stringToProxy(proxy2);
            log("Complete!");

            log("Constructor terminated");
            writeLog("C:\\tempCommLog.txt");
        }
开发者ID:CMU-CREATE-Lab,项目名称:terk-legacy,代码行数:29,代码来源:TempCommunicator.cs

示例8: client_ConnexionRemoved

 private void client_ConnexionRemoved(Communicator c, IConnexion conn)
 {
     /* if (!IsDisposed && client.Connexions.Count == 0)
     {
         MessageBox.Show(this, "Disconnected from server", Text);
         Close();
     } */
 }
开发者ID:pichiliani,项目名称:CoMusic,代码行数:8,代码来源:ClienteGT.cs

示例9: MainForm

        public MainForm()
        {
            InitializeComponent();            

            _communicator = Communicator.getInstance();

            _activeTalks = new List<Talk>();            
        }
开发者ID:skubisz,项目名称:komunikator-lpp,代码行数:8,代码来源:MainForm.cs

示例10: getInstance

    public static Communicator getInstance()
    {
        if (instance == null)
        {
            instance = new Communicator();
        }

        return instance;
    }
开发者ID:skubisz,项目名称:komunikator-lpp,代码行数:9,代码来源:Communicator.cs

示例11: Main

 static void Main(string[] args)
 {
     Console.WriteLine("Server started.");
     var settings = LoadSettings("Settings.txt");
     GameStateServer gameState = new GameStateServer(settings.Map);
     Communicator communicator = new Communicator(settings.ServerPort, settings.ServerConnectionPort, gameState);
     Console.ReadKey();
     System.Threading.Thread.Sleep(5000);
 }
开发者ID:virvar,项目名称:StillAlive,代码行数:9,代码来源:Program.cs

示例12: GetGameConfiguration

 public void GetGameConfiguration(Action<Response<GameConfiguration>> callback)
 {
     var payload = new Dictionary<string, object>(0);
      var communicator = new Communicator(this);
      communicator.SendPayload<GameConfiguration>(Communicator.POST, "conf", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<GameConfiguration>(r.Raw); }
     callback(r);
      });
 }
开发者ID:intfrr,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs

示例13: PingTimesForm

        public PingTimesForm(Communicator comm)
        {
            InitializeComponent();
            _pingTimes.ClearData(ClearDataFlag.Values);
            _pingTimes.AxisX.Min = 0;

            Text += ": " + comm;
            _observed = comm;
            _statsObserver = CommunicationStatisticsObserver<Communicator>.On(comm);
        }
开发者ID:briandealwis,项目名称:gt,代码行数:10,代码来源:PingTimesForm.cs

示例14: AchievementEarned

 public void AchievementEarned(string achievementId, string userName, string uniqueIdentifier, Action<Response<Achievement>> callback)
 {
     var payload = new Dictionary<string, object> { { "aid", achievementId }, { "username", userName }, { "userkey", uniqueIdentifier } };
      var communicator = new Communicator(this);
      communicator.SendPayload<Achievement>(Communicator.Post, "achievements", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<Achievement>(r.Raw); }
     if (callback != null) { callback(r); }
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs

示例15: GetAssets

 public void GetAssets(Action<Response<IList<Asset>>> callback)
 {
     var payload = new Dictionary<string, object> {{"key", Key}};
      var communicator = new Communicator(this);
      communicator.SendPayload<IList<Asset>>(Communicator.Get, "assets", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<IList<Asset>> (r.Raw); }
     if (callback != null) { callback(r); }
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs


注:本文中的Communicator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。