コード例 #1
0
ファイル: ButtonSkill.cs プロジェクト: xiney1986/SDKProject
    public override void DoClickEvent()
    {
        base.DoClickEvent();
        if (OnClickCallback != null)
        {
            OnClickCallback(this);
            MaskWindow.UnlockUI();
            return;
        }
        if (useInSkillChoose == true)
        {
            MaskWindow.UnlockUI();
            return;
        }
        MaskWindow.LockUI();


        //以下属性面板用
        if (skillData != null)
        {
            UiManager.Instance.openDialogWindow <SkillInfoWindow> ((win) => {
                if (skillState != STATE_BEAST)
                {
                    Card showCard = owner != null ? owner : (fatherWindow is CardBookWindow) ? (fatherWindow as CardBookWindow).getShowCard() : null;
                    win.Initialize(skillData, showCard);                     //暂时这么处理
                    if (fatherWindow != null && fatherWindow.GetType() == typeof(CardBookWindow))
                    {
                        CardBookWindow cwin = fatherWindow as CardBookWindow;
                        Card card           = cwin.getShowCard();
                        if (card != null && cwin.getShowType() == CardBookWindow.VIEW)
                        {
                            if (StorageManagerment.Instance.getAllRole().Contains(card))
                            {
                                //绑定技能无法替换
                                if (SkillSampleManager.Instance.getSkillSampleBySid(skillData.sid).isBind)
                                {
                                    //MaskWindow.UnlockUI ();
                                    return;
                                }
                                //小弟卡只能学习被动技能
                                else if (card.uid != UserManager.Instance.self.mainCardUid && skillData.getSkillStateType() != SkillStateType.ATTR)
                                {
                                    //MaskWindow.UnlockUI ();
                                    return;
                                }
                                //显示替换按钮
                                win.ShowRepick(() => {
                                    if (UserManager.Instance.self.getUserLevel() < 25)
                                    {
                                        MessageWindow.ShowAlert(string.Format(LanguageConfigManager.Instance.getLanguage("s0402"), 25));
                                    }
                                    else
                                    {
                                        UiManager.Instance.openWindow <LearnSkillWindow> ((win2) => {
                                            win2.init(card, skillData, skillType);
                                        });
                                    }
                                });
                            }
                        }
                    }
                }
                else
                {
                    win.Initialize(names, desc, exp, type, level);
                }
                if (fatherWindow != null)
                {
                    win.GetComponent <UIPanel> ().depth = fatherWindow.GetComponent <UIPanel> ().depth + 10000;
                }
            });
        }
        else
        {
            if (useInPicture)
            {
                //MaskWindow.UnlockUI ();
                return;
            }
            if (skillState == STATE_NOOPEN)
            {
                //MaskWindow.UnlockUI ();
                return;
            }
            //如果是可学习
            if (skillState == STATE_CANLEARN && fatherWindow.GetType() == typeof(CardBookWindow))
            {
                //跳到学习技能
                CardBookWindow cwin = fatherWindow as CardBookWindow;
                Card           card = cwin.getShowCard();
                if (card != null && cwin.getShowType() < CardBookWindow.SHOW)
                {
                    if (UserManager.Instance.self.getUserLevel() < 25)
                    {
                        MessageWindow.ShowAlert(string.Format(LanguageConfigManager.Instance.getLanguage("s0402"), 25));
                    }
                    else
                    {
                        GuideManager.Instance.doGuide();
                        UiManager.Instance.openWindow <LearnSkillWindow> ((win2) => {
                            win2.init(card, skillData, skillType);
                        });
                    }
                }
                //MaskWindow.UnlockUI();
            }
            else
            {
                if (fatherWindow != null && fatherWindow.GetType() == typeof(CardBookWindow))
                {
                    if ((fatherWindow as CardBookWindow).getShowType() == CardBookWindow.CHATSHOW)
                    {
                        //MaskWindow.UnlockUI ();
                        return;
                    }
                }
                UiManager.Instance.openDialogWindow <SkillInfoWindow> ((win) => {
                    win.Initialize(skillLevel.text, textLabel.text);                     //共鸣之力,skillLevel连接的是按钮名字
                });
            }
        }
    }