Esempio n. 1
0
        /// <summary>
        /// 创建Server服务器,地址绑定成功后,使用PubSocket发布出去ServerReady信息,
        /// 客户端的SubSocket接收到信息后,开始链接Server服务器
        ///
        /// </summary>
        void WarBegin()
        {
            //War Data Model is passed by Lua(what ever)
            IWarModel warModel = new DebugModel();

            warInfo = new WarInfo()
            {
                warMo = WarMode.NativeWar,
                                #if Server
                Side = WarSide.ServerAndClient,
                RequiredClientCount = 2,

                Map       = warModel.getMap(),
                Charactor = warModel.getCharactor(WarCamp.FirstCamp),

                ServerIp = "127.0.0.1",
                                #else
                Side      = WarSide.OnlyClient,
                Charactor = warModel.getCharactor(WarCamp.SecondCamp),
                ServerIp  = "192.168.1.176",               //TODO : real ip (not loopback)
                                #endif
            };

            if (warInfo.Side == WarSide.ServerAndClient)            //启动server
            {
                Server = new RealServer(warInfo, ServerRepOk, ServerPubOK);
            }
            else             //启动client , 这个client不和服务器端在一个物理设备上
            {
                Client = new RealClient(warInfo);
            }
        }
Esempio n. 2
0
 public override void GetData()
 {
     if (_realClient == null)
     {
         _realClient = new RealClient();
     }
     _realClient.GetData();
 }
Esempio n. 3
0
        // Добавление нового клиента
        internal void Add()
        {
            var client  = Client.CreateRandom();
            var picture = NewPicture(client.AutoType);
            var real    = new RealClient(client, picture);

            queue.Add(real);
            panel.Controls.Add(picture);
            timer.Change(0, 10);
            RefreshQueue();
        }
Esempio n. 4
0
            }                                            // True - обслуживание клиента завершено, и он покидает окно

            // Конструктор
            internal Employee(RealClient _client, Point _destination, ListBox _box, Action _refreshQueue)
            {
                client       = _client.Key;
                picture      = _client.Value;
                destination  = _destination;
                messageBox   = _box;
                refreshQueue = _refreshQueue;

                if (rand == null)
                {
                    rand = new Random((int)(DateTime.Now.Ticks % int.MaxValue));
                }

                Awaiting = true;

                timer = new Timer(MovePicture, null, Timeout.Infinite, Timeout.Infinite);
            }
Esempio n. 5
0
 /// <summary>
 /// PublisherSocket准备好了
 /// </summary>
 void ServerPubOK()
 {
     //启动client, 这个客户端和服务器端在一个物理设备上
     Client = new RealClient(warInfo);
 }