//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, March 11, 2019
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System;
|
|
namespace vnxbqy.UI
|
{
|
//装备强化
|
public struct EquipStrength
|
{
|
public int EquipIndex;//强化部位
|
public int StrengthLevel;//等级
|
public int Exp;//经验
|
public int EvolveLV;//进化等级
|
public int Type;//强化类型
|
|
}
|
|
public class EquipTypeClass
|
{
|
public int AttType;//属性类型
|
public int AttValue;//属性值
|
public string StrName;//属性名
|
}
|
public class EquipMaxLvClass
|
{
|
public int MaxLv;
|
public int MaxStar;
|
}
|
|
public class EquipPlusEvolveClass
|
{
|
public int EquipType;//装备类型
|
public int EvolveLV;//进化等级
|
public int NeedPlusLV;//需要强化等级
|
public int CostItemID;//所需物品ID
|
public int CostItemCount;//所需物品数量
|
public ItemConfig Item;
|
public int AttrType;
|
public string AttrValue;
|
public string AttrName;
|
}
|
|
|
public class EquipStrengthModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
{
|
public Dictionary<int, EquipStrength> EquipStrengthDic = new Dictionary<int, EquipStrength>();//强化数据
|
public Dictionary<int, Dictionary<int, int>> EquipLevelMaxDic = new Dictionary<int, Dictionary<int, int>>();//强化类型的最大等级上限
|
static Dictionary<int, int> PartTypeDic = new Dictionary<int, int>();//强化的部位类型
|
public Dictionary<int, int> EvolutionTypeMaxDic = new Dictionary<int, int>();
|
Dictionary<int, int> PlusMasterDict = new Dictionary<int, int>();
|
|
public List<EquipSetSelect> EquipSetList = new List<EquipSetSelect>();
|
|
public event Action EquipStrengthUpdate;//强化数据刷新
|
public event Action<int> EquipStrengthLvUpdate;//强化升级成功
|
public event Action EquipStrngthEvolutionLv;//进阶成功
|
public event Action SelectEquipRefresh;//二级页签刷新
|
public event Action SelectLevelRefresh;//一级页签刷新
|
|
public event Action StrengthMasterFresh;//强化大师
|
|
public List<int> equipPlaces { get; private set; }
|
|
//public Int3[] redpointLimits;
|
|
private bool isChangeBool = true;
|
public bool IsChangeBool {
|
get { return isChangeBool; }
|
set { isChangeBool = value; }
|
}
|
private int selectLevel = 0;
|
public int SelectLevel//装备类别
|
{
|
get { return selectLevel; }
|
set {
|
if (selectLevel != value)
|
{
|
selectLevel = value;
|
if (SelectLevelRefresh != null)
|
{
|
SelectLevelRefresh();
|
}
|
}
|
}
|
}
|
private int m_SelectEquipPlace = -1;//装备部位
|
public int SelectEquipPlace//装备类别
|
{
|
get { return m_SelectEquipPlace; }
|
set {
|
if (m_SelectEquipPlace != value)
|
{
|
m_SelectEquipPlace = value;
|
if (SelectEquipRefresh != null)
|
{
|
SelectEquipRefresh();
|
}
|
}
|
}
|
}
|
|
public Int2 jumpEquipPosition { get; set; }
|
|
public bool isServerPrepare { get; private set; }
|
|
public readonly Redpoint redpoint = new Redpoint(106, 10601);
|
public static int REDPOINTBASE = 106010000;
|
|
Dictionary<int, Redpoint> m_EquipSetRedpoints = new Dictionary<int, Redpoint>();
|
Dictionary<int, EquipStrengthRedpoint> m_EquipStrengthRedpoints = new Dictionary<int, EquipStrengthRedpoint>();
|
public Dictionary<int, Redpoint> m_EquipSetMasterRedpoints = new Dictionary<int, Redpoint>();
|
|
Dictionary<Int2, Redpoint> equipPositionRed = new Dictionary<Int2, Redpoint>();
|
|
PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
|
EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
|
|
public override void Init()
|
{
|
var strengthenLevelLimit = FuncConfigConfig.Get("StrengthenLevelLimit").Numerical1;
|
PartTypeDic = ConfigParse.GetDic<int, int>(strengthenLevelLimit);
|
InitEquipLevelMax();
|
GetEvolutionTypeMax();
|
|
var funcConfig = FuncConfigConfig.Get("StrengthenRedPointLevel");
|
var array = funcConfig.Numerical1.Split('|');
|
//redpointLimits = new Int3[array.Length];
|
//for (int i = 0; i < array.Length; i++)
|
//{
|
// Int3.TryParse(array[i], out redpointLimits[i]);
|
//}
|
|
equipPlaces = new List<int>(12);
|
for (int i = 1; i <= 12; i++)
|
{
|
equipPlaces.Add(i);
|
}
|
|
var configs = EquipControlConfig.GetValues();
|
var totalEquipLevels = new List<int>();
|
foreach (var item in configs)
|
{
|
var level = item.level;
|
if (!totalEquipLevels.Contains(level))
|
{
|
totalEquipLevels.Add(level);
|
}
|
}
|
|
foreach (var level in totalEquipLevels)
|
{
|
var equipSetRedpointBase = REDPOINTBASE++;
|
m_EquipSetRedpoints[level] = new Redpoint(redpoint.id, equipSetRedpointBase);
|
foreach (var place in equipPlaces)
|
{
|
var packIndex = EquipPlaceMapConfig.GetServerPlace(level, place);
|
if (!m_EquipStrengthRedpoints.ContainsKey(packIndex))
|
{
|
EquipStrengthRedpoint _redpoint = new EquipStrengthRedpoint(equipSetRedpointBase);
|
m_EquipStrengthRedpoints.Add(packIndex, _redpoint);
|
}
|
}
|
m_EquipSetMasterRedpoints[level] = new Redpoint(equipSetRedpointBase, equipSetRedpointBase+5000);
|
}
|
|
packModel.refreshItemCountEvent += RefreshItemCountEvent;
|
FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
|
PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent;
|
equipModel.OnSelectFuncSetEvent += OnSelect;
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
isServerPrepare = false;
|
EquipStrengthDic.Clear();
|
PlusMasterDict.Clear();
|
|
foreach (var instance in EquipSetList)
|
{
|
GameObject.Destroy(instance.gameObject);
|
}
|
EquipSetList.Clear();
|
|
}
|
|
public void OnPlayerLoginOk()
|
{
|
UpdateRedpoint();
|
isServerPrepare = true;
|
}
|
|
public override void UnInit()
|
{
|
packModel.refreshItemCountEvent -= RefreshItemCountEvent;
|
FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
|
PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent;
|
equipModel.OnSelectFuncSetEvent -= OnSelect;
|
}
|
|
private void OnSelect(int equipLevel)
|
{
|
if (SelectLevel == equipLevel)
|
{
|
return;
|
}
|
else
|
{
|
SelectLevel = equipLevel;
|
}
|
}
|
|
private void PlayerDataRefreshEvent(PlayerDataType dataType)
|
{
|
if (dataType == PlayerDataType.Silver
|
|| dataType == PlayerDataType.LV)
|
{
|
if (isServerPrepare)
|
{
|
UpdateRedpoint();
|
}
|
}
|
}
|
|
private void OnFuncStateChangeEvent(int id)
|
{
|
if (id == (int)FuncOpenEnum.Strength)
|
{
|
if (isServerPrepare)
|
{
|
UpdateRedpoint();
|
}
|
}
|
}
|
|
private void RefreshItemCountEvent(PackType packType, int arg2, int itemId)
|
{
|
if (packType == PackType.Item)
|
{
|
if (isServerPrepare)
|
{
|
UpdateRedpoint();
|
}
|
}
|
}
|
|
public void UpdateEuipPartPlusInfo(HA3B3_tagMCEquipPartPlusInfo info)
|
{
|
for (int i = 0; i < info.Count; i++)
|
{
|
var equipPartPlus = info.InfoList[i];
|
EquipStrength equipStrength = new EquipStrength();
|
equipStrength.Type = equipPartPlus.PackType;
|
equipStrength.EquipIndex = equipPartPlus.EquipIndex;
|
equipStrength.StrengthLevel = equipPartPlus.EquipPartStarLV;
|
equipStrength.Exp = (int)equipPartPlus.Proficiency;
|
equipStrength.EvolveLV = equipPartPlus.EvolveLV;
|
if (EquipStrengthDic.ContainsKey(equipPartPlus.EquipIndex))
|
{
|
var equip = EquipStrengthDic[equipPartPlus.EquipIndex];
|
EquipStrengthDic[equipPartPlus.EquipIndex] = equipStrength;
|
if (equip.StrengthLevel != equipPartPlus.EquipPartStarLV && EquipStrengthLvUpdate != null)
|
{
|
EquipStrengthLvUpdate(equipPartPlus.EquipPartStarLV);
|
}
|
if (equip.EvolveLV != equipPartPlus.EvolveLV && EquipStrngthEvolutionLv != null)
|
{
|
EquipStrngthEvolutionLv();
|
}
|
}
|
else
|
{
|
EquipStrengthDic.Add(equipPartPlus.EquipIndex, equipStrength);
|
}
|
}
|
if (EquipStrengthUpdate != null)
|
{
|
EquipStrengthUpdate();
|
}
|
|
if (isServerPrepare)
|
{
|
UpdateRedpoint();
|
}
|
}
|
|
public void SendEquip(int equipIndex, int packTyp = 1)
|
{
|
CA301_tagEquipPlus CA301 = new CA301_tagEquipPlus();
|
CA301.PackType = (byte)packTyp;
|
CA301.ItemIndex = (ushort)equipIndex;
|
GameNetSystem.Instance.SendInfo(CA301);
|
}
|
|
public void SendEquipPlusEvolve(int equipIndex)
|
{
|
CA316_tagCMEquipPlusEvolve CA316 = new CA316_tagCMEquipPlusEvolve();
|
CA316.ItemIndex = (ushort)equipIndex;
|
GameNetSystem.Instance.SendInfo(CA316);
|
}
|
private void InitEquipLevelMax()
|
{
|
//强化等级上限受装备阶影响
|
var itemPlusMax = ItemPlusMaxConfig.GetValues();
|
foreach (var value in itemPlusMax)
|
{
|
Dictionary<int, int> LevelDict = null;
|
if (!EquipLevelMaxDic.TryGetValue(value.EquipType, out LevelDict))
|
{
|
LevelDict = new Dictionary<int, int>();
|
EquipLevelMaxDic.Add(value.EquipType, LevelDict);
|
}
|
LevelDict.Add(value.equipLevel, value.levelMax);
|
}
|
}
|
|
public static int GetEquipStrengthType(int equipPlace)//获取装备类型
|
{
|
int type = 1;
|
if (PartTypeDic.ContainsKey(equipPlace))
|
{
|
type = PartTypeDic[equipPlace];
|
}
|
return type;
|
}
|
|
public int GetEquipLevelMax(int type, int equipLV)//获取某一类型的最大强化等级
|
{
|
int lv = 0;
|
if (EquipLevelMaxDic.ContainsKey(type))
|
{
|
var LevelDict = EquipLevelMaxDic[type];
|
if (LevelDict.ContainsKey(equipLV))
|
{
|
return LevelDict[equipLV];
|
}
|
}
|
return lv;
|
}
|
|
public List<EquipTypeClass> GetEquipValueList(int level, int equipPlace, int addlv = 0)//当前获得的强化属性
|
{
|
List<EquipTypeClass> EquipTypeList = new List<EquipTypeClass>();
|
int type = GetEquipStrengthType(equipPlace);
|
int equiplv = 0;
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
|
if (EquipStrengthDic.ContainsKey(equipIndex))
|
{
|
equiplv = EquipStrengthDic[equipIndex].StrengthLevel;
|
}
|
equiplv += addlv;
|
var itemPlus = ItemPlusConfig.GetTypeAndLevel(type, equiplv);
|
if (itemPlus != null)
|
{
|
int[] attType = itemPlus.attType;
|
int[] attValue = itemPlus.attValue;
|
for (int i = 0; i < attType.Length; i++)
|
{
|
EquipTypeClass equipType = new EquipTypeClass();
|
equipType.AttType = attType[i];
|
equipType.AttValue = attValue[i];
|
var config = PlayerPropertyConfig.Get(attType[i]);
|
if (config != null)
|
{
|
equipType.StrName = config.Name;
|
}
|
EquipTypeList.Add(equipType);
|
}
|
}
|
return EquipTypeList;
|
|
}
|
public ItemPlusConfig GetEquipConfig(int level, int equipPlace)
|
{
|
ItemPlusConfig itemPlusConfig = new ItemPlusConfig();
|
int type = GetEquipStrengthType(equipPlace);
|
int equiplv = 0;
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
|
if (EquipStrengthDic.ContainsKey(equipIndex))
|
{
|
equiplv = EquipStrengthDic[equipIndex].StrengthLevel;
|
}
|
itemPlusConfig = ItemPlusConfig.GetTypeAndLevel(type, equiplv);
|
return itemPlusConfig;
|
}
|
|
public EquipPlusEvolveClass GetEquipPlusEvolve(int equipPlace, int equipLv)//获取装备进化数据
|
{
|
EquipPlusEvolveClass equipPlusEvolve = new EquipPlusEvolveClass();
|
int lvType = 1;
|
if (equipLv != 0)
|
{
|
lvType = equipLv;
|
}
|
var equipPlusEvolveConfig = EquipPlusEvolveConfig.GetEquipPlaceAndEvolveLV(equipPlace, lvType);
|
if (equipPlusEvolveConfig != null)
|
{
|
equipPlusEvolve.EquipType = equipPlusEvolveConfig.EquipPlace;
|
equipPlusEvolve.EvolveLV = equipPlusEvolveConfig.EvolveLV;
|
equipPlusEvolve.NeedPlusLV = equipPlusEvolveConfig.NeedPlusLV;
|
var Dic1 = ConfigParse.GetDic<int, int>(equipPlusEvolveConfig.CostItem);
|
foreach (var key in Dic1.Keys)
|
{
|
equipPlusEvolve.CostItemID = key;
|
equipPlusEvolve.CostItemCount = Dic1[key];
|
}
|
var Dic2 = ConfigParse.GetDic<int, float>(equipPlusEvolveConfig.Attr);
|
foreach (var key in Dic2.Keys)
|
{
|
equipPlusEvolve.AttrType = key;
|
var config = PlayerPropertyConfig.Get(key);
|
if (config != null)
|
{
|
equipPlusEvolve.AttrName = config.Name;
|
float value = Dic2[key];
|
switch (config.ISPercentage)
|
{
|
case 0:
|
equipPlusEvolve.AttrValue = value.ToString();
|
if (equipLv == 0)
|
{
|
equipPlusEvolve.AttrValue = 0.ToString();
|
}
|
break;
|
case 1:
|
equipPlusEvolve.AttrValue = (value / 100).ToString() + "%";
|
if (equipLv == 0)
|
{
|
equipPlusEvolve.AttrValue = 0.ToString() + "%";
|
}
|
break;
|
case 2:
|
equipPlusEvolve.AttrValue = value.ToString() + "%";
|
if (equipLv == 0)
|
{
|
equipPlusEvolve.AttrValue = 0.ToString() + "%";
|
}
|
break;
|
}
|
}
|
}
|
}
|
return equipPlusEvolve;
|
}
|
|
private void GetEvolutionTypeMax()
|
{
|
var evolveValues = EquipPlusEvolveConfig.GetValues();
|
foreach (var value in evolveValues)
|
{
|
if (EvolutionTypeMaxDic.ContainsKey(value.EquipPlace))
|
{
|
var lv = EvolutionTypeMaxDic[value.EquipPlace];
|
if (value.EvolveLV > lv)
|
{
|
EvolutionTypeMaxDic[value.EquipPlace] = value.EvolveLV;
|
}
|
}
|
else
|
{
|
EvolutionTypeMaxDic.Add(value.EquipPlace, value.EvolveLV);
|
}
|
}
|
}
|
|
public EquipStrength GetEquipStrength(int level, int equipPlace)
|
{
|
EquipStrength equipStrength = new EquipStrength();
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
|
if (EquipStrengthDic.ContainsKey(equipIndex))
|
{
|
equipStrength = EquipStrengthDic[equipIndex];
|
}
|
return equipStrength;
|
}
|
|
public int GetStrengthLevel(int level, int equipPlace)
|
{
|
int lv = 0;
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
|
if (EquipStrengthDic.ContainsKey(equipIndex))
|
{
|
lv = EquipStrengthDic[equipIndex].StrengthLevel;
|
}
|
|
return lv;
|
}
|
|
public int GetStrengthLevelByColor(int level, int equipPlace)
|
{
|
int lv = 0;
|
var guid = equipModel.GetEquip(new Int2(level, equipPlace));
|
if (guid == string.Empty) return lv;
|
var item = packModel.GetItemByGuid(guid);
|
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
|
if (EquipStrengthDic.ContainsKey(equipIndex))
|
{
|
lv = EquipStrengthDic[equipIndex].StrengthLevel;
|
}
|
|
return lv;
|
}
|
|
|
public int GetMasterLV(int level)
|
{
|
int masterLV = 0;
|
PlusMasterDict.TryGetValue(level, out masterLV);
|
return masterLV;
|
}
|
|
|
public int GetStrengthEvolveLevel(int level, int equipPlace)
|
{
|
int lv = 0;
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, equipPlace);
|
if (EquipStrengthDic.ContainsKey(equipIndex))
|
{
|
lv = EquipStrengthDic[equipIndex].EvolveLV;
|
}
|
return lv;
|
}
|
|
// 依据装备品质(颜色)获取8件套最低等级
|
public int GetStrengthMinLV(int level)
|
{
|
int lv;
|
int minLV = -1;
|
int equipIndex = 0;
|
for (int i = 1; i <= 8; i++)
|
{
|
var guid = equipModel.GetEquip(new Int2(level, i));
|
if (guid != string.Empty)
|
{
|
|
equipIndex = EquipPlaceMapConfig.GetServerPlace(level, i);
|
if (EquipStrengthDic.ContainsKey(equipIndex))
|
{
|
lv = EquipStrengthDic[equipIndex].StrengthLevel;
|
}
|
else
|
{
|
lv = 0;
|
}
|
|
}
|
else
|
{
|
lv = 0;
|
}
|
|
if (minLV == -1)
|
minLV = lv;
|
minLV = Math.Min(minLV, lv);
|
}
|
|
return Math.Max(minLV, 0);
|
}
|
|
public int GetCountActiveMaster(int level, int color, int masterLV)
|
{
|
int count = 0;
|
for (int i = 1; i <= 8; i++)
|
{
|
var guid = equipModel.GetEquip(new Int2(level, i));
|
if (guid != string.Empty)
|
{
|
var item = packModel.GetItemByGuid(guid);
|
if (ItemLogicUtility.Instance.GetItemQuality(item.itemId, null) >= color)
|
{
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(level, i);
|
if (EquipStrengthDic.ContainsKey(equipIndex) && EquipStrengthDic[equipIndex].StrengthLevel >= masterLV)
|
{
|
count++;
|
}
|
|
}
|
}
|
|
}
|
|
return count;
|
}
|
|
|
public int GetEquipStrengthState(Int2 position)
|
{
|
var equipGuid = equipModel.GetEquip(position);
|
if (string.IsNullOrEmpty(equipGuid))
|
{
|
return 3;
|
}
|
|
var serverPlace = EquipPlaceMapConfig.GetServerPlace(position.x, position.y);
|
|
var item = packModel.GetItemByGuid(equipGuid);
|
|
|
int equipLevel = 0;
|
int advancedLevel = 0;
|
|
if (EquipStrengthDic.ContainsKey(serverPlace))//获取当前强化等级
|
{
|
equipLevel = EquipStrengthDic[serverPlace].StrengthLevel;
|
advancedLevel = EquipStrengthDic[serverPlace].EvolveLV;
|
}
|
|
int equipType = EquipStrengthModel.GetEquipStrengthType(position.y);
|
|
int maxLevel = GetEquipLevelMax(equipType, position.x);//获取最大强化等级
|
if (equipLevel >= maxLevel)//满级
|
{
|
return 2;
|
}
|
// 强化进阶限制强化
|
var equipPlusEvolveConfig = EquipPlusEvolveConfig.GetEquipPlaceAndEvolveLV(position.y, advancedLevel+1);
|
if (equipPlusEvolveConfig != null)
|
{
|
if (equipLevel >= equipPlusEvolveConfig.NeedPlusLV)//强化上限
|
{
|
return 1;
|
}
|
}
|
return 0;
|
}
|
|
public bool SatisfyEquipAdvance(Int2 position)
|
{
|
int equipLv = 0;
|
int advancedLv = 0;
|
int itemCount = 0;
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(position.x, position.y);
|
if (EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
|
{
|
equipLv = EquipStrengthDic[equipIndex].StrengthLevel;
|
advancedLv = EquipStrengthDic[equipIndex].EvolveLV;
|
}
|
var equipPlusEvolve = GetEquipPlusEvolve(position.y, advancedLv + 1);
|
if (equipPlusEvolve == null)
|
{
|
return false;
|
}
|
if (equipPlusEvolve.NeedPlusLV > equipLv)
|
{
|
return false;
|
}
|
itemCount = packModel.GetItemCountByID(PackType.Item, equipPlusEvolve.CostItemID);
|
if (equipPlusEvolve.CostItemCount > itemCount)
|
{
|
return false;
|
}
|
//满级最后一档不进化
|
if (GetEquipStrengthState(position) == 2) return false;
|
return true;
|
}
|
|
public bool HasEnoughMoney(Int2 position)
|
{
|
var config = GetEquipConfig(position.x, position.y);
|
if (config == null)
|
{
|
return false;
|
}
|
|
bool result = true;
|
ulong money = UIHelper.GetMoneyCnt(3);
|
ulong requireMoney = (ulong)config.costCount;
|
if (money < requireMoney)
|
result = false;
|
|
if (config.costItemInfo.Length == 2)
|
{
|
var itemCount = packModel.GetItemCountByID(PackType.Item, config.costItemInfo[0]);
|
if (itemCount < config.costItemInfo[1])
|
{
|
result = false;
|
}
|
}
|
|
return result;
|
}
|
|
public bool TryGetRedpoint(int level, out Redpoint _redpoint)
|
{
|
return m_EquipSetRedpoints.TryGetValue(level, out _redpoint);
|
}
|
|
public bool TryGetRedpoint(int level, int place, out EquipStrengthRedpoint _redpoint)
|
{
|
var packIndex = EquipPlaceMapConfig.GetServerPlace(level, place);
|
return m_EquipStrengthRedpoints.TryGetValue(packIndex, out _redpoint);
|
}
|
|
public void SetDayRemind()
|
{
|
if (redpoint.state == RedPointState.Simple)
|
{
|
DayRemind.Instance.SetDayRemind(DayRemind.EQUIPSTRENGTH_REDPOINT, true);
|
UpdateRedpoint();
|
}
|
}
|
|
public bool ExistAnySatisfyStrengh()
|
{
|
var equipSets = equipModel.GetUnLockedEquipSets();
|
foreach (var level in equipSets)
|
{
|
foreach (var place in equipPlaces)
|
{
|
var position = new Int2(level, place);
|
var equipGuid = equipModel.GetEquip(position);
|
if (string.IsNullOrEmpty(equipGuid))
|
{
|
continue;
|
}
|
|
var state = GetEquipStrengthState(position);
|
if (state != 0)
|
{
|
continue;
|
}
|
|
if (!HasEnoughMoney(position))
|
{
|
continue;
|
}
|
|
return true;
|
}
|
}
|
return false;
|
}
|
|
public void UpdateRedpoint()
|
{
|
if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Strength))
|
{
|
RefreshRedpoint(Int2.zero, 0);
|
return;
|
}
|
|
RefreshMasterRedpoint();
|
|
var equipSets = equipModel.GetAllEquipSets();
|
foreach (var level in equipSets)
|
{
|
foreach (var place in equipPlaces)
|
{
|
var position = new Int2(level, place);
|
var equipGuid = equipModel.GetEquip(position);
|
if (string.IsNullOrEmpty(equipGuid))
|
{
|
continue;
|
}
|
if (SatisfyEquipAdvance(position))
|
{
|
RefreshRedpoint(position, 2);
|
return;
|
}
|
}
|
}
|
|
//Int3 limit = redpointLimits[0];
|
//var isLast = false;
|
//for (int i = redpointLimits.Length - 1; i >= 0; i--)
|
//{
|
// if (PlayerDatas.Instance.baseData.LV >= redpointLimits[i].x)
|
// {
|
// limit = redpointLimits[i];
|
// if (i == redpointLimits.Length - 1)
|
// {
|
// isLast = true;
|
// }
|
// break;
|
// }
|
//}
|
|
//if (isLast)
|
//{
|
// if (DayRemind.Instance.GetDayRemind(DayRemind.EQUIPSTRENGTH_REDPOINT))
|
// {
|
// RefreshRedpoint(Int2.zero, 0);
|
// return;
|
// }
|
//}
|
|
//var money = UIHelper.GetMoneyCnt(3);
|
//if (money < (ulong)limit.y)
|
//{
|
// RefreshRedpoint(Int2.zero, 0);
|
// return;
|
//}
|
|
var satisfyPosition = Int2.zero;
|
var minStage = int.MaxValue;
|
foreach (var level in equipSets)
|
{
|
foreach (var place in equipPlaces)
|
{
|
var position = new Int2(level, place);
|
var equipGuid = equipModel.GetEquip(position);
|
if (string.IsNullOrEmpty(equipGuid))
|
{
|
continue;
|
}
|
|
var state = GetEquipStrengthState(position);
|
if (state != 0)
|
{
|
continue;
|
}
|
|
if (!HasEnoughMoney(position))
|
{
|
continue;
|
}
|
|
var serverPlace = EquipPlaceMapConfig.GetServerPlace(position.x, position.y);
|
var strengthLevel = 0;
|
if (EquipStrengthDic.ContainsKey(serverPlace))
|
{
|
strengthLevel = EquipStrengthDic[serverPlace].StrengthLevel;
|
}
|
var stage = strengthLevel / 10;// limit.z;
|
|
if (minStage > stage)
|
{
|
minStage = stage;
|
satisfyPosition = position;
|
}
|
}
|
}
|
|
RefreshRedpoint(satisfyPosition, 1);
|
}
|
|
void RefreshRedpoint(Int2 position, int type)
|
{
|
var equipSets = equipModel.GetAllEquipSets();
|
foreach (var level in equipSets)
|
{
|
foreach (var place in equipPlaces)
|
{
|
var packIndex = EquipPlaceMapConfig.GetServerPlace(level, place);
|
EquipStrengthRedpoint redpoint;
|
TryGetRedpoint(level, place, out redpoint);
|
|
redpoint.strengthRedpoint.state =
|
position.x == level && position.y == place && type == 1 ? RedPointState.Simple : RedPointState.None;
|
redpoint.advanceRedpoint.state =
|
position.x == level && position.y == place && type == 2 ? RedPointState.Simple : RedPointState.None;
|
if (level == 1 && place > 8)
|
{
|
redpoint.strengthRedpoint.state = RedPointState.None;
|
redpoint.advanceRedpoint.state = RedPointState.None;
|
}
|
}
|
}
|
}
|
|
|
public void RefreshMasterRedpoint()
|
{
|
foreach (var level in equipModel.GetUnLockedEquipSets())
|
{
|
//判断每套是否点亮
|
var curMasterLV = GetMasterLV(level);
|
var masterInfo = ItemPlusMasterConfig.TryGetNextMaster(level, curMasterLV);
|
|
if (masterInfo != null && (GetStrengthMinLV(level) >= masterInfo.MasterPlusLV))
|
{
|
m_EquipSetMasterRedpoints[level].state = RedPointState.Simple;
|
}
|
else
|
{
|
m_EquipSetMasterRedpoints[level].state = RedPointState.None;
|
}
|
}
|
}
|
|
public void ActiveMasterPack(HA3C2_tagMCMasterPlusLVInfo pack)
|
{
|
for (int i = 0; i < pack.Count; i++)
|
{
|
PlusMasterDict[pack.MasterPlusLVInfoList[i].ClassLV] = pack.MasterPlusLVInfoList[i].MasterPlusLV;
|
}
|
if (StrengthMasterFresh != null)
|
StrengthMasterFresh();
|
|
UpdateRedpoint();
|
}
|
|
public class EquipStrengthRedpoint
|
{
|
public readonly Redpoint redpoint;
|
public readonly Redpoint strengthRedpoint;
|
public readonly Redpoint advanceRedpoint;
|
|
public EquipStrengthRedpoint(int baseId)
|
{
|
redpoint = new Redpoint(baseId, EquipStrengthModel.REDPOINTBASE++);
|
strengthRedpoint = new Redpoint(redpoint.id, EquipStrengthModel.REDPOINTBASE++);
|
advanceRedpoint = new Redpoint(redpoint.id, EquipStrengthModel.REDPOINTBASE++);
|
}
|
}
|
}
|
|
|
|
}
|
|
|