public void AddHeroInSlot(int hashcode) { if (isLocked) { return; } GDEHeroData data = SDDataManager.Instance.GetHeroOwnedByHashcode(hashcode); if (data == null) { return; } HeroInfo info = SDDataManager.Instance.getHeroInfoById(data.id); if (info == null) { return; } // isEmpty = false; Icon.sprite = info.FaceIcon; bgIcon.sprite = SDDataManager.Instance.baseBgSpriteByRarity(info.Rarity); frameIcon.sprite = SDDataManager.Instance.baseFrameSpriteByRarity(info.Rarity); // starVision?.gameObject.SetActive(true); starVision.StarNum = data.starNumUpgradeTimes + info.LEVEL; aboveText.text = SDGameManager.T("Lv.") + SDDataManager.Instance.getLevelByExp(data.exp); belowText?.gameObject.SetActive(false); // ItemType = SDConstants.ItemType.Hero; _id = info.ID; _hashcode = data.hashCode; }
public static int AddTpAfterSkill(SDConstants.AddMpTpType addType , BattleRoleData source) { if (source._Tag != SDConstants.CharacterType.Hero) { return(0); } GDEHeroData hero = SDDataManager.Instance.getHeroByHashcode(source.unitHashcode); HeroInfo info = SDDataManager.Instance.getHeroInfoById(source.UnitId); int baseTp = info.RAL.Tp + hero.RoleAttritubeList.AD_List[(int)AttributeData.Tp]; int currentTp = source.ThisBasicRoleProperty().RoleBasicRA.Tp; // float upRate0 = currentTp * 1f / baseTp; float upRate1 = 1; if (addType == SDConstants.AddMpTpType.PreferMp || addType == SDConstants.AddMpTpType.PreferBoth) { upRate1 = 1.5f; } else if (addType == SDConstants.AddMpTpType.LowMp || addType == SDConstants.AddMpTpType.LowBoth) { upRate1 = 0.5f; } else if (addType == SDConstants.AddMpTpType.YearnMp || addType == SDConstants.AddMpTpType.YearnBoth) { upRate1 = 2f; } return((int)(SDConstants.SkillAddMinMp * upRate0 * upRate1)); }
public override void initRoleClassData() { base.initRoleClassData(); GDEHeroData D = SDDataManager.Instance.getHeroByHashcode(Hashcode); IsLocked = D.locked; }
public void ShowHeroMessage(int _hashcode) { hashcode = _hashcode; GDEHeroData data = SDDataManager.Instance.getHeroByHashcode(hashcode); if (data == null || hashcode <= 0) { EmptyVision(); return; } HeroInfo info = SDDataManager.Instance.getHeroInfoById(data.id); //heroCharacterDrawingImg.sprite = info.FaceIcon; //heroCharacterDrawingImg.sprite = // CareerIconImg.sprite = info.Career.Icon; CareerText.text = info.Career.NAME; RaceIconImg.sprite = info.Race.Icon; RaceText.text = info.Race.NAME; //NameBeforeText.text NameText.text = info.Name; RarityIconImg.sprite = SDDataManager.Instance.raritySprite(info.Rarity); RarityIconImg.gameObject.SetActive(true); RarityIconImg.SetNativeSize(); // StarNumVision.StarNum = info.LEVEL + data.starNumUpgradeTimes; //LvText.text = SDGameManager.T("Lv.")+SDDataManager.Instance.getLevelByExp(data.exp); //ExpSlider.localScale = new Vector3(SDDataManager.Instance.getExpRateByExp(data.exp), 1, 1); MoreInfoBtn.gameObject.SetActive(true); }
public void initHero(int hashcode) { heroHashcode = hashcode; refreshUnlockBtn(); if (heroHashcode == 0) { initEmptyHero(); } else { addImg.gameObject.SetActive(false); string id = SDDataManager.Instance.getHeroIdByHashcode(heroHashcode); GDEHeroData hero = SDDataManager.Instance.GetHeroOwnedByHashcode(heroHashcode); ROHeroData dal = SDDataManager.Instance.getHeroDataByID(id, hero.starNumUpgradeTimes); levelText.gameObject.SetActive(true); levelText.text = "Lv." + SDDataManager.Instance.getLevelByExp(hero.exp); //nameText.text = SDGameManager.T(dal.Info.Name); icon.sprite = dal.Info.FaceIcon; bgIcon.sprite = SDDataManager.Instance.baseBgSpriteByRarity (dal.Info.Rarity); frameIcon.sprite = SDDataManager.Instance.heroBoxFrameByRarity (dal.Info.Rarity); } }
public void setRolePlace(int aimPosIndex) { int heroHC = RoleGroup.GetChild(currentMGIndex).GetComponentInChildren <CharacterModelController>().heroHashcode; //如果选中新槽位已有角色,则调换两角色槽位 for (int i = 0; i < RoleGroup.childCount; i++) { int heroHashcode = RoleGroup.GetChild(i).GetComponentInChildren <CharacterModelController>().heroHashcode; if (SDDataManager.Instance.getHeroPosInTeamByHashcode(heroHashcode) == aimPosIndex && i != currentMGIndex) { int oldPos = SDDataManager.Instance.getHeroPosInTeamByHashcode(heroHC); SDDataManager.Instance.GetHeroOwnedByHashcode(heroHashcode).teamPos = oldPos; RoleGroup.GetChild(i).position = AllEnablePosPlace[oldPos].position; } } //改写当前角色槽位 RoleGroup.GetChild(currentMGIndex).position = AllEnablePosPlace[aimPosIndex].position; GDEHeroData hero = SDDataManager.Instance.GetHeroOwnedByHashcode(heroHC); hero.teamPos = aimPosIndex; }
public void refreshCurrentNewAddingStar() { currentAddingFigure = 0; GDEHeroData data = SDDataManager.Instance.getHeroByHashcode(heroDetail.Hashcode); HeroInfo indo = SDDataManager.Instance.getHeroInfoById(data.id); starVision.StarNum = data.starNumUpgradeTimes + indo.LEVEL; int starNum = starVision.StarNum; if (starNum >= SDConstants.UnitMAxStarNum) { BtnToConfirmCurrentImprove.interactable = false; return; } currentAddingFigure = 1; for (int i = 0; i < AllSlots.Length; i++) { bool unlocked = i < starNum; AllSlots[i].isLocked = !unlocked; if (unlocked && AllSlots[i].isEmpty) { currentAddingFigure = 0; } } //预计升星动画 //升级确认按钮状态 BtnToConfirmCurrentImprove.interactable = currentAddingFigure > 0 && SDDataManager.Instance.checkHeroExpIfOverflow(data.exp, starNum); }
public void setHero(int hashcode) { GDEHeroData heroData = SDDataManager.Instance.GetHeroOwnedByHashcode(hashcode); string id = heroData.id; ID = id; careerIndex = SDDataManager.Instance.getHeroCareerById(id); raceIndex = SDDataManager.Instance.getHeroRaceById(id); ROHeroData dal = SDDataManager.Instance.getHeroDataByID(id, heroData.starNumUpgradeTimes); //career RoleCareer c = dal.Info.Career; CareerIconImg.sprite = c.Icon; CareerIconImg.SetNativeSize(); CareerText.text = SDGameManager.T(c.NAME); //race HeroRace r = dal.Info.Race; RaceIconImg.sprite = r.Icon; RaceIconImg.SetNativeSize(); RaceText.text = SDGameManager.T(r.NAME); //rarity RarityImg.sprite = SDDataManager.Instance.raritySprite(dal.quality); RarityImg.SetNativeSize(); //personalDrawImg if (dal.Info.PersonalDrawImg == null) { HCdI_Bg.gameObject.SetActive(false); heroCharacterDrawingImg.sprite = RaceIconImg.sprite; heroCharacterDrawingImg.SetNativeSize(); heroCharacterDrawingImg.color = Color.grey; } else { HCdI_Bg.gameObject.SetActive(true); heroCharacterDrawingImg.sprite = dal.Info.PersonalDrawImg; heroCharacterDrawingImg.SetNativeSize(); heroCharacterDrawingImg.color = Color.white; HCdI_Bg.sprite = RaceIconImg.sprite; HCdI_Bg.SetNativeSize(); HCdI_Bg.color = Color.white; } //RaceIconImg.sprite = int grade = SDDataManager.Instance.getLevelByExp(heroData.exp); _hero.gender = (CharacterSex)heroData.sex; _hero.initData_Hero((Job)careerIndex, raceIndex, grade, dal.quality, dal.starNum , dal.ExportRAL , dal.CRIDmg, dal.DmgReduction, dal.DmgReflection, dal.RewardRate , dal.BarChartRegendPerTurn, ID, dal.Info.Name, heroData.wakeNum); }
public void initInjuriedHero(GDEHeroData hero) { type = SDConstants.ItemType.Hero; itemId = hero.id; itemHashcode = hero.hashCode; // float fatigueRate = SDDataManager.Instance.getHeroFatigueRate(hero.hashCode); int status = SDDataManager.Instance.getHeroStatus(hero.hashCode); Debug.Log("该英雄疲劳值:" + hero.Fatigue); // ROHeroData dal = SDDataManager.Instance.getHeroDataByID(itemId, hero.starNumUpgradeTimes); upText.gameObject.SetActive(true); upText.text = "Lv." + SDDataManager.Instance.getLevelByExp(hero.exp); if (downText) { downText.text = SDGameManager.T(dal.Info.Name); } if (slider) { slider.gameObject.SetActive(true); } // if (status == 2) { isSelected = false; isUnable = false; }//受伤且未进行治疗状态 else if (status == 3) { isSelected = false; isUnable = true; }//已经在治疗状态 else if (status == 0) { isSelected = false; if (fatigueRate > 0.1f) { isUnable = false; } else { isUnable = true; } }//无事可做状态 else { isSelected = false; isUnable = true; } //starVision.StarNum = dal.starNum; starVision.gameObject.SetActive(false); slider.GetChild(0).localScale = new Vector3(1 - fatigueRate, 1, 1); }
/// <summary> /// 初始化英雄出战选人页 /// </summary> /// <param name="hero"></param> public void initBattleHero(GDEHeroData hero) { type = SDConstants.ItemType.Hero; itemId = hero.id; itemHashcode = hero.hashCode; // // ROHeroData dal = SDDataManager.Instance.getHeroDataByID(itemId, hero.starNumUpgradeTimes); //if (frameImg != null) frameImg.gameObject.SetActive(false); upText.gameObject.SetActive(true); upText.text = SDGameManager.T("Lv.") + SDDataManager.Instance.getLevelByExp(hero.exp); downText.text = SDGameManager.T(dal.Info.Name); slider?.gameObject.SetActive(false); // int status = SDDataManager.Instance.getHeroStatus(hero.hashCode); if (status == 0) { isSelected = false; isUnable = false; }//无业 else if (status == 1) { isSelected = true; isUnable = false; }//战斗队伍中 else { isSelected = false; isUnable = true; }//其他状态 //statusImg.gameObject.SetActive(true); //statusImg.sprite = herostat starVision.StarNum = dal.starNum; if (careerImg) { Sprite career = dal.Info.Career.Icon; careerImg.sprite = career; } if (raceImg) { Sprite race = dal.Info.Race.Icon; if (dal.Info.Race.NAME == "无种族") { HeroRace _r = dal.Info.Race; race = _r.Icon; } raceImg.sprite = race; } itemBgImg.sprite = SDDataManager.Instance.heroBgSpriteByRarity(dal.Info.Rarity); frameImg.sprite = SDDataManager.Instance.heroFrameSpriteByRarity(dal.Info.Rarity); }
public void refreshCurrentNewAddingExp() { currentAddingFigure = 0; GDEHeroData data = SDDataManager.Instance.getHeroByHashcode(heroDetail.Hashcode); //HeroInfo indo = SDDataManager.Instance.getHeroInfoById(data.id); for (int i = 0; i < AllSlots.Length; i++) { bool locked = SDDataManager.Instance.checkHeroExpIfOverflow (data.exp, heroDetail.StarNumVision.StarNum); SingleSlot slot = AllSlots[i]; slot.isLocked = locked; if (!slot.isEmpty && !slot.isLocked) { if (slot.ItemType == SDConstants.ItemType.Hero) { int _exp = SDDataManager.Instance.getHeroExpPrice(heroDetail.Hashcode); currentAddingFigure += _exp; } else if (slot.ItemType == SDConstants.ItemType.Consumable) { int _exp = SDDataManager.Instance.getFigureFromMaterial(slot._id); currentAddingFigure += _exp; } } } //预计等级提升动画 int oldLv = SDDataManager.Instance.getLevelByExp(data.exp); int newLv = SDDataManager.Instance.getLevelByExp(data.exp + currentAddingFigure); expPart_lv_text.text = SDGameManager.T("Lv.") + oldLv + " > " + SDGameManager.T("Lv.") + newLv; expPart_exp_text.text = (data.exp - SDDataManager.Instance.getMinExpReachLevel(oldLv) + currentAddingFigure) + "/" + SDDataManager.Instance.ExpBulkPerLevel(oldLv); expPart_slider_old.localScale = new Vector3 ((data.exp - SDDataManager.Instance.getMinExpReachLevel(oldLv)) * 1f / SDDataManager.Instance.ExpBulkPerLevel(oldLv), 1, 1); int overExp = data.exp + currentAddingFigure - SDDataManager.Instance.getMinExpReachLevel(oldLv); float rate = overExp * 1f / SDDataManager.Instance.ExpBulkPerLevel(oldLv); expPart_slider_new.localScale = new Vector3(rate, 1, 1); //升级确认按钮状态 BtnToConfirmCurrentImprove.interactable = currentAddingFigure > 0 && !SDDataManager.Instance.checkHeroExpIfOverflow (data.exp, heroDetail.StarNumVision.StarNum); //exp专有 TooFlowToAdd = SDDataManager.Instance.checkHeroExpIfOverflow (data.exp + currentAddingFigure, heroDetail.StarNumVision.StarNum); }
public void Btn_ChangeLocked() { GDEHeroData D = SDDataManager.Instance.getHeroByHashcode(Hashcode); bool flag = !IsLocked; // if (flag != D.locked) { D.locked = flag; IsLocked = D.locked; } }
public IEnumerator IEInitCallingRewards() { yield return(new WaitForSeconds(newHeroPoseDismissDelay * 4)); homeScene.mapBtn.gameObject.SetActive(false); for (int i = 0; i < RewardHCs.Count; i++) { bool firstGet = true; GDEHeroData heroData = SDDataManager.Instance.getHeroByHashcode(RewardHCs[i]); string id = heroData.id; List <GDEHeroData> _List = SDDataManager.Instance.PlayerData.herosOwned.FindAll (x => x.id == id); if (_List.Count > 1) { firstGet = false; } resultRewards[i].initCalledHero(RewardHCs[i]); if (firstGet) { currentPanelContent = panelContent.pose; resultRewards[i].upText.text = "NEW!!!"; if (!excapePose) { PopoutController.CreatePopoutUnitSpeak("英雄大名" , "久仰大名", "Textures/xgb33", 10 + RewardHCs.Count - i , false, PopoutController.PopoutWIndowAlertType.ConfirmMessage , (PopoutController c, PopoutController.PopoutWindowAlertActionType a) => { if (a == PopoutController.PopoutWindowAlertActionType.OnConfirm) { StartCoroutine(c.Dismiss()); } else { StartCoroutine(c.IEWaitAndDismiss(newHeroPoseDismissDelay)); } }); yield return(new WaitForSeconds(newHeroPoseDismissDelay)); } } if (excapePose) { excapePose = false; } } currentPanelContent = panelContent.rrp; homeScene.mapBtn.gameObject.SetActive(true); }
public void initHero(int heroHashCode) { unitHashcode = heroHashCode; SDHero h; if (GetComponent <SDHero>()) { h = GetComponent <SDHero>(); } else { h = gameObject.AddComponent <SDHero>(); } HeroProperty._hero = h; GDEHeroData heroData = SDDataManager.Instance.GetHeroOwnedByHashcode(unitHashcode); // if (heroData != null) { HeroProperty._hero.nameBeforeId = heroData.nameBeforeId; // UnitId = SDDataManager.Instance.getHeroIdByHashcode(unitHashcode); HeroProperty.ID = HeroProperty._hero.ID = UnitId; ROHeroData dal = SDDataManager.Instance .getHeroDataByID(UnitId, heroData.starNumUpgradeTimes); // unit_character_model.initHeroCharacterModel(heroHashCode, SDConstants.HERO_MODEL_RATIO); // int grade = SDDataManager.Instance.getLevelByExp(heroData.exp); HeroProperty._hero.grade = grade; RoleAttributeList _ral = dal.ExportRAL; _ral.Add(RoleAttributeList.GDEToRAL(heroData.RoleAttritubeList)); // Race _race = dal.Info.Race.Race; // HeroProperty._hero.initData_Hero (dal.Info.Career.Career, _race , grade, 0, dal.starNum , _ral , dal.CRIDmg, dal.DmgReduction, dal.DmgReflection, dal.RewardRate , dal.BarChartRegendPerTurn, UnitId, dal.Info.Name, heroData.wakeNum);; HeroProperty._hero.gender = (CharacterSex)heroData.sex; addSkillByCareerByRaceByStarnum(heroHashCode, dal.starNum); } }
public void readHeroSkills() { for (int i = 0; i < SkillSlots.Length; i++) { SkillSlots[i].initSkillSlot(Hashcode); } GDEHeroData hero = SDDataManager.Instance.getHeroByHashcode(Hashcode); //HeroInfo info = SDDataManager.Instance.getHeroInfoById(ID); skillid0 = hero.a_skill0.Id; if (hero.a_skill1 != null) { skillid1 = hero.a_skill1.Id; } skillidOmega = hero.a_skillOmega.Id; }
public void addSkillByCareerByRaceByStarnum(int heroHashcode, int quality) { _skills.Add(OneSkill.normalAttack); // GDEHeroData hero = SDDataManager.Instance.getHeroByHashcode(heroHashcode); HeroInfo info = SDDataManager.Instance.getHeroInfoById(UnitId); string skill0Id = info.Skill0Info.ID; _skills.Add(SDDataManager.Instance.getOwnedSkillById(skill0Id, heroHashcode)); if (SDDataManager.Instance.checkHeroEnableSkill1ByHashcode(heroHashcode)) { string skill1Id = info.SkillOmegaInfo.ID; _skills.Add(SDDataManager.Instance.getOwnedSkillById(skill1Id, heroHashcode)); }//稀有角色才能拥有额外技能 string skillOmegaId = info.Skill1Info.ID; _skills.Add(SDDataManager.Instance.getOwnedSkillById(skillOmegaId, heroHashcode)); return; }
public void initHeroDetailPanel(int hashcode , SDConstants.CharacterType type = SDConstants.CharacterType.Hero) { Type = type; if (Type == SDConstants.CharacterType.Hero) { equipList.BuildEquipListBase(); equipList.HD = this; if (_hero == null) { _hero = equipList.gameObject.AddComponent <SDHero>(); } ID = SDDataManager.Instance.getHeroIdByHashcode(hashcode); GDEHeroData hero = SDDataManager.Instance.GetHeroOwnedByHashcode(hashcode); Hashcode = hashcode; setHero(Hashcode); setHelmet(Hashcode); setBreastplate(Hashcode); // setGardebras(Hashcode);//已过期 setLegging(Hashcode); setJewelry(Hashcode, false); setJewelry(Hashcode, true); setWeapon(Hashcode); InitHeroBasicProperties(); RALPanel.initRAL(this.RoleBasicRA , Type , SDDataManager.Instance.getLevelByExp(hero.exp));//视觉展示属性 setRoleBaseMessiage(); if (LvText) { int exp = hero.exp; int lv = SDDataManager.Instance.getLevelByExp(exp); LvText.text = SDGameManager.T("Lv.") + lv; } readHeroSkills(); // heroHeadImg.initHeroCharacterModel(Hashcode, SDConstants.HERO_MODEL_BIG_RATIO); } }
public void ReadHeroSkills() { GDEHeroData D = SDDataManager.Instance.PlayerData.herosOwned[0]; int hashcode = D.hashCode; Debug.Log("HC: " + hashcode); GDEHeroData h = SDDataManager.Instance.getHeroByHashcode(hashcode); /* * List<string> w = h.skillsOwned.Select(x => * { * return x.Id + "__" + x.Lv; * }).ToList(); * string W = ""; * foreach (string ww in w) * { * W += ww + "/"; * } * Debug.Log("FisrtHeroSkills: " + W);*/ }
public static void replaceSlotImg(string _region, string _slot , CharacterModel CM, GDEHeroData HD, RoleSkeletonData hail) { GDEAnimData AD = HD.AnimData; if (AD.isRare) { return; } Chara_atlasRegionAttacher ara; if (!string.IsNullOrEmpty(_region)) { RoleSkeletonData.SlotRegionPairList list = hail.AllEnableList.Find(x => x.slot == _slot); RoleSkeletonData.SlotRegionPair pair = list.AllRegionList .Find(x => x.Region == _region); if (list != null && list.AtlasAsset != null) { } } }
public void initStock(GDEHeroData data , SDConstants.MaterialType MType = SDConstants.MaterialType.end) { stockType = SDConstants.StockType.hero; materialType = MType; itemId = data.id; hashcode = data.hashCode; itemNum = 1; HeroInfo info = SDDataManager.Instance.getHeroInfoById(itemId); starVision.StarNum = info.LEVEL + data.starNumUpgradeTimes; if (NumText) { NumText.gameObject.SetActive(false); } itemImg.sprite = info.FaceIcon; bgImg.sprite = SDDataManager.Instance.baseBgSpriteByRarity(info.Rarity); frameImg.sprite = SDDataManager.Instance.baseFrameSpriteByRarity(info.Rarity); // isLocked = data.locked; }
public void initSkillSlot(int HeroHashcode) { bool flag = false; if (!SDDataManager.Instance.checkHeroEnableSkill1ByHashcode(HeroHashcode)) { if (slotType == skillSlotType.skill1) { flag = true; } } if (!flag) { gameObject.SetActive(true); GDEHeroData hero = SDDataManager.Instance.getHeroByHashcode(HeroHashcode); HeroInfo info = SDDataManager.Instance.getHeroInfoById(id); string skillId = string.Empty; if (slotType == skillSlotType.skill0) { skillId = hero.a_skill0.Id; } else if (slotType == skillSlotType.skill1) { skillId = hero.a_skill1.Id; } else if (slotType == skillSlotType.omegaSkill) { skillId = hero.a_skillOmega.Id; } OneSkill skill = SDDataManager.Instance.getOwnedSkillById(skillId, HeroHashcode); initOneSkillSlot(skill); } else { gameObject.SetActive(false); } }
public void initHero(GDEHeroData hero) { type = SDConstants.ItemType.Hero; itemId = hero.id; itemHashcode = hero.hashCode; if (fightForceText) { fightForceText.text = "" + (SDDataManager.Instance.getHeroOriginalBattleForceByHashCode(itemHashcode));//读取角色战斗力 } SDConstants.CharacterAnimType animType = (SDConstants.CharacterAnimType) (SDDataManager.Instance.getHeroCareerById(itemId)); ROHeroData roh = SDDataManager.Instance.getHeroDataByID(itemId, hero.starNumUpgradeTimes); if (characterModel != null) { characterModel.initHeroCharacterModel(itemHashcode, SDConstants.HERO_MODEL_RATIO); } itemLevel = SDDataManager.Instance.getLevelByExp(hero.exp); if (upText) { upText.gameObject.SetActive(false); } if (downText) { downText.text = SDGameManager.T("Lv.") + itemLevel; } if (slider) { slider.gameObject.SetActive(false); } if (starVision) { starVision.StarNum = roh.starNum; } if (statusImg) { statusImg.gameObject.SetActive(true); statusImg.sprite = UIEffectManager.Instance.heroStatusSps[hero.status]; } // if (itemImg) { } // if (careerImg) { Sprite career = roh.Info.Career.Icon; careerImg.sprite = career; } if (raceImg) { Sprite race = roh.Info.Race.Icon; if (roh.Info.Race.NAME == "无种族") { HeroRace _r = roh.Info.Race; race = _r.Icon; } raceImg.sprite = race; } if (itemBgImg) { itemBgImg.sprite = SDDataManager.Instance.heroBgSpriteByRarity(roh.Info.Rarity); } if (frameImg) { frameImg.sprite = SDDataManager.Instance.heroFrameSpriteByRarity(roh.Info.Rarity); } }
public void initHero(int hashcode) { GDEHeroData hero = SDDataManager.Instance.getHeroByHashcode(hashcode); initHero(hero); }