Exemple #1
0
 public void Init(ulong playerId, COMDT_HEROINFO svrInfo)
 {
     this.cfgInfo = GameDataMgr.heroDatabin.GetDataByKey(svrInfo.stCommonInfo.dwHeroID);
     GameDataMgr.heroShopInfoDict.TryGetValue(svrInfo.stCommonInfo.dwHeroID, out this.shopCfgInfo);
     this.m_selectPageIndex = svrInfo.stCommonInfo.bSymbolPageWear;
     if (this.mActorValue == null)
     {
         this.mActorValue = new PropertyHelper();
     }
     this.mActorValue.Init(svrInfo);
     if (this.skillInfo == null)
     {
         this.skillInfo = new CSkillData();
     }
     this.skillInfo.InitSkillData(this.cfgInfo, svrInfo.stCommonInfo.stSkill);
     this.m_Proficiency   = svrInfo.stCommonInfo.stProficiency.dwProficiency;
     this.m_ProficiencyLV = svrInfo.stCommonInfo.stProficiency.bLv;
     this.MaskBits        = svrInfo.stCommonInfo.dwMaskBits;
     this.m_skinInfo.Init(svrInfo.stCommonInfo.wSkinID);
     this.m_talentBuyList = new byte[svrInfo.stCommonInfo.stTalent.astTalentInfo.Length];
     for (int i = 0; i < svrInfo.stCommonInfo.stTalent.astTalentInfo.Length; i++)
     {
         this.m_talentBuyList[i] = svrInfo.stCommonInfo.stTalent.astTalentInfo[i].bIsBuyed;
     }
     this.m_awakeState         = svrInfo.stCommonInfo.stTalent.bWakeState;
     this.m_awakeStepID        = svrInfo.stCommonInfo.stTalent.stWakeStep.dwStepID;
     this.m_isStepFinish       = svrInfo.stCommonInfo.stTalent.stWakeStep.bIsFinish == 1;
     this.m_experienceDeadLine = !this.IsExperienceHero() ? 0 : svrInfo.stCommonInfo.dwDeadLine;
     this.m_masterHeroFightCnt = svrInfo.stCommonInfo.dwMasterTotalFightCnt;
     this.m_masterHeroWinCnt   = svrInfo.stCommonInfo.dwMasterTotalWinCnt;
 }
Exemple #2
0
 public static void Preload(ref ActorPreloadTab preloadTab)
 {
     for (int i = 1; i <= 4; i++)
     {
         preloadTab.AddSprite(CSkillData.GetEffectSlotBg((SkillEffectType)i));
     }
 }
Exemple #3
0
        public string GetSkillUpTip(int slotId, uint heroId)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            CHeroInfo cHeroInfo;

            masterRoleInfo.GetHeroInfo(this.m_heroCfgId, out cHeroInfo, true);
            DebugHelper.Assert(cHeroInfo != null);
            ResSkillCfgInfo dataByKey = GameDataMgr.skillDatabin.GetDataByKey((long)this.skillIdArr[slotId]);

            DebugHelper.Assert(dataByKey != null);
            string text = StringHelper.UTF8BytesToString(ref dataByKey.szSkillUpTip);

            string[] escapeString = CSkillData.GetEscapeString(text);
            if (escapeString != null)
            {
                for (int i = 0; i < escapeString.Length; i++)
                {
                    int    num   = CSkillData.CalcEscapeValue(escapeString[i], cHeroInfo, this.GetSkillLevel(slotId), 1, heroId);
                    string text2 = string.Empty;
                    if (num != 0)
                    {
                        text2 = num.ToString();
                    }
                    text = text.Replace("[" + escapeString[i] + "]", text2);
                }
            }
            return(text);
        }
        public void OnSkillTipsShow()
        {
            if (this.m_FormScript != null)
            {
                GameObject gameObject = this.m_FormScript.transform.Find("SkillTipsBg").gameObject;
                if (!gameObject.activeSelf)
                {
                    gameObject.CustomSetActive(true);
                }
                SkillSlotType[] typeArray1 = new SkillSlotType[4];
                typeArray1[1] = SkillSlotType.SLOT_SKILL_1;
                typeArray1[2] = SkillSlotType.SLOT_SKILL_2;
                typeArray1[3] = SkillSlotType.SLOT_SKILL_3;
                SkillSlotType[] typeArray = typeArray1;
                GameObject[]    objArray  = new GameObject[typeArray.Length];
                objArray[0] = gameObject.transform.Find("Panel0").gameObject;
                objArray[1] = gameObject.transform.Find("Panel1").gameObject;
                objArray[2] = gameObject.transform.Find("Panel2").gameObject;
                objArray[3] = gameObject.transform.Find("Panel3").gameObject;
                Skill skillObj = null;
                if (Singleton <GamePlayerCenter> .instance.GetHostPlayer() != null)
                {
                    PoolObjHandle <ActorRoot> captain = Singleton <GamePlayerCenter> .instance.GetHostPlayer().Captain;

                    if (captain != 0)
                    {
                        IHeroData   data           = CHeroDataFactory.CreateHeroData((uint)captain.handle.TheActorMeta.ConfigId);
                        SkillSlot[] skillSlotArray = captain.handle.SkillControl.SkillSlotArray;
                        for (int i = 0; i < typeArray.Length; i++)
                        {
                            SkillSlot slot = skillSlotArray[(int)typeArray[i]];
                            objArray[i].CustomSetActive(true);
                            if (slot != null)
                            {
                                skillObj = slot.SkillObj;
                            }
                            else if ((i < (typeArray.Length - 1)) && (i > 0))
                            {
                                skillObj = new Skill((captain.handle.TheActorMeta.ConfigId * 100) + (i * 10));
                            }
                            else
                            {
                                skillObj = null;
                            }
                            if (skillObj != null)
                            {
                                Image component = objArray[i].transform.Find("SkillMask/SkillImg").GetComponent <Image>();
                                if ((component != null) && !string.IsNullOrEmpty(skillObj.IconName))
                                {
                                    component.SetSprite(CUIUtility.s_Sprite_Dynamic_Skill_Dir + skillObj.IconName, Singleton <CUIManager> .GetInstance().GetForm(s_battleHeroInfoForm), true, false, false);
                                }
                                Text text = objArray[i].transform.Find("Text_Tittle").GetComponent <Text>();
                                if ((text != null) && (skillObj.cfgData.szSkillName.Length > 0))
                                {
                                    text.text = StringHelper.UTF8BytesToString(ref skillObj.cfgData.szSkillName);
                                }
                                Text text2      = objArray[i].transform.Find("Text_CD").GetComponent <Text>();
                                int  skillCDMax = 0;
                                if (slot != null)
                                {
                                    skillCDMax = slot.GetSkillCDMax();
                                }
                                text2.text = (i != 0) ? Singleton <CTextManager> .instance.GetText("Skill_Cool_Down_Tips", new string[1]) : Singleton <CTextManager> .instance.GetText("Skill_Common_Effect_Type_5");

                                if ((i < typeArray.Length) && (i > 0))
                                {
                                    Text text3 = objArray[i].transform.Find("Text_EnergyCost").GetComponent <Text>();
                                    if (slot == null)
                                    {
                                        string[] args = new string[] { skillObj.cfgData.iEnergyCost.ToString() };
                                        text3.text = Singleton <CTextManager> .instance.GetText(CUICommonSystem.GetEnergyMaxOrCostText(skillObj.cfgData.dwEnergyCostType, EnergyShowType.CostValue), args);
                                    }
                                    else
                                    {
                                        string[] textArray3 = new string[] { slot.NextSkillEnergyCostTotal().ToString() };
                                        text3.text = Singleton <CTextManager> .instance.GetText(CUICommonSystem.GetEnergyMaxOrCostText(skillObj.cfgData.dwEnergyCostType, EnergyShowType.CostValue), textArray3);
                                    }
                                }
                                uint[]     skillEffectType = skillObj.cfgData.SkillEffectType;
                                GameObject obj3            = null;
                                for (int j = 1; j <= 2; j++)
                                {
                                    obj3 = objArray[i].transform.Find(string.Format("EffectNode{0}", j)).gameObject;
                                    if ((j <= skillEffectType.Length) && (skillEffectType[j - 1] != 0))
                                    {
                                        obj3.CustomSetActive(true);
                                        obj3.GetComponent <Image>().SetSprite(CSkillData.GetEffectSlotBg((SkillEffectType)skillEffectType[j - 1]), this.m_FormScript, true, false, false);
                                        obj3.transform.Find("Text").GetComponent <Text>().text = CSkillData.GetEffectDesc((SkillEffectType)skillEffectType[j - 1]);
                                    }
                                    else
                                    {
                                        obj3.CustomSetActive(false);
                                    }
                                }
                                Text            text4      = objArray[i].transform.Find("Text_Detail").GetComponent <Text>();
                                ValueDataInfo[] actorValue = captain.handle.ValueComponent.mActorValue.GetActorValue();
                                if ((text4 != null) && (skillObj.cfgData.szSkillDesc.Length > 0))
                                {
                                    text4.text = CUICommonSystem.GetSkillDesc(skillObj.cfgData.szSkillDesc, actorValue, slot.GetSkillLevel(), captain.handle.ValueComponent.actorSoulLevel);
                                }
                            }
                            else if (i == (typeArray.Length - 1))
                            {
                                Text text5 = objArray[i].transform.Find("Text_Detail").GetComponent <Text>();
                                if (Singleton <BattleLogic> .GetInstance().GetCurLvelContext().IsMobaMode())
                                {
                                    text5.text = Singleton <CTextManager> .GetInstance().GetText("Skill_Text_Lock_PVP");
                                }
                                else
                                {
                                    text5.text = Singleton <CTextManager> .GetInstance().GetText("Skill_Text_Lock_PVE");
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #5
0
        public static int CalcEscapeValue(string escapeString, ValueDataInfo[] valueData, int skillLevel, int heroSoulLevel, uint heroId)
        {
            string text  = string.Empty;
            string text2 = string.Empty;

            string[] array = escapeString.Split(new char[]
            {
                '+',
                '-'
            });
            List <float> list  = new List <float>();
            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(valueData, 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);
                    }
                }
                float num2 = (float)list2.get_Item(0);
                for (int l = 0; l < list4.get_Count(); l++)
                {
                    char c2 = list4.get_Item(l);
                    if (c2 != '*')
                    {
                        if (c2 == '/')
                        {
                            num2 /= (float)list2.get_Item(l + 1);
                        }
                    }
                    else
                    {
                        num2 *= (float)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);
                }
            }
            float 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((int)num3);
        }
Exemple #6
0
        public void OnSkillTipsShow()
        {
            if (this.m_FormScript == null)
            {
                return;
            }
            GameObject gameObject = this.m_FormScript.transform.Find("SkillTipsBg").gameObject;

            if (!gameObject.activeSelf)
            {
                gameObject.CustomSetActive(true);
            }
            SkillSlotType[] array = new SkillSlotType[]
            {
                SkillSlotType.SLOT_SKILL_0,
                SkillSlotType.SLOT_SKILL_1,
                SkillSlotType.SLOT_SKILL_2,
                SkillSlotType.SLOT_SKILL_3
            };
            GameObject[] array2 = new GameObject[array.Length];
            array2[0] = gameObject.transform.Find("Panel0").gameObject;
            array2[1] = gameObject.transform.Find("Panel1").gameObject;
            array2[2] = gameObject.transform.Find("Panel2").gameObject;
            array2[3] = gameObject.transform.Find("Panel3").gameObject;
            if (Singleton <GamePlayerCenter> .get_instance().GetHostPlayer() == null)
            {
                return;
            }
            PoolObjHandle <ActorRoot> captain = Singleton <GamePlayerCenter> .get_instance().GetHostPlayer().Captain;

            if (!captain)
            {
                return;
            }
            IHeroData heroData = CHeroDataFactory.CreateHeroData((uint)captain.get_handle().TheActorMeta.ConfigId);

            SkillSlot[] skillSlotArray = captain.get_handle().SkillControl.SkillSlotArray;
            for (int i = 0; i < array.Length; i++)
            {
                SkillSlot skillSlot = skillSlotArray[(int)array[i]];
                array2[i].CustomSetActive(true);
                Skill skill;
                if (skillSlot != null)
                {
                    skill = skillSlot.SkillObj;
                }
                else if (i < array.Length - 1 && i > 0)
                {
                    skill = new Skill(captain.get_handle().TheActorMeta.ConfigId * 100 + i * 10);
                }
                else
                {
                    skill = null;
                }
                if (skill != null)
                {
                    Image component = array2[i].transform.Find("SkillMask/SkillImg").GetComponent <Image>();
                    if (component != null && !string.IsNullOrEmpty(skill.IconName))
                    {
                        component.SetSprite(CUIUtility.s_Sprite_Dynamic_Skill_Dir + skill.IconName, Singleton <CUIManager> .GetInstance().GetForm(CBattleHeroInfoPanel.s_battleHeroInfoForm), true, false, false, false);
                    }
                    Text component2 = array2[i].transform.Find("Text_Tittle").GetComponent <Text>();
                    if (component2 != null && skill.cfgData.szSkillName.get_Length() > 0)
                    {
                        component2.text = StringHelper.UTF8BytesToString(ref skill.cfgData.szSkillName);
                    }
                    Text component3 = array2[i].transform.Find("Text_CD").GetComponent <Text>();
                    int  num        = 0;
                    if (skillSlot != null)
                    {
                        num = skillSlot.GetSkillCDMax();
                    }
                    component3.text = ((i != 0) ? Singleton <CTextManager> .get_instance().GetText("Skill_Cool_Down_Tips", new string[]
                    {
                        (num / 1000).ToString()
                    }) : Singleton <CTextManager> .get_instance().GetText("Skill_Common_Effect_Type_5"));
                    if (i < array.Length && i > 0)
                    {
                        Text component4 = array2[i].transform.Find("Text_EnergyCost").GetComponent <Text>();
                        if (skillSlot == null)
                        {
                            component4.text = Singleton <CTextManager> .get_instance().GetText(EnergyCommon.GetEnergyShowText((uint)skill.cfgData.bEnergyCostType, EnergyShowType.CostValue), new string[]
                            {
                                skill.cfgData.iEnergyCost.ToString()
                            });
                        }
                        else
                        {
                            component4.text = Singleton <CTextManager> .get_instance().GetText(EnergyCommon.GetEnergyShowText((uint)skill.cfgData.bEnergyCostType, EnergyShowType.CostValue), new string[]
                            {
                                skillSlot.NextSkillEnergyCostTotal().ToString()
                            });
                        }
                    }
                    ushort[] skillEffectType = skill.cfgData.SkillEffectType;
                    for (int j = 1; j <= 2; j++)
                    {
                        GameObject gameObject2 = array2[i].transform.Find(string.Format("EffectNode{0}", j)).gameObject;
                        if (j <= skillEffectType.Length && skillEffectType[j - 1] != 0)
                        {
                            gameObject2.CustomSetActive(true);
                            gameObject2.GetComponent <Image>().SetSprite(CSkillData.GetEffectSlotBg(skillEffectType[j - 1]), this.m_FormScript, true, false, false, false);
                            gameObject2.transform.Find("Text").GetComponent <Text>().text = CSkillData.GetEffectDesc(skillEffectType[j - 1]);
                        }
                        else
                        {
                            gameObject2.CustomSetActive(false);
                        }
                    }
                    Text            component5 = array2[i].transform.Find("Text_Detail").GetComponent <Text>();
                    ValueDataInfo[] actorValue = captain.get_handle().ValueComponent.mActorValue.GetActorValue();
                    if (component5 != null && skill.cfgData.szSkillDesc.get_Length() > 0)
                    {
                        component5.text = CUICommonSystem.GetSkillDesc(skill.cfgData.szSkillDesc, actorValue, skillSlot.GetSkillLevel(), captain.get_handle().ValueComponent.actorSoulLevel, (uint)captain.get_handle().TheActorMeta.ConfigId);
                    }
                }
                else if (i == array.Length - 1)
                {
                    Text component6 = array2[i].transform.Find("Text_Detail").GetComponent <Text>();
                    if (Singleton <BattleLogic> .GetInstance().GetCurLvelContext().IsMobaMode())
                    {
                        component6.text = Singleton <CTextManager> .GetInstance().GetText("Skill_Text_Lock_PVP");
                    }
                    else
                    {
                        component6.text = Singleton <CTextManager> .GetInstance().GetText("Skill_Text_Lock_PVE");
                    }
                }
            }
        }