| | |
| | | [SerializeField]
|
| | | ScrollerController equipTypeLineCellCtrl;
|
| | |
|
| | | [SerializeField] GameObject increaseRateItem;
|
| | | [SerializeField] GameObject increaseGridCell;
|
| | | [SerializeField] Text increaseText;
|
| | | [SerializeField] PushSwitchBtn switchBtn;
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> sourceItemlist = new List<GameObject>();
|
| | |
|
| | |
| | | {
|
| | | get { return ModelCenter.Instance.GetModel<GetItemPathModel>(); }
|
| | | }
|
| | |
|
| | |
|
| | | private Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> firstTypeDict = null;
|
| | | private Dictionary<int, List<ItemCompoundConfig>> secondTypeDict = null;
|
| | | private List<ItemCompoundConfig> thirdTypelist = null;
|
| | |
|
| | | ComposeWinModel.ComposeFirstTypeData firstTypeData;
|
| | | ComposeWinModel.ComposeSecondTypeData secondTypeData;
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData;
|
| | | Dictionary<int, List<int>> fixedItemIndexDict = new Dictionary<int, List<int>>();
|
| | |
|
| | | private int curSecondType = 0;
|
| | |
| | | [SerializeField] int initSuccessRate = 0;
|
| | | private int curComposeEquipIndex = -1;
|
| | | ItemCompoundConfig compoundModel = null;
|
| | | bool isIncreaseRate = false;
|
| | | int successRate = 0;
|
| | | SelectEquipModel _selectModel;
|
| | | SelectEquipModel selectModel
|
| | |
| | | }
|
| | | protected override void BindController()
|
| | | {
|
| | | cellCtrl.OnRefreshCell += RefreshCell;
|
| | | cellCtrl.OnRefreshCell += RefreshTypeCell;
|
| | | cellCtrl.vertical = true;
|
| | | cellCtrl.lockType = EnhanceLockType.KeepVertical;
|
| | | equipTypeLineCellCtrl.OnRefreshCell += RefreshEquipTypeLineCell;
|
| | |
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | |
| | | composeWinModel.UpdateSecondTypeEvent += UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent += UpdateThirdType;
|
| | | selectModel.selectEquipEvent += RefreshSelectItem;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnComposeAnswer;
|
| | | UIEventTrigger.Get(helpBtn.gameObject).OnDown = OnClickHelpBtn;
|
| | | UIEventTrigger.Get(helpBtn.gameObject).OnUp = OnDownUp;
|
| | | Display();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | this.transform.SetAsLastSibling();
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | selectModel.selectEquipEvent -= RefreshSelectItem;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer;
|
| | | composeWinModel.UpdateSecondTypeEvent -= UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent -= UpdateThirdType;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | |
|
| | | }
|
| | | #region 新的逻辑
|
| | | private void Display()
|
| | | {
|
| | | composeWinModel.TryGetFirstTypeData((int)ComposeFuncType.Equip,out firstTypeData);
|
| | | if (firstTypeData == null ) return;
|
| | |
|
| | | isIncreaseRate = false;
|
| | | successRate = 0;
|
| | | firstTypeDict = composeWinModel.GetFirstTypeModel((int)ComposeFuncType.Equip);
|
| | | |
| | | DefaultSelect();
|
| | | CreateTypeCell();
|
| | | |
| | | }
|
| | |
|
| | | private void DefaultSelect()
|
| | | {
|
| | | bool isJumpTo = false;
|
| | | if (composeWinModel.secondType != 0)
|
| | | {
|
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Equip, composeWinModel.secondType);
|
| | | OnClickSecondType(curSecondType,curThirdType);
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | |
|
| | | CreateCell();
|
| | | //CreateCell();
|
| | | if (compoundModel != null)
|
| | | {
|
| | | RefreshUI(compoundModel);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | private void CreateTypeCell()
|
| | | {
|
| | | this.transform.SetAsLastSibling();
|
| | | if (firstTypeData == null) return;
|
| | |
|
| | | cellCtrl.Refresh();
|
| | | foreach(var second in firstTypeData.secondTypeDict.Keys)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Header,second);
|
| | | if(second == curSecondType)
|
| | | {
|
| | | var thirdTypeDict = firstTypeData.secondTypeDict[second].thirdTypeDict;
|
| | | foreach(var third in thirdTypeDict.Keys)
|
| | | {
|
| | | if (third != 0)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal,third);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | cellCtrl.Restart();
|
| | | JumpIndex();
|
| | |
|
| | | if (curThirdType != 0)
|
| | | {
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType, curThirdType, out thirdTypeData);
|
| | | ChangeUIState(false, true, false);
|
| | | if(thirdTypeData != null)
|
| | | {
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(thirdTypeData.itemCompound.makeID[0]);
|
| | | if (itemConfig != null && itemConfig.ItemColor == 6)
|
| | | {
|
| | | dismantleText.gameObject.SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | dismantleText.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshUI(null);
|
| | | dismantleText.gameObject.SetActive(false);
|
| | | ChangeUIState(true, false, false);
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | private void RefreshTypeCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | selectModel.selectEquipEvent -= RefreshSelectItem;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer;
|
| | | switch (type)
|
| | | {
|
| | | case ScrollerDataType.Header:
|
| | | ComposeWinModel.ComposeSecondTypeData _secondTypeData = null;
|
| | | ComposeFirstTypeCell firstTypeCell = cell.GetComponent<ComposeFirstTypeCell>();
|
| | | composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.Equip, cell.index, out _secondTypeData);
|
| | | if (_secondTypeData != null)
|
| | | {
|
| | | var thirdTypeDict = _secondTypeData.thirdTypeDict;
|
| | | foreach (var third in thirdTypeDict.Keys)
|
| | | {
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData = null;
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, cell.index, third, out thirdTypeData);
|
| | | firstTypeCell.SetDisplay((int)ComposeFuncType.Equip, cell.index, third, curSecondType);
|
| | | break;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case ScrollerDataType.Normal:
|
| | | ComposeSecondTypeCell secondTypeCell = cell.GetComponent<ComposeSecondTypeCell>();
|
| | | secondTypeCell.SetDisplay((int)ComposeFuncType.Equip, curSecondType, cell.index, curThirdType);
|
| | | if(curThirdType == cell.index)
|
| | | {
|
| | | CreateEquipTypeLineCell();
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | private void JumpIndex()
|
| | | {
|
| | | if (firstTypeData == null) return;
|
| | |
|
| | | var secondTypeDict = firstTypeData.secondTypeDict;
|
| | | if (secondTypeDict.Count >= 1 && curSecondType != 0
|
| | | && curThirdType >= 1)
|
| | | {
|
| | | cellCtrl.JumpIndex(GetCurIndex(curSecondType));
|
| | | }
|
| | | }
|
| | |
|
| | | private int GetCurIndex(int secondType)
|
| | | {
|
| | | if (firstTypeData == null) return 0;
|
| | | int curIndex = 0;
|
| | | var secondTypeDict = firstTypeData.secondTypeDict;
|
| | | List<int> secondlist = secondTypeDict.Keys.ToList();
|
| | | for (int i = 0; i < secondlist.Count; i++)
|
| | | {
|
| | | if (secondType == secondlist[i])
|
| | | {
|
| | | curIndex = i;
|
| | | break;
|
| | | }
|
| | | }
|
| | | return curIndex;
|
| | | }
|
| | |
|
| | | private void UpdateSecondType(int secondType)
|
| | | {
|
| | | curThirdType = 0;
|
| | | curSecondType = secondType;
|
| | | composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.Equip,secondType,out secondTypeData);
|
| | | OnClickSecondType();
|
| | | CreateTypeCell();
|
| | | }
|
| | |
|
| | | private void OnClickSecondType()
|
| | | {
|
| | | if (secondTypeData == null) return;
|
| | |
|
| | | var thirdTypeDict = secondTypeData.thirdTypeDict;
|
| | | if (curThirdType == 0)
|
| | | {
|
| | | foreach (var thirdType in thirdTypeDict.Keys)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | {
|
| | | if (preSecondType == curSecondType)
|
| | | {
|
| | | curSecondType = 0;
|
| | | preSecondType = 0;
|
| | | }
|
| | | else
|
| | | {
|
| | | curThirdType = thirdType;
|
| | | }
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (preSecondType != curSecondType)
|
| | | {
|
| | | preSecondType = curSecondType;
|
| | | curComposeEquipIndex = -1;
|
| | | selectModel.ClearSelectModel();
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateThirdType(int thirdType)
|
| | | {
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType,thirdType, out thirdTypeData);
|
| | | if(thirdTypeData != null)
|
| | | {
|
| | | bool isTrailer = composeWinModel.IsTrailerByLevel(thirdTypeData.itemCompound);
|
| | | if (isTrailer)
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(StringUtility.Contact(thirdTypeData.itemCompound.levelNeed, "级开启"));
|
| | | return;
|
| | | }
|
| | | }
|
| | | curThirdType = thirdType;
|
| | | OnClickThirdType();
|
| | | CreateTypeCell();
|
| | | }
|
| | |
|
| | | private void OnClickThirdType()
|
| | | {
|
| | | if (thirdTypeData == null) return;
|
| | |
|
| | | if (preThirdType != curThirdType)
|
| | | {
|
| | | preThirdType = curThirdType;
|
| | | }
|
| | | curComposeEquipIndex = -1;
|
| | | selectModel.ClearSelectModel();
|
| | | }
|
| | |
|
| | | private void CreateEquipTypeLineCell()
|
| | | {
|
| | | List<ComposeWinModel.ComposeThirdTypeData> thirdTypeDatas = null;
|
| | | bool isthird = composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType, curThirdType, out thirdTypeDatas);
|
| | | if (!isthird) return;
|
| | |
|
| | | if (thirdTypeDatas.Count > 1)
|
| | | {
|
| | | ChangeUIState(false, true, false);
|
| | | equipTypeLineCellCtrl.Refresh();
|
| | | int line = thirdTypeDatas.Count / 3;
|
| | | if (thirdTypeDatas.Count % 3 > 0)
|
| | | {
|
| | | line += 1;
|
| | | }
|
| | | int i = 0;
|
| | | for (i = 0; i < line; i++)
|
| | | {
|
| | | equipTypeLineCellCtrl.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | | equipTypeLineCellCtrl.Restart();
|
| | | }
|
| | | else
|
| | | {
|
| | | if (thirdTypeDatas.Count > 0)
|
| | | {
|
| | | ItemCompoundConfig tagItemCompound = thirdTypeDatas[0].itemCompound;
|
| | | ClickEquipTypeCell(tagItemCompound, 0);
|
| | | RefreshUI(tagItemCompound);
|
| | | }
|
| | | }
|
| | | if (curComposeEquipIndex != -1)
|
| | | {
|
| | | ItemCompoundConfig tagItemCompound = thirdTypeDatas[curComposeEquipIndex].itemCompound;
|
| | | ClickEquipTypeCell(tagItemCompound, curComposeEquipIndex);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void ChangeUIState(params bool[] isShows)
|
| | | {
|
| | | notChooseBG.SetActive(isShows[0]);
|
| | | chooseComposeEquip.SetActive(isShows[1]);
|
| | | composeEquip.SetActive(isShows[2]);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | private void ResetModel()
|
| | | {
|
| | |
| | | compoundModel = null;
|
| | | }
|
| | |
|
| | | private void CreateCell()
|
| | | {
|
| | | dismantleText.gameObject.SetActive(false);
|
| | | cellCtrl.Refresh();
|
| | | if(curSecondType == 0)
|
| | | {
|
| | | ChangeUIState(true, false,false);
|
| | | }
|
| | |
|
| | | if(firstTypeDict != null)
|
| | | {
|
| | | foreach (int secondType in firstTypeDict.Keys)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Header,secondType);
|
| | | if(secondType == curSecondType)
|
| | | {
|
| | | foreach (int thirdType in firstTypeDict[secondType].Keys)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal, thirdType);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | cellCtrl.Restart();
|
| | |
|
| | | if (secondTypeDict != null)
|
| | | {
|
| | | if (secondTypeDict.Count >= 1 && curSecondType != 0
|
| | | && curThirdType >= 1)
|
| | | {
|
| | | cellCtrl.JumpIndex(GetCurIndex(curSecondType));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private int GetCurIndex(int secondType)
|
| | | {
|
| | | int curIndex = 0;
|
| | | List<int> secondlist = firstTypeDict.Keys.ToList();
|
| | | for(int i = 0; i < secondlist.Count; i++)
|
| | | {
|
| | | if(secondType == secondlist[i])
|
| | | {
|
| | | curIndex = i;
|
| | | break;
|
| | | }
|
| | | }
|
| | | return curIndex;
|
| | | }
|
| | |
|
| | | private void RefreshCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | Image icon = cell.transform.Find("BtnIcon").GetComponent<Image>();
|
| | | Text name = cell.transform.Find("BtnText").GetComponent<Text>();
|
| | | Button cellBtn = cell.GetComponent<Button>();
|
| | | cellBtn.RemoveAllListeners();
|
| | | ItemCompoundConfig compoundModel = null;
|
| | | switch (type)
|
| | | {
|
| | | case ScrollerDataType.Header:
|
| | | GameObject arrowIcon = cell.transform.Find("SecondBtn").gameObject;
|
| | | foreach (int thirdType in firstTypeDict[cell.index].Keys)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | {
|
| | | arrowIcon.SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | arrowIcon.SetActive(false);
|
| | | }
|
| | |
|
| | | compoundModel = firstTypeDict[cell.index][thirdType][0];
|
| | | name.text = compoundModel.secondTypeName;
|
| | | if (curSecondType == cell.index)
|
| | | {
|
| | | arrowIcon.transform.localRotation = Quaternion.Euler(0, 0, -90);
|
| | | icon.SetSprite("ComposeFirstClassChoosebtn");
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Equip, curSecondType);
|
| | | }
|
| | | else
|
| | | {
|
| | | arrowIcon.transform.localRotation = Quaternion.Euler(0, 0,0);
|
| | | icon.SetSprite("ComposeFirstClassNormalbtn");
|
| | | }
|
| | | break;
|
| | | }
|
| | | cellBtn.AddListener(()=> { OnClickSecondType(cell.index); });
|
| | | break;
|
| | | case ScrollerDataType.Normal:
|
| | | compoundModel = secondTypeDict[cell.index][0];
|
| | | name.text = compoundModel.thirdTypeName;
|
| | | if (curThirdType == cell.index)
|
| | | {
|
| | | icon.SetSprite("ChildListBtn_Select");
|
| | | thirdTypelist = composeWinModel.GetThirdTypeModellist(compoundModel.firstType, compoundModel.secondType, cell.index);
|
| | | CreateEquipTypeLineCell();
|
| | | }
|
| | | else
|
| | | {
|
| | | icon.SetSprite("ChildListBtn_UnSelect");
|
| | | }
|
| | | cellBtn.AddListener(() => { OnClickThirdType(cell.index); });
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnClickSecondType(int secondType,int _thirdType = 0)
|
| | | {
|
| | | curSecondType = secondType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Equip, curSecondType);
|
| | | if(_thirdType == 0)
|
| | | {
|
| | | foreach (var thirdType in secondTypeDict.Keys)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | {
|
| | | if (preSecondType == curSecondType)
|
| | | {
|
| | | curSecondType = 0;
|
| | | preSecondType = 0;
|
| | | }
|
| | | curThirdType = thirdType;
|
| | | }
|
| | | else
|
| | | {
|
| | | curThirdType = 0;
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | curThirdType = _thirdType;
|
| | | }
|
| | | |
| | | if (preSecondType != curSecondType)
|
| | | {
|
| | | preSecondType = curSecondType;
|
| | | curComposeEquipIndex = -1;
|
| | | selectModel.ClearSelectModel();
|
| | | }
|
| | | |
| | | CreateCell();
|
| | | }
|
| | |
|
| | | private void OnClickThirdType(int thirdType)
|
| | | {
|
| | | curThirdType = thirdType;
|
| | | if (preThirdType != curThirdType)
|
| | | {
|
| | | preThirdType = curThirdType;
|
| | | }
|
| | | curComposeEquipIndex = -1;
|
| | | CreateCell();
|
| | | selectModel.ClearSelectModel();
|
| | | }
|
| | |
|
| | | private void CreateEquipTypeLineCell()
|
| | | {
|
| | | if (thirdTypelist == null)
|
| | | return;
|
| | |
|
| | | if(thirdTypelist.Count > 1)
|
| | | {
|
| | | ChangeUIState(false, true, false);
|
| | | equipTypeLineCellCtrl.Refresh();
|
| | | int line = thirdTypelist.Count / 3;
|
| | | if (thirdTypelist.Count % 3 > 0)
|
| | | {
|
| | | line += 1;
|
| | | }
|
| | | int i = 0;
|
| | | for (i = 0; i < line; i++)
|
| | | {
|
| | | equipTypeLineCellCtrl.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | |
|
| | | equipTypeLineCellCtrl.Restart();
|
| | | }
|
| | | else
|
| | | {
|
| | | if(thirdTypelist.Count > 0)
|
| | | {
|
| | | ItemCompoundConfig tagItemCompound = thirdTypelist[0];
|
| | | ClickEquipTypeCell(tagItemCompound, 0);
|
| | | RefreshUI(tagItemCompound);
|
| | | }
|
| | | }
|
| | | |
| | | if(curComposeEquipIndex != -1)
|
| | | {
|
| | | ItemCompoundConfig tagItemCompound = thirdTypelist[curComposeEquipIndex];
|
| | | ClickEquipTypeCell(tagItemCompound, curComposeEquipIndex);
|
| | | }
|
| | |
|
| | | if(thirdTypelist.Count > 1)
|
| | | {
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(thirdTypelist[0].makeID);
|
| | | if (itemConfig != null && itemConfig.ItemColor == 6)
|
| | | {
|
| | | dismantleText.gameObject.SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | dismantleText.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | dismantleText.gameObject.SetActive(false);
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | private void RefreshEquipTypeLineCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | List<ComposeWinModel.ComposeThirdTypeData> thirdTypeDatas = null;
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType, curThirdType, out thirdTypeDatas);
|
| | |
|
| | | int i = 0;
|
| | | for(i = 0; i < cell.transform.childCount; i++)
|
| | | {
|
| | | GameObject typeCell = cell.transform.GetChild(i).gameObject;
|
| | | int index = (cell.transform.childCount) * cell.index + i;
|
| | | if(index < thirdTypelist.Count)
|
| | | if(index < thirdTypeDatas.Count)
|
| | | {
|
| | | typeCell.SetActive(true);
|
| | | ItemCompoundConfig tagItemCompound = thirdTypelist[index];
|
| | | ItemConfig tagChinItem = Config.Instance.Get<ItemConfig>(tagItemCompound.makeID);
|
| | | ItemCompoundConfig tagItemCompound = thirdTypeDatas[index].itemCompound;
|
| | | ItemConfig tagChinItem = Config.Instance.Get<ItemConfig>(tagItemCompound.makeID[0]);
|
| | | Image icon = typeCell.transform.Find("EquipIcon").GetComponent<Image>();
|
| | | Image bgIcon = typeCell.transform.Find("EquipBG").GetComponent<Image>();
|
| | | Text nameText = typeCell.transform.Find("BtnText").GetComponent<Text>();
|
| | |
| | | RefreshComposeSuccessRate();
|
| | | }
|
| | |
|
| | | private void ChangeUIState(params bool[] isShows)
|
| | | {
|
| | | notChooseBG.SetActive(isShows[0]);
|
| | | chooseComposeEquip.SetActive(isShows[1]);
|
| | | composeEquip.SetActive(isShows[2]);
|
| | | }
|
| | |
|
| | | |
| | | private void RefreshUI(ItemCompoundConfig compoundModel)
|
| | | {
|
| | | this.compoundModel = compoundModel;
|
| | |
| | | GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject;
|
| | | if (i < makeIds.Length)
|
| | | {
|
| | | RefreshGridCellUI(gridCell, false, makeIds[i],NeedMatType.MakeItem);
|
| | | RefreshGridCellUI(gridCell, false, makeIds[i],0,NeedMatType.MakeItem);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | GameObject gridCell = matPos.transform.Find("GridCell").gameObject;
|
| | | Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>();
|
| | | putInText.gameObject.SetActive(false);
|
| | | RefreshGridCellUI(gridCell,false,fixedIds[i],NeedMatType.fixedItem);
|
| | | RefreshGridCellUI(gridCell,false,fixedIds[i],fixedCounts[i],NeedMatType.fixedItem);
|
| | |
|
| | | List<int> itemIndexlist = null;
|
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 提升合成成功率
|
| | | int[] increases = compoundModel.successRateIncrease;
|
| | | if(increases == null || increases.Length < 2)
|
| | | {
|
| | | isIncreaseRate = false;
|
| | | increaseRateItem.SetActive(isIncreaseRate);
|
| | | }
|
| | | else
|
| | | {
|
| | | int increaseId = increases[0];
|
| | | int increaseNeedNum = increases[1];
|
| | | int increaseRate = increases[2] / 100;
|
| | | increaseRateItem.SetActive(true);
|
| | | RefreshGridCellUI(increaseGridCell, false,increaseId,increaseNeedNum);
|
| | | increaseText.text = StringUtility.Contact("增加成功率", StringUtility.Contact(increaseRate, "%"));
|
| | | int haveIncreaseNum = playerPack.GetItemCountByID(PackType.rptItem, increaseId);
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(increaseId);
|
| | | isIncreaseRate = haveIncreaseNum >= increaseNeedNum ? isIncreaseRate : false;
|
| | | switchBtn.RefreshSwitchUI(isIncreaseRate);
|
| | | switchBtn.switchBtn.RemoveAllListeners();
|
| | | switchBtn.switchBtn.AddListener(()=>
|
| | | {
|
| | | if (switchBtn.onObj.activeInHierarchy)
|
| | | {
|
| | | isIncreaseRate = false;
|
| | | switchBtn.RefreshSwitchUI(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | if(haveIncreaseNum >= increaseNeedNum)
|
| | | {
|
| | | isIncreaseRate = true;
|
| | | switchBtn.RefreshSwitchUI(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | isIncreaseRate = false;
|
| | | MessageWin.Inst.ShowFixedTip(StringUtility.Contact("增加成功率需要",increaseNeedNum,itemConfig.ItemName,"数量不足"));
|
| | | }
|
| | | }
|
| | | RefreshComposeSuccessRate();
|
| | | });
|
| | | }
|
| | | #endregion
|
| | |
|
| | | }
|
| | |
|
| | | private void RefreshGridCellUI(GameObject gridCell, bool islock, int itemId = -1,NeedMatType matType = NeedMatType.Nothing,int itemPlace = -1)
|
| | | private void RefreshGridCellUI(GameObject gridCell, bool islock, int itemId = -1,int needCount = 0,NeedMatType matType = NeedMatType.Nothing,int itemPlace = -1)
|
| | | {
|
| | | gridCell.SetActive(true);
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | |
| | | else
|
| | | {
|
| | | itemCell.Init(itemModel);
|
| | | |
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | if (matType == NeedMatType.fixedItem)
|
| | |
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | | });
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | if(needCount > 0)
|
| | | {
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | itemCell.countText.gameObject.SetActive(true);
|
| | | int haveCount = playerPack.GetItemCountByID(PackType.rptItem,itemId);
|
| | | int i = 0;
|
| | | for(i = 0; i < fixedIds.Length; i++)
|
| | | int haveCount = playerPack.GetItemCountByID(PackType.rptItem, itemId);
|
| | | if (haveCount >= needCount)
|
| | | {
|
| | | if(fixedIds[i] == itemId)
|
| | | {
|
| | | if (haveCount >= fixedCounts[i])
|
| | | {
|
| | | itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Green,haveCount.ToString()),
|
| | | "/",fixedCounts[i].ToString());
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Red, haveCount.ToString()),
|
| | | "/", fixedCounts[i].ToString());
|
| | | }
|
| | | break;
|
| | | }
|
| | | itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Green, haveCount.ToString()),
|
| | | "/", needCount);
|
| | | }
|
| | | |
| | | else
|
| | | {
|
| | | itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Red, haveCount.ToString()),
|
| | | "/", needCount);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.countText.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | case SelectItemType.unfixed:
|
| | | putInText = go.transform.Find("PutInText").GetComponent<Text>();
|
| | | RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, NeedMatType.unfixedItem, model.itemInfo.ItemPlace);
|
| | | RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID,0 ,NeedMatType.unfixedItem, model.itemInfo.ItemPlace);
|
| | | break;
|
| | | case SelectItemType.addons:
|
| | | putInText = go.transform.Find("AddRateText").GetComponent<Text>();
|
| | | RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, NeedMatType.addItem, model.itemInfo.ItemPlace);
|
| | | RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, 0,NeedMatType.addItem, model.itemInfo.ItemPlace);
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | posDes.gameObject.SetActive(true);
|
| | | RefreshGridCellUI(gridCell,false,-1,NeedMatType.unfixedItem);
|
| | | RefreshGridCellUI(gridCell,false,-1,0,NeedMatType.unfixedItem);
|
| | | }
|
| | |
|
| | | public void RefreshComposeSuccessRate()
|
| | | {
|
| | | successRate = 0;
|
| | | int increaseRate = 0;
|
| | | if (compoundModel != null)
|
| | | {
|
| | | successRate = compoundModel.successRate;
|
| | | }
|
| | | successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(successRate / 100, "%"));
|
| | | if(isIncreaseRate)
|
| | | {
|
| | | int[] increases = compoundModel.successRateIncrease;
|
| | | if(increases != null && increases.Length > 1)
|
| | | {
|
| | | increaseRate = increases[2] / 100;
|
| | | }
|
| | | }
|
| | | |
| | | if(increaseRate > 0)
|
| | | {
|
| | | successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(successRate / 100, "%","+",increaseRate,"%"));
|
| | | }
|
| | | else
|
| | | {
|
| | | successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(successRate / 100, "%"));
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | private void OnClickOnekeyPutBtn()
|
| | |
| | |
|
| | | private void OnClickComposeBtn()
|
| | | {
|
| | | composeWinModel.SendComposeRequest(compoundModel,fixedItemIndexDict,composeEffect,1);
|
| | | composeWinModel.SendComposeRequest(compoundModel,fixedItemIndexDict,composeEffect,1,10000,isIncreaseRate);
|
| | | }
|
| | |
|
| | | private void OnComposeAnswer(HA814_tagMCMakeItemAnswer answer)
|