using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
public partial class HeroUIManager : GameSystemManager<HeroUIManager>
|
{
|
|
|
#region 重生 遣散
|
public int awakeRebirthCnt { get; private set; }
|
public int payBackMoneyType;
|
public int rebornAwakeHeroMaxCount; //觉醒武将每日的最大重生次数
|
|
public List<string> heroDeleteSortList { get; private set; } = new List<string>();
|
public int selectHeroDeleteListJob = 0; //筛选职业
|
public int selectHeroDeleteListCountry = 0; //筛选国家
|
|
public List<string> selectDeleteHeroList { get; private set; } = new List<string>();
|
|
|
public Dictionary<int, long> GetHeroLVPayBack(int quality, int lv)
|
{
|
//汇总返还总数量
|
Dictionary<int, long> itemCounDic = new Dictionary<int, long>();
|
for (int i = 1; i < lv; i++)
|
{
|
var config = HeroQualityLVConfig.GetQualityLVConfig(quality, i);
|
var itemID = config.UPCostItem[0];
|
var count = config.UPCostItem[1];
|
if (!itemCounDic.ContainsKey(itemID))
|
{
|
itemCounDic[itemID] = count;
|
}
|
else
|
{
|
itemCounDic[itemID] += count;
|
}
|
}
|
|
return itemCounDic;
|
}
|
|
|
public Dictionary<int, long> GetHeroBreakPayBack(int quality, int lv)
|
{
|
//汇总返还总数量
|
Dictionary<int, long> itemCounDic = new Dictionary<int, long>();
|
for (int i = 0; i < lv; i++)
|
{
|
var config = HeroQualityBreakConfig.GetQualityBreakConfig(quality, i);
|
var itemID = config.UPCostItem[0];
|
var count = config.UPCostItem[1];
|
if (!itemCounDic.ContainsKey(itemID))
|
{
|
itemCounDic[itemID] = count;
|
}
|
else
|
{
|
itemCounDic[itemID] += count;
|
}
|
}
|
|
return itemCounDic;
|
|
|
}
|
|
public Dictionary<int, long> GetHeroQualityAwakePayBack(int quality, int lv)
|
{
|
//汇总返还总数量
|
Dictionary<int, long> itemCounDic = new Dictionary<int, long>();
|
for (int i = 0; i < lv; i++)
|
{
|
var config = HeroQualityAwakeConfig.GetQualityAwakeConfig(quality, lv);
|
var itemID = config.UPCostItem[0];
|
var count = config.UPCostItem[1];
|
if (!itemCounDic.ContainsKey(itemID))
|
{
|
itemCounDic[itemID] = count;
|
}
|
else
|
{
|
itemCounDic[itemID] = itemCounDic[itemID] + count;
|
}
|
}
|
|
return itemCounDic;
|
}
|
|
public void UpdateHeroInfo(HB125_tagSCPlayerHeroInfo netPack)
|
{
|
awakeRebirthCnt = netPack.AwakeRebirthCnt;
|
}
|
|
|
public void SortHeroDeleteList()
|
{
|
heroDeleteSortList = HeroManager.Instance.GetHeroGuidList(selectHeroDeleteListJob, selectHeroDeleteListCountry);
|
heroDeleteSortList.Sort(CmpDeleteHero);
|
}
|
|
|
int CmpDeleteHero(string guidA, string guidB)
|
{
|
HeroInfo heroA = HeroManager.Instance.GetHero(guidA);
|
HeroInfo heroB = HeroManager.Instance.GetHero(guidB);
|
if (heroA == null || heroB == null)
|
{
|
return 0;
|
}
|
|
// 排序规则:上阵>武将等级>突破等级>武将觉醒阶级>武将品质>武将吞噬星级>武将ID
|
bool isInTeamA = heroA.IsInAnyTeam();
|
bool isInTeamB = heroB.IsInAnyTeam();
|
if (isInTeamA != isInTeamB)
|
{
|
return isInTeamA ? 1 : -1;
|
}
|
if (heroA.heroLevel != heroB.heroLevel)
|
{
|
return heroA.heroLevel < heroB.heroLevel ? -1 : 1;
|
}
|
if (heroA.breakLevel != heroB.breakLevel)
|
{
|
return heroA.breakLevel < heroB.breakLevel ? -1 : 1;
|
}
|
if (heroA.awakeLevel != heroB.awakeLevel)
|
{
|
return heroA.awakeLevel < heroB.awakeLevel ? -1 : 1;
|
}
|
if (heroA.Quality != heroB.Quality)
|
{
|
return heroA.Quality < heroB.Quality ? -1 : 1;
|
}
|
if (heroA.heroStar != heroA.heroStar)
|
{
|
return heroA.heroStar < heroB.heroStar ? -1 : 1;
|
}
|
|
return heroB.heroId.CompareTo(heroA.heroId);
|
}
|
|
|
#endregion
|
|
}
|