示例#1
0
    void Awake()
    {
        if (GameObject.FindGameObjectsWithTag("UICtrl").Length > 1)
        {
            Destroy(gameObject);
        }
        else
        {
            shopCanvas     = transform.Find("ShopCanvas").gameObject;
            RankCanvas     = transform.Find("RankCanvas").gameObject;
            uiStateMachine = new UIStateMachine();
            GameStartState gameStartState = new GameStartState(transform);
            uiStateMachine.AddState(gameStartState);

            GameSceneState gameSceneState = new GameSceneState(transform);
            uiStateMachine.AddState(gameSceneState);

            GameLoadingState gameLoadingState = new GameLoadingState(transform);
            uiStateMachine.AddState(gameLoadingState);

            uiStateMachine.ChangeState(typeof(GameLoadingState));

            DontDestroyOnLoad(gameObject);
        }
    }
示例#2
0
    private void Awake()
    {
        Screen.SetResolution(7680, 3240, true, 60);

        DicUI = new Dictionary <UIState, UIStateFSM>();

        _Machine = new UIStateMachine(this);

        DicUI.Add(UIState.CompanyIntroduction, new CompanyIntroductionFSM(this.transform.Find("CompanyIntroduction/CompanyIntroduction")));
        DicUI.Add(UIState.PrivateHeirs, new PrivateHeirsFSM(this.transform.Find("CompanyIntroduction/PrivateHeirs")));
        DicUI.Add(UIState.OutstandingStyle, new OutstandingStyleFSM(this.transform.Find("CompanyIntroduction/OutstandingStyle")));
        DicUI.Add(UIState.Close, new CloseFSM(null));

        _Machine.SetCurrentState(DicUI[UIState.Close]);

        CompanyIntroductionBtn.onClick.AddListener((() =>
        {
            _Machine.ChangeState(DicUI[UIState.CompanyIntroduction]);
        }));

        PrivateHeirsBtn.onClick.AddListener((() =>
        {
            _Machine.ChangeState(DicUI[UIState.PrivateHeirs]);
        }));

        OutstandingStyleBtn.onClick.AddListener((() =>
        {
            _Machine.ChangeState(DicUI[UIState.OutstandingStyle]);
        }));

        CloseButton.onClick.AddListener((() =>
        {
            _Machine.ChangeState(DicUI[UIState.Close]);
        }));


        Btn2000_2009.transform.Find("Tip").gameObject.SetActive(true);
        Btn2000_2009.onClick.AddListener((() =>
        {
            MultiDepthMotion.ChangeState(0);
            Btn2000_2009.transform.Find("Tip").gameObject.SetActive(true);
            Btn2010_2019.transform.Find("Tip").gameObject.SetActive(false);
            Btn2020.transform.Find("Tip").gameObject.SetActive(false);
        }));
        Btn2000_2009.transform.Find("Text").GetComponent <Text>().text = SettingManager.Instance.GetDirectName(Direct.FirstDir);



        Btn2010_2019.onClick.AddListener((() =>
        {
            MultiDepthMotion.ChangeState(1);
            Btn2000_2009.transform.Find("Tip").gameObject.SetActive(false);
            Btn2010_2019.transform.Find("Tip").gameObject.SetActive(true);
            Btn2020.transform.Find("Tip").gameObject.SetActive(false);
        }));
        Btn2010_2019.transform.Find("Text").GetComponent <Text>().text = SettingManager.Instance.GetDirectName(Direct.SecondDir);

        Btn2020.onClick.AddListener((() =>
        {
            MultiDepthMotion.ChangeState(2);
            Btn2000_2009.transform.Find("Tip").gameObject.SetActive(false);
            Btn2010_2019.transform.Find("Tip").gameObject.SetActive(false);
            Btn2020.transform.Find("Tip").gameObject.SetActive(true);
        }));
        Btn2020.transform.Find("Text").GetComponent <Text>().text = SettingManager.Instance.GetDirectName(Direct.ThirdDir);
    }
示例#3
0
 void ChangeStateToGameScene()
 {
     uiStateMachine.ChangeState(typeof(GameSceneState));
 }