/// <summary> /// Show the info of the item. /// </summary> /// <param name="orderType">The order type of </param> /// <param name="heroTran">The transform of item.</param> /// <param name="heroInfo">The info of item.</param> public static void ShowHero(OrderType orderType, HeroItem heroTran, HeroInfo heroInfo) { var heroTemplate = HeroModelLocator.Instance.HeroTemplates.HeroTmpls[heroInfo.TemplateId]; var quality = heroTemplate.Star; var level = heroInfo.Lvl; var job = heroTemplate.Job; var atk = heroInfo.Prop[RoleProperties.ROLE_ATK]; var hp = heroInfo.Prop[RoleProperties.ROLE_HP]; ; var recover = heroInfo.Prop[RoleProperties.ROLE_RECOVER]; ; ShowHero(orderType, heroTran, quality, level, job, atk, hp, recover); }
public static void ShowHero(OrderType orderType, HeroItem heroItem, int quality, short level, sbyte job, int atk, int hp, int recover) { switch (orderType) { //入手顺序排序 case OrderType.Time: heroItem.ShowByLvl(level); break; //武将职业排序 case OrderType.Job: heroItem.ShowByJob(atk); break; //武将稀有度排序 case OrderType.Rarity: heroItem.ShowByQuality(quality); break; //照队伍顺序排序 case OrderType.Team: heroItem.ShowByLvl(level); break; //攻击力排序 case OrderType.Attack: heroItem.ShowByJob(atk); break; //HP排序 case OrderType.Health: heroItem.ShowByHp(hp); break; //回复力排序 case OrderType.Recover: heroItem.ShowByRecover(recover); break; //等级排序 case OrderType.Level: heroItem.ShowByLvl(level); break; } }
public void Clear() { OrderType = OrderType.Time; GetHeroPos = 0; SCHeroList = null; AlreadyRequest = false; }
/// <summary> /// Sort the list of hero info by specific order type. /// </summary> /// <param name="orderType">The specific order type.</param> /// <param name="heros">The list of hero info to be sorted.</param> /// <param name="isDescend">Descend or ascend of the sorting.</param> public void SortHeroList(OrderType orderType, List<HeroInfo> heros, bool isDescend = true) { if (heros == null || heros.Count <= 1) { return; } switch (orderType) { case OrderType.Time: heros.Sort(CompareHeroByTime); break; case OrderType.Job: heros.Sort(CompareHeroByJob); break; case OrderType.Rarity: heros.Sort(CompareHeroByRarity); break; case OrderType.Team: SortHeroByTeam(heros); break; case OrderType.Attack: heros.Sort(CompareHeroByAttack); break; case OrderType.Health: heros.Sort(CompareHeroByHp); break; case OrderType.Recover: heros.Sort(CompareHeroByRecover); break; case OrderType.Level: heros.Sort(CompareHeroByLv); break; } if(isDescend == false) { heros.Reverse(); } }
/// <summary> /// Sort the list of hero info by specific order type. /// </summary> /// <param name="sortType">The specific order type.</param> /// <param name="items">The list of hero info to be sorted.</param> /// <param name="isDescend">Descend or ascend of the sorting.</param> public void SortItemList(OrderType sortType, List<ItemInfo> items, bool isDescend = true) { if (items == null || items.Count <= 1) { return; } switch (sortType) { case OrderType.Time: items.Sort(CompareItemByTime); break; case OrderType.Job: items.Sort(CompareItemByJob); break; case OrderType.Rarity: items.Sort(CompareItemByQuality); break; case OrderType.Attack: items.Sort(CompareItemByAttack); break; case OrderType.Health: items.Sort(CompareItemByHp); break; case OrderType.Recover: items.Sort(CompareItemByRecover); break; case OrderType.Level: items.Sort(CompareItemByLv); break; } if (isDescend == false) { items.Reverse(); } }