using System;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
using UnityEngine;
|
|
using System.Linq;
|
using Snxxz.UI;
|
using System.Collections;
|
|
public class WashTips : MonoBehaviour
|
{
|
#region 成员变量
|
[SerializeField] Text _costMoneyText;
|
[SerializeField] Text _washLevelTitle;
|
[SerializeField] Button _washBtn;
|
[SerializeField] Button _saveBtn;
|
[SerializeField] Button _cancelBtn;
|
[SerializeField] Button _upgradeBtn;
|
[SerializeField] Button _washMasterBtn;
|
[SerializeField] Text _specWashOpenCondition;
|
[SerializeField] Text _specWashFullText;
|
[SerializeField] GameObject _openSpecWashPro;
|
[SerializeField] ScrollRect _selectWashRect;
|
[SerializeField] ScrollerController _equipWashCtrl;
|
[SerializeField] Text _washFullLvText;
|
[SerializeField] ItemCell _costMatCell;
|
[SerializeField] ItemCell _washEquipCell;
|
[SerializeField] WashPro _attackWashPro; //攻击洗练属性
|
[SerializeField] WashPro _lifeWashPro; //生命
|
[SerializeField] WashPro _ignoreDefenceWashPro; //无视防御
|
[SerializeField] ToggleGroup _cellGroup;
|
[SerializeField] GameObject noEquipObj;
|
[SerializeField] GameObject contain_Cost;
|
[SerializeField] ItemCell contain_Cost_NormalItem;
|
[SerializeField] ItemCell contain_Cost_MustAddItem;
|
[SerializeField] Text contain_Cost_Money;
|
[SerializeField] GameObject contain_Default;
|
|
[SerializeField]
|
List<Text> specAttrNameText = new List<Text>();
|
[SerializeField]
|
List<Text> specAttrValueText = new List<Text>();
|
|
[SerializeField]
|
UIEffect washEffect;
|
[SerializeField]
|
UIEffect mustWashEffect;
|
|
[SerializeField] float offest = 50;
|
|
#endregion
|
|
private WashProCount _washProModel;
|
private EquipWashConfig.EquipWashData _tagWashModel;
|
private ItemModel _itemModel; //洗练的装备
|
private int[] _costMoneylist = null;
|
private List<WashProCount> _washInfolist;
|
EquipWashModel _equipWashModel;
|
EquipWashModel equipWashModel
|
{
|
get
|
{
|
return _equipWashModel ?? (_equipWashModel = ModelCenter.Instance.GetModel<EquipWashModel>());
|
}
|
}
|
|
WashProModel _washAttrModel;
|
WashProModel washAttrModel
|
{
|
get
|
{
|
return _washAttrModel ?? (_washAttrModel = ModelCenter.Instance.GetModel<WashProModel>());
|
}
|
}
|
|
HowToPlayModel _toPlayModel;
|
HowToPlayModel toPlayModel
|
{
|
get { return _toPlayModel ?? (_toPlayModel = ModelCenter.Instance.GetModel<HowToPlayModel>()); }
|
}
|
|
GetItemPathModel _itemPathModel;
|
GetItemPathModel itemPathModel
|
{
|
get { return _itemPathModel ?? (_itemPathModel = ModelCenter.Instance.GetModel<GetItemPathModel>()); }
|
}
|
|
ItemTipsModel _itemTipsModel;
|
ItemTipsModel itemTipsModel
|
{
|
get
|
{
|
return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
}
|
}
|
|
PlayerPackModel _playerPack;
|
PlayerPackModel playerPack
|
{
|
get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
}
|
|
public int jumpToWashId = 0;
|
AchievementGuideEffect guideEffect = null;
|
|
private void Awake()
|
{
|
_specWashOpenCondition.gameObject.SetActive(true);
|
_specWashFullText.gameObject.SetActive(false);
|
_equipWashCtrl.OnRefreshCell += RefreshEquipWashCell;
|
EquipReinforceEventMgr.Instance.RefreshWashCostMoneyEvent = UpdateMustWash;
|
_openSpecWashPro.SetActive(false);
|
|
}
|
|
private void OnEnable()
|
{
|
guideEffect = null;
|
//_equipWashCtrl.mScrollRect.verticalNormalizedPosition = 1;
|
#region 初始化监听和数据
|
if(equipWashModel.curWashEquip == 0)
|
{
|
_attackWashPro.toggleIsOn = false;
|
_lifeWashPro.toggleIsOn = false;
|
_ignoreDefenceWashPro.toggleIsOn = false;
|
isOpenPrompting = true;
|
jumpToWashId = 0;
|
}
|
_equipWashCtrl.lockType = EnhanceLockType.KeepVertical;
|
_cancelBtn.onClick.AddListener(OnClickCancelBtn);
|
_upgradeBtn.onClick.AddListener(OnClickUpGradeBtn);
|
_washMasterBtn.onClick.AddListener(OnClickMasterBtn);
|
equipWashModel.RefreshWashModelEvent += RefreshModel;
|
playerPack.RefreshItemCountAct += RefreshCostItem;
|
#endregion
|
CreateEquipWashCell();
|
CheckJumpToModel();
|
}
|
private void OnDisable()
|
{
|
_washBtn.onClick.RemoveAllListeners();
|
_saveBtn.onClick.RemoveAllListeners();
|
_cancelBtn.onClick.RemoveAllListeners();
|
_upgradeBtn.onClick.RemoveAllListeners();
|
_washMasterBtn.onClick.RemoveAllListeners();
|
equipWashModel.RefreshWashModelEvent -= RefreshModel;
|
playerPack.RefreshItemCountAct -= RefreshCostItem;
|
if(!WindowJumpMgr.Instance.IsJumpState)
|
{
|
equipWashModel.SetCurWashModel(0);
|
}
|
}
|
|
private void CheckJumpToModel()
|
{
|
_attackWashPro.isShowPerfectEffect = false;
|
_lifeWashPro.isShowPerfectEffect = false;
|
_ignoreDefenceWashPro.isShowPerfectEffect = false;
|
SuccessConfig successConfig = SuccessConfig.Get(AchievementGoto.guideAchievementId);
|
if (successConfig != null && successConfig.Type == 66)
|
{
|
bool isWash = false;
|
for (int i = 0; i < _washInfolist.Count; i++)
|
{
|
WashProCount washPro = _washInfolist[i];
|
ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.Equip, washPro.EquipPlace);
|
if (itemModel != null)
|
{
|
var washModel = EquipWashConfig.GetEquipWashData(equipWashModel.OnGetWashType(washPro.EquipPlace), washPro.XLAttrLV);
|
if (washModel != null
|
&& equipWashModel.IsEnoughMat(washModel.washConfig)
|
&& equipWashModel.IsCanWash(itemModel))
|
{
|
jumpToWashId = washPro.EquipPlace;
|
isWash = true;
|
equipWashModel.SetCurWashModel(i);
|
_equipWashCtrl.JumpIndex(equipWashModel.curWashEquip);
|
_equipWashCtrl.m_Scorller.RefreshActiveCellViews();
|
break;
|
}
|
}
|
}
|
|
if (!isWash)
|
{
|
ServerTipDetails.DisplayNormalTip(Language.Get("Material101"));
|
}
|
else
|
{
|
guideEffect = AchievementGuideEffectPool.Require(1);
|
guideEffect.transform.SetParentEx(_washBtn.transform, Vector3.zero, Quaternion.identity, Vector3.one);
|
}
|
AchievementGoto.guideAchievementId = 0;
|
}
|
else
|
{
|
if(equipWashModel.curWashEquip != 0)
|
{
|
_equipWashCtrl.JumpIndex(equipWashModel.curWashEquip);
|
_equipWashCtrl.m_Scorller.RefreshActiveCellViews();
|
}
|
else
|
{
|
equipWashModel.SetCurWashModel(equipWashModel.JumpToIndex);
|
_equipWashCtrl.JumpIndex(equipWashModel.curWashEquip);
|
_equipWashCtrl.m_Scorller.RefreshActiveCellViews();
|
}
|
}
|
|
OnClickWashCellToggle(_washInfolist[equipWashModel.curWashEquip], equipWashModel.curWashEquip);
|
StartCoroutine(SetOffestPos());
|
}
|
|
private IEnumerator SetOffestPos()
|
{
|
yield return null;
|
if (equipWashModel.curWashEquip != 0)
|
{
|
_equipWashCtrl.JumpIndex(-offest, 0, EnhancedUI.EnhancedScroller.EnhancedScroller.TweenType.immediate);
|
}
|
}
|
|
private void CreateEquipWashCell()
|
{
|
_washInfolist = equipWashModel.GetWashModellist();
|
int i = 0;
|
_equipWashCtrl.Refresh();
|
for (i = 0; i < _washInfolist.Count; i++)
|
{
|
_equipWashCtrl.AddCell(ScrollerDataType.Header, i);
|
}
|
_equipWashCtrl.Restart();
|
}
|
|
public void RefreshModel()
|
{
|
CreateEquipWashCell();
|
OnClickWashCellToggle(_washInfolist[equipWashModel.curWashEquip], equipWashModel.curWashEquip);
|
}
|
|
|
private void RefreshEquipWashCell(ScrollerDataType type, CellView cell)
|
{
|
EquipWashCell equipWashCell = cell.GetComponent<EquipWashCell>();
|
if(equipWashCell != null)
|
{
|
WashProCount washPro = _washInfolist[cell.index];
|
equipWashCell.SetDisplayModel(washPro, equipWashModel.washEquipRedPointlist[cell.index].id,cell.index, equipWashModel.curWashEquip);
|
equipWashCell.cellToggle.RemoveAllListeners();
|
equipWashCell.cellToggle.AddListener(()=>
|
{
|
OnClickWashCellToggle(washPro,cell.index);
|
});
|
}
|
}
|
|
|
private void OnClickWashCellToggle(WashProCount washPro,int index)
|
{
|
if (equipWashModel.curWashEquip != index)
|
{
|
_attackWashPro.isShowPerfectEffect = false;
|
_lifeWashPro.isShowPerfectEffect = false;
|
_ignoreDefenceWashPro.isShowPerfectEffect = false;
|
|
_attackWashPro.toggleIsOn = false;
|
_lifeWashPro.toggleIsOn = false;
|
_ignoreDefenceWashPro.toggleIsOn = false;
|
if (washPro.EquipPlace != jumpToWashId)
|
{
|
if (guideEffect != null)
|
{
|
AchievementGuideEffectPool.Recycle(guideEffect);
|
guideEffect = null;
|
}
|
}
|
}
|
ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.Equip, washPro.EquipPlace);
|
var washModel = EquipWashConfig.GetEquipWashData(equipWashModel.OnGetWashType(washPro.EquipPlace), washPro.XLAttrLV);
|
_washProModel = washPro;
|
_tagWashModel = washModel;
|
_costMoneylist = _tagWashModel.mustCosts;
|
washAttrModel.SetUIModel(washModel.washConfig, washPro, WashAttrType.attack);
|
washAttrModel.SetUIModel(washModel.washConfig, washPro, WashAttrType.life);
|
washAttrModel.SetUIModel(washModel.washConfig, washPro, WashAttrType.ignoredefence);
|
_attackWashPro.RefreshUI(WashAttrType.attack);
|
_lifeWashPro.RefreshUI(WashAttrType.life);
|
_ignoreDefenceWashPro.RefreshUI(WashAttrType.ignoredefence);
|
|
if (washPro.isPutOn == false)
|
{
|
_washLevelTitle.text = Language.Get("EquipWash108", 0);
|
}
|
else
|
{
|
_washLevelTitle.text = Language.Get("EquipWash108", washPro.XLAttrLV);
|
}
|
|
#region 刷新物品UI
|
if (itemModel == null)
|
{
|
_washEquipCell.gameObject.SetActive(false);
|
noEquipObj.SetActive(true);
|
}
|
else
|
{
|
noEquipObj.SetActive(false);
|
_itemModel = itemModel;
|
_washEquipCell.gameObject.SetActive(true);
|
_washEquipCell.Init(itemModel);
|
_washEquipCell.cellBtn.RemoveAllListeners();
|
_washEquipCell.cellBtn.onClick.AddListener(() =>
|
{
|
itemTipsModel.SetItemTipsModel(PackType.Equip, itemModel.guid);
|
});
|
}
|
|
UpdateMustWash();
|
#endregion
|
|
RefreshSpecWashUI();
|
|
ChangeBtn();
|
equipWashModel.SetCurWashModel(index);
|
equipWashModel.washBtnRedpoint.state = equipWashModel.washEquipRedPointlist[index].state;
|
_equipWashCtrl.m_Scorller.RefreshActiveCellViews();
|
}
|
//刷新材料
|
public void RefreshCostItem(PackType type, int index, int id)
|
{
|
if (type != PackType.Item) return;
|
UpdateMustWash();
|
|
}
|
|
private void UpdateMustWash()
|
{
|
UpdateWashMat();
|
UpdateMustWashCostMoney();
|
}
|
|
public void UpdateWashMat()
|
{
|
bool isMustAdd = GetMustAddNum() > 0 ? true : false;
|
contain_Cost.SetActive(isMustAdd);
|
contain_Default.SetActive(!isMustAdd);
|
if (!isMustAdd)
|
{
|
UpdateItemCell(_tagWashModel.washConfig.costItem,_costMatCell,_tagWashModel.washConfig.costCount);
|
}
|
else
|
{
|
UpdateItemCell(_tagWashModel.washConfig.costItem, contain_Cost_NormalItem, _tagWashModel.washConfig.costCount);
|
UpdateItemCell(equipWashModel.mustWashMatId, contain_Cost_MustAddItem, GetMustAddCost());
|
}
|
}
|
|
private void UpdateMustWashCostMoney()
|
{
|
int goldCount = (int)PlayerDatas.Instance.baseData.Gold;
|
int costMoney = GetCostMoney();
|
if (goldCount >= costMoney)
|
{
|
contain_Cost_Money.text = StringUtility.Contact("<color=#109D06>", costMoney, "</color>");
|
}
|
else
|
{
|
contain_Cost_Money.text = StringUtility.Contact("<color=#ff0000>", costMoney, "</color>");
|
}
|
}
|
|
private void UpdateItemCell(int itemId,ItemCell itemCell,int needNum)
|
{
|
ItemCellModel cellModel = new ItemCellModel(itemId);
|
itemCell.Init(cellModel);
|
itemCell.countText.gameObject.SetActive(_washProModel.isPutOn);
|
int haveNum = playerPack.GetItemCountByID(PackType.Item,itemId);
|
string matNumStr = string.Empty;
|
if (haveNum >= needNum)
|
{
|
matNumStr = UIHelper.AppendStringColor(TextColType.Green,haveNum.ToString(), true);
|
}
|
else
|
{
|
matNumStr = UIHelper.AppendStringColor(TextColType.Red,haveNum.ToString());
|
}
|
itemCell.countText.text = StringUtility.Contact(matNumStr, "/",needNum);
|
itemCell.cellBtn.RemoveAllListeners();
|
itemCell.cellBtn.onClick.AddListener(() =>
|
{
|
itemPathModel.SetChinItemModel(itemId);
|
});
|
}
|
|
private int GetCostMoney()
|
{
|
int costMatId = equipWashModel.mustWashMatId;
|
int costNum = GetMustAddCost();
|
int haveNum = playerPack.GetItemCountByID(PackType.Item, costMatId);
|
var storeConfig = StoreConfig.GetStoreCfg(costMatId, 1);
|
int matPrice = storeConfig == null ? 0 : storeConfig.MoneyNumber;
|
int costMoney = 0;
|
if (haveNum < costNum)
|
{
|
costMoney = (costNum - haveNum) * matPrice;
|
}
|
return costMoney;
|
}
|
|
/// <summary>
|
/// 获得勾选几条必增数量
|
/// </summary>
|
/// <returns></returns>
|
public int GetMustAddNum()
|
{
|
int needAddCount = 0;
|
if (_attackWashPro.toggleIsOn)
|
{
|
needAddCount += 1;
|
}
|
|
if (_lifeWashPro.toggleIsOn)
|
{
|
needAddCount += 1;
|
}
|
|
if (_ignoreDefenceWashPro.toggleIsOn)
|
{
|
needAddCount += 1;
|
}
|
return needAddCount;
|
}
|
|
/// <summary>
|
/// 获得必增消耗的数量
|
/// </summary>
|
/// <returns></returns>
|
public int GetMustAddCost()
|
{
|
int mustAddNum = GetMustAddNum();
|
if (_tagWashModel == null || mustAddNum < 1) return 0;
|
|
int index = mustAddNum - 1;
|
return mustAddNum > _tagWashModel.mustCosts.Length ? 0 : _tagWashModel.mustCosts[index];
|
|
}
|
|
//刷新特殊洗练UI
|
public void RefreshSpecWashUI()
|
{
|
equipWashModel.OnGetMasterModel(_washInfolist);
|
int type = equipWashModel.OnGetWashType(_washProModel.EquipPlace);
|
int curTypeLv = 0;
|
switch (type)
|
{
|
case 1:
|
curTypeLv = equipWashModel.washGroup1[0].XLAttrLV;
|
_specWashOpenCondition.text = Language.Get("WashTips_SpecWashOpenCondition_1");
|
_specWashFullText.text = Language.Get("WashTips_SpecWashFull_1");
|
break;
|
case 2:
|
curTypeLv = equipWashModel.washGroup2[0].XLAttrLV;
|
_specWashOpenCondition.text = Language.Get("WashTips_SpecWashOpenCondition_2");
|
_specWashFullText.text = Language.Get("WashTips_SpecWashFull_2");
|
break;
|
case 3:
|
curTypeLv = equipWashModel.washGroup3[0].XLAttrLV;
|
_specWashOpenCondition.text = Language.Get("WashTips_SpecWashOpenCondition_3");
|
_specWashFullText.text = Language.Get("WashTips_SpecWashFull_3");
|
break;
|
}
|
|
List<EquipWashSpecConfig.EquipWashSpecData> tagSpecModellist = EquipWashSpecConfig.GetWashSpecModel(type);
|
if (curTypeLv < tagSpecModellist[0].specConfig.levelNeed)
|
{
|
_specWashOpenCondition.gameObject.SetActive(true);
|
_openSpecWashPro.SetActive(false);
|
}
|
else
|
{
|
_specWashOpenCondition.gameObject.SetActive(false);
|
_openSpecWashPro.SetActive(true);
|
int i = 0;
|
for (i = tagSpecModellist.Count - 1; i > -1; i--)
|
{
|
var washSpecData = tagSpecModellist[i];
|
if (curTypeLv >= washSpecData.specConfig.levelNeed)
|
{
|
int[] specAttrsID = washSpecData.activeIds;
|
int[] specAttrsValue = washSpecData.activeValues;
|
int j = 0;
|
for (j = 0; j < specAttrNameText.Count; j++)
|
{
|
if(j < specAttrsID.Length)
|
{
|
specAttrNameText[j].gameObject.SetActive(true);
|
specAttrValueText[j].gameObject.SetActive(true);
|
PlayerPropertyConfig propertyModel = PlayerPropertyConfig.Get(specAttrsID[j]);
|
specAttrNameText[j].text = propertyModel.Name;
|
specAttrValueText[j].text = equipWashModel.GetProValueTypeStr(propertyModel, specAttrsValue[j]);
|
}
|
else
|
{
|
specAttrNameText[j].gameObject.SetActive(false);
|
specAttrValueText[j].gameObject.SetActive(false);
|
}
|
|
}
|
break;
|
}
|
}
|
}
|
|
if(curTypeLv >= tagSpecModellist[tagSpecModellist.Count - 1].specConfig.levelNeed)
|
{
|
_specWashFullText.gameObject.SetActive(true);
|
}
|
else
|
{
|
_specWashFullText.gameObject.SetActive(false);
|
}
|
}
|
|
public void ChangeBtn()
|
{
|
_washBtn.onClick.RemoveAllListeners();
|
if (_washProModel.isPutOn)
|
{
|
if (equipWashModel.IsCanWash(_itemModel))
|
{
|
if (equipWashModel.IsSaveWashValue(_washProModel))
|
{
|
if (equipWashModel.IsWashFull(_itemModel, _washProModel, _tagWashModel.washConfig))
|
{
|
if(_washProModel.XLAttrLV >= equipWashModel.GetMaxWashLv(_itemModel.config.EquipPlace)
|
&& _washProModel.XLAttrLV <= equipWashModel.GetWashFullLv(_itemModel.config.EquipPlace, _itemModel.config.LV))
|
{
|
_washFullLvText.text = Language.Get("WashLevelFulled");
|
}
|
else
|
{
|
_washFullLvText.text = Language.Get("EquipWash113", _itemModel.config.LV, equipWashModel.GetWashFullLv(_itemModel.config.EquipPlace, _itemModel.config.LV));
|
}
|
ObjHideOrShow(false, false, false, false, true);
|
}
|
else
|
{
|
if (_attackWashPro.singleWashAttrModel.isPerfect && _lifeWashPro.singleWashAttrModel.isPerfect
|
&& _ignoreDefenceWashPro.singleWashAttrModel.isPerfect)
|
{
|
ObjHideOrShow(false, false, false, true, false);
|
}
|
else
|
{
|
|
if (_attackWashPro.singleWashAttrModel.washState == WashState.None && _lifeWashPro.singleWashAttrModel.washState == WashState.None
|
&& _ignoreDefenceWashPro.singleWashAttrModel.washState == WashState.None)
|
{
|
_washBtn.onClick.AddListener(OnClickWashBtn);
|
ObjHideOrShow(true, false, false, false, false);
|
}
|
else
|
{
|
ObjHideOrShow(false, false, true, false, false);
|
_saveBtn.RemoveAllListeners();
|
_saveBtn.onClick.AddListener(() => { OnClickSaveBtn(); });
|
}
|
}
|
|
}
|
}
|
else
|
{
|
ObjHideOrShow(false, true, true, false, false);
|
_saveBtn.RemoveAllListeners();
|
_saveBtn.onClick.AddListener(() => { OnClickSaveBtn(); });
|
}
|
}
|
else
|
{
|
_washFullLvText.text = Language.Get("EquipWash114", equipWashModel.GetEquipWashMinLv(_itemModel.config.EquipPlace));
|
ObjHideOrShow(false, false, false, false, true);
|
|
}
|
|
|
}
|
else
|
{
|
_washBtn.onClick.AddListener(OnClickWashBtn);
|
ObjHideOrShow(true, false, false, false, false);
|
//_washBtn.GetComponent<Image>().SetSprite("BlackBtn");
|
}
|
|
}
|
|
private void ObjHideOrShow(params bool[] isShows)
|
{
|
_washBtn.gameObject.SetActive(isShows[0]);
|
_cancelBtn.gameObject.SetActive(isShows[1]);
|
_saveBtn.gameObject.SetActive(isShows[2]);
|
_upgradeBtn.gameObject.SetActive(isShows[3]);
|
_washFullLvText.gameObject.SetActive(isShows[4]);
|
}
|
|
#region 按钮事件
|
|
private bool isOpenPrompting = true;
|
|
private void OnClickWashBtn()
|
{
|
if (_washProModel.isPutOn)
|
{
|
int costMoney = GetCostMoney();
|
int goldCount = (int)PlayerDatas.Instance.baseData.Gold;
|
int mustAddNum = GetMustAddNum();
|
if (equipWashModel.IsEnoughMat(_tagWashModel.washConfig))
|
{
|
if (costMoney > 0)
|
{
|
int costNum = GetMustAddCost();
|
int haveNum = playerPack.GetItemCountByID(PackType.Item,equipWashModel.mustWashMatId);
|
string costMat = StringUtility.Contact(haveNum,"/",costNum);
|
if (isOpenPrompting)
|
{
|
ConfirmCancel.ToggleConfirmCancel(Language.Get("Mail101"), Language.Get("EquipWash103",costMat,costMoney),
|
Language.Get("ConfirmCancel101"), (bool isOk, bool isToggle) =>
|
{
|
if (isOk)
|
{
|
if(IsMoneyEnough())
|
{
|
mustWashEffect.Play();
|
equipWashModel.SendWashQuest(_washProModel.EquipPlace, GetWashCheckUseGoldAttr());
|
}
|
isOpenPrompting = !isToggle;
|
}
|
});
|
}
|
else
|
{
|
if(IsMoneyEnough())
|
{
|
mustWashEffect.Play();
|
equipWashModel.SendWashQuest(_washProModel.EquipPlace, GetWashCheckUseGoldAttr());
|
}
|
}
|
}
|
else
|
{
|
if(mustAddNum > 0)
|
{
|
mustWashEffect.Play();
|
}
|
else
|
{
|
washEffect.Play();
|
}
|
equipWashModel.SendWashQuest(_washProModel.EquipPlace, GetWashCheckUseGoldAttr());
|
}
|
}
|
else
|
{
|
itemPathModel.SetChinItemModel(_tagWashModel.washConfig.costItem);
|
}
|
}
|
else
|
{
|
SysNotifyMgr.Instance.ShowTip("Wash_NoEquip1");
|
}
|
|
}
|
|
private bool IsMoneyEnough()
|
{
|
int costMoney = GetCostMoney();
|
int goldCount = (int)PlayerDatas.Instance.baseData.Gold;
|
if(goldCount < costMoney)
|
{
|
WindowCenter.Instance.Open<RechargeTipWin>();
|
return false;
|
}
|
return true;
|
}
|
|
private int GetWashCheckUseGoldAttr()
|
{
|
int code = 0;
|
if (_attackWashPro.toggleIsOn)
|
{
|
code += 1;
|
}
|
if (_lifeWashPro.toggleIsOn)
|
{
|
code += 2;
|
}
|
if (_ignoreDefenceWashPro.toggleIsOn)
|
{
|
code += 4;
|
}
|
return code;
|
}
|
|
private void OnClickSaveBtn(bool needSave = true)
|
{
|
|
CA326_tagCMEquipXLAttrChangeOK result = new CA326_tagCMEquipXLAttrChangeOK();
|
result.EquipPlace = (byte)_washProModel.EquipPlace;
|
result.IsSave = 1;
|
GameNetSystem.Instance.SendInfo(result);
|
}
|
|
private void OnClickCancelBtn()
|
{
|
CA326_tagCMEquipXLAttrChangeOK result = new CA326_tagCMEquipXLAttrChangeOK();
|
result.EquipPlace = (byte)_washProModel.EquipPlace;
|
result.IsSave = 0;
|
GameNetSystem.Instance.SendInfo(result);
|
|
}
|
|
private void OnClickUpGradeBtn()
|
{
|
CA326_tagCMEquipXLAttrChangeOK result = new CA326_tagCMEquipXLAttrChangeOK();
|
result.EquipPlace = (byte)_washProModel.EquipPlace;
|
result.IsSave = 2;
|
GameNetSystem.Instance.SendInfo(result);
|
}
|
|
private void OnClickMasterBtn()
|
{
|
int type = equipWashModel.OnGetWashType(_washProModel.EquipPlace);
|
equipWashModel.OnGetMasterModel(_washInfolist);
|
int groupLv = 0;
|
switch(type)
|
{
|
case 1:
|
groupLv = equipWashModel.washGroup1[0].XLAttrLV;
|
break;
|
case 2:
|
groupLv = equipWashModel.washGroup2[0].XLAttrLV;
|
break;
|
case 3:
|
groupLv = equipWashModel.washGroup3[0].XLAttrLV;
|
break;
|
}
|
equipWashModel.SetWashMasterModel(type,groupLv);
|
WindowCenter.Instance.Open<WashMasterWin>();
|
}
|
|
private void OnClickRuleBtn()
|
{
|
}
|
#endregion
|
|
private List<string> GetToolsList(string tools, List<string> toolslist)
|
{
|
toolslist = new List<string>();
|
string[] toolsArray = tools.Split('|');
|
for (int i = 0; i < toolsArray.Length; i++)
|
{
|
toolslist.Add(toolsArray[i]);
|
}
|
return toolslist;
|
|
}
|
|
}
|