Example #1
0
        public SubClient(MsgPool <IpcMsg> pool, WarInfo war) : base(war)
        {
            ClientPool = pool;
            poller     = new Poller();

            establish();
        }
Example #2
0
        public RealServer(WarInfo war, Action RepBinded, Action PubBinded)
        {
            mWar = war;

            cached = ServerCached.Instance;
            cached.clear();

            RepBindCompleted = RepBinded;
            PubBindCompleted = PubBinded;

            monitor = new MonitorClient();
            monitor.startMonitor(mWar);

            EngineCfg engCfg = Core.EngCfg;

            cached.curServer = new ServerInfo()
            {
                IpAddr        = "127.0.0.1",
                PubPort       = engCfg.PubPort,
                PairPort      = engCfg.PairPort,
                HeartBeatPort = engCfg.HeartBeatPort,
                ServerName    = "Allen",
                ServerID      = DeviceInfo.GUID,
            };

            publisher = new PubServer(war, PubBindCompleted);
            Resper    = new ResponseServer(war, HandleMQMsg, RepBindCompleted);

            type      = GetType();
            c_bf      = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance;
            cmdMethod = new Dictionary <string, MethodInfo>();
            cachedMethod();

            proxyCli = new ProxyClient(-1, publisher);
        }
Example #3
0
 public void startMonitor(WarInfo war, Action HeartBeatDisConn)
 {
     if (war.warMo == WarMode.InLanWar)
     {
         mHeartBeatDisConn = HeartBeatDisConn;
         hbCli             = new HeartBeatClient(war, ServerTimeOut);
     }
 }
Example #4
0
 public void startMonitor(WarInfo war)
 {
     warInfo = war;
     if (warInfo.warMo == WarMode.InLanWar)
     {
         hbServer = new HeartBeatServer(warInfo, this);
     }
 }
Example #5
0
        public RequestClient(WarInfo war, Action <NetMQMessage> real, Action Connected) : base(war)
        {
            handler   = real;
            connected = false;

            establish(Connected);
            Pool = new MsgPool <NetMQMessage>(sendAndRecv);
        }
Example #6
0
        public HeartBeatServer(WarInfo war, MonitorClient climonitor) : base(war)
        {
            this.poller = new Poller();
            monitor     = climonitor;

            Msg = new NetMQMessage();
            Msg.Append(1);
            establish();
            //TimeOut = new t_Timer(new TimerCallback(TTimeOut), null, Timeout.Infinite, Timeout.Infinite);
        }
Example #7
0
        public HeartBeatClient(WarInfo war, Action disCon) : base(war)
        {
            isConnected    = false;
            OnDisconnected = disCon;
            CurTimeoutCnt  = 0;
            RepeatTimer    = new t_Timer(new TimerCallback(Beat), null, Timeout.Infinite, Timeout.Infinite);
            TimeOut        = new t_Timer(new TimerCallback(TTimeOut), null, Timeout.Infinite, Timeout.Infinite);

            msg = new NetMQMessage();
            msg.Append(0);
            msg.Append(DeviceInfo.GUID);

            establish();
        }
Example #8
0
        public void Init()
        {
            realCli.CtorEnvironment = creator.CreateMap;
            realCli.CtorNPC         = creator.CreateNpc;
            realCli.CreatHero       = creator.CreateHero;
            //creator.CreateUnVision();
            //creator.CreateNpcCache ();

            warInfo = realCli.war;

            ///
            /// 准备Team的信息
            ///
            clientTeam = new WarClientTeam(realCli);


            UIReadyInfo uiReady = new UIReadyInfo()
            {
                ClientID   = DeviceInfo.GUID,
                ClientName = "AW_Client",
            };

            string plainJoin = JSON.Instance.ToJSON(uiReady);

            realCli.proxyServer.UIReady(plainJoin);

            if (warInfo.warMo == WarMode.NativeWar)
            {
                ///
                /// 虚拟客户端
                ///
                uiReady = new UIReadyInfo()
                {
                    ClientID   = "-1",
                    ClientName = "AWClient",
                };

                plainJoin = JSON.Instance.ToJSON(uiReady);
                realCli.proxyServer.UIReady(plainJoin);
            }

            ///
            /// 创建默认的地图
            ///
            cached = ClientCached.Instance;
            creator.CreateMap(cached.map);
        }
Example #9
0
        public RealClient(WarInfo war)
        {
            this.war = war;

            cached = ClientCached.Instance;
            cached.clear();

            pool   = new MsgPool <IpcMsg>(HandleIpcMsg);
            CliSub = new SubClient(pool, war);

            monitor = new MonitorServer();
            monitor.startMonitor(this.war, HeartBeatDisConn);

            cliMonitor = new SimpleMonitorClient();

            proxyReady = false;
        }
Example #10
0
 public ResponseServer(WarInfo war, Func <NetMQMessage, NetMQMessage> real, Action BindEd) : base(war)
 {
     handler = real;
     poller  = new Poller();
     establish(BindEd);
 }
Example #11
0
 public PubServer(WarInfo war, Action binded) : base(war)
 {
     isBinded = false;
     establish(binded);
 }
Example #12
0
 public ProxyServer(WarInfo war, Action connected = null)
 {
     reqCli  = new RequestClient(war, HandleMQMsg, connected);
     FromRep = new Dictionary <string, Action <string> >();
 }
Example #13
0
 public BaseSsock(WarInfo war)
 {
     warInfo = war;
     EngCfg  = Core.EngCfg;
 }