Ejemplo n.º 1
0
        public void Init()
        {
            if (Loaded)
            {
                return;
            }

            Loaded = true;

            LoadingCommand?.Execute();
        }
Ejemplo n.º 2
0
        //private static void UpdatebuttonText(string newValue)
        //{
        //btnEmpty.Text = newValue;
        //}

        private void BtnEmpty_Clicked(object sender, EventArgs e)
        {
            LoadingCommand?.Execute(null);
        }
Ejemplo n.º 3
0
    void Update()
    {
        for (int i = updatePreclist.Count - 1; i >= 0; i--)
        {
            UpdatePrec up = updatePreclist[i];
            up.curTime += Time.deltaTime;
            if (up.curTime > updatePreclist[i].targetTime)
            {
                up.PrecValue--;
                up.curTime = 0.0f;
                up.loadingItem.percentage++;
                LuaComponent loadingItem = up.loadingItem.transform.GetComponent <LuaComponent>();
                if (loadingItem.table != null)
                {
                    loadingItem.table.Set("loadingState", CommonFunction.GetConstString("STR_LOADING") + up.loadingItem.percentage + "%");
                }
            }
            if (up.PrecValue == 0)
            {
                if (m_curLoadingCmd != null)
                {
                    if (up.loadingItem.ri != null)
                    {
                        if (up.loadingItem.ri.acc_id == MainPlayer.Instance.AccountID)
                        {
                            m_curLoadingCmd.m_bDone = true;
                        }
                    }
                    else
                    {
                        m_curLoadingCmd.m_bDone = true;
                    }
                }

                updatePreclist.RemoveAt(i);
            }
        }

        _InitGameMsgHandler();

        //loading queue process
        if (m_curLoadingCmd == null && m_loadingQueue.Count != 0)
        {
            m_curLoadingCmd = m_loadingQueue.Dequeue();
            m_curLoadingCmd.Execute();
        }
        if (m_curLoadingCmd != null && m_curLoadingCmd.m_bDone)
        {
            if (m_curLoadingCmd.m_bFinalCmd)
            {
                m_curLoadingStep = LoadingStep.eLoadingComplete;
            }
            m_curLoadingCmd = null;
        }
        if (m_curLoadingStep == LoadingStep.eInit)
        {
            return;
        }

        if (m_wait != null)
        {
            m_wait.Update(Time.deltaTime);
        }

        GameMatch_PVP match = GameSystem.Instance.mClient.mCurMatch as GameMatch_PVP;

        if (match == null)
        {
            if (m_curLoadingStep == LoadingStep.eLoadingComplete)
            {
                if (onComplete != null)
                {
                    onComplete();
                }
                Object.Destroy(gameObject);
            }
        }
        else
        {
            if (m_curLoadingStep == LoadingStep.eLoadedScene && match.m_bPlayerDataReady && !m_pvpLoadPlayer)
            {
                LoadCharacter(GameSystem.Instance.mClient.mPlayerManager, match);
                m_pvpLoadPlayer = true;
            }

            if (m_curLoadingStep == LoadingStep.eLoadedPlayers && !m_pvpLoadUI)
            {
                LoadUI(match);
                m_pvpLoadUI = true;
            }

            if (m_curLoadingStep == LoadingStep.eLoadingComplete && !m_pvpLoadComplete)
            {
                if (onComplete != null)
                {
                    onComplete();
                }
                m_pvpLoadComplete = true;
                GameMsgSender.SendLoadingComplete(match.GetMatchType());
            }

            if (m_curLoadingStep == LoadingStep.eLoadingComplete && disConnected)
            {
                disConnected = false;
                ShowOffLine();
            }

            if (m_delayDestroy && !MainPlayer.Instance.inPvpJoining)
            {
//               if( m_delayLoadLua != null)
//               {
//                   m_delayLoadLua.ForEach((LuaComponent item) =>
//                                 {
//                                     item.table.Set("loadingState", CommonFunction.GetConstString("STR_LOAD_COMPLETE"));
//                                     item.table.Set("loadDone", true);
//                                 });

//               }
                Object.Destroy(gameObject);
            }
        }
    }