using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
namespace Snxxz.UI
|
{
|
|
public class EquipSetStar
|
{
|
public readonly int level = 0;
|
Dictionary<int, int> equipStars = new Dictionary<int, int>();
|
|
public EquipSetStar(int level)
|
{
|
this.level = level;
|
}
|
|
public int GetTotalStarLevel()
|
{
|
var totalLevel = 0;
|
foreach (var starLevel in equipStars.Values)
|
{
|
totalLevel += starLevel;
|
}
|
|
return totalLevel;
|
}
|
|
public void UpdateEquipStarLevel(int place, int level)
|
{
|
equipStars[place] = level;
|
}
|
|
public int GetEquipStarLevel(int place)
|
{
|
return equipStars.ContainsKey(place) ? equipStars[place] : 0;
|
}
|
|
public int GetEquipCountWhichStarLevelLq(int standard)
|
{
|
var count = 0;
|
foreach (var starLevel in equipStars.Values)
|
{
|
count += starLevel >= standard ? 1 : 0;
|
}
|
|
return count;
|
}
|
|
public int GetSuitLevel(EquipSuitType type)
|
{
|
var targetCount = 2;
|
switch (type)
|
{
|
case EquipSuitType.TwoSuit:
|
targetCount = 2;
|
break;
|
case EquipSuitType.FiveSuit:
|
targetCount = 5;
|
break;
|
case EquipSuitType.EightSuit:
|
targetCount = 8;
|
break;
|
default:
|
break;
|
}
|
|
var maxLevel = GetTotalStarLevel() / targetCount;
|
for (var i = maxLevel; i >= 0; i--)
|
{
|
if (GetEquipCountWhichStarLevelLq(i) >= targetCount)
|
{
|
return i;
|
}
|
}
|
|
return 0;
|
}
|
|
}
|
|
public enum EquipSuitType
|
{
|
TwoSuit = 2,
|
FiveSuit = 5,
|
EightSuit = 8,
|
}
|
|
}
|