Beispiel #1
0
 public bool ReceiveException(NpCloudErrorData error)
 {
     if (error.command.Equals("9100") || error.command.Equals("9102") || error.command.Equals("9105") || error.command.Equals("9101") || error.command.Equals("9106"))
     {
         this.mRequestException(error);
         return(true);
     }
     return(false);
 }
Beispiel #2
0
 public void OnRequestException(NpCloudErrorData error)
 {
     global::Debug.Log("resultCode: " + error.resultCode);
     global::Debug.Log("command : " + error.command);
     global::Debug.Log("resultMsg: " + error.resultMsg);
     global::Debug.Log("detail : " + error.detail);
     if (this.onRequestExceptionAction != null)
     {
         this.onRequestExceptionAction(error.resultCode, error.resultMsg);
     }
 }
        public void Update()
        {
            byte[] array = null;
            while (this.SocketInstance != null)
            {
                NPCloudReceiveParameter <NPCloudReceiveHashParaemter> requestParameter = this.SocketInstance.GetRequestParameter <NPCloudReceiveParameter <NPCloudReceiveHashParaemter> >(out array);
                if (requestParameter == null || array == null)
                {
                    break;
                }
                string[] array2 = requestParameter.command.Split(new char[]
                {
                    ':'
                });
                NPCloudReceiveParameter <NpCloudVenusErrorParameter> npcloudReceiveParameter = NpMessagePack.Unpack <NPCloudReceiveParameter <NpCloudVenusErrorParameter> >(array);
                NpCloudErrorData npCloudErrorData = new NpCloudErrorData();
                npCloudErrorData.command    = array2[1];
                npCloudErrorData.resultCode = requestParameter.resultCode;
                npCloudErrorData.resultMsg  = requestParameter.resultMsg;
                npCloudErrorData.venus      = npcloudReceiveParameter.body;
                if (requestParameter.resultCode == null || !requestParameter.resultCode.Equals("0"))
                {
                    if (requestParameter.resultCode == "406")
                    {
                        throw new NpCloudException(712, requestParameter.body.shardingServ);
                    }
                    for (int i = 0; i < this.mListenerlist.Count; i++)
                    {
                        if (this.mListenerlist[i].ReceiveException(npCloudErrorData))
                        {
                        }
                    }
                    this.mListener.OnRequestException(npCloudErrorData);
                }
                object receiveData = null;
                string text        = array2[1];
                if (text == null)
                {
                    goto IL_2EA;
                }
                if (NpCloudManager.< > f__switch$map0 == null)
                {
                    NpCloudManager.< > f__switch$map0 = new Dictionary <string, int>(8)
                    {
                        {
                            string.Empty,
                            0
                        },
                        {
                            "9100",
                            1
                        },
                        {
                            "9101",
                            1
                        },
                        {
                            "9102",
                            1
                        },
                        {
                            "9105",
                            1
                        },
                        {
                            "9106",
                            1
                        },
                        {
                            "9201",
                            2
                        },
                        {
                            "9202",
                            3
                        }
                    };
                }
                int num;
                if (!NpCloudManager.< > f__switch$map0.TryGetValue(text, out num))
                {
                    goto IL_2EA;
                }
                switch (num)
                {
                case 0:
                    if (array2[0].Equals(NpCloudValueType.send.ToString()))
                    {
                        NPCloudReceiveParameter <Dictionary <string, object> > npcloudReceiveParameter2 = NpMessagePack.Unpack <NPCloudReceiveParameter <Dictionary <string, object> > >(array);
                        this.mListener.OnResponse((int)npcloudReceiveParameter2.sender, npcloudReceiveParameter2.body);
                    }
                    else if (array2[0].Equals(NpCloudValueType.finduser.ToString()))
                    {
                        NPCloudReceiveParameter <NpCloudReceiveFindUserParameter> npcloudReceiveParameter3 = NpMessagePack.Unpack <NPCloudReceiveParameter <NpCloudReceiveFindUserParameter> >(array);
                        List <string> on = npcloudReceiveParameter3.body.on;
                        if (NpCloudManager.< > f__mg$cache0 == null)
                        {
                            NpCloudManager.< > f__mg$cache0 = new Converter <string, int>(int.Parse);
                        }
                        List <int>    on2 = on.ConvertAll <int>(NpCloudManager.< > f__mg$cache0);
                        List <string> off = npcloudReceiveParameter3.body.off;
                        if (NpCloudManager.< > f__mg$cache1 == null)
                        {
                            NpCloudManager.< > f__mg$cache1 = new Converter <string, int>(int.Parse);
                        }
                        List <int> off2 = off.ConvertAll <int>(NpCloudManager.< > f__mg$cache1);
                        this.mListener.OnFindUser(on2, off2);
                    }
                    continue;

                case 1:
                    receiveData = this.SocketInstance.Deserialize <NpCloudReceiveRoomParameter>(requestParameter.body.data);
                    break;

                case 2:
                    receiveData = NpMessagePack.Unpack <NPCloudReceiveParameter <string> >(array);
                    break;

                case 3:
                    receiveData = NpMessagePack.Unpack <NPCloudReceiveParameter <List <RoomMsgLog> > >(array);
                    break;

                case 4:
                    goto IL_2EA;

                default:
                    goto IL_2EA;
                }
IL_30C:
                for (int j = 0; j < this.mListenerlist.Count; j++)
                {
                    if (this.mListenerlist[j].Receive(array2[1], receiveData, requestParameter.resTime))
                    {
                    }
                }
                continue;
IL_2EA:
                NPCloudReceiveParameter <Dictionary <string, object> > npcloudReceiveParameter4 = NpMessagePack.Unpack <NPCloudReceiveParameter <Dictionary <string, object> > >(array);
                this.mListener.OnCtrlResponse(array2[1], npcloudReceiveParameter4.body);
                goto IL_30C;
            }
        }