コード例 #1
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> .instance.GetHostPlayer() == null)
            {
                return;
            }
            PoolObjHandle <ActorRoot> captain = Singleton <GamePlayerCenter> .instance.GetHostPlayer().Captain;

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

            SkillSlot[] skillSlotArray = captain.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.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.set_text(StringHelper.UTF8BytesToString(ref skill.cfgData.szSkillName));
                    }
                    Text component3 = array2[i].transform.Find("Text_CD").GetComponent <Text>();
                    int  millsecond = 0;
                    if (skillSlot != null)
                    {
                        millsecond = skillSlot.GetSkillCDMax();
                    }
                    component3.set_text((i == 0) ? Singleton <CTextManager> .instance.GetText("Skill_Common_Effect_Type_5") : Singleton <CTextManager> .instance.GetText("Skill_Cool_Down_Tips", new string[]
                    {
                        CUICommonSystem.ConvertMillisecondToSecondWithOneDecimal(millsecond)
                    }));
                    if (i < array.Length && i > 0)
                    {
                        Text component4 = array2[i].transform.Find("Text_EnergyCost").GetComponent <Text>();
                        if (skillSlot == null)
                        {
                            component4.set_text((skill.cfgData.bEnergyCostType == 6) ? string.Empty : Singleton <CTextManager> .instance.GetText(EnergyCommon.GetEnergyShowText((uint)skill.cfgData.bEnergyCostType, EnergyShowType.CostValue), new string[]
                            {
                                skill.cfgData.iEnergyCost.ToString()
                            }));
                        }
                        else
                        {
                            component4.set_text((skill.cfgData.bEnergyCostType == 6) ? string.Empty : Singleton <CTextManager> .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)skillEffectType[j - 1]), this.m_FormScript, true, false, false, false);
                            gameObject2.transform.Find("Text").GetComponent <Text>().set_text(CSkillData.GetEffectDesc((SkillEffectType)skillEffectType[j - 1]));
                        }
                        else
                        {
                            gameObject2.CustomSetActive(false);
                        }
                    }
                    Text            component5 = array2[i].transform.Find("Text_Detail").GetComponent <Text>();
                    ValueDataInfo[] actorValue = captain.handle.ValueComponent.mActorValue.GetActorValue();
                    if (component5 != null && skill.cfgData.szSkillDesc.get_Length() > 0)
                    {
                        component5.set_text(CUICommonSystem.GetSkillDesc(skill.cfgData.szSkillDesc, actorValue, skillSlot.GetSkillLevel(), captain.handle.ValueComponent.actorSoulLevel, (uint)captain.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.set_text(Singleton <CTextManager> .GetInstance().GetText("Skill_Text_Lock_PVP"));
                    }
                    else
                    {
                        component6.set_text(Singleton <CTextManager> .GetInstance().GetText("Skill_Text_Lock_PVE"));
                    }
                }
            }
        }