コード例 #1
0
        public string CallGame(uint callId, LuaTable luatable)
        {
            string result2 = string.Empty;

            if (string.IsNullOrEmpty(luatable["type"].ToString()))
            {
                return(result2);
            }
            Logger.DEBUG(string.Concat(new object[]
            {
                "callId=",
                callId.ToString(),
                " type=",
                luatable["type"]
            }));
            Action <string> action = delegate(string result)
            {
                CSharpInterface.ExecCallback(callId, result);
            };
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            using (IDictionaryEnumerator enumerator = luatable.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    DictionaryEntry dictionaryEntry = (DictionaryEntry)enumerator.get_Current();
                    dictionary.Add(dictionaryEntry.get_Key().ToString(), dictionaryEntry.get_Value());
                }
            }
            if (this.callbackForCallGame != null)
            {
                result2 = this.callbackForCallGame.Invoke(dictionary, action);
            }
            return(result2);
        }
コード例 #2
0
ファイル: NetLogic.cs プロジェクト: TonyDongGuaPi/joework
 public void ProcessBrokerResponse(int status, Dictionary <string, object> content)
 {
     Logger.DEBUG(string.Empty);
     try
     {
         long num = (long)content.get_Item("type");
         if (num == 1L)
         {
             Logger.ERROR("recv invalid type[" + num.ToString() + "] from broker");
         }
         else if (num == 2L)
         {
             int  num2   = (int)((long)content.get_Item("cmd_id"));
             uint callId = (uint)((long)content.get_Item("seq_id"));
             int  num3   = num2;
             if (num3 != 5001)
             {
                 if (num3 != 9000)
                 {
                     Logger.ERROR("recv invalid cmdId[" + num2.ToString() + "] from broker");
                 }
                 else
                 {
                     Logger.DEBUG("recv lua request rsp, seqId[" + callId.ToString() + "]");
                     Dictionary <string, object> dictionary = Json.Deserialize(content.get_Item("body") as string) as Dictionary <string, object>;
                     dictionary.set_Item("netRet", 0);
                     string result = Json.Serialize(dictionary);
                     CSharpInterface.ExecCallback(callId, result);
                 }
             }
             else
             {
                 Logger.DEBUG("recv statistics rsp, seqId[" + callId.ToString() + "]");
                 string json = content.get_Item("body") as string;
                 Dictionary <string, object> dictionary2 = Json.Deserialize(json) as Dictionary <string, object>;
                 int num4 = (int)((long)dictionary2.get_Item("ret"));
                 if (num4 != 0)
                 {
                     Logger.ERROR(string.Concat(new object[]
                     {
                         "recv error statistics rsp, ret[",
                         num4.ToString(),
                         "] errMsg[",
                         dictionary2.get_Item("err_msg")
                     }) + "]");
                 }
             }
         }
         else
         {
             Logger.ERROR("recv invalid type[" + num.ToString() + "] from broker");
         }
     }
     catch (Exception ex)
     {
         Logger.ERROR(ex.get_StackTrace());
     }
 }
コード例 #3
0
        public static void ShowGameImg(int djType, int djID, GameObject go, uint callId)
        {
            int gameDjImage = Pandora.Instance.GetGameDjImage(go, djType, djID);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.set_Item("djType", djType.ToString());
            dictionary.set_Item("djID", djID.ToString());
            dictionary.set_Item("RetCode", gameDjImage.ToString());
            string result = Json.Serialize(dictionary);

            CSharpInterface.ExecCallback(callId, result);
        }
コード例 #4
0
        public static void CreatePanel(uint callId, string panelName)
        {
            Logger.DEBUG("callId=" + callId.ToString() + " panelName=" + panelName);
            PandoraImpl   pandoraImpl   = Pandora.Instance.GetPandoraImpl();
            Action <bool> onCreatePanel = delegate(bool status)
            {
                Dictionary <string, string> dictionary = new Dictionary <string, string>();
                dictionary.set_Item("RetCode", status ? "0" : "-1");
                dictionary.set_Item("PanelName", panelName);
                string result = Json.Serialize(dictionary);
                CSharpInterface.ExecCallback(callId, result);
                if (!status)
                {
                    Logger.ERROR(string.Empty);
                    pandoraImpl.DestroyPanel(panelName);
                }
            };

            pandoraImpl.CreatePanel(panelName, onCreatePanel);
        }
コード例 #5
0
 public void ProcessBrokerResponse(int status, Dictionary <string, object> content)
 {
     Logger.DEBUG(string.Empty);
     try
     {
         long num = (long)content.get_Item("type");
         if (num == 1L)
         {
             int  num2   = (int)((long)content.get_Item("cmd_id"));
             uint callId = (uint)((long)content.get_Item("seq_id"));
             int  num3   = num2;
             if (num3 != 1003)
             {
                 Logger.ERROR("recv invalid type[" + num.ToString() + "] from broker");
             }
             else
             {
                 Logger.DEBUG("recv push req from broker, req: " + Json.Serialize(content));
                 string text = Json.Serialize(content.get_Item("body"));
                 Dictionary <string, object> dictionary = Json.Deserialize(text) as Dictionary <string, object>;
                 Dictionary <string, object> headDict   = dictionary.get_Item("head") as Dictionary <string, object>;
                 string brokerPushRsp = this.GetBrokerPushRsp(headDict);
                 Logger.DEBUG("Send push rsp to broker, rsp=" + brokerPushRsp);
                 this.CallBroker(callId, brokerPushRsp, 1003, 2, 9000);
                 CSharpInterface.NotifyPushData(text);
             }
         }
         else if (num == 2L)
         {
             int  num4    = (int)((long)content.get_Item("cmd_id"));
             uint callId2 = (uint)((long)content.get_Item("seq_id"));
             int  num5    = num4;
             if (num5 != 1001)
             {
                 if (num5 != 1002)
                 {
                     if (num5 != 5001)
                     {
                         if (num5 != 9000)
                         {
                             Logger.ERROR("recv invalid cmdId[" + num4.ToString() + "] from broker");
                         }
                         else
                         {
                             Logger.DEBUG("recv lua request rsp, seqId[" + callId2.ToString() + "]");
                             Dictionary <string, object> dictionary2 = Json.Deserialize(content.get_Item("body") as string) as Dictionary <string, object>;
                             dictionary2.set_Item("netRet", 0);
                             string result = Json.Serialize(dictionary2);
                             CSharpInterface.ExecCallback(callId2, result);
                         }
                     }
                     else
                     {
                         Logger.DEBUG("recv statistics rsp, seqId[" + callId2.ToString() + "]");
                         string json = content.get_Item("body") as string;
                         Dictionary <string, object> dictionary3 = Json.Deserialize(json) as Dictionary <string, object>;
                         int num6 = (int)((long)dictionary3.get_Item("ret"));
                         if (num6 != 0)
                         {
                             Logger.ERROR(string.Concat(new object[]
                             {
                                 "recv error statistics rsp, ret[",
                                 num6.ToString(),
                                 "] errMsg[",
                                 dictionary3.get_Item("err_msg")
                             }) + "]");
                         }
                     }
                 }
                 else
                 {
                     Logger.DEBUG("recv heartbeat rsp from broker, rsp:" + Json.Serialize(content));
                     this.FinishRecvBrokerHeartbeatRsp();
                 }
             }
             else
             {
                 Logger.DEBUG("recv login rsp from broker, rsp:" + Json.Serialize(content));
                 Dictionary <string, object> dictionary4 = Json.Deserialize(content.get_Item("body") as string) as Dictionary <string, object>;
                 if ((int)((long)dictionary4.get_Item("ret")) == 0)
                 {
                     this.hasLoginBroker = true;
                     this.FinishRecvBrokerHeartbeatRsp();
                 }
                 else
                 {
                     Logger.ERROR("login failed, rsp: " + Json.Serialize(content));
                 }
             }
         }
         else
         {
             Logger.ERROR("recv invalid type[" + num.ToString() + "] from broker");
         }
     }
     catch (Exception ex)
     {
         Logger.ERROR(ex.get_StackTrace());
     }
 }