Пример #1
0
 void Awake()
 {
     practiceEffect = this.GetComponent <PracticeEffect>();
     if (manji != null)
     {
         manji.gameObject.SetActive(false);
     }
 }
Пример #2
0
    void Awake()
    {
        GameCenter.practiceMng.C2S_ReinState(practiceType.PRACRICE);
        mutualExclusion = true;
        layer           = GUIZLayer.NORMALWINDOW;
        practiceEffect  = this.GetComponent <PracticeEffect>();
        if (coinYGBtn != null)
        {
            UIEventListener.Get(coinYGBtn.gameObject).onClick = OnClickCoinYg;
        }
        if (diamondYGBtn != null)
        {
            UIEventListener.Get(diamondYGBtn.gameObject).onClick = OnClickDiamondYg;
        }
        if (closeBtn != null)
        {
            UIEventListener.Get(closeBtn.gameObject).onClick = OnClickCloseBtn;
        }
        if (gotoFlyBtn != null)
        {
            UIEventListener.Get(gotoFlyBtn.gameObject).onClick = delegate
            {
                GameCenter.practiceMng.C2S_ReqStopExcercise();
                GameCenter.uIMng.SwitchToSubUI(SubGUIType.SOARING);
            }
        }
        ;
        if (shouGongBtn != null)
        {
            UIEventListener.Get(shouGongBtn.gameObject).onClick += OnClickStopYG;
        }
        if (exchangeBtn != null)
        {
            UIEventListener.Get(exchangeBtn.gameObject).onClick = delegate
            {
                exchangeUi.gameObject.SetActive(true);
            }
        }
        ;
        if (masterAdviceBtn != null)
        {
            UIEventListener.Get(masterAdviceBtn.gameObject).onClick += OnClickMasterAdvice;
        }
        if (fairyAdviceBtn != null)
        {
            UIEventListener.Get(fairyAdviceBtn.gameObject).onClick += OnClickfairyAdvice;
        }
        if (tenTimesYg != null)
        {
            UIEventListener.Get(tenTimesYg.gameObject).onClick = ClickTenTimesYG;
        }
    }

    void OnDestroy()
    {
        if (shouGongBtn != null)
        {
            UIEventListener.Get(shouGongBtn.gameObject).onClick -= OnClickStopYG;
        }
        if (masterAdviceBtn != null)
        {
            UIEventListener.Get(masterAdviceBtn.gameObject).onClick -= OnClickMasterAdvice;
        }
        if (fairyAdviceBtn != null)
        {
            UIEventListener.Get(fairyAdviceBtn.gameObject).onClick -= OnClickfairyAdvice;
        }
    }

    void OnClickMasterAdvice(GameObject go)
    {
        if (master.IsGray == UISpriteEx.ColorGray.normal)
        {
            if (GameCenter.practiceMng.isTenTimesYG)
            {
                GameCenter.practiceMng.C2S_ReqExcercise(ExcerciseType.TENMASTERADVICE);
            }
            else
            {
                GameCenter.practiceMng.C2S_ReqExcercise(ExcerciseType.MASTERADVICE);
            }
        }
    }

    void OnClickfairyAdvice(GameObject go)
    {
        if (fairy.IsGray == UISpriteEx.ColorGray.normal)
        {
            if (GameCenter.practiceMng.isTenTimesYG)
            {
                GameCenter.practiceMng.C2S_ReqExcercise(ExcerciseType.TENFAIRYADVICE);
            }
            else
            {
                GameCenter.practiceMng.C2S_ReqExcercise(ExcerciseType.FAIRYADVICE);
            }
        }
    }