少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-05 efa5f8d07fc3321f6ac5f5d97fb422db28d0886f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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,
    }
 
}