using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TableConfig; using System.Collections; using System.Linq; using System.Text; using Snxxz.UI; using System; using Snxxz; public class EquipSuitTips : MonoBehaviour { #region 属性 [SerializeField] private Transform _suitCellParent; [SerializeField] private Button _equipMaker; //装备锻造 [SerializeField] private Button splitBtn; //拆解套装 [SerializeField] private Transform _equipParent; [SerializeField] private Transform _material1Parent; [SerializeField] private Transform _material2Parent; [SerializeField] private Transform _material3Parent; [SerializeField] private Text _makerSuitName; [SerializeField] private Text _makerSuitNumber; [SerializeField] private Text _needConditionText; [SerializeField] private GameObject _armorSuitGo; [SerializeField] private GameObject _equipSuitGo; [SerializeField] private Button _previewBtn; [SerializeField] private ScrollerController _equipSuitCtrl; [SerializeField] private ScrollRect _suitCellRect; [SerializeField] private ScrollerController _suitProCtrl; [SerializeField] UIEffect oneMatEffect; [SerializeField] UIEffect twoMatEffect; [SerializeField] UIEffect threeMatEffect; [SerializeField] UIEffect makeSuccessEffect; [SerializeField] UIEffect makerEquipEffect; [SerializeField] SuitTypeSwitchBtn swichBtn; [SerializeField] GameObject maxSuitLvObj; [SerializeField] GameObject makerMatlistObj; [SerializeField] Text upgradeLvText; #endregion #region 数据 private List equipPartlist; private EquipSuitAttrConfig _equipSuitProModel; private EquipSuitCompoundConfig _equipSuitMatModel; private List _materialPoslist = new List(); HowToPlayModel _toPlayModel; HowToPlayModel toPlayModel { get { return _toPlayModel ?? (_toPlayModel = ModelCenter.Instance.GetModel()); } } PlayerSuitModel _suitModel; PlayerSuitModel SuitModel { get { return _suitModel ?? (_suitModel = ModelCenter.Instance.GetModel()); } } GetItemPathModel _itemPathModel; GetItemPathModel itemPathModel { get { return _itemPathModel ?? (_itemPathModel = ModelCenter.Instance.GetModel()); } } ItemTipsModel _itemTipsModel; ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel()); } } PlayerPackModel _playerPack; PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel()); } } private int presentIndex; //用于记录当前选项 private string suitId; public static SuitType E_SuitType = SuitType.LowSuit; public int equipPlace = 0; public int curSuitLv = 0; private bool firstOpen = true; [SerializeField] float offest = 50; #endregion private int redEquipPlace = 0; AchievementGuideEffect guideEffect = null; private void OnEnable() { guideEffect = null; swichBtn.switchBtn.AddListener(OnClickSwitchBtn); _previewBtn.onClick.AddListener(OnClickPreViewBtn); _equipSuitCtrl.OnRefreshCell += RefreshEquipSuitCell; _suitProCtrl.OnRefreshCell += RefreshSuitProCell; DTC0721_tagMakeItemAnswer.MakeItemAnswerEvent += GetMakeResult; //_equipSuitCtrl.lockType = EnhanceLockType.KeepVertical; SuitModel.RefreshSuitModelAct += CreateEquipSuitCell; _materialPoslist.Clear(); _materialPoslist.Add(_material1Parent); _materialPoslist.Add(_material2Parent); _materialPoslist.Add(_material3Parent); firstOpen = true; CheckJumpToModel(); } private void OnDisable() { swichBtn.switchBtn.RemoveAllListeners(); _previewBtn.onClick.RemoveAllListeners(); _equipSuitCtrl.OnRefreshCell -= RefreshEquipSuitCell; _suitProCtrl.OnRefreshCell -= RefreshSuitProCell; DTC0721_tagMakeItemAnswer.MakeItemAnswerEvent -= GetMakeResult; SuitModel.RefreshSuitModelAct -= CreateEquipSuitCell; SuitModel.ClearJumpModel(); E_SuitType = SuitType.LowSuit; int equipPlace = 0; SuitModel.CheckRedPointCondition(out equipPlace); SuitModel.CheckTypeBtnRedPointCondition(); AchievementGoto.guideAchievementId = 0; } private void CheckJumpToModel() { SuccessConfig successConfig = Config.Instance.Get(AchievementGoto.guideAchievementId); if (successConfig != null && successConfig.Type == 92) { AchievementGoto.guideAchievementId = 0; E_SuitType = SuitModel.jumpToSuitType; } else { E_SuitType = SuitType.LowSuit; bool isSwitch = true; foreach(var red in SuitModel.suitCellRedPointDict.Values) { if(red.state == RedPointState.Simple) { isSwitch = false; break; } } if (SuitModel.typeBtnRedPoint.state == RedPointState.Simple && isSwitch) { E_SuitType = SuitType.HighSuit; } } equipPartlist = SuitModel.GetEquipOrderlist(E_SuitType); CreateEquipSuitCell(); StartCoroutine(SetOffestPos()); } private void CreateEquipSuitCell() { int equipPlace = 0; SuitModel.CheckRedPointCondition(out equipPlace); if (_equipSuitCtrl.GetNumberOfCells(_equipSuitCtrl.m_Scorller) > 0) { _equipSuitCtrl.m_Scorller.RefreshActiveCellViews(); } else { _equipSuitCtrl.Refresh(); for (int i = 0; i < equipPartlist.Count; i++) { _equipSuitCtrl.AddCell(ScrollerDataType.Header, i); } _equipSuitCtrl.Restart(); } ChooseSuitCell(); SuitModel.CheckTypeBtnRedPointCondition(); } private IEnumerator SetOffestPos() { yield return null; redEquipPlace = 0; int equipPlace = 0; SuitModel.CheckRedPointCondition(out equipPlace); int index = 0; for (int i = 0; i < equipPartlist.Count; i++) { if (equipPlace == equipPartlist[i]) { redEquipPlace = equipPlace; index = i; if(SuitModel.jumpToGroupType != 0) { guideEffect = AchievementGuideEffectPool.Require(1); guideEffect.transform.SetParentEx(_equipMaker.transform, Vector3.zero, Quaternion.identity, Vector3.one); } break; } } presentIndex = index; _equipSuitCtrl.JumpIndex(index); _equipSuitCtrl.m_Scorller.RefreshActiveCellViews(); ChooseSuitCell(); yield return null; if (presentIndex != 0) { _equipSuitCtrl.JumpIndex(-offest, 0, EnhancedUI.EnhancedScroller.EnhancedScroller.TweenType.immediate); } } private void ChooseSuitCell() { int realSuitLv = 0; ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip, equipPartlist[presentIndex]); int suitLv = SuitModel.GetServerSuitLv(equipPartlist[presentIndex], (int)E_SuitType); if (itemModel != null) { bool isMaker = SuitModel.IsMakerSuit(E_SuitType, itemModel.chinItemModel.ItemColor, itemModel.chinItemModel.StarLevel); realSuitLv = suitLv; switch (E_SuitType) { case SuitType.LowSuit: if (!isMaker) { realSuitLv = 0; } else { if (suitLv != 0) { if (suitLv > itemModel.chinItemModel.LV) { realSuitLv = itemModel.chinItemModel.LV; } } } break; case SuitType.HighSuit: int lowSuitLv = SuitModel.GetServerSuitLv(equipPartlist[presentIndex], (int)SuitType.LowSuit); if (!isMaker) { realSuitLv = 0; } else { if (suitLv != 0) { if (suitLv > itemModel.chinItemModel.LV) { realSuitLv = itemModel.chinItemModel.LV; } } } break; } } OnClickSuitCell(realSuitLv,presentIndex); } private void RefreshEquipSuitCell(ScrollerDataType type, CellView cell) { EquipSuitCell suitCell = cell.GetComponent(); int equipPlace = equipPartlist[cell.index]; int suitLv = SuitModel.GetServerSuitLv(equipPlace, (int)E_SuitType); if (suitCell != null) { suitCell.SetDisplayModel(SuitModel.suitCellRedPointDict[equipPlace].id,equipPlace,E_SuitType,presentIndex); } suitCell.suitCellToggle.RemoveAllListeners(); suitCell.suitCellToggle.AddListener(()=>{ OnClickSuitCell(suitLv, cell.index); }); } private void OnClickSuitCell(int realSuitLv,int index) { presentIndex = index; curSuitLv = realSuitLv; equipPlace = equipPartlist[index]; ControllerShowMidUI(equipPlace, realSuitLv); ControllerShowRightUI(equipPlace,realSuitLv); ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip, equipPlace); if(equipPlace != redEquipPlace) { if(guideEffect != null) { AchievementGuideEffectPool.Recycle(guideEffect); guideEffect = null; SuitModel.ClearJumpModel(); } } if(itemModel == null) { ChangeMakerBtnState(false, Language.Get("EquipSuit_Cannot")); } else { bool isMaker = SuitModel.IsMakerSuit(E_SuitType, itemModel.chinItemModel.ItemColor, itemModel.chinItemModel.StarLevel); if(!isMaker) { ChangeMakerBtnState(false, Language.Get("EquipSuit_Cannot")); } else { if(SuitModel.IsUpgradSuitLv(equipPartlist[index],(int)E_SuitType,realSuitLv)) { switch (E_SuitType) { case SuitType.LowSuit: ChangeMakerBtnState(true, Language.Get("EquipSuitPanel_SmithTxt_1")); break; case SuitType.HighSuit: ChangeMakerBtnState(true, Language.Get("EquipSuitPanel_SmithTxt_2")); break; } } else { switch (E_SuitType) { case SuitType.LowSuit: ChangeMakerBtnState(false, Language.Get("EquipSuit_Finished")); break; case SuitType.HighSuit: bool isReachMax = SuitModel.IsReachMax(equipPartlist[index],(int)SuitType.HighSuit,realSuitLv); if(!isReachMax && SuitModel.GetServerSuitLv(equipPartlist[index], (int)SuitType.LowSuit) <= SuitModel.GetServerSuitLv(equipPartlist[index], (int)SuitType.HighSuit)) { ChangeMakerBtnState(false, Language.Get("EquipSuit_Cannot")); } else { ChangeMakerBtnState(false, Language.Get("EquipSuit_Finished")); } break; } } } } int serverSuitLv = SuitModel.GetServerSuitLv(equipPlace,(int)E_SuitType); if(serverSuitLv > 0) { splitBtn.gameObject.SetActive(true); splitBtn.RemoveAllListeners(); splitBtn.AddListener(()=> { switch (E_SuitType) { case SuitType.LowSuit: ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("EquipSuitSplit101", UIHelper.GetEquipAreaName(equipPlace)), (bool isOk) => { if (isOk) { SuitModel.SendSplitSuit(equipPlace,E_SuitType); } }); break; case SuitType.HighSuit: ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("EquipSuitSplit102", UIHelper.GetEquipAreaName(equipPlace)), (bool isOk) => { if (isOk) { SuitModel.SendSplitSuit(equipPlace, E_SuitType); } }); break; } }); } else { splitBtn.gameObject.SetActive(false); } _equipSuitCtrl.m_Scorller.RefreshActiveCellViews(); } public void ChangeMakerBtnState(bool isClick, string btnDes) { Text btnText = _equipMaker.transform.Find("SmithTxt").GetComponent(); Image btnIcon = _equipMaker.GetComponent(); btnText.text = btnDes; _equipMaker.RemoveAllListeners(); if (isClick) { _equipMaker.interactable = true; _equipMaker.onClick.AddListener(OnClickEquipMaker); btnIcon.SetSprite("CanUseBtn"); } else { _equipMaker.interactable = false; btnIcon.SetSprite("BlackBtn_a"); } } public void IsLockGridCell(bool islock, GameObject go) { GameObject itemCell = go.transform.Find("ItemCell").gameObject; GameObject gridLock = go.transform.Find("GridLock").gameObject; GameObject lockBg = go.transform.Find("ItemBG").gameObject; if (islock) { itemCell.SetActive(false); gridLock.SetActive(true); lockBg.SetActive(true); } else { itemCell.SetActive(true); gridLock.SetActive(false); lockBg.SetActive(false); } } public void ControllerShowMidUI(int equipPlace,int realSuitLv) { swichBtn.SetInit(E_SuitType); GameObject equipGridCell = _equipParent.transform.Find("GridCell").gameObject; GameObject mater1GridCell = _material1Parent.transform.Find("GridCell").gameObject; GameObject mater2GridCell = _material2Parent.transform.Find("GridCell").gameObject; GameObject mater3GridCell = _material3Parent.transform.Find("GridCell").gameObject; maxSuitLvObj.SetActive(false); makerMatlistObj.SetActive(true); if (makerEquipEffect.IsPlaying) { makerEquipEffect.StopImediatly(); } ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip,equipPlace); if (itemModel == null) { IsLockGridCell(true, equipGridCell); IsLockGridCell(true, mater1GridCell); IsLockGridCell(true, mater2GridCell); IsLockGridCell(true, mater3GridCell); } else { IsLockGridCell(false, equipGridCell); ItemCell itemCell = equipGridCell.transform.Find("ItemCell").GetComponent(); //pdr ToDo itemCell.Init(itemModel); itemCell.cellBtn.RemoveAllListeners(); itemCell.cellBtn.AddListener(() => { itemTipsModel.SetItemTipsModel(PackType.rptEquip,itemModel.itemInfo.ItemGUID); }); bool isMaker = SuitModel.IsMakerSuit(E_SuitType,itemModel.chinItemModel.ItemColor,itemModel.chinItemModel.StarLevel); if(E_SuitType == SuitType.HighSuit) { if (isMaker) { if (!makerEquipEffect.IsPlaying) { makerEquipEffect.Play(); } } } if(SuitModel.IsNeedUpgradEquipLv(equipPlace,(int)E_SuitType)) { maxSuitLvObj.SetActive(true); makerMatlistObj.SetActive(false); upgradeLvText.text = Language.Get("EquipSuitUpgradLv",itemModel.chinItemModel.LV + 1); } else { int suitLv = SuitModel.GetServerSuitLv(equipPlace,(int)E_SuitType); if (SuitModel.IsReachMax(equipPlace, (int)E_SuitType,suitLv)) { maxSuitLvObj.SetActive(true); makerMatlistObj.SetActive(false); upgradeLvText.text = Language.Get("NewEquipSuitFull"); } } #region 材料UI的显示 _equipSuitMatModel = EquipSuitCompoundConfig.GetMakerEquipSuitMatModel((int)E_SuitType, equipPlace,SuitModel.GetServerSuitLv(equipPlace,(int)E_SuitType) + 1, SuitModel.GetEquipJob(itemModel.itemId)); if (_equipSuitMatModel == null || !SuitModel.IsUpgradSuitLv(equipPlace,(int)E_SuitType,curSuitLv)) { IsLockGridCell(true, mater1GridCell); IsLockGridCell(true, mater2GridCell); IsLockGridCell(true, mater3GridCell); return; } int materIndex = 0; for (materIndex = 0; materIndex < _materialPoslist.Count; materIndex++) { GameObject matGridCell = _materialPoslist[materIndex].transform.Find("GridCell").gameObject; ItemCell materItemCell = _materialPoslist[materIndex].transform.Find("GridCell/ItemCell").GetComponent(); Text materCount = materItemCell.transform.Find("CountText").GetComponent(); if(isMaker) { if (materIndex < _equipSuitMatModel.CostItemID.Length) { IsLockGridCell(false, matGridCell); int itemid = _equipSuitMatModel.CostItemID[materIndex]; ItemCellModel cellModel = new ItemCellModel(itemid); materItemCell.Init(cellModel); materItemCell.cellBtn.RemoveAllListeners(); materItemCell.cellBtn.AddListener(() => { itemPathModel.SetChinItemModel(itemid); }); materCount.gameObject.SetActive(true); int haveCount = playerPack.GetItemCountByID(PackType.rptItem, _equipSuitMatModel.CostItemID[materIndex]); if (haveCount >= _equipSuitMatModel.CostItemCnt[materIndex]) { materCount.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Green, haveCount.ToString(), true), "/", _equipSuitMatModel.CostItemCnt[materIndex]); } else { materCount.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Red, haveCount.ToString()), "/", _equipSuitMatModel.CostItemCnt[materIndex]); } } else { IsLockGridCell(true, matGridCell); } } else { IsLockGridCell(true, matGridCell); } } #endregion } } public void ControllerShowRightUI(int equipPlace, int realSuitLv) { _needConditionText.gameObject.SetActive(true); ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip,equipPlace); switch (E_SuitType) { case SuitType.LowSuit: _needConditionText.text = Language.Get("SuitPanel_FourStage"); break; case SuitType.HighSuit: _needConditionText.text = Language.Get("EquipSuit_Honghuang"); break; } if (itemModel != null) { bool isMaker = SuitModel.IsMakerSuit(E_SuitType, itemModel.chinItemModel.ItemColor, itemModel.chinItemModel.StarLevel); if (isMaker) { _equipSuitGo.gameObject.SetActive(true); _armorSuitGo.gameObject.SetActive(true); List equipPlacelist = null; int previewSuitLv = realSuitLv; if (realSuitLv <= 0) { previewSuitLv += 1; } curSuitNum = SuitModel.GetSameSuitCnt(E_SuitType, equipPlace, previewSuitLv, out equipPlacelist); EquipSuitAttrConfig attrConfig = EquipSuitAttrConfig.GetSuitAttrConfig(SuitModel.GetGroupType(equipPlace) , (int)E_SuitType, previewSuitLv, SuitModel.GetEquipJob(itemModel.itemId)); if(attrConfig != null) { _makerSuitName.text = StringUtility.Contact(Language.Get("KnapS143"),":"); _makerSuitNumber.text = StringUtility.Contact(curSuitNum, "/", attrConfig.count3); } OnGetSuitProValue(attrConfig); _needConditionText.gameObject.SetActive(false); } else { _equipSuitGo.gameObject.SetActive(false); _armorSuitGo.gameObject.SetActive(false); } } else { _equipSuitGo.gameObject.SetActive(false); _armorSuitGo.gameObject.SetActive(false); } } private int[] firstProlist = null; private int[] firstProValuelist = null; private int[] secondProlist = null; private int[] secondProValuelist = null; private int[] thirdProlist = null; private int[] thirdProValuelist = null; public void OnGetSuitProValue(EquipSuitAttrConfig attrConfig) { if (attrConfig == null) return; _equipSuitProModel = attrConfig; firstProlist = ConfigParse.GetMultipleStr(attrConfig.propList1); firstProValuelist = ConfigParse.GetMultipleStr(attrConfig.propValueList1); secondProlist = ConfigParse.GetMultipleStr(attrConfig.propList2); secondProValuelist = ConfigParse.GetMultipleStr(attrConfig.propValueList2); thirdProlist = ConfigParse.GetMultipleStr(attrConfig.propList3); thirdProValuelist = ConfigParse.GetMultipleStr(attrConfig.propValueList3); CreateSuitProCell(); } private int length1 = 0; private int length2 = 0; private int length3 = 0; private int curSuitNum = 0; private void CreateSuitProCell() { _suitProCtrl.Refresh(); int i = 0; length1 = firstProlist.Length; for (i = 0; i < length1; i++) { _suitProCtrl.AddCell(ScrollerDataType.Header, i); } _suitProCtrl.AddCell(ScrollerDataType.Normal, length1); length2 = length1 + secondProlist.Length + 1; for (i = length1 + 1; i < length2; i++) { _suitProCtrl.AddCell(ScrollerDataType.Header, i); } _suitProCtrl.AddCell(ScrollerDataType.Normal, length2); length3 = length2 + thirdProlist.Length + 1; for (i = length2 + 1; i < length3; i++) { _suitProCtrl.AddCell(ScrollerDataType.Header, i); } _suitProCtrl.Restart(); } private void RefreshSuitProCell(ScrollerDataType type, CellView cell) { if (type != ScrollerDataType.Header) return; Text curNum = cell.transform.Find("FirstSuitATT").GetComponent(); Text curPro = cell.transform.Find("ATTNum").GetComponent(); Text curProName = cell.transform.Find("ATTTxt").GetComponent(); if (cell.index == 0) { curNum.text = Language.Get("EquipSuit111", _equipSuitProModel.count1.ToString()); curNum.gameObject.SetActive(true); } else if (cell.index == length1 + 1) { curNum.text = Language.Get("EquipSuit111", _equipSuitProModel.count2.ToString()); curNum.gameObject.SetActive(true); } else if (cell.index == length2 + 1) { curNum.text = Language.Get("EquipSuit111", _equipSuitProModel.count3.ToString()); curNum.gameObject.SetActive(true); } else { curNum.gameObject.SetActive(false); } PlayerPropertyConfig playerproModel = null; if (cell.index < length1) { playerproModel = Config.Instance.Get(firstProlist[cell.index]); if (playerproModel != null) { curProName.text = playerproModel.Name; curPro.text = StringUtility.Contact("+", GetProValueTypeStr(playerproModel, firstProValuelist[cell.index])); } ChangeSuitProTextColor(curNum, curPro, curProName, _equipSuitProModel.count1); } else if (cell.index >= length1 + 1 && cell.index < length2) { playerproModel = Config.Instance.Get(secondProlist[cell.index - length1 -1]); if (playerproModel != null) { curProName.text = playerproModel.Name; curPro.text = StringUtility.Contact("+", GetProValueTypeStr(playerproModel, secondProValuelist[cell.index - length1 - 1])); } ChangeSuitProTextColor(curNum, curPro, curProName, _equipSuitProModel.count2); } else if (cell.index >= length2 + 1 && cell.index < length3) { playerproModel = Config.Instance.Get(thirdProlist[cell.index - length2 - 1]); if (playerproModel != null) { curProName.text = playerproModel.Name; curPro.text = StringUtility.Contact("+", GetProValueTypeStr(playerproModel, thirdProValuelist[cell.index - length2 - 1])); } ChangeSuitProTextColor(curNum, curPro, curProName, _equipSuitProModel.count3); } } private void ChangeSuitProTextColor(Text num, Text pro, Text proName, int needSuitNum) { string nameStr = GetSuitNameByName(proName.text); if (curSuitNum >= needSuitNum) { num.text = StringUtility.Contact("", num.text, ""); pro.text = StringUtility.Contact(" ", pro.text, ""); proName.text = StringUtility.Contact("", nameStr, ""); } else { num.text = StringUtility.Contact("", num.text, ""); pro.text = StringUtility.Contact("", pro.text, ""); proName.text = StringUtility.Contact("", nameStr, ""); } } public string GetSuitNameByName(string attrName) { string suitStr = ""; for (int i = 0; i < attrName.Length; i++) { if (i != attrName.Length - 1) { if (attrName.Length == 2) { suitStr = StringUtility.Contact(suitStr, attrName[i], " "); } else { suitStr = StringUtility.Contact(suitStr, attrName[i]); } } else { suitStr = StringUtility.Contact(suitStr, attrName[i]); } } return suitStr; } /// /// 套装属性值的UI展示 /// /// /// /// 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 按钮监听 private void OnClickSwitchBtn() { int curSelect = equipPartlist[presentIndex]; E_SuitType = E_SuitType == SuitType.LowSuit ? SuitType.HighSuit : SuitType.LowSuit; equipPartlist = SuitModel.GetEquipOrderlist(E_SuitType); for (int i = 0; i < equipPartlist.Count; i++) { if (equipPartlist[i] == curSelect) { presentIndex = i; break; } } if (guideEffect != null) { AchievementGuideEffectPool.Recycle(guideEffect); guideEffect = null; SuitModel.ClearJumpModel(); } CreateEquipSuitCell(); } private void OnClickHowToPlayerBtn() { } private void OnClickPreViewBtn() { WindowCenter.Instance.Open(); } private void OnClickEquipMaker() { ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip, equipPlace); if (itemModel == null) return; bool canMaker = true; if (SuitModel.IsUpgradSuitLv(equipPlace, (int)E_SuitType, curSuitLv)) { for (int i = _equipSuitMatModel.CostItemID.Length - 1; i > -1; i--) { int haveCnt = playerPack.GetItemCountByID(PackType.rptItem, _equipSuitMatModel.CostItemID[i]); if (haveCnt < _equipSuitMatModel.CostItemCnt[i]) { itemPathModel.SetChinItemModel(_equipSuitMatModel.CostItemID[i]); canMaker = false; break; } } } else { canMaker = false; } if (canMaker) { if(SuitModel.IsFirstEquipMaker()) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("EquipSuit112"),(bool isOk)=> { if(isOk) { switch (_equipSuitMatModel.CostItemID.Length) { case 1: oneMatEffect.Play(); break; case 2: twoMatEffect.Play(); break; case 3: threeMatEffect.Play(); break; } SuitModel.SendMakeSuit((int)E_SuitType, equipPlace); } } ); } else { switch (_equipSuitMatModel.CostItemID.Length) { case 1: oneMatEffect.Play(); break; case 2: twoMatEffect.Play(); break; case 3: threeMatEffect.Play(); break; } SuitModel.SendMakeSuit((int)E_SuitType, equipPlace); } } } #endregion private void GetMakeResult(H0721_tagMakeItemAnswer result) { if (result.MakeType != (int)MakeType.Def_mitSuiteCompound) return; if (result.Result == 1) { CreateEquipSuitCell(); makeSuccessEffect.Play(); } } }