Exemplo n.º 1
0
        private IEnumerator Start()
        {
            yield return(new WaitForSeconds(0.2f));

            UIMgr.OpenPanel(PanelName, Level);

            mOtherPanels.ForEach(panelTesterInfo => { UIMgr.OpenPanel(panelTesterInfo.PanelName, panelTesterInfo.Level); });
        }
Exemplo n.º 2
0
        public void Init(IUIData uiData = null)
        {
            mUIData = uiData;
            InitUI(uiData);
            RegisterUIEvent();

            mSubPanelInfos.ForEach(subPanelInfo => UIMgr.OpenPanel(subPanelInfo.PanelName, subPanelInfo.Level));
        }
Exemplo n.º 3
0
 /// <summary>
 /// 绑定跳转逻辑
 /// </summary>
 /// <param name="selfPanel"></param>
 /// <param name="btn"></param>
 /// <typeparam name="T"></typeparam>
 public static Action Transition <TDstPanel>(this UIPanel selfBehaviour, IUIData uidata = null) where TDstPanel : UIPanel
 {
     return(() =>
     {
         UIMgr.ClosePanel(selfBehaviour.name);
         UIMgr.OpenPanel <TDstPanel>(uidata);
     });
 }
Exemplo n.º 4
0
 /// <summary>
 /// 绑定跳转逻辑
 /// </summary>
 /// <param name="selfPanel"></param>
 /// <param name="btn"></param>
 /// <typeparam name="T"></typeparam>
 public static void BindTransition <TSrcPanel, TDstPanel>(this Button btn) where TSrcPanel : QUIBehaviour
     where TDstPanel : QUIBehaviour
 {
     btn.onClick.AddListener(() =>
     {
         UIMgr.HidePanel <TSrcPanel>();
         UIMgr.OpenPanel <TDstPanel>();
     });
 }
Exemplo n.º 5
0
 /// <summary>
 /// 绑定跳转逻辑
 /// </summary>
 /// <param name="selfPanel"></param>
 /// <param name="btn"></param>
 /// <typeparam name="T"></typeparam>
 public static void BindTransition <TSrcPanel, TDstPanel>(this Button btn) where TSrcPanel : UIPanel
     where TDstPanel : UIPanel
 {
     btn.onClick.AddListener(() =>
     {
         UIMgr.ClosePanel <TSrcPanel>();
         UIMgr.OpenPanel <TDstPanel>();
     });
 }
Exemplo n.º 6
0
        private void StartResquestForBind(String deviceId)
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("deviceId", deviceId);
            paramDict.Add("userId", PlayerPrefsUtil.GetUserId());
            HttpUtil.PostWithSign <BindResultModel>(UrlConst.Bind, paramDict)
            .Subscribe(response =>
            {
                if (response.bindRelation == 1)
                {
                    UIMgr.OpenPanel <TipPanel>(new TipPanelData()
                    {
                        action             = TipAction.BindDevice,
                        message            = "该账号已绑定其他设备,\n如需绑定当前设备,需解绑后重新绑定",
                        isHideCancelButton = true,
                        strConfirm         = "知道了"
                    });
                    StopAllCoroutines();
                }
                else
                {
                    ConnectResult(true);
                    StopAllCoroutines();
                }

                /**
                 * 停止播放音频
                 */
                if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    IOSClientUtil.StopBindDevice("");
                }
                else if (Application.platform == RuntimePlatform.Android)
                {
                    AndroidForUnity.CallAndroidForStopDeviceConnect();
                }
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    ConnectResult(false);
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
Exemplo n.º 7
0
        public static void DoTransition <TDstPanel>(this UIPanel selfBehaviour, UITransition transition,
                                                    UILevel uiLevel        = UILevel.Common,
                                                    IUIData uiData         = null,
                                                    string assetBundleName = null,
                                                    string prefabName      = null) where TDstPanel : UIPanel
        {
            transition.FromPanel   = selfBehaviour;
            transition.InCompleted = () =>
            {
                UIMgr.OpenPanel <TDstPanel>(uiLevel, uiData, assetBundleName, prefabName);
            };


            UIMgr.OpenPanel <UITransitionPanel>(UILevel.Forward, new UITransitionPanelData()
            {
                Transition = transition
            }, prefabName: "Resources/UITransitionPanel");
        }
Exemplo n.º 8
0
        /// <summary>
        /// 关闭,不允许子类调用
        /// </summary>
        void IPanel.Close(bool destroyed)
        {
            PanelInfo.UIData = mUIData;
            mOnClosed.InvokeGracefully();
            mOnClosed = null;

            OnClose();
            if (destroyed)
            {
                Destroy(gameObject);
            }

            mPanelLoader.Unload();
            mPanelLoader = null;
            mUIData      = null;

            mSubPanelInfos.ForEach(subPanelInfo => UIMgr.ClosePanel(subPanelInfo.PanelName));
            mSubPanelInfos.Clear();
        }
Exemplo n.º 9
0
        private IEnumerator Start()
        {
            UIMgr.OpenPanel <UIMsg>();

            mHostIp = NetworkUtil.GetAddressIP();

            mSocketServer = FlexiSocket.Create(1366, Protocols.BodyLengthPrefix, false);
            mSocketServer.ClientConnected += delegate(ISocketClientToken client)
            {
                Log.I("OnClientConnected ID:{0} Count:{1}", client.ID, mSocketServer.Clients.Count);
            };
            mSocketServer.SentToClient += delegate(bool success, ISocketClientToken client)
            {
                if (success)
                {
                }
            };

            mSocketServer.ReceivedFromClient += delegate(ISocketClientToken client, byte[] message)
            {
                SocketMsg msg = SerializeHelper.FromProtoBuff <SocketMsg>(message);
                mMessage = msg.msgId + ":" + msg.ToEventID;
                if (!string.IsNullOrEmpty(msg.Msg))
                {
                    mMessage += ":" + msg.Msg;
                }
                Log.I("OnReceivedFromClient:{0}", mMessage);
                mMsgQueue.Enqueue(msg);
            };

            mSocketServer.ClientDisconnected += delegate(ISocketClientToken client)
            {
            };
            mSocketServer.StartListen(10);

            yield return(0);
        }
Exemplo n.º 10
0
        protected override void OnInit(QFramework.IUIData uiData)
        {
            mData = uiData as ConnectDevicePanelData ?? new ConnectDevicePanelData();
            Meteors.transform.DOLocalMoveX(-2370, 5f).SetLoops(-1, LoopType.Restart);
            Meteors.transform.DOLocalMoveY(-470, 5f).SetLoops(-1, LoopType.Restart);

            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("ssid", mData.SSIDStr);
            param.Add("password", mData.SSIDPWD);
            param.Add("token", PlayerPrefsUtil.GetToken());
            param.Add("userId", PlayerPrefsUtil.GetUserId());
            if (Application.platform == RuntimePlatform.Android)
            {
                AndroidForUnity.CallAndroidForStartDeviceConnect(mData.SSIDStr, mData.SSIDPWD);
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                IOSClientUtil.StartBindDevice(param.ToJson());
            }

            StartCoroutine(CountDown());

            BtnBack.OnClickAsObservable().Subscribe(_ =>
            {
                UIMgr.OpenPanel <TipPanel>(new TipPanelData()
                {
                    action     = TipAction.BindingBack,
                    message    = "返回后联网将不在继续,确认终止操作?",
                    strConfirm = "确定",
                    strCancel  = "继续等待",
                    strTitle   = "终止配网",
                });
            }).AddTo(this);

            BtnCheckWiFi.OnClickAsObservable().Subscribe(_ =>
            {
                UIMgr.OpenPanel <BindCheckWIFIPanel>(new BindCheckWIFIPanelData(), UITransitionType.NULL);
            }).AddTo(this);

            SimpleEventSystem.GetEvent <BindDeviceResult>().Subscribe(res =>
            {
                BindDeviceModel model = res.Model;

                if (Application.platform == RuntimePlatform.Android)
                {
                    if (model.status == 1)
                    {
                        StartResquestForBind(model.deviceId);
                    }
                    else
                    {
                        ConnectResult(false);
                    }
                }
                else if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    if (model.requestTag == 2 && model.deviceId.IsNotNullAndEmpty())
                    {
                        StartResquestForBind(model.deviceId);
                    }

                    if (model.requestTag == 1)
                    {
                        CommonUtil.toast("获取音频接口出错");
                    }
                }
            }).AddTo(this);

            SimpleEventSystem.GetEvent <TipConfirmClick>()
            .Subscribe(_ =>
            {
                if (_.GetAction == TipAction.BindDevice)
                {
                    ShowMainPanel();
                }
                else if (_.GetAction == TipAction.BindingBack)
                {
                    StopAllCoroutines();
                    if (Application.platform == RuntimePlatform.IPhonePlayer)
                    {
                        IOSClientUtil.StopBindDevice("");
                    }
                    else if (Application.platform == RuntimePlatform.Android)
                    {
                        AndroidForUnity.CallAndroidForStopDeviceConnect();
                    }
                    Back();
                }
            }).AddTo(this);
        }