コード例 #1
0
ファイル: TalentView.cs プロジェクト: wujiangu/wanshiwu0.1
        public void OnHeroLearnTalent(PoolObjHandle <ActorRoot> hero, sbyte talentLevel, uint talentID)
        {
            HeroTalentViewInfo heroTalentViewInfo = this.GetHeroTalentViewInfo(hero);

            if (heroTalentViewInfo != null)
            {
                ResTalentLib dataByKey = GameDataMgr.talentLib.GetDataByKey(talentID);
                heroTalentViewInfo.m_learnTalentList[(int)talentLevel] = dataByKey.dwID;
                if (hero == this.m_heroCaption)
                {
                    this.Refresh();
                    if (dataByKey.bType == 3)
                    {
                        Singleton <CBattleSystem> .GetInstance().ResetSkillButtonManager(this.m_heroCaption);

                        Singleton <CBattleSystem> .GetInstance().m_skillButtonManager.SetButtonCDOver(SkillSlotType.SLOT_SKILL_3, false);
                    }
                    string   str  = StringHelper.UTF8BytesToString(ref dataByKey.szName);
                    string[] args = new string[] { str };
                    Singleton <CBattleSystem> .GetInstance().CreateOtherFloatText(enOtherFloatTextContent.LearnTalent, (Vector3)this.m_heroCaption.handle.location, args);

                    Singleton <CSoundManager> .GetInstance().PlayBattleSound("UI_Prompt_get_tianfu", null);
                }
                Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();
            }
        }
コード例 #2
0
ファイル: TalentView.cs プロジェクト: wujiangu/wanshiwu0.1
        public void InitResData(PoolObjHandle <ActorRoot> heroActor)
        {
            HeroTalentViewInfo heroTalentViewInfo = GetHeroTalentViewInfo((uint)heroActor.handle.TheActorMeta.ConfigId);

            heroTalentViewInfo.m_hero = heroActor;
            this.m_heroTalentViewList.Add(heroTalentViewInfo);
        }
コード例 #3
0
ファイル: TalentView.cs プロジェクト: wujiangu/wanshiwu0.1
        private void SendLearnTalentCommand(HeroTalentViewInfo viewInfo, uint talentID, sbyte talentLevelIndex)
        {
            FrameCommand <LearnTalentCommand> command = FrameCommandFactory.CreateFrameCommand <LearnTalentCommand>();

            command.cmdData.TalentLevelIndex = talentLevelIndex;
            command.cmdData.TalentID         = talentID;
            command.cmdData.HeroObjID        = viewInfo.m_hero.handle.ObjID;
            command.Send();
        }
コード例 #4
0
ファイル: TalentView.cs プロジェクト: wujiangu/wanshiwu0.1
        public void OnTalent_BtnLearnClick(CUIEvent uiEvent)
        {
            stTalentEventParams talentParams = uiEvent.m_eventParams.talentParams;

            Singleton <CUIManager> .GetInstance().CloseForm(s_TalentFormPath);

            HeroTalentViewInfo heroTalentViewInfo = this.GetHeroTalentViewInfo(this.m_heroCaption);

            if ((heroTalentViewInfo != null) && (talentParams.talentInfo != null))
            {
                this.SendLearnTalentCommand(heroTalentViewInfo, talentParams.talentInfo.dwID, (sbyte)talentParams.talentLevelIndex);
            }
        }
コード例 #5
0
ファイル: TalentView.cs プロジェクト: wujiangu/wanshiwu0.1
        public bool SetTalentLevel(HeroTalentViewInfo viewInfo, int soulLevel)
        {
            bool flag = false;

            for (int i = 0; i < this.m_talentRuleList.Count; i++)
            {
                if (((soulLevel >= this.m_talentRuleList[i].bSoulRequestValue) && (viewInfo.m_talentLevel < this.m_talentRuleList[i].bID)) && (viewInfo.m_talentLevel != this.m_talentRuleList[i].bID))
                {
                    viewInfo.m_talentLevel = this.m_talentRuleList[i].bID;
                    flag = true;
                }
            }
            return(flag);
        }
コード例 #6
0
        public bool CheckHeroTalentHaveBuy(uint heroID)
        {
            bool flag = false;

            if (TalentView.IsHaveTalentBuyFunc(heroID))
            {
                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                if (masterRoleInfo == null)
                {
                    return(flag);
                }
                CHeroInfo heroInfo = masterRoleInfo.GetHeroInfo(heroID, false);
                if (heroInfo == null)
                {
                    return(flag);
                }
                HeroTalentViewInfo heroTalentViewInfo = TalentView.GetHeroTalentViewInfo(heroID);
                if (heroTalentViewInfo == null)
                {
                    return(flag);
                }
                for (int i = 0; i < heroTalentViewInfo.m_heroTalentLevelInfoList.Count; i++)
                {
                    int  num2        = heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_levelDetail.bLvl3UnlockLvl;
                    uint targetValue = heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_levelDetail.dwLvl3UnLockCostPrice;
                    RES_SHOPBUY_COINTYPE coinType = (RES_SHOPBUY_COINTYPE)heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_levelDetail.bLvl3UnLockCostType;
                    uint num4 = heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_levelDetail.dwLvl3LockCostPrice;
                    RES_SHOPBUY_COINTYPE res_shopbuy_cointype2 = (RES_SHOPBUY_COINTYPE)heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_levelDetail.bLvl3LockCostType;
                    if (((i == 0) || TalentView.IsBuyTalent(heroID, i - 1)) && !TalentView.IsBuyTalent(heroID, i))
                    {
                        if ((heroInfo.m_ProficiencyLV >= num2) && masterRoleInfo.CheckCoinEnough(coinType, targetValue))
                        {
                            return(true);
                        }
                        if ((heroInfo.m_ProficiencyLV < num2) && masterRoleInfo.CheckCoinEnough(res_shopbuy_cointype2, num4))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(flag);
        }
コード例 #7
0
ファイル: TalentView.cs プロジェクト: wujiangu/wanshiwu0.1
        public static HeroTalentViewInfo GetHeroTalentViewInfo(uint heroCfgID)
        {
            HeroTalentViewInfo info = new HeroTalentViewInfo {
                m_talentLevel     = 0,
                m_learnTalentList = new uint[5]
            };
            ResTalentHero dataByKey = GameDataMgr.talentHero.GetDataByKey(heroCfgID);

            if (dataByKey != null)
            {
                info.m_heroTalentLevelInfoList = new ListView <HeroTalentLevelInfo>();
                for (int i = 0; i < dataByKey.astTalentList.Length; i++)
                {
                    HeroTalentLevelInfo info2 = new HeroTalentLevelInfo();
                    InitHeroTalentLevelInfo(info2, dataByKey.astTalentList[i].dwLvl1ID, dataByKey.astTalentList[i].dwLvl2ID, dataByKey.astTalentList[i].dwLvl3ID, dataByKey.astTalentList[i]);
                    info.m_heroTalentLevelInfoList.Add(info2);
                }
            }
            return(info);
        }
コード例 #8
0
ファイル: TalentView.cs プロジェクト: wujiangu/wanshiwu0.1
        public void OnHeroSoulLvlChange(PoolObjHandle <ActorRoot> hero, int level)
        {
            HeroTalentViewInfo heroTalentViewInfo = this.GetHeroTalentViewInfo(hero);

            if (((heroTalentViewInfo != null) && this.SetTalentLevel(heroTalentViewInfo, level)) && (hero == this.m_heroCaption))
            {
                this.Refresh();
                if ((this.m_root != null) && this.m_root.activeSelf)
                {
                    Singleton <CBattleSystem> .GetInstance().CreateOtherFloatText(enOtherFloatTextContent.OpenTalent, (Vector3)this.m_heroCaption.handle.location, new string[0]);
                }
                Singleton <CSoundManager> .GetInstance().PlayBattleSound("UI_Prompt_tianfu", null);

                TalentLevelChangeParam prm = new TalentLevelChangeParam {
                    src         = hero,
                    SoulLevel   = level,
                    TalentLevel = heroTalentViewInfo.m_talentLevel
                };
                Singleton <GameEventSys> .instance.SendEvent <TalentLevelChangeParam>(GameEventDef.Event_TalentLevelChange, ref prm);
            }
            this.AutoLearnTalent(hero, level);
        }
コード例 #9
0
ファイル: TalentView.cs プロジェクト: wujiangu/wanshiwu0.1
        public void Refresh()
        {
            if (Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo() != null)
            {
                HeroTalentViewInfo heroTalentViewInfo = this.GetHeroTalentViewInfo(this.m_heroCaption);
                if (heroTalentViewInfo != null)
                {
                    uint configId = (uint)heroTalentViewInfo.m_hero.handle.TheActorMeta.ConfigId;
                    List <stTalentEventParams> list = new List <stTalentEventParams>();
                    for (int i = heroTalentViewInfo.m_talentLevel - 1; i >= 0; i--)
                    {
                        if (heroTalentViewInfo.m_learnTalentList[i] == 0)
                        {
                            for (int k = 0; k < heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_tarlentLibList.Count; k++)
                            {
                                if (heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_tarlentLibList[k] == null)
                                {
                                    return;
                                }
                                stTalentEventParams item = new stTalentEventParams {
                                    talentLevelIndex = (byte)i,
                                    talentInfo       = heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_tarlentLibList[k],
                                    isCanLearn       = true
                                };
                                if (!IsNeedBuy(i, k) || IsBuyTalent(configId, i))
                                {
                                    item.isHaveTalent = true;
                                    list.Add(item);
                                }
                            }
                            break;
                        }
                    }
                    GameObject   gameObject = this.m_root.transform.Find("List1").gameObject;
                    GameObject[] objArray   = new GameObject[] { gameObject.transform.Find("talentCell1").gameObject, gameObject.transform.Find("talentCell2").gameObject, gameObject.transform.Find("talentCell3").gameObject };
                    for (int j = 0; j < objArray.Length; j++)
                    {
                        GameObject obj3 = objArray[j];
                        if (j < list.Count)
                        {
                            obj3.CustomSetActive(true);
                            stTalentEventParams params2 = list[j];
                            Image component             = obj3.transform.Find("imgIcon").GetComponent <Image>();
                            Text  text = obj3.transform.Find("panelDesc/Text").GetComponent <Text>();
                            component.SetSprite(CUIUtility.s_Sprite_Dynamic_Talent_Dir + params2.talentInfo.dwIcon, Singleton <CBattleSystem> .GetInstance().m_FormScript, true, false, false);
                            text.text = StringHelper.UTF8BytesToString(ref params2.talentInfo.szDesc2);
                            CUIEventScript  script      = obj3.GetComponent <CUIEventScript>();
                            stUIEventParams eventParams = new stUIEventParams {
                                talentParams = params2
                            };
                            script.SetUIEvent(enUIEventType.Click, enUIEventID.Talent_BtnLearnClick, eventParams);
                        }
                        else
                        {
                            obj3.CustomSetActive(false);
                        }
                    }
                    if (list.Count > 0)
                    {
                        gameObject.gameObject.CustomSetActive(true);
                    }
                    else
                    {
                        gameObject.gameObject.CustomSetActive(false);
                    }
                    CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_TalentFormPath);

                    if (form != null)
                    {
                        CUIListScript[] scriptArray = new CUIListScript[] { form.gameObject.transform.Find("Panel/PanelLeft/List1").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List2").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List3").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List4").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List5").GetComponent <CUIListScript>() };
                        for (int m = 0; m < this.m_talentRuleList.Count; m++)
                        {
                            HeroTalentLevelInfo info3 = heroTalentViewInfo.m_heroTalentLevelInfoList[m];
                            uint          num6        = heroTalentViewInfo.m_learnTalentList[m];
                            bool          flag        = heroTalentViewInfo.m_talentLevel > m;
                            CUIListScript script3     = scriptArray[m];
                            script3.SetElementAmount(info3.m_tarlentLibList.Count);
                            GameObject obj4 = script3.gameObject.transform.Find("Current").gameObject;
                            obj4.CustomSetActive(false);
                            for (int n = 0; n < info3.m_tarlentLibList.Count; n++)
                            {
                                GameObject     obj5    = script3.GetElemenet(n).gameObject.transform.Find("talentCell").gameObject;
                                Image          image   = obj5.transform.Find("imgIcon").GetComponent <Image>();
                                Image          image3  = obj5.transform.Find("lock").GetComponent <Image>();
                                Text           text2   = obj5.transform.Find("lblName").GetComponent <Text>();
                                CanvasGroup    group   = obj5.GetComponent <CanvasGroup>();
                                CUIEventScript script4 = obj5.GetComponent <CUIEventScript>();
                                ResTalentLib   lib     = info3.m_tarlentLibList[n];
                                if (lib == null)
                                {
                                    return;
                                }
                                image.SetSprite(CUIUtility.s_Sprite_Dynamic_Talent_Dir + lib.dwIcon, form, true, false, false);
                                image.color = CUIUtility.s_Color_White;
                                text2.text  = StringHelper.UTF8BytesToString(ref lib.szName);
                                stTalentEventParams params4 = new stTalentEventParams {
                                    talentLevelIndex = (byte)m,
                                    talentInfo       = info3.m_tarlentLibList[n],
                                    isCanLearn       = false
                                };
                                if (IsNeedBuy(m, n) && !IsBuyTalent(configId, m))
                                {
                                    params4.isHaveTalent = false;
                                    image3.gameObject.CustomSetActive(true);
                                }
                                else
                                {
                                    params4.isHaveTalent = true;
                                    image3.gameObject.CustomSetActive(false);
                                }
                                if (flag)
                                {
                                    if (num6 == 0)
                                    {
                                        if (params4.isHaveTalent)
                                        {
                                            params4.isCanLearn = true;
                                        }
                                        obj4.CustomSetActive(true);
                                    }
                                    else if (lib.dwID != num6)
                                    {
                                        group.alpha = 0.25f;
                                    }
                                    else
                                    {
                                        group.alpha = 1f;
                                    }
                                    image.color  = CUIUtility.s_Color_White;
                                    image3.color = CUIUtility.s_Color_White;
                                    text2.color  = CUIUtility.s_Color_White;
                                }
                                else
                                {
                                    image.color  = CUIUtility.s_Color_GrayShader;
                                    image3.color = CUIUtility.s_Color_GrayShader;
                                    text2.color  = CUIUtility.s_Color_Grey;
                                }
                                stUIEventParams params5 = new stUIEventParams {
                                    talentParams = params4
                                };
                                script4.SetUIEvent(enUIEventType.Click, enUIEventID.Talent_ItemClick, params5);
                            }
                        }
                    }
                }
            }
        }
コード例 #10
0
        public void RefreshForm(int effectIndex = -1)
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_talentBuyFormPath);

            if (form != null)
            {
                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                if (masterRoleInfo != null)
                {
                    CHeroInfo          heroInfo           = masterRoleInfo.GetHeroInfo(this.m_heroID, false);
                    HeroTalentViewInfo heroTalentViewInfo = TalentView.GetHeroTalentViewInfo(this.m_heroID);
                    if (heroTalentViewInfo != null)
                    {
                        CUIListScript[] scriptArray = new CUIListScript[] { form.gameObject.transform.Find("Panel/PanelLeft/List1").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List2").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List3").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List4").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List5").GetComponent <CUIListScript>() };
                        for (int i = 0; i < 5; i++)
                        {
                            CUIListScript       script2 = scriptArray[i];
                            HeroTalentLevelInfo info4   = heroTalentViewInfo.m_heroTalentLevelInfoList[i];
                            ResTalentLib        lib     = info4.m_tarlentLibList[info4.m_tarlentLibList.Count - 1];
                            Button component            = script2.transform.Find("BtnBuyCoin").GetComponent <Button>();
                            Text   text  = script2.transform.Find("lblTips").GetComponent <Text>();
                            Text   text2 = text.transform.Find("Text").GetComponent <Text>();
                            Image  image = text.transform.Find("Image").GetComponent <Image>();
                            component.gameObject.CustomSetActive(false);
                            text2.gameObject.CustomSetActive(false);
                            image.gameObject.CustomSetActive(false);
                            if (!TalentView.IsHaveTalentBuyFunc(this.m_heroID))
                            {
                                text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_3");
                            }
                            else if ((heroInfo == null) && (i == 0))
                            {
                                text.text = Singleton <CTextManager> .instance.GetText("Skin_NeedToBuyAHero");
                            }
                            else if (TalentView.IsBuyTalent(this.m_heroID, i))
                            {
                                text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_2");
                            }
                            else if ((i > 0) && !TalentView.IsBuyTalent(this.m_heroID, i - 1))
                            {
                                int      num2 = heroTalentViewInfo.m_heroTalentLevelInfoList[i - 1].m_tarlentLibList.Count - 1;
                                string   str  = StringHelper.UTF8BytesToString(ref heroTalentViewInfo.m_heroTalentLevelInfoList[i - 1].m_tarlentLibList[num2].szName);
                                string[] args = new string[] { str };
                                text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_4", args);
                            }
                            else
                            {
                                if (heroInfo == null)
                                {
                                    continue;
                                }
                                string str2 = StringHelper.UTF8BytesToString(ref CHeroInfo.GetHeroProficiency(heroInfo.cfgInfo.bJob, heroInfo.m_ProficiencyLV).szTitle);
                                string str3 = StringHelper.UTF8BytesToString(ref CHeroInfo.GetHeroProficiency(heroInfo.cfgInfo.bJob, info4.m_levelDetail.bLvl3UnlockLvl).szTitle);
                                if (heroInfo.m_ProficiencyLV < info4.m_levelDetail.bLvl3UnlockLvl)
                                {
                                    component.gameObject.CustomSetActive(true);
                                    stUIEventParams eventParams = new stUIEventParams {
                                        tag     = info4.m_levelDetail.bLvl3LockCostType,
                                        tagUInt = info4.m_levelDetail.dwLvl3LockCostPrice,
                                        tag2    = i,
                                        tagStr  = StringHelper.UTF8BytesToString(ref lib.szName)
                                    };
                                    CMallSystem.SetPayButton(form, (RectTransform)component.transform, CMallSystem.ResBuyTypeToPayType(info4.m_levelDetail.bLvl3LockCostType), info4.m_levelDetail.dwLvl3LockCostPrice, enUIEventID.Talent_Buy_BtnSellClick, ref eventParams);
                                    string[] textArray2 = new string[] { str3 };
                                    text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_7", textArray2);

                                    text2.gameObject.CustomSetActive(true);
                                    image.gameObject.CustomSetActive(true);
                                    CMallSystem.SetPayButton(form, (RectTransform)text.transform, CMallSystem.ResBuyTypeToPayType(info4.m_levelDetail.bLvl3UnLockCostType), info4.m_levelDetail.dwLvl3UnLockCostPrice, enUIEventID.None, ref eventParams);
                                }
                                else
                                {
                                    component.gameObject.CustomSetActive(true);
                                    stUIEventParams params2 = new stUIEventParams {
                                        tag     = info4.m_levelDetail.bLvl3UnLockCostType,
                                        tagUInt = info4.m_levelDetail.dwLvl3UnLockCostPrice,
                                        tag2    = i,
                                        tagStr  = StringHelper.UTF8BytesToString(ref lib.szName)
                                    };
                                    CMallSystem.SetPayButton(form, (RectTransform)component.transform, CMallSystem.ResBuyTypeToPayType(info4.m_levelDetail.bLvl3UnLockCostType), info4.m_levelDetail.dwLvl3UnLockCostPrice, enUIEventID.Talent_Buy_BtnSellClick, ref params2);
                                    string[] textArray3 = new string[] { str2 };
                                    text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_8", textArray3);
                                }
                            }
                            script2.SetElementAmount(info4.m_tarlentLibList.Count);
                            for (int j = 0; j < info4.m_tarlentLibList.Count; j++)
                            {
                                GameObject     gameObject = script2.GetElemenet(j).gameObject.transform.Find("talentCell").gameObject;
                                Image          image2     = gameObject.transform.Find("imgIcon").GetComponent <Image>();
                                Image          image3     = gameObject.transform.Find("lock").GetComponent <Image>();
                                Text           text3      = gameObject.transform.Find("lblName").GetComponent <Text>();
                                CanvasGroup    group      = gameObject.GetComponent <CanvasGroup>();
                                CUIEventScript script3    = gameObject.GetComponent <CUIEventScript>();
                                ResTalentLib   lib2       = info4.m_tarlentLibList[j];
                                if (lib2 == null)
                                {
                                    return;
                                }
                                image2.SetSprite(CUIUtility.s_Sprite_Dynamic_Talent_Dir + lib2.dwIcon, form, true, false, false);
                                image2.color = CUIUtility.s_Color_White;
                                text3.text   = StringHelper.UTF8BytesToString(ref lib2.szName);
                                stTalentEventParams params3 = new stTalentEventParams {
                                    talentLevelIndex = (byte)i,
                                    talentInfo       = info4.m_tarlentLibList[j],
                                    isCanLearn       = false
                                };
                                if (TalentView.IsNeedBuy(i, j) && !TalentView.IsBuyTalent(this.m_heroID, i))
                                {
                                    params3.isHaveTalent = false;
                                    image3.gameObject.CustomSetActive(true);
                                    image2.color = CUIUtility.s_Color_GrayShader;
                                }
                                else
                                {
                                    params3.isHaveTalent = true;
                                    image3.gameObject.CustomSetActive(false);
                                    image2.color = CUIUtility.s_Color_White;
                                    if ((effectIndex == i) && (j == (info4.m_tarlentLibList.Count - 1)))
                                    {
                                        CUICommonSystem.PlayAnimator(gameObject, "UnLock_Anim");
                                    }
                                }
                                string strContent = StringHelper.UTF8BytesToString(ref lib2.szDesc);
                                CUICommonSystem.SetCommonTipsEvent(form, gameObject, strContent, enUseableTipsPos.enTop);
                            }
                        }
                    }
                }
            }
        }