From 27c1fce6488069ca68d3c1f14ea833973265de79 Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期三, 29 八月 2018 11:56:13 +0800
Subject: [PATCH] 1495 修复合成Bug
---
System/Compose/New/ComposeTicketWin.cs | 142 +++++++++++++++++++++++------------------------
1 files changed, 70 insertions(+), 72 deletions(-)
diff --git a/System/Compose/New/ComposeTicketWin.cs b/System/Compose/New/ComposeTicketWin.cs
index a2beb65..eb6a3b0 100644
--- a/System/Compose/New/ComposeTicketWin.cs
+++ b/System/Compose/New/ComposeTicketWin.cs
@@ -109,8 +109,7 @@
protected override void OnPreOpen()
{
DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnComposeAnswer;
- composeWinModel.funcType = ComposeFuncType.Ticket;
- firstTypeDict = composeWinModel.GetFirstTypeModel();
+ firstTypeDict = composeWinModel.GetFirstTypeModel((int)ComposeFuncType.Ticket);
bool isJumpTo = false;
if (AchievementGoto.guideAchievementId != 0)
{
@@ -120,7 +119,7 @@
isJumpTo = true;
curSecondType = composeWinModel.secondType;
curThirdType = composeWinModel.thirdType;
- secondTypeDict = composeWinModel.GetSecondTypeModel(composeWinModel.secondType);
+ secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Ticket, composeWinModel.secondType);
ClickSecondTypeUICtrl();
composeWinModel.ResetJumpToModel();
}
@@ -133,7 +132,7 @@
isJumpTo = true;
curSecondType = composeWinModel.secondType;
curThirdType = composeWinModel.thirdType;
- secondTypeDict = composeWinModel.GetSecondTypeModel(composeWinModel.secondType);
+ secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Ticket,composeWinModel.secondType);
ClickSecondTypeUICtrl();
composeWinModel.ResetJumpToModel();
}
@@ -151,7 +150,7 @@
{
isJumpTo = false;
bool isCanCompose = true;
- if (!composeWinModel.IsEnoughFixedMat() || !composeWinModel.IsEnoughUnfixedMat(compoundModel))
+ if (!composeWinModel.IsEnoughFixedMat(compoundModel) || !composeWinModel.IsEnoughUnfixedMat(compoundModel))
{
MessageWin.Inst.ShowFixedTip(Language.Get("Compose101"));
isCanCompose = false;
@@ -256,7 +255,7 @@
{
arrowIcon.transform.localRotation = Quaternion.Euler(0, 0, -90);
icon.SetSprite("ComposeFirstClassChoosebtn");
- secondTypeDict = composeWinModel.GetSecondTypeModel(curSecondType);
+ secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Ticket, curSecondType);
//ClickSecondTypeUICtrl();
}
else
@@ -274,7 +273,7 @@
if (curThirdType == cell.index)
{
icon.SetSprite("ChildListBtn_Select");
- thirdTypelist = composeWinModel.GetThirdTypeModellist(cell.index);
+ thirdTypelist = composeWinModel.GetThirdTypeModellist(compoundModel.firstType, compoundModel.secondType, cell.index);
RefreshUI(compoundModel);
}
else
@@ -289,7 +288,7 @@
private void OnClickSecondType(int secondType)
{
curSecondType = secondType;
- secondTypeDict = composeWinModel.GetSecondTypeModel(curSecondType);
+ secondTypeDict = composeWinModel.GetSecondTypeModel((int)ComposeFuncType.Ticket, curSecondType);
foreach (var thirdType in secondTypeDict.Keys)
{
if (thirdType != 0)
@@ -363,10 +362,11 @@
#region 鍚堟垚鐗╁搧UI
for (i = 0; i < previewItemlist.Count; i++)
{
+ int[] makeIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.MakeIds);
GameObject gridCell = previewItemlist[i].transform.Find("GridCell").gameObject;
- if (i < composeWinModel.makeIDs.Length)
+ if (i < makeIds.Length)
{
- RefreshGridCellUI(gridCell, false, composeWinModel.makeIDs[i],NeedMatType.MakeItem);
+ RefreshGridCellUI(gridCell, false,makeIds[i],NeedMatType.MakeItem);
}
else
{
@@ -376,8 +376,13 @@
#endregion
#region 鍥哄畾閬撳叿鍜屼笉鍥哄畾閬撳叿UI
+ int[] fixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedDisplay);
+ int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
+ int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
+ int[] unfixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedIds);
+ int[] unfixedDisplay = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.UnfixedDisplay);
- for(i = 0;i < sourceItemlist.Count; i++)
+ for (i = 0;i < sourceItemlist.Count; i++)
{
GameObject gridCell = sourceItemlist[i].transform.Find("GridCell").gameObject;
Text putInText = sourceItemlist[i].transform.Find("PutInText").GetComponent<Text>();
@@ -387,36 +392,23 @@
posBtn.RemoveAllListeners();
}
- fixedItemIndexDict.Clear();
- for (i = 0; i < composeWinModel.fixedItemDisplay.Length; i++)
+ for (i = 0; i < fixedDisplay.Length; i++)
{
- if (composeWinModel.fixedItemDisplay[i] != 0)
+ if (fixedDisplay[i] != 0)
{
- GameObject matPos = sourceItemlist[composeWinModel.fixedItemDisplay[i] - 1];
+ GameObject matPos = sourceItemlist[fixedDisplay[i] - 1];
GameObject gridCell = matPos.transform.Find("GridCell").gameObject;
Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>();
putInText.gameObject.SetActive(false);
- RefreshGridCellUI(gridCell,false,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);
- }
+ RefreshGridCellUI(gridCell,false,fixedIds[i],NeedMatType.fixedItem);
}
}
- for (i = 0; i < composeWinModel.unfixedItemDisplay.Length; i++)
+ for (i = 0; i < unfixedDisplay.Length; i++)
{
- if (composeWinModel.unfixedItemDisplay[i] != 0)
+ if (unfixedDisplay[i] != 0)
{
- GameObject matPos = sourceItemlist[composeWinModel.unfixedItemDisplay[i] - 1];
+ GameObject matPos = sourceItemlist[unfixedDisplay[i] - 1];
GameObject gridCell = matPos.transform.Find("GridCell").gameObject;
Text putInText = matPos.transform.Find("PutInText").GetComponent<Text>();
Button posBtn = matPos.GetComponent<Button>();
@@ -516,22 +508,24 @@
if(matType == NeedMatType.fixedItem)
{
+ int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
+ int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
itemCell.countText.gameObject.SetActive(true);
int haveCount = playerPack.GetItemCountByID(PackType.rptItem,itemId);
int i = 0;
- for(i = 0; i < composeWinModel.costfixedItemIDs.Length; i++)
+ for(i = 0; i < fixedIds.Length; i++)
{
- if(composeWinModel.costfixedItemIDs[i] == itemId)
+ if(fixedIds[i] == itemId)
{
- if (haveCount >= composeWinModel.costfixedItemCounts[i])
+ if (haveCount >= fixedCounts[i])
{
itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Green,haveCount.ToString()),
- "/",composeWinModel.costfixedItemCounts[i].ToString());
+ "/",fixedCounts[i].ToString());
}
else
{
itemCell.countText.text = StringUtility.Contact(UIHelper.GetTextColorByItemColor(TextColType.Red, haveCount.ToString()),
- "/", composeWinModel.costfixedItemCounts[i].ToString());
+ "/", fixedCounts[i].ToString());
}
break;
}
@@ -549,75 +543,79 @@
private void ClickAllComposeBtn()
{
- List<int> composeCountlist = new List<int>();
fixedItemIndexDict.Clear();
- SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
- if(composeWinModel.costfixedItemIDs != null)
- {
- for (int i = 0; i < composeWinModel.costfixedItemIDs.Length; i++)
- {
- int haveCount = playerPack.GetItemCountByID(PackType.rptItem, composeWinModel.costfixedItemIDs[i]);
- int canComposeCount = haveCount / composeWinModel.costfixedItemCounts[i];
- composeCountlist.Add(canComposeCount);
- List<int> itemIndexlist = null;
- if (singlePack != null)
- {
- itemIndexlist = singlePack.ItemIndexlist(composeWinModel.costfixedItemIDs[i], composeWinModel.costfixedItemCounts[i] * canComposeCount);
- }
- fixedItemIndexDict.Add(composeWinModel.costfixedItemIDs[i], itemIndexlist);
- }
+ if (compoundModel == null) return;
- composeCountlist.Sort();
- int composeCnt = 0;
- for (int i = composeCountlist[0]; i > -1; i--)
+ List<int> composeCountlist = new List<int>();
+ SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
+ int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
+ int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
+ for (int i = 0; i < fixedIds.Length; i++)
+ {
+ int haveCount = playerPack.GetItemCountByID(PackType.rptItem, fixedIds[i]);
+ int canComposeCount = haveCount / fixedCounts[i];
+ composeCountlist.Add(canComposeCount);
+ List<int> itemIndexlist = null;
+ if (singlePack != null)
{
- ulong needMoney = (ulong)(i * compoundModel.money);
- if (UIHelper.GetMoneyCnt(3) >= needMoney)
- {
- composeCnt = i;
- break;
- }
+ itemIndexlist = singlePack.ItemIndexlist(fixedIds[i], fixedCounts[i] * canComposeCount);
}
- composeWinModel.SendComposeRequest(compoundModel, fixedItemIndexDict, composeEffect, composeCnt);
+ fixedItemIndexDict.Add(fixedIds[i], itemIndexlist);
}
+
+ composeCountlist.Sort();
+ int composeCnt = 0;
+ for (int i = composeCountlist[0]; i > -1; i--)
+ {
+ ulong needMoney = (ulong)(i * compoundModel.money);
+ if (UIHelper.GetMoneyCnt(3) >= needMoney)
+ {
+ composeCnt = i;
+ break;
+ }
+ }
+ composeWinModel.SendComposeRequest(compoundModel, fixedItemIndexDict, composeEffect, composeCnt);
}
private void OnClickComposeBtn()
{
+ if (compoundModel == null) return;
+
SetFixedItemIndexDic();
composeWinModel.SendComposeRequest(compoundModel, fixedItemIndexDict,composeEffect,1);
}
private void SetFixedItemIndexDic()
{
+ fixedItemIndexDict.Clear();
SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem);
- if (singlePack == null) return;
+ if (singlePack == null || compoundModel == null) return;
int minBindCnt = 0;
int minNoBindCnt = 0;
composeWinModel.GetBindOrNoBindMinCnt(out minBindCnt,out minNoBindCnt);
+ int[] fixedIds = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedIds);
+ int[] fixedCounts = ItemCompoundConfig.GetDisplayArrayByType(compoundModel.id, DisplayItemArray.FixedCounts);
- fixedItemIndexDict.Clear();
-
- for (int i = 0; i < composeWinModel.costfixedItemIDs.Length; i++)
+ for (int i = 0; i < fixedIds.Length; i++)
{
List<int> itemIndexlist = null;
- if (minBindCnt >= composeWinModel.costfixedItemCounts[i])
+ if (minBindCnt >= fixedCounts[i])
{
- itemIndexlist = singlePack.ItemIndexlistByIsBind(composeWinModel.costfixedItemIDs[i], composeWinModel.costfixedItemCounts[i], 1);
+ itemIndexlist = singlePack.ItemIndexlistByIsBind(fixedIds[i],fixedCounts[i], 1);
}
- else if(minNoBindCnt >= composeWinModel.costfixedItemCounts[i])
+ else if(minNoBindCnt >= fixedCounts[i])
{
- itemIndexlist = singlePack.ItemIndexlistByIsBind(composeWinModel.costfixedItemIDs[i], composeWinModel.costfixedItemCounts[i],0);
+ itemIndexlist = singlePack.ItemIndexlistByIsBind(fixedIds[i],fixedCounts[i],0);
}
else
{
- itemIndexlist = singlePack.ItemIndexlist(composeWinModel.costfixedItemIDs[i], composeWinModel.costfixedItemCounts[i]);
+ itemIndexlist = singlePack.ItemIndexlist(fixedIds[i],fixedCounts[i]);
}
if (itemIndexlist != null)
{
- fixedItemIndexDict.Add(composeWinModel.costfixedItemIDs[i], itemIndexlist);
+ fixedItemIndexDict.Add(fixedIds[i], itemIndexlist);
}
}
--
Gitblit v1.8.0