| | |
| | | [SerializeField] ScrollerController gridCtrl;
|
| | | [SerializeField] Button devourBtn;
|
| | | [SerializeField] Button equipColorSelectBtn;
|
| | | [SerializeField] Button equipLvSelectBtn;
|
| | | [SerializeField] Text equipColorText;
|
| | | [SerializeField] Text equipLvText;
|
| | | [SerializeField] GameObject colorlistObj;
|
| | | [SerializeField] GameObject lvlistObj;
|
| | | [SerializeField] ClickScreenOtherSpace colorSpaceClick;
|
| | | [SerializeField] ClickScreenOtherSpace lvSpaceClick;
|
| | |
|
| | | [SerializeField] UIEffect equipDevourEffect;
|
| | | [Header("颜色选择列表")]
|
| | | [SerializeField] List<EquipColorSelect> colorSelectlist = new List<EquipColorSelect>();
|
| | | [Header("阶级选择列表")]
|
| | | [SerializeField]
|
| | | List<EquipLvSelect> lvSelectlist = new List<EquipLvSelect>();
|
| | |
|
| | | [Header("分解装备属性")]
|
| | | [SerializeField] Text decomLvText;
|
| | |
| | | protected override void BindController()
|
| | | {
|
| | | colorlistObj.SetActive(true);
|
| | | lvlistObj.SetActive(true);
|
| | | gridCtrl.OnRefreshCell += RefreshGridCell;
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | equipColorSelectBtn.AddListener(ClickColorSelectBtn);
|
| | | equipLvSelectBtn.AddListener(ClickLvSelectBtn);
|
| | | devourBtn.AddListener(ClickEquipDecomBtn);
|
| | | colorSpaceClick.AddListener(ClickColorSelectBtn);
|
| | | lvSpaceClick.AddListener(ClickLvSelectBtn);
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | |
| | | {
|
| | | this.transform.SetAsLastSibling();
|
| | | colorlistObj.SetActive(false);
|
| | | lvlistObj.SetActive(false);
|
| | | RefreshColor(playerPack.colorType);
|
| | | RefreshLv(playerPack.lvType);
|
| | | OnRefreshColor(playerPack.colorType);
|
| | | StartCoroutine(SetJumpIndex(0));
|
| | |
|
| | | playerPack.RefreshColorSelectAct += RefreshColor;
|
| | | playerPack.RefreshLvSelectAct += RefreshLv;
|
| | | playerPack.RefreshStarSelectAct += RefreshStar;
|
| | | playerPack.RefreshColorSelectAct += OnRefreshColor;
|
| | | playerPack.itemCntAddEvent += RefreshAddItem;
|
| | | playerPack.itemCntReduceEvent += RefreshReduceItem;
|
| | | playerPack.refrechPackEvent += RefreshPack;
|
| | | playerPack.refrechPackEvent += OnRefreshPack;
|
| | | playerPack.RefreshDecomAttrAct += RefreshDecomAttr;
|
| | | equipDevourEffect.OnComplete += OnCompleteEvent;
|
| | | playerPack.RefreshEquipDecomNumAct += RefreshDecomPreviewAttr;
|
| | |
| | | protected override void OnPreClose()
|
| | | {
|
| | | equipDevourEffect.OnComplete -= OnCompleteEvent;
|
| | | playerPack.RefreshColorSelectAct -= RefreshColor;
|
| | | playerPack.RefreshLvSelectAct -= RefreshLv;
|
| | | playerPack.RefreshColorSelectAct -= OnRefreshColor;
|
| | | playerPack.itemCntAddEvent -= RefreshAddItem;
|
| | | playerPack.itemCntReduceEvent -= RefreshReduceItem;
|
| | | playerPack.refrechPackEvent -= RefreshPack;
|
| | | playerPack.RefreshStarSelectAct -= RefreshStar;
|
| | | playerPack.refrechPackEvent -= OnRefreshPack;
|
| | | playerPack.RefreshDecomAttrAct -= RefreshDecomAttr;
|
| | | playerPack.RefreshEquipDecomNumAct -= RefreshDecomPreviewAttr;
|
| | | }
|
| | |
| | | RefreshDecomposeAttr();
|
| | | RefreshDecomPreviewAttr();
|
| | | ItemConfig getMatConfig = ItemConfig.Get(2125);
|
| | | if(getMatConfig != null)
|
| | | if (getMatConfig != null)
|
| | | {
|
| | | getMatBgImg.SetItemBackGround(getMatConfig.ItemColor);
|
| | | getMatIcon.SetSprite(getMatConfig.IconKey);
|
| | | getMatBtn.RemoveAllListeners();
|
| | | getMatBtn.AddListener(()=>
|
| | | getMatBtn.AddListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(getMatConfig.ID);
|
| | | });
|
| | |
| | |
|
| | | private void RefreshGeMatProgress()
|
| | | {
|
| | | getMatProgressText.text = Language.Get("EquipDevour_Text5",StringUtility.Contact(playerPack.decomposeProgress,"/",getMatCycle));
|
| | | getMatProgressText.text = Language.Get("EquipDevour_Text5", StringUtility.Contact(playerPack.decomposeProgress, "/", getMatCycle));
|
| | | }
|
| | |
|
| | | private void RefreshAddItem(PackType type, int index, int id)
|
| | |
| | | if (type != PackType.Item || (type == PackType.Item && itemConfig.Type != 29 && itemConfig.EquipPlace <= 0)) return;
|
| | |
|
| | | devourModellist = playerPack.GetDevourModellist();
|
| | | ItemModel itemModel = playerPack.GetItemByIndex(type,index);
|
| | | ItemModel itemModel = playerPack.GetItemByIndex(type, index);
|
| | | playerPack.RefreshGetNewItem(itemModel);
|
| | | gridCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
| | | if (type != PackType.Item || (type == PackType.Item && itemConfig.Type != 29 && itemConfig.EquipPlace <= 0)) return;
|
| | |
|
| | | devourModellist = playerPack.GetDevourModellist();
|
| | | ItemModel itemModel = playerPack.GetItemByIndex(type,index);
|
| | | if(itemModel == null)
|
| | | ItemModel itemModel = playerPack.GetItemByIndex(type, index);
|
| | | if (itemModel == null)
|
| | | {
|
| | | for(int i = 0; i < playerPack.selectDevourlist.Count; i++)
|
| | | for (int i = 0; i < playerPack.selectDevourlist.Count; i++)
|
| | | {
|
| | | if(playerPack.selectDevourlist[i].gridIndex == index)
|
| | | if (playerPack.selectDevourlist[i].gridIndex == index)
|
| | | {
|
| | | playerPack.selectDevourlist.RemoveAt(i);
|
| | | break;
|
| | |
| | | gridCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | |
|
| | | private void RefreshPack(PackType type)
|
| | | private void OnRefreshPack(PackType type)
|
| | | {
|
| | | if (type != PackType.Item) return;
|
| | | playerPack.selectDevourlist.Clear();
|
| | |
| | | gridCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | | private void RefreshLv(PackModel.EquipLvType type)
|
| | | {
|
| | | for (int i = 0; i < lvSelectlist.Count; i++)
|
| | | {
|
| | | if (lvSelectlist[i].lvType == type)
|
| | | {
|
| | | equipLvText.text = lvSelectlist[i].lvText.text;
|
| | | equipLvText.color = lvSelectlist[i].lvText.color;
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (!isOpen)
|
| | | {
|
| | | lvlistObj.SetActive(false);
|
| | | playerPack.GetSelectDevourList();
|
| | | gridCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshColor(PackModel.EquipColorType type)
|
| | | private void OnRefreshColor(PackModel.EquipColorType type)
|
| | | {
|
| | | for (int i = 0; i < colorSelectlist.Count; i++)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshStar(PackModel.EquipStarType type)
|
| | | {
|
| | | if (!isOpen)
|
| | | {
|
| | | playerPack.GetSelectDevourList();
|
| | | gridCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | | }
|
| | |
|
| | | private void CreateCell()
|
| | | {
|
| | | gridCtrl.Refresh();
|
| | | int line = sumGridNum / singleLineNum;
|
| | | for(int i = 0; i < line; i++)
|
| | | for (int i = 0; i < line; i++)
|
| | | {
|
| | | gridCtrl.AddCell(ScrollerDataType.Header,i);
|
| | | gridCtrl.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | | gridCtrl.Restart();
|
| | | }
|
| | |
| | | private void RefreshGridCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | int childLength = cell.transform.childCount;
|
| | | for(int i = 0; i < childLength; i++)
|
| | | for (int i = 0; i < childLength; i++)
|
| | | {
|
| | | int cellCnt = cell.index * singleLineNum + (i + 1);
|
| | | DevourGridCell gridCell = cell.transform.GetChild(i).GetComponent<DevourGridCell>();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void ClickLvSelectBtn()
|
| | | {
|
| | | if (lvlistObj.activeInHierarchy)
|
| | | {
|
| | | lvlistObj.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | lvlistObj.SetActive(true);
|
| | | }
|
| | | }
|
| | |
|
| | | private void ClickColorSelectBtn()
|
| | | {
|
| | | if(colorlistObj.activeInHierarchy)
|
| | | if (colorlistObj.activeInHierarchy)
|
| | | {
|
| | | colorlistObj.SetActive(false);
|
| | | }
|
| | |
| | | WindowCenter.Instance.Open<DecomposeGetItemWin>();
|
| | | }
|
| | | }
|
| | | |
| | | public void RefreshDecomposeAttr(bool isRefresh = false)
|
| | |
|
| | | void RefreshDecomposeAttr(bool isRefresh = false)
|
| | | {
|
| | | //decomPreviewLvText.gameObject.SetActive(false);
|
| | | decomLvText.text = playerPack.decomposeLv.ToString();
|
| | | EquipDeComposeConfig deComposeConfig = EquipDeComposeConfig.Get(playerPack.decomposeLv);
|
| | | expNumText.text = StringUtility.Contact(playerPack.decomposeExp,"/",deComposeConfig.UpNeedExp);
|
| | | if(!isRefresh)
|
| | | expNumText.text = StringUtility.Contact(playerPack.decomposeExp, "/", deComposeConfig.UpNeedExp);
|
| | | if (!isRefresh)
|
| | | {
|
| | | expSlider.delay = 0;
|
| | | expSlider.ResetStage();
|
| | |
| | | else
|
| | | {
|
| | | expSlider.delay = 0.1f;
|
| | | |
| | |
|
| | | }
|
| | | expSlider.stage = playerPack.decomposeLv;
|
| | | expSlider.value = (float)Math.Round((double)playerPack.decomposeExp / deComposeConfig.UpNeedExp, 2, MidpointRounding.AwayFromZero);//经验条的初始化和刷新
|
| | | Dictionary<int, int> attrDict = playerPack.GetDecomAttrDictByLv(playerPack.decomposeLv);
|
| | | var attrDict = playerPack.GetDecomAttrDictByLv(playerPack.decomposeLv);
|
| | | List<int> attrIdlist = null;
|
| | | List<int> attrValuelist = null;
|
| | | if(attrDict != null)
|
| | | if (attrDict != null)
|
| | | {
|
| | | attrIdlist = attrDict.Keys.ToList();
|
| | | attrValuelist = attrDict.Values.ToList();
|
| | | }
|
| | | for(int i = 0; i < decomAttrlist.Count; i++)
|
| | | for (int i = 0; i < decomAttrlist.Count; i++)
|
| | | {
|
| | | if (attrIdlist != null)
|
| | | {
|
| | | if(i < attrIdlist.Count)
|
| | | if (i < attrIdlist.Count)
|
| | | {
|
| | | decomAttrlist[i].SetActive(true);
|
| | | decomAttrPreviewlist[i].gameObject.SetActive(false);
|
| | | PlayerPropertyConfig propertyConfig = PlayerPropertyConfig.Get(attrIdlist[i]);
|
| | | decomAttrNamelist[i].text = StringUtility.Contact(propertyConfig.Name,":");
|
| | | decomAttrNamelist[i].text = StringUtility.Contact(propertyConfig.Name, ":");
|
| | | decomAttrValuelist[i].text = attrValuelist[i].ToString();
|
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | int equipAddExpPreview = 0;
|
| | | public void RefreshDecomPreviewAttr()
|
| | | void RefreshDecomPreviewAttr()
|
| | | {
|
| | | equipAddExpPreview = 0;
|
| | | EquipDeComposeConfig deComposeConfig = EquipDeComposeConfig.Get(playerPack.decomposeLv);
|
| | | if (playerPack.selectDevourlist.Count > 0)
|
| | | {
|
| | | int devourCnt = GetRealDevourCnt();
|
| | | equipAddExpPreview = GetPreviewExpByDevour();
|
| | | int previewLv = GetPreviewDecomposeLv(playerPack.decomposeLv, 0);
|
| | | //decomPreviewLvText.gameObject.SetActive(true);
|
| | | //decomPreviewLvText.text = StringUtility.Contact("+", previewLv - playerPack.decomposeLv);
|
| | | Dictionary<int, int> attrDict = playerPack.GetDecomAttrDictByLv(playerPack.decomposeLv);
|
| | | Dictionary<int, int> attrPreviewDict = playerPack.GetDecomAttrDictByLv(previewLv);
|
| | | var previewLv = GetPreviewDecomposeLv(playerPack.decomposeLv, 0);
|
| | | var attrDict = playerPack.GetDecomAttrDictByLv(playerPack.decomposeLv);
|
| | | var attrPreviewDict = playerPack.GetDecomAttrDictByLv(previewLv);
|
| | | if (attrDict != null)
|
| | | {
|
| | | int i = 0;
|
| | |
| | | i += 1;
|
| | | }
|
| | | }
|
| | | string previewExp = StringUtility.Contact(playerPack.decomposeExp,"+",equipAddExpPreview);
|
| | | expNumText.text = StringUtility.Contact(UIHelper.AppendColor(TextColType.Green,previewExp,true),"/"+ deComposeConfig.UpNeedExp);
|
| | | string previewExp = StringUtility.Contact(playerPack.decomposeExp, "+", equipAddExpPreview);
|
| | | expNumText.text = StringUtility.Contact(UIHelper.AppendColor(TextColType.Green, previewExp, true), "/" + deComposeConfig.UpNeedExp);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public int GetPreviewDecomposeLv(int decomLv,int sumNeedExp)
|
| | | public int GetPreviewDecomposeLv(int decomLv, int sumNeedExp)
|
| | | {
|
| | | EquipDeComposeConfig deComposeConfig = EquipDeComposeConfig.Get(decomLv);
|
| | | if(!playerPack.IsMaxDecomLv(decomLv,out decomLv))
|
| | | if (!playerPack.IsMaxDecomLv(decomLv, out decomLv))
|
| | | {
|
| | | if (decomLv == playerPack.decomposeLv)
|
| | | {
|
| | |
| | | SysNotifyMgr.Instance.ShowTip("EquipDevour_Text_1");
|
| | | return;
|
| | | }
|
| | | int devourCnt = GetRealDevourCnt();
|
| | | int betterEquip = 0;
|
| | | int preciousCnt = 0;
|
| | | int twoStarCnt = 0;
|
| | | bool isContain = playerPack.ContainPreciousItem(realDevourlist, out betterEquip, out preciousCnt);
|
| | | bool isTwoStarEquip = playerPack.ContainTwoStarEquip(realDevourlist,out twoStarCnt);
|
| | | if (isContain || isTwoStarEquip)
|
| | |
|
| | | var betterEquipCount = GetBetterEquipCount(playerPack.selectDevourlist);
|
| | | if (betterEquipCount > 0)
|
| | | {
|
| | | if(betterEquip > 0 && preciousCnt > 0)
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
|
| | | Language.Get("EquipResolve_Text_1", betterEquip, preciousCnt),
|
| | | (bool isOk) =>
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | equipDevourEffect.Play();
|
| | | SendEquipdevourQuest();
|
| | | }
|
| | | });
|
| | | }
|
| | | else if(twoStarCnt > 0 && preciousCnt > 0)
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
|
| | | Language.Get("EquipResolve_Text_6", twoStarCnt, preciousCnt),
|
| | | (bool isOk) =>
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
|
| | | Language.Get("EquipResolve_Text_1", betterEquipCount),
|
| | | (bool ok) =>
|
| | | {
|
| | | if (ok)
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | equipDevourEffect.Play();
|
| | | SendEquipdevourQuest();
|
| | | }
|
| | | });
|
| | | }
|
| | | else if(betterEquip > 0)
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
|
| | | Language.Get("EquipResolve_Text_5", betterEquip),
|
| | | (bool isOk) =>
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | equipDevourEffect.Play();
|
| | | SendEquipdevourQuest();
|
| | | }
|
| | | });
|
| | | }
|
| | | else if(preciousCnt > 0)
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
|
| | | Language.Get("EquipResolve_Text_4",preciousCnt),
|
| | | (bool isOk) =>
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | equipDevourEffect.Play();
|
| | | SendEquipdevourQuest();
|
| | | }
|
| | | });
|
| | | }
|
| | | else if(twoStarCnt > 0)
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
|
| | | Language.Get("EquipResolve_Text_7", twoStarCnt),
|
| | | (bool isOk) =>
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | equipDevourEffect.Play();
|
| | | SendEquipdevourQuest();
|
| | | }
|
| | | });
|
| | | }
|
| | | |
| | | equipDevourEffect.Play();
|
| | | playerPack.SendEquipdevourQuest(false);
|
| | | }
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | equipDevourEffect.Play();
|
| | | SendEquipdevourQuest();
|
| | | playerPack.SendEquipdevourQuest(false);
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | private void OnCompleteEvent()
|
| | |
| | | decomEffect.Play();
|
| | | }
|
| | |
|
| | | public int GetPreviewExpByDevour()
|
| | | int GetBetterEquipCount(List<ItemModel> itemModels) |
| | | { |
| | | if (itemModels.IsNullOrEmpty())
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | |
| | | var count = 0; |
| | | foreach (var item in itemModels)
|
| | | {
|
| | | if (ItemLogicUtility.Instance.IsFightUp(item.itemId, item.score) == 1) |
| | | {
|
| | | count += item.count; |
| | | }
|
| | | } |
| | | return count; |
| | | }
|
| | |
|
| | | int GetPreviewExpByDevour()
|
| | | {
|
| | | int sumExp = 0;
|
| | | for (int i = 0; i < realDevourlist.Count; i++)
|
| | | for (int i = 0; i < playerPack.selectDevourlist.Count; i++)
|
| | | {
|
| | | int curExp = 0;
|
| | | ItemModel itemModel = realDevourlist[i];
|
| | | ItemModel itemModel = playerPack.selectDevourlist[i];
|
| | | if (itemModel.config.EquipPlace == 0)
|
| | | {
|
| | | curExp = itemModel.count * itemModel.config.EffectValueA1;
|
| | | }
|
| | | else
|
| | | {
|
| | | PetEatEquipConfig tagPet = PetEatEquipConfig.GetEquipColorAndEquipClass(itemModel.config.ItemColor, itemModel.config.LV);
|
| | | var tagPet = PetEatEquipConfig.GetEquipColorAndEquipClass(itemModel.config.ItemColor, itemModel.config.LV);
|
| | | if (tagPet != null)
|
| | | {
|
| | | curExp = tagPet.Exp;
|
| | |
| | | return sumExp;
|
| | | }
|
| | |
|
| | | public void SendEquipdevourQuest()
|
| | | {
|
| | | if (!ItemLogicUtility.Instance.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return;
|
| | |
|
| | | playerPack.isAutoDecompose = false;
|
| | | SettingEffectMgr.Instance.isStartDecompose = true;
|
| | | CA32C_tagCMEquipDecompose _petEat = new CA32C_tagCMEquipDecompose();
|
| | | var _petIndex = new ushort[realDevourlist.Count];
|
| | | var idlist = new uint[realDevourlist.Count];
|
| | | for (int i = 0; i < realDevourlist.Count; i++)
|
| | | {
|
| | | _petIndex[i] = (ushort)realDevourlist[i].gridIndex;
|
| | | idlist[i] = (uint)realDevourlist[i].itemId;
|
| | | }
|
| | | _petEat.Count = (byte)_petIndex.Length;
|
| | | _petEat.IndexList = _petIndex;
|
| | | _petEat.ItemIDList = idlist;
|
| | | _petEat.IsAuto = 0;
|
| | | GameNetSystem.Instance.SendInfo(_petEat);
|
| | | }
|
| | |
|
| | | List<ItemModel> realDevourlist = new List<ItemModel>();
|
| | | private int GetRealDevourCnt()
|
| | | {
|
| | | realDevourlist.Clear();
|
| | | int devourCnt = 0;
|
| | | for (int i = 0; i < sumGridNum; i++)
|
| | | {
|
| | | if (i < devourModellist.Count)
|
| | | {
|
| | | ItemModel itemModel = devourModellist[i];
|
| | | if(playerPack.selectDevourlist.Contains(itemModel))
|
| | | {
|
| | | devourCnt += itemModel.count;
|
| | | realDevourlist.Add(itemModel);
|
| | | }
|
| | | }
|
| | | }
|
| | | return devourCnt;
|
| | | }
|
| | | }
|
| | | }
|