Пример #1
0
        private void OnConfigLoadFailure(string msg)
        {
            Hashtable hashtable = new Hashtable();

            hashtable["message"] = msg;
            AWEvent evt = new AWEvent(AWEvent.CONFIG_LOAD_FAILURE, hashtable);

            this.dispatcher.DispatchEvent(evt);
        }
        private void OnS2C_FightBegin(ProtoBuf.IExtensible msg)
        {
            clientmsg.s2c_fightbegin fightbegin = msg as clientmsg.s2c_fightbegin;
            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = fightbegin;
            AWEvent evt = new AWEvent(AWEvent.S2C_FIGHTBEGIN, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_MyHero(ProtoBuf.IExtensible msg)
        {
            clientmsg.s2c_myhero myhero    = msg as clientmsg.s2c_myhero;
            Hashtable            hashtable = new Hashtable();

            hashtable["protomsg"] = myhero;
            AWEvent evt = new AWEvent(AWEvent.S2C_MYHERO, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_IntoemBattle(ProtoBuf.IExtensible msg)
        {
            clientmsg.s2c_intoembattle intoembattle = msg as clientmsg.s2c_intoembattle;
            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = intoembattle;
            AWEvent evt = new AWEvent(AWEvent.S2C_INTOEMBATTLE, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_IntoLevels(ProtoBuf.IExtensible msg)
        {
            clientmsg.s2c_intolevels intolevels = msg as clientmsg.s2c_intolevels;
            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = intolevels;
            AWEvent evt = new AWEvent(AWEvent.S2C_INTOLEVELS, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_IntoDungeon(ProtoBuf.IExtensible msg)
        {
            clientmsg.s2c_intodungeon intodungeon = msg as clientmsg.s2c_intodungeon;
            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = intodungeon;
            AWEvent evt = new AWEvent(AWEvent.S2C_INTODUNGEON, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_IntoMainWorld(ProtoBuf.IExtensible msg)
        {
            clientmsg.s2c_intomainworld intomainworld = msg as clientmsg.s2c_intomainworld;
            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = intomainworld;
            AWEvent evt = new AWEvent(AWEvent.S2C_INTOMAINWORLD, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_CreateChar(ProtoBuf.IExtensible msg)
        {
            UnityEngine.Debug.Log("SystemProtoBufController--------->OnS2C_CreateChar");
            clientmsg.s2c_createchar createchar = msg as clientmsg.s2c_createchar;
            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = createchar;
            AWEvent evt = new AWEvent(AWEvent.S2C_CREATECHAR, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_BeginGame(ProtoBuf.IExtensible msg)
        {
            UnityEngine.Debug.Log("SystemProtoBufController-------->OnS2C_ResponseLoginGame");
            clientmsg.s2c_begingame logingame = msg as clientmsg.s2c_begingame;
            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = logingame;
            AWEvent evt = new AWEvent(AWEvent.S2C_BEGINGAME, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_ResponseProofTime(ProtoBuf.IExtensible msg)
        {
            UnityEngine.Debug.Log("SystemProtoBufController------>OnS2C_ResponseProofTime");
            clientmsg.S2CProofTime prooftime = msg as clientmsg.S2CProofTime;
            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = prooftime;
            AWEvent evt = new AWEvent(AWEvent.RESPONSE_PROOFTIME, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="msg"></param>
        private void OnS2C_Login(ProtoBuf.IExtensible msg)
        {
            UnityEngine.Debug.Log("SystemProtoBufController------>OnS2C_LoginResponse()");
            clientmsg.s2c_login loginResponse = msg as clientmsg.s2c_login;

            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = loginResponse;
            AWEvent evt = new AWEvent(AWEvent.LOGIN, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_ResponseMailContent(ProtoBuf.IExtensible msg)
        {
            UnityEngine.Debug.Log("SystemProtoBufController------>OnS2C_ResponseMailContent");
            clientmsg.SendMailContent mailcontent = msg as clientmsg.SendMailContent;
            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = mailcontent;

            AWEvent evt = new AWEvent(AWEvent.RESPONSE_MAILCONTENT, hashtable);

            this.sfs.DispatchEvent(evt);
        }
        private void OnS2C_ResponseInitChar(ProtoBuf.IExtensible msg)
        {
            UnityEngine.Debug.Log("SystemProtoBufController------>OnS2C_ResponseInitChar");
            clientmsg.s2c_initchar clientinit = msg as clientmsg.s2c_initchar;
            Hashtable hashtable = new Hashtable();

            //if (clientinit.result == common.enumGetCharResult.Response_Success)
            {
                hashtable["protomsg"] = clientinit;
                AWEvent evt = new AWEvent(AWEvent.S2C_INITCHAR, hashtable);
                this.sfs.DispatchEvent(evt);
            }
        }
Пример #14
0
        private void OnConfigLoadFailure(BaseEvent e)
        {
            AWEvent sFSEvent = e as AWEvent;

            this.log.Error(new string[]
            {
                "Failed to load config: " + (string)sFSEvent.Params["message"]
            });
            ConfigLoader configLoader = sFSEvent.Target as ConfigLoader;

            configLoader.Dispatcher.RemoveEventListener(AWEvent.CONFIG_LOAD_SUCCESS, new EventListenerDelegate(this.OnConfigLoadSuccess));
            configLoader.Dispatcher.RemoveEventListener(AWEvent.CONFIG_LOAD_FAILURE, new EventListenerDelegate(this.OnConfigLoadFailure));
            BaseEvent evt = new AWEvent(AWEvent.CONFIG_LOAD_FAILURE);

            this.DispatchEvent(evt);
        }
Пример #15
0
        private void OnConfigLoadSuccess(BaseEvent e)
        {
            AWEvent      sFSEvent     = e as AWEvent;
            ConfigLoader configLoader = sFSEvent.Target as ConfigLoader;
            ConfigData   configData   = sFSEvent.Params["cfg"] as ConfigData;

            configLoader.Dispatcher.RemoveEventListener(AWEvent.CONFIG_LOAD_SUCCESS, new EventListenerDelegate(this.OnConfigLoadSuccess));
            configLoader.Dispatcher.RemoveEventListener(AWEvent.CONFIG_LOAD_FAILURE, new EventListenerDelegate(this.OnConfigLoadFailure));
            this.ValidateConfig(configData);
            Hashtable hashtable = new Hashtable();

            hashtable["config"] = configData;
            BaseEvent evt = new AWEvent(AWEvent.CONFIG_LOAD_SUCCESS, hashtable);

            this.DispatchEvent(evt);
            if (this.autoConnectOnConfig)
            {
                this.Connect(this.config.Host, this.config.Port);
            }
        }
Пример #16
0
        private void TryParse()
        {
            ConfigData configData = new ConfigData();

            try
            {
                XMLNodeList xMLNodeList = this.rootNode["SmartFoxConfig"] as XMLNodeList;
                XMLNode     xMLNode     = xMLNodeList[0] as XMLNode;
                if (this.GetNodeText(xMLNode, "ip") == null)
                {
                    this.AiWanNet.Log.Error(new string[]
                    {
                        "Required config node missing: ip"
                    });
                }
                if (this.GetNodeText(xMLNode, "port") == null)
                {
                    this.AiWanNet.Log.Error(new string[]
                    {
                        "Required config node missing: port"
                    });
                }
                if (this.GetNodeText(xMLNode, "udpIp") == null)
                {
                    this.AiWanNet.Log.Error(new string[]
                    {
                        "Required config node missing: udpIp"
                    });
                }
                if (this.GetNodeText(xMLNode, "udpPort") == null)
                {
                    this.AiWanNet.Log.Error(new string[]
                    {
                        "Required config node missing: udpPort"
                    });
                }
                if (this.GetNodeText(xMLNode, "zone") == null)
                {
                    this.AiWanNet.Log.Error(new string[]
                    {
                        "Required config node missing: zone"
                    });
                }
                configData.Host    = this.GetNodeText(xMLNode, "ip");
                configData.Port    = Convert.ToInt32(this.GetNodeText(xMLNode, "port"));
                configData.UdpHost = this.GetNodeText(xMLNode, "udpIp");
                configData.UdpPort = Convert.ToInt32(this.GetNodeText(xMLNode, "udpPort"));
                configData.Zone    = this.GetNodeText(xMLNode, "zone");
                if (this.GetNodeText(xMLNode, "debug") != null)
                {
                    configData.Debug = (this.GetNodeText(xMLNode, "debug").ToLower() == "true");
                }
                if (this.GetNodeText(xMLNode, "useBlueBox") != null)
                {
                    configData.UseBlueBox = (this.GetNodeText(xMLNode, "useBlueBox").ToLower() == "true");
                }
                if (this.GetNodeText(xMLNode, "httpPort") != null && this.GetNodeText(xMLNode, "httpPort") != "")
                {
                    configData.HttpPort = Convert.ToInt32(this.GetNodeText(xMLNode, "httpPort"));
                }
                if (this.GetNodeText(xMLNode, "blueBoxPollingRate") != null && this.GetNodeText(xMLNode, "blueBoxPollingRate") != "")
                {
                    configData.BlueBoxPollingRate = Convert.ToInt32(this.GetNodeText(xMLNode, "blueBoxPollingRate"));
                }
            }
            catch (Exception ex)
            {
                this.OnConfigLoadFailure("Error parsing config file: " + ex.Message + " " + ex.StackTrace);
                return;
            }
            Hashtable hashtable = new Hashtable();

            hashtable["cfg"] = configData;
            AWEvent evt = new AWEvent(AWEvent.CONFIG_LOAD_SUCCESS, hashtable);

            this.dispatcher.DispatchEvent(evt);
        }