Exemplo n.º 1
0
 public void SetUserInfo(string strJson)
 {
     try
     {
         stopConnectAll = false;
         Debug.Log("Pandora SetPara");
         Dictionary <string, object> dictionary = Json.Deserialize(strJson) as Dictionary <string, object>;
         Dictionary <string, string> dicPara    = new Dictionary <string, string>();
         foreach (KeyValuePair <string, object> pair in dictionary)
         {
             dicPara.Add(pair.Key, pair.Value as string);
         }
         string str = string.Empty;
         if (dictionary.ContainsKey("sRoleId"))
         {
             str = dictionary["sRoleId"].ToString();
         }
         if (str.Equals(string.Empty))
         {
             com.tencent.pandora.Logger.d("role is empty");
         }
         CUserData.SetPara(dicPara);
         if (Configer.strCtrFlagTotalSwitch.Equals(string.Empty))
         {
             com.tencent.pandora.Logger.d("InitSocket");
             NetProxcy.GetInstance().InitSocket();
         }
     }
     catch (Exception exception)
     {
         com.tencent.pandora.Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace);
     }
 }
Exemplo n.º 2
0
        public static void Do(string strJson)
        {
            Dictionary <string, object> dictionary = null;

            try
            {
                dictionary = Json.Deserialize(strJson) as Dictionary <string, object>;
                if ((dictionary.ContainsKey("type") && dictionary.ContainsKey("content")) && dictionary["type"].Equals("inMainSence"))
                {
                    if (dictionary["content"].Equals("0"))
                    {
                        com.tencent.pandora.Logger.d("停止下载");
                        NetProxcy.PandoraLibDownloadControl(false);
                        setNoUpdateFlag(true);
                    }
                    else
                    {
                        com.tencent.pandora.Logger.d("恢复下载");
                        NetProxcy.PandoraLibDownloadControl(true);
                        setNoUpdateFlag(false);
                    }
                }
            }
            catch (Exception exception)
            {
                com.tencent.pandora.Logger.d("协议无法解析:" + strJson + "," + exception.Message);
                NotificationCenter.DefaultCenter().PostNotification(null, "PraseCmdFail", strJson);
                return;
            }
            object[] args = new object[] { strJson };
            Util.CallMethod("commonlib", "DoCmdFromGame", args);
        }
Exemplo n.º 3
0
        public void SetUserInfo(Dictionary <string, string> dicPara)
        {
            stopConnectAll = false;
            FileUtils.InitPath();
            string str = string.Empty;

            if (dicPara.ContainsKey("sRoleId"))
            {
                str = dicPara["sRoleId"].ToString();
            }
            if (str.Equals(string.Empty))
            {
                com.tencent.pandora.Logger.d("role is empty");
            }
            CUserData.SetPara(dicPara);
            if (Configer.strCtrFlagTotalSwitch.Equals(string.Empty))
            {
                com.tencent.pandora.Logger.d("InitSocket");
                NetProxcy.GetInstance().InitSocket();
            }
            else
            {
                object[] args = new object[] { string.Empty };
                Util.CallMethod("commonlib", "ReSetUserInfo", args);
            }
        }
Exemplo n.º 4
0
 public static NetProxcy GetInstance()
 {
     if (instance == null)
     {
         instance = new NetProxcy();
     }
     return(instance);
 }
Exemplo n.º 5
0
 private void OnApplicationQuit()
 {
     stopConnectAll = true;
     try
     {
         NetProxcy.CloseSocket();
     }
     catch (Exception exception)
     {
         com.tencent.pandora.Logger.d(exception.Message);
     }
     com.tencent.pandora.Logger.d("Pandora OnApplicationQuit");
     instance   = null;
     pandora_gm = null;
 }
Exemplo n.º 6
0
 private void Update()
 {
     if (!stopConnectAll && !NotDoUpdate)
     {
         if ((NetProxcy.listInfoSO.Count > 0) && Pdr.isInitUlua)
         {
             com.tencent.pandora.Logger.d("begin to send jsonactdata to lua");
             NetProxcy.infoFromSo so   = NetProxcy.listInfoSO.Dequeue() as NetProxcy.infoFromSo;
             object[]             args = new object[] { so.jsonFromSO, so.jsonFromSOLength, so.iFlagSO };
             Util.CallMethod("commonlib", "CsharpToLuaCallBack", args);
         }
         if (NetProxcy.GetCallBackData(new NetProxcy.CallBack(NetProxcy.DoCallBack)) == 0)
         {
         }
     }
 }
Exemplo n.º 7
0
 public static void LogNet(int iErrorCode, string strMsg)
 {
     if (!Pandora.stopConnectAll)
     {
         try
         {
             if (strMsg.Length > 600)
             {
                 strMsg = strMsg.Substring(0, 600);
             }
             NetProxcy.SendLogReport(1, 1, iErrorCode, strMsg);
         }
         catch (Exception)
         {
             LogText(DEBUG, strMsg);
         }
     }
 }
Exemplo n.º 8
0
 public static void LogOutAccount()
 {
     try
     {
         Configer.strCtrFlagTotalSwitch = string.Empty;
         stopConnectAll = false;
         NetProxcy.CloseSocket();
         if (Pdr.isInitUlua)
         {
             object[] args = new object[] { string.Empty };
             Util.CallMethod("commonlib", "ChangeRole", args);
         }
     }
     catch (Exception exception)
     {
         com.tencent.pandora.Logger.LogNetError(Configer.iCodeCSException, exception.Message);
     }
 }
Exemplo n.º 9
0
 public void BuyGoods(string strGoodsId, string iActionId, string payType, int iNum)
 {
     try
     {
         int iFlag = 8;
         com.tencent.pandora.Logger.d("start to buy goods:" + strGoodsId);
         int    iCostType = 2;
         string sData     = new CReqInfoDataBuilder().getGPMBuyPayReqJson(iActionId, iCostType, payType, strGoodsId, iNum);
         com.tencent.pandora.Logger.d("GPM PAY:" + sData);
         com.tencent.pandora.Logger.d("strJson.Length:" + sData.Length);
         com.tencent.pandora.Logger.d("get GpmPay return:" + NetProxcy.GpmPay(sData, sData.Length, iFlag));
     }
     catch (Exception exception)
     {
         com.tencent.pandora.Logger.e("error2:" + exception.Message);
         com.tencent.pandora.Logger.e(exception.StackTrace);
     }
 }
Exemplo n.º 10
0
 public static void SendPandoraLibCmd(int iCmdId, string sData, int iLength, int iFlag)
 {
     NetProxcy.SendPandoraLibCmd(iCmdId, sData, iLength, iFlag);
 }