public static CharInfo GetCharInfo(WUnitData troopData) { var stats = new BattleObjStats( troopData.health, troopData.max_health, troopData.attack, troopData.shield, troopData.max_shield); CharInfo chInf = new CharInfo( troopData.moniker, stats, CharInfoHelper.GetCharacterSpells(troopData.moniker), troopData.dexterity, 0, troopData.level, troopData.id, troopData.cool_down_remaining_seconds, troopData.quantity, GetNextUpgradeStats(troopData.next_upgrade_stats), troopData.ownerMoniker); chInf.SetOtherStats(troopData.critical_ratio, troopData.critical_chance, troopData.miss_chance); //chInf.SetUnlockData(troopData.used_status, troopData.unlock_league, troopData.unlock_league_step_number); chInf.SetUnlockData(WCharExistenceType.unlock, troopData.unlock_league, troopData.unlock_league_step_number); return(chInf); }
public static HeroInfo GetHeroInfo(WHeroData heroData) { var stats = new BattleObjStats( heroData.health, heroData.max_health, heroData.attack, heroData.shield, heroData.max_shield); HeroInfo hInfo = new HeroInfo( heroData.moniker, stats, CharInfoHelper.GetCharacterSpells(heroData.moniker), heroData.dexterity, 0, heroData.level, heroData.id, 0, heroData.quantity, GetNextUpgradeStats(heroData.next_upgrade_stats)); hInfo.SetOtherStats(heroData.critical_ratio, heroData.critical_chance, heroData.miss_chance); hInfo.SetChakra(heroData.chakra, GetCharacterSpells(heroData.chakra.chakra_moniker)); hInfo.SetIsSelectedHero(heroData.selected_hero); hInfo.SetHeroItems(heroData.items); return(hInfo); }
public static void Net_CharLevelUp(NewUIGroup relatedGroup, CharInfo charInfo, Action actionOnSuccess = null, Action actionOnFail = null) { relatedGroup.SetIsBusyInLogicForAMoment(); NetRequestPage netReqPage = NewUIGroup.CreateGroup(NewUIGroup.NAME__NETREQUESTPAGE, relatedGroup) as NetRequestPage; netReqPage.Init("upgrading"); DivineDebug.Log("Net: CharLevelUp request sent. Char: '" + charInfo.moniker.ToString() + "'."); NewNetworkManager.instance.CharLevelUp(charInfo, (data) => { DivineDebug.Log("Old MaxHP: " + charInfo.baseStats.maxHp); DivineDebug.Log("Next MaxHP: " + charInfo.nextUpgradeStats.health); DivineDebug.Log("Net: CharLevelUp was successful. Char: '" + charInfo.moniker.ToString() + "'."); netReqPage.SetSuccessHappened("done"); GameManager.instance.player.coin -= charInfo.nextUpgradeStats.card_cost; charInfo.curCardCount -= charInfo.nextUpgradeStats.card_count; GameAnalyticsSDK.GameAnalytics.NewDesignEvent("Level up character : " + charInfo.moniker.ToString()); charInfo.level++; charInfo.SetBaseStats(data.max_health, data.max_health, data.attack, data.max_shield, data.max_shield); charInfo.SetOtherStats(data.critical_ratio, data.critical_chance, data.dodge_chance); charInfo.nextUpgradeStats = CharInfoHelper.GetNextUpgradeStats(data.nextStats); if (data.chakraData != null) { HeroInfo heroInfo = (HeroInfo)charInfo; heroInfo.chakra.level++; heroInfo.chakra.SetBaseStats(data.chakraData.chakra_max_health, data.chakraData.chakra_max_health, data.chakraData.chakra_attack, data.chakraData.chakra_max_shield, data.chakraData.chakra_max_shield); heroInfo.chakra.SetOtherStats(data.chakraData.chakra_critical_ratio, data.chakraData.chakra_critical_chance, data.chakraData.chakra_dodge_chance); heroInfo.chakra.nextUpgradeStats = CharInfoHelper.GetNextUpgradeStats(data.chakraData.next_upgrade_stats); } if (actionOnSuccess != null) { actionOnSuccess(); } DivineDebug.Log("MaxHP: " + charInfo.baseStats.maxHp); DivineDebug.Log("MaxHP: " + charInfo.nextUpgradeStats.health); }, (errorMsg) => { DivineDebug.Log("Net: CharLevelUp failed. Char: '" + charInfo.moniker.ToString() + "'."); netReqPage.SetFailHappened("connectionError"); if (actionOnFail != null) { actionOnFail(); } }); }