Ejemplo n.º 1
0
 public static void LoadImage(string url, bool isCacheInMemory, uint callId)
 {
     AssetManager.GetImage(url, isCacheInMemory, delegate(Texture2D texture)
     {
         CSharpInterface.OnLoadAsset(url, texture, callId);
     });
 }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 public static void LoadGameObject(string url, bool isCacheInMemory, uint callId)
 {
     AssetManager.GetGameObject(url, isCacheInMemory, delegate(GameObject gameObject)
     {
         CSharpInterface.OnLoadAsset(url, gameObject, callId);
     });
 }
Ejemplo n.º 4
0
 public static void CreatePanel(uint callId, string panelName)
 {
     PanelManager.CreatePanel(panelName, delegate(int returnCode)
     {
         CSharpInterface.OnCreatePanel(panelName, callId, returnCode);
     });
 }
Ejemplo n.º 5
0
 public static void LoadWww(string url, string requestJson, bool isPost, uint callId)
 {
     AssetManager.LoadWww(url, requestJson, isPost, delegate(string response)
     {
         CSharpInterface.OnLoadWww(response, callId);
     });
 }
Ejemplo n.º 6
0
 private void HandlePushMessage(uint callId, int commandId, string message)
 {
     if (commandId == 1003)
     {
         CSharpInterface.ExecuteLuaCallback(0u, message);
     }
 }
Ejemplo n.º 7
0
 public static void LoadAssetBundle(string url, uint callId)
 {
     AssetManager.GetAssetBundle(url, delegate(AssetBundle assetBundle)
     {
         CSharpInterface.OnLoadAsset(url, assetBundle, callId);
     });
 }
Ejemplo n.º 8
0
 public static void ShowImage(string panelName, string url, GameObject go, bool isCacheInMemory, uint callId)
 {
     PanelManager.ShowImage(panelName, url, go, isCacheInMemory, delegate(int returnCode)
     {
         CSharpInterface.OnShowImage(panelName, url, callId, returnCode);
     });
 }
Ejemplo n.º 9
0
        private static void OnLoadWww(string response, uint callId)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary["Resp"]    = response;
            dictionary["RetCode"] = ((!string.IsNullOrEmpty(response)) ? "0" : "-1");
            CSharpInterface.ExecuteLuaCallback(callId, dictionary);
        }
Ejemplo n.º 10
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)
         {
             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());
     }
 }
Ejemplo n.º 11
0
        private static void OnShowImage(string panelName, string url, uint callId, int returnCode)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary["PanelName"] = panelName;
            dictionary["Url"]       = url;
            dictionary["RetCode"]   = returnCode.ToString();
            CSharpInterface.ExecuteLuaCallback(callId, dictionary);
        }
Ejemplo n.º 12
0
 public void CloseAllPanel()
 {
     Logger.DEBUG(string.Empty);
     if (this.luaMgrInited)
     {
         Logger.DEBUG(string.Empty);
         CSharpInterface.NotifyCloseAllPanel();
     }
 }
Ejemplo n.º 13
0
        private static void OnCreatePanel(string panelName, uint callId, int returnCode)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary["PanelName"] = panelName;
            dictionary["RetCode"]   = returnCode.ToString();
            CSharpInterface.ExecuteLuaCallback(callId, dictionary);
            Pandora.Instance.CallGame(Json.Serialize(dictionary));
        }
Ejemplo n.º 14
0
        private static void OnLoadAsset(string url, UnityEngine.Object obj, uint callId)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary["Type"]    = obj.GetType().ToString();
            dictionary["Url"]     = url;
            dictionary["RetCode"] = ((!(obj != null)) ? 1 : 0);
            CSharpInterface.ExecuteLuaCallback(callId, dictionary);
        }
        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);
        }
Ejemplo n.º 16
0
        public static GameObject CloneAndAddToParent(GameObject template, string name, GameObject parent)
        {
            if (template == null)
            {
                Logger.LogError("源节点不存在");
                return(null);
            }
            GameObject gameObject = UnityEngine.Object.Instantiate(template) as GameObject;

            gameObject.name = name;
            CSharpInterface.SetParent(gameObject, parent);
            return(gameObject);
        }
Ejemplo n.º 17
0
 private void HandlePullMessage(uint callId, int commandId, string message)
 {
     this._hasHeartbeatResponse = true;
     if (commandId != 1001)
     {
         if (commandId != 1002)
         {
             if (commandId == 9000)
             {
                 CSharpInterface.ExecuteLuaCallback(callId, message);
             }
         }
     }
     else
     {
         this.EnterHeartbeatState();
     }
 }
        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);
        }
Ejemplo n.º 19
0
 public void Do(Dictionary <string, string> cmdDict)
 {
     try
     {
         Logger.DEBUG(string.Empty);
         if (cmdDict.ContainsKey("type") && cmdDict.ContainsKey("content") && cmdDict.get_Item("type").Equals("inMainSence"))
         {
             if (cmdDict.get_Item("content").Equals("0"))
             {
                 if (this.netLogic != null)
                 {
                     this.netLogic.SetDownloadingPaused(true);
                 }
                 Logger.INFO("SetDownloadingPaused=true");
             }
             else
             {
                 if (this.netLogic != null)
                 {
                     this.netLogic.SetDownloadingPaused(false);
                 }
                 Logger.INFO("SetDownloadingPaused=false");
             }
         }
         if (this.luaMgrInited)
         {
             Logger.DEBUG(string.Empty);
             string jsonData = Json.Serialize(cmdDict);
             CSharpInterface.DoCmdFromGame(jsonData);
         }
     }
     catch (Exception ex)
     {
         Logger.ERROR(ex.get_Message());
     }
 }
Ejemplo n.º 20
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());
     }
 }
Ejemplo n.º 21
0
 private static string GetPanelAssetFullName(string name)
 {
     return(CSharpInterface.GetPlatformDescription() + "_" + name.ToLower() + ".assetbundle");
 }
Ejemplo n.º 22
0
 public void DoJson(string jsonStr)
 {
     CSharpInterface.GameCallLua(jsonStr);
 }
Ejemplo n.º 23
0
        internal static void ExecuteLuaCallback(uint callId, Dictionary <string, object> result)
        {
            string jsonStr = Json.Serialize(result);

            CSharpInterface.ExecuteLuaCallback(callId, jsonStr);
        }
Ejemplo n.º 24
0
 public void PayCallback(string jsonResult)
 {
     CSharpInterface.NotifyAndroidPayFinish(jsonResult);
 }
Ejemplo n.º 25
0
 public void Do(Dictionary <string, string> commandDict)
 {
     CSharpInterface.GameCallLua(Json.Serialize(commandDict));
 }