//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, March 12, 2019
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System.Collections.Generic;
|
|
namespace Snxxz.UI
|
{
|
|
public enum TipType
|
{
|
Normal = 1,
|
Good = 2,
|
}
|
|
public class EquipTipUtility
|
{
|
|
public class TipData
|
{
|
public int itemId;
|
public string guid;
|
|
public BaseInfo baseInfo;
|
public BaseProperty baseProperty;
|
public BaseProperty petMountBaseProperty;
|
public LegendProperty legendProperty;
|
public SkillInfo skillInfo;
|
public SuitInfo suitInfo;
|
public StarInfo starInfo;
|
public StrengthenProperty strengthenProperty;
|
public GemInfo gemInfo;
|
public TrainProperty trainProperty;
|
public List<ItemOperateType> operates;
|
|
}
|
|
public struct BaseInfo
|
{
|
public int itemId;
|
public int count;
|
public bool isAuction;
|
public bool isEquiped;
|
|
public int star;
|
public int strengthenLevel;
|
public int score;
|
public int auctionSurplusTime;
|
public int levelLimit;
|
public int realmLimit;
|
}
|
|
public struct BaseProperty
|
{
|
public List<Int2> baseProperties;
|
public int star;
|
public List<Int2> starProperties;
|
}
|
|
public struct LegendProperty
|
{
|
public bool isPreview;
|
public int trueCount;
|
public List<Int2> properties;
|
}
|
|
public struct SuitInfo
|
{
|
public int job;
|
public string name;
|
public int level;
|
public int maxSuitLevel;
|
public List<int> places;
|
public Dictionary<int, EquipSuitPropertyEntry> twoSuitProperties;
|
public Dictionary<int, EquipSuitPropertyEntry> fiveSuitProperties;
|
public Dictionary<int, bool> eightSuits;
|
}
|
|
public struct StarInfo
|
{
|
public Int2 equipPosition;
|
public int starLevel;
|
public int maxLevel;
|
}
|
|
public struct StrengthenProperty
|
{
|
public int strengthenLevel;
|
public List<Int2> properties;
|
}
|
|
public struct GemInfo
|
{
|
public Dictionary<int, bool> activeStates;
|
public Dictionary<int, int> gems;
|
}
|
|
public struct TrainProperty
|
{
|
public int level;
|
public List<Int2> properties;
|
}
|
|
public struct SkillInfo
|
{
|
public List<int> skills;
|
}
|
|
static PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
static EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
|
static EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
|
static EquipGemModel gemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
|
static EquipTrainModel trainModel { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } }
|
static EquipStrengthModel strengthenModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
|
static MountModel mountModel { get { return ModelCenter.Instance.GetModel<MountModel>(); } }
|
static PetModel perModel { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
|
|
public static TipType tipType { get; private set; }
|
public static TipData mainTipData { get; private set; }
|
public static TipData secondaryData { get; private set; }
|
|
public static void Show(TipType type, int itemId)
|
{
|
tipType = type;
|
secondaryData = null;
|
|
var isEquip = ItemLogicUtility.Instance.IsEquip(itemId);
|
if (isEquip)
|
{
|
mainTipData = CreateNormalEquipData(itemId);
|
}
|
else
|
{
|
mainTipData = CreateItemData(itemId);
|
}
|
|
var config = ItemConfig.Get(itemId);
|
switch (type)
|
{
|
case TipType.Normal:
|
if (isEquip)
|
{
|
WindowCenter.Instance.Open<EquipTipWin>();
|
}
|
else
|
{
|
switch (config.Type)
|
{
|
case 26:
|
case 41:
|
case 42:
|
WindowCenter.Instance.Open<PetMountTipWin>();
|
break;
|
default:
|
WindowCenter.Instance.Open<ItemTipWin>();
|
break;
|
}
|
}
|
break;
|
case TipType.Good:
|
WindowCenter.Instance.Open<GoodTipWin>();
|
break;
|
}
|
}
|
|
public static void Show(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return;
|
}
|
|
secondaryData = null;
|
var packType = item.packType;
|
var isEquip = ItemLogicUtility.Instance.IsEquip(item.itemId);
|
switch (packType)
|
{
|
case PackType.Equip:
|
tipType = TipType.Normal;
|
mainTipData = CreateNormalEquipData(guid);
|
break;
|
default:
|
tipType = TipType.Normal;
|
|
if (isEquip)
|
{
|
if (item.isAuction)
|
{
|
mainTipData = CreateEquipAuctionData(guid);
|
}
|
else
|
{
|
mainTipData = CreateNormalEquipData(guid);
|
var equipedGuid = equipModel.GetEquip(new Int2(item.config.LV, item.config.EquipPlace));
|
if (equipedGuid != guid)
|
{
|
secondaryData = CreateNormalEquipData(equipedGuid);
|
}
|
}
|
}
|
else
|
{
|
mainTipData = CreateItemData(guid);
|
}
|
break;
|
}
|
|
switch (tipType)
|
{
|
case TipType.Normal:
|
if (isEquip)
|
{
|
WindowCenter.Instance.Open<EquipTipWin>();
|
}
|
else
|
{
|
switch (item.config.Type)
|
{
|
case 26:
|
case 41:
|
case 42:
|
WindowCenter.Instance.Open<PetMountTipWin>();
|
break;
|
default:
|
WindowCenter.Instance.Open<ItemTipWin>();
|
break;
|
}
|
}
|
break;
|
case TipType.Good:
|
WindowCenter.Instance.Open<GoodTipWin>();
|
break;
|
}
|
}
|
|
static TipData CreateNormalEquipData(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return default(TipData);
|
}
|
|
return new TipData()
|
{
|
itemId = item.itemId,
|
guid = guid,
|
|
baseInfo = GetBaseInfo(guid),
|
baseProperty = GetBaseProperty(guid),
|
legendProperty = GetLegendProperty(guid),
|
skillInfo = GetSkillInfo(item.itemId),
|
suitInfo = GetSuitInfo(guid),
|
starInfo = GetStarInfo(guid),
|
strengthenProperty = GetStrengthenProperty(guid),
|
gemInfo = GetGemInfo(guid),
|
|
trainProperty = GetTrainProperty(guid),
|
operates = GetOperates(guid),
|
};
|
}
|
|
static TipData CreateNormalEquipData(int itemId)
|
{
|
return new TipData()
|
{
|
itemId = itemId,
|
guid = string.Empty,
|
|
baseInfo = GetBaseInfo(itemId),
|
baseProperty = GetBaseProperty(itemId),
|
legendProperty = GetLegendProperty(itemId),
|
skillInfo = GetSkillInfo(itemId),
|
suitInfo = GetSuitInfo(itemId),
|
gemInfo = GetGemInfo(itemId),
|
};
|
}
|
|
static TipData CreateEquipAuctionData(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return default(TipData);
|
}
|
|
return new TipData()
|
{
|
itemId = item.itemId,
|
guid = guid,
|
|
baseInfo = GetBaseInfo(guid),
|
baseProperty = GetBaseProperty(item.itemId),
|
legendProperty = GetLegendProperty(item.itemId),
|
skillInfo = GetSkillInfo(item.itemId),
|
suitInfo = GetSuitInfo(item.itemId),
|
operates = GetOperates(guid),
|
};
|
}
|
|
static TipData CreateItemData(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return default(TipData);
|
}
|
|
return new TipData()
|
{
|
itemId = item.itemId,
|
guid = guid,
|
|
baseInfo = GetBaseInfo(guid),
|
petMountBaseProperty = GetPetMountBaseProperty(item.itemId),
|
operates = GetOperates(guid),
|
};
|
}
|
|
static TipData CreateItemData(int itemId)
|
{
|
return new TipData()
|
{
|
itemId = itemId,
|
baseInfo = GetBaseInfo(itemId),
|
petMountBaseProperty = GetPetMountBaseProperty(itemId),
|
};
|
}
|
|
public static void Operate(ItemOperateType type, string guid)
|
{
|
switch (type)
|
{
|
case ItemOperateType.putOn:
|
ItemOperateUtility.Instance.PutOnItem(guid);
|
break;
|
case ItemOperateType.putOff:
|
ItemOperateUtility.Instance.PutOffEquip(guid);
|
break;
|
case ItemOperateType.putAway:
|
ItemOperateUtility.Instance.PutAway(guid);
|
break;
|
case ItemOperateType.putIn:
|
ItemOperateUtility.Instance.PutInWareHouse(guid);
|
break;
|
case ItemOperateType.putOut:
|
ItemOperateUtility.Instance.TakeOutFromWarehouse(guid);
|
break;
|
case ItemOperateType.sell:
|
var item = packModel.GetItemByGuid(guid);
|
ItemOperateUtility.Instance.SendSellQuest(PackType.Item, item.gridIndex);
|
break;
|
case ItemOperateType.strength:
|
ItemOperateUtility.Instance.GotoStrengthen(guid);
|
break;
|
case ItemOperateType.star:
|
ItemOperateUtility.Instance.GotoStarUpgrade(guid);
|
break;
|
case ItemOperateType.inlay:
|
ItemOperateUtility.Instance.GotoInlayItem(guid);
|
break;
|
case ItemOperateType.train:
|
ItemOperateUtility.Instance.GotoTrain(guid);
|
break;
|
case ItemOperateType.makeUse:
|
ItemOperateUtility.Instance.GotoUseItem(guid);
|
break;
|
case ItemOperateType.split:
|
ItemOperateUtility.Instance.OnClickSplitBtn(guid);
|
break;
|
}
|
}
|
|
private static BaseInfo GetBaseInfo(int itemId)
|
{
|
var config = ItemConfig.Get(itemId);
|
var baseInfo = new BaseInfo()
|
{
|
itemId = itemId,
|
isAuction = false,
|
isEquiped = false,
|
score = ItemLogicUtility.Instance.GetEquipScore(PackType.Item, itemId, null, true),
|
auctionSurplusTime = 0,
|
levelLimit = config.UseLV,
|
realmLimit = config.RealmLimit,
|
};
|
|
return baseInfo;
|
}
|
|
private static BaseInfo GetBaseInfo(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
|
var level = item.config.LV;
|
var place = item.config.EquipPlace;
|
|
var isEquiped = equipModel.GetEquip(new Int2(level, place)) == guid;
|
|
var type = strengthenModel.GetEquipStrengthType(place);
|
var star = starModel.GetEquipStarLevel(new Int2(level, place));
|
var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, level);
|
var maxStrengthenLevel = strengthenModel.GetEquipLevelMax(type, Mathf.Min(star, maxStar));
|
var placeStrengthenLevel = strengthenModel.GetStrengthLevel(level, place);
|
|
var baseInfo = new BaseInfo()
|
{
|
itemId = item.itemId,
|
count = item.count,
|
isAuction = item.isAuction,
|
isEquiped = isEquiped,
|
score = item.score,
|
auctionSurplusTime = item.isAuction ? item.auctionSurplusTime : 0,
|
levelLimit = item.isAuction ? 0 : item.config.UseLV,
|
realmLimit = item.isAuction ? 0 : item.config.RealmLimit,
|
star = isEquiped ? star : -1,
|
strengthenLevel = isEquiped ? Mathf.Min(placeStrengthenLevel, maxStrengthenLevel) : 0
|
};
|
|
return baseInfo;
|
}
|
|
private static BaseProperty GetBaseProperty(int itemId)
|
{
|
var baseProperties = new List<Int2>();
|
var config = ItemConfig.Get(itemId);
|
|
if (config.Effect1 != 0)
|
{
|
baseProperties.Add(new Int2(config.Effect1, config.EffectValueA1));
|
}
|
|
if (config.Effect2 != 0)
|
{
|
baseProperties.Add(new Int2(config.Effect2, config.EffectValueA2));
|
}
|
|
if (config.Effect3 != 0)
|
{
|
baseProperties.Add(new Int2(config.Effect3, config.EffectValueA3));
|
}
|
|
if (config.Effect4 != 0)
|
{
|
baseProperties.Add(new Int2(config.Effect4, config.EffectValueA4));
|
}
|
|
if (config.Effect5 != 0)
|
{
|
baseProperties.Add(new Int2(config.Effect5, config.EffectValueA5));
|
}
|
|
var baseProperty = new BaseProperty()
|
{
|
baseProperties = baseProperties,
|
};
|
|
return baseProperty;
|
}
|
|
private static BaseProperty GetBaseProperty(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
var equipPosition = new Int2(item.config.LV, item.config.EquipPlace);
|
var equiped = equipModel.GetEquip(equipPosition) == guid;
|
|
var baseProperty = GetBaseProperty(item.itemId);
|
|
if (equiped)
|
{
|
var starProperties = new List<Int2>();
|
var currentStar = starModel.GetEquipStarLevel(equipPosition);
|
var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV);
|
var star = Mathf.Min(currentStar, maxStar);
|
if (star > 0)
|
{
|
baseProperty.star = star;
|
var starConfig = EquipStarConfig.Get(item.config.LV, item.config.EquipPlace, star);
|
starProperties.AddRange(starConfig.BaseAttrInfo);
|
}
|
|
baseProperty.starProperties = starProperties;
|
}
|
|
return baseProperty;
|
}
|
|
private static BaseProperty GetPetMountBaseProperty(int itemId)
|
{
|
var config = ItemConfig.Get(itemId);
|
var baseProperty = new BaseProperty();
|
Dictionary<int, int> properties = null;
|
switch (config.Type)
|
{
|
case 26:
|
var petId = PetInfoConfig.GetItemUnLockPet(itemId);
|
properties = perModel.GetPetAttrAddDict(petId);
|
break;
|
case 41:
|
case 42:
|
var horseId = HorseConfig.GetItemUnLockHorse(itemId);
|
properties = mountModel.GetMountAttrAddDict(horseId);
|
break;
|
default:
|
break;
|
}
|
|
if (properties != null)
|
{
|
baseProperty.baseProperties = new List<Int2>();
|
foreach (var property in properties)
|
{
|
baseProperty.baseProperties.Add(new Int2(property.Key, property.Value));
|
}
|
}
|
|
return baseProperty;
|
}
|
|
private static LegendProperty GetLegendProperty(int itemId)
|
{
|
var data = new LegendProperty();
|
data.isPreview = true;
|
data.trueCount = LegendPropertyUtility.GetEquipPropertyCount(itemId);
|
data.properties = LegendPropertyUtility.GetEquipProperties(itemId);
|
|
return data;
|
}
|
|
private static LegendProperty GetLegendProperty(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return default(LegendProperty);
|
}
|
|
var data = new LegendProperty();
|
data.isPreview = false;
|
|
var ids = item.GetUseData(17);
|
var values = item.GetUseData(19);
|
if (!ids.IsNullOrEmpty() && !values.IsNullOrEmpty())
|
{
|
var properties = new List<Int2>();
|
var count = Mathf.Min(ids.Count, values.Count);
|
for (int i = 0; i < count; i++)
|
{
|
properties.Add(new Int2(ids[i], values[i]));
|
}
|
|
data.properties = properties;
|
}
|
|
return data;
|
}
|
|
private static SuitInfo GetSuitInfo(int itemId)
|
{
|
var config = ItemConfig.Get(itemId);
|
if (config == null || config.SuiteiD <= 0)
|
{
|
return default(SuitInfo);
|
}
|
|
var job = config.JobLimit;
|
var twoConfigs = EquipSuitConfig.GetConfigs(job, config.LV, EquipSuitType.TwoSuit);
|
|
var name = twoConfigs[0].name;
|
var level = config.LV;
|
var places = new List<int>();
|
places.Add(config.EquipPlace);
|
var suitInfo = new SuitInfo()
|
{
|
name = name,
|
level = level,
|
job = job,
|
places = places,
|
};
|
|
return suitInfo;
|
}
|
|
private static SuitInfo GetSuitInfo(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return default(SuitInfo);
|
}
|
|
var config = ItemConfig.Get(item.itemId);
|
if (config == null || config.SuiteiD <= 0)
|
{
|
return default(SuitInfo);
|
}
|
|
var equipPosition = new Int2(item.config.LV, item.config.EquipPlace);
|
var equiped = equipModel.GetEquip(equipPosition) == guid;
|
|
var job = config.JobLimit;
|
var twoConfigs = EquipSuitConfig.GetConfigs(job, config.LV, EquipSuitType.TwoSuit);
|
var name = twoConfigs[0].name;
|
|
var level = config.LV;
|
var maxSuitLevel = equiped ? EquipStarModel.GetMaxStarLevel(level) : -1;
|
|
var places = new List<int>();
|
if (equiped)
|
{
|
for (int i = 1; i <= 8; i++)
|
{
|
var equip = packModel.GetItemByGuid(equipModel.GetEquip(new Int2(level, i)));
|
var hasSuit = equip != null && equip.config.SuiteiD > 0;
|
if (hasSuit)
|
{
|
places.Add(i);
|
}
|
}
|
}
|
|
var twoSuitProperties = new Dictionary<int, EquipSuitPropertyEntry>();
|
var fiveSuitProperties = new Dictionary<int, EquipSuitPropertyEntry>();
|
var eightSuits = new Dictionary<int, bool>();
|
var eightSuitLevel = equiped ? equipModel.GetSuitLevel(config.LV, EquipSuitType.EightSuit) : -1;
|
|
var twoSuitProperties0 = equipModel.GetEquipSuitEntry(config.LV, 0, EquipSuitType.TwoSuit);
|
var fiveSuitProperties0 = equipModel.GetEquipSuitEntry(config.LV, 0, EquipSuitType.FiveSuit);
|
|
if (!equiped)
|
{
|
twoSuitProperties0.actived = false;
|
fiveSuitProperties0.actived = false;
|
}
|
|
twoSuitProperties[0] = twoSuitProperties0;
|
fiveSuitProperties[0] = fiveSuitProperties0;
|
eightSuits[0] = eightSuitLevel >= 0;
|
|
if (maxSuitLevel >= 3)
|
{
|
twoSuitProperties[3] = equipModel.GetEquipSuitEntry(config.LV, 3, EquipSuitType.TwoSuit);
|
fiveSuitProperties[3] = equipModel.GetEquipSuitEntry(config.LV, 3, EquipSuitType.FiveSuit);
|
eightSuits[3] = eightSuitLevel >= 3;
|
}
|
|
if (maxSuitLevel >= 6)
|
{
|
twoSuitProperties[6] = equipModel.GetEquipSuitEntry(config.LV, 6, EquipSuitType.TwoSuit);
|
fiveSuitProperties[6] = equipModel.GetEquipSuitEntry(config.LV, 6, EquipSuitType.FiveSuit);
|
eightSuits[6] = eightSuitLevel >= 3;
|
}
|
|
if (maxSuitLevel >= 9)
|
{
|
twoSuitProperties[9] = equipModel.GetEquipSuitEntry(config.LV, 9, EquipSuitType.TwoSuit);
|
fiveSuitProperties[9] = equipModel.GetEquipSuitEntry(config.LV, 9, EquipSuitType.FiveSuit);
|
eightSuits[9] = eightSuitLevel >= 9;
|
}
|
|
var suitInfo = new SuitInfo()
|
{
|
name = name,
|
level = level,
|
job = job,
|
maxSuitLevel = maxSuitLevel,
|
places = places,
|
twoSuitProperties = twoSuitProperties,
|
fiveSuitProperties = fiveSuitProperties,
|
eightSuits = eightSuits
|
};
|
|
return suitInfo;
|
}
|
|
private static StarInfo GetStarInfo(int itemId)
|
{
|
var config = ItemConfig.Get(itemId);
|
if (!EquipModel.IsRealmEquip(config.EquipPlace))
|
{
|
return default(StarInfo);
|
}
|
|
var starInfo = new StarInfo();
|
starInfo.equipPosition = new Int2(config.LV, config.EquipPlace);
|
starInfo.maxLevel = EquipStarModel.GetMaxStarLevel(config.ItemColor, config.LV);
|
starInfo.starLevel = 0;
|
|
return starInfo;
|
}
|
|
private static StarInfo GetStarInfo(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return default(StarInfo);
|
}
|
|
if (!EquipModel.IsRealmEquip(item.config.EquipPlace))
|
{
|
return default(StarInfo);
|
}
|
|
var starInfo = new StarInfo();
|
var equipPosition = new Int2(item.config.LV, item.config.EquipPlace);
|
var equiped = equipModel.GetEquip(equipPosition) == guid;
|
starInfo.equipPosition = equipPosition;
|
starInfo.maxLevel = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV);
|
starInfo.starLevel = equiped ? starModel.GetStarLevel(equipPosition) : 0;
|
|
return starInfo;
|
}
|
|
private static StrengthenProperty GetStrengthenProperty(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return default(StrengthenProperty);
|
}
|
|
var level = item.config.LV;
|
var place = item.config.EquipPlace;
|
var equiped = equipModel.GetEquip(new Int2(level, place)) == guid;
|
if (!equiped)
|
{
|
return default(StrengthenProperty);
|
}
|
|
var data = new StrengthenProperty();
|
|
var strengthenLevel = strengthenModel.GetStrengthLevel(level, place);
|
var type = strengthenModel.GetEquipStrengthType(place);
|
var star = starModel.GetEquipStarLevel(new Int2(level, place));
|
var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV);
|
var maxStrengthenLevel = strengthenModel.GetEquipLevelMax(type, Mathf.Min(star, maxStar));
|
|
data.strengthenLevel = Mathf.Min(strengthenLevel, maxStrengthenLevel);
|
|
data.properties = new List<Int2>();
|
var config = ItemPlusConfig.GetTypeAndLevel(type, data.strengthenLevel);
|
for (int i = 0; i < config.attType.Length; i++)
|
{
|
data.properties.Add(new Int2(config.attType[i], config.attValue[i]));
|
}
|
|
return data;
|
}
|
|
private static GemInfo GetGemInfo(int itemId)
|
{
|
return default(GemInfo);
|
}
|
|
private static GemInfo GetGemInfo(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return default(GemInfo);
|
}
|
|
var level = item.config.LV;
|
var place = item.config.EquipPlace;
|
|
var gemInfo = new GemInfo();
|
var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV);
|
gemInfo.activeStates = new Dictionary<int, bool>();
|
for (int i = 0; i < 4; i++)
|
{
|
gemInfo.activeStates[i] = IsEquipGemHoleOpen(new Int2(level, place), maxStar, i);
|
}
|
|
gemInfo.gems = new Dictionary<int, int>();
|
if (item.packType == PackType.Equip)
|
{
|
int[] gems;
|
if (gemModel.TryGetEquipGems(item.config.LV, item.config.EquipPlace, out gems))
|
{
|
for (int i = 0; i < gems.Length; i++)
|
{
|
gemInfo.gems[i] = gems[i];
|
}
|
}
|
}
|
|
return gemInfo;
|
}
|
|
private static TrainProperty GetTrainProperty(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return default(TrainProperty);
|
}
|
|
var equipPosition = new Int2(item.config.LV, item.config.EquipPlace);
|
var equiped = equipModel.GetEquip(equipPosition) == guid;
|
if (!equiped)
|
{
|
return default(TrainProperty);
|
}
|
|
var trainProperty = new TrainProperty();
|
var star = Mathf.Min(EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV), starModel.GetEquipStarLevel(equipPosition));
|
var type = EquipTrainModel.GetTrainType(equipPosition.y);
|
var maxConfig = WashLevelMaxConfig.Get(type, star);
|
var maxLevel = maxConfig == null ? 1 : maxConfig.levelMax;
|
var trainLevel = Mathf.Min(maxLevel, trainModel.GetTrainLevel(equipPosition));
|
trainProperty.level = trainLevel;
|
|
var trainConfig = EquipWashConfig.Get(type, trainLevel);
|
trainProperty.properties = new List<Int2>();
|
|
if (trainConfig == null)
|
{
|
var trainConfigLevel1 = EquipWashConfig.Get(type, 1);
|
trainProperty.properties.Add(new Int2(trainConfigLevel1.config.attType1, 0));
|
trainProperty.properties.Add(new Int2(trainConfigLevel1.config.attType2, 0));
|
trainProperty.properties.Add(new Int2(trainConfigLevel1.config.attType3, 0));
|
}
|
else
|
{
|
var trainedProperties = trainModel.GetTrainedProperties(equipPosition);
|
trainProperty.properties.Add(new Int2(trainConfig.config.attType1, Mathf.Min(trainedProperties.x, trainConfig.config.attMax1)));
|
trainProperty.properties.Add(new Int2(trainConfig.config.attType2, Mathf.Min(trainedProperties.y, trainConfig.config.attMax2)));
|
trainProperty.properties.Add(new Int2(trainConfig.config.attType3, Mathf.Min(trainedProperties.z, trainConfig.config.attMax3)));
|
}
|
|
return trainProperty;
|
}
|
|
private static SkillInfo GetSkillInfo(int itemId)
|
{
|
var config = ItemConfig.Get(itemId);
|
if (config == null)
|
{
|
return default(SkillInfo);
|
}
|
|
var skillInfo = new SkillInfo();
|
skillInfo.skills = new List<int>();
|
|
if (config.AddSkill1 != 0)
|
{
|
skillInfo.skills.Add(config.AddSkill1);
|
}
|
|
if (config.AddSkill2 != 0)
|
{
|
skillInfo.skills.Add(config.AddSkill2);
|
}
|
|
return skillInfo;
|
}
|
|
private static List<ItemOperateType> GetOperates(int itemId)
|
{
|
var config = ItemConfig.Get(itemId);
|
var operates = new List<ItemOperateType>();
|
if (config.CanSell == 1)
|
{
|
operates.Add(ItemOperateType.sell);
|
}
|
|
if (config.UseTag == 1)
|
{
|
operates.Add(ItemOperateType.makeUse);
|
}
|
|
if (config.Type == 25 || config.Effect1 == 225)
|
{
|
operates.Add(ItemOperateType.inlay);
|
}
|
|
return operates;
|
}
|
|
private static List<ItemOperateType> GetOperates(string guid)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (item == null)
|
{
|
return null;
|
}
|
|
var operates = new List<ItemOperateType>();
|
var packType = item.packType;
|
|
if (WindowCenter.Instance.IsOpen("DepotWin"))
|
{
|
switch (packType)
|
{
|
case PackType.Warehouse:
|
operates.Add(ItemOperateType.putOut);
|
break;
|
default:
|
operates.Add(ItemOperateType.putIn);
|
break;
|
}
|
|
return operates;
|
}
|
|
switch (packType)
|
{
|
case PackType.Equip:
|
if (WindowCenter.Instance.IsOpen("RealmEquipWin"))
|
{
|
operates.Add(ItemOperateType.putOff);
|
|
if (FuncOpen.Instance.IsFuncOpen(1))
|
{
|
operates.Add(ItemOperateType.strength);
|
}
|
|
operates.Add(ItemOperateType.star);
|
if (FuncOpen.Instance.IsFuncOpen(1))
|
{
|
operates.Add(ItemOperateType.inlay);
|
}
|
|
operates.Add(ItemOperateType.train);
|
}
|
break;
|
case PackType.Warehouse:
|
operates.Add(ItemOperateType.putOut);
|
break;
|
default:
|
if (item.isAuction)
|
{
|
operates.Add(ItemOperateType.putAway);
|
}
|
else
|
{
|
var isEquip = ItemLogicUtility.Instance.IsEquip(item.itemId);
|
if (isEquip)
|
{
|
operates.Add(ItemOperateType.sell);
|
operates.Add(ItemOperateType.putOn);
|
}
|
else
|
{
|
operates.AddRange(GetOperates(item.itemId));
|
if (item.count > 1)
|
{
|
operates.Add(ItemOperateType.split);
|
}
|
}
|
}
|
break;
|
}
|
|
return operates;
|
}
|
|
private static bool IsEquipGemHoleOpen(Int2 equipPosition, int maxStar, int hole)
|
{
|
GemHoleCondition condition;
|
if (gemModel.TryGetGemHoleCondition(hole, out condition))
|
{
|
var star = starModel.GetStarLevel(equipPosition);
|
if (Mathf.Min(star, maxStar) < condition.equipStar)
|
{
|
return false;
|
}
|
|
var vipLevel = PlayerDatas.Instance.baseData.VIPLv;
|
if (vipLevel < condition.vipLevel)
|
{
|
return false;
|
}
|
}
|
|
return true;
|
}
|
|
}
|
|
}
|