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);
|
}
|
|
}
|