Exemple #1
0
        protected override void OnOpen(object userData)
        {
            base.OnOpen(userData);

            for (int i = 0; i < m_LevelItems.Length; i++)
            {
                int       levelId   = m_LevelItems[i].LevelId;
                string    levelName = m_LevelItems[i].LevelName;
                SceneId   sceneId   = m_LevelItems[i].SceneId;
                LevelItem item      = m_LevelItems[i];

                item.onClick.Add(() =>
                {
                    m_CurSelectLevelId    = levelId;
                    m_LevelScene          = sceneId;
                    m_SelectText.text     = levelName;
                    m_EnterButton.enabled = !item.IsLock;
                });
            }

            m_EnterButton?.onClick.Add(() =>
            {
                EnterLevelEventArgs eventArgs = ReferencePool.Acquire <EnterLevelEventArgs>();
                eventArgs.Fill(m_CurSelectLevelId, m_LevelScene);
                GameEntry.Event.Fire(this, eventArgs);

                GameEntry.UI.CloseUIForm(UIFormId.LevelSelectForm);
            });

            m_CloseButton?.onClick.Add(() =>
            {
                GameEntry.UI.CloseUIForm(UIFormId.LevelSelectForm);
            });
        }
        private void OnEnterLevel(object sender, GameEventArgs e)
        {
            EnterLevelEventArgs ne = e as EnterLevelEventArgs;

            m_ProcedureOwner.SetData <VarInt>(Constant.ProcedureData.NextSceneId, (int)ne.SceneId);
            m_ProcedureOwner.SetData <VarInt>(Constant.ProcedureData.NextLevelId, ne.LevelId);

            GameEntry.Level.LeaveCurrentLevel();
            ChangeState <ProcedureChangeScene>(m_ProcedureOwner);
        }