Esempio n. 1
0
 public static void Preload(ref ActorPreloadTab preloadTab)
 {
     for (int i = 1; i <= 4; i++)
     {
         preloadTab.AddSprite(CSkillData.GetEffectSlotBg((SkillEffectType)i));
     }
 }
Esempio n. 2
0
        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");
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
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");
                    }
                }
            }
        }