Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| | |
| | | }
|
| | | }
|
| | |
|
| | | private bool CheckIsAutoEquip(ItemModel itemModel)
|
| | | public bool CheckIsAutoEquip(ItemModel itemModel)
|
| | | {
|
| | | if (itemModel == null) return false;
|
| | |
|
| | | if (itemModel == null
|
| | | || itemModel.chinItemModel.EquipPlace > 12
|
| | | || itemModel.chinItemModel.EquipPlace == (int)RoleEquipType.retWing
|
| | | || itemModel.chinItemModel.EquipPlace == (int)RoleEquipType.retSpiritAnimal) return false;
|
| | | |
| | | int playerLv = PlayerDatas.Instance.baseData.LV;
|
| | | if (playerLv > autoEquipLvLimit) return false;
|
| | |
|
| | |
| | | [SerializeField]
|
| | | ScrollerController cellCtrl;
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> sourceItemlist = new List<GameObject>();
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> previewItemlist = new List<GameObject>();
|
| | | [Header("固定物品和非固定物品")]
|
| | | [SerializeField] List<ComposeMatCell> fixedAndUnfixeds = new List<ComposeMatCell>();
|
| | | [Header("合成物品")]
|
| | | [SerializeField] List<ComposeMatCell> makeItems = new List<ComposeMatCell>();
|
| | |
|
| | | [SerializeField]
|
| | | Text successRateText;
|
| | |
| | | get { return _composeWinModel ?? (_composeWinModel = ModelCenter.Instance.GetModel<ComposeWinModel>()); }
|
| | | }
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel
|
| | | {
|
| | | get
|
| | | {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | |
|
| | | PlayerPackModel _playerPack;
|
| | | PlayerPackModel playerPack
|
| | | {
|
| | | get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
| | | }
|
| | |
|
| | | GetItemPathModel ItemPathModel
|
| | | {
|
| | | 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>>();
|
| | |
|
| | |
| | | }
|
| | | protected override void BindController()
|
| | | {
|
| | | cellCtrl.OnRefreshCell += RefreshCell;
|
| | | cellCtrl.OnRefreshCell += RefreshTypeCell;
|
| | | cellCtrl.vertical = true;
|
| | | cellCtrl.lockType = EnhanceLockType.KeepVertical;
|
| | | composeWinModel.ResetModelEvent += ResetModel;
|
| | |
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | selectModel.selectEquipEvent += RefreshSelectItem;
|
| | | composeWinModel.UpdateSecondTypeEvent += UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent += UpdateThirdType;
|
| | | composeWinModel.UpdateReduceEvent += UpdateReduce;
|
| | | selectModel.UpdateSelectEvent += UpdateSelect;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnComposeAnswer;
|
| | | UIEventTrigger.Get(helpBtn.gameObject).OnDown = OnClickHelpBtn;
|
| | | UIEventTrigger.Get(helpBtn.gameObject).OnUp = OnDownUp;
|
| | | successRate = 0;
|
| | | firstTypeDict = composeWinModel.GetFirstTypeModel((int)ComposeFuncType.MountDogz);
|
| | | CreateCell();
|
| | | if(curSecondType == 0)
|
| | | {
|
| | | RefreshUI(null);
|
| | | }
|
| | | if (compoundModel != null)
|
| | | {
|
| | | RefreshUI(compoundModel);
|
| | | }
|
| | | Display();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | selectModel.selectEquipEvent -= RefreshSelectItem;
|
| | | composeWinModel.UpdateSecondTypeEvent -= UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent -= UpdateThirdType;
|
| | | composeWinModel.UpdateReduceEvent -= UpdateReduce;
|
| | | selectModel.UpdateSelectEvent -= UpdateSelect;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | private void ResetModel()
|
| | | #region 新的逻辑
|
| | | private void Display()
|
| | | {
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | preSecondType = 0;
|
| | | preThirdType = 0;
|
| | | compoundModel = null;
|
| | | composeWinModel.TryGetFirstTypeData((int)ComposeFuncType.MountDogz, out firstTypeData);
|
| | | if (firstTypeData == null) return;
|
| | |
|
| | | successRate = 0;
|
| | | DefaultSelect();
|
| | | CreateTypeCell();
|
| | | JumpIndex();
|
| | | }
|
| | |
|
| | | private void CreateCell()
|
| | | private void DefaultSelect()
|
| | | {
|
| | | cellCtrl.Refresh();
|
| | |
|
| | | if(curSecondType == 0)
|
| | | bool isJumpTo = false;
|
| | | if (composeWinModel.secondType != 0)
|
| | | {
|
| | | ChangeUIState(true, false);
|
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | |
|
| | | if(firstTypeDict != null)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.MountDogz, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | foreach (int secondType in firstTypeDict.Keys)
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | if (isJumpTo)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Header,secondType);
|
| | | if(secondType == curSecondType)
|
| | | isJumpTo = false;
|
| | | if (!composeWinModel.IsEnoughFixedMat(thirdTypeData.itemCompound) || !composeWinModel.IsEnoughUnfixedMat(thirdTypeData.itemCompound))
|
| | | {
|
| | | foreach (int thirdType in firstTypeDict[secondType].Keys)
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Compose101"));
|
| | | }
|
| | | else if (!composeWinModel.IsEnoughMoney(thirdTypeData.itemCompound))
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Z1011"));
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshUI(null);
|
| | | }
|
| | | }
|
| | |
|
| | | private void CreateTypeCell()
|
| | | {
|
| | | 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)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal, thirdType);
|
| | | }
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal, third);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | cellCtrl.Restart();
|
| | |
|
| | | if (secondTypeDict != null)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.MountDogz, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | if (secondTypeDict.Count >= 1 && curSecondType != 0
|
| | | && curThirdType >= 1)
|
| | | {
|
| | | cellCtrl.JumpIndex(GetCurIndex(curSecondType));
|
| | | }
|
| | | ChangeUIState(false,true);
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshUI(null);
|
| | | ChangeUIState(true,false);
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshTypeCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case ScrollerDataType.Header:
|
| | | ComposeWinModel.ComposeSecondTypeData _secondTypeData = null;
|
| | | ComposeFirstTypeCell firstTypeCell = cell.GetComponent<ComposeFirstTypeCell>();
|
| | | composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.MountDogz, cell.index, out _secondTypeData);
|
| | | if (_secondTypeData != null)
|
| | | {
|
| | | var thirdTypeDict = _secondTypeData.thirdTypeDict;
|
| | | foreach (var third in thirdTypeDict.Keys)
|
| | | {
|
| | | firstTypeCell.SetDisplay((int)ComposeFuncType.MountDogz, cell.index, third, curSecondType);
|
| | | break;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case ScrollerDataType.Normal:
|
| | | ComposeSecondTypeCell secondTypeCell = cell.GetComponent<ComposeSecondTypeCell>();
|
| | | secondTypeCell.SetDisplay((int)ComposeFuncType.MountDogz, curSecondType, cell.index, curThirdType);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | 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;
|
| | | List<int> secondlist = firstTypeDict.Keys.ToList();
|
| | | var secondTypeDict = firstTypeData.secondTypeDict;
|
| | | List<int> secondlist = secondTypeDict.Keys.ToList();
|
| | | for (int i = 0; i < secondlist.Count; i++)
|
| | | {
|
| | | if (secondType == secondlist[i])
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | if (curThirdType >= 4)
|
| | | {
|
| | | curIndex = curIndex + curThirdType - 2;
|
| | | }
|
| | | return curIndex;
|
| | | }
|
| | |
|
| | | private void RefreshCell(ScrollerDataType type, CellView cell)
|
| | | private void UpdateSecondType(int secondType)
|
| | | {
|
| | | 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.MountDogz, 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);
|
| | | RefreshUI(compoundModel);
|
| | | }
|
| | | else
|
| | | {
|
| | | icon.SetSprite("ChildListBtn_UnSelect");
|
| | | }
|
| | | cellBtn.AddListener(() => { OnClickThirdType(cell.index); });
|
| | | break;
|
| | | }
|
| | | curThirdType = 0;
|
| | | curSecondType = secondType;
|
| | | composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.MountDogz, secondType, out secondTypeData);
|
| | | OnClickSecondType();
|
| | | CreateTypeCell();
|
| | | JumpIndex();
|
| | | }
|
| | |
|
| | | private void OnClickSecondType(int secondType)
|
| | | private void OnClickSecondType()
|
| | | {
|
| | | curSecondType = secondType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.MountDogz, curSecondType);
|
| | | if (secondTypeData == null) return;
|
| | |
|
| | | foreach (var thirdType in secondTypeDict.Keys)
|
| | | var thirdTypeDict = secondTypeData.thirdTypeDict;
|
| | | if (curThirdType == 0)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | foreach (var thirdType in thirdTypeDict.Keys)
|
| | | {
|
| | |
|
| | | if (preSecondType == curSecondType)
|
| | | if (thirdType != 0)
|
| | | {
|
| | | curSecondType = 0;
|
| | | preSecondType = 0;
|
| | | if (preSecondType == curSecondType)
|
| | | {
|
| | | curSecondType = 0;
|
| | | preSecondType = 0;
|
| | | }
|
| | | else
|
| | | {
|
| | | curThirdType = thirdType;
|
| | | }
|
| | | }
|
| | | curThirdType = thirdType;
|
| | | break;
|
| | | }
|
| | | else
|
| | | {
|
| | | curThirdType = 0;
|
| | | }
|
| | | break;
|
| | | }
|
| | |
|
| | | if (preSecondType != curSecondType)
|
| | |
| | | preSecondType = curSecondType;
|
| | | selectModel.ClearSelectModel();
|
| | | }
|
| | | |
| | | CreateCell();
|
| | | }
|
| | |
|
| | | private void OnClickThirdType(int thirdType)
|
| | | private void UpdateThirdType(int thirdType)
|
| | | {
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.MountDogz, curSecondType, thirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | bool isTrailer = composeWinModel.IsTrailerByLevel(thirdTypeData.itemCompound);
|
| | | if (isTrailer)
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("FuncOpenLv", thirdTypeData.itemCompound.levelNeed));
|
| | | return;
|
| | | }
|
| | | }
|
| | | curThirdType = thirdType;
|
| | | OnClickThirdType();
|
| | | CreateTypeCell();
|
| | | }
|
| | |
|
| | | private void OnClickThirdType()
|
| | | {
|
| | | if (thirdTypeData == null) return;
|
| | |
|
| | | if (preThirdType != curThirdType)
|
| | | {
|
| | | preThirdType = curThirdType;
|
| | | }
|
| | | CreateCell();
|
| | | selectModel.ClearSelectModel();
|
| | | }
|
| | |
|
| | |
| | | composeEquip.SetActive(isShows[1]);
|
| | | }
|
| | |
|
| | | private void UpdateComposeMat()
|
| | | {
|
| | | int[] makeIds = compoundModel.makeID;
|
| | | for (int i = 0; i < makeItems.Count; i++)
|
| | | {
|
| | | var matCell = makeItems[i];
|
| | | if (makeIds != null && i < makeIds.Length)
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.MakeItem, false, "", makeIds[i]);
|
| | | }
|
| | | else
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.MakeItem, true);
|
| | | }
|
| | | }
|
| | |
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int[] fixedDisplays = compoundModel.itemDisplay;
|
| | | int[] unfixedIds = compoundModel.unfixedItemID;
|
| | | int[] unfixedDisplays = compoundModel.unfixedItemDisplay;
|
| | |
|
| | | for (int i = 0; i < fixedAndUnfixeds.Count; i++)
|
| | | {
|
| | | var matCell = fixedAndUnfixeds[i];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | |
|
| | | for (int i = 0; i < fixedDisplays.Length; i++)
|
| | | {
|
| | | var fixedDisplay = fixedDisplays[i];
|
| | | if (fixedDisplay != 0)
|
| | | {
|
| | | var matCell = fixedAndUnfixeds[fixedDisplay - 1];
|
| | | int fixedId = 0;
|
| | | composeWinModel.TryGetIdByDisplay(NeedMatType.fixedItem, compoundModel, fixedDisplay, out fixedId);
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.fixedItem, false, "", fixedId);
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < unfixedDisplays.Length; i++)
|
| | | {
|
| | | var unfixedDisplay = unfixedDisplays[i];
|
| | | if (unfixedDisplay != 0)
|
| | | {
|
| | | var matCell = fixedAndUnfixeds[unfixedDisplay - 1];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false, UIHelper.ReplaceNewLine(Language.Get("ComposeWin_PutInText_2")));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | private void UpdateSelect(ComposeMatCell matCell, int itemIndex, SelectItemType selectType)
|
| | | {
|
| | | switch (selectType)
|
| | | {
|
| | | case SelectItemType.unfixed:
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false, "", 0, itemIndex);
|
| | | break;
|
| | | case SelectItemType.addons:
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.addItem, false, "", 0, itemIndex);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateReduce(ComposeMatCell matCell, NeedMatType matType)
|
| | | {
|
| | | switch (matType)
|
| | | {
|
| | | case NeedMatType.unfixedItem:
|
| | | matCell.SetDisplay(compoundModel, matType, false, UIHelper.ReplaceNewLine(Language.Get("ComposeWin_PutInText_2")));
|
| | | break;
|
| | | case NeedMatType.addItem:
|
| | | matCell.SetDisplay(compoundModel, matType, false);
|
| | | break;
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | private void ResetModel()
|
| | | {
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | compoundModel = null;
|
| | | if(!WindowJumpMgr.Instance.IsJumpState)
|
| | | {
|
| | | preSecondType = 0;
|
| | | preThirdType = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshUI(ItemCompoundConfig compoundModel)
|
| | | {
|
| | | this.compoundModel = compoundModel;
|
| | |
|
| | | if (compoundModel == null)
|
| | | {
|
| | | ChangeUIState(true, false);
|
| | | int i = 0;
|
| | | for (i = 0; i < previewItemlist.Count; i++)
|
| | | {
|
| | | GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject;
|
| | | gridCell.SetActive(false);
|
| | | }
|
| | |
|
| | | for (i = 0; i < sourceItemlist.Count; i++)
|
| | | {
|
| | | GameObject gridCell = sourceItemlist[i].transform.Find("GridCell").gameObject;
|
| | | Text putInText = sourceItemlist[i].transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = sourceItemlist[i].GetComponent<Button>();
|
| | | posBtn.RemoveAllListeners();
|
| | | putInText.gameObject.SetActive(false);
|
| | | RefreshGridCellUI(gridCell, true);
|
| | | }
|
| | | composeBtn.gameObject.SetActive(false);
|
| | | onekeyPutBtn.gameObject.SetActive(false);
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | ChangeUIState(false, true);
|
| | | composeWinModel.SetCurComposeModel(compoundModel);
|
| | | composeBtn.gameObject.SetActive(true);
|
| | | onekeyPutBtn.gameObject.SetActive(true);
|
| | | ControllerRightUI();
|
| | | UpdateComposeMat();
|
| | | }
|
| | |
|
| | | RefreshComposeSuccessRate();
|
| | | }
|
| | |
|
| | | private void ControllerRightUI()
|
| | | {
|
| | |
|
| | | int i = 0;
|
| | | #region 合成物品UI
|
| | | for (i = 0; i < previewItemlist.Count; i++)
|
| | | {
|
| | | GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject;
|
| | | int[] makeIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id,DisplayItemArray.MakeIds);
|
| | | if(makeIds != null)
|
| | | {
|
| | | if (i < makeIds.Length)
|
| | | {
|
| | | RefreshGridCellUI(gridCell, false, makeIds[i], NeedMatType.MakeItem);
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshGridCellUI(gridCell, true);
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 固定道具和不固定道具UI
|
| | |
|
| | | for(i = 0;i < sourceItemlist.Count; i++)
|
| | | {
|
| | | GameObject gridCell = sourceItemlist[i].transform.Find("GridCell").gameObject;
|
| | | Text putInText = sourceItemlist[i].transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = sourceItemlist[i].GetComponent<Button>();
|
| | | putInText.gameObject.SetActive(false);
|
| | | RefreshGridCellUI(gridCell, true);
|
| | | posBtn.RemoveAllListeners();
|
| | | }
|
| | | fixedItemIndexDict.Clear();
|
| | | int[] fixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedDisplay);
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | int[] unfixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedIds);
|
| | | int[] unfixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedDisplay);
|
| | | for (i = 0; i < fixedDisplay.Length; i++)
|
| | | {
|
| | | if (fixedDisplay[i] != 0)
|
| | | {
|
| | | GameObject matPos = sourceItemlist[fixedDisplay[i] - 1];
|
| | | 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);
|
| | | |
| | | List<int> itemIndexlist = null;
|
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
| | | if (singlePack != null)
|
| | | {
|
| | | itemIndexlist = singlePack.ItemIndexlist(fixedIds[i],fixedCounts[i]);
|
| | | }
|
| | | if (itemIndexlist != null)
|
| | | {
|
| | | fixedItemIndexDict.Add(fixedIds[i], itemIndexlist);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | for (i = 0; i < unfixedDisplay.Length; i++)
|
| | | {
|
| | | if (unfixedDisplay[i] != 0)
|
| | | {
|
| | | GameObject matPos = sourceItemlist[unfixedDisplay[i] - 1];
|
| | | GameObject gridCell = matPos.transform.Find("GridCell").gameObject;
|
| | | Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = matPos.GetComponent<Button>();
|
| | | putInText.gameObject.SetActive(true);
|
| | | RefreshGridCellUI(gridCell, false);
|
| | | posBtn.RemoveAllListeners();
|
| | | posBtn.AddListener(()=> {
|
| | | selectModel.SetAddParent(matPos);
|
| | | selectModel.selectItem = SelectItemType.unfixed;
|
| | | WindowCenter.Instance.Open<SelectItemWin>();
|
| | | });
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | }
|
| | |
|
| | | private void RefreshGridCellUI(GameObject gridCell, bool islock, int itemId = -1,NeedMatType matType = NeedMatType.Nothing,int itemPlace = -1)
|
| | | {
|
| | | gridCell.SetActive(true);
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | if (itemCell == null)
|
| | | itemCell = gridCell.transform.Find("ItemCell").gameObject.AddComponent<ItemCell>();
|
| | |
|
| | | GameObject gridlock = gridCell.transform.Find("GridLock").gameObject;
|
| | | itemCell.cellBtn.onClick.RemoveAllListeners();
|
| | | if (islock)
|
| | | {
|
| | | gridlock.gameObject.SetActive(true);
|
| | | itemCell.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | gridlock.gameObject.SetActive(false);
|
| | | itemCell.gameObject.SetActive(true);
|
| | | ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptItem,itemPlace);
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId);
|
| | | if (itemModel == null)
|
| | | {
|
| | | if(itemId != -1)
|
| | | {
|
| | | ItemCellModel cellModel = new ItemCellModel(itemId);
|
| | | itemCell.Init(cellModel);
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | {
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | }
|
| | | }
|
| | | );
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.gameObject.SetActive(false);
|
| | | }
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.Init(itemModel);
|
| | | |
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | {
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | | });
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | {
|
| | | 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++)
|
| | | {
|
| | | 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;
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.countText.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshSelectItem(ItemModel model, GameObject go, SelectItemType selectType)
|
| | | {
|
| | | GameObject gridCell = go.transform.Find("GridCell").gameObject;
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | Text putInText = null;
|
| | | switch (selectType)
|
| | | {
|
| | | case SelectItemType.unfixed:
|
| | | putInText = go.transform.Find("PutInText").GetComponent<Text>();
|
| | | RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, 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);
|
| | | break;
|
| | | }
|
| | |
|
| | | itemCell.reducebtn.gameObject.SetActive(true);
|
| | | itemCell.reducebtn.RemoveAllListeners();
|
| | |
|
| | | itemCell.reducebtn.AddListener(() => { OnClickReduceBtn(gridCell, putInText,model.itemInfo.ItemPlace, selectType); });
|
| | | putInText.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | private void OnClickReduceBtn(GameObject gridCell,Text posDes,int itemPlace,SelectItemType selectItem)
|
| | | {
|
| | | switch (selectItem)
|
| | | {
|
| | | case SelectItemType.unfixed:
|
| | | selectModel.RemoveHaveUnfixedSelectItem(itemPlace);
|
| | | break;
|
| | | case SelectItemType.addons:
|
| | | selectModel.RemoveHaveAddSelectItem(itemPlace);
|
| | | break;
|
| | | }
|
| | |
|
| | | posDes.gameObject.SetActive(true);
|
| | | RefreshGridCellUI(gridCell,false,-1,NeedMatType.unfixedItem);
|
| | | }
|
| | |
|
| | | public void RefreshComposeSuccessRate()
|
| | |
| | | if (compoundModel == null)
|
| | | return;
|
| | |
|
| | | Dictionary<int,ItemModel> unfixedSelectItemDict = selectModel.GetUnfixedItemModel();
|
| | | int i = 0;
|
| | | for (i = 0; i <sourceItemlist.Count; i++)
|
| | | var unfixedSelectItemDict = selectModel.GetUnfixedItemModel();
|
| | | var unfixeAddDict = selectModel.GetHaveUnfixedSelectItem();
|
| | | int[] unfixedDisplays = compoundModel.unfixedItemDisplay;
|
| | | for (int i = 0; i < unfixedDisplays.Length; i++)
|
| | | {
|
| | | GameObject gridCell = sourceItemlist[i].transform.Find("GridCell").gameObject;
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | GameObject gridlock = gridCell.transform.Find("GridLock").gameObject;
|
| | | foreach (int key in unfixedSelectItemDict.Keys)
|
| | | var unfixedDisplay = unfixedDisplays[i];
|
| | | if (unfixedDisplay != 0)
|
| | | {
|
| | | if(gridCell.activeInHierarchy && !gridlock.activeInHierarchy |
| | | && !itemCell.gameObject.activeInHierarchy)
|
| | | var matCell = fixedAndUnfixeds[unfixedDisplay - 1];
|
| | | if (matCell.itemModel == null)
|
| | | {
|
| | |
|
| | | if (!selectModel.GetHaveUnfixedSelectItem().ContainsKey(key))
|
| | | foreach (var index in unfixedSelectItemDict.Keys)
|
| | | {
|
| | | selectModel.AddHaveUnfixedSelectItem(key);
|
| | | RefreshSelectItem(unfixedSelectItemDict[key], sourceItemlist[i],SelectItemType.unfixed);
|
| | | break;
|
| | | if (!unfixeAddDict.ContainsKey(index))
|
| | | {
|
| | | selectModel.AddHaveUnfixedSelectItem(index);
|
| | | UpdateSelect(matCell, index, SelectItemType.unfixed);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | [SerializeField] GameObject increaseRateItem;
|
| | | [SerializeField] GameObject increaseGridCell;
|
| | | |
| | | [Header("固定物品和非固定物品")]
|
| | | [SerializeField] List<ComposeMatCell> fixedAndUnfixeds = new List<ComposeMatCell>();
|
| | | [Header("合成物品")]
|
| | | [SerializeField] List<ComposeMatCell> makeItems = new List<ComposeMatCell>();
|
| | | [Header("提高成功率")]
|
| | | [SerializeField] ComposeMatCell increaseRateMatCell;
|
| | | [SerializeField] Text increaseText;
|
| | | [SerializeField] PushSwitchBtn switchBtn;
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> sourceItemlist = new List<GameObject>();
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> previewItemlist = new List<GameObject>();
|
| | |
|
| | | [SerializeField]
|
| | | Text successRateText;
|
| | |
| | | get { return _composeWinModel ?? (_composeWinModel = ModelCenter.Instance.GetModel<ComposeWinModel>()); }
|
| | | }
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel
|
| | | {
|
| | | get
|
| | | {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | |
|
| | | PlayerPackModel _playerPack;
|
| | | PlayerPackModel playerPack
|
| | | {
|
| | | get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
| | | }
|
| | |
|
| | | GetItemPathModel ItemPathModel
|
| | | {
|
| | | get { return ModelCenter.Instance.GetModel<GetItemPathModel>(); }
|
| | | }
|
| | | ComposeWinModel.ComposeFirstTypeData firstTypeData;
|
| | | ComposeWinModel.ComposeSecondTypeData secondTypeData;
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData;
|
| | |
| | |
|
| | | composeWinModel.UpdateSecondTypeEvent += UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent += UpdateThirdType;
|
| | | selectModel.selectEquipEvent += RefreshSelectItem;
|
| | | composeWinModel.UpdateReduceEvent += UpdateReduce;
|
| | | selectModel.UpdateSelectEvent += UpdateSelect;
|
| | | composeWinModel.UpdateEquipTypeEvent += UpdateEquipType;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnComposeAnswer;
|
| | | UIEventTrigger.Get(helpBtn.gameObject).OnDown = OnClickHelpBtn;
|
| | | UIEventTrigger.Get(helpBtn.gameObject).OnUp = OnDownUp;
|
| | |
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | selectModel.selectEquipEvent -= RefreshSelectItem;
|
| | | composeWinModel.UpdateReduceEvent -= UpdateReduce;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer;
|
| | | composeWinModel.UpdateSecondTypeEvent -= UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent -= UpdateThirdType;
|
| | | selectModel.UpdateSelectEvent -= UpdateSelect;
|
| | | composeWinModel.UpdateEquipTypeEvent -= UpdateEquipType;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | #region 新的逻辑
|
| | | private void Display()
|
| | | {
|
| | |
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | |
|
| | | //CreateCell();
|
| | | if (compoundModel != null)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | RefreshUI(compoundModel);
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | if (isJumpTo)
|
| | | {
|
| | | isJumpTo = false;
|
| | | if (!composeWinModel.IsEnoughFixedMat(compoundModel) || !composeWinModel.IsEnoughUnfixedMat(compoundModel))
|
| | | if (!composeWinModel.IsEnoughFixedMat(thirdTypeData.itemCompound) || !composeWinModel.IsEnoughUnfixedMat(thirdTypeData.itemCompound))
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Compose101"));
|
| | | }
|
| | | else if (!composeWinModel.IsEnoughMoney(compoundModel))
|
| | | else if (!composeWinModel.IsEnoughMoney(thirdTypeData.itemCompound))
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Z1011"));
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | cellCtrl.Restart();
|
| | |
|
| | | if (curThirdType != 0)
|
| | | {
|
| | | CreateEquipTypeLineCell();
|
| | | 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]);
|
| | |
| | | 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;
|
| | | }
|
| | |
| | | case ScrollerDataType.Normal:
|
| | | ComposeSecondTypeCell secondTypeCell = cell.GetComponent<ComposeSecondTypeCell>();
|
| | | secondTypeCell.SetDisplay((int)ComposeFuncType.Equip, curSecondType, cell.index, curThirdType);
|
| | | if(curThirdType == cell.index)
|
| | | {
|
| | | CreateEquipTypeLineCell();
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | curIndex = i;
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (curThirdType >= 4)
|
| | | {
|
| | | curIndex = curIndex + curThirdType - 2;
|
| | | }
|
| | | return curIndex;
|
| | | }
|
| | |
| | | if (thirdTypeDatas.Count > 0)
|
| | | {
|
| | | ItemCompoundConfig tagItemCompound = thirdTypeDatas[0].itemCompound;
|
| | | ClickEquipTypeCell(tagItemCompound, 0);
|
| | | UpdateEquipType(tagItemCompound,0);
|
| | | RefreshUI(tagItemCompound);
|
| | | ChangeUIState(false, false, true);
|
| | | }
|
| | | }
|
| | |
|
| | | if (curComposeEquipIndex != -1)
|
| | | {
|
| | | ItemCompoundConfig tagItemCompound = thirdTypeDatas[curComposeEquipIndex].itemCompound;
|
| | | ClickEquipTypeCell(tagItemCompound, curComposeEquipIndex);
|
| | | UpdateEquipType(tagItemCompound, curComposeEquipIndex);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | composeEquip.SetActive(isShows[2]);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | private void ResetModel()
|
| | | private void UpdateComposeMat()
|
| | | {
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | preSecondType = 0;
|
| | | preThirdType = 0;
|
| | | curComposeEquipIndex = -1;
|
| | | compoundModel = null;
|
| | | }
|
| | |
|
| | | 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++)
|
| | | int[] makeIds = compoundModel.makeID;
|
| | | for (int i = 0; i < makeItems.Count; i++)
|
| | | {
|
| | | GameObject typeCell = cell.transform.GetChild(i).gameObject;
|
| | | int index = (cell.transform.childCount) * cell.index + i;
|
| | | if(index < thirdTypeDatas.Count)
|
| | | var matCell = makeItems[i];
|
| | | if (makeIds != null && i < makeIds.Length)
|
| | | {
|
| | | typeCell.SetActive(true);
|
| | | 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>();
|
| | | Button cellBtn = typeCell.GetComponent<Button>();
|
| | | icon.SetSprite(tagChinItem.IconKey);
|
| | | bgIcon.SetItemBackGround(tagChinItem.ItemColor);
|
| | | nameText.text = GeneralDefine.equipPlaceNameDict[tagChinItem.EquipPlace];
|
| | | cellBtn.RemoveAllListeners();
|
| | | cellBtn.AddListener(()=> {
|
| | | ClickEquipTypeCell(tagItemCompound,index);
|
| | | RefreshUI(tagItemCompound);
|
| | | });
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.MakeItem, false, "", makeIds[i]);
|
| | | }
|
| | | else
|
| | | {
|
| | | typeCell.SetActive(false);
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.MakeItem, true);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int[] fixedDisplays = compoundModel.itemDisplay;
|
| | | int[] unfixedIds = compoundModel.unfixedItemID;
|
| | | int[] unfixedDisplays = compoundModel.unfixedItemDisplay;
|
| | |
|
| | | private void ClickEquipTypeCell(ItemCompoundConfig tagItemCompound,int index)
|
| | | {
|
| | | curComposeEquipIndex = index;
|
| | | ChangeUIState(false, false, true);
|
| | | RefreshComposeSuccessRate();
|
| | | }
|
| | |
|
| | | |
| | | private void RefreshUI(ItemCompoundConfig compoundModel)
|
| | | {
|
| | | this.compoundModel = compoundModel;
|
| | |
|
| | | if (compoundModel == null)
|
| | | for(int i = 0; i < fixedAndUnfixeds.Count; i++)
|
| | | {
|
| | |
|
| | | int i = 0;
|
| | | for (i = 0; i < previewItemlist.Count; i++)
|
| | | {
|
| | | GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject;
|
| | | gridCell.SetActive(false);
|
| | | }
|
| | |
|
| | | for (i = 0; i < sourceItemlist.Count; i++)
|
| | | {
|
| | | GameObject gridCell = sourceItemlist[i].transform.Find("GridCell").gameObject;
|
| | | Text putInText = sourceItemlist[i].transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = sourceItemlist[i].GetComponent<Button>();
|
| | | posBtn.RemoveAllListeners();
|
| | | putInText.gameObject.SetActive(false);
|
| | | RefreshGridCellUI(gridCell, true);
|
| | | }
|
| | | composeBtn.gameObject.SetActive(false);
|
| | | onekeyPutBtn.gameObject.SetActive(false);
|
| | | |
| | | var matCell = fixedAndUnfixeds[i];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | | else
|
| | |
|
| | | for(int i = 0; i < fixedDisplays.Length; i++)
|
| | | {
|
| | | composeWinModel.SetCurComposeModel(compoundModel);
|
| | | composeBtn.gameObject.SetActive(true);
|
| | | onekeyPutBtn.gameObject.SetActive(true);
|
| | | ControllerRightUI();
|
| | | }
|
| | |
|
| | | RefreshComposeSuccessRate();
|
| | | }
|
| | |
|
| | | private void ControllerRightUI()
|
| | | {
|
| | |
|
| | | int i = 0;
|
| | | #region 合成物品UI
|
| | | for (i = 0; i < previewItemlist.Count; i++)
|
| | | {
|
| | | int[] makeIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.MakeIds);
|
| | | GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject;
|
| | | if (i < makeIds.Length)
|
| | | var fixedDisplay = fixedDisplays[i];
|
| | | if(fixedDisplay != 0)
|
| | | {
|
| | | RefreshGridCellUI(gridCell, false, makeIds[i],0,NeedMatType.MakeItem);
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshGridCellUI(gridCell,true);
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 固定道具和不固定道具UI
|
| | | int[] fixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedDisplay);
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | int[] unfixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedIds);
|
| | | int[] unfixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedDisplay);
|
| | | for (i = 0;i < sourceItemlist.Count; i++)
|
| | | {
|
| | | GameObject gridCell = sourceItemlist[i].transform.Find("GridCell").gameObject;
|
| | | Text putInText = sourceItemlist[i].transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = sourceItemlist[i].GetComponent<Button>();
|
| | | putInText.gameObject.SetActive(false);
|
| | | RefreshGridCellUI(gridCell, true);
|
| | | posBtn.RemoveAllListeners();
|
| | | }
|
| | | fixedItemIndexDict.Clear();
|
| | | for (i = 0; i < fixedDisplay.Length; i++)
|
| | | {
|
| | | if (fixedDisplay[i] != 0)
|
| | | {
|
| | | GameObject matPos = sourceItemlist[fixedDisplay[i] - 1];
|
| | | GameObject gridCell = matPos.transform.Find("GridCell").gameObject;
|
| | | Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>();
|
| | | putInText.gameObject.SetActive(false);
|
| | | RefreshGridCellUI(gridCell,false,fixedIds[i],fixedCounts[i],NeedMatType.fixedItem);
|
| | | |
| | | List<int> itemIndexlist = null;
|
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
| | | if (singlePack != null)
|
| | | {
|
| | | itemIndexlist = singlePack.ItemIndexlist(fixedIds[i],fixedCounts[i]);
|
| | | }
|
| | | if (itemIndexlist != null)
|
| | | {
|
| | | fixedItemIndexDict.Add(fixedIds[i], itemIndexlist);
|
| | | }
|
| | | var matCell = fixedAndUnfixeds[fixedDisplay -1];
|
| | | int fixedId = 0;
|
| | | composeWinModel.TryGetIdByDisplay(NeedMatType.fixedItem, compoundModel, fixedDisplay, out fixedId);
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.fixedItem, false, "", fixedId);
|
| | | }
|
| | | }
|
| | |
|
| | | for (i = 0; i < unfixedDisplay.Length; i++)
|
| | | for (int i = 0; i < unfixedDisplays.Length; i++)
|
| | | {
|
| | | if (unfixedDisplay[i] != 0)
|
| | | var unfixedDisplay = unfixedDisplays[i];
|
| | | if (unfixedDisplay != 0)
|
| | | {
|
| | | GameObject matPos = sourceItemlist[unfixedDisplay[i] - 1];
|
| | | GameObject gridCell = matPos.transform.Find("GridCell").gameObject;
|
| | | Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = matPos.GetComponent<Button>();
|
| | | putInText.gameObject.SetActive(true);
|
| | | RefreshGridCellUI(gridCell, false);
|
| | | posBtn.RemoveAllListeners();
|
| | | posBtn.AddListener(()=> {
|
| | | selectModel.SetAddParent(matPos);
|
| | | selectModel.selectItem = SelectItemType.unfixed;
|
| | | WindowCenter.Instance.Open<SelectItemWin>();
|
| | | });
|
| | | var matCell = fixedAndUnfixeds[unfixedDisplay - 1];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false, UIHelper.ReplaceNewLine(Language.Get("ComposeWin_PutInText_2")));
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 提升合成成功率
|
| | | int[] increases = compoundModel.successRateIncrease;
|
| | | if(increases == null || increases.Length < 2)
|
| | | if (increases == null || increases.Length < 2)
|
| | | {
|
| | | isIncreaseRate = false;
|
| | | increaseRateItem.SetActive(isIncreaseRate);
|
| | | increaseRateMatCell.gameObject.SetActive(isIncreaseRate);
|
| | | }
|
| | | else
|
| | | {
|
| | | int increaseId = increases[0];
|
| | | int increaseNeedNum = increases[1];
|
| | | int increaseRate = increases[2] / 100;
|
| | | increaseRateItem.SetActive(true);
|
| | | RefreshGridCellUI(increaseGridCell, false,increaseId,increaseNeedNum,NeedMatType.IncreaseItem);
|
| | | increaseRateMatCell.gameObject.SetActive(true);
|
| | | increaseRateMatCell.SetDisplay(compoundModel,NeedMatType.IncreaseItem,false,"",increaseId);
|
| | | increaseText.text = Language.Get("Compose109", 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(()=>
|
| | | switchBtn.switchBtn.AddListener(() =>
|
| | | {
|
| | | if (switchBtn.onObj.activeInHierarchy)
|
| | | {
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if(haveIncreaseNum >= increaseNeedNum)
|
| | | if (haveIncreaseNum >= increaseNeedNum)
|
| | | {
|
| | | isIncreaseRate = true;
|
| | | switchBtn.RefreshSwitchUI(true);
|
| | | }
|
| | | else
|
| | | else
|
| | | {
|
| | | isIncreaseRate = false;
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Compose110", increaseNeedNum, itemConfig.ItemName));
|
| | |
| | | RefreshComposeSuccessRate();
|
| | | });
|
| | | }
|
| | | #endregion
|
| | |
|
| | | }
|
| | |
|
| | | private void RefreshGridCellUI(GameObject gridCell, bool islock, int itemId = -1,int needCount = 0,NeedMatType matType = NeedMatType.Nothing,int itemPlace = -1)
|
| | |
|
| | | private void UpdateSelect(ComposeMatCell matCell, int itemIndex, SelectItemType selectType)
|
| | | {
|
| | | gridCell.SetActive(true);
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | if (itemCell == null)
|
| | | itemCell = gridCell.transform.Find("ItemCell").gameObject.AddComponent<ItemCell>();
|
| | |
|
| | | GameObject gridlock = gridCell.transform.Find("GridLock").gameObject;
|
| | | itemCell.cellBtn.onClick.RemoveAllListeners();
|
| | | if (islock)
|
| | | {
|
| | | gridlock.gameObject.SetActive(true);
|
| | | itemCell.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | gridlock.gameObject.SetActive(false);
|
| | | itemCell.gameObject.SetActive(true);
|
| | | ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptItem,itemPlace);
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId);
|
| | | if (itemModel == null)
|
| | | {
|
| | | if(itemId != -1)
|
| | | {
|
| | | ItemCellModel cellModel = new ItemCellModel(itemId);
|
| | | itemCell.Init(cellModel);
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | ItemAttrData attrData = null;
|
| | | switch (matType)
|
| | | {
|
| | | case NeedMatType.IncreaseItem:
|
| | | case NeedMatType.fixedItem:
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | }
|
| | | break;
|
| | | case NeedMatType.unfixedItem:
|
| | | case NeedMatType.addItem:
|
| | | case NeedMatType.Nothing:
|
| | | case NeedMatType.MakeItem:
|
| | | attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | break;
|
| | | |
| | | }
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.Init(itemModel);
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | switch (matType)
|
| | | {
|
| | | case NeedMatType.IncreaseItem:
|
| | | case NeedMatType.fixedItem:
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | | break;
|
| | | case NeedMatType.unfixedItem:
|
| | | case NeedMatType.addItem:
|
| | | case NeedMatType.Nothing:
|
| | | case NeedMatType.MakeItem:
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | break;
|
| | |
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | if(needCount > 0)
|
| | | {
|
| | | itemCell.countText.gameObject.SetActive(true);
|
| | | int haveCount = playerPack.GetItemCountByID(PackType.rptItem, itemId);
|
| | | if (haveCount >= needCount)
|
| | | {
|
| | | 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);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshSelectItem(ItemModel model, GameObject go, SelectItemType selectType)
|
| | | {
|
| | | GameObject gridCell = go.transform.Find("GridCell").gameObject;
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | Text putInText = null;
|
| | | switch (selectType)
|
| | | {
|
| | | case SelectItemType.unfixed:
|
| | | putInText = go.transform.Find("PutInText").GetComponent<Text>();
|
| | | RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID,0 ,NeedMatType.unfixedItem, model.itemInfo.ItemPlace);
|
| | | matCell.SetDisplay(compoundModel,NeedMatType.unfixedItem,false,"",0,itemIndex);
|
| | | break;
|
| | | case SelectItemType.addons:
|
| | | putInText = go.transform.Find("AddRateText").GetComponent<Text>();
|
| | | RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, 0,NeedMatType.addItem, model.itemInfo.ItemPlace);
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.addItem, false, "", 0, itemIndex);
|
| | | break;
|
| | | }
|
| | |
|
| | | itemCell.reducebtn.gameObject.SetActive(true);
|
| | | itemCell.reducebtn.RemoveAllListeners();
|
| | |
|
| | | itemCell.reducebtn.AddListener(() => { OnClickReduceBtn(gridCell, putInText,model.itemInfo.ItemPlace, selectType); });
|
| | | putInText.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | private void OnClickReduceBtn(GameObject gridCell,Text posDes,int itemPlace,SelectItemType selectItem)
|
| | | private void UpdateReduce(ComposeMatCell matCell,NeedMatType matType)
|
| | | {
|
| | | switch (selectItem)
|
| | | switch (matType)
|
| | | {
|
| | | case SelectItemType.unfixed:
|
| | | selectModel.RemoveHaveUnfixedSelectItem(itemPlace);
|
| | | case NeedMatType.unfixedItem:
|
| | | matCell.SetDisplay(compoundModel,matType, false, UIHelper.ReplaceNewLine(Language.Get("ComposeWin_PutInText_2")));
|
| | | break;
|
| | | case SelectItemType.addons:
|
| | | selectModel.RemoveHaveAddSelectItem(itemPlace);
|
| | | case NeedMatType.addItem:
|
| | | matCell.SetDisplay(compoundModel, matType, false);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | posDes.gameObject.SetActive(true);
|
| | | RefreshGridCellUI(gridCell,false,-1,0,NeedMatType.unfixedItem);
|
| | |
|
| | | private void UpdateEquipType(ItemCompoundConfig itemCompound, int equipIndex)
|
| | | {
|
| | | curComposeEquipIndex = equipIndex;
|
| | | ChangeUIState(false, false, true);
|
| | | RefreshComposeSuccessRate();
|
| | | RefreshUI(itemCompound);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | private void ResetModel()
|
| | | {
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | compoundModel = null;
|
| | | if (!WindowJumpMgr.Instance.IsJumpState)
|
| | | {
|
| | | curComposeEquipIndex = -1;
|
| | | preSecondType = 0;
|
| | | preThirdType = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshEquipTypeLineCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | List<ComposeWinModel.ComposeThirdTypeData> thirdTypeDatas = null;
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType, curThirdType, out thirdTypeDatas);
|
| | | EquipTypeLineCell typeLineCell = cell.GetComponent<EquipTypeLineCell>();
|
| | | typeLineCell.Refresh(cell,thirdTypeDatas);
|
| | | }
|
| | | |
| | | private void RefreshUI(ItemCompoundConfig compoundModel)
|
| | | {
|
| | | this.compoundModel = compoundModel;
|
| | | if (compoundModel == null)
|
| | | {
|
| | | composeBtn.gameObject.SetActive(false);
|
| | | onekeyPutBtn.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | composeWinModel.SetCurComposeModel(compoundModel);
|
| | | composeBtn.gameObject.SetActive(true);
|
| | | onekeyPutBtn.gameObject.SetActive(true);
|
| | | UpdateComposeMat();
|
| | | }
|
| | |
|
| | | RefreshComposeSuccessRate();
|
| | | }
|
| | |
|
| | | public void RefreshComposeSuccessRate()
|
| | |
| | | if (compoundModel == null)
|
| | | return;
|
| | |
|
| | | Dictionary<int,ItemModel> unfixedSelectItemDict = selectModel.GetUnfixedItemModel();
|
| | | int i = 0;
|
| | | for (i = 0; i <sourceItemlist.Count; i++)
|
| | | var unfixedSelectItemDict = selectModel.GetUnfixedItemModel();
|
| | | var unfixeAddDict = selectModel.GetHaveUnfixedSelectItem();
|
| | | int[] unfixedDisplays = compoundModel.unfixedItemDisplay;
|
| | | for (int i = 0; i < unfixedDisplays.Length; i++)
|
| | | {
|
| | | GameObject gridCell = sourceItemlist[i].transform.Find("GridCell").gameObject;
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | GameObject gridlock = gridCell.transform.Find("GridLock").gameObject;
|
| | | foreach (int key in unfixedSelectItemDict.Keys)
|
| | | var unfixedDisplay = unfixedDisplays[i];
|
| | | if (unfixedDisplay != 0)
|
| | | {
|
| | | if(gridCell.activeInHierarchy && !gridlock.activeInHierarchy |
| | | && !itemCell.gameObject.activeInHierarchy)
|
| | | var matCell = fixedAndUnfixeds[unfixedDisplay - 1];
|
| | | if (matCell.itemModel == null)
|
| | | {
|
| | |
|
| | | if (!selectModel.GetHaveUnfixedSelectItem().ContainsKey(key))
|
| | | foreach (var index in unfixedSelectItemDict.Keys)
|
| | | {
|
| | | selectModel.AddHaveUnfixedSelectItem(key);
|
| | | RefreshSelectItem(unfixedSelectItemDict[key], sourceItemlist[i],SelectItemType.unfixed);
|
| | | break;
|
| | | if (!unfixeAddDict.ContainsKey(index))
|
| | | {
|
| | | selectModel.AddHaveUnfixedSelectItem(index);
|
| | | UpdateSelect(matCell, index, SelectItemType.unfixed);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | [SerializeField] Transform arrowImg;
|
| | | [SerializeField] Text unlockTypeName;
|
| | | [SerializeField] Button typeBtn;
|
| | | [SerializeField] RedpointBehaviour redpoint;
|
| | |
|
| | | ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } }
|
| | |
|
| | |
| | | unlockTypeName.text = itemCompound.secondTypeName;
|
| | | arrowImg.gameObject.SetActive(thirdType != 0);
|
| | | UpdateBtnImg(selectSecondType);
|
| | | if (composeModel.secondTypeRedDict.ContainsKey(secondType))
|
| | | {
|
| | | redpoint.gameObject.SetActive(true);
|
| | | redpoint.redpointId = composeModel.secondTypeRedDict[secondType].id;
|
| | | }
|
| | | else
|
| | | {
|
| | | redpoint.gameObject.SetActive(false);
|
| | | }
|
| | | typeBtn.RemoveAllListeners();
|
| | | typeBtn.AddListener(ClickTypeBtn);
|
| | | }
|
| | |
| | | public class ComposeMatCell : MonoBehaviour
|
| | | {
|
| | | [SerializeField] Button selectBtn;
|
| | | [SerializeField] ItemCell itemCell;
|
| | | [SerializeField] public ItemCell itemCell;
|
| | | [SerializeField] GameObject lockObj;
|
| | | [SerializeField] Text desText;
|
| | |
|
| | | NeedMatType matType = NeedMatType.Nothing;
|
| | | int itemId = 0;
|
| | | ItemModel itemModel;
|
| | | string matDes = string.Empty;
|
| | | public ItemModel itemModel { get; private set;}
|
| | | ItemCompoundConfig itemCompound;
|
| | | PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
|
| | | GetItemPathModel pathModel { get { return ModelCenter.Instance.GetModel<GetItemPathModel>(); } }
|
| | | ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
| | | SelectEquipModel selectModel {get { return ModelCenter.Instance.GetModel<SelectEquipModel>(); }}
|
| | | ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } }
|
| | |
|
| | | public void SetDisplay(ItemCompoundConfig _itemCompound,NeedMatType _matType,bool isLock,string des = "", int _itemId = 0,int _itemIndex = -1)
|
| | | {
|
| | | this.itemCompound = _itemCompound;
|
| | | this.itemModel = playerPack.GetItemModelByIndex(PackType.rptItem, _itemIndex);
|
| | | this.matType = _matType;
|
| | | this.itemId = _itemId;
|
| | | matDes = des;
|
| | | desText.gameObject.SetActive(des != "" && !string.IsNullOrEmpty(des));
|
| | | desText.text = des;
|
| | | this.itemModel = playerPack.GetItemModelByIndex(PackType.rptItem,_itemIndex);
|
| | | lockObj.SetActive(isLock);
|
| | | bool isShowMat = _itemId != 0 || itemModel != null ? true : false;
|
| | | UpdateItemCell();
|
| | | UpdateMatCount();
|
| | | selectBtn.RemoveAllListeners();
|
| | | selectBtn.AddListener(ClickSelect);
|
| | | }
|
| | |
|
| | | private void UpdateItemCell()
|
| | | {
|
| | | bool isShowMat = itemId != 0 || itemModel != null ? true : false;
|
| | | itemCell.gameObject.SetActive(isShowMat);
|
| | | itemCell.cellBtn.RemoveAllListeners();
|
| | | if(isShowMat)
|
| | | itemCell.reducebtn.RemoveAllListeners();
|
| | | if (isShowMat)
|
| | | {
|
| | | if(itemModel != null)
|
| | | if (itemModel != null)
|
| | | {
|
| | | itemCell.Init(itemModel);
|
| | | itemCell.cellBtn.AddListener(ClickItemCell);
|
| | |
| | | itemCell.Init(cellModel);
|
| | | itemCell.cellBtn.AddListener(ClickItemCell);
|
| | | }
|
| | |
|
| | | switch(matType)
|
| | | {
|
| | | case NeedMatType.unfixedItem:
|
| | | case NeedMatType.addItem:
|
| | | itemCell.reducebtn.gameObject.SetActive(true);
|
| | | itemCell.reducebtn.AddListener(ClickReduce);
|
| | | break;
|
| | | }
|
| | | }
|
| | | UpdateMatCount();
|
| | | selectBtn.RemoveAllListeners();
|
| | | selectBtn.AddListener(ClickSelect);
|
| | | }
|
| | |
|
| | | private void UpdateMatCount()
|
| | |
| | | WindowCenter.Instance.Open<SelectItemWin>();
|
| | | }
|
| | |
|
| | | private void ClickReduce()
|
| | | {
|
| | | if (itemModel == null) return;
|
| | |
|
| | | switch (matType)
|
| | | {
|
| | | case NeedMatType.unfixedItem:
|
| | | selectModel.RemoveHaveUnfixedSelectItem(itemModel.itemInfo.ItemPlace);
|
| | | break;
|
| | | case NeedMatType.addItem:
|
| | | selectModel.RemoveHaveAddSelectItem(itemModel.itemInfo.ItemPlace);
|
| | | break;
|
| | | }
|
| | | composeModel.UpdateReduce(this,matType);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | [SerializeField] Text lockTypeName;
|
| | | [SerializeField] Text lockLevel;
|
| | | [SerializeField] Button typeBtn;
|
| | | [SerializeField] RedpointBehaviour redpoint;
|
| | |
|
| | | ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } }
|
| | |
|
| | |
| | | unlockTypeName.text = itemCompound.thirdTypeName;
|
| | | lockTypeName.text = itemCompound.thirdTypeName;
|
| | | lockLevel.text = StringUtility.Contact(itemCompound.levelNeed,Language.Get("Z1041"));
|
| | | string key = StringUtility.Contact(secondType, 10,thirdType);
|
| | | if (composeModel.thirdTypeRedDict.ContainsKey(key))
|
| | | {
|
| | | redpoint.gameObject.SetActive(true);
|
| | | redpoint.redpointId = composeModel.thirdTypeRedDict[key].id;
|
| | | }
|
| | | else
|
| | | {
|
| | | redpoint.gameObject.SetActive(false);
|
| | | }
|
| | | UpdateBtnImg(selectThirdType);
|
| | | typeBtn.RemoveAllListeners();
|
| | | typeBtn.AddListener(ClickTypeBtn);
|
| | |
| | | composeWinModel.UpdateSecondTypeEvent += UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent += UpdateThirdType;
|
| | | Display();
|
| | | //firstTypeDict = composeWinModel.GetFirstTypeModel((int)ComposeFuncType.Ticket);
|
| | | //bool isJumpTo = false;
|
| | | //if (AchievementGoto.guideAchievementId != 0)
|
| | | //{
|
| | | // SuccessConfig successConfig = Config.Instance.Get<SuccessConfig>(AchievementGoto.guideAchievementId);
|
| | | // if (successConfig.Type == 69)
|
| | | // {
|
| | | // isJumpTo = true;
|
| | | // curSecondType = composeWinModel.secondType;
|
| | | // curThirdType = composeWinModel.thirdType;
|
| | | // secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Ticket, composeWinModel.secondType);
|
| | | // ClickSecondTypeUICtrl();
|
| | | // composeWinModel.ResetJumpToModel();
|
| | | // }
|
| | |
|
| | | //}
|
| | | //else
|
| | | //{
|
| | | // if(composeWinModel.secondType != 0)
|
| | | // {
|
| | | // isJumpTo = true;
|
| | | // curSecondType = composeWinModel.secondType;
|
| | | // curThirdType = composeWinModel.thirdType;
|
| | | // secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Ticket,composeWinModel.secondType);
|
| | | // ClickSecondTypeUICtrl();
|
| | | // composeWinModel.ResetJumpToModel();
|
| | | // }
|
| | | //}
|
| | | //CreateCell();
|
| | | //if (curSecondType == 0)
|
| | | //{
|
| | | // RefreshUI(null);
|
| | | //}
|
| | |
|
| | | //if (compoundModel != null)
|
| | | //{
|
| | | // RefreshUI(compoundModel);
|
| | | // if (isJumpTo)
|
| | | // {
|
| | | // isJumpTo = false;
|
| | | // bool isCanCompose = true;
|
| | | // if (!composeWinModel.IsEnoughFixedMat(compoundModel) || !composeWinModel.IsEnoughUnfixedMat(compoundModel))
|
| | | // {
|
| | | // MessageWin.Inst.ShowFixedTip(Language.Get("Compose101"));
|
| | | // isCanCompose = false;
|
| | | // }
|
| | | // else if (!composeWinModel.IsEnoughMoney(compoundModel))
|
| | | // {
|
| | | // MessageWin.Inst.ShowFixedTip(Language.Get("Z1011"));
|
| | | // isCanCompose = false;
|
| | | // }
|
| | |
|
| | | // if (isCanCompose)
|
| | | // {
|
| | | // guidEffect = AchievementGuideEffectPool.Require(1);
|
| | | // guidEffect.transform.SetParentEx(composeBtn.transform, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | // }
|
| | | // }
|
| | | //}
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | #region 新的逻辑
|
| | | private void Display()
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | | cellCtrl.Restart();
|
| | | if (curSecondType != 0)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Ticket, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Ticket, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | var fixItemIds = thirdTypeData.itemCompound.itemID;
|
| | | if (fixItemIds != null)
|
| | | {
|
| | | var fixItemIds = thirdTypeData.itemCompound.itemID;
|
| | | if(fixItemIds != null)
|
| | | if (fixItemIds.Length < 2)
|
| | | {
|
| | | if(fixItemIds.Length < 2)
|
| | | {
|
| | | UpdateUIShow(true,false,true,false);
|
| | | }
|
| | | else
|
| | | {
|
| | | UpdateUIShow(true, false, false, true);
|
| | | }
|
| | | |
| | | UpdateUIShow(true, false, true, false);
|
| | | }
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | else
|
| | | {
|
| | | UpdateUIShow(true, false, false, true);
|
| | | }
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshUI(null);
|
| | | UpdateUIShow(false, true, false, false);
|
| | | }
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | if (curThirdType >= 4)
|
| | | {
|
| | | curIndex = curIndex + curThirdType - 2;
|
| | | }
|
| | | return curIndex;
|
| | | }
|
| | |
|
| | |
| | | var thirdTypeDict = _secondTypeData.thirdTypeDict;
|
| | | foreach (var third in thirdTypeDict.Keys)
|
| | | {
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData = null;
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Ticket, cell.index, third, out thirdTypeData);
|
| | | firstTypeCell.SetDisplay((int)ComposeFuncType.Ticket, cell.index, third, curSecondType);
|
| | | break;
|
| | | }
|
| | |
| | | case ScrollerDataType.Normal:
|
| | | ComposeSecondTypeCell secondTypeCell = cell.GetComponent<ComposeSecondTypeCell>();
|
| | | secondTypeCell.SetDisplay((int)ComposeFuncType.Ticket, curSecondType, cell.index, curThirdType);
|
| | | if (curThirdType == cell.index)
|
| | | {
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData = null;
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Ticket, curSecondType, cell.index,out thirdTypeData);
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | for (int i = 0; i < oneMatFixedAndUnfixeds.Count; i++)
|
| | | {
|
| | | var matCell = oneMatFixedAndUnfixeds[i];
|
| | | var fixedDisplay = 0;
|
| | | var unfixedDisplay = 0;
|
| | | if (i < fixedDisplays.Length)
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | |
|
| | | for (int i = 0; i < fixedDisplays.Length; i++)
|
| | | {
|
| | | var fixedDisplay = fixedDisplays[i];
|
| | | if (fixedDisplay != 0)
|
| | | {
|
| | | fixedDisplay = fixedDisplays[i];
|
| | | }
|
| | | else
|
| | | {
|
| | | int unfixedIndex = i - fixedDisplays.Length;
|
| | | if (unfixedIndex < unfixedDisplays.Length)
|
| | | {
|
| | | unfixedDisplay = unfixedDisplays[unfixedIndex];
|
| | | }
|
| | | }
|
| | | |
| | | if (fixedDisplays != null
|
| | | && fixedDisplay != 0
|
| | | && fixedDisplays.Contains(fixedDisplay))
|
| | | {
|
| | | var matCell = oneMatFixedAndUnfixeds[fixedDisplay - 1];
|
| | | int fixedId = 0;
|
| | | composeWinModel.TryGetIdByDisplay(NeedMatType.fixedItem, compoundModel, fixedDisplay, out fixedId);
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.fixedItem, false, "", fixedId);
|
| | | }
|
| | | else if (unfixedDisplays != null
|
| | | && unfixedDisplay != 0
|
| | | && unfixedDisplays.Contains(unfixedDisplay))
|
| | | }
|
| | |
|
| | | for (int i = 0; i < unfixedDisplays.Length; i++)
|
| | | {
|
| | | var unfixedDisplay = unfixedDisplays[i];
|
| | | if (unfixedDisplay != 0)
|
| | | {
|
| | | var matCell = oneMatFixedAndUnfixeds[unfixedDisplay - 1];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false);
|
| | | }
|
| | | else
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | for (int i = 0; i < twoMatFixedAndUnfixeds.Count; i++)
|
| | | {
|
| | | var matCell = twoMatFixedAndUnfixeds[i];
|
| | | var fixedDisplay = 0;
|
| | | var unfixedDisplay = 0;
|
| | | if (i < fixedDisplays.Length)
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | |
|
| | | for (int i = 0; i < fixedDisplays.Length; i++)
|
| | | {
|
| | | var fixedDisplay = fixedDisplays[i];
|
| | | if (fixedDisplay != 0)
|
| | | {
|
| | | fixedDisplay = fixedDisplays[i];
|
| | | }
|
| | | else
|
| | | {
|
| | | int unfixedIndex = i - fixedDisplays.Length;
|
| | | if (unfixedIndex < unfixedDisplays.Length)
|
| | | {
|
| | | unfixedDisplay = unfixedDisplays[unfixedIndex];
|
| | | }
|
| | | }
|
| | | |
| | | if (fixedDisplays != null
|
| | | && fixedDisplay != 0
|
| | | && fixedDisplays.Contains(fixedDisplay))
|
| | | {
|
| | | var matCell = twoMatFixedAndUnfixeds[fixedDisplay - 1];
|
| | | int fixedId = 0;
|
| | | composeWinModel.TryGetIdByDisplay(NeedMatType.fixedItem, compoundModel, fixedDisplay, out fixedId);
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.fixedItem, false, "", fixedId);
|
| | | }
|
| | | else if (unfixedDisplays != null
|
| | | && unfixedDisplay != 0
|
| | | && unfixedDisplays.Contains(unfixedDisplay))
|
| | | }
|
| | |
|
| | | for (int i = 0; i < unfixedDisplays.Length; i++)
|
| | | {
|
| | | var unfixedDisplay = unfixedDisplays[i];
|
| | | if (unfixedDisplay != 0)
|
| | | {
|
| | | var matCell = twoMatFixedAndUnfixeds[unfixedDisplay - 1];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false);
|
| | | }
|
| | | else
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | private void ResetModel()
|
| | | {
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | preSecondType = 0;
|
| | | compoundModel = null;
|
| | | if (!WindowJumpMgr.Instance.IsJumpState)
|
| | | {
|
| | | preSecondType = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshUI(ItemCompoundConfig compoundModel)
|
| | |
| | | [SerializeField]
|
| | | ScrollerController cellCtrl;
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> sourceItemlist = new List<GameObject>();
|
| | | [Header("固定物品和非固定物品")]
|
| | | [SerializeField] List<ComposeMatCell> fixedAndUnfixeds = new List<ComposeMatCell>();
|
| | | [Header("合成物品")]
|
| | | [SerializeField] List<ComposeMatCell> makeItems = new List<ComposeMatCell>();
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> previewItemlist = new List<GameObject>();
|
| | | ComposeWinModel.ComposeFirstTypeData firstTypeData;
|
| | | ComposeWinModel.ComposeSecondTypeData secondTypeData;
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData;
|
| | |
|
| | | [SerializeField]
|
| | | Text successRateText;
|
| | |
| | | get { return _composeWinModel ?? (_composeWinModel = ModelCenter.Instance.GetModel<ComposeWinModel>()); }
|
| | | }
|
| | |
|
| | | private Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> firstTypeDict = null;
|
| | | private Dictionary<int, List<ItemCompoundConfig>> secondTypeDict = null;
|
| | | private List<ItemCompoundConfig> thirdTypelist = null;
|
| | |
|
| | | private int curSecondType = 0;
|
| | | private int curThirdType = 0;
|
| | | private int preSecondType = 0;
|
| | | private int preThirdType = 0;
|
| | | [SerializeField] int initSuccessRate = 10000;
|
| | | ItemCompoundConfig compoundModel = null;
|
| | |
|
| | | SelectEquipModel _selectModel;
|
| | | private Dictionary<int,List<int>> fixedItemIndexDict = new Dictionary<int, List<int>>();
|
| | |
|
| | | SelectEquipModel selectModel
|
| | | {
|
| | | get { return _selectModel ?? (_selectModel = ModelCenter.Instance.GetModel<SelectEquipModel>()); }
|
| | | }
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel
|
| | | {
|
| | | get
|
| | | {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | |
|
| | | PlayerPackModel _playerPack;
|
| | | PlayerPackModel playerPack
|
| | |
| | | get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
| | | }
|
| | |
|
| | | GetItemPathModel ItemPathModel
|
| | | {
|
| | | get { return ModelCenter.Instance.GetModel<GetItemPathModel>(); }
|
| | | }
|
| | |
|
| | | AchievementGuideEffect guidEffect = null;
|
| | | bool isJumpTo;
|
| | | protected override void BindController()
|
| | | {
|
| | | cellCtrl.OnRefreshCell += RefreshCell;
|
| | | cellCtrl.OnRefreshCell += RefreshTypeCell;
|
| | | cellCtrl.lockType = EnhanceLockType.KeepVertical;
|
| | | composeWinModel.ResetModelEvent += ResetModel;
|
| | |
|
| | |
| | | protected override void OnPreOpen()
|
| | | {
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnComposeAnswer;
|
| | | firstTypeDict = composeWinModel.GetFirstTypeModel((int)ComposeFuncType.Item);
|
| | | isJumpTo = false;
|
| | | if (AchievementGoto.guideAchievementId != 0)
|
| | | composeWinModel.UpdateSecondTypeEvent += UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent += UpdateThirdType;
|
| | | Display();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | this.transform.SetAsLastSibling();
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer;
|
| | | composeWinModel.UpdateSecondTypeEvent -= UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent -= UpdateThirdType;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | #region 新的逻辑
|
| | | private void Display()
|
| | | {
|
| | | composeWinModel.TryGetFirstTypeData((int)ComposeFuncType.Item, out firstTypeData);
|
| | | if (firstTypeData == null) return;
|
| | |
|
| | | DefaultSelect();
|
| | | CreateTypeCell();
|
| | | JumpIndex();
|
| | | }
|
| | | private void DefaultSelect()
|
| | | {
|
| | | bool isJumpTo = false;
|
| | | var achieveId = AchievementGoto.guideAchievementId;
|
| | | SuccessConfig successConfig = Config.Instance.Get<SuccessConfig>(achieveId);
|
| | | if (successConfig != null && successConfig.Type == 69)
|
| | | {
|
| | | SuccessConfig successConfig = Config.Instance.Get<SuccessConfig>(AchievementGoto.guideAchievementId);
|
| | | if (successConfig.Type == 69)
|
| | | {
|
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Item,composeWinModel.secondType);
|
| | | ClickSecondTypeUICtrl();
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Item, composeWinModel.secondType);
|
| | | ClickSecondTypeUICtrl();
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | | else if(composeWinModel.composeToolRed.state == RedPointState.Simple)
|
| | | else
|
| | | {
|
| | | foreach(var second in composeWinModel.secondTypeRedDict.Keys)
|
| | | if (composeWinModel.composeToolRed.state == RedPointState.Simple)
|
| | | {
|
| | | if(composeWinModel.secondTypeRedDict[second].state == RedPointState.Simple)
|
| | | foreach (var second in composeWinModel.secondTypeRedDict.Keys)
|
| | | {
|
| | | string key = StringUtility.Contact(second,10);
|
| | | foreach(var third in composeWinModel.thirdTypeRedDict.Keys)
|
| | | if (composeWinModel.secondTypeRedDict[second].state == RedPointState.Simple)
|
| | | {
|
| | | if(composeWinModel.thirdTypeRedDict[third].state == RedPointState.Simple)
|
| | | string key = StringUtility.Contact(second, 10);
|
| | | foreach (var third in composeWinModel.thirdTypeRedDict.Keys)
|
| | | {
|
| | | string thirdType = third.Substring(key.Length,third.Length - key.Length);
|
| | | isJumpTo = true;
|
| | | curSecondType = second;
|
| | | curThirdType = int.Parse(thirdType);
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Item, second);
|
| | | ClickSecondTypeUICtrl();
|
| | | composeWinModel.ResetJumpToModel();
|
| | | break;
|
| | | }
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | CreateCell();
|
| | | if (curSecondType == 0)
|
| | | {
|
| | | RefreshUI(null);
|
| | | } |
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | this.transform.SetAsLastSibling();
|
| | | StartCoroutine(SetOffestPos());
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | private void ResetModel()
|
| | | {
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | preSecondType = 0;
|
| | | compoundModel = null;
|
| | | }
|
| | |
|
| | | private void CreateCell()
|
| | | {
|
| | | cellCtrl.Refresh();
|
| | | 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)
|
| | | {
|
| | | ItemCompoundConfig compoundConfig = firstTypeDict[secondType][thirdType][0];
|
| | | int makeID = compoundConfig.makeID[0];
|
| | | if(secondType != 3)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal, thirdType);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (composeWinModel.IsComposeJobLimit(makeID))
|
| | | if (composeWinModel.thirdTypeRedDict[third].state == RedPointState.Simple)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal, thirdType);
|
| | | string thirdType = third.Substring(key.Length, third.Length - key.Length);
|
| | | isJumpTo = true;
|
| | | curSecondType = second;
|
| | | curThirdType = int.Parse(thirdType);
|
| | | composeWinModel.ResetJumpToModel();
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | cellCtrl.Restart();
|
| | |
|
| | | if (secondTypeDict != null)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Item, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | if (secondTypeDict.Count >= 1 && curSecondType != 0)
|
| | | {
|
| | | 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 IEnumerator SetOffestPos()
|
| | | {
|
| | | yield return null;
|
| | | if (curThirdType >= 5)
|
| | | {
|
| | | cellCtrl.JumpIndex(curThirdType*50, 0, EnhancedUI.EnhancedScroller.EnhancedScroller.TweenType.immediate);
|
| | | }
|
| | | CheckJumpModel();
|
| | | }
|
| | |
|
| | | private void CheckJumpModel()
|
| | | {
|
| | | if (compoundModel != null)
|
| | | {
|
| | | RefreshUI(compoundModel);
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | if (isJumpTo)
|
| | | {
|
| | | isJumpTo = false;
|
| | | bool isCanCompose = true;
|
| | | if (!composeWinModel.IsEnoughFixedMat(compoundModel) || !composeWinModel.IsEnoughUnfixedMat(compoundModel))
|
| | | if (!composeWinModel.IsEnoughFixedMat(thirdTypeData.itemCompound) || !composeWinModel.IsEnoughUnfixedMat(thirdTypeData.itemCompound))
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Compose101"));
|
| | | isCanCompose = false;
|
| | | }
|
| | | else if (!composeWinModel.IsEnoughMoney(compoundModel))
|
| | | else if (!composeWinModel.IsEnoughMoney(thirdTypeData.itemCompound))
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("L1006"));
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Z1011"));
|
| | | isCanCompose = false;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshUI(null);
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshCell(ScrollerDataType type, CellView cell)
|
| | | private void CreateTypeCell()
|
| | | {
|
| | | Image icon = cell.transform.Find("BtnIcon").GetComponent<Image>();
|
| | | Text name = cell.transform.Find("BtnText").GetComponent<Text>();
|
| | | Button cellBtn = cell.GetComponent<Button>();
|
| | | 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)
|
| | | {
|
| | | var thirdTypeDatas = thirdTypeDict[third];
|
| | | if (third != 0)
|
| | | {
|
| | | if (second != 3)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal,third);
|
| | | }
|
| | | else
|
| | | {
|
| | | var makerIds = thirdTypeDatas[0].itemCompound.makeID;
|
| | | if (composeWinModel.IsComposeJobLimit(makerIds[0]))
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal,third);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | cellCtrl.Restart();
|
| | |
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Item, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | noneComposeObj.SetActive(false);
|
| | | composeUIShowObj.SetActive(true);
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | }
|
| | | else
|
| | | {
|
| | | noneComposeObj.SetActive(true);
|
| | | composeUIShowObj.SetActive(false);
|
| | | RefreshUI(null);
|
| | | }
|
| | | }
|
| | |
|
| | | private void JumpIndex()
|
| | | {
|
| | | if (firstTypeData == null) return;
|
| | |
|
| | | var secondTypeDict = firstTypeData.secondTypeDict;
|
| | | if (secondTypeDict.Count >= 1 && curSecondType != 0)
|
| | | {
|
| | | 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;
|
| | | }
|
| | | }
|
| | | if(curThirdType >= 4)
|
| | | {
|
| | | curIndex = curIndex + curThirdType - 2;
|
| | | }
|
| | | return curIndex;
|
| | | }
|
| | |
|
| | | private void RefreshTypeCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | RedpointBehaviour behaviour = cell.transform.Find("RedPoint").GetComponent<RedpointBehaviour>();
|
| | | 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)
|
| | | ComposeWinModel.ComposeSecondTypeData _secondTypeData = null;
|
| | | ComposeFirstTypeCell firstTypeCell = cell.GetComponent<ComposeFirstTypeCell>();
|
| | | composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.Item, cell.index, out _secondTypeData);
|
| | | if (_secondTypeData != null)
|
| | | {
|
| | | if(thirdType != 0)
|
| | | var thirdTypeDict = _secondTypeData.thirdTypeDict;
|
| | | foreach (var third in thirdTypeDict.Keys)
|
| | | {
|
| | | arrowIcon.SetActive(true);
|
| | | firstTypeCell.SetDisplay((int)ComposeFuncType.Item, cell.index, third, curSecondType);
|
| | | break;
|
| | | }
|
| | | else
|
| | | {
|
| | | arrowIcon.SetActive(false);
|
| | | }
|
| | |
|
| | | compoundModel = firstTypeDict[cell.index][thirdType][0];
|
| | | name.text = compoundModel.secondTypeName;
|
| | | if (curSecondType == cell.index)
|
| | | {
|
| | | preSecondType = curSecondType;
|
| | | arrowIcon.transform.localRotation = Quaternion.Euler(0, 0, -90);
|
| | | icon.SetSprite("ComposeFirstClassChoosebtn");
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Item, curSecondType);
|
| | | //ClickSecondTypeUICtrl();
|
| | | }
|
| | | else
|
| | | {
|
| | | arrowIcon.transform.localRotation = Quaternion.Euler(0, 0,0);
|
| | | icon.SetSprite("ComposeFirstClassNormalbtn");
|
| | | }
|
| | | break;
|
| | | }
|
| | | cellBtn.AddListener(()=> { OnClickSecondType(cell.index); });
|
| | | if(composeWinModel.secondTypeRedDict.ContainsKey(cell.index))
|
| | | {
|
| | | behaviour.redpointId = composeWinModel.secondTypeRedDict[cell.index].id;
|
| | | }
|
| | | 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);
|
| | | RefreshUI(compoundModel);
|
| | | }
|
| | | else
|
| | | {
|
| | | icon.SetSprite("ChildListBtn_UnSelect");
|
| | | }
|
| | | cellBtn.AddListener(() => { OnClickThirdType(cell.index); });
|
| | | string key = StringUtility.Contact(compoundModel.secondType,10,compoundModel.thirdType);
|
| | | if (composeWinModel.thirdTypeRedDict.ContainsKey(key))
|
| | | {
|
| | | behaviour.redpointId = composeWinModel.thirdTypeRedDict[key].id;
|
| | | }
|
| | | ComposeSecondTypeCell secondTypeCell = cell.GetComponent<ComposeSecondTypeCell>();
|
| | | secondTypeCell.SetDisplay((int)ComposeFuncType.Item, curSecondType, cell.index, curThirdType);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnClickSecondType(int secondType)
|
| | | private void UpdateSecondType(int secondType)
|
| | | {
|
| | | curThirdType = 0;
|
| | | curSecondType = secondType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Item, curSecondType);
|
| | | foreach (var thirdType in secondTypeDict.Keys)
|
| | | composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.Item, secondType, out secondTypeData);
|
| | | OnClickSecondType();
|
| | | CreateTypeCell();
|
| | | JumpIndex();
|
| | | }
|
| | |
|
| | | private void OnClickSecondType()
|
| | | {
|
| | | if (secondTypeData == null) return;
|
| | |
|
| | | var thirdTypeDict = secondTypeData.thirdTypeDict;
|
| | | if (curThirdType == 0)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | foreach (var thirdType in thirdTypeDict.Keys)
|
| | | {
|
| | | if (preSecondType == curSecondType)
|
| | | if (thirdType != 0)
|
| | | {
|
| | | curSecondType = 0;
|
| | | preSecondType = 0;
|
| | | if (preSecondType == curSecondType)
|
| | | {
|
| | | curSecondType = 0;
|
| | | preSecondType = 0;
|
| | | }
|
| | | }
|
| | | |
| | | break;
|
| | | }
|
| | | curThirdType = 0;
|
| | | break;
|
| | | }
|
| | |
|
| | | if (preSecondType != curSecondType)
|
| | | {
|
| | | preSecondType = curSecondType;
|
| | | if(guidEffect != null)
|
| | | if (guidEffect != null)
|
| | | {
|
| | | AchievementGuideEffectPool.Recycle(guidEffect);
|
| | | guidEffect = null;
|
| | | }
|
| | | }
|
| | | ClickSecondTypeUICtrl();
|
| | | CreateCell();
|
| | | }
|
| | |
|
| | | private void ClickSecondTypeUICtrl()
|
| | | private void UpdateThirdType(int thirdType)
|
| | | {
|
| | | if (secondTypeDict.Count > 1)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Item, curSecondType, thirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | RefreshUI(null);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (secondTypeDict.ContainsKey(curThirdType))
|
| | | bool isTrailer = composeWinModel.IsTrailerByLevel(thirdTypeData.itemCompound);
|
| | | if (isTrailer)
|
| | | {
|
| | | RefreshUI(secondTypeDict[curThirdType][0]);
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("FuncOpenLv", thirdTypeData.itemCompound.levelNeed));
|
| | | return;
|
| | | }
|
| | | }
|
| | | curThirdType = thirdType;
|
| | | OnClickThirdType();
|
| | | CreateTypeCell();
|
| | | }
|
| | |
|
| | | private void OnClickThirdType()
|
| | | {
|
| | | if (thirdTypeData == null) return;
|
| | |
|
| | | if (preThirdType != curThirdType)
|
| | | {
|
| | | preThirdType = curThirdType;
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateComposeMat()
|
| | | {
|
| | | int[] makeIds = compoundModel.makeID;
|
| | | for (int i = 0; i < makeItems.Count; i++)
|
| | | {
|
| | | var matCell = makeItems[i];
|
| | | if (makeIds != null && i < makeIds.Length)
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.MakeItem, false, "", makeIds[i]);
|
| | | }
|
| | | else
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | | }
|
| | |
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int[] fixedDisplays = compoundModel.itemDisplay;
|
| | | int[] unfixedIds = compoundModel.unfixedItemID;
|
| | | int[] unfixedDisplays = compoundModel.unfixedItemDisplay;
|
| | | for (int i = 0; i < fixedAndUnfixeds.Count; i++)
|
| | | {
|
| | | var matCell = fixedAndUnfixeds[i];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | |
|
| | | for (int i = 0; i < fixedDisplays.Length; i++)
|
| | | {
|
| | | var fixedDisplay = fixedDisplays[i];
|
| | | if (fixedDisplay != 0)
|
| | | {
|
| | | var matCell = fixedAndUnfixeds[fixedDisplay - 1];
|
| | | int fixedId = fixedIds[i];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.fixedItem, false, "", fixedId);
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < unfixedDisplays.Length; i++)
|
| | | {
|
| | | var unfixedDisplay = unfixedDisplays[i];
|
| | | if (unfixedDisplay != 0)
|
| | | {
|
| | | var matCell = fixedAndUnfixeds[unfixedDisplay - 1];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false);
|
| | | }
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | private void OnClickThirdType(int thirdType)
|
| | | private void ResetModel()
|
| | | {
|
| | | curThirdType = thirdType;
|
| | | cellCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | compoundModel = null;
|
| | | if(!WindowJumpMgr.Instance.IsJumpState)
|
| | | {
|
| | | preSecondType = 0;
|
| | | preThirdType = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshUI(ItemCompoundConfig compoundModel)
|
| | | {
|
| | | this.compoundModel = compoundModel;
|
| | | if (compoundModel == null)
|
| | | {
|
| | | noneComposeObj.SetActive(true);
|
| | | composeUIShowObj.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | noneComposeObj.SetActive(false);
|
| | | composeUIShowObj.SetActive(true);
|
| | | successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(compoundModel.successRate / 100, "%"));
|
| | | composeWinModel.SetCurComposeModel(compoundModel);
|
| | | ControllerRightUI();
|
| | | composeWinModel.composeBtnRed.state = composeWinModel.secondTypeRedDict[compoundModel.secondType].state;
|
| | | }
|
| | | }
|
| | | if (compoundModel == null) return;
|
| | |
|
| | | private void ControllerRightUI()
|
| | | {
|
| | | int i = 0;
|
| | | #region 合成物品UI
|
| | | for (i = 0; i < previewItemlist.Count; i++)
|
| | | {
|
| | | int[] makeIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.MakeIds);
|
| | | GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject;
|
| | | if (i < makeIds.Length)
|
| | | {
|
| | | |
| | | RefreshGridCellUI(gridCell, false,makeIds[i],NeedMatType.MakeItem);
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshGridCellUI(gridCell,true);
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 固定道具和不固定道具UI
|
| | | int[] fixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedDisplay);
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | int[] unfixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedIds);
|
| | | int[] unfixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedDisplay);
|
| | | for (i = 0;i < sourceItemlist.Count; i++)
|
| | | {
|
| | | GameObject gridCell = sourceItemlist[i].transform.Find("GridCell").gameObject;
|
| | | Text putInText = sourceItemlist[i].transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = sourceItemlist[i].GetComponent<Button>();
|
| | | putInText.gameObject.SetActive(false);
|
| | | RefreshGridCellUI(gridCell, true);
|
| | | posBtn.RemoveAllListeners();
|
| | | }
|
| | | |
| | | for (i = 0; i < fixedDisplay.Length; i++)
|
| | | {
|
| | | if (fixedDisplay[i] != 0)
|
| | | {
|
| | | GameObject matPos = sourceItemlist[fixedDisplay[i] - 1];
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | | for (i = 0; i < unfixedDisplay.Length; i++)
|
| | | {
|
| | | if (unfixedDisplay[i] != 0)
|
| | | {
|
| | | GameObject matPos = sourceItemlist[unfixedDisplay[i] - 1];
|
| | | GameObject gridCell = matPos.transform.Find("GridCell").gameObject;
|
| | | Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = matPos.GetComponent<Button>();
|
| | | putInText.gameObject.SetActive(true);
|
| | | RefreshGridCellUI(gridCell, false);
|
| | | |
| | | posBtn.RemoveAllListeners();
|
| | | posBtn.AddListener(() => {
|
| | | selectModel.SetAddParent(matPos);
|
| | | selectModel.selectItem = SelectItemType.unfixed;
|
| | | WindowCenter.Instance.Open<SelectItemWin>();
|
| | | });
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | }
|
| | |
|
| | | private void RefreshGridCellUI(GameObject gridCell, bool islock, int itemId = -1,NeedMatType matType = NeedMatType.unfixedItem,int itemPlace = -1)
|
| | | {
|
| | | gridCell.SetActive(true);
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | if (itemCell == null)
|
| | | itemCell = gridCell.transform.Find("ItemCell").gameObject.AddComponent<ItemCell>();
|
| | |
|
| | | GameObject gridlock = gridCell.transform.Find("GridLock").gameObject;
|
| | | itemCell.cellBtn.onClick.RemoveAllListeners();
|
| | | if (islock)
|
| | | {
|
| | | gridlock.gameObject.SetActive(true);
|
| | | itemCell.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | gridlock.gameObject.SetActive(false);
|
| | | itemCell.gameObject.SetActive(true);
|
| | | ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptItem,itemPlace);
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId);
|
| | | if (itemModel == null)
|
| | | {
|
| | | if(itemId != -1)
|
| | | {
|
| | | ItemCellModel cellModel = new ItemCellModel(itemId);
|
| | | itemCell.Init(cellModel);
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | {
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | }
|
| | | }
|
| | | );
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.gameObject.SetActive(false);
|
| | | }
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.Init(itemModel);
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | {
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | |
|
| | | });
|
| | | }
|
| | |
|
| | | if(matType == NeedMatType.fixedItem)
|
| | | {
|
| | | 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++)
|
| | | {
|
| | | 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;
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.countText.gameObject.SetActive(false);
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(compoundModel.successRate / 100, "%"));
|
| | | composeWinModel.SetCurComposeModel(compoundModel);
|
| | | composeWinModel.composeBtnRed.state = composeWinModel.secondTypeRedDict[compoundModel.secondType].state;
|
| | | UpdateComposeMat();
|
| | | }
|
| | |
|
| | | private void OnClickComposeBtn()
|
| | |
| | | int minBindCnt = 0;
|
| | | int minNoBindCnt = 0;
|
| | | composeWinModel.GetBindOrNoBindMinCnt(out minBindCnt, out minNoBindCnt);
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id,DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int[] fixedCounts = compoundModel.itemCount;
|
| | | for (int i = 0; i < fixedIds.Length; i++)
|
| | | {
|
| | | List<int> itemIndexlist = null;
|
| | |
| | | List<int> composeCountlist = new List<int>();
|
| | | fixedItemIndexDict.Clear();
|
| | | SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int[] fixedCounts = compoundModel.itemCount;
|
| | |
|
| | | for (int i = 0; i < fixedIds.Length; i++)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | RefreshUI(compoundModel);
|
| | | selectModel.ClearSelectModel();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public event Action<ComposeMatCell,NeedMatType> UpdateReduceEvent;
|
| | | public void UpdateReduce(ComposeMatCell matCell,NeedMatType matType)
|
| | | {
|
| | | if (UpdateReduceEvent != null)
|
| | | {
|
| | | UpdateReduceEvent(matCell,matType);
|
| | | }
|
| | | }
|
| | |
|
| | | public event Action<ItemCompoundConfig, int> UpdateEquipTypeEvent;
|
| | | public void UpdateComposeEquipPlace(ItemCompoundConfig itemCompound,int equipIndex)
|
| | | {
|
| | | if (UpdateEquipTypeEvent != null)
|
| | | {
|
| | | UpdateEquipTypeEvent(itemCompound, equipIndex);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool TryGetIncreaseRateItemIndex(ItemCompoundConfig itemCompound,bool IsIncrease, out List<int> indexlist)
|
| | | {
|
| | | indexlist = null;
|
| | |
| | | [SerializeField]
|
| | | ScrollerController cellCtrl;
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> sourceItemlist = new List<GameObject>();
|
| | | [Header("固定物品和非固定物品")]
|
| | | [SerializeField] List<ComposeMatCell> fixedAndUnfixeds = new List<ComposeMatCell>();
|
| | | [Header("合成物品")]
|
| | | [SerializeField] List<ComposeMatCell> makeItems = new List<ComposeMatCell>();
|
| | | [Header("附加物品")]
|
| | | [SerializeField] List<ComposeMatCell> extraAddItems = new List<ComposeMatCell>();
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> previewItemlist = new List<GameObject>();
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> addItemlist = new List<GameObject>();
|
| | | [Header("合成物品目标特效")]
|
| | | [SerializeField] List<UIEffect> composeTargetEffects = new List<UIEffect>();
|
| | |
|
| | | [SerializeField]
|
| | | Text successRateText;
|
| | |
| | | get { return _composeWinModel ?? (_composeWinModel = ModelCenter.Instance.GetModel<ComposeWinModel>()); }
|
| | | }
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel
|
| | | {
|
| | | get
|
| | | {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | |
|
| | | GetItemPathModel ItemPathModel
|
| | | {
|
| | | 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;
|
| | | private int curThirdType = 0;
|
| | | private int preSecondType = 0;
|
| | | private int preThirdType = 0;
|
| | | private int successRate = 0;
|
| | | [SerializeField] int initSuccessRate = 2000;
|
| | | ItemCompoundConfig compoundModel = null;
|
| | |
| | |
|
| | | protected override void BindController()
|
| | | {
|
| | | cellCtrl.OnRefreshCell += RefreshCell;
|
| | | cellCtrl.OnRefreshCell += RefreshTypeCell;
|
| | |
|
| | | cellCtrl.lockType = EnhanceLockType.KeepVertical;
|
| | | composeWinModel.ResetModelEvent += ResetModel;
|
| | |
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | selectModel.selectEquipEvent += RefreshSelectItem;
|
| | | composeWinModel.UpdateSecondTypeEvent += UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent += UpdateThirdType;
|
| | | composeWinModel.UpdateReduceEvent += UpdateReduce;
|
| | | selectModel.UpdateSelectEvent += UpdateSelect;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnComposeAnswer;
|
| | | UIEventTrigger.Get(helpBtn.gameObject).OnDown = OnClickHelpBtn;
|
| | | UIEventTrigger.Get(helpBtn.gameObject).OnUp = OnDownUp;
|
| | |
|
| | | firstTypeDict = composeWinModel.GetFirstTypeModel((int)ComposeFuncType.Wings);
|
| | | bool isJumpTo = false;
|
| | | SuccessConfig successConfig = Config.Instance.Get<SuccessConfig>(AchievementGoto.guideAchievementId);
|
| | | if (successConfig != null && successConfig.Type == 69)
|
| | | {
|
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Wings,composeWinModel.secondType);
|
| | | ClickSecondTypeUICtrl();
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | | else
|
| | | {
|
| | | if (composeWinModel.secondType != 0)
|
| | | {
|
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Wings, composeWinModel.secondType);
|
| | | ClickSecondTypeUICtrl();
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | | }
|
| | |
|
| | | CreateCell();
|
| | | IsComposeBind = false;
|
| | | if (curSecondType == 0)
|
| | | {
|
| | | RefreshUI(null);
|
| | | }
|
| | |
|
| | | if(compoundModel != null)
|
| | | {
|
| | | selectModel.ClearSelectModel();
|
| | | RefreshUI(compoundModel);
|
| | | if(isJumpTo)
|
| | | {
|
| | | isJumpTo = false;
|
| | | bool isCanCompose = true;
|
| | | if(!composeWinModel.IsEnoughFixedMat(compoundModel) || !composeWinModel.IsEnoughUnfixedMat(compoundModel))
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Compose101"));
|
| | | isCanCompose = false;
|
| | | }
|
| | | else if(!composeWinModel.IsEnoughMoney(compoundModel))
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Z1011"));
|
| | | isCanCompose = false;
|
| | | }
|
| | |
|
| | | if(isCanCompose)
|
| | | {
|
| | | guidEffect = AchievementGuideEffectPool.Require(1);
|
| | | guidEffect.transform.SetParentEx(composeBtn.transform, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | }
|
| | | }
|
| | | }
|
| | | Display();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | selectModel.selectEquipEvent -= RefreshSelectItem;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer;
|
| | | composeWinModel.UpdateReduceEvent -= UpdateReduce;
|
| | | composeWinModel.UpdateSecondTypeEvent -= UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent -= UpdateThirdType;
|
| | | selectModel.UpdateSelectEvent -= UpdateSelect;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | |
| | |
|
| | | }
|
| | |
|
| | | private void ResetModel()
|
| | | #region 新的逻辑
|
| | | private void Display()
|
| | | {
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | preSecondType = 0;
|
| | | successRate = 0;
|
| | | compoundModel = null;
|
| | | composeWinModel.TryGetFirstTypeData((int)ComposeFuncType.Wings, out firstTypeData);
|
| | | if (firstTypeData == null) return;
|
| | |
|
| | | IsComposeBind = false;
|
| | | DefaultSelect();
|
| | | CreateTypeCell();
|
| | | JumpIndex();
|
| | | }
|
| | | private void DefaultSelect()
|
| | | {
|
| | | bool isJumpTo = false;
|
| | | var achieveId = AchievementGoto.guideAchievementId;
|
| | | SuccessConfig successConfig = Config.Instance.Get<SuccessConfig>(achieveId);
|
| | | if (successConfig != null && successConfig.Type == 69)
|
| | | {
|
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | | else
|
| | | {
|
| | | if (composeWinModel.secondType != 0)
|
| | | {
|
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | | }
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Wings, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | if (isJumpTo)
|
| | | {
|
| | | isJumpTo = false;
|
| | | bool isCanCompose = true;
|
| | | if (!composeWinModel.IsEnoughFixedMat(thirdTypeData.itemCompound) || !composeWinModel.IsEnoughUnfixedMat(thirdTypeData.itemCompound))
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Compose101"));
|
| | | isCanCompose = false;
|
| | | }
|
| | | else if (!composeWinModel.IsEnoughMoney(thirdTypeData.itemCompound))
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Z1011"));
|
| | | isCanCompose = false;
|
| | | }
|
| | |
|
| | | if (isCanCompose)
|
| | | {
|
| | | guidEffect = AchievementGuideEffectPool.Require(1);
|
| | | guidEffect.transform.SetParentEx(composeBtn.transform, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshUI(null);
|
| | | }
|
| | | }
|
| | |
|
| | | private void CreateCell()
|
| | | private void CreateTypeCell()
|
| | | {
|
| | | if (firstTypeData == null) return;
|
| | |
|
| | | cellCtrl.Refresh();
|
| | | if(firstTypeDict != null)
|
| | | foreach (var second in firstTypeData.secondTypeDict.Keys)
|
| | | {
|
| | | foreach (int secondType in firstTypeDict.Keys)
|
| | | cellCtrl.AddCell(ScrollerDataType.Header, second);
|
| | | if (second == curSecondType)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Header,secondType);
|
| | | if(secondType == curSecondType)
|
| | | var thirdTypeDict = firstTypeData.secondTypeDict[second].thirdTypeDict;
|
| | | foreach (var third in thirdTypeDict.Keys)
|
| | | {
|
| | | foreach (int thirdType in secondTypeDict.Keys)
|
| | | if (third != 0)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal, thirdType);
|
| | | }
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal, third);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | cellCtrl.Restart();
|
| | |
|
| | | if(secondTypeDict != null)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Wings, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | if (secondTypeDict.Count >= 1 && curSecondType != 0)
|
| | | {
|
| | | cellCtrl.JumpIndex(GetCurIndex(curSecondType));
|
| | | }
|
| | | noneComposeObj.SetActive(false);
|
| | | composeUIShowObj.SetActive(true);
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshUI(null);
|
| | | noneComposeObj.SetActive(true);
|
| | | composeUIShowObj.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | private void JumpIndex()
|
| | | {
|
| | | if (firstTypeData == null) return;
|
| | |
|
| | | var secondTypeDict = firstTypeData.secondTypeDict;
|
| | | if (secondTypeDict.Count >= 1 && curSecondType != 0)
|
| | | {
|
| | | cellCtrl.JumpIndex(GetCurIndex(curSecondType));
|
| | | }
|
| | | }
|
| | |
|
| | | private int GetCurIndex(int secondType)
|
| | | {
|
| | | if (firstTypeData == null) return 0;
|
| | | int curIndex = 0;
|
| | | List<int> secondlist = firstTypeDict.Keys.ToList();
|
| | | var secondTypeDict = firstTypeData.secondTypeDict;
|
| | | List<int> secondlist = secondTypeDict.Keys.ToList();
|
| | | for (int i = 0; i < secondlist.Count; i++)
|
| | | {
|
| | | if (secondType == secondlist[i])
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | if (curThirdType >= 4)
|
| | | {
|
| | | curIndex = curIndex + curThirdType - 2;
|
| | | }
|
| | | return curIndex;
|
| | | }
|
| | |
|
| | | private void RefreshCell(ScrollerDataType type, CellView cell)
|
| | | private void RefreshTypeCell(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)
|
| | | ComposeWinModel.ComposeSecondTypeData _secondTypeData = null;
|
| | | ComposeFirstTypeCell firstTypeCell = cell.GetComponent<ComposeFirstTypeCell>();
|
| | | composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.Wings, cell.index, out _secondTypeData);
|
| | | if (_secondTypeData != null)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | var thirdTypeDict = _secondTypeData.thirdTypeDict;
|
| | | foreach (var third in thirdTypeDict.Keys)
|
| | | {
|
| | | arrowIcon.SetActive(true);
|
| | | firstTypeCell.SetDisplay((int)ComposeFuncType.Wings, cell.index, third, curSecondType);
|
| | | break;
|
| | | }
|
| | | else
|
| | | {
|
| | | arrowIcon.SetActive(false);
|
| | | }
|
| | | compoundModel = firstTypeDict[cell.index][thirdType][0];
|
| | | name.text = compoundModel.secondTypeName;
|
| | | if (curSecondType == cell.index)
|
| | | {
|
| | | preSecondType = curSecondType;
|
| | | icon.SetSprite("ComposeFirstClassChoosebtn");
|
| | | arrowIcon.transform.localRotation = Quaternion.Euler(0,0,-90);
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Wings, curSecondType);
|
| | | //ClickSecondTypeUICtrl();
|
| | | }
|
| | | 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);
|
| | | RefreshUI(compoundModel);
|
| | | }
|
| | | else
|
| | | {
|
| | | icon.SetSprite("ChildListBtn_UnSelect");
|
| | | }
|
| | | cellBtn.AddListener(() => { OnClickThirdType(cell.index); });
|
| | | ComposeSecondTypeCell secondTypeCell = cell.GetComponent<ComposeSecondTypeCell>();
|
| | | secondTypeCell.SetDisplay((int)ComposeFuncType.Wings, curSecondType, cell.index, curThirdType);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnClickSecondType(int secondType)
|
| | | private void UpdateSecondType(int secondType)
|
| | | {
|
| | | curThirdType = 0;
|
| | | curSecondType = secondType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Wings, curSecondType);
|
| | | foreach(var thirdType in secondTypeDict.Keys)
|
| | | {
|
| | | if(thirdType != 0)
|
| | | {
|
| | | composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.Wings,secondType, out secondTypeData);
|
| | | OnClickSecondType();
|
| | | CreateTypeCell();
|
| | | JumpIndex();
|
| | | }
|
| | |
|
| | | private void OnClickSecondType()
|
| | | {
|
| | | if (secondTypeData == null) return;
|
| | |
|
| | | var thirdTypeDict = secondTypeData.thirdTypeDict;
|
| | | foreach (var thirdType in thirdTypeDict.Keys)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | {
|
| | | if (preSecondType == curSecondType)
|
| | | {
|
| | | curSecondType = 0;
|
| | | preSecondType = 0;
|
| | | }
|
| | | else
|
| | | {
|
| | | curThirdType = thirdType;
|
| | | }
|
| | | }
|
| | | curThirdType = 0;
|
| | | break;
|
| | | }
|
| | | |
| | |
|
| | | if (preSecondType != curSecondType)
|
| | | {
|
| | | preSecondType = curSecondType;
|
| | |
| | | guidEffect = null;
|
| | | }
|
| | | }
|
| | |
|
| | | ClickSecondTypeUICtrl();
|
| | | CreateCell();
|
| | | }
|
| | |
|
| | | private void ClickSecondTypeUICtrl()
|
| | | private void UpdateThirdType(int thirdType)
|
| | | {
|
| | | if (secondTypeDict.Count > 1)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Wings, curSecondType, thirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | RefreshUI(null);
|
| | | }
|
| | | else
|
| | | {
|
| | | if(curThirdType == 0)
|
| | | bool isTrailer = composeWinModel.IsTrailerByLevel(thirdTypeData.itemCompound);
|
| | | if (isTrailer)
|
| | | {
|
| | | if(secondTypeDict.ContainsKey(curThirdType))
|
| | | {
|
| | | RefreshUI(secondTypeDict[curThirdType][0]);
|
| | | }
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("FuncOpenLv", thirdTypeData.itemCompound.levelNeed));
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | curThirdType = thirdType;
|
| | | OnClickThirdType();
|
| | | CreateTypeCell();
|
| | | }
|
| | |
|
| | | private void OnClickThirdType(int thirdType)
|
| | | private void OnClickThirdType()
|
| | | {
|
| | | curThirdType = thirdType;
|
| | | cellCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | if (thirdTypeData == null) return;
|
| | |
|
| | | if (preThirdType != curThirdType)
|
| | | {
|
| | | preThirdType = curThirdType;
|
| | | }
|
| | | selectModel.ClearSelectModel();
|
| | | }
|
| | |
|
| | | private void RefreshUI(ItemCompoundConfig compoundModel)
|
| | | private void UpdateComposeMat()
|
| | | {
|
| | | this.compoundModel = compoundModel;
|
| | | if (compoundModel == null)
|
| | | int[] makeIds = compoundModel.makeID;
|
| | | for (int i = 0; i < makeItems.Count; i++)
|
| | | {
|
| | | noneComposeObj.SetActive(true);
|
| | | composeUIShowObj.SetActive(false);
|
| | | var matCell = makeItems[i];
|
| | | if (makeIds != null && i < makeIds.Length)
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.MakeItem, false, "", makeIds[i]);
|
| | | }
|
| | | else
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | | }
|
| | | else
|
| | |
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int[] fixedDisplays = compoundModel.itemDisplay;
|
| | | int[] unfixedIds = compoundModel.unfixedItemID;
|
| | | int[] unfixedDisplays = compoundModel.unfixedItemDisplay;
|
| | | for (int i = 0; i < fixedAndUnfixeds.Count; i++)
|
| | | {
|
| | | noneComposeObj.SetActive(false);
|
| | | composeUIShowObj.SetActive(true);
|
| | | successRate = compoundModel.successRate;
|
| | | successRateText.text = Language.Get("HallowsWin_Success",StringUtility.Contact(compoundModel.successRate / 100, "%"));
|
| | | composeWinModel.SetCurComposeModel(compoundModel);
|
| | | ControllerRightUI();
|
| | | var matCell = fixedAndUnfixeds[i];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | |
|
| | | for (int i = 0; i < fixedDisplays.Length; i++)
|
| | | {
|
| | | var fixedDisplay = fixedDisplays[i];
|
| | | if (fixedDisplay != 0)
|
| | | {
|
| | | var matCell = fixedAndUnfixeds[fixedDisplay - 1];
|
| | | int fixedId = fixedIds[i];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.fixedItem, false, "", fixedId);
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < unfixedDisplays.Length; i++)
|
| | | {
|
| | | var unfixedDisplay = unfixedDisplays[i];
|
| | | if (unfixedDisplay != 0)
|
| | | {
|
| | | var matCell = fixedAndUnfixeds[unfixedDisplay - 1];
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false, UIHelper.ReplaceNewLine(Language.Get("ComposeWin_PutInText_1")));
|
| | | }
|
| | | }
|
| | |
|
| | | int maxAddNum = compoundModel.addonsCountMax;
|
| | | for(int i = 0; i < extraAddItems.Count; i++)
|
| | | {
|
| | | var matCell = extraAddItems[i];
|
| | | if(i < maxAddNum)
|
| | | {
|
| | | matCell.SetDisplay(compoundModel,NeedMatType.addItem,false, UIHelper.ReplaceNewLine(Language.Get("ComposeWin_AddRateText_1")));
|
| | | }
|
| | | else
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void ControllerRightUI()
|
| | | private void UpdateSelect(ComposeMatCell matCell, int itemIndex, SelectItemType selectType)
|
| | | {
|
| | | int i = 0;
|
| | | #region 合成物品UI
|
| | | for (i = 0; i < previewItemlist.Count; i++)
|
| | | {
|
| | | int[] makeIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.MakeIds);
|
| | | GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject;
|
| | | if (i < makeIds.Length)
|
| | | {
|
| | | RefreshGridCellUI(gridCell, false, makeIds[i],NeedMatType.MakeItem);
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshGridCellUI(gridCell,true);
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 固定道具和不固定道具UI
|
| | | int[] fixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedDisplay);
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | int[] unfixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedIds);
|
| | | int[] unfixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedDisplay);
|
| | | for (i = 0;i < sourceItemlist.Count; i++)
|
| | | {
|
| | | GameObject gridCell = sourceItemlist[i].transform.Find("GridCell").gameObject;
|
| | | Text putInText = sourceItemlist[i].transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = sourceItemlist[i].GetComponent<Button>();
|
| | | posBtn.RemoveAllListeners();
|
| | | putInText.gameObject.SetActive(false);
|
| | | RefreshGridCellUI(gridCell,true);
|
| | | }
|
| | |
|
| | | for (i = 0; i < fixedDisplay.Length; i++)
|
| | | {
|
| | | if (fixedDisplay[i] != 0)
|
| | | {
|
| | | GameObject matPos = sourceItemlist[fixedDisplay[i] - 1];
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | | for (i = 0; i < unfixedDisplay.Length; i++)
|
| | | {
|
| | | if (unfixedDisplay[i] != 0)
|
| | | {
|
| | | GameObject matPos = sourceItemlist[unfixedDisplay[i] - 1];
|
| | | GameObject gridCell = matPos.transform.Find("GridCell").gameObject;
|
| | | Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>();
|
| | | Button posBtn = matPos.GetComponent<Button>();
|
| | | putInText.gameObject.SetActive(true);
|
| | | RefreshGridCellUI(gridCell, false);
|
| | | posBtn.RemoveAllListeners();
|
| | | posBtn.AddListener(()=> {
|
| | | selectModel.SetAddParent(matPos);
|
| | | selectModel.selectItem = SelectItemType.unfixed;
|
| | | WindowCenter.Instance.Open<SelectItemWin>();
|
| | | });
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 增加成功率UI
|
| | | for (i = 0; i < addItemlist.Count; i++)
|
| | | {
|
| | | GameObject matPos = addItemlist[i];
|
| | | GameObject gridCell = matPos.transform.Find("GridCell").gameObject;
|
| | | Text putInText = matPos.transform.Find("AddRateText").GetComponent<Text>();
|
| | | Button posBtn = matPos.GetComponent<Button>();
|
| | | if (i < compoundModel.addonsCountMax)
|
| | | {
|
| | | putInText.gameObject.SetActive(true);
|
| | | RefreshGridCellUI(gridCell, false);
|
| | | posBtn.RemoveAllListeners();
|
| | | posBtn.AddListener(() => {
|
| | | selectModel.SetAddParent(matPos);
|
| | | selectModel.selectItem = SelectItemType.addons;
|
| | | WindowCenter.Instance.Open<SelectItemWin>();
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | putInText.gameObject.SetActive(false);
|
| | | RefreshGridCellUI(gridCell, true);
|
| | | posBtn.RemoveAllListeners();
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | |
| | | }
|
| | |
|
| | | private void RefreshGridCellUI(GameObject gridCell, bool islock, int itemId = -1,NeedMatType matType = NeedMatType.Nothing,int itemPlace = -1)
|
| | | {
|
| | | gridCell.SetActive(true);
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | if (itemCell == null)
|
| | | itemCell = gridCell.transform.Find("ItemCell").gameObject.AddComponent<ItemCell>();
|
| | |
|
| | | GameObject gridlock = gridCell.transform.Find("GridLock").gameObject;
|
| | | itemCell.cellBtn.onClick.RemoveAllListeners();
|
| | | if (islock)
|
| | | {
|
| | | gridlock.gameObject.SetActive(true);
|
| | | itemCell.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | gridlock.gameObject.SetActive(false);
|
| | | itemCell.gameObject.SetActive(true);
|
| | | ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptItem,itemPlace);
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId);
|
| | | if(itemModel == null)
|
| | | {
|
| | | if(itemId != -1)
|
| | | {
|
| | | ItemCellModel cellModel = new ItemCellModel(itemId);
|
| | | itemCell.Init(cellModel);
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | {
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | }
|
| | | }
|
| | | );
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.gameObject.SetActive(false);
|
| | | }
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.Init(itemModel);
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | {
|
| | | if (itemConfig.GetWay != null && itemConfig.GetWay.Length > 0)
|
| | | {
|
| | | ItemPathModel.SetChinItemModel(itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID);
|
| | | }
|
| | |
|
| | | });
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | if (matType == NeedMatType.fixedItem)
|
| | | {
|
| | | 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++)
|
| | | {
|
| | | 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;
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.countText.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void RefreshSelectItem(ItemModel model, GameObject go, SelectItemType selectType)
|
| | | {
|
| | | GameObject gridCell = go.transform.Find("GridCell").gameObject;
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | Text putInText = null;
|
| | | switch (selectType)
|
| | | {
|
| | | case SelectItemType.unfixed:
|
| | | putInText = go.transform.Find("PutInText").GetComponent<Text>();
|
| | | RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, NeedMatType.unfixedItem, model.itemInfo.ItemPlace);
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false, "", 0, itemIndex);
|
| | | IsComposeBind = ChangeFixedMatUI();
|
| | | break;
|
| | | case SelectItemType.addons:
|
| | | putInText = go.transform.Find("AddRateText").GetComponent<Text>();
|
| | | RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, NeedMatType.addItem, model.itemInfo.ItemPlace);
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.addItem, false, "", 0, itemIndex);
|
| | | successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(RefreshComposeSuccessRate(initSuccessRate) / 100, "%"));
|
| | | if (successRate >= compoundModel.successUpper)
|
| | | {
|
| | |
| | | }
|
| | | break;
|
| | | }
|
| | |
|
| | | itemCell.reducebtn.gameObject.SetActive(true);
|
| | | itemCell.reducebtn.RemoveAllListeners();
|
| | |
|
| | | itemCell.reducebtn.AddListener(() => { OnClickReduceBtn(gridCell, putInText,model.itemInfo.ItemPlace,selectType); });
|
| | | putInText.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | private void OnClickReduceBtn(GameObject gridCell,Text posDes,int itemPlace,SelectItemType selectItem)
|
| | | private void UpdateReduce(ComposeMatCell matCell, NeedMatType matType)
|
| | | {
|
| | | ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptItem,itemPlace);
|
| | | switch (selectItem)
|
| | | switch (matType)
|
| | | {
|
| | | case SelectItemType.unfixed:
|
| | | selectModel.RemoveHaveUnfixedSelectItem(itemPlace);
|
| | | case NeedMatType.unfixedItem:
|
| | | matCell.SetDisplay(compoundModel, matType, false, |
| | | UIHelper.ReplaceNewLine(Language.Get("ComposeWin_PutInText_1")));
|
| | | IsComposeBind = ChangeFixedMatUI();
|
| | | break;
|
| | | case SelectItemType.addons:
|
| | | selectModel.RemoveHaveAddSelectItem(itemPlace);
|
| | | case NeedMatType.addItem:
|
| | | matCell.SetDisplay(compoundModel, matType, false, |
| | | UIHelper.ReplaceNewLine(Language.Get("ComposeWin_AddRateText_1")));
|
| | | successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(RefreshComposeSuccessRate(initSuccessRate) / 100, "%"));
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | posDes.gameObject.SetActive(true);
|
| | | RefreshGridCellUI(gridCell,false);
|
| | | #endregion
|
| | |
|
| | | private void ResetModel()
|
| | | {
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | successRate = 0;
|
| | | compoundModel = null;
|
| | | if (!WindowJumpMgr.Instance.IsJumpState)
|
| | | {
|
| | | preSecondType = 0;
|
| | | preThirdType = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshUI(ItemCompoundConfig compoundModel)
|
| | | {
|
| | | this.compoundModel = compoundModel;
|
| | | if (compoundModel == null) return;
|
| | |
|
| | | successRate = compoundModel.successRate;
|
| | | successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(compoundModel.successRate / 100, "%"));
|
| | | composeWinModel.SetCurComposeModel(compoundModel);
|
| | | UpdateComposeMat();
|
| | | }
|
| | |
|
| | | private bool ChangeFixedMatUI()
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | int[] fixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedDisplay);
|
| | | for (int i = 0; i < fixedDisplay.Length; i++)
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int[] fixedCounts = compoundModel.itemCount;
|
| | | int[] fixedDisplays = compoundModel.itemDisplay;
|
| | | for (int i = 0; i < fixedDisplays.Length; i++)
|
| | | {
|
| | | if (fixedDisplay[i] != 0)
|
| | | var fixedDisplay = fixedDisplays[i];
|
| | | if (fixedDisplay != 0)
|
| | | {
|
| | | GameObject matPos = sourceItemlist[fixedDisplay[i] - 1];
|
| | | ItemCell itemCell = matPos.transform.Find("GridCell/ItemCell").GetComponent<ItemCell>();
|
| | | var matCell = fixedAndUnfixeds[fixedDisplay - 1];
|
| | | int fixedId = fixedIds[i];
|
| | | itemCell.bindIcon.gameObject.SetActive(false);
|
| | | var bindIcon = matCell.itemCell.bindIcon;
|
| | | bindIcon.gameObject.SetActive(false);
|
| | | if (isBind)
|
| | | {
|
| | | List<ItemModel> list = null;
|
| | |
| | | {
|
| | | if (list[j].itemInfo.IsBind == 1)
|
| | | {
|
| | | itemCell.bindIcon.gameObject.SetActive(true);
|
| | | bindIcon.gameObject.SetActive(true);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | successRate = initRate;
|
| | |
|
| | | Debug.Log("RefreshComposeSuccessRate;"+ addSelectItemDict.Count);
|
| | | foreach (var index in addSelectItemDict.Keys)
|
| | | {
|
| | | successRate = composeWinModel.GetComposeSuccessRate(compoundModel,addSelectItemDict[index],successRate);
|
| | |
| | | SysNotifyMgr.Instance.ShowTip("ComposeNothingToAdd");
|
| | | return;
|
| | | }
|
| | | for (int i = 0; i <addItemlist.Count; i++)
|
| | |
|
| | | var addSelectItemDict = selectModel.GetHaveAddSelectItem();
|
| | | int maxAddNum = compoundModel.addonsCountMax;
|
| | | for (int i = 0; i < extraAddItems.Count; i++)
|
| | | {
|
| | | GameObject gridCell = addItemlist[i].transform.Find("GridCell").gameObject;
|
| | | ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | GameObject gridlock = gridCell.transform.Find("GridLock").gameObject;
|
| | | if (gridCell.activeInHierarchy |
| | | && !gridlock.activeInHierarchy
|
| | | && !itemCell.gameObject.activeInHierarchy)
|
| | | var matCell = extraAddItems[i];
|
| | | if(i < maxAddNum && matCell.itemModel == null)
|
| | | {
|
| | | for(int j = 0; j < onekeyPutlist.Count; j++)
|
| | | for (int j = 0; j < onekeyPutlist.Count; j++)
|
| | | {
|
| | | if (!selectModel.GetHaveAddSelectItem().ContainsKey(onekeyPutlist[j].itemInfo.ItemPlace))
|
| | | var itemIndex = onekeyPutlist[j].itemInfo.ItemPlace;
|
| | | if (!addSelectItemDict.ContainsKey(itemIndex))
|
| | | {
|
| | | if(successRate < compoundModel.successUpper)
|
| | | if (successRate < compoundModel.successUpper)
|
| | | {
|
| | | selectModel.AddHaveAddSelectItem(onekeyPutlist[j].itemInfo.ItemPlace);
|
| | | RefreshSelectItem(onekeyPutlist[j], addItemlist[i], SelectItemType.addons);
|
| | | selectModel.AddHaveAddSelectItem(itemIndex);
|
| | | UpdateSelect(matCell, itemIndex, SelectItemType.addons);
|
| | | break;
|
| | | }
|
| | | else
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void OnClickComposeBtn()
|
| | |
| | | {
|
| | | isBind = 0;
|
| | | }
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
|
| | | int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int[] fixedCounts = compoundModel.itemCount;
|
| | | for (int i = 0; i < fixedIds.Length; i++)
|
| | | {
|
| | | List<int> itemIndexlist = singlePack.ItemIndexlistByIsBind(fixedIds[i], fixedCounts[i],isBind);
|
| | |
| | | {
|
| | | if(compoundModel == null) return null;
|
| | |
|
| | | int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id,DisplayItemArray.FixedIds);
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | int matTypeCnt = compoundModel.unfixedItemCount + fixedIds.Length;
|
| | | switch (matTypeCnt)
|
| | | {
|
| | |
| | | if (answer.Result == 1)
|
| | | {
|
| | | successEffect.Play();
|
| | | int[] makeIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id,DisplayItemArray.MakeIds);
|
| | | for (int i = 0; i < previewItemlist.Count; i++)
|
| | | int[] makeIds = compoundModel.makeID;
|
| | | for (int i = 0; i < composeTargetEffects.Count; i++)
|
| | | {
|
| | | UIEffect targetEffect = previewItemlist[i].transform.Find("GridCell/TargetEffect").GetComponent<UIEffect>();
|
| | | var targetEffect = composeTargetEffects[i];
|
| | | if (i < makeIds.Length)
|
| | | {
|
| | | if(makeIds[i] == answer.MakeItemID)
|
| New file |
| | |
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | using TableConfig;
|
| | | using System;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class EquipTypeCell : MonoBehaviour
|
| | | {
|
| | | [SerializeField] Image equipImg;
|
| | | [SerializeField] Image bgImg;
|
| | | [SerializeField] Text nameText;
|
| | | [SerializeField] Button typeBtn;
|
| | |
|
| | | int equipIndex = 0;
|
| | | ItemCompoundConfig itemCompound;
|
| | | ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } }
|
| | |
|
| | | public void SetDisplay(int _equipIndex,ItemCompoundConfig _itemCompound)
|
| | | {
|
| | | this.equipIndex = _equipIndex;
|
| | | this.itemCompound = _itemCompound;
|
| | | int itemId = _itemCompound.makeID[0];
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId);
|
| | | if (itemConfig == null) return;
|
| | |
|
| | | equipImg.SetSprite(itemConfig.IconKey);
|
| | | bgImg.SetItemBackGround(itemConfig.ItemColor);
|
| | | nameText.text = GeneralDefine.equipPlaceNameDict[itemConfig.EquipPlace];
|
| | | typeBtn.RemoveAllListeners();
|
| | | typeBtn.AddListener(ClickTypeBtn);
|
| | | }
|
| | |
|
| | | private void ClickTypeBtn()
|
| | | {
|
| | | composeModel.UpdateComposeEquipPlace(itemCompound,equipIndex);
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 976a885fa2f849147990218323d25bd6 |
| | | timeCreated: 1541668866 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | using EnhancedUI.EnhancedScroller;
|
| | | using System.Collections.Generic;
|
| | | using TableConfig;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class EquipTypeLineCell : MonoBehaviour
|
| | | {
|
| | | [SerializeField] List<EquipTypeCell> typeCells = new List<EquipTypeCell>();
|
| | |
|
| | | public void Refresh(CellView cell, List<ComposeWinModel.ComposeThirdTypeData> thirdTypeDatas)
|
| | | {
|
| | | if (thirdTypeDatas == null) return;
|
| | |
|
| | | int length = typeCells.Count;
|
| | | for (int i = 0; i < length; i++)
|
| | | {
|
| | | var typeCell = typeCells[i];
|
| | | int index = length * cell.index + i;
|
| | | if(index < thirdTypeDatas.Count)
|
| | | {
|
| | | var thirdTypeData = thirdTypeDatas[index];
|
| | | typeCell.gameObject.SetActive(true);
|
| | | typeCell.SetDisplay(index,thirdTypeData.itemCompound);
|
| | | }
|
| | | else
|
| | | {
|
| | | typeCell.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4cf204a0437ea5b4e84fc52a04950cd1 |
| | | timeCreated: 1541668771 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | }
|
| | | }
|
| | |
|
| | | public GameObject addParent { get; private set; }
|
| | | public void SetAddParent(GameObject go)
|
| | | {
|
| | | addParent = go;
|
| | | }
|
| | |
|
| | | public event Action<ItemModel, GameObject,SelectItemType> selectEquipEvent;
|
| | | public void RefreshSelectEquip(ItemModel model)
|
| | | {
|
| | | if (selectEquipEvent != null)
|
| | | {
|
| | | selectEquipEvent(model, addParent,selectItem);
|
| | | }
|
| | | }
|
| | |
|
| | | public event Action<ComposeMatCell,int, SelectItemType> UpdateSelectEvent;
|
| | | public ComposeMatCell selectMatCell { get; private set; }
|
| | | public void SetSelectMatCell(ComposeMatCell matCell)
|
| | |
| | | public void ClearSelectModel()
|
| | | {
|
| | | selectMatCell = null;
|
| | | addParent = null;
|
| | | haveAddSelectItemDic.Clear();
|
| | | haveUnfixedSelectItemDic.Clear();
|
| | | }
|
| | |
| | | selectModel.AddHaveAddSelectItem(itemModel.itemInfo.ItemPlace);
|
| | | break;
|
| | | }
|
| | | selectModel.RefreshSelectEquip(itemModel);
|
| | | selectModel.UpdateSelectItem(itemModel.itemInfo.ItemPlace);
|
| | | CloseWin();
|
| | | }
|
| | |
| | | if (model.TryGetBetterEquip(model.currentEquipGuid, out betterEquip))
|
| | | {
|
| | | var coolData = KnapsackTimeCDMgr.Instance.GetItemCoolById(model.currentEquipGuid);
|
| | | bool isCoolEnd = coolData == null || coolData.GetRemainTime() <= 0 ? true : false;
|
| | | bool isCoolEnd = !model.CheckIsAutoEquip(betterEquip) || coolData == null || coolData.GetRemainTime() <= 0 ? true : false;
|
| | | coolObj.SetActive(!isCoolEnd);
|
| | | m_FunctionTitle.gameObject.SetActive(isCoolEnd);
|
| | | if (!isCoolEnd)
|