コード例 #1
0
    public override void OnInit()
    {
        //指定id
        this.id = EUiId.ID_SaveGamePanel;

        buttonClose  = UtilUI.findChild(this.gameObject, "Cross").gameObject;
        buttonLoad_1 = UtilUI.findChild(this.gameObject, "Load_1").gameObject;
        buttonLoad_2 = UtilUI.findChild(this.gameObject, "Load_2").gameObject;
        buttonLoad_3 = UtilUI.findChild(this.gameObject, "Load_3").gameObject;
        buttonLoad_4 = UtilUI.findChild(this.gameObject, "Load_4").gameObject;
        buttonLoad_5 = UtilUI.findChild(this.gameObject, "Load_5").gameObject;
        buttonLoad_6 = UtilUI.findChild(this.gameObject, "Load_6").gameObject;

        UGUIEventListener.Get(buttonClose).onClick  = OnClose;
        UGUIEventListener.Get(buttonLoad_1).onClick = OnSave_1;
        UGUIEventListener.Get(buttonLoad_2).onClick = OnSave_2;
        UGUIEventListener.Get(buttonLoad_3).onClick = OnSave_3;
        UGUIEventListener.Get(buttonLoad_4).onClick = OnSave_4;
        UGUIEventListener.Get(buttonLoad_5).onClick = OnSave_5;
        UGUIEventListener.Get(buttonLoad_6).onClick = OnSave_6;

        textLog       = transform.Find("SaveGame").Find("LogInfo").GetComponent <Text>();
        textLog.color = new Color(textLog.color.r, textLog.color.g, textLog.color.b, 0.0f);


        buttonLoad_1.GetComponentInChildren <Text>().text = GameState.Instance.mapIDSaved(01);
        buttonLoad_2.GetComponentInChildren <Text>().text = GameState.Instance.mapIDSaved(02);
        buttonLoad_3.GetComponentInChildren <Text>().text = GameState.Instance.mapIDSaved(03);
        buttonLoad_4.GetComponentInChildren <Text>().text = GameState.Instance.mapIDSaved(04);
        buttonLoad_5.GetComponentInChildren <Text>().text = GameState.Instance.mapIDSaved(05);
        buttonLoad_6.GetComponentInChildren <Text>().text = GameState.Instance.mapIDSaved(06);
    }
コード例 #2
0
ファイル: UIMainPanel.cs プロジェクト: passiony/UIFramework
    private GameObject buttonShop;    //关卡界面的按钮对象
    public override void OnInit()     //用于初始化UI控件
    {
        //给定ID
        this.id          = EUiId.ID_MainPanel; //对UI的ID赋值(重点,一定要赋值)
        this.IsKeepAbove = true;               //保持在最前面

        //用于查找游戏对象
        buttonRoleBag = UtilUI.findChild(this.gameObject, "BtnRoleBag").gameObject;
        butotnSet     = UtilUI.findChild(this.gameObject, "BtnSet").gameObject;
        buttonStage   = UtilUI.findChild(this.gameObject, "BtnStages").gameObject;
        buttonShop    = UtilUI.findChild(this.gameObject, "BtnShop").gameObject;

        UGUIEventListener.Get(buttonRoleBag).onClick += OnBtnRoleBag;//事件和方法的关联
        UGUIEventListener.Get(butotnSet).onClick      = OnBtnSet;
        UGUIEventListener.Get(buttonStage).onClick    = OnBtnStage;
        UGUIEventListener.Get(buttonShop).onClick     = OnBtnShop;


        //3:如果有动画添加动画
        //显示动画
        animShow = this.transform.DOLocalMoveY(805, 1.0f).From();
        animShow.Pause();
        animShow.SetAutoKill(false);

        //隐藏动画
        animHide = this.transform.DOLocalMoveY(805, 1.0f);
        animHide.Pause();
        animHide.SetAutoKill(false);
        animHide.OnComplete(delegate() { this.gameObject.SetActive(false); });
    }
コード例 #3
0
    public override void OnInit()
    {
        //指定id
        this.id = EUiId.ID_InfoPanel;

        buttonClose = UtilUI.findChild(this.gameObject, "Cross").gameObject;
        UGUIEventListener.Get(buttonClose).onClick = OnClose;
    }
コード例 #4
0
    public override void OnInit()
    {
        //指定id
        this.id = EUiId.ID_ExitPanel;

        buttonQuit  = UtilUI.findChild(this.gameObject, "Yes").gameObject;
        buttonClose = UtilUI.findChild(this.gameObject, "Maybe").gameObject;
        UGUIEventListener.Get(buttonQuit).onClick  = OnQuit;
        UGUIEventListener.Get(buttonClose).onClick = OnClose;
    }
コード例 #5
0
    public override void OnInit()
    {
        //指定id
        this.id = EUiId.ID_SettingPanel;

        buttonClose = UtilUI.findChild(this.gameObject, "Cross").gameObject;
        UGUIEventListener.Get(buttonClose).onClick = OnClose;

        bgmvolume       = transform.Find("Set").Find("VolumeSlider").GetComponent <Slider>();
        bgmvolume.value = PlayerPrefs.GetFloat("volume"); //初始化为之前的音量
    }
コード例 #6
0
    public override void OnInit()
    {
        //指定id
        this.id = EUiId.ID_PausePanel;

        buttonContinue = UtilUI.findChild(this.gameObject, "ContinueButton").gameObject;
        buttonSave     = UtilUI.findChild(this.gameObject, "SaveButton").gameObject;
        buttonLoad     = UtilUI.findChild(this.gameObject, "LoadButton").gameObject;
        buttonExit     = UtilUI.findChild(this.gameObject, "ExitButton").gameObject;
        buttonMenu     = UtilUI.findChild(this.gameObject, "MenuButton").gameObject;
        UGUIEventListener.Get(buttonContinue).onClick = OnClose;
        UGUIEventListener.Get(buttonSave).onClick     = OnSave;
        UGUIEventListener.Get(buttonLoad).onClick     = OnLoad;
        UGUIEventListener.Get(buttonExit).onClick     = OnBtnExit;
        UGUIEventListener.Get(buttonMenu).onClick     = OnBtnMenu;

        sceneName = SceneManager.GetActiveScene().name;
    }
コード例 #7
0
    public override void OnInit()
    {
        //1:必须给定ID
        this.id = EUiId.ID_RoleBagPanel;
        //2:获取组件,如果有事件添加事件
        goBtnClose = UtilUI.findChild(this.gameObject, "BtnClose").gameObject;
        UGUIEventListener.Get(goBtnClose).onClick = OnBtnClose;
        //3:如果有动画添加动画
        //显示动画
        animShow = this.transform.DOLocalMoveY(805, 1.0f).From();
        animShow.Pause();
        animShow.SetAutoKill(false);

        //隐藏动画
        animHide = this.transform.DOLocalMoveY(805, 1.0f);
        animHide.Pause();
        animHide.SetAutoKill(false);
        animHide.OnComplete(delegate() { this.gameObject.SetActive(false); });
    }
コード例 #8
0
ファイル: UIStagesPanel.cs プロジェクト: passiony/UIFramework
    public override void OnInit()
    {
        base.OnInit();
        this.id     = EUiId.ID_StagesPanel;
        buttonClose = UtilUI.findChild(this.gameObject, "BtnClose").gameObject;
        UGUIEventListener.Get(buttonClose).onClick = OnClose;

        //3:如果有动画添加动画
        //显示动画
        animShow = this.transform.DOLocalMoveY(805, 1.0f).From();
        animShow.Pause();
        animShow.SetAutoKill(false);

        //隐藏动画
        animHide = this.transform.DOLocalMoveY(805, 1.0f);
        animHide.Pause();
        animHide.SetAutoKill(false);
        animHide.OnComplete(() => { this.gameObject.SetActive(false); });
    }
コード例 #9
0
    public override void OnInit()//初始化UI控件
    {
        //给定ID
        this.id          = EUiId.ID_MenuPanel; //对UI的ID赋值(重点,一定要赋值)
        this.IsKeepAbove = true;               //保持始终不消失

        //用于查找游戏对象
        buttonSet      = UtilUI.findChild(this.gameObject, "SettingButton").gameObject;
        buttonExit     = UtilUI.findChild(this.gameObject, "ExitButton").gameObject;
        buttonInfo     = UtilUI.findChild(this.gameObject, "InfoButton").gameObject;
        buttonNewGame  = UtilUI.findChild(this.gameObject, "NewGameButton").gameObject;
        buttonLoadGame = UtilUI.findChild(this.gameObject, "LoadGameButton").gameObject;
        buttonInfinity = UtilUI.findChild(this.gameObject, "InfinityModButton").gameObject;
        UGUIEventListener.Get(buttonSet).onClick      = OnBtnSet;//事件和方法的关联
        UGUIEventListener.Get(buttonExit).onClick     = OnBtnExit;
        UGUIEventListener.Get(buttonInfo).onClick     = OnBtnInfo;
        UGUIEventListener.Get(buttonNewGame).onClick  = OnBtnNew;
        UGUIEventListener.Get(buttonLoadGame).onClick = OnBtnLoad;
        UGUIEventListener.Get(buttonInfinity).onClick = OnBtnInfinity;
    }