| | |
| | |
|
| | | [SerializeField]
|
| | | UIEffect washEffect;
|
| | | [SerializeField]
|
| | | UIEffect mustWashEffect;
|
| | |
|
| | | [SerializeField] float offest = 50;
|
| | |
|
| | | #endregion
|
| | |
|
| | | private WashProCount _washProModel;
|
| | | private EquipWashConfig _tagWashModel;
|
| | | private EquipWashConfig.EquipWashData _tagWashModel;
|
| | | private ItemModel _itemModel; //洗练的装备
|
| | | private List<string> _costMoneylist = null;
|
| | | private int _costmoney = 0;
|
| | | public int CostMoney
|
| | | {
|
| | | get { return _costmoney; }
|
| | | set { _costmoney = value; }
|
| | | }
|
| | | private int[] _costMoneylist = null;
|
| | | private List<WashProCount> _washInfolist;
|
| | | private int curWashEquip = 0;
|
| | |
|
| | |
| | | _specWashOpenCondition.gameObject.SetActive(true);
|
| | | _specWashFullText.gameObject.SetActive(false);
|
| | | _equipWashCtrl.OnRefreshCell += RefreshEquipWashCell;
|
| | | EquipReinforceEventMgr.Instance.RefreshWashCostMoneyEvent = RefreshCostMoney;
|
| | | EquipReinforceEventMgr.Instance.RefreshWashCostMoneyEvent = UpdateMustWash;
|
| | | _openSpecWashPro.SetActive(false);
|
| | |
|
| | | }
|
| | |
| | | ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip,washPro.EquipPlace);
|
| | | if(itemModel != null)
|
| | | {
|
| | | EquipWashConfig washModel = EquipWashConfig.GetCurrentWashEquipModel(equipWashModel.OnGetWashType(washPro.EquipPlace), washPro.XLAttrLV);
|
| | | if (equipWashModel.IsEnoughMat(washModel) && equipWashModel.IsCanWash(itemModel))
|
| | | 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;
|
| | |
| | | }
|
| | | }
|
| | | ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip, washPro.EquipPlace);
|
| | | EquipWashConfig washModel = EquipWashConfig.GetCurrentWashEquipModel(equipWashModel.OnGetWashType(washPro.EquipPlace), washPro.XLAttrLV);
|
| | | var washModel = EquipWashConfig.GetEquipWashData(equipWashModel.OnGetWashType(washPro.EquipPlace), washPro.XLAttrLV);
|
| | | _washProModel = washPro;
|
| | | _tagWashModel = washModel;
|
| | | _costMoneylist = GetToolsList(_tagWashModel.costMoneyList, _costMoneylist);
|
| | | washAttrModel.SetUIModel(washModel, washPro, WashAttrType.attack);
|
| | | washAttrModel.SetUIModel(washModel, washPro, WashAttrType.life);
|
| | | washAttrModel.SetUIModel(washModel, washPro, WashAttrType.ignoredefence);
|
| | | _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);
|
| | |
| | | {
|
| | | _washLevelTitle.text = Language.Get("EquipWash108", washPro.XLAttrLV);
|
| | | }
|
| | | _costMatCell.gameObject.SetActive(true);
|
| | | ItemCellModel cellModel = new ItemCellModel(washModel.costItem);
|
| | | _costMatCell.Init(cellModel);
|
| | | _costMatCell.cellBtn.RemoveAllListeners();
|
| | | _costMatCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | itemPathModel.SetChinItemModel(washModel.costItem);
|
| | | });
|
| | |
|
| | | #region 刷新物品UI
|
| | | if (itemModel == null)
|
| | |
| | | else
|
| | | {
|
| | | noEquipObj.SetActive(false);
|
| | | RefreshCostItem(itemModel.packType, itemModel.itemInfo.ItemPlace, itemModel.itemInfo.ItemID);
|
| | | _itemModel = itemModel;
|
| | | _washEquipCell.gameObject.SetActive(true);
|
| | | _washEquipCell.Init(itemModel);
|
| | |
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptEquip, itemModel.itemInfo.ItemGUID);
|
| | | });
|
| | |
|
| | | RefreshCostMoney();
|
| | | }
|
| | |
|
| | | UpdateMustWash();
|
| | | #endregion
|
| | |
|
| | | RefreshSpecWashUI();
|
| | |
| | | //刷新材料
|
| | | public void RefreshCostItem(PackType type, int index, int id)
|
| | | {
|
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
| | | if (singlePack == null)
|
| | | return;
|
| | | if (type != PackType.rptItem) return;
|
| | | UpdateMustWash();
|
| | |
|
| | | _costMatCell.countText.gameObject.SetActive(true);
|
| | | int bagItemCount = singlePack.GetItemCountByID(_tagWashModel.costItem);
|
| | | if (bagItemCount >= _tagWashModel.costCount)
|
| | | _costMatCell.countText.text = UIHelper.AppendStringColor(TextColType.Green, bagItemCount.ToString(),true) + "/" + _tagWashModel.costCount;
|
| | | else
|
| | | _costMatCell.countText.text = UIHelper.AppendStringColor(TextColType.Red, bagItemCount.ToString()) + "/" + _tagWashModel.costCount;
|
| | | }
|
| | |
|
| | | private void UpdateMustWash()
|
| | | {
|
| | | UpdateWashMat();
|
| | | UpdateMustWashCostMoney();
|
| | | }
|
| | |
|
| | | public void UpdateWashMat()
|
| | |
| | | contain_Default.SetActive(!isMustAdd);
|
| | | if (!isMustAdd)
|
| | | {
|
| | | UpdateItemCell(_tagWashModel.costItem,_costMatCell,_tagWashModel.costCount);
|
| | | UpdateItemCell(_tagWashModel.washConfig.costItem,_costMatCell,_tagWashModel.washConfig.costCount);
|
| | | }
|
| | | else
|
| | | {
|
| | | UpdateItemCell(_tagWashModel.costItem, contain_Cost_NormalItem, _tagWashModel.costCount);
|
| | | 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>");
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | ItemCellModel cellModel = new ItemCellModel(itemId);
|
| | | itemCell.Init(cellModel);
|
| | | itemCell.countText.gameObject.SetActive(true);
|
| | | itemCell.countText.gameObject.SetActive(_washProModel.isPutOn);
|
| | | int haveNum = playerPack.GetItemCountByID(PackType.rptItem,itemId);
|
| | | string matNumStr = string.Empty;
|
| | | if (haveNum >= needNum)
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | private int GetCostMoney()
|
| | | {
|
| | | int costMatId = equipWashModel.mustWashMatId;
|
| | | int costNum = GetMustAddCost();
|
| | | int haveNum = playerPack.GetItemCountByID(PackType.rptItem, 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;
|
| | |
| | | return needAddCount;
|
| | | }
|
| | |
|
| | | //刷新仙玉
|
| | | public void RefreshCostMoney()
|
| | | /// <summary>
|
| | | /// 获得必增消耗的数量
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public int GetMustAddCost()
|
| | | {
|
| | | int needAddCount = 0;
|
| | | if (_attackWashPro.toggleIsOn)
|
| | | needAddCount += 1;
|
| | | int mustAddNum = GetMustAddNum();
|
| | | if (_tagWashModel == null || mustAddNum < 1) return 0;
|
| | |
|
| | | if (_lifeWashPro.toggleIsOn)
|
| | | needAddCount += 1;
|
| | |
|
| | | if (_ignoreDefenceWashPro.toggleIsOn)
|
| | | needAddCount += 1;
|
| | |
|
| | | if (needAddCount == 0)
|
| | | {
|
| | | CostMoney = 0;
|
| | | }
|
| | | else if (needAddCount == 1)
|
| | | {
|
| | | CostMoney = int.Parse(GetCostMoneyList()[0]);
|
| | | }
|
| | | else if (needAddCount == 2)
|
| | | {
|
| | | CostMoney = int.Parse(GetCostMoneyList()[1]);
|
| | | }
|
| | | else if (needAddCount == 3)
|
| | | {
|
| | | CostMoney = int.Parse(GetCostMoneyList()[2]);
|
| | | }
|
| | |
|
| | | int goldCount = (int)PlayerDatas.Instance.baseData.Gold;
|
| | | if (goldCount >= CostMoney)
|
| | | {
|
| | | _costMoneyText.text = StringUtility.Contact("<color=#109D06>", CostMoney.ToString(), "</color>");
|
| | | }
|
| | | else
|
| | | {
|
| | | _costMoneyText.text = StringUtility.Contact("<color=#ff0000>", CostMoney.ToString(), "</color>");
|
| | | }
|
| | | int index = mustAddNum - 1;
|
| | | return mustAddNum > _tagWashModel.mustCosts.Length ? 0 : _tagWashModel.mustCosts[index];
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | //刷新特殊洗练UI
|
| | | public void RefreshSpecWashUI()
|
| | |
| | | {
|
| | | if (equipWashModel.IsSaveWashValue(_washProModel))
|
| | | {
|
| | | if (equipWashModel.IsWashFull(_itemModel, _washProModel, _tagWashModel))
|
| | | if (equipWashModel.IsWashFull(_itemModel, _washProModel, _tagWashModel.washConfig))
|
| | | {
|
| | | if(_washProModel.XLAttrLV >= equipWashModel.GetMaxWashLv(_itemModel.chinItemModel.EquipPlace)
|
| | | && _washProModel.XLAttrLV <= equipWashModel.GetWashFullLv(_itemModel.chinItemModel.EquipPlace, _itemModel.chinItemModel.LV))
|
| | |
| | | {
|
| | | if (_washProModel.isPutOn)
|
| | | {
|
| | | |
| | | int costMoney = GetCostMoney();
|
| | | int goldCount = (int)PlayerDatas.Instance.baseData.Gold;
|
| | | if (equipWashModel.IsEnoughMat(_tagWashModel))
|
| | | int mustAddNum = GetMustAddNum();
|
| | | if (equipWashModel.IsEnoughMat(_tagWashModel.washConfig))
|
| | | {
|
| | | if (CostMoney > 0)
|
| | | if (costMoney > 0)
|
| | | {
|
| | | if (goldCount >= CostMoney)
|
| | | int costNum = GetMustAddCost();
|
| | | int haveNum = playerPack.GetItemCountByID(PackType.rptItem,equipWashModel.mustWashMatId);
|
| | | string costMat = StringUtility.Contact(haveNum,"/",costNum);
|
| | | if (isOpenPrompting)
|
| | | {
|
| | | if (isOpenPrompting)
|
| | | ConfirmCancel.ToggleConfirmCancel(Language.Get("Mail101"), Language.Get("EquipWash103",costMat,costMoney),
|
| | | Language.Get("ConfirmCancel101"), (bool isOk, bool isToggle) =>
|
| | | {
|
| | | ConfirmCancel.ToggleConfirmCancel(Language.Get("Mail101"), Language.Get("EquipWash103", CostMoney),
|
| | | Language.Get("ConfirmCancel101"), (bool isOk, bool isToggle) =>
|
| | | if (isOk)
|
| | | {
|
| | | if (isOk)
|
| | | if(IsMoneyEnough())
|
| | | {
|
| | | washEffect.Play();
|
| | | mustWashEffect.Play();
|
| | | equipWashModel.SendWashQuest(_washProModel.EquipPlace, GetWashCheckUseGoldAttr());
|
| | | }
|
| | | }
|
| | |
|
| | | isOpenPrompting = !isToggle;
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | washEffect.Play();
|
| | | equipWashModel.SendWashQuest(_washProModel.EquipPlace, GetWashCheckUseGoldAttr());
|
| | | }
|
| | |
|
| | | isOpenPrompting = !isToggle;
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | if (VersionConfig.Get().isBanShu)
|
| | | if(IsMoneyEnough())
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("GoldErr");
|
| | | return;
|
| | | mustWashEffect.Play();
|
| | | equipWashModel.SendWashQuest(_washProModel.EquipPlace, GetWashCheckUseGoldAttr());
|
| | | }
|
| | | WindowCenter.Instance.Open<RechargeTipWin>();
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | washEffect.Play();
|
| | | if(mustAddNum > 0)
|
| | | {
|
| | | mustWashEffect.Play();
|
| | | }
|
| | | else
|
| | | {
|
| | | washEffect.Play();
|
| | | }
|
| | | equipWashModel.SendWashQuest(_washProModel.EquipPlace, GetWashCheckUseGoldAttr());
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | itemPathModel.SetChinItemModel(_tagWashModel.costItem);
|
| | | 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()
|
| | |
| | | {
|
| | | }
|
| | | #endregion
|
| | |
|
| | | public List<string> GetCostMoneyList()
|
| | | {
|
| | | if (_costMoneylist != null)
|
| | | return _costMoneylist;
|
| | | else
|
| | | return null;
|
| | | }
|
| | |
|
| | | private List<string> GetToolsList(string tools, List<string> toolslist)
|
| | | {
|