using System;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using TableConfig;
|
using Snxxz.UI;
|
using System.Linq;
|
|
public class WashProValue
|
{
|
public int XLAttrValue; // 当前属性值
|
|
public int XLAttrChange; // 洗练操作属性值, 当大于0时代表当前部位有还未确认的洗练结果, 与当前属性值相减得出洗练正负
|
|
public int addAttrValue; //增加洗练属性值
|
|
public WashState washState;
|
}
|
|
public enum WashState
|
{
|
None, //未洗练
|
MustWash, //必增洗练
|
normalWash, //普通洗练
|
}
|
|
public class WashProCount
|
{
|
public int EquipPlace; // 装备位
|
|
public int XLAttrLV; // 洗练等级
|
|
public int XLAttrCnt; // 属性条数
|
|
public bool isPutOn = false;
|
|
public string placeName = "";
|
|
public WashProValue[] proValuelist = null; // 属性列表,索引0的代表属性1,依次递增
|
}
|
|
[XLua.LuaCallCSharp]
|
public class EquipWashModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk
|
{
|
|
public delegate void OnRefreshWashModel();
|
public event OnRefreshWashModel RefreshWashModelEvent;
|
|
public int[] washGroups1 { get; private set; }
|
public int[] washGroups2 { get; private set; }
|
public int[] washGroups3 { get; private set; }
|
|
private Dictionary<int, WashProCount> washEquipProDict = new Dictionary<int, WashProCount>();
|
private FuncConfigConfig funcModel;
|
private Dictionary<int, Dictionary<int, int>> _equipWashLimitDict = new Dictionary<int, Dictionary<int, int>>();
|
private List<WashProCount> orderWashProlist = new List<WashProCount>();
|
PlayerPackModel _playerPack;
|
PlayerPackModel playerPack
|
{
|
get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
}
|
|
private bool _isWashUI = true;
|
public bool isWashUI { get { return _isWashUI; } set { _isWashUI = value; } }
|
|
public bool isMustAddAttr { get; private set; }
|
|
private bool FirstLogin = true;
|
|
private void RefreshItemCount(PackType arg1, int arg2, int arg3)
|
{
|
switch (arg1)
|
{
|
case PackType.rptEquip:
|
GetWashModellist();
|
break;
|
case PackType.rptItem:
|
if (arg3 == 5303)
|
{
|
GetWashModellist();
|
}
|
break;
|
|
}
|
}
|
|
private void WashFuncOpen(int obj)
|
{
|
if (obj != 91)
|
return;
|
|
GetWashModellist();
|
}
|
|
public override void Init()
|
{
|
_equipWashLimitDict.Clear();
|
FuncConfigConfig washGroup1Model = Config.Instance.Get<FuncConfigConfig>("EquipWashGroup1");
|
FuncConfigConfig washGroup2Model = Config.Instance.Get<FuncConfigConfig>("EquipWashGroup2");
|
FuncConfigConfig washGroup3Model = Config.Instance.Get<FuncConfigConfig>("EquipWashGroup3");
|
washGroups1 = ConfigParse.GetMultipleStr<int>(washGroup1Model.Numerical1);
|
washGroups2 = ConfigParse.GetMultipleStr<int>(washGroup2Model.Numerical1);
|
washGroups3 = ConfigParse.GetMultipleStr<int>(washGroup3Model.Numerical1);
|
SetEquipWashMaxLV(washGroups1, washGroup1Model.Numerical2);
|
SetEquipWashMaxLV(washGroups2, washGroup2Model.Numerical2);
|
SetEquipWashMaxLV(washGroups3, washGroup3Model.Numerical2);
|
}
|
|
private void SetEquipWashMaxLV(int[] groups,string limit)
|
{
|
Dictionary<int,int> limitDict = ConfigParse.GetDic<int, int>(limit);
|
if (groups != null && limitDict != null)
|
{
|
for (int i = 0; i < groups.Length; i++)
|
{
|
if (!_equipWashLimitDict.ContainsKey(groups[i]))
|
{
|
_equipWashLimitDict.Add(groups[i], limitDict);
|
}
|
}
|
}
|
}
|
|
public override void UnInit()
|
{
|
FuncOpen.Instance.OnFuncStateChangeEvent -= WashFuncOpen;
|
playerPack.RefreshItemCountAct -= RefreshItemCount;
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
FirstLogin = true;
|
isMustAddAttr = false;
|
funcModel = null;
|
_isWashUI = true;
|
FuncOpen.Instance.OnFuncStateChangeEvent -= WashFuncOpen;
|
playerPack.RefreshItemCountAct -= RefreshItemCount;
|
InitWashModel();
|
}
|
|
public void OnAfterPlayerDataInitialize()
|
{
|
|
FuncOpen.Instance.OnFuncStateChangeEvent += WashFuncOpen;
|
playerPack.RefreshItemCountAct += RefreshItemCount;
|
SetWashEquipRedPointlist();
|
GetWashModellist();
|
}
|
|
public void OnPlayerLoginOk()
|
{
|
isMustAddAttr = true;
|
FirstLogin = false;
|
PlayerPrefs.DeleteKey(MasterGroup1ActiveKey);
|
PlayerPrefs.DeleteKey(MasterGroup2ActiveKey);
|
PlayerPrefs.DeleteKey(MasterGroup3ActiveKey);
|
PlayerPrefs.DeleteKey(MasterGroup1RaiseKey);
|
PlayerPrefs.DeleteKey(MasterGroup2RaiseKey);
|
PlayerPrefs.DeleteKey(MasterGroup3RaiseKey);
|
CheckIsMasterLv();
|
}
|
|
public int[] washPlacelist { get; private set; }
|
public List<WashProCount> washProlist { get; private set; }
|
private void InitWashModel()
|
{
|
FuncConfigConfig washDisPlayer = Config.Instance.Get<FuncConfigConfig>("StrengthenDisplay");
|
washPlacelist = ConfigParse.GetMultipleStr<int>(washDisPlayer.Numerical1);
|
washEquipProDict.Clear();
|
if (washPlacelist != null)
|
{
|
for (int i = 0; i < washPlacelist.Length; i++)
|
{
|
WashProCount proCount = new WashProCount();
|
proCount.EquipPlace = washPlacelist[i];
|
proCount.isPutOn = false;
|
proCount.XLAttrCnt = 3;
|
proCount.XLAttrLV = 1;
|
proCount.proValuelist = new WashProValue[proCount.XLAttrCnt];
|
if (proCount.XLAttrCnt > 0)
|
{
|
for (int j = 0; j < proCount.XLAttrCnt; j++)
|
{
|
proCount.proValuelist[j] = new WashProValue();
|
proCount.proValuelist[j].XLAttrValue = 0;
|
proCount.proValuelist[j].XLAttrChange = 0;
|
proCount.proValuelist[j].addAttrValue = 0;
|
proCount.proValuelist[j].washState = WashState.None;
|
}
|
}
|
washEquipProDict.Add(washPlacelist[i], proCount);
|
}
|
}
|
washProlist = washEquipProDict.Values.ToList();
|
|
}
|
|
public void ReFreshModel(HA3BB_tagMCEquipPartXLAttrInfo info)
|
{
|
for (int i = 0; i < info.Count; i++)
|
{
|
if (washEquipProDict.ContainsKey(info.InfoList[i].EquipPlace))
|
{
|
WashProCount proCount = washEquipProDict[info.InfoList[i].EquipPlace];
|
proCount.EquipPlace = info.InfoList[i].EquipPlace;
|
proCount.XLAttrLV = info.InfoList[i].XLAttrLV;
|
proCount.XLAttrCnt = info.InfoList[i].XLAttrCnt;
|
proCount.isPutOn = false;
|
if (proCount.XLAttrCnt > 0)
|
{
|
for (int j = 0; j < proCount.XLAttrCnt; j++)
|
{
|
proCount.proValuelist[j].XLAttrChange = (int)info.InfoList[i].XLAttrList[j].XLAttrChange;
|
|
if (proCount.proValuelist[j].XLAttrChange <= 0)
|
{
|
proCount.proValuelist[j].addAttrValue = (int)info.InfoList[i].XLAttrList[j].XLAttrValue - proCount.proValuelist[j].XLAttrValue;
|
|
switch (proCount.proValuelist[j].washState)
|
{
|
case WashState.None:
|
if (isMustAddAttr)
|
{
|
if (proCount.proValuelist[j].addAttrValue > 0)
|
{
|
proCount.proValuelist[j].washState = WashState.MustWash;
|
}
|
}
|
break;
|
case WashState.MustWash:
|
proCount.proValuelist[j].washState = WashState.None;
|
break;
|
case WashState.normalWash:
|
proCount.proValuelist[j].washState = WashState.None;
|
break;
|
}
|
|
}
|
else
|
{
|
proCount.proValuelist[j].washState = WashState.normalWash;
|
proCount.proValuelist[j].addAttrValue = 0;
|
}
|
proCount.proValuelist[j].XLAttrValue = (int)info.InfoList[i].XLAttrList[j].XLAttrValue;
|
|
}
|
}
|
}
|
}
|
if (RefreshWashModelEvent != null)
|
RefreshWashModelEvent();
|
|
if (!FirstLogin)
|
{
|
CheckIsMasterLv();
|
}
|
GetWashModellist();
|
}
|
|
//设置洗练数据的排列顺序
|
public void SetModelOrder()
|
{
|
orderWashProlist.Clear();
|
orderWashProlist.AddRange(washProlist);
|
|
SinglePackModel rptEquipPack = playerPack.GetSinglePackModel(PackType.rptEquip);
|
Dictionary<int, ItemModel> itemPlaceDict = null;
|
if (rptEquipPack != null)
|
{
|
itemPlaceDict = rptEquipPack.GetPackModelIndexDict();
|
}
|
|
int i = 0;
|
for (i = 0; i < washPlacelist.Length; i++)
|
{
|
if (washEquipProDict.ContainsKey(washPlacelist[i]))
|
{
|
if (itemPlaceDict != null)
|
{
|
if (itemPlaceDict.ContainsKey(washPlacelist[i]))
|
{
|
washEquipProDict[washPlacelist[i]].isPutOn = true;
|
}
|
else
|
{
|
washEquipProDict[washPlacelist[i]].isPutOn = false;
|
}
|
}
|
}
|
}
|
|
orderWashProlist.Sort(CompareByIsPutOn);
|
}
|
|
public int CompareByIsPutOn(WashProCount start, WashProCount end)
|
{
|
bool startIsput = start.isPutOn;
|
bool endIsPut = end.isPutOn;
|
if (startIsput.CompareTo(endIsPut) != 0) return -startIsput.CompareTo(endIsPut);
|
|
int startIndex = washProlist.IndexOf(start);
|
int endIndex = washProlist.IndexOf(end);
|
|
if (startIndex.CompareTo(endIndex) != 0) return startIndex.CompareTo(endIndex);
|
|
return 0;
|
}
|
|
public List<WashProCount> GetWashModellist()
|
{
|
SetModelOrder();
|
ReachWashCondition();
|
return orderWashProlist;
|
}
|
|
public Dictionary<int, WashProCount> GetWashInfoDict()
|
{
|
return washEquipProDict;
|
}
|
|
public WashProCount GetWashEquipInfo(int equipPlace)
|
{
|
if (washEquipProDict.ContainsKey(equipPlace))
|
return washEquipProDict[equipPlace];
|
else
|
return null;
|
}
|
|
//得到洗练群组类型
|
public int OnGetWashType(int itemPlace)
|
{
|
int i = 0;
|
for (i = 0; i < washGroups1.Length; i++)
|
{
|
if (washGroups1[i] == itemPlace)
|
return 1;
|
}
|
|
for (i = 0; i < washGroups2.Length; i++)
|
{
|
if (washGroups2[i] == itemPlace)
|
return 2;
|
}
|
|
for (i = 0; i < washGroups3.Length; i++)
|
{
|
if (washGroups3[i] == itemPlace)
|
return 3;
|
}
|
return 0;
|
}
|
public List<WashProCount> washGroup1 = null;
|
public List<WashProCount> washGroup2 = null;
|
public List<WashProCount> washGroup3 = null;
|
|
//得到大师洗练的数据
|
public void OnGetMasterModel(List<WashProCount> washInfolist)
|
{
|
washGroup1 = new List<WashProCount>();
|
washGroup2 = new List<WashProCount>();
|
washGroup3 = new List<WashProCount>();
|
int i = 0;
|
for (i = 0; i < washInfolist.Count; i++)
|
{
|
if (OnGetWashType(washInfolist[i].EquipPlace) == 1)
|
washGroup1.Add(washInfolist[i]);
|
else if (OnGetWashType(washInfolist[i].EquipPlace) == 2)
|
washGroup2.Add(washInfolist[i]);
|
else if (OnGetWashType(washInfolist[i].EquipPlace) == 3)
|
washGroup3.Add(washInfolist[i]);
|
}
|
if (washGroup1.Count > 1)
|
washGroup1.Sort(Compare);
|
if (washGroup2.Count > 1)
|
washGroup2.Sort(Compare);
|
if (washGroup3.Count > 1)
|
washGroup3.Sort(Compare);
|
|
}
|
|
public int Compare(WashProCount start, WashProCount next)
|
{
|
int startLevel = start.XLAttrLV;
|
int nextLevel = next.XLAttrLV;
|
if (startLevel.CompareTo(nextLevel) != 0) return startLevel.CompareTo(nextLevel);
|
return 0;
|
}
|
|
|
//得到当前装备的洗练数值
|
public int[] WashProValues(int itemPlace)
|
{
|
if (washEquipProDict.ContainsKey(itemPlace))
|
{
|
int[] values = new int[washEquipProDict[itemPlace].proValuelist.Length];
|
int i = 0;
|
for (i = 0; i < washEquipProDict[itemPlace].proValuelist.Length; i++)
|
{
|
values[i] = (int)washEquipProDict[itemPlace].proValuelist[i].XLAttrValue;
|
}
|
return values;
|
}
|
else
|
{
|
return null;
|
}
|
|
}
|
|
/// <summary>
|
/// 得打装备等级对应的最大洗练等级
|
/// </summary>
|
/// <param name="equipLv"></param>
|
/// <returns></returns>
|
public int GetWashFullLv(int equipPlace,int equipLv)
|
{
|
if (_equipWashLimitDict.ContainsKey(equipPlace))
|
{
|
if(_equipWashLimitDict[equipPlace].ContainsKey(equipLv))
|
{
|
return _equipWashLimitDict[equipPlace][equipLv];
|
}
|
}
|
return 0;
|
}
|
|
public int GetEquipWashMinLv(int equipPlace)
|
{
|
if (_equipWashLimitDict.ContainsKey(equipPlace))
|
{
|
List<int> lvlist = _equipWashLimitDict[equipPlace].Keys.ToList();
|
if (lvlist != null && lvlist.Count > 0)
|
{
|
return lvlist[0];
|
}
|
}
|
return 0;
|
}
|
|
|
/// <summary>
|
/// 判断当前装备是否洗练满阶
|
/// </summary>
|
/// <returns></returns>
|
private ItemConfig chinItemModel;
|
public bool IsWashFull(ItemModel model, WashProCount washPro, EquipWashConfig tagEquipWash)
|
{
|
if (model == null)
|
return false;
|
|
chinItemModel = Config.Instance.Get<ItemConfig>((int)model.itemInfo.ItemID);
|
int fullLv = GetWashFullLv(chinItemModel.EquipPlace,chinItemModel.LV);
|
if (washPro.XLAttrLV == fullLv)
|
{
|
if (washPro.proValuelist[0].XLAttrValue < tagEquipWash.attMax1)
|
{
|
return false;
|
}
|
|
if (washPro.proValuelist[1].XLAttrValue < tagEquipWash.attMax2)
|
{
|
return false;
|
}
|
|
if (washPro.proValuelist[2].XLAttrValue < tagEquipWash.attMax3)
|
{
|
return false;
|
}
|
return true;
|
}
|
else if (washPro.XLAttrLV > fullLv)
|
{
|
return true;
|
}
|
else
|
return false;
|
|
}
|
|
public bool IsCanWash(ItemModel model)
|
{
|
if (model == null)
|
return false;
|
|
chinItemModel = Config.Instance.Get<ItemConfig>((int)model.itemInfo.ItemID);
|
if(chinItemModel.LV >= GetEquipWashMinLv(chinItemModel.EquipPlace))
|
{
|
return true;
|
}
|
return false;
|
}
|
|
/// <summary>
|
/// 得到装备位最大洗练等级
|
/// </summary>
|
/// <returns></returns>
|
public int GetMaxWashLv(int equipPlace)
|
{
|
if (_equipWashLimitDict.ContainsKey(equipPlace))
|
{
|
List<int> washLvlist = _equipWashLimitDict[equipPlace].Values.ToList();
|
if (washLvlist != null && washLvlist.Count > 0)
|
{
|
return washLvlist[washLvlist.Count - 1];
|
}
|
}
|
return 0;
|
}
|
|
public string GetCurWashLvStr(WashProCount washPro, EquipWashConfig tagEquipWash)
|
{
|
int maxWashLv = GetMaxWashLv(washPro.EquipPlace);
|
|
if (washPro.XLAttrLV < maxWashLv)
|
{
|
return Language.Get("EquipWash108", washPro.XLAttrLV);
|
}
|
else
|
{
|
if (washPro.proValuelist[0].XLAttrValue < tagEquipWash.attMax1)
|
{
|
return Language.Get("EquipWash109");
|
}
|
|
if (washPro.proValuelist[1].XLAttrValue < tagEquipWash.attMax2)
|
{
|
return Language.Get("EquipWash109");
|
}
|
|
if (washPro.proValuelist[2].XLAttrValue < tagEquipWash.attMax3)
|
{
|
return Language.Get("EquipWash109");
|
}
|
return Language.Get("EquipWash110");
|
}
|
|
}
|
|
/// <summary>
|
/// 判断当前洗练装备是否保存洗练数值
|
/// </summary>
|
/// <param name="washPro"></param>
|
/// <returns></returns>
|
public bool IsSaveWashValue(WashProCount washPro)
|
{
|
int i = 0;
|
for (i = 0; i < washPro.proValuelist.Length; i++)
|
{
|
if (washPro.proValuelist[i].XLAttrChange != 0)
|
{
|
return false;
|
}
|
}
|
return true;
|
}
|
|
public bool IsEnoughMat(EquipWashConfig tagWashModel)
|
{
|
if (playerPack.GetItemCountByID(PackType.rptItem, tagWashModel.costItem) >= tagWashModel.costCount)
|
return true;
|
else
|
return false;
|
}
|
|
public void SendWashQuest(int equipPlace, int code)
|
{
|
CA325_tagCMEquipXLAttrChange equipWash = new CA325_tagCMEquipXLAttrChange();
|
equipWash.EquipPlace = (byte)equipPlace;
|
equipWash.CheckUseGoldAttr = (byte)code;
|
GameNetSystem.Instance.SendInfo(equipWash);
|
}
|
|
#region 红点逻辑处理
|
public List<Redpoint> washEquipRedPointlist { get; private set; }
|
public const int WashBtnRed_Key = 1060501;
|
public Redpoint washBtnRedpoint = new Redpoint(WashBtnRed_Key);
|
public void SetWashEquipRedPointlist()
|
{
|
washEquipRedPointlist = new List<Redpoint>();
|
int i = 0;
|
for (i = 0; i < 10; i++)
|
{
|
int id = MainRedDot.RedPoint_WashFuncKey * 1000 + i;
|
Redpoint washRedPoint = new Redpoint(MainRedDot.RedPoint_WashFuncKey, id);
|
washEquipRedPointlist.Add(washRedPoint);
|
}
|
}
|
|
Dictionary<int, WashProCount> RedpointWashDict = new Dictionary<int, WashProCount>();
|
|
public int JumpToIndex { get; set;}
|
public void ReachWashCondition()
|
{
|
RedpointWashDict.Clear();
|
JumpToIndex = 0;
|
int i = 0;
|
for(i = 0; i < orderWashProlist.Count; i++)
|
{
|
washEquipRedPointlist[i].state = RedPointState.None;
|
}
|
for (i = 0; i < orderWashProlist.Count; i++)
|
{
|
ItemModel model = playerPack.GetItemModelByIndex(PackType.rptEquip, orderWashProlist[i].EquipPlace);
|
EquipWashConfig washModel = EquipWashConfig.GetCurrentWashEquipModel(OnGetWashType(orderWashProlist[i].EquipPlace), orderWashProlist[i].XLAttrLV);
|
if (model != null && washModel != null)
|
{
|
if (IsCanWash(model) && IsEnoughMat(washModel) && !IsWashFull(model, orderWashProlist[i], washModel)
|
&& FuncOpen.Instance.IsFuncOpen(91))
|
{
|
RedpointWashDict.Add(i, orderWashProlist[i]);
|
}
|
}
|
}
|
|
List<WashProCount> redpointlist = RedpointWashDict.Values.ToList();
|
redpointlist.Sort(CompareByLv);
|
foreach(var key in RedpointWashDict.Keys)
|
{
|
if(RedpointWashDict[key].EquipPlace == redpointlist[0].EquipPlace)
|
{
|
washEquipRedPointlist[key].state = RedPointState.Simple;
|
JumpToIndex = key;
|
return;
|
}
|
}
|
}
|
|
public int CompareByLv(WashProCount start,WashProCount end)
|
{
|
int startLv = start.XLAttrLV;
|
int endLv = end.XLAttrLV;
|
if (startLv.CompareTo(endLv) != 0) return startLv.CompareTo(endLv);
|
|
int startIndex = orderWashProlist.IndexOf(start);
|
int endIndex = orderWashProlist.IndexOf(end);
|
if (startIndex.CompareTo(endIndex) != 0) return startIndex.CompareTo(endIndex);
|
|
return 0;
|
}
|
|
#endregion
|
|
public string GetProValueTypeStr(PlayerPropertyConfig playerproModel, int value)
|
{
|
string s = "";
|
if (playerproModel.ISPercentage == 0)
|
{
|
s = value.ToString();
|
}
|
else if (playerproModel.ISPercentage == 1)
|
{
|
s = (float)Math.Round(value / 100f, 1) + "%";
|
}
|
else if (playerproModel.ISPercentage == 2)
|
{
|
s = ((float)Math.Round(value / 100f, 1)).ToString();
|
}
|
return s;
|
}
|
|
#region 大师洗练数据
|
public int washType { get; private set; }
|
public int washLv { get; private set; }
|
public void SetWashMasterModel(int type, int groupLv)
|
{
|
washType = type;
|
washLv = groupLv;
|
}
|
|
public readonly string MasterGroup1ActiveKey = "MasterGroup1Active";
|
public readonly string MasterGroup2ActiveKey = "MasterGroup2Active";
|
public readonly string MasterGroup3ActiveKey = "MasterGroup3Active";
|
public readonly string MasterGroup1RaiseKey = "MasterGroup1Raise";
|
public readonly string MasterGroup2RaiseKey = "MasterGroup2Raise";
|
public readonly string MasterGroup3RaiseKey = "MasterGroup3Raise";
|
|
public int MasterWashState { get; private set; } //1 激活 2 升级
|
|
private void CheckIsMasterLv()
|
{
|
List<WashProCount> washAttrlist = washEquipProDict.Values.ToList();
|
OnGetMasterModel(washAttrlist);
|
for (int i = 1; i < 4; i++)
|
{
|
int curTypeLv = 0;
|
switch (i)
|
{
|
case 1:
|
curTypeLv = washGroup1[0].XLAttrLV;
|
SetMasterGroupActiveRecord(curTypeLv,1,MasterGroup1ActiveKey);
|
SetMasterGroupRaiseRecord(curTypeLv, 1, MasterGroup1RaiseKey);
|
break;
|
case 2:
|
curTypeLv = washGroup2[0].XLAttrLV;
|
SetMasterGroupActiveRecord(curTypeLv,2, MasterGroup2ActiveKey);
|
SetMasterGroupRaiseRecord(curTypeLv, 2, MasterGroup2RaiseKey);
|
break;
|
case 3:
|
curTypeLv = washGroup3[0].XLAttrLV;
|
SetMasterGroupActiveRecord(curTypeLv, 3, MasterGroup3ActiveKey);
|
SetMasterGroupRaiseRecord(curTypeLv, 3, MasterGroup3RaiseKey);
|
break;
|
}
|
}
|
}
|
|
public void SetMasterGroupRaiseRecord(int curGroupLv, int type, string groupRaise)
|
{
|
List<EquipWashSpecConfig> tagSpecModellist = EquipWashSpecConfig.GetWashSpecModel(type);
|
for(int i = 0; i < tagSpecModellist.Count; i++)
|
{
|
if(curGroupLv < tagSpecModellist[i].levelNeed)
|
{
|
if(i == 0)
|
{
|
LocalSave.SetInt(groupRaise, tagSpecModellist[i].levelNeed);
|
}
|
else
|
{
|
if (!PlayerPrefs.HasKey(groupRaise))
|
{
|
LocalSave.SetInt(groupRaise, tagSpecModellist[i-1].levelNeed);
|
}
|
else
|
{
|
int groupLv = LocalSave.GetInt(groupRaise);
|
if (tagSpecModellist[i - 1].levelNeed > groupLv)
|
{
|
MasterWashState = 2;
|
SetWashMasterModel(type, curGroupLv);
|
WindowCenter.Instance.Open<WashMasterActiveWin>();
|
LocalSave.SetInt(groupRaise, tagSpecModellist[i - 1].levelNeed);
|
}
|
}
|
}
|
return;
|
}
|
else if(curGroupLv >= tagSpecModellist[tagSpecModellist.Count -1].levelNeed)
|
{
|
if (!PlayerPrefs.HasKey(groupRaise))
|
{
|
LocalSave.SetInt(groupRaise, tagSpecModellist[tagSpecModellist.Count - 1].levelNeed);
|
}
|
else
|
{
|
int groupLv = LocalSave.GetInt(groupRaise);
|
if (tagSpecModellist[tagSpecModellist.Count - 1].levelNeed > groupLv)
|
{
|
MasterWashState = 2;
|
SetWashMasterModel(type, curGroupLv);
|
WindowCenter.Instance.Open<WashMasterActiveWin>();
|
LocalSave.SetInt(groupRaise, tagSpecModellist[tagSpecModellist.Count - 1].levelNeed);
|
}
|
}
|
return;
|
}
|
}
|
}
|
|
public void SetMasterGroupActiveRecord(int curGroupLv,int type,string groupActive)
|
{
|
List<EquipWashSpecConfig> tagSpecModellist = EquipWashSpecConfig.GetWashSpecModel(type);
|
if (curGroupLv >= tagSpecModellist[0].levelNeed)
|
{
|
if (!PlayerPrefs.HasKey(groupActive))
|
{
|
LocalSave.SetBool(groupActive, true);
|
}
|
else
|
{
|
bool isActive = LocalSave.GetBool(groupActive);
|
if (!isActive)
|
{
|
MasterWashState = 1;
|
SetWashMasterModel(type, curGroupLv);
|
WindowCenter.Instance.Open<WashMasterActiveWin>();
|
}
|
LocalSave.SetBool(groupActive, true);
|
}
|
}
|
else
|
{
|
LocalSave.SetBool(groupActive, false);
|
}
|
}
|
#endregion
|
|
}
|