Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        if (ui == null)
        {
            ui = this.GetComponent <UIFun>();
        }
        if (FaildMenu != null)
        {
            FaildMenu.SetActive(false);
        }
        if (PauseMenu != null)
        {
            PauseMenu.SetActive(false);
        }
        if (WinMenu != null)
        {
            WinMenu.SetActive(false);
        }
        if (GameManager.gm != null)
        {
            StartRoom = GameManager.gm.StartRoom;
            MinRoom   = GameManager.gm.MinRoom;
            MaxRoom   = GameManager.gm.MaxRoom;
        }

        Room    = GameObject.Find("Room");
        RoomNow = StartRoom;
        for (int i = 1; i < RoomNow; i++)
        {
            Room.transform.Translate(-MoveDistance, 0, 0);
        }
        //参数初始化
        //进行UI初始化设置
        //默认跳转到当前进度关卡
        if (glg)
        {
            offset   = glg.cellSize.x + glg.spacing.x;
            progress = PlayerPrefs.GetInt("progress", 1);
            Debug.Log("level_chosen:" + progress);
            level_chosen = progress;
            Vector3 position = rtf.anchoredPosition3D;
            position[0]           -= offset * (level_chosen - 1);
            rtf.anchoredPosition3D = position;
        }
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        if (ui == null)
        {
            ui = this.GetComponent <UIFun>();
        }
        if (FaildMenu != null)
        {
            FaildMenu.SetActive(false);
        }
        if (PauseMenu != null)
        {
            PauseMenu.SetActive(false);
        }
        if (WinMenu != null)
        {
            WinMenu.SetActive(false);
        }
        if (GameManager.gm != null)
        {
            StartRoom = GameManager.gm.StartRoom;
            MinRoom   = GameManager.gm.MinRoom;
            MaxRoom   = GameManager.gm.MaxRoom;
        }

        Room    = GameObject.Find("Room");
        RoomNow = StartRoom;
        for (int i = 1; i < RoomNow; i++)
        {
            Room.transform.Translate(-MoveDistance, 0, 0);
        }
        //参数初始化
        //进行UI初始化设置
        //默认跳转到当前进度关卡
        if (glg)
        {
            offset   = glg.cellSize.x + glg.spacing.x;
            progress = PlayerPrefs.GetInt("progress", 1);
            Debug.Log("level_chosen:" + progress);
            level_chosen = progress;
            //2018/12/20 ADD CHOOSE LEVEL LIMIT
            Vector3 position = rtf.anchoredPosition3D;
            position[0]           -= offset * (level_chosen - 1);
            rtf.anchoredPosition3D = position;
        }
        if (left_button && right_button)
        {
            string name = SceneManager.GetActiveScene().name;
            if (name == "Level_3_outdoor")
            {
                right_button.SetActive(false);
                left_button.SetActive(false);
            }
            else if (RoomNow == MinRoom)
            {
                left_button.SetActive(false);
            }
            else if (RoomNow == MaxRoom)
            {
                right_button.SetActive(false);
            }
        }
        if (PrevButton && NextButton)
        {
            NextButton.SetActive(false);
            if (level_chosen == 1)
            {
                PrevButton.SetActive(false);
            }
        }
    }