void initalize() { int i = 0; int index = -1; foreach (System.Collections.Generic.KeyValuePair <string, DragonPlayerData> iterator in ReadDatabase.Instance.DragonInfo.Player) { SSelectDragonContainer container = dragons[i]; container.IDBranch = iterator.Key; container.Branch.spriteName = "icon-branch-" + iterator.Key.ToLower(); container.Icon.mainTexture = Resources.Load <Texture>("Image/Dragon/Icon/dragon-" + iterator.Key.ToLower()); if (PlayerInfo.Instance.dragonInfo.id.Equals(iterator.Key)) { index = i; } i++; } //Stretch skill selected float ratio = GameSupportor.getRatioAspect(tempSkill.gameObject, renderUlti) * 100; renderUlti.transform.localScale = new Vector3(ratio, ratio, ratio); selected.transform.position = dragons[index].transform.position; updateAttribute(PlayerInfo.Instance.dragonInfo.id); updateSkill(PlayerInfo.Instance.dragonInfo.id); }
void initSkill() { //Stretch skill selected float ratio = GameSupportor.getRatioAspect(PlayDragonInfoController.Instance.tempSkill, PlayDragonInfoController.Instance.renderUlti) * 100; PlayDragonInfoController.Instance.renderUlti.transform.localScale = new Vector3(ratio, ratio, ratio); bool hasUlti = false; string branch = PlayerInfo.Instance.dragonInfo.id; int length = PlayDragonInfoController.Instance.Skills.Length; int count = ReadDatabase.Instance.DragonInfo.Player[branch].Skills.Count - 1; if (ReadDatabase.Instance.DragonInfo.Player[branch].Skills.Count > 0) { for (int i = 0; i < length; i++) { PlayDragonInfoController.Instance.Skills[i].gameObject.SetActive(true); } foreach (DragonPlayerSkillData skillData in ReadDatabase.Instance.DragonInfo.Player[branch].Skills) { PlayDragonInfoSkillController skill = PlayDragonInfoController.Instance.Skills[count].GetComponent <PlayDragonInfoSkillController>(); SkillData data = ReadDatabase.Instance.SkillInfo[skillData.ID.ToUpper()]; skill.ID = skillData.ID; skill.CooldownTime = data.Cooldown; skill.Type = data.Type; skill.Ability = data.Ability; skill.ManaValue = data.Mana; skill.initalize(); string path = "Image/Dragon/Player/" + ConvertSupportor.convertUpperFirstChar(branch) + "/Skill/" + skillData.ID; skill.sprite.mainTexture = Resources.Load <Texture>(path); count--; if (skillData.Ulti) { PlayDragonInfoController.Instance.renderUlti.gameObject.SetActive(true); UIAnchor anchor = PlayDragonInfoController.Instance.renderUlti.GetComponent <UIAnchor>(); anchor.container = skill.gameObject; anchor.enabled = true; hasUlti = true; } } } if (hasUlti == false && PlayDragonInfoController.Instance.renderUlti.gameObject.activeSelf) { PlayDragonInfoController.Instance.renderUlti.gameObject.SetActive(false); } count = ReadDatabase.Instance.DragonInfo.Player[branch].Skills.Count; if (count < length) { for (int i = count; i < length; i++) { PlayDragonInfoController.Instance.Skills[i].gameObject.SetActive(false); } } }