Exemple #1
0
        public static bool IsBuyTalent(uint heroID, int talentLevelIndex)
        {
            bool      flag           = false;
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                return(false);
            }
            CHeroInfo heroInfo = masterRoleInfo.GetHeroInfo(heroID, false);

            if (heroInfo == null)
            {
                return(false);
            }
            if ((talentLevelIndex >= heroInfo.m_talentBuyList.Length) || (talentLevelIndex < 0))
            {
                return(false);
            }
            if (heroInfo.m_talentBuyList[talentLevelIndex] == 1)
            {
                flag = true;
            }
            return(flag);
        }
Exemple #2
0
        public static string GetJobFeature(uint heroId)
        {
            string         text      = string.Empty;
            ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);
            CTextManager   instance  = Singleton <CTextManager> .GetInstance();

            if (dataByKey != null)
            {
                string text2 = string.Empty;
                for (int i = 0; i < dataByKey.JobFeature.Length; i++)
                {
                    text2 = CHeroInfo.GetFeatureStr((RES_HERO_JOB_FEATURE)dataByKey.JobFeature[i]);
                    if (!string.IsNullOrEmpty(text2))
                    {
                        if (!string.IsNullOrEmpty(text))
                        {
                            text = string.Format("{0}/{1}", text, text2);
                        }
                        else
                        {
                            text = text2;
                        }
                    }
                }
            }
            return(text);
        }
        public static void OnRecieveLimitSkinAdd(CSPkg msg)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            COMDT_HERO_LIMIT_SKIN_LIST stLimitSkinList = msg.stPkgData.stLimitSkinAdd.stLimitSkinList;

            for (int i = 0; i < stLimitSkinList.dwNum; i++)
            {
                COMDT_HERO_LIMIT_SKIN comdt_hero_limit_skin = stLimitSkinList.astSkinList[i];
                if (masterRoleInfo.heroExperienceSkinDic.ContainsKey(comdt_hero_limit_skin.dwSkinID))
                {
                    uint num2 = masterRoleInfo.heroExperienceSkinDic[comdt_hero_limit_skin.dwSkinID];
                    masterRoleInfo.heroExperienceSkinDic[comdt_hero_limit_skin.dwSkinID] = comdt_hero_limit_skin.dwDeadLine;
                    if ((0 < num2) && (num2 < masterRoleInfo.heroExperienceSkinDic[comdt_hero_limit_skin.dwSkinID]))
                    {
                        int      experienceHeroOrSkinExtendDays = CHeroInfo.GetExperienceHeroOrSkinExtendDays(masterRoleInfo.heroExperienceSkinDic[comdt_hero_limit_skin.dwSkinID] - num2);
                        string   skinName   = CSkinInfo.GetSkinName(comdt_hero_limit_skin.dwSkinID);
                        object[] replaceArr = new object[] { skinName, experienceHeroOrSkinExtendDays };
                        Singleton <CUIManager> .GetInstance().OpenTips("ExpCard_ExtendDays", true, 1f, null, replaceArr);
                    }
                }
                else
                {
                    uint num4;
                    uint num5;
                    masterRoleInfo.heroExperienceSkinDic.Add(comdt_hero_limit_skin.dwSkinID, comdt_hero_limit_skin.dwDeadLine);
                    CSkinInfo.ResolveHeroSkin(comdt_hero_limit_skin.dwSkinID, out num4, out num5);
                    CUICommonSystem.ShowNewHeroOrSkin(num4, num5, enUIEventID.None, true, COM_REWARDS_TYPE.COM_REWARDS_TYPE_SKIN, false, null, enFormPriority.Priority1, 0, CHeroInfo.GetExperienceHeroOrSkinValidDays(comdt_hero_limit_skin.dwDeadLine));
                }
            }
        }
Exemple #4
0
 public static string GetFriendSourceDesc(ulong friendUid, COMDT_FRIEND_SOURCE friendSource)
 {
     if (friendSource != null)
     {
         COM_ADD_FRIEND_TYPE bAddFriendType = friendSource.bAddFriendType;
         if (bAddFriendType == 1)
         {
             string heroName = CHeroInfo.GetHeroName(friendSource.stAddFriendInfo.get_stPvp().dwHeroID);
             if (!string.IsNullOrEmpty(heroName))
             {
                 return(Singleton <CTextManager> .GetInstance().GetText("Friend_Apply_Play_With_You_Tip", new string[]
                 {
                     heroName
                 }));
             }
             DebugHelper.Assert(false, "好友来源是PVP,但却获取不了英雄名,heroId={0}", new object[]
             {
                 friendSource.stAddFriendInfo.get_stPvp().dwHeroID
             });
         }
         else
         {
             if (CGuildHelper.IsInSameGuild(friendUid))
             {
                 return(Singleton <CTextManager> .GetInstance().GetText("Friend_Apply_Same_Guild_Tip"));
             }
             if (bAddFriendType == 2)
             {
                 return(Singleton <CTextManager> .GetInstance().GetText("Friend_Apply_Nearby_You_Tip"));
             }
         }
     }
     return(string.Empty);
 }
 private void OnHeroExperienceTimeUpdate(string heroName, uint oldDeadLine, uint newDeadLine)
 {
     if ((0 < oldDeadLine) && (oldDeadLine < newDeadLine))
     {
         int      experienceHeroOrSkinExtendDays = CHeroInfo.GetExperienceHeroOrSkinExtendDays(newDeadLine - oldDeadLine);
         object[] replaceArr = new object[] { heroName, experienceHeroOrSkinExtendDays };
         Singleton <CUIManager> .GetInstance().OpenTips("ExpCard_ExtendDays", true, 1f, null, replaceArr);
     }
 }
Exemple #6
0
 private static bool ParsePlayerProperty(CHeroInfo heroInfo, string s, out int value)
 {
     value = 0;
     if (s[0] == 'k')
     {
         RES_FUNCEFT_TYPE res_funceft_type = (RES_FUNCEFT_TYPE)Convert.ToInt32(s.Substring(1));
         value = heroInfo.mActorValue[res_funceft_type].totalValue;
         return(true);
     }
     return(false);
 }
Exemple #7
0
 public CHeroInfoData(CHeroInfo info)
 {
     DebugHelper.Assert(info != null, "Create CHeroInfoData, CHeroInfo = null");
     if (info != null)
     {
         this.m_info    = info;
         this.m_name    = StringHelper.UTF8BytesToString(ref info.cfgInfo.szName);
         this.m_imgPath = StringHelper.UTF8BytesToString(ref info.cfgInfo.szImagePath);
         this.m_tilte   = StringHelper.UTF8BytesToString(ref info.cfgInfo.szHeroTitle);
     }
 }
Exemple #8
0
 private static bool ParsePlayerProperty(CHeroInfo heroInfo, string s, out int value)
 {
     value = 0;
     if (s.get_Chars(0) == 'k')
     {
         int num = Convert.ToInt32(s.Substring(1));
         RES_FUNCEFT_TYPE key = (RES_FUNCEFT_TYPE)num;
         value = heroInfo.mActorValue[key].totalValue;
         return(true);
     }
     return(false);
 }
        public static void ReciveHeroAWakeStepCHG(CSPkg msg)
        {
            SCPKG_CMD_HERO_WAKESTEP stHeroWakeStep = msg.stPkgData.stHeroWakeStep;
            CHeroInfo heroInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().GetHeroInfo(stHeroWakeStep.dwHeroID, false);

            heroInfo.m_awakeStepID  = stHeroWakeStep.dwWakeStep;
            heroInfo.m_isStepFinish = false;
            Singleton <CUIManager> .GetInstance().CloseForm(s_heroAwakeFormPath);

            Singleton <CHeroAwakeSystem> .GetInstance().OpenAwakeTaskForm();

            Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();
        }
Exemple #10
0
        public static int GetInitCombatByHeroId(uint id)
        {
            ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(id);

            if (dataByKey == null)
            {
                return(0);
            }
            int combatEftByStarLevel = CHeroInfo.GetCombatEftByStarLevel(1, dataByKey.iInitialStar);
            int combatEft            = CSkinInfo.GetCombatEft(id, 0u);

            return(combatEftByStarLevel + combatEft);
        }
        public static void ReciveHeroAWakeStateCHG(CSPkg msg)
        {
            SCPKG_CMD_HERO_WAKECHG stHeroWakeChg = msg.stPkgData.stHeroWakeChg;
            CHeroInfo heroInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().GetHeroInfo(stHeroWakeChg.dwHeroID, false);

            heroInfo.m_awakeState = stHeroWakeChg.bWakeState;
            if (heroInfo.m_awakeState == 3)
            {
                Singleton <CUIManager> .GetInstance().CloseForm(s_heroAwakeTaskFormPath);

                Singleton <CHeroAwakeSystem> .GetInstance().OpenAwakeAwardForm();
            }
            Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();
        }
Exemple #12
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);
        }
Exemple #13
0
        public static string GetHeroJob(uint heroId)
        {
            string         text      = string.Empty;
            ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);
            CTextManager   instance  = Singleton <CTextManager> .GetInstance();

            if (dataByKey != null)
            {
                if (dataByKey.bMainJob > 0)
                {
                    text += CHeroInfo.GetHeroJobStr((RES_HERO_JOB)dataByKey.bMainJob);
                }
                if (dataByKey.bMinorJob > 0)
                {
                    text = string.Format("{0}/{1}", text, CHeroInfo.GetHeroJobStr((RES_HERO_JOB)dataByKey.bMinorJob));
                }
            }
            return(text);
        }
        public static void OnRecieveLimitSkinAdd(CSPkg msg)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            COMDT_HERO_LIMIT_SKIN_LIST stLimitSkinList = msg.stPkgData.get_stLimitSkinAdd().stLimitSkinList;
            int num = 0;

            while ((long)num < (long)((ulong)stLimitSkinList.dwNum))
            {
                COMDT_HERO_LIMIT_SKIN cOMDT_HERO_LIMIT_SKIN = stLimitSkinList.astSkinList[num];
                if (masterRoleInfo.heroExperienceSkinDic.ContainsKey(cOMDT_HERO_LIMIT_SKIN.dwSkinID))
                {
                    uint num2 = masterRoleInfo.heroExperienceSkinDic.get_Item(cOMDT_HERO_LIMIT_SKIN.dwSkinID);
                    masterRoleInfo.heroExperienceSkinDic.set_Item(cOMDT_HERO_LIMIT_SKIN.dwSkinID, cOMDT_HERO_LIMIT_SKIN.dwDeadLine);
                    if (0u < num2 && num2 < masterRoleInfo.heroExperienceSkinDic.get_Item(cOMDT_HERO_LIMIT_SKIN.dwSkinID))
                    {
                        int    experienceHeroOrSkinExtendDays = CHeroInfo.GetExperienceHeroOrSkinExtendDays(masterRoleInfo.heroExperienceSkinDic.get_Item(cOMDT_HERO_LIMIT_SKIN.dwSkinID) - num2);
                        string skinName = CSkinInfo.GetSkinName(cOMDT_HERO_LIMIT_SKIN.dwSkinID);
                        Singleton <CUIManager> .GetInstance().OpenTips("ExpCard_ExtendDays", true, 1f, null, new object[]
                        {
                            skinName,
                            experienceHeroOrSkinExtendDays
                        });
                    }
                }
                else
                {
                    masterRoleInfo.heroExperienceSkinDic.Add(cOMDT_HERO_LIMIT_SKIN.dwSkinID, cOMDT_HERO_LIMIT_SKIN.dwDeadLine);
                    uint heroId;
                    uint skinId;
                    CSkinInfo.ResolveHeroSkin(cOMDT_HERO_LIMIT_SKIN.dwSkinID, out heroId, out skinId);
                    if (!Singleton <CHeroSelectBaseSystem> .get_instance().m_isInHeroSelectState)
                    {
                        CUICommonSystem.ShowNewHeroOrSkin(heroId, skinId, enUIEventID.None, true, 10, false, null, enFormPriority.Priority1, 0u, CHeroInfo.GetExperienceHeroOrSkinValidDays(cOMDT_HERO_LIMIT_SKIN.dwDeadLine));
                    }
                    else if (!Singleton <CHeroSelectBaseSystem> .get_instance().IsMultilMode())
                    {
                        CHeroInfoSystem2.ReqWearHeroSkin(heroId, skinId, true);
                    }
                }
                num++;
            }
        }
        private void HeroAwake_Open(CUIEvent uiEvent)
        {
            this.m_heroInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().GetHeroInfo(uiEvent.m_eventParams.tagUInt, false);

            if (this.m_heroInfo != null)
            {
                if (this.m_heroInfo.m_awakeState == 2)
                {
                    this.OpenAwakeTaskForm();
                }
                else if (this.m_heroInfo.m_awakeState == 3)
                {
                    Singleton <CUIManager> .GetInstance().OpenTips(Singleton <CTextManager> .instance.GetText("HeroAwake_Tips2"), false, 1f, null, new object[0]);
                }
                else
                {
                    this.OpenStartAwakeForm();
                }
            }
        }
Exemple #16
0
        public int GetCombatEft()
        {
            DebugHelper.Assert(this.mActorValue != null, "GetCombatEft mActorValue is null");
            int num = 0;

            if (this.mActorValue != null)
            {
                num = CHeroInfo.GetCombatEftByStarLevel(this.mActorValue.actorLvl, this.mActorValue.actorStar);
            }
            int       combatEft      = CSkinInfo.GetCombatEft(this.cfgInfo.dwCfgID, this.m_skinInfo.GetWearSkinId());
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "GetCombatEft master is null");
            int num2 = 0;

            if (masterRoleInfo != null)
            {
                num2 = masterRoleInfo.m_symbolInfo.GetSymbolPageEft(this.m_selectPageIndex);
            }
            return(num + combatEft + num2);
        }
Exemple #17
0
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true);

            if (null != formScript)
            {
                this._root                 = formScript.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._count                = 1;
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0;
                this._maxCount             = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem item = new CItem(0L, id, 0, 0);
                    uint  key  = (uint)item.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key);
                    ListView <CUseable>  view      = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (useable != null)
                            {
                                view.Add(useable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.text = item.m_description;
                    }
                    uint num3 = 0;
                    int  num4 = 0;
                    if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem item2 = (CItem)this._usb;
                        if (((item2 != null) && (item2.m_itemData != null)) && (item2.m_itemData.bType == 4))
                        {
                            this._bDynamicCorrectPrice = item2.m_itemData.EftParam[3] > 0f;
                        }
                    }
                    for (int j = 0; j < 10; j++)
                    {
                        GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject;
                        if (j < view.Count)
                        {
                            gameObject.CustomSetActive(true);
                            CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false);
                            Transform transform = gameObject.transform.Find("HaveItemFlag");
                            transform.gameObject.CustomSetActive(false);
                            if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                            {
                                this._bHeroSkinGift = true;
                                CHeroItem item3          = view[j] as CHeroItem;
                                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item3.m_heroData.dwCfgID))
                                {
                                    num3 += CHeroInfo.GetHeroCost(item3.m_heroData.dwCfgID, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                            else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                            {
                                this._bHeroSkinGift = true;
                                CHeroSkin skin  = view[j] as CHeroSkin;
                                CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false))
                                {
                                    num3 += CSkinInfo.GetHeroSkinCost(skin.m_heroId, skin.m_skinId, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                        }
                        else
                        {
                            gameObject.CustomSetActive(false);
                        }
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false));
                    }
                    Text componetInChild = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText");
                    componetInChild.text = string.Empty;
                    if (this._bHeroSkinGift && this._bDynamicCorrectPrice)
                    {
                        uint   buyPrice = this._usb.GetBuyPrice(coinType);
                        Button btn      = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale");
                        if (num4 >= view.Count)
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, false, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip");

                            this._heroSkinGiftCost = 0;
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, true, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip");

                            uint num7 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num3, this._realDiscount);
                            if ((buyPrice >= num3) && (num7 >= (buyPrice / 10)))
                            {
                                this._heroSkinGiftCost = num7;
                            }
                            else
                            {
                                this._heroSkinGiftCost = buyPrice / 10;
                            }
                        }
                        if (this._callContext != null)
                        {
                            this._callContext.m_bChangeGiftPrice = true;
                            this._callContext.m_newGiftPrice     = this._heroSkinGiftCost;
                        }
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                this.ValidateDynamic();
            }
        }
Exemple #18
0
        public void UpdateUI()
        {
            CUIFormScript form = Singleton <CUIManager> .instance.GetForm(CPlayerInfoSystem.sPlayerInfoFormPath);

            if (form == null)
            {
                return;
            }
            GameObject widget = form.GetWidget(32);

            if (widget == null)
            {
                return;
            }
            CPlayerProfile profile = Singleton <CPlayerInfoSystem> .instance.GetProfile();

            if (profile == null)
            {
                return;
            }
            this.CheckLoadAddressBook();
            this.SetFriendCardByWidgets(ref profile._socialCardInfo, true);
            bool      flag       = CPlayerInfoSystem.isSelf(profile.m_uuid);
            Transform transform  = widget.transform.Find("pnlContainer/Social_BtnGroupTop");
            Transform transform2 = widget.transform.Find("pnlContainer/Social_BtnGroupTopWatch");
            Transform transform3 = widget.transform.Find("pnlContainer/Social_BtnGroupBottom");
            Transform transform4 = widget.transform.Find("pnlContainer/Social_Sign");

            if (!flag)
            {
                this.m_isInEditmode = false;
                Singleton <CPlayerMentorInfoController> .GetInstance().MentorBtnUIUpdate();
            }
            for (int i = 0; i < this.m_searchTypeNodes.Length; i++)
            {
                if (this.m_searchTypeNodes[i] != null)
                {
                    this.m_searchTypeNodes[i].gameObject.CustomSetActive(this.m_isInEditmode);
                }
            }
            string[]   array      = null;
            GameObject gameObject = this.m_displyTypeNodes[0].gameObject;

            if (!this.m_isInEditmode)
            {
                string srvAddr = StringHelper.UTF8BytesToString(ref profile._socialCardInfo.szPlace);
                array = this.GetLocations(srvAddr);
                gameObject.GetComponent <Text>().set_color(this.m_colorHighlight);
                gameObject.transform.parent.Find("Title").GetComponent <Text>().set_color(this.m_colorHighlight);
            }
            else
            {
                gameObject.GetComponent <Text>().set_color(this.m_colorNormal);
                gameObject.transform.parent.Find("Title").GetComponent <Text>().set_color(this.m_colorNormal);
            }
            try
            {
                GameObject gameObject2 = this.m_displyTypeNodes[3].transform.parent.Find("img1").gameObject;
                GameObject gameObject3 = this.m_displyTypeNodes[3].transform.parent.Find("img2").gameObject;
                gameObject2.CustomSetActive(!this.m_isInEditmode);
                gameObject3.CustomSetActive(!this.m_isInEditmode);
                for (int j = 0; j < this.m_searchTypeNodes.Length; j++)
                {
                    if (this.m_displyTypeNodes[j] != null)
                    {
                        this.m_displyTypeNodes[j].gameObject.CustomSetActive(!this.m_isInEditmode);
                        Text component = this.m_displyTypeNodes[j].GetComponent <Text>();
                        if (!this.m_isInEditmode)
                        {
                            switch (j)
                            {
                            case 0:
                                component.set_text(this.GetSearchStr(j, (int)profile._socialCardInfo.dwSearchType));
                                break;

                            case 1:
                                component.set_text(this.GetSearchStr(j, (int)profile._socialCardInfo.dwDay));
                                break;

                            case 2:
                                component.set_text(this.GetSearchStr(j, (int)profile._socialCardInfo.dwHour));
                                break;

                            case 3:
                                try
                                {
                                    string searchStr = this.GetSearchStr(j, (int)profile._socialCardInfo.wHeroTypeOne);
                                    int    num       = Convert.ToInt32(searchStr);
                                    gameObject2.CustomSetActive(num != 0);
                                    if (num == 0)
                                    {
                                        component.set_text("-");
                                    }
                                    else
                                    {
                                        component.set_text(CHeroInfo.GetHeroJobStr((RES_HERO_JOB)num));
                                        CUICommonSystem.SetHeroJob(form, gameObject2, (enHeroJobType)num);
                                    }
                                    this.m_searchTypeNodes[j].transform.FindChild("List").GetComponent <CUIListScript>().SelectElement(this.GetIndexByString(j, searchStr), true);
                                }
                                catch (Exception var_18_38C)
                                {
                                    Debug.LogError("social 配置表JOB错误,找jason");
                                }
                                break;

                            case 4:
                                try
                                {
                                    string searchStr2 = this.GetSearchStr(j, (int)profile._socialCardInfo.wHeroTypeTwo);
                                    int    num2       = Convert.ToInt32(searchStr2);
                                    gameObject3.CustomSetActive(num2 != 0);
                                    if (num2 == 0)
                                    {
                                        component.set_text("-");
                                    }
                                    else
                                    {
                                        component.set_text(CHeroInfo.GetHeroJobStr((RES_HERO_JOB)num2));
                                        CUICommonSystem.SetHeroJob(form, gameObject3, (enHeroJobType)num2);
                                    }
                                    this.m_searchTypeNodes[j].transform.FindChild("List").GetComponent <CUIListScript>().SelectElement(this.GetIndexByString(j, searchStr2), true);
                                }
                                catch (Exception var_21_431)
                                {
                                    Debug.LogError("social 配置表JOB错误,找jason");
                                }
                                break;

                            case 5:
                                if (array != null && array.Length > 0)
                                {
                                    component.set_text(array[0]);
                                }
                                else
                                {
                                    component.set_text("-");
                                }
                                break;

                            case 6:
                                if (array != null && array.Length > 1)
                                {
                                    component.set_text(array[1]);
                                }
                                else
                                {
                                    component.set_text("-");
                                }
                                break;
                            }
                            if (flag && j != 3 && j != 4 && this.m_searchStrings[j] != null)
                            {
                                this.m_searchTypeNodes[j].transform.FindChild("List").GetComponent <CUIListScript>().SelectElement(this.GetIndexByString(j, component.get_text()), true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.LogError("social card setting error:" + ex);
            }
            if (transform != null)
            {
                transform.gameObject.CustomSetActive(flag && !this.m_isInEditmode);
                if (flag)
                {
                    this.SetHideCardButton();
                }
            }
            if (transform3 != null)
            {
                transform3.gameObject.CustomSetActive(flag && this.m_isInEditmode);
            }
            if (transform2 != null)
            {
                transform2.gameObject.CustomSetActive(!flag);
                if (!flag)
                {
                    GameObject gameObject4 = transform2.transform.FindChild("AddFriendBtn").gameObject;
                    bool       flag2       = Singleton <CFriendContoller> .GetInstance().model.IsContain(CFriendModel.FriendType.GameFriend, profile.m_uuid, (uint)profile.m_iLogicWorldId);

                    gameObject4.CustomSetActive(!flag2);
                    GameObject gameObject5 = transform2.transform.FindChild("AddGuildBtn").gameObject;
                    bool       bActive     = Singleton <CGuildSystem> .GetInstance().IsInNormalGuild() && !CGuildHelper.IsInSameGuild((ulong)((long)profile.m_iLogicWorldId));

                    gameObject5.CustomSetActive(bActive);
                    GameObject gameObject6 = transform2.transform.FindChild("AddMentorBtn").gameObject;
                    Singleton <CPlayerMentorInfoController> .GetInstance().MentorBtnUIUpdate();

                    gameObject6.CustomSetActive(Singleton <CPlayerMentorInfoController> .GetInstance().mentorBtnStr != null);
                    if (Singleton <CPlayerMentorInfoController> .GetInstance().mentorBtnStr != null)
                    {
                        gameObject6.transform.Find("Text").GetComponent <Text>().set_text(Singleton <CPlayerMentorInfoController> .GetInstance().mentorBtnStr);
                    }
                }
            }
            if (transform4 != null)
            {
                GameObject gameObject7   = transform4.FindChild("InputCtrl").gameObject;
                InputField signInputText = this.GetSignInputText();
                gameObject7.CustomSetActive(true);
                gameObject7.GetComponent <InputField>().set_interactable(this.m_isInEditmode);
            }
            if (!this.m_isInEditmode)
            {
                string     text           = StringHelper.UTF8BytesToString(ref profile._socialCardInfo.szDatingDeclaration);
                InputField signInputText2 = this.GetSignInputText();
                if (signInputText2)
                {
                    signInputText2.set_text(text);
                }
            }
            this.UpdateTags();
        }
Exemple #19
0
        public void Load(CUIFormScript form)
        {
            if (form == null)
            {
                return;
            }
            GameObject widget  = form.GetWidget(32);
            GameObject widget2 = form.GetWidget(33);

            widget2.CustomSetActive(false);
            if (widget == null)
            {
                for (int i = 0; i < this.m_searchTypeNodes.Length; i++)
                {
                    this.m_searchTypeNodes[i] = null;
                }
                for (int j = 0; j < this.m_searchTypeNodes.Length; j++)
                {
                    this.m_displyTypeNodes[j] = null;
                }
                return;
            }
            this.m_searchTypeNodes[0] = widget.transform.Find("pnlContainer/Social_IWant/DropList");
            this.m_searchTypeNodes[5] = widget.transform.Find("pnlContainer/Social_Position/DropList1");
            this.m_searchTypeNodes[6] = widget.transform.Find("pnlContainer/Social_Position/DropList2");
            this.m_searchTypeNodes[1] = widget.transform.Find("pnlContainer/Social_Time/WeekDropList");
            this.m_searchTypeNodes[2] = widget.transform.Find("pnlContainer/Social_Time/DayDropList");
            this.m_searchTypeNodes[3] = widget.transform.Find("pnlContainer/Social_Speciality/DropList1");
            this.m_searchTypeNodes[4] = widget.transform.Find("pnlContainer/Social_Speciality/DropList2");
            this.m_displyTypeNodes[0] = widget.transform.Find("pnlContainer/Social_IWant/Content");
            this.m_displyTypeNodes[5] = widget.transform.Find("pnlContainer/Social_Position/Content1");
            this.m_displyTypeNodes[6] = widget.transform.Find("pnlContainer/Social_Position/Content2");
            this.m_displyTypeNodes[1] = widget.transform.Find("pnlContainer/Social_Time/WeekContent");
            this.m_displyTypeNodes[2] = widget.transform.Find("pnlContainer/Social_Time/DayContent");
            this.m_displyTypeNodes[3] = widget.transform.Find("pnlContainer/Social_Speciality/Content1");
            this.m_displyTypeNodes[4] = widget.transform.Find("pnlContainer/Social_Speciality/Content2");
            string[] array  = this.m_searchStrings[3];
            string[] array2 = new string[array.Length];
            try
            {
                for (int k = 0; k < array.Length; k++)
                {
                    array2[k] = CHeroInfo.GetHeroJobStr((RES_HERO_JOB)Convert.ToInt32(array[k]));
                }
            }
            catch (Exception var_7_20E)
            {
                Debug.LogError("social 配置表JOB错误,找jason");
            }
            CUIUtility.ClearTextComboboxContent();
            for (int l = 0; l < 6; l++)
            {
                if (!(this.m_searchTypeNodes[l] == null) && this.m_searchStrings[l] != null)
                {
                    CUIListScript component  = this.m_searchTypeNodes[l].Find("List").GetComponent <CUIListScript>();
                    GameObject    gameObject = this.m_searchTypeNodes[l].Find("Button_Down").gameObject;
                    switch (l)
                    {
                    case 3:
                    case 4:
                        CUIUtility.RegisterTextComboboxContent(gameObject, component, array2, null);
                        break;

                    case 5:
                        CUIUtility.RegisterTextComboboxContent(gameObject, component, this.m_searchStrings[l], new CUIUtility.TextComboClickCallback(this.OnLocation1Choose));
                        break;

                    default:
                        CUIUtility.RegisterTextComboboxContent(gameObject, component, this.m_searchStrings[l], null);
                        break;
                    }
                }
            }
            this.m_isInEditmode = false;
            this.UpdateUI();
        }
Exemple #20
0
        private void SetHeroAddExpItem(CUIFormScript formScript, GameObject listElement, CHeroInfo info)
        {
            Text component = listElement.transform.Find("TextName").GetComponent <Text>();
            Text text2     = listElement.transform.Find("TextLevel").GetComponent <Text>();

            component.text = StringHelper.UTF8BytesToString(ref info.cfgInfo.szName);
            text2.text     = "Lv." + info.mActorValue.actorLvl.ToString();
            CUICommonSystem.SetProgressBarData(listElement.transform.Find("progressBar").gameObject, info.mActorValue.actorExp, info.mActorValue.actorMaxExp, false);
        }
Exemple #21
0
        public static int CalcEscapeValue(string escapeString, CHeroInfo heroInfo, int skillLevel, int heroSoulLevel, uint heroId)
        {
            string text  = string.Empty;
            string text2 = string.Empty;

            string[] array = escapeString.Split(new char[]
            {
                '+',
                '-'
            });
            List <int>  list  = new List <int>();
            List <int>  list2 = new List <int>();
            List <char> list3 = new List <char>();
            List <char> list4 = new List <char>();

            for (int i = 0; i < array.Length; i++)
            {
                list2.Clear();
                list4.Clear();
                text = array[i];
                string[] array2 = text.Split(new char[]
                {
                    '*',
                    '/'
                });
                for (int j = 0; j < array2.Length; j++)
                {
                    text2 = array2[j];
                    int num;
                    if (int.TryParse(text2, ref num))
                    {
                        list2.Add(num);
                    }
                    else if (CSkillData.ParsePlayerProperty(heroInfo, text2, out num))
                    {
                        list2.Add(num);
                    }
                    else if (CSkillData.ParseSkillProperty(text2, out num, heroId))
                    {
                        list2.Add(num);
                    }
                    else if (CSkillData.ParseSkillLevel(text2, out num, skillLevel))
                    {
                        list2.Add(num);
                    }
                    else
                    {
                        if (!CSkillData.ParseHeroSoulLevel(text2, out num, heroSoulLevel))
                        {
                            DebugHelper.Assert(false, "Skill Data Desc[{0}] can not be parsed..", new object[]
                            {
                                text2
                            });
                            return(0);
                        }
                        list2.Add(num);
                    }
                }
                for (int k = 0; k < text.get_Length(); k++)
                {
                    char c = text.get_Chars(k);
                    if (c.Equals('*') || c.Equals('/'))
                    {
                        list4.Add(c);
                    }
                }
                int num2 = list2.get_Item(0);
                for (int l = 0; l < list4.get_Count(); l++)
                {
                    char c2 = list4.get_Item(l);
                    if (c2 != '*')
                    {
                        if (c2 == '/')
                        {
                            num2 /= list2.get_Item(l + 1);
                        }
                    }
                    else
                    {
                        num2 *= list2.get_Item(l + 1);
                    }
                }
                list.Add(num2);
            }
            for (int m = 0; m < escapeString.get_Length(); m++)
            {
                char c3 = escapeString.get_Chars(m);
                if (c3.Equals('+') || c3.Equals('-'))
                {
                    list3.Add(c3);
                }
            }
            int num3 = list.get_Item(0);

            for (int n = 0; n < list3.get_Count(); n++)
            {
                switch (list3.get_Item(n))
                {
                case '+':
                    num3 += list.get_Item(n + 1);
                    break;

                case '-':
                    num3 -= list.get_Item(n + 1);
                    break;
                }
            }
            return(num3);
        }
        private void SetName(CUIListElementScript elemt, HeroKDA p)
        {
            Text component = elemt.transform.FindChild("Name").GetComponent <Text>();

            component.set_text(CHeroInfo.GetHeroName((uint)p.HeroId));
        }
Exemple #23
0
        public static int CalcEscapeValue(string escapeString, CHeroInfo heroInfo, int skillLevel)
        {
            char   ch;
            string str = string.Empty;

            str2 = string.Empty;
            char[]      separator = new char[] { '+', '-' };
            string[]    strArray  = escapeString.Split(separator);
            List <int>  list      = new List <int>();
            List <int>  list2     = new List <int>();
            List <char> list3     = new List <char>();
            List <char> list4     = new List <char>();

            for (int i = 0; i < strArray.Length; i++)
            {
                list2.Clear();
                list4.Clear();
                str = strArray[i];
                char[] chArray2 = new char[] { '*', '/' };
                foreach (string str2 in str.Split(chArray2))
                {
                    int num3;
                    if (int.TryParse(str2, out num3))
                    {
                        list2.Add(num3);
                    }
                    else if (ParsePlayerProperty(heroInfo, str2, out num3))
                    {
                        list2.Add(num3);
                    }
                    else if (ParseSkillProperty(str2, out num3))
                    {
                        list2.Add(num3);
                    }
                    else if (ParseSkillLevel(str2, out num3, skillLevel))
                    {
                        list2.Add(num3);
                    }
                    else
                    {
                        object[] inParameters = new object[] { str2 };
                        DebugHelper.Assert(false, "Skill Data Desc[{0}] can not be parsed..", inParameters);
                        return(0);
                    }
                }
                for (int m = 0; m < str.Length; m++)
                {
                    ch = str[m];
                    if (ch.Equals('*') || ch.Equals('/'))
                    {
                        list4.Add(ch);
                    }
                }
                int item = list2[0];
                for (int n = 0; n < list4.Count; n++)
                {
                    switch (list4[n])
                    {
                    case '*':
                        item *= list2[n + 1];
                        break;

                    case '/':
                        item /= list2[n + 1];
                        break;
                    }
                }
                list.Add(item);
            }
            for (int j = 0; j < escapeString.Length; j++)
            {
                ch = escapeString[j];
                if (ch.Equals('+') || ch.Equals('-'))
                {
                    list3.Add(ch);
                }
            }
            int num = list[0];

            for (int k = 0; k < list3.Count; k++)
            {
                switch (list3[k])
                {
                case '+':
                    num += list[k + 1];
                    break;

                case '-':
                    num -= list[k + 1];
                    break;
                }
            }
            return(num);
        }
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, BuyPickDialog.OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, BuyPickDialog.OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null, bool bfromFactoyShop = false)
        {
            this.m_bShowBigIcon = (callContext != null && callContext.GetSpecialIconPath() != null);
            CUIFormScript cUIFormScript;

            if (this.m_bShowBigIcon)
            {
                cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Big_Icon_Form_Path, false, true);
            }
            else
            {
                cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Form_Path, false, true);
            }
            if (null != cUIFormScript)
            {
                this._root                 = cUIFormScript.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._count                = 1u;
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0u;
                this._maxCount             = maxCount;
                if (this._maxCount == 0u)
                {
                    this._maxCount = 999u;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem cItem = new CItem(0uL, id, 0, 0);
                    uint  key   = (uint)cItem.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key);
                    ListView <CUseable>  listView  = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable cUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (cUseable != null)
                            {
                                listView.Add(cUseable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.set_text(string.IsNullOrEmpty(cItem.m_mallDescription) ? cItem.m_description : cItem.m_mallDescription);
                    }
                    uint num  = 0u;
                    int  num2 = 0;
                    if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem cItem2 = (CItem)this._usb;
                        if (cItem2 != null && cItem2.m_itemData != null && cItem2.m_itemData.bType == 4)
                        {
                            this._bDynamicCorrectPrice = (cItem2.m_itemData.EftParam[3] > 0f);
                        }
                    }
                    CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(cUIFormScript.gameObject, "Panel/itemGroup");
                    componetInChild.SetElementAmount(listView.Count);
                    for (int j = 0; j < listView.Count; j++)
                    {
                        CUIListElementScript elemenet = componetInChild.GetElemenet(j);
                        this.UpdateElement(elemenet, listView[j], this.m_bShowBigIcon);
                        if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                        {
                            this._bHeroSkinGift = true;
                            CHeroItem cHeroItem      = listView[j] as CHeroItem;
                            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo != null && masterRoleInfo.IsOwnHero(cHeroItem.m_heroData.dwCfgID))
                            {
                                num += CHeroInfo.GetHeroCost(cHeroItem.m_heroData.dwCfgID, coinType);
                                num2++;
                            }
                        }
                        else if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                        {
                            this._bHeroSkinGift = true;
                            CHeroSkin cHeroSkin       = listView[j] as CHeroSkin;
                            CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo2 != null && masterRoleInfo2.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false))
                            {
                                num += CSkinInfo.GetHeroSkinCost(cHeroSkin.m_heroId, cHeroSkin.m_skinId, coinType);
                                num2++;
                            }
                        }
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false), false);
                    }
                    Text componetInChild2 = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText");
                    componetInChild2.set_text(string.Empty);
                    if (this._bHeroSkinGift && this._bDynamicCorrectPrice)
                    {
                        uint   buyPrice         = this._usb.GetBuyPrice(coinType);
                        Button componetInChild3 = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale");
                        if (num2 >= listView.Count)
                        {
                            CUICommonSystem.SetButtonEnableWithShader(componetInChild3, false, true);
                            componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip"));
                            this._heroSkinGiftCost = 0u;
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnableWithShader(componetInChild3, true, true);
                            componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip"));
                            uint num3 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num, this._realDiscount);
                            if (buyPrice >= num && num3 >= buyPrice / 10u)
                            {
                                this._heroSkinGiftCost = num3;
                            }
                            else
                            {
                                this._heroSkinGiftCost = buyPrice / 10u;
                            }
                        }
                        if (this._callContext != null)
                        {
                            this._callContext.m_bChangeGiftPrice = true;
                            this._callContext.m_newGiftPrice     = this._heroSkinGiftCost;
                        }
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_CloseForm, new CUIEventManager.OnUIEventHandler(this.OnCloseForm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_ConfirmFactoryShopBuy, new CUIEventManager.OnUIEventHandler(this.OnConfirmFactoryShopBuy));

                this.ValidateDynamic();
            }
        }
Exemple #25
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);
                            }
                        }
                    }
                }
            }
        }