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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
//主功能整套装备
public class EquipSet
{
    public readonly int maxEquipCnt = 12; //最大装备格子数
    public readonly int mark;  //多套情况,或者多流派存储
    public bool unLocked { get { return true; } }   //后续根据玩法解锁的情况,如购买存储流派位
 
    public int fightPower {
        get {
            return EquipFightPower.Instance.CalculatePower(mark);
        }
    }
 
    Dictionary<int, EquipSlot> equipSlots = new Dictionary<int, EquipSlot>();
 
    public EquipSet(int mark)
    {
        this.mark = mark;
        for (var i = 1; i <= maxEquipCnt; i++)
        {
            equipSlots[i] = new EquipSlot(i);
        }
 
    }
 
    public void UpdateEquipSlot(int place, string equipGuid)
    {
        if (equipSlots.ContainsKey(place))
        {
            equipSlots[place].equip.value = equipGuid;
        }
    }
 
 
 
    public EquipSlot GetEquipSlot(int place)
    {
        if (!equipSlots.ContainsKey(place))
        {
            return null;
        }
 
        return equipSlots[place];
    }
 
    public string GetEquip(int place)
    {
        if (!equipSlots.ContainsKey(place))
        {
            return null;
        }
 
        return equipSlots[place].equip.value;
    }
 
    
 
    public int CompareToCurrent(string equipGuid)
    {
        var item = PackManager.Instance.GetItemByGuid(equipGuid);   //需改成地板物品
        if (item == null)
        {
            return 0;
        }
 
        var place = item.config.EquipPlace;
        if (!equipSlots.ContainsKey(place))
        {
            return 0;
        }
 
        var slot = equipSlots[place];
        var currentEquip = PackManager.Instance.GetItemByGuid(slot.equip.value);
        if (currentEquip == null)
        {
            return 1;
        }
 
        return item.score.CompareTo(currentEquip.score);
    }
 
    public static Int2 ServerPlaceToClientPlace(int serverPlace)
    {
        var config = EquipPlaceMapConfig.Get(serverPlace);
        if (config != null)
        {
            return new Int2(config.LV, config.EquipPlace);
        }
        else
        {
            return Int2.zero;
        }
    }
 
    public static int ClientPlaceToServerPlace(Int2 equipPosition)
    {
        return EquipPlaceMapConfig.GetServerPlace(equipPosition.x, equipPosition.y);
    }
 
}