| Core/GameEngine/Model/Config/ItemCompoundConfig.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Core/GameEngine/Model/Config/ItemCompoundConfig.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Core/GameEngine/Model/TelPartialConfig/tagItemCompoundConfig.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Core/NetworkPackage/ClientPack/ClientToMapServer/CA3_Item/CA303_tagCMItemCompound.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Compose/New/ComposeEquipWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Compose/New/ComposeFirstTypeCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Compose/New/ComposeFirstTypeCell.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Compose/New/ComposeSecondTypeCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Compose/New/ComposeSecondTypeCell.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Compose/New/ComposeToolsWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Compose/New/ComposeWinModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Core/GameEngine/Model/Config/ItemCompoundConfig.cs
@@ -1,6 +1,6 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Saturday, January 06, 2018 // [ Date ]: Wednesday, October 31, 2018 //-------------------------------------------------------- using UnityEngine; @@ -11,24 +11,26 @@ public partial class ItemCompoundConfig : ConfigBase { public int id { get ; private set ; } public int firstType { get ; private set ; } public int levelNeed { get ; private set ; } public int secondType { get ; private set ; } public string secondTypeName { get ; private set; } public int thirdType { get ; private set ; } public string thirdTypeName { get ; private set; } public string makeID { get ; private set; } public string unfixedItemID { get ; private set; } public int unfixedItemCount { get ; private set ; } public string unfixedItemDisplay { get ; private set; } public string itemID { get ; private set; } public string itemCount { get ; private set; } public string itemDisplay { get ; private set; } public int money { get ; private set ; } public int successRate { get ; private set ; } public int successUpper { get ; private set ; } public int addonsCountMax { get ; private set ; } public int id { get ; private set ; } public int firstType { get ; private set ; } public int levelNeed { get ; private set ; } public int trailerLevel { get ; private set ; } public int secondType { get ; private set ; } public string secondTypeName { get ; private set; } public int thirdType { get ; private set ; } public string thirdTypeName { get ; private set; } public int[] makeID; public int[] unfixedItemID; public int unfixedItemCount { get ; private set ; } public int[] unfixedItemDisplay; public int[] itemID; public int[] itemCount; public int[] itemDisplay; public int money { get ; private set ; } public int successRate { get ; private set ; } public int successUpper { get ; private set ; } public int[] successRateIncrease; public int addonsCountMax { get ; private set ; } public string helpDesc { get ; private set; } public override string getKey() @@ -39,43 +41,82 @@ public override void Parse() { try { id=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0; firstType=IsNumeric(rawContents[1]) ? int.Parse(rawContents[1]):0; levelNeed=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0; secondType=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0; secondTypeName = rawContents[4].Trim(); thirdType=IsNumeric(rawContents[5]) ? int.Parse(rawContents[5]):0; thirdTypeName = rawContents[6].Trim(); makeID = rawContents[7].Trim(); unfixedItemID = rawContents[8].Trim(); unfixedItemCount=IsNumeric(rawContents[9]) ? int.Parse(rawContents[9]):0; unfixedItemDisplay = rawContents[10].Trim(); itemID = rawContents[11].Trim(); itemCount = rawContents[12].Trim(); itemDisplay = rawContents[13].Trim(); money=IsNumeric(rawContents[14]) ? int.Parse(rawContents[14]):0; successRate=IsNumeric(rawContents[15]) ? int.Parse(rawContents[15]):0; successUpper=IsNumeric(rawContents[16]) ? int.Parse(rawContents[16]):0; addonsCountMax=IsNumeric(rawContents[17]) ? int.Parse(rawContents[17]):0; helpDesc = rawContents[18].Trim(); id=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0; firstType=IsNumeric(rawContents[1]) ? int.Parse(rawContents[1]):0; levelNeed=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0; trailerLevel=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0; secondType=IsNumeric(rawContents[4]) ? int.Parse(rawContents[4]):0; secondTypeName = rawContents[5].Trim(); thirdType=IsNumeric(rawContents[6]) ? int.Parse(rawContents[6]):0; thirdTypeName = rawContents[7].Trim(); string[] makeIDStringArray = rawContents[8].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); makeID = new int[makeIDStringArray.Length]; for (int i=0;i<makeIDStringArray.Length;i++) { int.TryParse(makeIDStringArray[i],out makeID[i]); } string[] unfixedItemIDStringArray = rawContents[9].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); unfixedItemID = new int[unfixedItemIDStringArray.Length]; for (int i=0;i<unfixedItemIDStringArray.Length;i++) { int.TryParse(unfixedItemIDStringArray[i],out unfixedItemID[i]); } unfixedItemCount=IsNumeric(rawContents[10]) ? int.Parse(rawContents[10]):0; string[] unfixedItemDisplayStringArray = rawContents[11].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); unfixedItemDisplay = new int[unfixedItemDisplayStringArray.Length]; for (int i=0;i<unfixedItemDisplayStringArray.Length;i++) { int.TryParse(unfixedItemDisplayStringArray[i],out unfixedItemDisplay[i]); } string[] itemIDStringArray = rawContents[12].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); itemID = new int[itemIDStringArray.Length]; for (int i=0;i<itemIDStringArray.Length;i++) { int.TryParse(itemIDStringArray[i],out itemID[i]); } string[] itemCountStringArray = rawContents[13].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); itemCount = new int[itemCountStringArray.Length]; for (int i=0;i<itemCountStringArray.Length;i++) { int.TryParse(itemCountStringArray[i],out itemCount[i]); } string[] itemDisplayStringArray = rawContents[14].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); itemDisplay = new int[itemDisplayStringArray.Length]; for (int i=0;i<itemDisplayStringArray.Length;i++) { int.TryParse(itemDisplayStringArray[i],out itemDisplay[i]); } money=IsNumeric(rawContents[15]) ? int.Parse(rawContents[15]):0; successRate=IsNumeric(rawContents[16]) ? int.Parse(rawContents[16]):0; successUpper=IsNumeric(rawContents[17]) ? int.Parse(rawContents[17]):0; string[] successRateIncreaseStringArray = rawContents[18].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); successRateIncrease = new int[successRateIncreaseStringArray.Length]; for (int i=0;i<successRateIncreaseStringArray.Length;i++) { int.TryParse(successRateIncreaseStringArray[i],out successRateIncrease[i]); } addonsCountMax=IsNumeric(rawContents[19]) ? int.Parse(rawContents[19]):0; helpDesc = rawContents[20].Trim(); } catch (Exception ex) { Core/GameEngine/Model/Config/ItemCompoundConfig.cs.meta
@@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: f7aa11735b56478439413cb389e5fc41 timeCreated: 1515213736 timeCreated: 1540973067 licenseType: Pro MonoImporter: serializedVersion: 2 Core/GameEngine/Model/TelPartialConfig/tagItemCompoundConfig.cs
@@ -46,12 +46,12 @@ } int[] makeIDs = ConfigParse.GetMultipleStr<int>(makeID); int[] unfixedItemIDs = ConfigParse.GetMultipleStr<int>(unfixedItemID); int[] fixedItemIDs = ConfigParse.GetMultipleStr<int>(itemID); int[] fixedItemCounts = ConfigParse.GetMultipleStr<int>(itemCount); int[] unfixedDisplay = ConfigParse.GetMultipleStr<int>(unfixedItemDisplay); int[] fixedDisplay = ConfigParse.GetMultipleStr<int>(itemDisplay); int[] makeIDs = makeID; int[] unfixedItemIDs = unfixedItemID; int[] fixedItemIDs = itemID; int[] fixedItemCounts = itemCount; int[] unfixedDisplay = unfixedItemDisplay; int[] fixedDisplay = itemDisplay; if (!displayItemDict.ContainsKey(id)) { @@ -67,14 +67,13 @@ if (firstType == (int)ComposeFuncType.Ticket) { var makeItemArray = ConfigParse.GetMultipleStr<int>(makeID); for (int i = 0; i < makeItemArray.Length; i++) for (int i = 0; i < makeIDs.Length; i++) { List<ItemCompoundConfig> list = null; if (!ticketComposeDict.TryGetValue(makeItemArray[i], out list)) if (!ticketComposeDict.TryGetValue(makeIDs[i], out list)) { list = new List<ItemCompoundConfig>(); ticketComposeDict.Add(makeItemArray[i], list); ticketComposeDict.Add(makeIDs[i], list); } list.Add(this); } @@ -99,7 +98,8 @@ for (int i = 0; i < thirdTypeDict[thirdType].Count; i++) { ItemCompoundConfig compoundConfig = thirdTypeDict[thirdType][i]; if (compoundConfig.levelNeed <= PlayerDatas.Instance.baseData.LV) if (compoundConfig.levelNeed <= PlayerDatas.Instance.baseData.LV || (compoundConfig.trailerLevel > 0 && compoundConfig.trailerLevel <= PlayerDatas.Instance.baseData.LV)) { if (!composeTypeDict.ContainsKey(secondType)) { Core/NetworkPackage/ClientPack/ClientToMapServer/CA3_Item/CA303_tagCMItemCompound.cs
@@ -1,65 +1,38 @@ using UnityEngine; using System.Collections; //A3 03 物品合成 #tagCMItemCompound public class CA303_tagCMItemCompound : GameNetPackBasic { public uint ID; // 合成ID public ushort CompoundCnt; //合成数量(次数) public byte UnfixedItemIndexCnt; // 不固定物品在背包中索引个数 public byte[] UnfixedItemIndex; // 不固定物品在背包的索引列表 public byte FixedItemIndexCnt; // 固定物品在背包中索引个数 public byte[] FixedItemIndex; // 固定物品在背包的索引列表 public byte AddonsItemIndexCnt; // 附加物品在背包中索引个数 public byte[] AddonsItemIndex; // 附加物品在背包的索引列表 public byte[] AddonsItemCount; // 附加物品在背包的索引对应扣除数量列表 public CA303_tagCMItemCompound () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA303; } public override void WriteToBytes () { WriteBytes (ID, NetDataType.DWORD); WriteBytes (CompoundCnt, NetDataType.WORD); WriteBytes (UnfixedItemIndexCnt, NetDataType.BYTE); WriteBytes (UnfixedItemIndex, NetDataType.BYTE, UnfixedItemIndexCnt); WriteBytes (FixedItemIndexCnt, NetDataType.BYTE); WriteBytes (FixedItemIndex, NetDataType.BYTE, FixedItemIndexCnt); WriteBytes (AddonsItemIndexCnt, NetDataType.BYTE); WriteBytes (AddonsItemIndex, NetDataType.BYTE, AddonsItemIndexCnt); WriteBytes (AddonsItemCount, NetDataType.BYTE, AddonsItemIndexCnt); } } using UnityEngine; using System.Collections; //A3 03 物品合成 #tagCMItemCompound public class CA303_tagCMItemCompound : GameNetPackBasic { public uint ID; // 合成ID public ushort CompoundCnt; //合成数量(次数) public byte UnfixedItemIndexCnt; // 不固定物品在背包中索引个数 public byte[] UnfixedItemIndex; // 不固定物品在背包的索引列表 public byte FixedItemIndexCnt; // 固定物品在背包中索引个数 public byte[] FixedItemIndex; // 固定物品在背包的索引列表 public byte AddonsItemIndexCnt; // 附加物品在背包中索引个数 public byte[] AddonsItemIndex; // 附加物品在背包的索引列表 public byte[] AddonsItemCount; // 附加物品在背包的索引对应扣除数量列表 public byte RateIncreaseItemIndexCnt; // 提升概率物品在背包中索引个数 public byte[] RateIncreaseItemIndex; // 提升概率物品在背包的索引列表 public CA303_tagCMItemCompound () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA303; } public override void WriteToBytes () { WriteBytes (ID, NetDataType.DWORD); WriteBytes (CompoundCnt, NetDataType.WORD); WriteBytes (UnfixedItemIndexCnt, NetDataType.BYTE); WriteBytes (UnfixedItemIndex, NetDataType.BYTE, UnfixedItemIndexCnt); WriteBytes (FixedItemIndexCnt, NetDataType.BYTE); WriteBytes (FixedItemIndex, NetDataType.BYTE, FixedItemIndexCnt); WriteBytes (AddonsItemIndexCnt, NetDataType.BYTE); WriteBytes (AddonsItemIndex, NetDataType.BYTE, AddonsItemIndexCnt); WriteBytes (AddonsItemCount, NetDataType.BYTE, AddonsItemIndexCnt); WriteBytes (RateIncreaseItemIndexCnt, NetDataType.BYTE); WriteBytes (RateIncreaseItemIndex, NetDataType.BYTE, RateIncreaseItemIndexCnt); } } System/Compose/New/ComposeEquipWin.cs
@@ -16,6 +16,11 @@ [SerializeField] ScrollerController equipTypeLineCellCtrl; [SerializeField] GameObject increaseRateItem; [SerializeField] GameObject increaseGridCell; [SerializeField] Text increaseText; [SerializeField] PushSwitchBtn switchBtn; [SerializeField] List<GameObject> sourceItemlist = new List<GameObject>(); @@ -73,12 +78,9 @@ { 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; @@ -88,6 +90,7 @@ [SerializeField] int initSuccessRate = 0; private int curComposeEquipIndex = -1; ItemCompoundConfig compoundModel = null; bool isIncreaseRate = false; int successRate = 0; SelectEquipModel _selectModel; SelectEquipModel selectModel @@ -96,7 +99,7 @@ } protected override void BindController() { cellCtrl.OnRefreshCell += RefreshCell; cellCtrl.OnRefreshCell += RefreshTypeCell; cellCtrl.vertical = true; cellCtrl.lockType = EnhanceLockType.KeepVertical; equipTypeLineCellCtrl.OnRefreshCell += RefreshEquipTypeLineCell; @@ -111,25 +114,58 @@ protected override void OnPreOpen() { composeWinModel.UpdateSecondTypeEvent += UpdateSecondType; composeWinModel.UpdateThirdTypeEvent += UpdateThirdType; selectModel.selectEquipEvent += RefreshSelectItem; DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnComposeAnswer; UIEventTrigger.Get(helpBtn.gameObject).OnDown = OnClickHelpBtn; UIEventTrigger.Get(helpBtn.gameObject).OnUp = OnDownUp; Display(); } protected override void OnAfterOpen() { this.transform.SetAsLastSibling(); } protected override void OnPreClose() { selectModel.selectEquipEvent -= RefreshSelectItem; DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer; composeWinModel.UpdateSecondTypeEvent -= UpdateSecondType; composeWinModel.UpdateThirdTypeEvent -= UpdateThirdType; } protected override void OnAfterClose() { } #region 新的逻辑 private void Display() { composeWinModel.TryGetFirstTypeData((int)ComposeFuncType.Equip,out firstTypeData); if (firstTypeData == null ) return; isIncreaseRate = false; successRate = 0; firstTypeDict = composeWinModel.GetFirstTypeModel((int)ComposeFuncType.Equip); DefaultSelect(); CreateTypeCell(); } private void DefaultSelect() { bool isJumpTo = false; if (composeWinModel.secondType != 0) { isJumpTo = true; curSecondType = composeWinModel.secondType; curThirdType = composeWinModel.thirdType; secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Equip, composeWinModel.secondType); OnClickSecondType(curSecondType,curThirdType); composeWinModel.ResetJumpToModel(); } CreateCell(); //CreateCell(); if (compoundModel != null) { RefreshUI(compoundModel); @@ -152,21 +188,232 @@ } } protected override void OnAfterOpen() private void CreateTypeCell() { this.transform.SetAsLastSibling(); if (firstTypeData == null) return; cellCtrl.Refresh(); foreach(var second in firstTypeData.secondTypeDict.Keys) { cellCtrl.AddCell(ScrollerDataType.Header,second); if(second == curSecondType) { var thirdTypeDict = firstTypeData.secondTypeDict[second].thirdTypeDict; foreach(var third in thirdTypeDict.Keys) { if (third != 0) { cellCtrl.AddCell(ScrollerDataType.Normal,third); } } } } cellCtrl.Restart(); JumpIndex(); if (curThirdType != 0) { composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType, curThirdType, out thirdTypeData); ChangeUIState(false, true, false); if(thirdTypeData != null) { ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(thirdTypeData.itemCompound.makeID[0]); if (itemConfig != null && itemConfig.ItemColor == 6) { dismantleText.gameObject.SetActive(true); } else { dismantleText.gameObject.SetActive(false); } } } else { RefreshUI(null); dismantleText.gameObject.SetActive(false); ChangeUIState(true, false, false); } } protected override void OnPreClose() private void RefreshTypeCell(ScrollerDataType type, CellView cell) { selectModel.selectEquipEvent -= RefreshSelectItem; DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer; switch (type) { case ScrollerDataType.Header: ComposeWinModel.ComposeSecondTypeData _secondTypeData = null; ComposeFirstTypeCell firstTypeCell = cell.GetComponent<ComposeFirstTypeCell>(); composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.Equip, cell.index, out _secondTypeData); if (_secondTypeData != null) { var thirdTypeDict = _secondTypeData.thirdTypeDict; foreach (var third in thirdTypeDict.Keys) { ComposeWinModel.ComposeThirdTypeData thirdTypeData = null; composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, cell.index, third, out thirdTypeData); firstTypeCell.SetDisplay((int)ComposeFuncType.Equip, cell.index, third, curSecondType); break; } } break; case ScrollerDataType.Normal: ComposeSecondTypeCell secondTypeCell = cell.GetComponent<ComposeSecondTypeCell>(); secondTypeCell.SetDisplay((int)ComposeFuncType.Equip, curSecondType, cell.index, curThirdType); if(curThirdType == cell.index) { CreateEquipTypeLineCell(); } break; } } protected override void OnAfterClose() private void JumpIndex() { if (firstTypeData == null) return; var secondTypeDict = firstTypeData.secondTypeDict; if (secondTypeDict.Count >= 1 && curSecondType != 0 && curThirdType >= 1) { cellCtrl.JumpIndex(GetCurIndex(curSecondType)); } } private int GetCurIndex(int secondType) { if (firstTypeData == null) return 0; int curIndex = 0; var secondTypeDict = firstTypeData.secondTypeDict; List<int> secondlist = secondTypeDict.Keys.ToList(); for (int i = 0; i < secondlist.Count; i++) { if (secondType == secondlist[i]) { curIndex = i; break; } } return curIndex; } private void UpdateSecondType(int secondType) { curThirdType = 0; curSecondType = secondType; composeWinModel.TryGetSecondTypeData((int)ComposeFuncType.Equip,secondType,out secondTypeData); OnClickSecondType(); CreateTypeCell(); } private void OnClickSecondType() { if (secondTypeData == null) return; var thirdTypeDict = secondTypeData.thirdTypeDict; if (curThirdType == 0) { foreach (var thirdType in thirdTypeDict.Keys) { if (thirdType != 0) { if (preSecondType == curSecondType) { curSecondType = 0; preSecondType = 0; } else { curThirdType = thirdType; } } break; } } if (preSecondType != curSecondType) { preSecondType = curSecondType; curComposeEquipIndex = -1; selectModel.ClearSelectModel(); } } private void UpdateThirdType(int thirdType) { composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType,thirdType, out thirdTypeData); if(thirdTypeData != null) { bool isTrailer = composeWinModel.IsTrailerByLevel(thirdTypeData.itemCompound); if (isTrailer) { MessageWin.Inst.ShowFixedTip(StringUtility.Contact(thirdTypeData.itemCompound.levelNeed, "级开启")); return; } } curThirdType = thirdType; OnClickThirdType(); CreateTypeCell(); } private void OnClickThirdType() { if (thirdTypeData == null) return; if (preThirdType != curThirdType) { preThirdType = curThirdType; } curComposeEquipIndex = -1; selectModel.ClearSelectModel(); } private void CreateEquipTypeLineCell() { List<ComposeWinModel.ComposeThirdTypeData> thirdTypeDatas = null; bool isthird = composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType, curThirdType, out thirdTypeDatas); if (!isthird) return; if (thirdTypeDatas.Count > 1) { ChangeUIState(false, true, false); equipTypeLineCellCtrl.Refresh(); int line = thirdTypeDatas.Count / 3; if (thirdTypeDatas.Count % 3 > 0) { line += 1; } int i = 0; for (i = 0; i < line; i++) { equipTypeLineCellCtrl.AddCell(ScrollerDataType.Header, i); } equipTypeLineCellCtrl.Restart(); } else { if (thirdTypeDatas.Count > 0) { ItemCompoundConfig tagItemCompound = thirdTypeDatas[0].itemCompound; ClickEquipTypeCell(tagItemCompound, 0); RefreshUI(tagItemCompound); } } if (curComposeEquipIndex != -1) { ItemCompoundConfig tagItemCompound = thirdTypeDatas[curComposeEquipIndex].itemCompound; ClickEquipTypeCell(tagItemCompound, curComposeEquipIndex); } } private void ChangeUIState(params bool[] isShows) { notChooseBG.SetActive(isShows[0]); chooseComposeEquip.SetActive(isShows[1]); composeEquip.SetActive(isShows[2]); } #endregion private void ResetModel() { @@ -178,236 +425,21 @@ compoundModel = null; } private void CreateCell() { dismantleText.gameObject.SetActive(false); cellCtrl.Refresh(); if(curSecondType == 0) { ChangeUIState(true, false,false); } if(firstTypeDict != null) { foreach (int secondType in firstTypeDict.Keys) { cellCtrl.AddCell(ScrollerDataType.Header,secondType); if(secondType == curSecondType) { foreach (int thirdType in firstTypeDict[secondType].Keys) { if (thirdType != 0) { cellCtrl.AddCell(ScrollerDataType.Normal, thirdType); } } } } } cellCtrl.Restart(); if (secondTypeDict != null) { if (secondTypeDict.Count >= 1 && curSecondType != 0 && curThirdType >= 1) { cellCtrl.JumpIndex(GetCurIndex(curSecondType)); } } } private int GetCurIndex(int secondType) { int curIndex = 0; List<int> secondlist = firstTypeDict.Keys.ToList(); for(int i = 0; i < secondlist.Count; i++) { if(secondType == secondlist[i]) { curIndex = i; break; } } return curIndex; } private void RefreshCell(ScrollerDataType type, CellView cell) { Image icon = cell.transform.Find("BtnIcon").GetComponent<Image>(); Text name = cell.transform.Find("BtnText").GetComponent<Text>(); Button cellBtn = cell.GetComponent<Button>(); cellBtn.RemoveAllListeners(); ItemCompoundConfig compoundModel = null; switch (type) { case ScrollerDataType.Header: GameObject arrowIcon = cell.transform.Find("SecondBtn").gameObject; foreach (int thirdType in firstTypeDict[cell.index].Keys) { if (thirdType != 0) { arrowIcon.SetActive(true); } else { arrowIcon.SetActive(false); } compoundModel = firstTypeDict[cell.index][thirdType][0]; name.text = compoundModel.secondTypeName; if (curSecondType == cell.index) { arrowIcon.transform.localRotation = Quaternion.Euler(0, 0, -90); icon.SetSprite("ComposeFirstClassChoosebtn"); secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Equip, curSecondType); } else { arrowIcon.transform.localRotation = Quaternion.Euler(0, 0,0); icon.SetSprite("ComposeFirstClassNormalbtn"); } break; } cellBtn.AddListener(()=> { OnClickSecondType(cell.index); }); break; case ScrollerDataType.Normal: compoundModel = secondTypeDict[cell.index][0]; name.text = compoundModel.thirdTypeName; if (curThirdType == cell.index) { icon.SetSprite("ChildListBtn_Select"); thirdTypelist = composeWinModel.GetThirdTypeModellist(compoundModel.firstType, compoundModel.secondType, cell.index); CreateEquipTypeLineCell(); } else { icon.SetSprite("ChildListBtn_UnSelect"); } cellBtn.AddListener(() => { OnClickThirdType(cell.index); }); break; } } private void OnClickSecondType(int secondType,int _thirdType = 0) { curSecondType = secondType; secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Equip, curSecondType); if(_thirdType == 0) { foreach (var thirdType in secondTypeDict.Keys) { if (thirdType != 0) { if (preSecondType == curSecondType) { curSecondType = 0; preSecondType = 0; } curThirdType = thirdType; } else { curThirdType = 0; } break; } } else { curThirdType = _thirdType; } if (preSecondType != curSecondType) { preSecondType = curSecondType; curComposeEquipIndex = -1; selectModel.ClearSelectModel(); } CreateCell(); } private void OnClickThirdType(int thirdType) { curThirdType = thirdType; if (preThirdType != curThirdType) { preThirdType = curThirdType; } curComposeEquipIndex = -1; CreateCell(); selectModel.ClearSelectModel(); } private void CreateEquipTypeLineCell() { if (thirdTypelist == null) return; if(thirdTypelist.Count > 1) { ChangeUIState(false, true, false); equipTypeLineCellCtrl.Refresh(); int line = thirdTypelist.Count / 3; if (thirdTypelist.Count % 3 > 0) { line += 1; } int i = 0; for (i = 0; i < line; i++) { equipTypeLineCellCtrl.AddCell(ScrollerDataType.Header, i); } equipTypeLineCellCtrl.Restart(); } else { if(thirdTypelist.Count > 0) { ItemCompoundConfig tagItemCompound = thirdTypelist[0]; ClickEquipTypeCell(tagItemCompound, 0); RefreshUI(tagItemCompound); } } if(curComposeEquipIndex != -1) { ItemCompoundConfig tagItemCompound = thirdTypelist[curComposeEquipIndex]; ClickEquipTypeCell(tagItemCompound, curComposeEquipIndex); } if(thirdTypelist.Count > 1) { ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(thirdTypelist[0].makeID); if (itemConfig != null && itemConfig.ItemColor == 6) { dismantleText.gameObject.SetActive(true); } else { dismantleText.gameObject.SetActive(false); } } else { dismantleText.gameObject.SetActive(false); } } private void RefreshEquipTypeLineCell(ScrollerDataType type, CellView cell) { List<ComposeWinModel.ComposeThirdTypeData> thirdTypeDatas = null; composeWinModel.TryGetThirdTypeData((int)ComposeFuncType.Equip, curSecondType, curThirdType, out thirdTypeDatas); int i = 0; for(i = 0; i < cell.transform.childCount; i++) { GameObject typeCell = cell.transform.GetChild(i).gameObject; int index = (cell.transform.childCount) * cell.index + i; if(index < thirdTypelist.Count) if(index < thirdTypeDatas.Count) { typeCell.SetActive(true); ItemCompoundConfig tagItemCompound = thirdTypelist[index]; ItemConfig tagChinItem = Config.Instance.Get<ItemConfig>(tagItemCompound.makeID); ItemCompoundConfig tagItemCompound = thirdTypeDatas[index].itemCompound; ItemConfig tagChinItem = Config.Instance.Get<ItemConfig>(tagItemCompound.makeID[0]); Image icon = typeCell.transform.Find("EquipIcon").GetComponent<Image>(); Image bgIcon = typeCell.transform.Find("EquipBG").GetComponent<Image>(); Text nameText = typeCell.transform.Find("BtnText").GetComponent<Text>(); @@ -437,13 +469,7 @@ RefreshComposeSuccessRate(); } private void ChangeUIState(params bool[] isShows) { notChooseBG.SetActive(isShows[0]); chooseComposeEquip.SetActive(isShows[1]); composeEquip.SetActive(isShows[2]); } private void RefreshUI(ItemCompoundConfig compoundModel) { this.compoundModel = compoundModel; @@ -493,7 +519,7 @@ GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject; if (i < makeIds.Length) { RefreshGridCellUI(gridCell, false, makeIds[i],NeedMatType.MakeItem); RefreshGridCellUI(gridCell, false, makeIds[i],0,NeedMatType.MakeItem); } else { @@ -526,7 +552,7 @@ GameObject gridCell = matPos.transform.Find("GridCell").gameObject; Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>(); putInText.gameObject.SetActive(false); RefreshGridCellUI(gridCell,false,fixedIds[i],NeedMatType.fixedItem); RefreshGridCellUI(gridCell,false,fixedIds[i],fixedCounts[i],NeedMatType.fixedItem); List<int> itemIndexlist = null; SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem); @@ -561,9 +587,54 @@ } #endregion #region 提升合成成功率 int[] increases = compoundModel.successRateIncrease; if(increases == null || increases.Length < 2) { isIncreaseRate = false; increaseRateItem.SetActive(isIncreaseRate); } else { int increaseId = increases[0]; int increaseNeedNum = increases[1]; int increaseRate = increases[2] / 100; increaseRateItem.SetActive(true); RefreshGridCellUI(increaseGridCell, false,increaseId,increaseNeedNum); increaseText.text = StringUtility.Contact("增加成功率", StringUtility.Contact(increaseRate, "%")); int haveIncreaseNum = playerPack.GetItemCountByID(PackType.rptItem, increaseId); ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(increaseId); isIncreaseRate = haveIncreaseNum >= increaseNeedNum ? isIncreaseRate : false; switchBtn.RefreshSwitchUI(isIncreaseRate); switchBtn.switchBtn.RemoveAllListeners(); switchBtn.switchBtn.AddListener(()=> { if (switchBtn.onObj.activeInHierarchy) { isIncreaseRate = false; switchBtn.RefreshSwitchUI(false); } else { if(haveIncreaseNum >= increaseNeedNum) { isIncreaseRate = true; switchBtn.RefreshSwitchUI(true); } else { isIncreaseRate = false; MessageWin.Inst.ShowFixedTip(StringUtility.Contact("增加成功率需要",increaseNeedNum,itemConfig.ItemName,"数量不足")); } } RefreshComposeSuccessRate(); }); } #endregion } private void RefreshGridCellUI(GameObject gridCell, bool islock, int itemId = -1,NeedMatType matType = NeedMatType.Nothing,int itemPlace = -1) private void RefreshGridCellUI(GameObject gridCell, bool islock, int itemId = -1,int needCount = 0,NeedMatType matType = NeedMatType.Nothing,int itemPlace = -1) { gridCell.SetActive(true); ItemCell itemCell = gridCell.transform.Find("ItemCell").GetComponent<ItemCell>(); @@ -620,7 +691,6 @@ else { itemCell.Init(itemModel); itemCell.cellBtn.onClick.AddListener(() => { if (matType == NeedMatType.fixedItem) @@ -639,41 +709,27 @@ itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID); } }); } if (matType == NeedMatType.fixedItem) if(needCount > 0) { int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds); int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts); itemCell.countText.gameObject.SetActive(true); int haveCount = playerPack.GetItemCountByID(PackType.rptItem,itemId); int i = 0; for(i = 0; i < fixedIds.Length; i++) int haveCount = playerPack.GetItemCountByID(PackType.rptItem, itemId); if (haveCount >= needCount) { if(fixedIds[i] == itemId) { if (haveCount >= fixedCounts[i]) { itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Green,haveCount.ToString()), "/",fixedCounts[i].ToString()); } else { itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Red, haveCount.ToString()), "/", fixedCounts[i].ToString()); } break; } itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Green, haveCount.ToString()), "/", needCount); } else { itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Red, haveCount.ToString()), "/", needCount); } } else { itemCell.countText.gameObject.SetActive(false); } } } @@ -686,11 +742,11 @@ { case SelectItemType.unfixed: putInText = go.transform.Find("PutInText").GetComponent<Text>(); RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, NeedMatType.unfixedItem, model.itemInfo.ItemPlace); RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID,0 ,NeedMatType.unfixedItem, model.itemInfo.ItemPlace); break; case SelectItemType.addons: putInText = go.transform.Find("AddRateText").GetComponent<Text>(); RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, NeedMatType.addItem, model.itemInfo.ItemPlace); RefreshGridCellUI(gridCell, false, model.itemInfo.ItemID, 0,NeedMatType.addItem, model.itemInfo.ItemPlace); break; } @@ -714,17 +770,35 @@ } posDes.gameObject.SetActive(true); RefreshGridCellUI(gridCell,false,-1,NeedMatType.unfixedItem); RefreshGridCellUI(gridCell,false,-1,0,NeedMatType.unfixedItem); } public void RefreshComposeSuccessRate() { successRate = 0; int increaseRate = 0; if (compoundModel != null) { successRate = compoundModel.successRate; } successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(successRate / 100, "%")); if(isIncreaseRate) { int[] increases = compoundModel.successRateIncrease; if(increases != null && increases.Length > 1) { increaseRate = increases[2] / 100; } } if(increaseRate > 0) { successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(successRate / 100, "%","+",increaseRate,"%")); } else { successRateText.text = Language.Get("HallowsWin_Success", StringUtility.Contact(successRate / 100, "%")); } } private void OnClickOnekeyPutBtn() @@ -760,7 +834,7 @@ private void OnClickComposeBtn() { composeWinModel.SendComposeRequest(compoundModel,fixedItemIndexDict,composeEffect,1); composeWinModel.SendComposeRequest(compoundModel,fixedItemIndexDict,composeEffect,1,10000,isIncreaseRate); } private void OnComposeAnswer(HA814_tagMCMakeItemAnswer answer) System/Compose/New/ComposeFirstTypeCell.cs
New file @@ -0,0 +1,45 @@ using UnityEngine; using UnityEngine.UI; using TableConfig; using System; namespace Snxxz.UI { public class ComposeFirstTypeCell : MonoBehaviour { [SerializeField] Image btnImg; [SerializeField] Transform arrowImg; [SerializeField] Text unlockTypeName; [SerializeField] Button typeBtn; ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } } int secondType = 0; public void SetDisplay(int firstType,int secondType,int thirdType,int selectSecondType) { this.secondType = secondType; ComposeWinModel.ComposeThirdTypeData thirdTypeData = null; bool isThird = composeModel.TryGetThirdTypeData(firstType,secondType,thirdType,out thirdTypeData); if (!isThird) return; var itemCompound = thirdTypeData.itemCompound; unlockTypeName.text = itemCompound.secondTypeName; arrowImg.gameObject.SetActive(thirdType != 0); UpdateBtnImg(selectSecondType); typeBtn.RemoveAllListeners(); typeBtn.AddListener(ClickTypeBtn); } public void UpdateBtnImg(int selectSecondType) { string iconKey = secondType == selectSecondType ? "ComposeFirstClassChoosebtn" : "ComposeFirstClassNormalbtn"; btnImg.SetSprite(iconKey); arrowImg.localRotation = secondType == selectSecondType ? Quaternion.Euler(0, 0, -90) : Quaternion.Euler(0, 0, 0); } private void ClickTypeBtn() { composeModel.UpdateSecondType(secondType); } } } System/Compose/New/ComposeFirstTypeCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: cc47f0ab38a5c6847a598577d28d0c37 timeCreated: 1540951445 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Compose/New/ComposeSecondTypeCell.cs
New file @@ -0,0 +1,51 @@ using UnityEngine; using UnityEngine.UI; using TableConfig; using System; namespace Snxxz.UI { public class ComposeSecondTypeCell : MonoBehaviour { [SerializeField] Image btnImg; [SerializeField] GameObject unlockObj; [SerializeField] Text unlockTypeName; [SerializeField] GameObject lockObj; [SerializeField] Text lockTypeName; [SerializeField] Text lockLevel; [SerializeField] Button typeBtn; ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } } int thirdType = 0; public void SetDisplay(int firstType,int secondType,int thirdType,int selectThirdType) { this.thirdType = thirdType; ComposeWinModel.ComposeThirdTypeData thirdTypeData = null; bool isThird = composeModel.TryGetThirdTypeData(firstType,secondType,thirdType,out thirdTypeData); if (!isThird) return; var itemCompound = thirdTypeData.itemCompound; bool isTrailer = composeModel.IsTrailerByLevel(itemCompound); lockObj.SetActive(isTrailer); unlockObj.SetActive(!isTrailer); unlockTypeName.text = itemCompound.thirdTypeName; lockTypeName.text = itemCompound.thirdTypeName; lockLevel.text = StringUtility.Contact(itemCompound.levelNeed,"级"); UpdateBtnImg(selectThirdType); typeBtn.RemoveAllListeners(); typeBtn.AddListener(ClickTypeBtn); } public void UpdateBtnImg(int selectThirdType) { string iconKey = thirdType == selectThirdType ? "ChildListBtn_Select" : "ChildListBtn_UnSelect"; btnImg.SetSprite(iconKey); } private void ClickTypeBtn() { composeModel.UpdateThirdType(thirdType); } } } System/Compose/New/ComposeSecondTypeCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: c14524d2fe5c7d448b54a73d3611ec7c timeCreated: 1540900861 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Compose/New/ComposeToolsWin.cs
@@ -197,7 +197,7 @@ if (thirdType != 0) { ItemCompoundConfig compoundConfig = firstTypeDict[secondType][thirdType][0]; int makeID = ConfigParse.GetMultipleStr<int>(compoundConfig.makeID)[0]; int makeID = compoundConfig.makeID[0]; if(secondType != 3) { cellCtrl.AddCell(ScrollerDataType.Normal, thirdType); System/Compose/New/ComposeWinModel.cs
@@ -10,8 +10,7 @@ { private Dictionary<int, Dictionary<int, List<ItemCompoundConfig>>> firstTypeDict = null; private Dictionary<int, List<ItemCompoundConfig>> secondTypeDict = null; private Dictionary<int, List<int>> composeJobLimitDict = new Dictionary<int, List<int>>(); private FuncConfigConfig addonsFormulaModel; public event Action ResetModelEvent; SelectEquipModel _selectModel; SelectEquipModel selectModel @@ -36,23 +35,8 @@ public override void Init() { addonsFormulaModel = Config.Instance.Get<FuncConfigConfig>("ComposeAddonsFormula"); composeJobLimitDict.Clear(); FuncConfigConfig funcConfig = Config.Instance.Get<FuncConfigConfig>("ComposeJobLimit"); JsonData limitData = JsonMapper.ToObject(funcConfig.Numerical1); foreach(var job in limitData.Keys) { List<int> idlist = new List<int>(); composeJobLimitDict.Add(int.Parse(job),idlist); if(limitData[job].IsArray) { for(int i= 0; i < limitData[job].Count; i++) { int id = int.Parse(limitData[job][i].ToString()); idlist.Add(id); } } } ParseFuncConfig(); ParseItemComoundConfig(); } public override void UnInit() @@ -76,6 +60,7 @@ playerPack.RefreshItemCountAct += OnItemCntRefresh; PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerLvUpdate; PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerLvUpdate; UpdateComposeDataByLevel(); } public void ResetModel() @@ -86,14 +71,234 @@ } } private void PlayerLvUpdate(PlayerDataRefresh type) { if (type != PlayerDataRefresh.LV) return; UpdateComposeDataByLevel(); SetComposeTypeRed(); RefreshComposeRed(); } #region 解析本地数据 private FuncConfigConfig addonsFormulaModel; private Dictionary<int, List<int>> composeJobLimitDict = new Dictionary<int, List<int>>(); public void ParseFuncConfig() { addonsFormulaModel = Config.Instance.Get<FuncConfigConfig>("ComposeAddonsFormula"); composeJobLimitDict.Clear(); FuncConfigConfig funcConfig = Config.Instance.Get<FuncConfigConfig>("ComposeJobLimit"); JsonData limitData = JsonMapper.ToObject(funcConfig.Numerical1); foreach (var job in limitData.Keys) { List<int> idlist = new List<int>(); composeJobLimitDict.Add(int.Parse(job), idlist); if (limitData[job].IsArray) { for (int i = 0; i < limitData[job].Count; i++) { int id = int.Parse(limitData[job][i].ToString()); idlist.Add(id); } } } } public Dictionary<int, ComposeFirstTypeData> composeDataDict = new Dictionary<int, ComposeFirstTypeData>(); public void ParseItemComoundConfig() { composeDataDict.Clear(); List<ItemCompoundConfig> itemCompounds = Config.Instance.GetAllValues<ItemCompoundConfig>(); for(int i = 0; i < itemCompounds.Count; i++) { AddComposeData(itemCompounds[i],composeDataDict); } } public void AddComposeData(ItemCompoundConfig itemCompound, Dictionary<int, ComposeFirstTypeData> keyValues) { if (itemCompound == null) return; if (!keyValues.ContainsKey(itemCompound.firstType)) { var firstData = new ComposeFirstTypeData(); firstData.firstType = itemCompound.firstType; firstData.secondTypeDict = new Dictionary<int, ComposeSecondTypeData>(); ComposeSecondTypeData secondData = new ComposeSecondTypeData(); secondData.secondType = itemCompound.secondType; secondData.thirdTypeDict = new Dictionary<int, List<ComposeThirdTypeData>>(); List<ComposeThirdTypeData> thirdTypeDatas = new List<ComposeThirdTypeData>(); ComposeThirdTypeData thirdData = new ComposeThirdTypeData(); thirdData.thirdType = itemCompound.thirdType; thirdData.itemCompound = itemCompound; thirdTypeDatas.Add(thirdData); firstData.secondTypeDict.Add(secondData.secondType, secondData); secondData.thirdTypeDict.Add(thirdData.thirdType, thirdTypeDatas); keyValues.Add(firstData.firstType, firstData); } else { ComposeSecondTypeData secondData = new ComposeSecondTypeData(); secondData.secondType = itemCompound.secondType; var secondTypeDict = keyValues[itemCompound.firstType].secondTypeDict; if (!secondTypeDict.ContainsKey(secondData.secondType)) { secondTypeDict.Add(secondData.secondType, secondData); secondData.thirdTypeDict = new Dictionary<int, List<ComposeThirdTypeData>>(); List<ComposeThirdTypeData> thirdTypeDatas = new List<ComposeThirdTypeData>(); ComposeThirdTypeData thirdData = new ComposeThirdTypeData(); thirdData.thirdType = itemCompound.thirdType; thirdData.itemCompound = itemCompound; thirdTypeDatas.Add(thirdData); secondData.thirdTypeDict.Add(thirdData.thirdType, thirdTypeDatas); } else { ComposeThirdTypeData thirdData = new ComposeThirdTypeData(); thirdData.thirdType = itemCompound.thirdType; thirdData.itemCompound = itemCompound; var thirdTypeDict = secondTypeDict[secondData.secondType].thirdTypeDict; if (!thirdTypeDict.ContainsKey(thirdData.thirdType)) { List<ComposeThirdTypeData> thirdTypeDatas = new List<ComposeThirdTypeData>(); thirdTypeDatas.Add(thirdData); thirdTypeDict.Add(thirdData.thirdType, thirdTypeDatas); } else { thirdTypeDict[thirdData.thirdType].Add(thirdData); } } } } public class ComposeFirstTypeData { public int firstType; public Dictionary<int,ComposeSecondTypeData> secondTypeDict = null; } public class ComposeSecondTypeData { public int secondType; public Dictionary<int,List<ComposeThirdTypeData>> thirdTypeDict= null; } public class ComposeThirdTypeData { public int thirdType; public ItemCompoundConfig itemCompound = null; } #endregion #region 数据变动 public Dictionary<int, ComposeFirstTypeData> composeOpenDataDict = new Dictionary<int, ComposeFirstTypeData>(); public void UpdateComposeDataByLevel() { composeOpenDataDict.Clear(); int playerLv = PlayerDatas.Instance.baseData.LV; foreach (var first in composeDataDict.Keys) { var secondTypeDict = composeDataDict[first].secondTypeDict; foreach (var second in secondTypeDict.Keys) { var thirdTypeDict = secondTypeDict[second].thirdTypeDict; foreach (var third in thirdTypeDict.Keys) { for(int i = 0; i < thirdTypeDict[third].Count; i++) { var thirdData = thirdTypeDict[third][i]; if(playerLv >= thirdData.itemCompound.levelNeed ||(thirdData.itemCompound.trailerLevel != 0 && playerLv >= thirdData.itemCompound.trailerLevel)) { AddComposeData(thirdData.itemCompound, composeOpenDataDict); } } } } } } public bool TryGetFirstTypeData(int firstType,out ComposeFirstTypeData firstTypeData) { firstTypeData = null; return composeDataDict.TryGetValue(firstType,out firstTypeData); } public bool TryGetSecondTypeData(int firstType,int secondType,out ComposeSecondTypeData secondTypeData) { ComposeFirstTypeData firstTypeData = null; secondTypeData = null; bool isFirst = TryGetFirstTypeData(firstType,out firstTypeData); if(isFirst) { return firstTypeData.secondTypeDict.TryGetValue(secondType,out secondTypeData); } return false; } public bool TryGetThirdTypeData(int firstType, int secondType, int thirdType, out List<ComposeThirdTypeData> thirdTypeDatas) { ComposeSecondTypeData secondTypeData = null; thirdTypeDatas = null; bool isSecond = TryGetSecondTypeData(firstType, secondType, out secondTypeData); if (isSecond) { return secondTypeData.thirdTypeDict.TryGetValue(thirdType, out thirdTypeDatas); } return false; } public bool TryGetThirdTypeData(int firstType, int secondType,int thirdType,out ComposeThirdTypeData thirdTypeData) { ComposeSecondTypeData secondTypeData = null; thirdTypeData = null; bool isSecond = TryGetSecondTypeData(firstType,secondType ,out secondTypeData); if (isSecond) { List<ComposeThirdTypeData> thirdTypeDatas = null; bool isThird = secondTypeData.thirdTypeDict.TryGetValue(thirdType, out thirdTypeDatas); if(isThird) { thirdTypeData = thirdTypeDatas[0]; return true; } } return false; } public ItemCompoundConfig CurComposeModel { get; private set; } public void SetCurComposeModel(ItemCompoundConfig compoundModel) { CurComposeModel = compoundModel; } public event Action<int> UpdateThirdTypeEvent; public void UpdateThirdType(int thirdType) { if (UpdateThirdTypeEvent != null) { UpdateThirdTypeEvent(thirdType); } } public event Action<int> UpdateSecondTypeEvent; public void UpdateSecondType(int secondType) { if (UpdateSecondTypeEvent != null) { UpdateSecondTypeEvent(secondType); } } public bool TryGetIncreaseRateItemIndex(ItemCompoundConfig itemCompound,bool IsIncrease, out List<int> indexlist) { indexlist = null; if (!IsIncrease || itemCompound == null) return false; SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem); int[] increases = itemCompound.successRateIncrease; indexlist = singlePack.ItemIndexlist(increases[0], increases[1]); return true; } #endregion public bool IsComposeJobLimit(int composeId) { @@ -137,6 +342,18 @@ return modellist; } public bool IsTrailerByLevel(ItemCompoundConfig itemCompound) { if (itemCompound.trailerLevel <= 0) return false; int playerLv = PlayerDatas.Instance.baseData.LV; if(playerLv >= itemCompound.trailerLevel && playerLv < itemCompound.levelNeed) { return true; } return false; } public int GetTicketId(int firstType, int secondType, int thirdType) { var itemId = 0; @@ -149,16 +366,10 @@ _secondTypeDict.TryGetValue(thirdType, out modellist); if (modellist != null && modellist.Count > 0) { int.TryParse(modellist[0].makeID, out itemId); itemId = modellist[0].makeID[0]; } } return itemId; } public ItemCompoundConfig CurComposeModel { get; private set; } public void SetCurComposeModel(ItemCompoundConfig compoundModel) { CurComposeModel = compoundModel; } public bool IsEnoughUnfixedMat(ItemCompoundConfig compoundModel) @@ -205,7 +416,7 @@ Dictionary<int, Dictionary<int, int>> fixedMatIsBindDict = new Dictionary<int, Dictionary<int, int>>(); //id , isBind, count Dictionary<int, Dictionary<int, int>> unfixedMatIsBindDict = new Dictionary<int, Dictionary<int, int>>(); public void SendComposeRequest(ItemCompoundConfig compoundModel, Dictionary<int, List<int>> fixedItemIndexDict,UIEffect composEffect,int composeCount = 1,int successRate = 10000) public void SendComposeRequest(ItemCompoundConfig compoundModel, Dictionary<int, List<int>> fixedItemIndexDict,UIEffect composEffect,int composeCount = 1,int successRate = 10000,bool isIncrease = false) { fixedMatIsBindDict.Clear(); unfixedMatIsBindDict.Clear(); @@ -320,19 +531,19 @@ { if (sure) { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount,isIncrease); } }); return; } else { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount, isIncrease); } } else { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount, isIncrease); } } @@ -349,19 +560,19 @@ { if (sure) { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount, isIncrease); } }); return; } else { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount, isIncrease); } } else { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount, isIncrease); } } } @@ -377,13 +588,13 @@ { if (isCompose) { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount, isIncrease); } }); } else { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount, isIncrease); } } else @@ -449,7 +660,7 @@ { if (isCompose) { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount, isIncrease); } }); } @@ -480,14 +691,14 @@ { if (isCompose) { SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount); SendComposeQuest(compoundModel, composEffect, unfixedIndexArray, composeCount, isIncrease); } }); } } } public void SendComposeQuest(ItemCompoundConfig compoundModel,UIEffect composEffect,byte[] unfixedIndexArray, int composeCount) public void SendComposeQuest(ItemCompoundConfig compoundModel,UIEffect composEffect,byte[] unfixedIndexArray, int composeCount,bool isIncrease) { composEffect.Play(); CA303_tagCMItemCompound itemCompose = null; @@ -501,6 +712,20 @@ itemCompose.AddonsItemIndexCnt = (byte)selectModel.GetHaveAddSelectItem().Count; itemCompose.AddonsItemIndex = DictToArray(selectModel.GetHaveAddSelectItem()); itemCompose.AddonsItemCount = addonsReduceArray; List<int> increaseIndexlist = null; TryGetIncreaseRateItemIndex(compoundModel,isIncrease,out increaseIndexlist); byte[] increaseRateIndexArray = null; if (increaseIndexlist != null) { increaseRateIndexArray = ListToArray(increaseIndexlist); itemCompose.RateIncreaseItemIndexCnt = (byte)increaseRateIndexArray.Length; itemCompose.RateIncreaseItemIndex = increaseRateIndexArray; } else { itemCompose.RateIncreaseItemIndexCnt = 0; itemCompose.RateIncreaseItemIndex = new byte[0]; } GameNetSystem.Instance.SendInfo(itemCompose); } @@ -652,6 +877,18 @@ return itemArray; } private byte[] ListToArray(List<int> list) { byte[] itemArray = new byte[list.Count]; int i = 0; for (i = 0; i < list.Count; i++) { itemArray[i] = (byte)list[i]; } return itemArray; } private byte[] DictToArray(Dictionary<int, List<int>> itemDict) { int itemArrayLength = 0; @@ -773,8 +1010,8 @@ if (getFirstModel[secondType].ContainsKey(0)) { ItemCompoundConfig compoundConfig = getFirstModel[secondType][0][0]; int[] fixedIDs = ConfigParse.GetMultipleStr<int>(compoundConfig.itemID); int[] fixedCnt = ConfigParse.GetMultipleStr<int>(compoundConfig.itemCount); int[] fixedIDs = compoundConfig.itemID; int[] fixedCnt = compoundConfig.itemCount; for (int i = 0; i < fixedIDs.Length; i++) { int haveCnt = playerPack.GetItemCountByID(PackType.rptItem, fixedIDs[i]); @@ -945,7 +1182,7 @@ List<ItemCompoundConfig> compoundlist = firstDict[3][thirdType]; for(int i = 0; i < compoundlist.Count; i++) { int makeID = ConfigParse.GetMultipleStr<int>(compoundlist[i].makeID)[i]; int makeID = compoundlist[i].makeID[i]; string key = StringUtility.Contact(3, 10, thirdType); if (IsComposeJobLimit(makeID) && IsEnoughFixedMat(compoundlist[i])) { @@ -987,6 +1224,7 @@ fixedItem, unfixedItem, addItem, IncreaseItem, } public enum DisplayItemArray