System/Compose/New/ComposeDogzEquipWin.cs
New file @@ -0,0 +1,635 @@ using Snxxz.UI; using System; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class ComposeDogzEquipWin : Window { [SerializeField] ScrollerController cellCtrl; [SerializeField] List<GameObject> sourceItemlist = new List<GameObject>(); [SerializeField] List<GameObject> previewItemlist = new List<GameObject>(); [SerializeField] Text successRateText; [SerializeField] Button helpBtn; [SerializeField] Button composeBtn; [SerializeField] Button onekeyPutBtn; [SerializeField] GameObject notChooseBG; [SerializeField] GameObject composeEquip; [SerializeField] UIEffect composeEffect; [SerializeField] UIEffect successEffect; [SerializeField] UIEffect failEffect; 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 _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; 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; [SerializeField] int initSuccessRate = 0; ItemCompoundConfig compoundModel = null; int successRate = 0; SelectEquipModel _selectModel; SelectEquipModel selectModel { get { return _selectModel ?? (_selectModel = ModelCenter.Instance.GetModel<SelectEquipModel>()); } } protected override void BindController() { cellCtrl.OnRefreshCell += RefreshCell; cellCtrl.vertical = true; cellCtrl.lockType = EnhanceLockType.KeepVertical; composeWinModel.ResetModelEvent += ResetModel; } protected override void AddListeners() { composeBtn.AddListener(OnClickComposeBtn); onekeyPutBtn.AddListener(OnClickOnekeyPutBtn); } protected override void OnPreOpen() { selectModel.selectEquipEvent += RefreshSelectItem; DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnComposeAnswer; UIEventTrigger.Get(helpBtn.gameObject).OnDown = OnClickHelpBtn; UIEventTrigger.Get(helpBtn.gameObject).OnUp = OnDownUp; successRate = 0; composeWinModel.funcType = ComposeFuncType.MountDogz; firstTypeDict = composeWinModel.GetFirstTypeModel(); CreateCell(); if(curSecondType == 0) { RefreshUI(null); } if (compoundModel != null) { RefreshUI(compoundModel); } } protected override void OnAfterOpen() { this.transform.SetAsLastSibling(); } protected override void OnPreClose() { selectModel.selectEquipEvent -= RefreshSelectItem; DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer; } protected override void OnAfterClose() { } private void ResetModel() { curSecondType = 0; curThirdType = 0; preSecondType = 0; preThirdType = 0; compoundModel = null; } private void CreateCell() { cellCtrl.Refresh(); if(curSecondType == 0) { ChangeUIState(true, false); } if(firstTypeDict != null) { foreach (int secondType in firstTypeDict.Keys) { cellCtrl.AddCell(ScrollerDataType.Header,secondType); if(secondType == curSecondType) { foreach (int thirdType in firstTypeDict[secondType].Keys) { if (thirdType != 0) { cellCtrl.AddCell(ScrollerDataType.Normal, thirdType); } } } } } cellCtrl.Restart(); if (secondTypeDict != null) { if (secondTypeDict.Count >= 1 && curSecondType != 0 && curThirdType == 1) { cellCtrl.JumpIndex(curSecondType - 1); } } } private void RefreshCell(ScrollerDataType type, CellView cell) { Image icon = cell.transform.Find("BtnIcon").GetComponent<Image>(); Text name = cell.transform.Find("BtnText").GetComponent<Text>(); Button cellBtn = cell.GetComponent<Button>(); cellBtn.RemoveAllListeners(); ItemCompoundConfig compoundModel = null; switch (type) { case ScrollerDataType.Header: GameObject arrowIcon = cell.transform.Find("SecondBtn").gameObject; foreach (int thirdType in firstTypeDict[cell.index].Keys) { if (thirdType != 0) { arrowIcon.SetActive(true); } else { arrowIcon.SetActive(false); } compoundModel = firstTypeDict[cell.index][thirdType][0]; name.text = compoundModel.secondTypeName; if (curSecondType == cell.index) { arrowIcon.transform.localRotation = Quaternion.Euler(0, 0, -90); icon.SetSprite("ComposeFirstClassChoosebtn"); secondTypeDict = composeWinModel.GetSecondTypeModel(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(cell.index); RefreshUI(compoundModel); } else { icon.SetSprite("ChildListBtn_UnSelect"); } cellBtn.AddListener(() => { OnClickThirdType(cell.index); }); break; } } private void OnClickSecondType(int secondType) { curSecondType = secondType; secondTypeDict = composeWinModel.GetSecondTypeModel(curSecondType); foreach (var thirdType in secondTypeDict.Keys) { if (thirdType != 0) { if (preSecondType == curSecondType) { curSecondType = 0; preSecondType = 0; } curThirdType = thirdType; } else { curThirdType = 0; } break; } if (preSecondType != curSecondType) { preSecondType = curSecondType; selectModel.ClearSelectModel(); } CreateCell(); } private void OnClickThirdType(int thirdType) { curThirdType = thirdType; if (preThirdType != curThirdType) { preThirdType = curThirdType; } CreateCell(); selectModel.ClearSelectModel(); } private void ChangeUIState(params bool[] isShows) { notChooseBG.SetActive(isShows[0]); composeEquip.SetActive(isShows[1]); } 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(); } RefreshComposeSuccessRate(); } private void ControllerRightUI() { int i = 0; #region 合成物品UI for (i = 0; i < previewItemlist.Count; i++) { GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject; if (i < composeWinModel.makeIDs.Length) { RefreshGridCellUI(gridCell, false, composeWinModel.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(); for (i = 0; i < composeWinModel.fixedItemDisplay.Length; i++) { if (composeWinModel.fixedItemDisplay[i] != 0) { GameObject matPos = sourceItemlist[composeWinModel.fixedItemDisplay[i] - 1]; GameObject gridCell = matPos.transform.Find("GridCell").gameObject; Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>(); putInText.gameObject.SetActive(false); RefreshGridCellUI(gridCell,false,composeWinModel.costfixedItemIDs[i],NeedMatType.fixedItem); List<int> itemIndexlist = null; SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem); if (singlePack != null) { itemIndexlist = singlePack.ItemIndexlist(composeWinModel.costfixedItemIDs[i], composeWinModel.costfixedItemCounts[i]); } if (itemIndexlist != null) { fixedItemIndexDict.Add(composeWinModel.costfixedItemIDs[i], itemIndexlist); } } } for (i = 0; i < composeWinModel.unfixedItemDisplay.Length; i++) { if (composeWinModel.unfixedItemDisplay[i] != 0) { GameObject matPos = sourceItemlist[composeWinModel.unfixedItemDisplay[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) { itemCell.countText.gameObject.SetActive(true); int haveCount = playerPack.GetItemCountByID(PackType.rptItem,itemId); int i = 0; for(i = 0; i < composeWinModel.costfixedItemIDs.Length; i++) { if(composeWinModel.costfixedItemIDs[i] == itemId) { if (haveCount >= composeWinModel.costfixedItemCounts[i]) { itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Green,haveCount.ToString()), "/",composeWinModel.costfixedItemCounts[i].ToString()); } else { itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Red, haveCount.ToString()), "/", composeWinModel.costfixedItemCounts[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() { successRate = 0; if (compoundModel != null) { successRate = compoundModel.successRate; } successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(successRate / 100, "%")); } private void OnClickOnekeyPutBtn() { if (compoundModel == null) return; Dictionary<int,ItemModel> unfixedSelectItemDict = selectModel.GetUnfixedItemModel(); int i = 0; for (i = 0; i <sourceItemlist.Count; 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) { if(gridCell.activeInHierarchy && !gridlock.activeInHierarchy && !itemCell.gameObject.activeInHierarchy) { if (!selectModel.GetHaveUnfixedSelectItem().ContainsKey(key)) { selectModel.AddHaveUnfixedSelectItem(key); RefreshSelectItem(unfixedSelectItemDict[key], sourceItemlist[i],SelectItemType.unfixed); break; } } } } } private void OnClickComposeBtn() { composeWinModel.SendComposeRequest(compoundModel,fixedItemIndexDict,composeEffect,1); } private void OnComposeAnswer(HA814_tagMCMakeItemAnswer answer) { if (answer.MakeType != (int)MakeType.Def_mitItemCompound) return; if (answer.Result == 1) { successEffect.Play(); } else { failEffect.Play(); } RefreshUI(compoundModel); selectModel.ClearSelectModel(); } private void OnDownUp(GameObject go) { WindowCenter.Instance.Close<ComposeHelpWin>(); } private void OnClickHelpBtn(GameObject go) { if (compoundModel != null) { WindowCenter.Instance.Open<ComposeHelpWin>(); } } } } System/Compose/New/ComposeDogzEquipWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: fb017b532aee52e4c985eebfe50daa5e timeCreated: 1534910034 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Compose/New/ComposeEquipWin.cs
@@ -182,7 +182,7 @@ if (secondTypeDict != null) { if (secondTypeDict.Count > 1 && curSecondType != 0 if (secondTypeDict.Count >= 1 && curSecondType != 0 && curThirdType == 1) { cellCtrl.JumpIndex(curSecondType - 1); System/Compose/New/ComposeTicketWin.cs
@@ -220,7 +220,7 @@ if (secondTypeDict != null) { if (secondTypeDict.Count > 1 && curSecondType != 0 if (secondTypeDict.Count >= 1 && curSecondType != 0 && curThirdType == 0) { cellCtrl.JumpIndex(curSecondType - 1); System/Compose/New/ComposeToolsWin.cs
@@ -243,7 +243,7 @@ if (secondTypeDict != null) { if (secondTypeDict.Count > 1 && curSecondType != 0 if (secondTypeDict.Count >= 1 && curSecondType != 0 && curThirdType == 0) { cellCtrl.JumpIndex(curSecondType - 1); System/Compose/New/ComposeWinModel.cs
@@ -959,6 +959,7 @@ Fairy = 3, Equip = 4, Item = 5, MountDogz = 6, } public enum NeedMatType System/Compose/New/ComposeWingsWin.cs
@@ -225,7 +225,7 @@ if(secondTypeDict != null) { if (secondTypeDict.Count > 1 && curSecondType != 0 if (secondTypeDict.Count >= 1 && curSecondType != 0 && curThirdType == 0) { cellCtrl.JumpIndex(curSecondType - 1); System/Dungeon/DungeonVictoryWin.cs
@@ -56,7 +56,10 @@ protected override void AddListeners() { m_Exit.AddListener(ExitDungeon); if (m_Exit != null) { m_Exit.AddListener(ExitDungeon); } } protected override void OnPreOpen() @@ -116,7 +119,7 @@ { base.LateUpdate(); if (!m_ExitTimer.gameObject.activeInHierarchy) if (m_ExitTimer != null && !m_ExitTimer.gameObject.activeInHierarchy) { m_ExitTimer.gameObject.SetActive(true); } @@ -138,7 +141,10 @@ protected virtual void DrawExitTimer(int seconds) { m_ExitTimer.text = Language.Get("DungeonVictoryWin_Btn_Exit_1", Mathf.Clamp(seconds, 0, int.MaxValue)); if (m_ExitTimer != null) { m_ExitTimer.text = Language.Get("DungeonVictoryWin_Btn_Exit_1", Mathf.Clamp(seconds, 0, int.MaxValue)); } } protected virtual void DrawItemRewards() @@ -421,7 +427,10 @@ protected virtual void RequireDungeonExit() { m_Exit.gameObject.SetActive(true); if (m_Exit != null) { m_Exit.gameObject.SetActive(true); } var endTime = dungeonModel.GetDungeonCoolDownEndTime(DungeonCoolDownType.LeaveMap); var seconds = (endTime - DateTime.Now).TotalSeconds; timer = (float)seconds - (int)seconds; System/LoginAd/LoginAdModel.cs
@@ -115,7 +115,7 @@ } break; case LoginAdCondition.ImpactRank: if (TimeUtility.OpenDay >= impactRankModel.openServerActivityDays || !FuncOpen.Instance.IsFuncOpen(125)) if (!OpenServerActivityCenter.Instance.IsActivityOpen(0)) { continue; } System/OpenServerActivity/ImpactRankWin.cs
@@ -245,9 +245,9 @@ switch (model.GetRankType(model.presentSelectType)) { case PlayerRankData.RankType.OpenServerRealm: m_TargetImg.gameObject.SetActive(_hasData && _playerData.value > 0); m_TotalTargetValue.gameObject.SetActive(!_hasData || _playerData.value == 0); if(_hasData && _playerData.value > 0) m_TargetImg.gameObject.SetActive(_hasData && _playerData.value >= 0); m_TotalTargetValue.gameObject.SetActive(!_hasData); if (_hasData && _playerData.value >= 0) { var _realmConfig = Config.Instance.Get<RealmConfig>(_playerData.value); m_TargetImg.SetSprite(_realmConfig == null ? string.Empty : _realmConfig.Img); System/Strengthening/EquipSuit/PlayerSuitModel.cs
@@ -137,11 +137,10 @@ /// <summary> /// 获取排序后的装备位顺序 /// </summary> List<int> orderlist = new List<int>(); Dictionary<int, ItemModel> equipDict; public List<int> GetEquipOrderlist(SuitType type) { orderlist.Clear(); List<int> orderlist = new List<int>(); SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptEquip); if (singlePack == null) { @@ -772,8 +771,7 @@ return; redSuitType = EquipSuitTips.E_SuitType; List<int> orderPlacelist = new List<int>(); orderPlacelist.AddRange(orderlist); List<int> orderPlacelist = GetEquipOrderlist(redSuitType); orderPlacelist.Sort(CompareSuitLV); for (int i = 0; i < orderPlacelist.Count; i++) @@ -809,9 +807,7 @@ break; } List<int> orderPlacelist = new List<int>(); GetEquipOrderlist(redSuitType); orderPlacelist.AddRange(orderlist); List<int> orderPlacelist = GetEquipOrderlist(redSuitType); orderPlacelist.Sort(CompareSuitLV); for (int i = 0; i < orderPlacelist.Count; i++) System/Strengthening/EquipSuitTips.cs
@@ -42,7 +42,7 @@ #endregion #region 数据 private List<int> equipPartlist = new List<int>(); private List<int> equipPartlist; private EquipSuitAttrConfig _equipSuitProModel; private EquipSuitCompoundConfig _equipSuitMatModel; private List<Transform> _materialPoslist = new List<Transform>(); @@ -153,7 +153,7 @@ E_SuitType = SuitType.HighSuit; } } equipPartlist.AddRange(SuitModel.GetEquipOrderlist(E_SuitType)); equipPartlist = SuitModel.GetEquipOrderlist(E_SuitType); CreateEquipSuitCell(); StartCoroutine(SetOffestPos()); } @@ -786,7 +786,7 @@ { int curSelect = equipPartlist[presentIndex]; E_SuitType = E_SuitType == SuitType.LowSuit ? SuitType.HighSuit : SuitType.LowSuit; equipPartlist.AddRange(SuitModel.GetEquipOrderlist(E_SuitType)); equipPartlist = SuitModel.GetEquipOrderlist(E_SuitType); for (int i = 0; i < equipPartlist.Count; i++) { if (equipPartlist[i] == curSelect) System/Strengthening/GodBeastAttributes.cs
@@ -9,18 +9,32 @@ using System; using TableConfig; //神兽强化(神兽属性展示) namespace Snxxz.UI { namespace Snxxz.UI { public class GodBeastAttributes:MonoBehaviour { public class GodBeastAttributes : MonoBehaviour { [SerializeField] ItemCell m_ItemCell; [SerializeField] GameObject m_FrameNull; [SerializeField] GameObject m_FullLevel; [SerializeField] GameObject m_BottomDisplay; [SerializeField] Text m_LvNowText; [SerializeField] Text m_LvNextText; [SerializeField] IntensifySmoothSlider m_ExpSlider; [SerializeField] Text m_ExpNum; [SerializeField] Text m_TextAttributes; [SerializeField] Text m_TextAttributesAdd; [SerializeField] Text m_TextAttributes1; [SerializeField] Text m_TextAttributesAdd1; [SerializeField] Text m_TextAttributes2; [SerializeField] Text m_TextAttributesAdd2; [SerializeField] GodBeastSlidingList m_GodBeastSlidingList; [SerializeField] Toggle m_DoubleToggle; [SerializeField] Button m_StrengthenBtn; [SerializeField] UIAlphaTween m_UIAlphaTween; [SerializeField] Slider m_Slider; DogzModel Dogz_model; DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } } private Dictionary<int, int> QualityLimit = new Dictionary<int, int>(); @@ -28,21 +42,30 @@ PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } ItemTipsModel _itemTipsModel; ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } } private int GodBeastNumber=0;//神兽编号 private int GodBeastNumber = 0;//神兽编号 private int GodBeastPart = 0;//神兽装备ID private int DogZLv = 0;//获取神兽等级 private int DogZExp = 0;//熟练度 private ItemModel m_DogZItemModel = null; private int SingleProficiency = 0;//单倍熟练度 private int DoubleProficiency = 0;//双倍熟练度 private int NeedFairyJade = 0;//所需仙玉 private void Start() private void Start() { m_DoubleToggle.onValueChanged.AddListener(OnClickToggle); m_StrengthenBtn.AddListener(OnClickStrengthBtn); } private void OnEnable() { if (m_DoubleToggle.isOn) { m_DoubleToggle.isOn = false; } GodBeastReinforcementWin.ChooseToModify += ChooseToModify; GodBeastSlidingList.AbsorbEvent += AbsorbEvent; } } private void OnDisable() { GodBeastReinforcementWin.ChooseToModify -= ChooseToModify; @@ -63,12 +86,21 @@ } private void OnClickToggle(bool Isbool) { AttributeAssignment(); } private void OnClickStrengthBtn() { } private void ChooseToModify(int locationMarker) { GetGodBeastLocationMarker(locationMarker); } private void AbsorbEvent(Dictionary<int, int> absorb) { GetDogZLevelAndExp(); AttributeAssignment(); } public void GetGodBeastLocationMarker(int LocationMarker)//获取神兽装备的标记信息 @@ -89,7 +121,7 @@ m_ItemCell.Init(ItemModel); m_ItemCell.cellBtn.RemoveAllListeners(); int type = i; m_ItemCell.cellBtn.AddListener(()=> m_ItemCell.cellBtn.AddListener(() => { itemTipsModel.SetItemTipsModel(PackType.rptDogzEquip, itemModel[type].itemInfo.ItemGUID); }); @@ -98,6 +130,7 @@ } m_FrameNull.SetActive(true); m_FullLevel.SetActive(false); GetDogZLevelAndExp(); AttributeAssignment(); } else @@ -115,8 +148,195 @@ public void AttributeAssignment() { if (m_DogZItemModel == null) { return; } GainProficiency();//获取熟练度 var IudetDogzEquipPlus = m_DogZItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus); if (IudetDogzEquipPlus != null) { int lv = QualityLimit[m_DogZItemModel.chinItemModel.ItemColor]; var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv); if (DogZLv >= lv) { m_FrameNull.SetActive(false); m_FullLevel.SetActive(true); m_ExpSlider.stage = lv; m_ExpSlider.delay = 0f; m_ExpSlider.ResetStage(); m_ExpSlider.value = 1; m_Slider.gameObject.SetActive(false); m_ExpNum.text = DogzEquipConfig.upExpTotal + "/" + DogzEquipConfig.upExpTotal; } else { if (m_DoubleToggle.isOn) { PropertySetting(DogZExp, DoubleProficiency); } else { PropertySetting(DogZExp, SingleProficiency); } } } else { if (m_DoubleToggle.isOn) { PropertySetting(0, DoubleProficiency); } else { PropertySetting(0, SingleProficiency); } } } private void GainProficiency()//选中装备的获取熟练度 { SingleProficiency = 0; DoubleProficiency = 0; NeedFairyJade = 0; Dictionary<int, int> DicAb = m_GodBeastSlidingList.Absorption_Dic; foreach (var key in DicAb.Keys) { ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptDogzItem, key); if (itemModel != null) { if (itemModel.chinItemModel.Effect1 == 235) { var IudetDogzEquipPlus = itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus); SingleProficiency += itemModel.chinItemModel.EffectValueA1 * DicAb[key]; if (IudetDogzEquipPlus != null) { SingleProficiency += IudetDogzEquipPlus[1]; DoubleProficiency += itemModel.chinItemModel.EffectValueA1; } else { DoubleProficiency += itemModel.chinItemModel.EffectValueA1 * 2 * DicAb[key]; NeedFairyJade += itemModel.chinItemModel.Effect2 * DicAb[key]; } } } } } private void PropertySetting(int ExpTotalNow, int ToExpTotal)//属性设置 { m_FrameNull.gameObject.SetActive(true); m_FullLevel.SetActive(false); int toLv = ToLv(ToExpTotal); m_LvNowText.text = "+" + DogZLv.ToString(); if (DogZLv == toLv) { m_LvNextText.text = "+" + (toLv + 1).ToString(); } else { m_LvNextText.text = "+" + toLv.ToString(); } var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, DogZLv); int[] AttType = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attType); int[] AttValue = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attValue); if (ToExpTotal == 0) { m_Slider.gameObject.SetActive(false); m_TextAttributesAdd1.gameObject.SetActive(false); m_TextAttributesAdd2.gameObject.SetActive(false); m_ExpNum.text = DogZExp + "/" + DogzEquipConfig.upExpTotal; if (AttType.Length > 1) { m_TextAttributes1.gameObject.SetActive(true); m_TextAttributes2.gameObject.SetActive(true); string StrName1 = Config.Instance.Get<PlayerPropertyConfig>(AttType[0]).Name; string StrName2 = Config.Instance.Get<PlayerPropertyConfig>(AttType[1]).Name; m_TextAttributes1.text = StrName1 + ":" + AttValue[0]; m_TextAttributes2.text = StrName2 + ":" + AttValue[1]; } else { m_TextAttributes2.gameObject.SetActive(false); string StrName1 = Config.Instance.Get<PlayerPropertyConfig>(AttType[0]).Name; m_TextAttributes1.text = StrName1 + ":" + AttValue[0]; } } else { m_Slider.gameObject.SetActive(true); if (DogZExp + ToExpTotal >= DogzEquipConfig.upExpTotal) { m_Slider.value = 1f; } else { m_Slider.value = (float)(DogZExp + ToExpTotal) / (float)(DogzEquipConfig.upExpTotal); } m_UIAlphaTween.Play(); var DogzEquipToConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, toLv); int[] AttTypeTo = ConfigParse.GetMultipleStr<int>(DogzEquipToConfig.attType); int[] AttValueTo = ConfigParse.GetMultipleStr<int>(DogzEquipToConfig.attValue); string strColor = string.Format(Language.Get("DogzGreenText"), ToExpTotal); m_ExpNum.text = DogZExp +strColor+ "/" + DogzEquipConfig.upExpTotal; if (AttType.Length > 1) { m_TextAttributes1.gameObject.SetActive(true); m_TextAttributes2.gameObject.SetActive(true); m_TextAttributesAdd1.gameObject.SetActive(true); m_TextAttributesAdd2.gameObject.SetActive(true); string StrName1 = Config.Instance.Get<PlayerPropertyConfig>(AttType[0]).Name; string StrName2 = Config.Instance.Get<PlayerPropertyConfig>(AttType[1]).Name; m_TextAttributes1.text = StrName1 + ":" + AttValue[0]; m_TextAttributes2.text = StrName2 + ":" + AttValue[1]; m_TextAttributesAdd1.text = "+" +( AttValueTo[0] - AttValue[0]); m_TextAttributesAdd2.text = "+" + (AttValueTo[1] - AttValue[1]); } else { m_TextAttributes1.gameObject.SetActive(true); m_TextAttributesAdd1.gameObject.SetActive(true); m_TextAttributes2.gameObject.SetActive(false); m_TextAttributesAdd2.gameObject.SetActive(false); string StrName1 = Config.Instance.Get<PlayerPropertyConfig>(AttType[0]).Name; m_TextAttributes1.text = StrName1 + ":" + AttValue[0]; m_TextAttributesAdd1.text = "+" + (AttValueTo[0] - AttValue[0]); } } } private int ToLv(int ToExpTotal)//获取等到达的熟练度等级 { int DogzLv = 0; if (m_DogZItemModel == null) { return DogzLv; } int lv = QualityLimit[m_DogZItemModel.chinItemModel.ItemColor]; for (int i = lv; i >= 0; i--) { var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, i); if (ToExpTotal < DogzEquipConfig.upExpTotal) { DogzLv = DogzEquipConfig.level; } } var DogzEquipMaxConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv); if (ToExpTotal >= DogzEquipMaxConfig.upExpTotal) { DogzLv = DogzEquipMaxConfig.level; } return DogzLv; } private void GetDogZLevelAndExp()//获取当前所选选择神兽的等级和熟练度 { DogZLv = 0; DogZExp = 0; m_DogZItemModel = null; List<ItemModel> itemModel = dogz_model.GetDogzEquips(GodBeastNumber); ItemModel ItemModel=null; ItemModel ItemModel = null; if (itemModel != null) { for (int i = 0; i < itemModel.Count; i++) @@ -131,67 +351,14 @@ { return; } GainProficiency();//获取熟练度 m_DogZItemModel = ItemModel; var IudetDogzEquipPlus = ItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus); if (IudetDogzEquipPlus != null) { int lv = QualityLimit[ItemModel.chinItemModel.ItemColor]; var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv); if (IudetDogzEquipPlus[0] >= lv) { m_FrameNull.SetActive(false); m_FullLevel.SetActive(true); m_ExpSlider.stage = lv; m_ExpSlider.delay = 0f; m_ExpSlider.ResetStage(); m_ExpSlider.value = 1; m_ExpNum.text = DogzEquipConfig.upExpTotal + "/" + DogzEquipConfig.upExpTotal; } else { } } else { var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart,0); m_ExpNum.text = "0/" + DogzEquipConfig.upExpTotal; DogZLv = IudetDogzEquipPlus[0]; DogZExp = IudetDogzEquipPlus[1]; } } private void GainProficiency()//获取熟练度 { SingleProficiency = 0; DoubleProficiency = 0; NeedFairyJade = 0; Dictionary<int,int> DicAb=m_GodBeastSlidingList.Absorption_Dic; foreach (var key in DicAb.Keys) { ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptDogzItem, key); if (itemModel != null) { if (itemModel.chinItemModel.Effect1 == 235) { var IudetDogzEquipPlus = itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus); SingleProficiency += itemModel.chinItemModel.EffectValueA1* DicAb[key]; if (IudetDogzEquipPlus != null) { SingleProficiency += IudetDogzEquipPlus[1]; DoubleProficiency += itemModel.chinItemModel.EffectValueA1; } else { DoubleProficiency += itemModel.chinItemModel.EffectValueA1 * 2* DicAb[key]; NeedFairyJade += itemModel.chinItemModel.Effect2* DicAb[key]; } } } } } } } System/Strengthening/GodBeastSlidingList.cs
@@ -132,11 +132,13 @@ } private void OnEnable() { } playerPack.RefreshItemCountAct += RefreshItemCountAct; playerPack.ItemCntReduceAct += ItemCntReduceAct; } private void OnDisable() { playerPack.RefreshItemCountAct -= RefreshItemCountAct; playerPack.ItemCntReduceAct -= ItemCntReduceAct; } public void Init() @@ -162,7 +164,41 @@ { m_ScrollerController.OnRefreshCell -= OnRefreshGridCell; } private void ItemCntReduceAct(PackType arg1, int arg2, int arg3) { if (arg1 == PackType.rptDogzItem) { if (m_ToggleAll.isOn) { m_ToggleAll.isOn = false; } GetGodBeastBag(); FilterQuality(); m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见 if (AbsorbEvent != null) { AbsorbEvent(AbsorptionDic); } } } private void RefreshItemCountAct(PackType arg1, int arg2, int arg3) { if (arg1 == PackType.rptDogzItem) { if (m_ToggleAll.isOn) { m_ToggleAll.isOn = false; } GetGodBeastBag(); FilterQuality(); m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见 if (AbsorbEvent != null) { AbsorbEvent(AbsorptionDic); } } } private void GetGodBeastBag()//获取神兽背包数据排序 { GodBeastBagList.Clear(); UI/EnhancedScroller/EnhancedScroller.cs
@@ -810,7 +810,7 @@ if (NumberOfCells == 0) return 0;//如果scroll没有子物体直接返回 if (cellViewIndex == 0 && insertPosition == CellViewPositionEnum.Before) if (cellViewIndex <= 0 && insertPosition == CellViewPositionEnum.Before) { return 0;//如果是第一个子物体且要得到它的上方位置,直接返回0 }