Exemple #1
0
        public void ConnectAsync(NpCloudSocketType type, string url, int timeOut, Action <bool> result, object option = null)
        {
            if (this.mCloudType != NpCloud.Type.None)
            {
                result(true);
                return;
            }
            this.mIsConnectAsync     = false;
            this.mConnectAsyncAction = result;
            Action connect = delegate()
            {
                Action <bool, Exception> result2 = delegate(bool flg, Exception e)
                {
                    this.ConnectResultAction(flg, e, result);
                };
                NpCloudSocketSystem.GetInstance().ConnectAsync(timeOut, result2, option);
                this.mCloudType = NpCloud.Type.Connecting;
            };

            if (!this.ConnectCore(type, url, connect))
            {
                this.mIsConnectAsync       = true;
                this.mIsConnectAsyncResult = false;
            }
        }
Exemple #2
0
        public bool Connect(NpCloudSocketType type, string url, int timeOut, object option = null)
        {
            if (this.mCloudType != NpCloud.Type.None)
            {
                return(true);
            }
            Action connect = delegate()
            {
                NpCloudSocketSystem instance = NpCloudSocketSystem.GetInstance();
                bool flag = false;
                global::Debug.Log("npCloudSocketSystem " + instance);
                if (instance != null)
                {
                    flag = instance.Connect(timeOut, option);
                }
                if (flag)
                {
                    this.mCloudType = NpCloud.Type.Idle;
                }
                else
                {
                    this.mCloudType = NpCloud.Type.Error;
                }
            };

            return(this.ConnectCore(type, url, connect));
        }