| | |
| | |
|
| | | [SerializeField]
|
| | | UIEffect washEffect;
|
| | | [SerializeField]
|
| | | UIEffect mustWashEffect;
|
| | |
|
| | | [SerializeField] float offest = 50;
|
| | |
|
| | | #endregion
|
| | |
| | | private EquipWashConfig.EquipWashData _tagWashModel;
|
| | | private ItemModel _itemModel; //洗练的装备
|
| | | private int[] _costMoneylist = null;
|
| | | private int _costmoney = 0;
|
| | | public int CostMoney
|
| | | {
|
| | | get { return _costmoney; }
|
| | | set { _costmoney = value; }
|
| | | }
|
| | | 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);
|
| | |
|
| | | }
|
| | |
| | | {
|
| | | _washLevelTitle.text = Language.Get("EquipWash108", washPro.XLAttrLV);
|
| | | }
|
| | | _costMatCell.gameObject.SetActive(true);
|
| | | ItemCellModel cellModel = new ItemCellModel(washModel.washConfig.costItem);
|
| | | _costMatCell.Init(cellModel);
|
| | | _costMatCell.cellBtn.RemoveAllListeners();
|
| | | _costMatCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | itemPathModel.SetChinItemModel(washModel.washConfig.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.washConfig.costItem);
|
| | | if (bagItemCount >= _tagWashModel.washConfig.costCount)
|
| | | _costMatCell.countText.text = UIHelper.AppendStringColor(TextColType.Green, bagItemCount.ToString(),true) + "/" + _tagWashModel.washConfig.costCount;
|
| | | else
|
| | | _costMatCell.countText.text = UIHelper.AppendStringColor(TextColType.Red, bagItemCount.ToString()) + "/" + _tagWashModel.washConfig.costCount;
|
| | | }
|
| | |
|
| | | private void UpdateMustWash()
|
| | | {
|
| | | UpdateWashMat();
|
| | | UpdateMustWashCostMoney();
|
| | | }
|
| | |
|
| | | public void UpdateWashMat()
|
| | |
| | | else
|
| | | {
|
| | | UpdateItemCell(_tagWashModel.washConfig.costItem, contain_Cost_NormalItem, _tagWashModel.washConfig.costCount);
|
| | | UpdateItemCell(equipWashModel.mustWashMatId, contain_Cost_MustAddItem, GetMustAddNum());
|
| | | UpdateItemCell(equipWashModel.mustWashMatId, contain_Cost_MustAddItem, GetMustAddCost());
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateMustWashCostMoney()
|
| | | {
|
| | | 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)
|
| | | int goldCount = (int)PlayerDatas.Instance.baseData.Gold;
|
| | | int costMoney = GetCostMoney();
|
| | | if (goldCount >= costMoney)
|
| | | {
|
| | | costMoney = (costNum - haveNum) * matPrice;
|
| | | 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)
|
| | |
| | | {
|
| | | itemPathModel.SetChinItemModel(itemId);
|
| | | });
|
| | | }
|
| | |
|
| | | 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>
|
| | |
| | | /// <returns></returns>
|
| | | public int GetMustAddCost()
|
| | | {
|
| | | if (_tagWashModel == null) return 0;
|
| | |
|
| | | int mustAddNum = GetMustAddNum();
|
| | | if (_tagWashModel == null || mustAddNum < 1) return 0;
|
| | |
|
| | | int index = mustAddNum - 1;
|
| | | return mustAddNum > _tagWashModel.mustCosts.Length ? 0 : _tagWashModel.mustCosts[index];
|
| | |
|
| | | }
|
| | | //刷新仙玉
|
| | | public void RefreshCostMoney()
|
| | | {
|
| | | CostMoney = GetMustAddCost();
|
| | | 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>");
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | //刷新特殊洗练UI
|
| | | public void RefreshSpecWashUI()
|
| | |
| | | {
|
| | | if (_washProModel.isPutOn)
|
| | | {
|
| | | |
| | | int costMoney = GetCostMoney();
|
| | | int goldCount = (int)PlayerDatas.Instance.baseData.Gold;
|
| | | 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());
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | }
|
| | |
|
| | | 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;
|