Пример #1
0
        private void ReloadScene()
        {
            ClearScene();
            ChangeToStatus(RegularityStatus.InitScene);
            m_CurrentConfig = m_DiffMgr.GetDifficulty();
            for (int i = 0; i < m_CurrentConfig.OptionList.Count; ++i)
            {
                string     name      = m_CurrentConfig.OptionList[i].Name;
                bool       isVisable = m_CurrentConfig.OptionList[i].IsVisable;
                GameObject elem      = GameObject.Instantiate(m_ObjElementTemplate);
                elem.name = i.ToString();

                PilesAlphaElement dataElem = new PilesAlphaElement(elem, name, isVisable, m_strEmptyTextureName);
                ComponentTool.Attach(m_ObjElementRoot.transform, dataElem.m_ObjRoot.transform);
                m_ElementList.Add(dataElem);

                if (!isVisable)
                {
                    m_iCurrentOptionIndex = i - 1;
                }
            }
            m_Grid.Reposition();
            SetPlayerPos(0);

            OpenWindow();

            m_UIWindow.ResetAnswer(m_CurrentConfig.AnswerList);
            m_iCurrentJumpedIndex = 0;
            TriggerJumpToTarget(1);
        }
        public void Initialize()
        {
            m_GameSettingConfig = ConfigManager.Instance.GetRegularityGameSetting();
            m_iLimitCount       = m_GameSettingConfig.PlayCountLimit;
            m_fLeftTime         = m_GameSettingConfig.PlayTime;
            m_DiffMgr           = new RegularityGameDifficultyManager();
            RegularityGameConfig config = m_DiffMgr.GetDifficulty();

            WindowManager.Instance.OpenWindow(WindowID.Regularity2D);
            m_UIWindow = (UIWindowRegularity2D)WindowManager.Instance.GetWindow(WindowID.Regularity2D);

            Regularity2DWindowParam param = new Regularity2DWindowParam();

            param.m_ResultCallBack = OnResultCallBack;
            param.m_PilesList      = config.OptionList;
            param.m_OptionList     = config.AnswerList;

            m_UIWindow.ResetWindow(param);
        }
Пример #3
0
        private void ReLoadScene()
        {
            if (!m_bIsResetByUI)
            {
                m_CurrentConfig = m_DiffMgr.GetDifficulty();
            }
            m_bIsResetByUI = false;

            m_ElementList = new List <PilesElement>();
            for (int i = 0; i < m_CurrentConfig.OptionList.Count; ++i)
            {
                string     name = m_CurrentConfig.OptionList[i].Name;
                GameObject elem = GameObject.Instantiate(m_ElementTemplate);
                elem.name = i.ToString();
                MeshRenderer renderer     = ComponentTool.FindChildComponent <MeshRenderer>("Option", elem);
                Material     elemMaterial =
                    new Material(ResourceManager.Instance.LoadBuildInResource <Material>("Piles/PilesMaterial",
                                                                                         AssetType.Materials));
                if (m_CurrentConfig.OptionList[i].IsVisable)
                {
                    elemMaterial.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture2D>(name,
                                                                                                        AssetType.Texture);
                }
                else
                {
                    elemMaterial.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture2D>(m_strEmptyTextureName,
                                                                                                        AssetType.Texture);
                }
                renderer.material = elemMaterial;
                elem.SetActive(true);
                m_ElementList.Add(new PilesElement(renderer.gameObject, elem, name, elemMaterial, m_CurrentConfig.OptionList[i].IsVisable));
                ComponentTool.Attach(m_ObjRoot.transform, elem.transform);
            }
            m_Grid = m_ObjRoot.GetComponent <RegularityGame.SimpleUIGrid>();
            m_Grid.Reposition();
            FixPosition();

            m_bIsInit = true;
        }