| | |
| | | {
|
| | | public class ComposeTicketWin : Window
|
| | | {
|
| | | [SerializeField]
|
| | | GameObject composeUIShowObj;
|
| | | [SerializeField]
|
| | | GameObject noneComposeObj;
|
| | |
|
| | | [SerializeField]
|
| | | ScrollerController cellCtrl;
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> sourceItemlist = new List<GameObject>();
|
| | |
|
| | | [SerializeField]
|
| | | List<GameObject> previewItemlist = new List<GameObject>();
|
| | |
|
| | | [SerializeField]
|
| | | Text successRateText;
|
| | |
|
| | | [SerializeField]
|
| | | Text _moneyCountText;
|
| | |
|
| | | [SerializeField] ScrollerController cellCtrl;
|
| | | [SerializeField] GameObject containCompose;
|
| | | [SerializeField] GameObject containUnCompose;
|
| | | [SerializeField] GameObject containOneMat;
|
| | | [SerializeField] GameObject containTwoMat;
|
| | | [SerializeField] Text successRateText;
|
| | | [SerializeField] Text _moneyCountText;
|
| | | [SerializeField] GameObject costMoneyObj;
|
| | |
|
| | | [SerializeField]
|
| | | Button composeBtn;
|
| | |
|
| | | [SerializeField] Button composeBtn;
|
| | | [SerializeField] Button allComposeBtn;
|
| | |
|
| | | [SerializeField] UIEffect composeEffect;
|
| | |
|
| | | [SerializeField] UIEffect twoMatComposeEffect;
|
| | | [SerializeField] UIEffect oneMatComposeEffect;
|
| | | [Header("一个固定物品和非固定物品")]
|
| | | [SerializeField] List<ComposeMatCell> oneMatFixedAndUnfixeds = new List<ComposeMatCell>();
|
| | | [Header("非一个固定物品和非固定物品")]
|
| | | [SerializeField] List<ComposeMatCell> twoMatFixedAndUnfixeds = new List<ComposeMatCell>();
|
| | | [Header("合成物品")]
|
| | | [SerializeField] List<ComposeMatCell> makeItems = new List<ComposeMatCell>();
|
| | | |
| | | ComposeWinModel _composeWinModel;
|
| | | ComposeWinModel composeWinModel
|
| | | {
|
| | | 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 _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); }
|
| | | }
|
| | |
|
| | | 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;
|
| | |
|
| | | private int curSecondType = 0;
|
| | | private int curThirdType = 0;
|
| | | private int preSecondType = 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>()); }
|
| | | }
|
| | |
|
| | | AchievementGuideEffect guidEffect = null;
|
| | |
|
| | | protected override void BindController()
|
| | | {
|
| | | cellCtrl.OnRefreshCell += RefreshCell;
|
| | | cellCtrl.OnRefreshCell += RefreshTypeCell;
|
| | | cellCtrl.vertical = true;
|
| | | cellCtrl.lockType = EnhanceLockType.KeepVertical;
|
| | | composeWinModel.ResetModelEvent += ResetModel;
|
| | |
| | | protected override void OnPreOpen()
|
| | | {
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnComposeAnswer;
|
| | | firstTypeDict = composeWinModel.GetFirstTypeModel((int)ComposeFuncType.Ticket);
|
| | | 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()
|
| | | {
|
| | | cellCtrl.vertical = true;
|
| | | this.transform.SetAsLastSibling();
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | composeWinModel.UpdateSecondTypeEvent -= UpdateSecondType;
|
| | | composeWinModel.UpdateThirdTypeEvent -= UpdateThirdType;
|
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | |
|
| | | }
|
| | | #region 新的逻辑
|
| | | private void Display()
|
| | | {
|
| | | composeWinModel.TryGetFirstTypeData((int)ComposeFuncType.Ticket, out firstTypeData);
|
| | | if (firstTypeData == null) return;
|
| | |
|
| | | DefaultSelect();
|
| | | CreateTypeCell();
|
| | | JumpIndex();
|
| | | }
|
| | | private void DefaultSelect()
|
| | | {
|
| | | bool isJumpTo = false;
|
| | | if (AchievementGoto.guideAchievementId != 0)
|
| | | 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.Ticket, composeWinModel.secondType);
|
| | | ClickSecondTypeUICtrl();
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | | |
| | | isJumpTo = true;
|
| | | curSecondType = composeWinModel.secondType;
|
| | | curThirdType = composeWinModel.thirdType;
|
| | | composeWinModel.ResetJumpToModel();
|
| | | }
|
| | | else
|
| | | {
|
| | | if(composeWinModel.secondType != 0)
|
| | | 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)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Ticket, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | RefreshUI(null);
|
| | | }
|
| | |
|
| | | 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("Z1011"));
|
| | | isCanCompose = false;
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | cellCtrl.vertical = true;
|
| | | this.transform.SetAsLastSibling();
|
| | | }
|
| | |
|
| | | 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)
|
| | | else
|
| | | {
|
| | | foreach (int secondType in firstTypeDict.Keys)
|
| | | 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)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Header,secondType);
|
| | | if(secondType == curSecondType)
|
| | | var thirdTypeDict = firstTypeData.secondTypeDict[second].thirdTypeDict;
|
| | | foreach (var third in thirdTypeDict.Keys)
|
| | | {
|
| | | foreach (int thirdType in firstTypeDict[secondType].Keys)
|
| | | if (third != 0)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | {
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal, thirdType);
|
| | | }
|
| | | cellCtrl.AddCell(ScrollerDataType.Normal, third);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | cellCtrl.Restart();
|
| | |
|
| | | if (secondTypeDict != null)
|
| | | if (curSecondType != 0)
|
| | | {
|
| | | if (secondTypeDict.Count >= 1 && curSecondType != 0)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Ticket, curSecondType, curThirdType, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | cellCtrl.JumpIndex(GetCurIndex(curSecondType));
|
| | | var fixItemIds = thirdTypeData.itemCompound.itemID;
|
| | | if(fixItemIds != null)
|
| | | {
|
| | | if(fixItemIds.Length < 2)
|
| | | {
|
| | | UpdateUIShow(true,false,true,false);
|
| | | }
|
| | | else
|
| | | {
|
| | | UpdateUIShow(true, false, false, true);
|
| | | }
|
| | | |
| | | }
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshUI(null);
|
| | | UpdateUIShow(false, true, false, false);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | RefreshUI(null);
|
| | | UpdateUIShow(false,true, false,false);
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateUIShow(params bool[] isShows)
|
| | | {
|
| | | containCompose.SetActive(isShows[0]);
|
| | | containUnCompose.SetActive(isShows[1]);
|
| | | containOneMat.SetActive(isShows[2]);
|
| | | containTwoMat.SetActive(isShows[3]);
|
| | | }
|
| | |
|
| | | 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])
|
| | |
| | | }
|
| | | 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.Ticket, cell.index, out _secondTypeData);
|
| | | if (_secondTypeData != null)
|
| | | {
|
| | | if (thirdType != 0)
|
| | | var thirdTypeDict = _secondTypeData.thirdTypeDict;
|
| | | foreach (var third in thirdTypeDict.Keys)
|
| | | {
|
| | | arrowIcon.SetActive(true);
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData = null;
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Ticket, cell.index, third, out thirdTypeData);
|
| | | firstTypeCell.SetDisplay((int)ComposeFuncType.Ticket, 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.Ticket, 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;
|
| | | ComposeSecondTypeCell secondTypeCell = cell.GetComponent<ComposeSecondTypeCell>();
|
| | | secondTypeCell.SetDisplay((int)ComposeFuncType.Ticket, curSecondType, cell.index, curThirdType);
|
| | | if (curThirdType == cell.index)
|
| | | {
|
| | | icon.SetSprite("ChildListBtn_Select");
|
| | | thirdTypelist = composeWinModel.GetThirdTypeModellist(compoundModel.firstType, compoundModel.secondType, cell.index);
|
| | | RefreshUI(compoundModel);
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData = null;
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Ticket, curSecondType, cell.index,out thirdTypeData);
|
| | | RefreshUI(thirdTypeData.itemCompound);
|
| | | }
|
| | | else
|
| | | {
|
| | | icon.SetSprite("ChildListBtn_UnSelect");
|
| | | }
|
| | | cellBtn.AddListener(() => { OnClickThirdType(cell.index); });
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnClickSecondType(int secondType)
|
| | | private void UpdateSecondType(int secondType)
|
| | | {
|
| | | curThirdType = 0;
|
| | | curSecondType = secondType;
|
| | | secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Ticket, curSecondType);
|
| | | foreach (var thirdType in secondTypeDict.Keys)
|
| | | composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.Ticket, 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;
|
| | | }
|
| | | else
|
| | | {
|
| | | curThirdType = thirdType;
|
| | | }
|
| | | }
|
| | | break;
|
| | | }
|
| | | curThirdType = 0;
|
| | | break;
|
| | | }
|
| | |
|
| | | if (preSecondType != curSecondType)
|
| | |
| | | guidEffect = null;
|
| | | }
|
| | | }
|
| | | ClickSecondTypeUICtrl();
|
| | | CreateCell();
|
| | | }
|
| | |
|
| | | private void ClickSecondTypeUICtrl()
|
| | | private void UpdateThirdType(int thirdType)
|
| | | {
|
| | | if (secondTypeDict.Count > 1)
|
| | | composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Ticket, 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;
|
| | | CreateTypeCell();
|
| | | }
|
| | |
|
| | | private void OnClickThirdType(int thirdType)
|
| | | private void UpdateComposeMat()
|
| | | {
|
| | | curThirdType = thirdType;
|
| | | cellCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | 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;
|
| | | if(fixedIds != null && fixedIds.Length < 2)
|
| | | {
|
| | | for (int i = 0; i < oneMatFixedAndUnfixeds.Count; i++)
|
| | | {
|
| | | var matCell = oneMatFixedAndUnfixeds[i];
|
| | | var fixedDisplay = 0;
|
| | | var unfixedDisplay = 0;
|
| | | if (i < fixedDisplays.Length)
|
| | | {
|
| | | fixedDisplay = fixedDisplays[i];
|
| | | }
|
| | | else
|
| | | {
|
| | | int unfixedIndex = i - fixedDisplays.Length;
|
| | | if (unfixedIndex < unfixedDisplays.Length)
|
| | | {
|
| | | unfixedDisplay = unfixedDisplays[unfixedIndex];
|
| | | }
|
| | | }
|
| | | |
| | | if (fixedDisplays != null
|
| | | && fixedDisplay != 0
|
| | | && fixedDisplays.Contains(fixedDisplay))
|
| | | {
|
| | | 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))
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false);
|
| | | }
|
| | | else
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | | }
|
| | | }
|
| | | else if(fixedIds != null)
|
| | | {
|
| | | for (int i = 0; i < twoMatFixedAndUnfixeds.Count; i++)
|
| | | {
|
| | | var matCell = twoMatFixedAndUnfixeds[i];
|
| | | var fixedDisplay = 0;
|
| | | var unfixedDisplay = 0;
|
| | | if (i < fixedDisplays.Length)
|
| | | {
|
| | | fixedDisplay = fixedDisplays[i];
|
| | | }
|
| | | else
|
| | | {
|
| | | int unfixedIndex = i - fixedDisplays.Length;
|
| | | if (unfixedIndex < unfixedDisplays.Length)
|
| | | {
|
| | | unfixedDisplay = unfixedDisplays[unfixedIndex];
|
| | | }
|
| | | }
|
| | | |
| | | if (fixedDisplays != null
|
| | | && fixedDisplay != 0
|
| | | && fixedDisplays.Contains(fixedDisplay))
|
| | | {
|
| | | 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))
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.unfixedItem, false);
|
| | | }
|
| | | else
|
| | | {
|
| | | matCell.SetDisplay(compoundModel, NeedMatType.Nothing, true);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | _moneyCountText.text = modelInterface.OnChangeCoinsUnit((ulong)compoundModel.money);
|
| | | }
|
| | |
|
| | | private UIEffect GetPlayMatEffect()
|
| | | {
|
| | | if (compoundModel == null) return null;
|
| | |
|
| | | int[] fixedIds = compoundModel.itemID;
|
| | | if(fixedIds != null)
|
| | | {
|
| | | if(fixedIds.Length < 2)
|
| | | {
|
| | | return oneMatComposeEffect;
|
| | | }
|
| | | else
|
| | | {
|
| | | return twoMatComposeEffect;
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | | #endregion
|
| | | private void ResetModel()
|
| | | {
|
| | | curSecondType = 0;
|
| | | curThirdType = 0;
|
| | | preSecondType = 0;
|
| | | compoundModel = null;
|
| | | }
|
| | |
|
| | | 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();
|
| | | }
|
| | | if (compoundModel == null) return;
|
| | |
|
| | | successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(compoundModel.successRate / 100, "%"));
|
| | | composeWinModel.SetCurComposeModel(compoundModel);
|
| | | UpdateComposeMat();
|
| | | }
|
| | |
|
| | | 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
|
| | |
|
| | | _moneyCountText.text = modelInterface.OnChangeCoinsUnit((ulong)compoundModel.money);
|
| | | }
|
| | |
|
| | | 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);
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | |
| | | private void ClickAllComposeBtn()
|
| | | {
|
| | | fixedItemIndexDict.Clear();
|
| | |
| | |
|
| | | List<int> composeCountlist = new List<int>();
|
| | | 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++)
|
| | | {
|
| | | int haveCount = playerPack.GetItemCountByID(PackType.rptItem, fixedIds[i]);
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | composeWinModel.SendComposeRequest(compoundModel, fixedItemIndexDict, composeEffect, composeCnt);
|
| | | composeWinModel.SendComposeRequest(compoundModel, fixedItemIndexDict,GetPlayMatEffect(), composeCnt);
|
| | | }
|
| | |
|
| | | private void OnClickComposeBtn()
|
| | |
| | | if (compoundModel == null) return;
|
| | |
|
| | | SetFixedItemIndexDic();
|
| | | composeWinModel.SendComposeRequest(compoundModel, fixedItemIndexDict,composeEffect,1);
|
| | | composeWinModel.SendComposeRequest(compoundModel, fixedItemIndexDict,GetPlayMatEffect(),1);
|
| | | }
|
| | |
|
| | | private void SetFixedItemIndexDic()
|
| | |
| | | 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++)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | RefreshUI(compoundModel);
|
| | | selectModel.ClearSelectModel();
|
| | | }
|
| | | }
|
| | | }
|