//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, March 11, 2019
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class EquipStrengthWin : Window
|
{
|
[SerializeField] ScrollerController m_Controller;
|
[SerializeField] RectTransform m_LevelsContainer;
|
|
[SerializeField] Transform m_ContainerStrength;
|
[SerializeField] Transform m_ContainerEmpty;
|
|
[SerializeField] GameObject m_NotEquipped;//未装备
|
[SerializeField] EquipStrengthFull m_EquipStrengthFull;//满级
|
[SerializeField] EquipStrengthUpper m_EquipStrengthUpper;// 进化
|
[SerializeField] EquipStrengthRein m_EquipStrengthRein;//可强化
|
[SerializeField] EquipEvolution m_EquipEvolution;//进阶
|
[SerializeField] GameObject m_BottomFrame;
|
[SerializeField] Button m_StrengBtn;
|
[SerializeField] TextEx m_StrengText;
|
[SerializeField] Button m_AutomaticBtn;
|
[SerializeField] Button m_StopBtn;
|
[SerializeField] Button m_EvolutionBtn;
|
|
[SerializeField] RedpointBehaviour m_AdvanceRedpoint;
|
[SerializeField] RedpointBehaviour m_StrengthRedpoint;
|
|
[SerializeField] UIEffect m_UIEffect1A;
|
[SerializeField] UIEffect m_UIEffect1B;
|
[SerializeField] UIEffect m_UIEffect1C;
|
|
[SerializeField] UIEffect m_UIEffectTP; //突破按钮特效
|
[SerializeField] UIEffect m_UIEffectTP1; //突破飘到强化大师
|
[SerializeField] UIEffect m_UIEffectClose; //强化大师界面关闭后的特效
|
|
[SerializeField] EquipStrengthMaster strengthMaster;
|
|
EquipStrengthModel model { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
|
EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
|
PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
|
PlayerMainDate mainModel { get { return ModelCenter.Instance.GetModel<PlayerMainDate>(); } }
|
|
float customDelayTime = 0f;
|
float customPowerUpDelay = 0.5f;
|
|
bool m_IsAutomaticBool = false;
|
private bool IsAutomaticBool
|
{
|
get { return m_IsAutomaticBool; }
|
set
|
{
|
if (m_IsAutomaticBool != value)
|
{
|
m_IsAutomaticBool = value;
|
if (value)
|
{
|
recordFightPower = PlayerDatas.Instance.baseData.FightPoint;
|
}
|
else
|
{
|
customDelayTime = Time.time;
|
var power = recordFightPower;
|
Clock.AlarmAfter(customPowerUpDelay, () =>
|
{
|
if (PlayerDatas.Instance.baseData.FightPoint > power)
|
{
|
var powerUp = PlayerDatas.Instance.baseData.FightPoint - power;
|
if (powerUp > 0)
|
{
|
mainModel.CustomPowerUp(powerUp);
|
}
|
}
|
});
|
recordFightPower = 0;
|
}
|
}
|
}
|
}
|
|
public float WaitTime = 0.25f;
|
private float Times = 0f;
|
|
ulong recordFightPower = 0;
|
|
bool selectRedpointable = false;
|
|
List<int> m_Sorts = new List<int>();
|
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
m_Controller.OnRefreshCell += OnRefreshCell;
|
m_StrengBtn.AddListener(OnClickStrengBtn);
|
m_EvolutionBtn.AddListener(OnClickEvolutionBtn);
|
m_AutomaticBtn.AddListener(OnClickAutomaticBtn);
|
m_StopBtn.AddListener(OnClickStopBtn);
|
|
}
|
|
|
protected override void OnPreOpen()
|
{
|
model.IsChangeBool = true;
|
m_IsAutomaticBool = false;
|
Times = 0f;
|
m_StopBtn.SetActive(false);
|
m_AutomaticBtn.SetActive(true);
|
|
var selectEquip = OpenSelect();//默认选择
|
DisplayEquips();
|
SetStrengthenedState();
|
model.SelectEquipRefresh += SelectEquipRefresh;
|
model.SelectLevelRefresh += SelectLevelRefresh;
|
model.EquipStrengthUpdate += EquipStrengthUpdate;
|
model.EquipStrengthLvUpdate += EquipStrengthLvUpdate;
|
model.StrengthMasterFresh += StrengthMasterFresh;
|
PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent;
|
mainModel.customDisplayPower += CustomDisplayPower;
|
WindowCenter.Instance.windowAfterCloseEvent += OnWindowClose;
|
|
m_Controller.JumpIndex(GetJumpIndex(model.SelectLevel, model.SelectEquipPlace));
|
|
}
|
|
private void OnWindowClose(Window win)
|
{
|
if (win is EquipEvolutionWin)
|
{
|
m_UIEffectClose.Play();
|
}
|
}
|
|
private void StrengthMasterFresh()
|
{
|
strengthMaster.Show(model.SelectLevel);
|
}
|
|
protected override void OnAfterOpen()
|
{
|
RedpointCenter.Instance.redpointValueChangeEvent += RedpointValueChangeEvent;
|
}
|
|
protected override void OnPreClose()
|
{
|
model.SelectEquipRefresh -= SelectEquipRefresh;
|
model.SelectLevelRefresh -= SelectLevelRefresh;
|
model.EquipStrengthUpdate -= EquipStrengthUpdate;
|
model.EquipStrengthLvUpdate -= EquipStrengthLvUpdate;
|
model.StrengthMasterFresh -= StrengthMasterFresh;
|
PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent;
|
RedpointCenter.Instance.redpointValueChangeEvent -= RedpointValueChangeEvent;
|
mainModel.customDisplayPower -= CustomDisplayPower;
|
WindowCenter.Instance.windowAfterCloseEvent -= OnWindowClose;
|
model.SetDayRemind();
|
|
IsAutomaticBool = false;
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
protected override void LateUpdate()
|
{
|
if (IsAutomaticBool)
|
{
|
Times += Time.deltaTime;
|
var isBool = StrengtheBool();
|
var upperLimitBool = UpperLimitBool();
|
var isMasterUP = IsForMasterUp(); //突破后强化升级
|
if (Times >= WaitTime && isBool && upperLimitBool)
|
{
|
Times = 0;
|
int itemIndex = EquipPlaceMapConfig.GetServerPlace(model.SelectLevel, model.SelectEquipPlace);
|
model.SendEquip(itemIndex);
|
}
|
else if (!isBool || !upperLimitBool || isMasterUP)
|
{
|
IsAutomaticBool = false;
|
OnClickStopBtn();
|
if (isMasterUP)
|
m_AutomaticBtn.SetActive(false);
|
}
|
}
|
else
|
{
|
Times = 0f;
|
}
|
}
|
#endregion
|
|
private bool CustomDisplayPower()
|
{
|
return IsAutomaticBool || (Time.time - customDelayTime) < customPowerUpDelay;
|
}
|
|
int GetJumpIndex(int selectLevel, int selectPlace)
|
{
|
var jumpIndex = 0;
|
|
var equipSet = equipModel.GetEquipSet(selectLevel);
|
if (equipSet == null)
|
{
|
return jumpIndex;
|
}
|
|
foreach (var place in m_Sorts)
|
{
|
if (equipSet.IsSlotUnLocked(place))
|
{
|
if (selectPlace == place)
|
{
|
return Math.Max(jumpIndex - 2, 0);
|
}
|
jumpIndex++;
|
}
|
}
|
|
return 0;
|
}
|
|
private void OnClickEvolutionBtn()
|
{
|
var isBool = IsCarryOut();
|
if (isBool)
|
{
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(model.SelectLevel, model.SelectEquipPlace);
|
model.SendEquipPlusEvolve(equipIndex);
|
}
|
}
|
|
private bool IsCarryOut()
|
{
|
int equipLv = 0;
|
int advancedLv = 0;
|
int itemCount = 0;
|
int equipIndex = EquipPlaceMapConfig.GetServerPlace(model.SelectLevel, model.SelectEquipPlace);
|
if (model.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
|
{
|
equipLv = model.EquipStrengthDic[equipIndex].StrengthLevel;
|
advancedLv = model.EquipStrengthDic[equipIndex].EvolveLV;
|
}
|
var equipPlusEvolve = model.GetEquipPlusEvolve(model.SelectEquipPlace, advancedLv + 1);
|
if (equipPlusEvolve == null)
|
{
|
DebugEx.LogError("没有找到表数据");
|
return false;
|
}
|
itemCount = packModel.GetItemCountByID(PackType.Item, equipPlusEvolve.CostItemID);
|
if (equipPlusEvolve.NeedPlusLV > equipLv)
|
{
|
ServerTipDetails.DisplayNormalTip(Language.Get("ZBQH_07"));
|
return false;
|
}
|
if (equipPlusEvolve.CostItemCount > itemCount)
|
{
|
ServerTipDetails.DisplayNormalTip(Language.Get("ZBQH_08"));
|
return false;
|
}
|
return true;
|
}
|
|
|
private void OnClickStrengBtn()
|
{
|
if (StrengtheBool())
|
{
|
int itemIndex = EquipPlaceMapConfig.GetServerPlace(model.SelectLevel, model.SelectEquipPlace);
|
model.SendEquip(itemIndex);
|
|
var itemPlus = model.GetEquipConfig(model.SelectLevel, model.SelectEquipPlace);
|
if (itemPlus != null && itemPlus.costItemInfo.Length == 2)
|
{
|
m_UIEffectTP1.Play();
|
}
|
|
}
|
}
|
|
private void OnClickAutomaticBtn()
|
{
|
if (StrengtheBool())
|
{
|
IsAutomaticBool = true;
|
m_StopBtn.SetActive(true);
|
m_AutomaticBtn.SetActive(false);
|
}
|
|
}
|
private void OnClickStopBtn()
|
{
|
IsAutomaticBool = false;
|
m_StopBtn.SetActive(false);
|
m_AutomaticBtn.SetActive(true);
|
|
}
|
|
private void EquipStrengthLvUpdate(int upLV)
|
{
|
if (!m_UIEffect1B.IsPlaying)
|
{
|
m_UIEffect1B.Play();
|
}
|
|
// 刷新大师等级数据
|
var curMasterLV = model.GetMasterLV(model.SelectLevel);
|
var masterInfo = ItemPlusMasterConfig.TryGetNextMaster(model.SelectLevel, curMasterLV);
|
if (masterInfo == null) return;
|
|
if (upLV != masterInfo.MasterPlusLV) return;
|
strengthMaster.Show(model.SelectLevel);
|
|
if (model.GetStrengthMinLV(model.SelectLevel) >= masterInfo.MasterPlusLV)
|
WindowCenter.Instance.Open<EquipEvolutionWin>();
|
}
|
|
private void EquipStrengthUpdate()
|
{
|
if (!m_UIEffect1A.IsPlaying)
|
{
|
m_UIEffect1A.Play();
|
}
|
m_UIEffect1C.Play();
|
if (model.SelectLevel != -1)
|
{
|
SetStrengthenedState();
|
m_Controller.m_Scorller.RefreshActiveCellViews();
|
}
|
}
|
|
|
private void DisplayEquips()
|
{
|
var sets = equipModel.GetUnLockedEquipSetsByFuncID(-1);
|
var behaviourCount = sets.Count;
|
var behaviourGap = behaviourCount - model.EquipSetList.Count;
|
for (var i = 0; i < behaviourGap; i++)
|
{
|
var instance = UIUtility.CreateWidget("EquipSetSelect", "EquipSetSelect");
|
instance.transform.SetParentEx(m_LevelsContainer, Vector3.zero, Quaternion.identity, Vector3.one);
|
instance.transform.SetAsFirstSibling();
|
model.EquipSetList.Insert(0, instance.GetComponent<EquipSetSelect>());
|
}
|
|
m_Controller.Refresh();
|
|
for (var i = 0; i < model.EquipSetList.Count; i++)
|
{
|
var behaviour = model.EquipSetList[i];
|
if (i < behaviourCount)
|
{
|
behaviour.SetActive(true);
|
Redpoint redpoint;
|
model.TryGetRedpoint(sets[i], out redpoint);
|
behaviour.Display(sets[i], model.SelectLevel == sets[i], redpoint.id);
|
}
|
else
|
{
|
behaviour.SetActive(false);
|
}
|
if (model.SelectLevel == sets[i])
|
{
|
var equipSet = equipModel.GetEquipSet(sets[i]);
|
if (equipSet == null)
|
{
|
continue;
|
}
|
m_Sorts.Clear();
|
int equipCnt = model.SelectLevel < 2 ? 8 : 12;
|
for (int k = 1; k <= equipCnt; k++)
|
{
|
m_Sorts.Add(k);
|
}
|
m_Sorts.Sort(EquipCompare);
|
foreach (var place in m_Sorts)
|
{
|
if (equipSet.IsSlotUnLocked(place))
|
{
|
m_Controller.AddCell(ScrollerDataType.Header, sets[i] * 1000 + place);
|
}
|
}
|
}
|
}
|
|
m_Controller.Restart();
|
|
strengthMaster.Show(model.SelectLevel);
|
}
|
|
private int EquipCompare(int x, int y)
|
{
|
var x_state = 0;
|
var y_state = 0;
|
var equipGuidx = equipModel.GetEquip(new Int2(model.SelectLevel, x));
|
if (string.IsNullOrEmpty(equipGuidx))
|
{
|
x_state = 1;
|
}
|
|
var equipGuidy = equipModel.GetEquip(new Int2(model.SelectLevel, y));
|
if (string.IsNullOrEmpty(equipGuidy))
|
{
|
y_state = 1;
|
}
|
if (x_state != y_state)
|
{
|
return x_state.CompareTo(y_state);
|
}
|
return x.CompareTo(y);
|
}
|
|
private void SelectEquipRefresh()
|
{
|
m_Controller.m_Scorller.RefreshActiveCellViews();
|
model.IsChangeBool = true;
|
SetStrengthenedState();
|
if (IsAutomaticBool)
|
{
|
Times = 0f;
|
OnClickStopBtn();
|
IsAutomaticBool = false;
|
}
|
strengthMaster.SetActive(model.SelectEquipPlace <= 8);
|
}
|
|
private void SelectLevelRefresh()
|
{
|
model.IsChangeBool = true;
|
if (IsAutomaticBool)
|
{
|
Times = 0f;
|
OnClickStopBtn();
|
IsAutomaticBool = false;
|
}
|
DisplayEquips();
|
if (model.SelectLevel != -1)
|
{
|
SetDefaultSelectEquip();
|
m_Controller.JumpIndex(GetJumpIndex(model.SelectLevel, model.SelectEquipPlace));
|
}
|
SetStrengthenedState();
|
}
|
|
private void OnRefreshCell(ScrollerDataType type, CellView cell)
|
{
|
switch (type)
|
{
|
case ScrollerDataType.Header:
|
var level = cell.index / 1000;
|
var place = cell.index % 1000;
|
var equipSelectCell = cell as EquipStrengthSelectBehaviour;
|
equipSelectCell.Display(level, place);
|
break;
|
}
|
}
|
|
private void SetStrengthenedState()
|
{
|
if (model.SelectLevel == -1)
|
{
|
m_ContainerEmpty.SetActive(true);
|
m_ContainerStrength.SetActive(false);
|
return;
|
}
|
|
m_ContainerEmpty.SetActive(false);
|
m_ContainerStrength.SetActive(true);
|
|
EquipStrengthModel.EquipStrengthRedpoint redpoint;
|
if (model.TryGetRedpoint(model.SelectLevel, model.SelectEquipPlace, out redpoint))
|
{
|
m_AdvanceRedpoint.redpointId = redpoint.advanceRedpoint.id;
|
m_StrengthRedpoint.redpointId = redpoint.strengthRedpoint.id;
|
selectRedpointable = redpoint.strengthRedpoint.state == RedPointState.Simple;
|
}
|
|
var equipGuid = equipModel.GetEquip(new Int2(model.SelectLevel, model.SelectEquipPlace));
|
|
var state = model.GetEquipStrengthState(new Int2(model.SelectLevel, model.SelectEquipPlace));
|
|
m_NotEquipped.SetActive(state == 3);
|
|
m_EquipStrengthFull.SetActive(state == 2);
|
m_EquipStrengthUpper.SetActive(state == 1);
|
m_EquipStrengthRein.SetActive(state == 0);
|
m_EquipEvolution.SetActive(state == 0 || state == 2);
|
m_BottomFrame.SetActive(state == 0);
|
m_EvolutionBtn.SetActive(state == 1);
|
|
if (state == 0 || state == 2)
|
{
|
var advancedLv = 0;
|
var serverPlace = EquipPlaceMapConfig.GetServerPlace(model.SelectLevel, model.SelectEquipPlace);
|
if (model.EquipStrengthDic.ContainsKey(serverPlace))
|
{
|
advancedLv = model.EquipStrengthDic[serverPlace].EvolveLV;
|
}
|
if (advancedLv == 0)
|
m_EquipEvolution.SetActive(false);
|
else
|
m_EquipEvolution.SetEquipEvolution(model.SelectEquipPlace, advancedLv);
|
}
|
|
|
switch (state)
|
{
|
case 0:
|
m_EquipStrengthRein.SetEquipStrengthRein(equipGuid, model.SelectLevel, model.SelectEquipPlace);
|
break;
|
case 1:
|
m_EquipStrengthUpper.SetEquipStrengthUpper(equipGuid, model.SelectLevel, model.SelectEquipPlace);
|
break;
|
case 2:
|
m_EquipStrengthFull.SetEquipStrengthFull(equipGuid, model.SelectLevel, model.SelectEquipPlace);
|
break;
|
}
|
|
ShowStrengthButton();
|
}
|
|
|
private void ShowStrengthButton()
|
{
|
var itemPlus = model.GetEquipConfig(model.SelectLevel, model.SelectEquipPlace);
|
if (itemPlus == null)
|
{
|
return;
|
}
|
|
m_UIEffectTP.Stop();
|
if (itemPlus.costItemInfo.Length == 2 && model.SelectEquipPlace <= 8)
|
{
|
m_StrengText.text = Language.Get("Z2005");
|
m_AutomaticBtn.SetActive(false);
|
m_StopBtn.SetActive(false);
|
m_UIEffectTP.Play();
|
}
|
else
|
{
|
m_StrengText.text = Language.Get("EquipReinforceWin_btnText_1");
|
m_StopBtn.SetActive(IsAutomaticBool);
|
m_AutomaticBtn.SetActive(!IsAutomaticBool);
|
|
}
|
}
|
|
|
private bool OpenSelect()
|
{
|
model.SelectLevel = -1;
|
model.SelectEquipPlace = -1;
|
|
if (!model.jumpEquipPosition.Equals(Int2.zero))
|
{
|
model.SelectLevel = model.jumpEquipPosition.x;
|
model.SelectEquipPlace = model.jumpEquipPosition.y;
|
model.jumpEquipPosition = Int2.zero;
|
return true;
|
}
|
|
var equipSets = equipModel.GetAllEquipSets();
|
foreach (var equipSet in equipSets)
|
{
|
var places = model.equipPlaces;
|
foreach (var place in places)
|
{
|
EquipStrengthModel.EquipStrengthRedpoint redpoint;
|
if (model.TryGetRedpoint(equipSet, place, out redpoint)
|
&& redpoint.redpoint.state == RedPointState.Simple)
|
{
|
model.SelectLevel = equipSet;
|
model.SelectEquipPlace = place;
|
return true;
|
}
|
}
|
}
|
|
var minStrengthLevel = int.MaxValue;
|
var minSelect = Int2.zero;
|
foreach (var level in equipSets)
|
{
|
var equipSet = equipModel.GetEquipSet(level);
|
if (equipSet == null)
|
{
|
continue;
|
}
|
model.SelectLevel = level;
|
var places = model.equipPlaces;
|
places.Sort(EquipCompare);
|
foreach (var place in places)
|
{
|
if (minSelect.x == 0)
|
{
|
minSelect.x = level;
|
minSelect.y = place;
|
}
|
if (level == 1 && place >8)
|
{
|
continue;
|
}
|
var state = model.GetEquipStrengthState(new Int2(level, place));
|
if (state == 3)
|
{
|
continue;
|
}
|
var strengthLevel = model.GetStrengthLevel(level, place);
|
if (strengthLevel < minStrengthLevel && state == 0)
|
{
|
minStrengthLevel = strengthLevel;
|
minSelect.x = level;
|
minSelect.y = place;
|
}
|
}
|
}
|
model.SelectLevel = minSelect.x;
|
model.SelectEquipPlace = minSelect.y;
|
return minStrengthLevel != int.MaxValue;
|
}
|
|
//界面打开的情况下
|
private void SetDefaultSelectEquip()
|
{
|
var places = model.equipPlaces;
|
foreach (var place in places)
|
{
|
EquipStrengthModel.EquipStrengthRedpoint redpoint;
|
if (model.TryGetRedpoint(model.SelectLevel, place, out redpoint)
|
&& redpoint.redpoint.state == RedPointState.Simple)
|
{
|
model.SelectEquipPlace = place;
|
return;
|
}
|
}
|
|
var minStrengthLevel = int.MaxValue;
|
var minSelect = 0;
|
var equipSet = equipModel.GetEquipSet(model.SelectLevel);
|
if (equipSet == null)
|
{
|
return;
|
}
|
places.Sort(EquipCompare);
|
foreach (var place in places)
|
{
|
if (model.SelectLevel == 1 && place > 8)
|
{
|
continue;
|
}
|
var state = model.GetEquipStrengthState(new Int2(model.SelectLevel, place));
|
if (state == 3)
|
{
|
continue;
|
}
|
var strengthLevel = model.GetStrengthLevel(model.SelectLevel, place);
|
if (strengthLevel < minStrengthLevel && state == 0)
|
{
|
minStrengthLevel = strengthLevel;
|
minSelect = place;
|
}
|
}
|
model.SelectEquipPlace = minSelect;
|
}
|
|
private bool IsForMasterUp()
|
{
|
// 8件部位突破(也是强化)用物品,特殊4部位也用物品但不显示为突破
|
if (model.SelectEquipPlace > 8)
|
return false;
|
|
var itemPlus = model.GetEquipConfig(model.SelectLevel, model.SelectEquipPlace);
|
if (itemPlus == null)
|
{
|
return false;
|
}
|
|
if (itemPlus.costItemInfo.Length == 2)
|
{
|
return true;
|
}
|
|
return false;
|
}
|
|
|
private bool StrengtheBool()
|
{
|
|
if (m_EquipStrengthUpper.gameObject.activeSelf)
|
{
|
//int equipType = EquipStrengthModel.GetEquipStrengthType(model.SelectEquipPlace);
|
//var equipMaxLv = model.GetEquipLevelMax(equipType, model.SelectLevel);
|
//进阶后可继续强化提示
|
SysNotifyMgr.Instance.ShowTip("EquipStrengthLimitError_1");
|
return false;
|
}
|
|
var itemPlus = model.GetEquipConfig(model.SelectLevel, model.SelectEquipPlace);
|
if (itemPlus == null)
|
{
|
return false;
|
}
|
|
ulong money = UIHelper.GetMoneyCnt(3);
|
ulong needMoney = (ulong)itemPlus.costCount;
|
LimitedTimeLuxuryGiftModel.Instance.IsItemIdShow(51, 1, (int)needMoney, 2, 0);
|
|
if (money < needMoney)
|
{
|
ItemTipUtility.Show(2100);
|
return false;
|
}
|
|
|
if (itemPlus.costItemInfo.Length == 2)
|
{
|
var itemCount = packModel.GetItemCountByID(PackType.Item, itemPlus.costItemInfo[0]);
|
if (itemCount < itemPlus.costItemInfo[1])
|
{
|
ItemTipUtility.Show(itemPlus.costItemInfo[0]);
|
return false;
|
}
|
LimitedTimeLuxuryGiftModel.Instance.IsItemIdShow(1, itemPlus.costItemInfo[0], itemPlus.costItemInfo[1], 1, 0);
|
}
|
|
return true;
|
}
|
|
private bool UpperLimitBool()
|
{
|
bool isBool = false;
|
var equipPosition = new Int2(model.SelectLevel, model.SelectEquipPlace);
|
int equipIndex = EquipSet.ClientPlaceToServerPlace(equipPosition);
|
int star = equipStarModel.GetEquipStarLevel(equipPosition);
|
int equipLv = 0;
|
if (model.EquipStrengthDic.ContainsKey(equipIndex))//获取当前强化等级
|
{
|
equipLv = model.EquipStrengthDic[equipIndex].StrengthLevel;
|
}
|
int equipType = EquipStrengthModel.GetEquipStrengthType(model.SelectEquipPlace);
|
var itemPlusMaxConfig = ItemPlusMaxConfig.GetStrengthMaxLV(equipType, model.SelectLevel);//获取强化等级上限值
|
if (itemPlusMaxConfig.levelMax > equipLv)
|
{
|
isBool = true;
|
}
|
else
|
{
|
isBool = false;
|
}
|
|
return isBool;
|
}
|
|
private void PlayerDataRefreshEvent(PlayerDataType dataType)
|
{
|
if (dataType == PlayerDataType.Silver)
|
{
|
m_EquipStrengthRein.DisplayMoney();
|
|
}
|
}
|
|
private void RedpointValueChangeEvent(int id)
|
{
|
if (model.SelectLevel != -1)
|
{
|
EquipStrengthModel.EquipStrengthRedpoint redpoint;
|
if (model.TryGetRedpoint(model.SelectLevel, model.SelectEquipPlace, out redpoint))
|
{
|
if (selectRedpointable && redpoint.strengthRedpoint.state != RedPointState.Simple)
|
{
|
//if (IsAutomaticBool)
|
Int2 position;
|
if (OnRedpointSelect(out position))
|
{
|
if (model.SelectLevel != position.x)
|
{
|
return;
|
}
|
OnClickStopBtn();
|
|
model.SelectLevel = position.x;
|
model.SelectEquipPlace = position.y;
|
|
if (!m_Controller.IsDisplay(position.x * 1000 + position.y))
|
{
|
m_Controller.JumpIndex(GetJumpIndex(model.SelectLevel, model.SelectEquipPlace));
|
}
|
}
|
|
}
|
}
|
}
|
}
|
|
bool OnRedpointSelect(out Int2 position)
|
{
|
position = default(Int2);
|
var equipSets = equipModel.GetAllEquipSets();
|
foreach (var equipSet in equipSets)
|
{
|
var places = model.equipPlaces;
|
foreach (var place in places)
|
{
|
EquipStrengthModel.EquipStrengthRedpoint redpoint;
|
if (model.TryGetRedpoint(equipSet, place, out redpoint)
|
&& redpoint.strengthRedpoint.state == RedPointState.Simple)
|
{
|
position = new Int2()
|
{
|
x = equipSet,
|
y = place,
|
};
|
return true;
|
}
|
}
|
}
|
return false;
|
}
|
}
|
}
|
|
|
|
|