IEnumerator ResLoad()
        {
            GF.ShowView <LoadingView>();

            GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_UI, 0));
            yield return(new WaitForSeconds(0.2f));

            GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_UI, 15));
            yield return(new WaitForSeconds(0.2f));

            GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_UI, 30));
            yield return(new WaitForSeconds(0.1f));

            GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_UI, 45));
            yield return(new WaitForSeconds(0.1f));

            OnLoadFinished();
        }
        public override void Update()
        {
            if (!m_lastConnected && GF.GetProxy <SosProxy>().isConnected)
            {
                GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_WAIT_LOGIN, 70));
            }
            m_lastConnected = GF.GetProxy <SosProxy>().isConnected;

            if (!m_lastLogin && GF.GetProxy <SosProxy>().isLogin)
            {
                GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.GENRAL_START, 98));
                Task.WaitFor(1f, () =>
                {
                    GF.ChangeState <BattleState>();
                });
            }
            m_lastLogin = GF.GetProxy <SosProxy>().isLogin;
        }
Exemple #3
0
 private void Connect()
 {
     GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_WAIT_RESPONSE, 50));
     GF.GetProxy <HallProxy>().Connect();
     Task.WaitFor(3f, () =>
     {
         if (!GF.GetProxy <HallProxy>().isConnected)
         {
             MessageBox.Show("连接失败", "连接服务器失败,是否重新连接?", MessageBoxStyle.OKClose
                             , (result) =>
             {
                 if (result.result == MessageBoxResultType.OK)
                 {
                     Connect();
                 }
             });
         }
     });
 }
Exemple #4
0
        public void Connect()
        {
            m_needReconnnect = false;
            network.Connect();

            Task.WaitFor(3f, () =>
            {
                if (!GF.GetProxy <HallProxy>().isConnected)
                {
                    MessageBox.Show("连接失败", "连接服务器失败,是否重新连接?", MessageBoxStyle.OKClose
                                    , (result) =>
                    {
                        if (result.result == MessageBoxResultType.OK)
                        {
                            Connect();
                        }
                    });
                }
            });
        }
Exemple #5
0
 void OnMatchSuccess(CMMatchSuccess msg)
 {
     battleServerInfo = msg.BattleServerInfo;
     SendEvent(EventDef.MatchSuccess);
     GF.ChangeState <BattleLoadingState>();
 }
Exemple #6
0
 private void Connect()
 {
     GF.Send(EventDef.HallLoading, new LoadingStatus(LTKey.LOADING_WAIT_RESPONSE, 50));
     GF.GetProxy <HallProxy>().Connect();
 }
Exemple #7
0
 public void UnRegister <T>(string eventName, Action <T> callback)
 {
     GF.UnRegister(eventName, callback);
 }
Exemple #8
0
 public void Register(string eventName, Action callback)
 {
     GF.Register(eventName, callback);
     registedEvents.Add(new RegistedEvent(eventName, callback.Target.GetHashCode()));
 }
Exemple #9
0
 public void SendEvent <T>(string eventName, T evtBody)
 {
     GF.Send(eventName, evtBody);
 }
Exemple #10
0
 public void SendEvent(string eventName, object obj = null)
 {
     GF.Send(eventName, obj);
 }
Exemple #11
0
 public override void Enter(params object[] param)
 {
     GF.ShowView <BattleView>();
 }
Exemple #12
0
 public static void Show(string title, string msg, MessageBoxStyle style, Action <MessageBoxResult> callback = null)
 {
     GF.Send(EventDef.MessageBox, new MessageBoxEvent(title, msg, style, callback));
 }
 public override void Enter(params object[] param)
 {
     GF.GetProxy <SosProxy>().Reset();
     GF.GetProxy <SosProxy>().InitSocket();
     Connect();
 }
Exemple #14
0
 private void ReconnectToBattle()
 {
     needReconnectBattle = true;
     GF.ChangeState <BattleLoadingState>();
 }
 private void OnLoadFinished()
 {
     GF.ChangeState <HallLoginState>();
 }
 public override void Enter(params object[] param)
 {
     GF.StartCoroutine(ResLoad());
 }