From cad87129e5ea2fd23cc195ed0444bd38f1117aa7 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 05 八月 2025 15:51:54 +0800
Subject: [PATCH] 79 【常规】背包 - 随机宝箱界面,自选宝箱界面,获得物品奖励界面
---
Main/System/KnapSack/Logic/CommonGetItemCell.cs | 36
Main/Config/Configs/ChestsAwardConfig.cs | 2
Main/Config/PartialConfigs/ChestsAwardConfig.cs | 78 +
Main/System/ItemTip/ChooseItemsWin.cs | 109 ++
Main/System/ItemTip/BoxItemCell.cs.meta | 5
Main/System/ItemTip/BoxItemLineCell.cs.meta | 5
Main/System/KnapSack/Logic/ItemLogicUtility.cs | 122 ++
Main/System/KnapSack/Logic/CommonGetItemWin.cs | 174 +--
Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs | 2
Main/System/ItemTip/ChooseItemsCell.cs | 79 +
Main/System/GeneralConfig/GeneralDefine.cs | 39
Main/System/ItemTip/BoxItemLineCell.cs | 25
Main/System/KnapSack/New/CommonItemBaisc.cs | 6
Main/Component/UI/Common/ButtonClickInterval.cs | 40
Main/Component/UI/Common/LongPressButton.cs | 150 +-
Main/Main.cs | 1
Main/System/ItemTip/BoxItemCell.cs | 20
Main/System/ItemTip/BoxGetItemModel.cs.meta | 5
Main/System/ItemTip/BoxItemWin.cs.meta | 5
Main/System/Recharge/DailySpecialsModel.cs | 2
Main/System/Store/StoreModel.cs | 2
Main/Config/ConfigParse.cs | 29
Main/System/KnapSack/Logic/PackGirdCell.cs | 14
Main/Component/UI/Common/SliderPanel.cs | 99 ++
Main/System/KnapSack/PackManager.cs | 153 +--
Main/Utility/MaterialUtility.cs | 8
Main/Config/Configs/ChestsConfig.cs | 2
Main/Manager/UIManager.cs | 9
Main/Core/NetworkPackage/ClientPack/CA3_Item/CA323_tagCMUseItems.cs | 4
Main/System/KnapSack/BackpackData.cs | 92 -
Main/System/ItemTip/BoxGetItemModel.cs | 538 ++++++++++++
Main/System/ItemTip/ItemTipUtility.cs | 511 ++---------
Main/System/ItemTip/ChooseItemsWin.cs.meta | 5
Main/System/Tip/ItemsConfirmCell.cs | 2
/dev/null | 56 -
Main/System/Recharge/RechargeManager.cs | 6
Main/System/ItemTip/ChooseItemsCell.cs.meta | 5
Main/Config/PartialConfigs/ChestsAwardConfig.cs.meta | 5
Main/System/CustomizedGift/CustomizedRechargeModel.cs | 4
Main/System/ItemTip/BoxItemWin.cs | 118 ++
Main/Component/UI/Common/SliderPanel.cs.meta | 5
41 files changed, 1,649 insertions(+), 923 deletions(-)
diff --git a/Main/Component/UI/Common/ButtonClickInterval.cs b/Main/Component/UI/Common/ButtonClickInterval.cs
index f4eb65a..4b44d99 100644
--- a/Main/Component/UI/Common/ButtonClickInterval.cs
+++ b/Main/Component/UI/Common/ButtonClickInterval.cs
@@ -4,25 +4,25 @@
using System.Collections;
- public class ButtonClickInterval : MonoBehaviour
+public class ButtonClickInterval : MonoBehaviour
+{
+ [SerializeField] float interval = 1f;
+ [SerializeField] Button targetBtn;
+
+ private void Awake()
{
- [SerializeField] float interval = 1f;
- [SerializeField] Button targetBtn;
-
- private void Awake()
- {
- targetBtn.AddListener(OnClick);
- }
-
- private void OnClick()
- {
- targetBtn.enabled = false;
- StartCoroutine(DelayClick());
- }
-
- IEnumerator DelayClick()
- {
- yield return new WaitForSeconds(interval);
- targetBtn.enabled = true;
- }
+ targetBtn.AddListener(OnClick);
}
+
+ private void OnClick()
+ {
+ targetBtn.enabled = false;
+ StartCoroutine(DelayClick());
+ }
+
+ IEnumerator DelayClick()
+ {
+ yield return new WaitForSeconds(interval);
+ targetBtn.enabled = true;
+ }
+}
diff --git a/Main/Component/UI/Common/LongPressButton.cs b/Main/Component/UI/Common/LongPressButton.cs
index b84d4ce..3cb9cf1 100644
--- a/Main/Component/UI/Common/LongPressButton.cs
+++ b/Main/Component/UI/Common/LongPressButton.cs
@@ -6,93 +6,95 @@
using UnityEngine.Serialization;
using UnityEngine.UI;
- public class LongPressButton : ButtonEx
+public class LongPressButton : ButtonEx
+{
+ public class ButtonPressEvent : UnityEvent { }
+
+ //闀挎寜鐩戝惉
+ [FormerlySerializedAs("onPress")]
+ [SerializeField]
+ private ButtonPressEvent m_OnPress = new ButtonPressEvent();
+ public ButtonPressEvent onPress
{
- public class ButtonPressEvent : UnityEvent { }
+ get { return m_OnPress; }
+ set { m_OnPress = value; }
+ }
- [FormerlySerializedAs("onPress")]
- [SerializeField]
- private ButtonPressEvent m_OnPress = new ButtonPressEvent();
- public ButtonPressEvent onPress
+ [SerializeField]
+ float m_LongPressCheckTime = 0.3f;
+ public float longPressCheckTime
+ {
+ get { return m_LongPressCheckTime; }
+ set { m_LongPressCheckTime = value; }
+ }
+ [SerializeField]
+ float m_LongPressIntervalTime = 0.1f;
+ public float longPressIntervalTime
+ {
+ get { return m_LongPressIntervalTime; }
+ set { m_LongPressIntervalTime = value; }
+ }
+
+ float m_PressTime = 0.0f;
+ float m_PressIntervalTime = 0.0f;
+ bool m_LongPress = false;
+ bool m_IsButtonDown = false;
+
+ public override void OnPointerClick(PointerEventData eventData)
+ {
+ if (m_LongPress)
{
- get { return m_OnPress; }
- set { m_OnPress = value; }
+ m_LongPress = false;
+ return;
}
+ base.OnPointerClick(eventData);
+ }
- [SerializeField]
- float m_LongPressCheckTime = 0.5f;
- public float longPressCheckTime
- {
- get { return m_LongPressCheckTime; }
- set { m_LongPressCheckTime = value; }
- }
- [SerializeField]
- float m_LongPressIntervalTime = 0.1f;
- public float longPressIntervalTime
- {
- get { return m_LongPressIntervalTime; }
- set { m_LongPressIntervalTime = value; }
- }
+ public override void OnPointerDown(PointerEventData eventData)
+ {
+ base.OnPointerDown(eventData);
+ m_PressTime = 0.0f;
+ m_PressIntervalTime = 0.0f;
+ m_IsButtonDown = true;
+ }
- float m_PressTime = 0.0f;
- float m_PressIntervalTime = 0.0f;
- bool m_LongPress = false;
- bool m_IsButtonDown = false;
+ public override void OnPointerUp(PointerEventData eventData)
+ {
+ base.OnPointerUp(eventData);
+ m_IsButtonDown = false;
+ }
- public override void OnPointerClick(PointerEventData eventData)
+ public override void OnPointerExit(PointerEventData eventData)
+ {
+ base.OnPointerExit(eventData);
+ m_IsButtonDown = false;
+ m_LongPress = false;
+ }
+
+ private void Update()
+ {
+ if (m_IsButtonDown)
{
- if (m_LongPress)
+ m_PressTime += Time.deltaTime;
+ if (m_PressTime < m_LongPressCheckTime)
{
- m_LongPress = false;
return;
}
- base.OnPointerClick(eventData);
- }
- public override void OnPointerDown(PointerEventData eventData)
- {
- base.OnPointerDown(eventData);
- m_PressTime = 0.0f;
- m_PressIntervalTime = 0.0f;
- m_IsButtonDown = true;
- }
-
- public override void OnPointerUp(PointerEventData eventData)
- {
- base.OnPointerUp(eventData);
- m_IsButtonDown = false;
- }
-
- public override void OnPointerExit(PointerEventData eventData)
- {
- base.OnPointerExit(eventData);
- m_IsButtonDown = false;
- m_LongPress = false;
- }
-
- private void Update()
- {
- if (m_IsButtonDown)
+ if (m_PressIntervalTime >= m_LongPressIntervalTime)
{
- m_PressTime += Time.deltaTime;
- if (m_PressTime < m_LongPressCheckTime)
- {
- return;
- }
- if (m_PressIntervalTime >= m_LongPressIntervalTime)
- {
- onPress.Invoke();
- m_PressIntervalTime = 0.0f;
- }
- m_PressIntervalTime += Time.deltaTime;
- m_LongPress = true;
+ onPress.Invoke();
+ m_PressIntervalTime = 0.0f;
}
+ m_PressIntervalTime += Time.deltaTime;
+ m_LongPress = true;
}
+ }
- protected override void OnEnable()
- {
- base.OnEnable();
- m_LongPress = false;
- m_IsButtonDown = false;
- }
- }
\ No newline at end of file
+ protected override void OnEnable()
+ {
+ base.OnEnable();
+ m_LongPress = false;
+ m_IsButtonDown = false;
+ }
+}
\ No newline at end of file
diff --git a/Main/Component/UI/Common/SliderPanel.cs b/Main/Component/UI/Common/SliderPanel.cs
new file mode 100644
index 0000000..761b58a
--- /dev/null
+++ b/Main/Component/UI/Common/SliderPanel.cs
@@ -0,0 +1,99 @@
+锘縰sing System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+using System;
+
+/// <summary>
+/// 杩涘害鏉″姛鑳斤紝甯︽湁+-鎸夐挳鎺у埗锛屾渶澶ф暟閲忔寜閽�
+/// </summary>
+public class SliderPanel : MonoBehaviour
+{
+ [SerializeField] Text countText;
+ [SerializeField] Slider slider;
+ [SerializeField] LongPressButton addBtn;
+ [SerializeField] LongPressButton decBtn;
+ [SerializeField] ButtonEx maxBtn;
+
+ int count;
+ int maxCount;
+
+ Action<int> OnChangeEvent;
+ void Start()
+ {
+ slider.AddListener((value) => { Refresh(); });
+ addBtn.AddListener(() =>
+ {
+ slider.value += 1;
+ Refresh();
+ });
+ addBtn.onPress.AddListener(() =>
+ {
+ slider.value += 1;
+ Refresh();
+ });
+ decBtn.AddListener(() =>
+ {
+ slider.value -= 1;
+ Refresh();
+ });
+ decBtn.onPress.AddListener(() =>
+ {
+ slider.value -= 1;
+ Refresh();
+ });
+
+ maxBtn.AddListener(() =>
+ {
+ slider.value = slider.maxValue;
+ Refresh();
+ });
+ }
+
+ public void Init(Action<int> _OnChangeEvent, int _maxCount, int _count = 1)
+ {
+ count = _count;
+ maxCount = _maxCount;
+ slider.minValue = 1;
+ slider.maxValue = _maxCount;
+ slider.value = count;
+
+ Refresh();
+ OnChangeEvent = _OnChangeEvent;
+
+ }
+
+ void Refresh()
+ {
+ count = (int)slider.value;
+ countText.text = count.ToString();
+ if (count >= maxCount)
+ {
+ addBtn.interactable = false;
+ addBtn.SetColorful(null, false);
+ maxBtn.interactable = false;
+ maxBtn.SetColorful(null, false);
+ }
+ else
+ {
+ addBtn.interactable = true;
+ addBtn.SetColorful(null, true);
+ maxBtn.interactable = true;
+ maxBtn.SetColorful(null, true);
+ }
+
+ if (count <= 0)
+ {
+ decBtn.interactable = false;
+ decBtn.SetColorful(null, false);
+ }
+ else
+ {
+ decBtn.interactable = true;
+ decBtn.SetColorful(null, true);
+ }
+
+ OnChangeEvent?.Invoke(count);
+ }
+
+}
diff --git a/Main/Component/UI/Core/DelayButton.cs.meta b/Main/Component/UI/Common/SliderPanel.cs.meta
similarity index 68%
copy from Main/Component/UI/Core/DelayButton.cs.meta
copy to Main/Component/UI/Common/SliderPanel.cs.meta
index 3596531..eab5a03 100644
--- a/Main/Component/UI/Core/DelayButton.cs.meta
+++ b/Main/Component/UI/Common/SliderPanel.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: f91c143a16d59de4b80b2b0ffbb455e4
-timeCreated: 1501494723
-licenseType: Free
+guid: 3525ae0230fc77c439297c3fe45ed8d5
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/Component/UI/Core/DelayButton.cs b/Main/Component/UI/Core/DelayButton.cs
deleted file mode 100644
index 748b752..0000000
--- a/Main/Component/UI/Core/DelayButton.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-锘�//--------------------------------------------------------
-// [Author]: 鐜╀釜娓告垙
-// [ Date ]: Monday, July 31, 2017
-//--------------------------------------------------------
-
-using UnityEngine;
-using System.Collections;
-using UnityEngine.EventSystems;
-using UnityEngine.UI;
-using System;
-
- /// <summary>
- /// 寤惰繜瑙﹀彂鐐瑰嚮浜嬩欢鐨勬寜閽紝鐢ㄤ簬闀挎寜浜嬩欢
- /// </summary>
- public class DelayButton:MonoBehaviour,IPointerDownHandler,IPointerUpHandler {
-
- [SerializeField]
- float m_Delay = 0.5f;
- public float delay { get { return m_Delay; } }
-
- [SerializeField]
- Action m_OnClick;
- public Action onClick { get { return m_OnClick; } }
-
- float timer = 0f;
- bool down = false;
-
- public void OnPointerDown(PointerEventData eventData) {
- timer = 0f;
- down = true;
- }
-
- public void OnPointerUp(PointerEventData eventData) {
- down = false;
- }
-
- private void OnEnable() {
- timer = 0f;
- down = false;
- }
-
- private void LateUpdate() {
- if(down && timer < delay) {
- timer += Time.deltaTime;
- if(timer > delay) {
- if(onClick != null) {
- onClick?.Invoke();
- }
- }
- }
- }
-
- }
-
-
-
diff --git a/Main/Config/ConfigParse.cs b/Main/Config/ConfigParse.cs
index 355e980..8e2f2f8 100644
--- a/Main/Config/ConfigParse.cs
+++ b/Main/Config/ConfigParse.cs
@@ -105,6 +105,8 @@
return msg.Split('_');
}
+ //涓�缁存暟缁勶細鏉ユ簮鏍煎紡濡� 1_2|2_3|3_1|4_3锛�
+ //杩斿洖涓�缁存暟缁勭粨鏋勫 1|2|3|4
public static T[] GetKeyValueKeys<T>(string msg) where T : struct
{
string[] segs = GetMultipleStr(msg);
@@ -124,6 +126,8 @@
return null;
}
+ //涓�缁存暟缁勶細鏉ユ簮鏍煎紡濡� 1_2|2_3|3_1|4_3锛�
+ //杩斿洖涓�缁存暟缁勭粨鏋勫 2|3|1|3
public static T[] GetKeyValueValues<T>(string msg) where T : struct
{
string[] segs = GetMultipleStr(msg);
@@ -143,6 +147,31 @@
return null;
}
+ //浜岀淮鏁扮粍锛氭潵婧愭牸寮忓 1_2_1|2_3_4|3_1_2|4_3_4
+ public static T[][] GetArray2<T>(string msg) where T : struct
+ {
+ string[] segs = GetMultipleStr(msg);
+ if (segs != null && segs.Length > 0)
+ {
+ T[][] array = new T[segs.Length][];
+ for (int i = 0; i < segs.Length; i++)
+ {
+ string[] pair = GetKeyValue(segs[i]);
+ if (pair.Length > 1)
+ {
+ array[i] = new T[pair.Length];
+ for (int j = 0; j < pair.Length; j++)
+ {
+ array[i][j] = (T)Convert.ChangeType(pair[j], typeof(T));
+ }
+ }
+ }
+ return array;
+ }
+ return null;
+ }
+
+ //瀛楀吀锛氭潵婧愭牸寮忓 1_2|2_3|3_1|4_3锛�
public static Dictionary<T, P> GetDic<T, P>(string msg)
{
Dictionary<T, P> dic = null;
diff --git a/Main/Config/Configs/ChestsAwardConfig.cs b/Main/Config/Configs/ChestsAwardConfig.cs
index 7cd3637..e4d8118 100644
--- a/Main/Config/Configs/ChestsAwardConfig.cs
+++ b/Main/Config/Configs/ChestsAwardConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: Monday, August 4, 2025
+// [ Date ]: Tuesday, August 5, 2025
//--------------------------------------------------------
using System.Collections.Generic;
diff --git a/Main/Config/Configs/ChestsConfig.cs b/Main/Config/Configs/ChestsConfig.cs
index 82c7fad..a7d24d5 100644
--- a/Main/Config/Configs/ChestsConfig.cs
+++ b/Main/Config/Configs/ChestsConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: YYL
-// [ Date ]: Monday, August 4, 2025
+// [ Date ]: 2025骞�8鏈�5鏃�
//--------------------------------------------------------
using System.Collections.Generic;
diff --git a/Main/Config/PartialConfigs/ChestsAwardConfig.cs b/Main/Config/PartialConfigs/ChestsAwardConfig.cs
new file mode 100644
index 0000000..f9d7212
--- /dev/null
+++ b/Main/Config/PartialConfigs/ChestsAwardConfig.cs
@@ -0,0 +1,78 @@
+锘�//--------------------------------------------------------
+// [Author]: 绗簩涓栫晫
+// [ Date ]: Sunday, February 04, 2018
+//--------------------------------------------------------
+
+using System.Collections.Generic;
+
+public partial class ChestsAwardConfig : ConfigBase<int, ChestsAwardConfig>
+{
+
+ private static Dictionary<string, ChestsAwardConfig> chestAwardDict = new Dictionary<string, ChestsAwardConfig>();
+ private static Dictionary<int, List<int>> chestIdDict = new Dictionary<int, List<int>>();
+
+ protected override void OnConfigParseCompleted()
+ {
+ string key = StringUtility.Contact(BoxID, BoxLV);
+ if (!chestAwardDict.ContainsKey(key))
+ {
+ chestAwardDict.Add(key, this);
+ }
+
+ if (!chestIdDict.ContainsKey(BoxID))
+ {
+ List<int> boxLvlist = new List<int>();
+ boxLvlist.Add(BoxLV);
+ chestIdDict.Add(BoxID, boxLvlist);
+ }
+ else
+ {
+ chestIdDict[BoxID].Add(BoxLV);
+ }
+ }
+
+ public static ChestsAwardConfig GetChestsAwardByID(int boxId)
+ {
+ int playerLv = PlayerDatas.Instance.baseData.LV;
+ List<int> boxLvlist = null;
+ int boxLv = 0;
+ chestIdDict.TryGetValue(boxId, out boxLvlist);
+ if (boxLvlist != null)
+ {
+ boxLvlist.Sort();
+ for (int i = boxLvlist.Count - 1; i > -1; i--)
+ {
+ if (boxLvlist[i] <= playerLv)
+ {
+ boxLv = boxLvlist[i];
+ break;
+ }
+ }
+ }
+ return GetChestsAwardByIDAndLv(boxId, boxLv);
+ }
+
+ private static ChestsAwardConfig GetChestsAwardByIDAndLv(int id, int lv)
+ {
+ ChestsAwardConfig chestsAwardConfig = null;
+ string key = StringUtility.Contact(id, lv);
+ chestAwardDict.TryGetValue(key, out chestsAwardConfig);
+ return chestsAwardConfig;
+ }
+
+ //0:涓嶆槸绠卞瓙锛�1锛氶殢鏈虹瀛� 2锛氳嚜閫夌瀛�
+ public static int GetBoxType(int itemID)
+ {
+ if (!chestIdDict.ContainsKey(itemID))
+ {
+ return 0;
+ }
+ var config = GetChestsAwardByID(itemID);
+ return string.IsNullOrEmpty(config.SelectList) ? 1 : 2;
+ }
+}
+
+
+
+
+
diff --git a/Main/Component/UI/Core/DelayButton.cs.meta b/Main/Config/PartialConfigs/ChestsAwardConfig.cs.meta
similarity index 68%
copy from Main/Component/UI/Core/DelayButton.cs.meta
copy to Main/Config/PartialConfigs/ChestsAwardConfig.cs.meta
index 3596531..9d386de 100644
--- a/Main/Component/UI/Core/DelayButton.cs.meta
+++ b/Main/Config/PartialConfigs/ChestsAwardConfig.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: f91c143a16d59de4b80b2b0ffbb455e4
-timeCreated: 1501494723
-licenseType: Free
+guid: 5ce9e992608fd9f458c1b1a26a13d102
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/Core/NetworkPackage/ClientPack/CA3_Item/CA323_tagCMUseItems.cs b/Main/Core/NetworkPackage/ClientPack/CA3_Item/CA323_tagCMUseItems.cs
index b39aa7e..0664dfb 100644
--- a/Main/Core/NetworkPackage/ClientPack/CA3_Item/CA323_tagCMUseItems.cs
+++ b/Main/Core/NetworkPackage/ClientPack/CA3_Item/CA323_tagCMUseItems.cs
@@ -5,7 +5,7 @@
public class CA323_tagCMUseItems : GameNetPackBasic {
public byte ItemIndex; //鐗╁搧鍦ㄨ儗鍖呬腑绱㈠紩
- public ushort UseCnt; //浣跨敤涓暟锛�0琛ㄧず鍏ㄩ儴浣跨敤
+ public uint UseCnt; //浣跨敤涓暟锛�0琛ㄧず鍏ㄩ儴浣跨敤
public uint ExData; //浣跨敤鎵╁睍鍊�, 榛樿0, 閫夋嫨鐗╁搧瀹濈鏃跺彂閫侀�夋嫨鐨勭墿鍝両D
public byte SelectCount; //鎸囧畾閫夋嫨椤癸紝褰撴壒閲忎娇鐢ㄥ崟涓瀛愰渶瑕佸悓鏃堕�変腑澶氱閫夐」鏃朵娇鐢ㄨ鍊�
public tagCMUseItemsSelect[] SelectList;
@@ -17,7 +17,7 @@
public override void WriteToBytes () {
WriteBytes (ItemIndex, NetDataType.BYTE);
- WriteBytes (UseCnt, NetDataType.WORD);
+ WriteBytes (UseCnt, NetDataType.DWORD);
WriteBytes (ExData, NetDataType.DWORD);
WriteBytes (SelectCount, NetDataType.BYTE);
for (int i = 0; i < SelectCount; i ++) {
diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs
index f72ba4c..2dd50fe 100644
--- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs
+++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs
@@ -7,6 +7,6 @@
{
base.Done(vNetPack);
HA801_tagMCGiveAwardInfo vNetData = vNetPack as HA801_tagMCGiveAwardInfo;
- PackManager.Instance.ReceiveAwardNotify(vNetData);
+ BoxGetItemModel.Instance.ReceiveAwardNotify(vNetData);
}
}
diff --git a/Main/Main.cs b/Main/Main.cs
index e9763c0..a8402d0 100644
--- a/Main/Main.cs
+++ b/Main/Main.cs
@@ -32,6 +32,7 @@
// UIManager.Instance.OpenWindow<LoginWin>();
Debug.Log("鍒囨崲鍒扮櫥褰曞満鏅�");
ConfigManager.Instance.Init();
+ GeneralDefine.Init();
StageManager.Instance.ToLoginScene();
DTC0403_tagPlayerLoginLoadOK.finishedLogin = false;
diff --git a/Main/Manager/UIManager.cs b/Main/Manager/UIManager.cs
index 82cc5eb..dec0ec4 100644
--- a/Main/Manager/UIManager.cs
+++ b/Main/Manager/UIManager.cs
@@ -690,7 +690,14 @@
}
// 娣诲姞鍒癠I鍒楄〃
uiDict[uiName].Add(returnValue);
-
+
+#if UNITY_EDITOR
+ if (uiDict[uiName].Count > 5)
+ {
+ Debug.LogError("宸叉墦寮�" + uiDict[uiName].Count + "涓晫闈�:" + uiName);
+ }
+#endif
+
// 灏哢I娣诲姞鍒版爤涓�
uiStack.Push(returnValue);
diff --git a/Main/System/CustomizedGift/CustomizedRechargeModel.cs b/Main/System/CustomizedGift/CustomizedRechargeModel.cs
index 3aabd1a..ad70ee9 100644
--- a/Main/System/CustomizedGift/CustomizedRechargeModel.cs
+++ b/Main/System/CustomizedGift/CustomizedRechargeModel.cs
@@ -52,7 +52,7 @@
{
int selectID = selectItemInfo[j][selectedItemIndexs[j] - 1];
- items.Add(new Item(CTGSelectItemConfig.Get(selectID).ItemID, CTGSelectItemConfig.Get(selectID).ItemCount));
+ items.Add(new Item(CTGSelectItemConfig.Get(selectID).ItemID, (ulong)CTGSelectItemConfig.Get(selectID).ItemCount));
}
}
else
@@ -143,7 +143,7 @@
if (i < awards.Count)
{
var award = awards[i];
- var itemData = new ItemCellModel(award.id, false, (ulong)award.count);
+ var itemData = new ItemCellModel(award.id, false, (ulong)award.countEx);
itemCells[i].Init(itemData);
itemCells[i].button.SetListener(() =>
{
diff --git a/Main/System/GeneralConfig/GeneralDefine.cs b/Main/System/GeneralConfig/GeneralDefine.cs
index 302a4e9..39b5caf 100644
--- a/Main/System/GeneralConfig/GeneralDefine.cs
+++ b/Main/System/GeneralConfig/GeneralDefine.cs
@@ -146,6 +146,7 @@
public static Dictionary<int, List<int>> DropItemEffectMapID { get; private set; }
public static Dictionary<int, List<int>> itemPutInPackDict { get; private set; }
+ public static Dictionary<int, int> itemMoneyCountDict { get; private set; } //鑳屽寘涓敤浜庡睍绀鸿揣甯佹暟閲忕殑鐗╁搧
public static List<int> RebornAutoFightMapID { get; private set; }
public static string teamWorldCall;
@@ -458,24 +459,26 @@
// checkShowSwitchAccount.Add(item.ToString());
// }
- // var putInItemPack = FuncConfigConfig.Get("PutInItemPack");
- // LitJson.JsonData itemPutInData = LitJson.JsonMapper.ToObject(putInItemPack.Numerical1);
- // itemPutInPackDict = new Dictionary<int, List<int>>();
- // foreach (var _key in itemPutInData.Keys)
- // {
- // var itemTypeData = itemPutInData[_key];
- // int packType = int.Parse(_key);
- // List<int> itemTypes = new List<int>();
- // itemPutInPackDict.Add(packType, itemTypes);
- // if (itemTypeData.IsArray)
- // {
- // for (i = 0; i < itemTypeData.Count; i++)
- // {
- // int itemType = int.Parse(itemTypeData[i].ToString());
- // itemTypes.Add(itemType);
- // }
- // }
- // }
+ var putInItemPack = FuncConfigConfig.Get("PutInItemPack");
+ LitJson.JsonData itemPutInData = LitJson.JsonMapper.ToObject(putInItemPack.Numerical1);
+ itemPutInPackDict = new Dictionary<int, List<int>>();
+ foreach (var _key in itemPutInData.Keys)
+ {
+ var itemTypeData = itemPutInData[_key];
+ int packType = int.Parse(_key);
+ List<int> itemTypes = new List<int>();
+ itemPutInPackDict.Add(packType, itemTypes);
+ if (itemTypeData.IsArray)
+ {
+ for (int i = 0; i < itemTypeData.Count; i++)
+ {
+ int itemType = int.Parse(itemTypeData[i].ToString());
+ itemTypes.Add(itemType);
+ }
+ }
+ }
+
+ itemMoneyCountDict = ConfigParse.ParseIntDict(putInItemPack.Numerical2);
// //鎷惧彇璐甸噸鐗╁搧
// FuncConfigConfig importantItemType = FuncConfigConfig.Get("AutoBuyDrug");
diff --git a/Main/System/ItemTip/BoxGetItemModel.cs b/Main/System/ItemTip/BoxGetItemModel.cs
new file mode 100644
index 0000000..2800b24
--- /dev/null
+++ b/Main/System/ItemTip/BoxGetItemModel.cs
@@ -0,0 +1,538 @@
+锘縰sing System;
+using LitJson;
+
+using System.Collections.Generic;
+
+/// <summary>
+/// 瀹濈鍔熻兘 + 鑾峰彇濂栧姳鐣岄潰
+/// </summary>
+public class BoxGetItemModel : GameSystemManager<BoxGetItemModel>
+{
+
+ List<string> commonShowAwardEvents = new List<string>(); //鑾峰彇濂栧姳鐨勫睍绀轰簨浠�
+
+ public override void Init()
+ {
+ var config = FuncConfigConfig.Get("CommonShowAwards");
+ commonShowAwardEvents = JsonMapper.ToObject<List<string>>(config.Numerical1);
+ }
+
+ // void OnBeforePlayerDataInitialize()
+ // {
+ // getItems = null;
+ // getCoinsType = 0;
+ // getCoinsCnt = 0;
+ // }
+
+ #region 澶勭悊鏈嶅姟鍣ㄦ暟鎹�
+
+ // public BoxGetItemInfo[] getItems { get; private set; }
+ // public int getCoinsType { get; private set; }
+ // public long getCoinsCnt { get; private set; }
+ // public event Action<int, int, BoxGetItemInfo[]> RefreshGetItemAct;
+ // public void SetGetBoxItemInfo(HA810_tagMCNotifyUseItemGetItem boxItemInfo)
+ // {
+ // getItems = JsonMapper.ToObject<BoxGetItemInfo[]>(boxItemInfo.GetItemData);
+ // getCoinsType = boxItemInfo.MoneyType;
+ // getCoinsCnt = boxItemInfo.MoneyCount;
+ // if (!NewBieCenter.Instance.inGuiding)
+ // {
+ // List<Item> items = new List<Item>();
+ // for (int i = 0; i < getItems.Length; i++)
+ // {
+ // BoxGetItemInfo info = getItems[i];
+ // Dictionary<int, List<int>> useDataDic = ConfigParse.Analysis(info.UserData);
+ // if (useDataDic != null && useDataDic.TryGetValue((int)ItemUseDataKey.itemCount, out List<int> list) && list != null && list.Count > 0)
+ // {
+ // int count = list[0];
+ // items.Add(new Item(info.ItemID, count));
+ // }
+ // else
+ // {
+ // items.Add(new Item(info.ItemID, info.Count));
+ // }
+
+ // }
+ // ItemLogicUtility.Instance.ShowGetItem(items, seconds: 0);
+ // }
+
+ // if (RefreshGetItemAct != null)
+ // {
+ // RefreshGetItemAct((int)boxItemInfo.UseItemID, (int)boxItemInfo.UseCount, getItems);
+ // }
+
+
+ // }
+
+ //鑾峰緱濂栧姳灞曠ず
+ public void ReceiveAwardNotify(HA801_tagMCGiveAwardInfo netPack)
+ {
+ var eventName = UIHelper.ServerStringTrim(netPack.EventName);
+
+ // 浠欑洘鏀诲煄鎴�
+ // if (eventName == "FamilyGCZSQGrid" || eventName == "FamilyGCZSQPass" || eventName == "FamilyGCZSQPassAll" ||
+ // eventName == "FamilyGCZContiribution" || eventName == "FamilyGCZAtk")
+ // {
+ // ModelCenter.Instance.GetModel<FairySiegeActModel>()?.OnUpdateAwardInfoAction(netPack);
+ // return;
+ // }
+ if (!commonShowAwardEvents.Contains(eventName))
+ return;
+
+ List<Item> showItems = new List<Item>();
+
+ if (netPack.Exp != 0 || netPack.ExpPoint != 0)
+ {
+ ulong expValue = netPack.Exp + netPack.ExpPoint * (ulong)Constants.ExpPointValue;
+ showItems.Add(new Item(GeneralDefine.expDisplayId, expValue));
+ }
+ if (netPack.MoneyList.Length != 0)
+ {
+ for (int i = 0; i < netPack.MoneyLen; i++)
+ {
+ var moneyType = netPack.MoneyList[i].MoneyType;
+ if (GeneralDefine.moneyDisplayIds.ContainsKey(moneyType) && netPack.MoneyList[i].MoneyValue != 0)
+ {
+ showItems.Add(new Item(GeneralDefine.moneyDisplayIds[moneyType], netPack.MoneyList[i].MoneyValue));
+ }
+
+ }
+ }
+
+ if (netPack.ItemList.Length != 0)
+ {
+ for (int i = 0; i < netPack.ItemLen; i++)
+ {
+ showItems.Add(new Item((int)netPack.ItemList[i].ItemID, netPack.ItemList[i].Count, netPack.ItemList[i].IsBind));
+ }
+ }
+
+
+ string info = string.Empty;
+ if (LanguageConfig.HasKey("commonShowAwardEvents_" + eventName))
+ info = Language.Get("commonShowAwardEvents_" + eventName);
+
+ if (showItems.Count == 0)
+ return;
+
+ ItemLogicUtility.Instance.ShowGetItem(showItems, eventName);
+ }
+
+ // public int GetUseCntByID(int itemId)
+ // {
+ // return PackManager.Instance.GetItemUsedTimesToday(itemId);
+ // }
+
+ #endregion
+
+ // #region 娑堣�楁潗鏂欒揣甯佸紑鍚殑瀹濈
+ // public void SetModel(string guid, int itemId)
+ // {
+ // ChestsConfig chestsConfig = ChestsConfig.Get(itemId);
+ // this.guid = guid;
+ // this.itemId = itemId;
+ // if (guid == "" || chestsConfig == null) return;
+
+ // ItemConfig boxConfig = ItemConfig.Get(itemId);
+ // if (PlayerDatas.Instance.baseData.LV < boxConfig.UseLV)
+ // {
+ // ServerTipDetails.DisplayNormalTip(Language.Get("MakeUseItem101", boxConfig.UseLV));
+ // return;
+ // }
+
+ // CheckOpenBoxCondi(guid, itemId);
+ // }
+
+ // public void CheckOpenBoxCondi(string guid, int itemId, int useCnt = 1)
+ // {
+ // ChestsConfig chestsConfig = ChestsConfig.Get(itemId);
+ // if (chestsConfig == null) return;
+
+ // ItemConfig boxConfig = ItemConfig.Get(itemId);
+
+ // if (chestsConfig.ExpendItemID != 0)
+ // {
+ // ItemConfig itemConfig = ItemConfig.Get(chestsConfig.ExpendItemID);
+ // ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("OpenBoxTool", itemConfig.ItemName), (bool isOk) =>
+ // {
+ // if (isOk)
+ // {
+ // if (!IsEnoughTools(chestsConfig.ExpendItemID, chestsConfig.ExpendCount * useCnt))
+ // {
+ // SysNotifyMgr.Instance.ShowTip("OpenBoxToolNoEnough", itemConfig.ItemName);
+ // return;
+ // }
+ // else
+ // {
+ // CheckOpenMoney(chestsConfig, boxConfig, useCnt);
+ // }
+ // }
+ // });
+ // }
+ // else
+ // {
+ // CheckOpenMoney(chestsConfig, boxConfig, useCnt);
+ // }
+ // }
+
+ // public void CheckOpenMoney(ChestsConfig chestsConfig, ItemConfig boxConfig, int useCnt)
+ // {
+ // if (!IsEnoughMoney(chestsConfig.OpenMoney * useCnt))
+ // {
+ // SysNotifyMgr.Instance.ShowTip("BoxOpenCostMoney", 1);
+ // return;
+ // }
+ // else
+ // {
+ // if (chestsConfig.OpenMoney > 0)
+ // {
+ // ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("OpenBoxGold", chestsConfig.OpenMoney * useCnt), (bool isOk) =>
+ // {
+ // if (isOk)
+ // {
+ // CheckOtherCondi(chestsConfig, boxConfig, useCnt);
+ // }
+ // });
+ // }
+ // else
+ // {
+ // CheckOtherCondi(chestsConfig, boxConfig, useCnt);
+ // }
+ // }
+ // }
+
+ // public void CheckOtherCondi(ChestsConfig chestsConfig, ItemConfig boxConfig, int useCnt)
+ // {
+
+ // if (boxConfig.MaxSkillCnt > 0 && GetUseCntByID(itemId) >= boxConfig.MaxSkillCnt)
+ // {
+ // SysNotifyMgr.Instance.ShowTip("UseCntLimit");
+ // return;
+ // }
+
+ // if (IsSelectItemByID(itemId))
+ // {
+ // UIManager.Instance.OpenWindow<ChooseItemsWin>();
+ // return;
+ // }
+
+ // ItemLogicUtility.Instance.UseItem(guid, useCnt);
+ // }
+
+ // public bool CheckOpenBoxCondition(int itemId, out bool isBox)
+ // {
+ // isBox = false;
+ // ChestsConfig chestsConfig = ChestsConfig.Get(itemId);
+ // if (chestsConfig == null) return false;
+
+ // isBox = true;
+ // bool isCanOpen = true;
+ // ItemConfig boxConfig = ItemConfig.Get(itemId);
+ // if (PlayerDatas.Instance.baseData.LV < boxConfig.UseLV)
+ // {
+ // isCanOpen = false;
+ // return isCanOpen;
+ // }
+
+ // if (chestsConfig.ExpendItemID != 0)
+ // {
+ // ItemConfig itemConfig = ItemConfig.Get(chestsConfig.ExpendItemID);
+ // if (!IsEnoughTools(chestsConfig.ExpendItemID, chestsConfig.ExpendCount))
+ // {
+ // isCanOpen = false;
+ // return isCanOpen;
+ // }
+ // }
+
+ // if (!IsEnoughMoney(chestsConfig.OpenMoney))
+ // {
+ // isCanOpen = false;
+ // return isCanOpen;
+ // }
+
+ // if (boxConfig.MaxSkillCnt > 0 && GetUseCntByID(itemId) >= boxConfig.MaxSkillCnt)
+ // {
+ // isCanOpen = false;
+ // return isCanOpen;
+ // }
+
+ // return isCanOpen;
+ // }
+
+ // private bool IsEnoughMoney(int moneyCnt)
+ // {
+ // ulong haveMoney = UIHelper.GetMoneyCnt(1);
+ // if (haveMoney >= (ulong)moneyCnt)
+ // {
+ // return true;
+ // }
+ // else
+ // {
+ // return false;
+ // }
+ // }
+
+ // private bool IsEnoughTools(int itemId, int toolCnt)
+ // {
+ // int count = PackManager.Instance.GetItemCountByID(PackType.Item, itemId);
+ // if (count >= toolCnt)
+ // {
+ // return true;
+ // }
+ // else
+ // {
+ // return false;
+ // }
+ // }
+ // #endregion
+
+ //瀹濈棰勮鐗╁搧 (闅忔満鑾峰緱)
+ public List<Item> GetBoxItems(int boxID)
+ {
+ List<Item> itemIDs = new List<Item>();
+
+ if (ChestsAwardConfig.GetBoxType(boxID) == 0)
+ {
+ return itemIDs;
+ }
+
+ var config = ChestsAwardConfig.GetChestsAwardByID(boxID);
+
+ if (!string.IsNullOrEmpty(config.SelectList))
+ {
+ var selectlistDict = ConfigParse.GetDic<int, int>(config.SelectList);
+ foreach (var item in selectlistDict)
+ {
+ itemIDs.Add(new Item(item.Key, (ulong)item.Value));
+ }
+ }
+
+ if (!string.IsNullOrEmpty(config.FixedItem))
+ {
+ var itemListDict = ConfigParse.GetDic<int, int>(config.FixedItem);
+ foreach (var item in itemListDict)
+ {
+ itemIDs.Add(new Item(item.Key, (ulong)item.Value));
+ }
+ }
+
+ if (!string.IsNullOrEmpty(config.Probability1))
+ {
+ var arr = JsonMapper.ToObject(config.Probability1);
+
+ for (int i = 0; i < arr.Count; i++)
+ {
+ itemIDs.Add(new Item(int.Parse(arr[i][1][0].ToString()), ulong.Parse(arr[i][1][1].ToString())));
+ }
+ }
+
+ if (!string.IsNullOrEmpty(config.Probability2))
+ {
+ var arr = JsonMapper.ToObject(config.Probability2);
+
+ for (int i = 0; i < arr.Count; i++)
+ {
+ itemIDs.Add(new Item(int.Parse(arr[i][1][0].ToString()), ulong.Parse(arr[i][1][1].ToString())));
+ }
+ }
+
+ return itemIDs;
+ }
+
+
+
+ #region 鑷�夌墿鍝佸疂绠�
+
+ //<鐗╁搧ID锛屾暟閲�> 鐢ㄦ埛閫変腑鐗╁搧瀛楀吀
+ public Dictionary<int, ChooseItems> userChooseItemDict = new Dictionary<int, ChooseItems>();
+ public Action countChangeAction; //鏁伴噺鍙戠敓鍙樺寲
+
+ public bool IsSelectItemByID(int boxId)
+ {
+ ChestsAwardConfig awardConfig = ChestsAwardConfig.GetChestsAwardByID(boxId);
+ if (string.IsNullOrEmpty(awardConfig.SelectList))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public int[][] GetSelectItemsByID(int boxId)
+ {
+ ChestsAwardConfig awardConfig = ChestsAwardConfig.GetChestsAwardByID(boxId);
+ if (string.IsNullOrEmpty(awardConfig.SelectList))
+ {
+ return null;
+ }
+ var arr = ConfigParse.GetArray2<int>(awardConfig.SelectList);
+ Array.Sort(arr, SortShowItem);
+ return arr;
+ }
+
+ int SortShowItem(int[] a, int[] b)
+ {
+ var itemConfig1 = ItemConfig.Get(a[0]);
+ var itemConfig2 = ItemConfig.Get(b[0]);
+ int quality1 = itemConfig1.ItemColor;
+ int quality2 = itemConfig2.ItemColor;
+ //鍝佽川楂樼殑鎺掑湪鍓嶉潰
+ if (quality1 != quality2)
+ return quality2.CompareTo(quality1);
+ return itemConfig1.ID - itemConfig2.ID;
+ }
+
+ /// <summary>
+ /// 閫夋嫨鑷�夌墿鍝佹暟閲�
+ /// </summary>
+ /// <param name="itemId">琚�夋嫨鐗╁搧鐨処D</param>
+ /// <param name="guid">瀹濈鐨凣UID</param>
+ /// <param name="extra"></param>
+ /// <param name="changeCnt">鍔犲噺鏁伴噺</param>
+ public void IncreaseUserChooseItemCount(int itemId, string guid, int extra, int changeCnt)
+ {
+ if (userChooseItemDict.ContainsKey(itemId))
+ {
+ userChooseItemDict[itemId].guid = guid;
+ userChooseItemDict[itemId].useCnt = userChooseItemDict[itemId].useCnt + changeCnt;
+ userChooseItemDict[itemId].extra = extra;
+ }
+ else
+ {
+ userChooseItemDict[itemId] = new ChooseItems() { guid = guid, useCnt = 1, extra = extra };
+ }
+ countChangeAction?.Invoke();
+ }
+
+
+ //褰撳墠閫夋嫨鏉愭枡鎬绘暟閲�
+ public int GetNowChooseItemCount()
+ {
+ int total = 0;
+ if (userChooseItemDict == null && userChooseItemDict.Count == 0)
+ return 0;
+ List<int> list = new List<int>(userChooseItemDict.Keys);
+ for (int i = 0; i < list.Count; i++)
+ total += userChooseItemDict[list[i]].useCnt;
+ return total;
+ }
+
+
+
+ public bool TrySendUse()
+ {
+ CA323_tagCMUseItems.tagCMUseItemsSelect[] chooseItemList = GetSendList(userChooseItemDict, out List<ChooseItems> resultChooseItemDict, out string guid, out int count);
+ //涓�涓潗鏂欎篃娌¢��
+ if (chooseItemList.Length < 1)
+ {
+ SysNotifyMgr.Instance.ShowTip("ChooseItems01");
+ return false;
+ }
+
+ var itemModel = PackManager.Instance.GetItemByGuid(guid);
+ if (itemModel == null)
+ return false;
+
+ for (int i = 0; i < resultChooseItemDict.Count; i++)
+ {
+ var item = PackManager.Instance.GetItemByGuid(resultChooseItemDict[i].guid);
+ if (item == null)
+ return false;
+
+ var error = 0;
+ if (!ItemLogicUtility.Instance.CanUseItem(resultChooseItemDict[i].guid, resultChooseItemDict[i].useCnt, out error))
+ {
+ switch (error)
+ {
+ case 1:
+ SysNotifyMgr.Instance.ShowTip("EverydayUseLimit");
+ break;
+ case 2:
+ SysNotifyMgr.Instance.ShowTip("UseCntLimit");
+ break;
+ case 3:
+ SysNotifyMgr.Instance.ShowTip("GeRen_chenxin_749572");
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+ }
+
+ var useItem = new CA323_tagCMUseItems();
+ useItem.ItemIndex = (byte)itemModel.gridIndex;
+ useItem.UseCnt = (ushort)count;
+ useItem.ExData = (uint)0;
+ useItem.SelectCount = (byte)chooseItemList.Length;
+ useItem.SelectList = chooseItemList;
+ GameNetSystem.Instance.SendInfo(useItem);
+ return true;
+ }
+
+
+
+ CA323_tagCMUseItems.tagCMUseItemsSelect[] GetSendList(Dictionary<int, ChooseItems> userChooseItemDict, out List<ChooseItems> resultChooseItemDict, out string guid, out int count)
+ {
+ guid = string.Empty;
+ count = 0;
+ resultChooseItemDict = new List<ChooseItems> { };
+ List<int> list = new List<int>(userChooseItemDict.Keys);
+ List<ChooseItems> result = new List<ChooseItems>();
+ for (int i = 0; i < list.Count; i++)
+ {
+ int itemId = list[i];
+ ChooseItems chooseItems = userChooseItemDict[itemId];
+ if (!ItemConfig.HasKey(itemId))
+ continue;
+ if (chooseItems == null || chooseItems.useCnt <= 0)
+ continue;
+ count += chooseItems.useCnt;
+ result.Add(chooseItems);
+ }
+ resultChooseItemDict = result;
+ if (!result.IsNullOrEmpty())
+ guid = result[0].guid;
+
+ List<CA323_tagCMUseItems.tagCMUseItemsSelect> tagCMUseItemsSelects = new List<CA323_tagCMUseItems.tagCMUseItemsSelect>();
+ for (int i = 0; i < result.Count; i++)
+ {
+ CA323_tagCMUseItems.tagCMUseItemsSelect temp = new CA323_tagCMUseItems.tagCMUseItemsSelect();
+ temp.SelectID = (uint)result[i].extra;
+ temp.SelectCnt = (ushort)result[i].useCnt;
+ tagCMUseItemsSelects.Add(temp);
+ }
+
+ return tagCMUseItemsSelects.ToArray();
+ }
+
+ public void ClearAll()
+ {
+ userChooseItemDict.Clear();
+ }
+
+
+
+
+
+ #endregion
+
+
+
+}
+
+
+public class BoxGetItemInfo
+{
+ public int ItemID;
+ public int Count;
+ public int IsBind;
+ public int IsSuite;
+ public string UserData;
+}
+
+public class ChooseItems
+{
+ public string guid;
+ public int useCnt;
+ public int extra;
+}
\ No newline at end of file
diff --git a/Main/Component/UI/Core/DelayButton.cs.meta b/Main/System/ItemTip/BoxGetItemModel.cs.meta
similarity index 68%
copy from Main/Component/UI/Core/DelayButton.cs.meta
copy to Main/System/ItemTip/BoxGetItemModel.cs.meta
index 3596531..a968b07 100644
--- a/Main/Component/UI/Core/DelayButton.cs.meta
+++ b/Main/System/ItemTip/BoxGetItemModel.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: f91c143a16d59de4b80b2b0ffbb455e4
-timeCreated: 1501494723
-licenseType: Free
+guid: 2eb8c13a1ade0ce458b63f0ca368758c
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/ItemTip/BoxItemCell.cs b/Main/System/ItemTip/BoxItemCell.cs
new file mode 100644
index 0000000..0ea87f4
--- /dev/null
+++ b/Main/System/ItemTip/BoxItemCell.cs
@@ -0,0 +1,20 @@
+锘縰sing UnityEngine;
+using UnityEngine.UI;
+
+public class BoxItemCell : MonoBehaviour
+{
+ [SerializeField] ItemCell itemCell;
+ [SerializeField] Text nameText;
+
+ public void Display(Item item)
+ {
+ int itemID = item.id;
+ itemCell.Init(new ItemCellModel(itemID, false, item.countEx));
+ itemCell.button.AddListener(()=>
+ {
+ ItemTipUtility.Show(itemID);
+ });
+ nameText.text = ItemConfig.Get(itemID).ItemName;
+ }
+}
+
diff --git a/Main/Component/UI/Core/DelayButton.cs.meta b/Main/System/ItemTip/BoxItemCell.cs.meta
similarity index 68%
copy from Main/Component/UI/Core/DelayButton.cs.meta
copy to Main/System/ItemTip/BoxItemCell.cs.meta
index 3596531..d5ec9e6 100644
--- a/Main/Component/UI/Core/DelayButton.cs.meta
+++ b/Main/System/ItemTip/BoxItemCell.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: f91c143a16d59de4b80b2b0ffbb455e4
-timeCreated: 1501494723
-licenseType: Free
+guid: bb169f4e43327164c8aa0a1cfeecdad1
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/ItemTip/BoxItemLineCell.cs b/Main/System/ItemTip/BoxItemLineCell.cs
new file mode 100644
index 0000000..8da4d91
--- /dev/null
+++ b/Main/System/ItemTip/BoxItemLineCell.cs
@@ -0,0 +1,25 @@
+锘縰sing System.Collections.Generic;
+using LitJson;
+using UnityEngine;
+
+public class BoxItemLineCell : CellView
+{
+ [SerializeField] BoxItemCell[] itemList;
+
+ public void Display(List<Item> list)
+ {
+ for (int i = 0; i < itemList.Length; i++)
+ {
+ if (i < list.Count)
+ {
+ itemList[i].SetActive(true);
+ itemList[i].Display(list[i]);
+ }
+ else
+ {
+ itemList[i].SetActive(false);
+ }
+ }
+ }
+}
+
diff --git a/Main/Component/UI/Core/DelayButton.cs.meta b/Main/System/ItemTip/BoxItemLineCell.cs.meta
similarity index 68%
copy from Main/Component/UI/Core/DelayButton.cs.meta
copy to Main/System/ItemTip/BoxItemLineCell.cs.meta
index 3596531..e9e3d06 100644
--- a/Main/Component/UI/Core/DelayButton.cs.meta
+++ b/Main/System/ItemTip/BoxItemLineCell.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: f91c143a16d59de4b80b2b0ffbb455e4
-timeCreated: 1501494723
-licenseType: Free
+guid: a4e421d1b43c43741a77780e74104218
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/ItemTip/BoxItemWin.cs b/Main/System/ItemTip/BoxItemWin.cs
new file mode 100644
index 0000000..f4a4c2f
--- /dev/null
+++ b/Main/System/ItemTip/BoxItemWin.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using LitJson;
+using UnityEngine;
+using UnityEngine.UI;
+
+/// <summary>
+/// 闅忔満瀹濈:鍖哄垎鏄湡鐗╁搧锛岃繕鏄瑙�
+/// 鏀寔鍚屾椂鎵撳紑澶氫釜鐣岄潰
+/// </summary>
+public class BoxItemWin : UIBase
+{
+
+ [SerializeField] ItemCell itemCell;
+ [SerializeField] Text nameText;
+ [SerializeField] Text descText;
+ [SerializeField] ScrollerController scroller;
+ [SerializeField] SliderPanel sliderPanel;
+ [SerializeField] Button openButton;
+
+ [SerializeField] CellView _InitCell;
+
+ string guid;
+ int itemID;
+ int itemCount;
+ int useCnt;
+ List<Item> items;
+ protected override void InitComponent()
+ {
+ openButton.AddListener(() =>
+ {
+ ItemLogicUtility.Instance.UseItem(guid, useCnt);
+ });
+ }
+
+ protected override void Start()
+ {
+ _InitCell.cellIdentifier = _InitCell.cellIdentifier + this.GetInstanceID().ToString();
+ }
+
+
+ protected override void OnPreOpen()
+ {
+ itemID = ItemTipUtility.mainTipData.baseInfo.itemId;
+ itemCount = ItemTipUtility.mainTipData.baseInfo.count;
+ guid = ItemTipUtility.mainTipData.guid;
+
+ itemCell.Init(new ItemCellModel(itemID, false, (ulong)itemCount));
+ var itemConfig = ItemConfig.Get(itemID);
+ nameText.text = itemConfig.ItemName;
+ descText.text = itemConfig.Description;
+
+ if (string.IsNullOrEmpty(guid))
+ {
+ openButton.SetActive(false);
+ sliderPanel.SetActive(false);
+ }
+ else
+ {
+ openButton.SetActive(true);
+ sliderPanel.SetActive(true);
+ }
+
+ sliderPanel.Init((value) => { useCnt = value; }, itemCount);
+
+
+ scroller.OnRefreshCell += OnRefreshCell;
+ items = BoxGetItemModel.Instance.GetBoxItems(itemID);
+ CreateScroller();
+ }
+
+ protected override void OnPreClose()
+ {
+ scroller.OnRefreshCell -= OnRefreshCell;
+ }
+
+ void CreateScroller()
+ {
+ scroller.Refresh();
+
+ for (int i = 0; i < items.Count; i++)
+ {
+ if (i % 4 == 0)
+ {
+ List<Item> tmpIDs = new List<Item>();
+ for (int j = 0; j < 4; j++)
+ {
+ int index = i + j;
+ if (index >= items.Count)
+ break;
+ tmpIDs.Add(items[index]);
+ }
+ scroller.AddCell(ScrollerDataType.Header, i);
+ }
+ }
+ scroller.Restart();
+ }
+
+
+ void OnRefreshCell(ScrollerDataType type, CellView cell)
+ {
+ var _cell = cell as BoxItemLineCell;
+
+ List<Item> tmpIDs = new List<Item>();
+ for (int j = 0; j < 4; j++)
+ {
+ int index = cell.index + j;
+ if (index >= items.Count)
+ break;
+ tmpIDs.Add(items[index]);
+ }
+
+ _cell.Display(tmpIDs);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/Main/Component/UI/Core/DelayButton.cs.meta b/Main/System/ItemTip/BoxItemWin.cs.meta
similarity index 68%
copy from Main/Component/UI/Core/DelayButton.cs.meta
copy to Main/System/ItemTip/BoxItemWin.cs.meta
index 3596531..7226575 100644
--- a/Main/Component/UI/Core/DelayButton.cs.meta
+++ b/Main/System/ItemTip/BoxItemWin.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: f91c143a16d59de4b80b2b0ffbb455e4
-timeCreated: 1501494723
-licenseType: Free
+guid: b86f5d8b940c1c34cabe4876cd7993be
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/ItemTip/ChooseItemsCell.cs b/Main/System/ItemTip/ChooseItemsCell.cs
new file mode 100644
index 0000000..189b175
--- /dev/null
+++ b/Main/System/ItemTip/ChooseItemsCell.cs
@@ -0,0 +1,79 @@
+锘縰sing System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+public class ChooseItemsCell : CellView
+{
+ [SerializeField] ItemCell itemCell;
+ [SerializeField] TextEx txtItemName;
+ [SerializeField] TextEx txtNumber;
+ [SerializeField] LongPressButton btnReduce;
+ [SerializeField] LongPressButton btnPlus;
+ [SerializeField] Transform numForm;
+
+ int itemId;
+ string guid;
+
+ public void Display(int[] itemArr, string _guid )
+ {
+ this.itemId = itemArr[0];
+ this.guid = _guid;
+ ItemConfig itemConfig = ItemConfig.Get(itemId);
+ int count = itemArr[1];
+ itemCell.Init(new ItemCellModel(itemId, false, (ulong)count));
+ itemCell.button.SetListener(() =>
+ {
+ ItemTipUtility.Show(itemId);
+ });
+ txtItemName.text = itemConfig.ItemName;
+ txtNumber.text = BoxGetItemModel.Instance.userChooseItemDict.ContainsKey(itemId) ? BoxGetItemModel.Instance.userChooseItemDict[itemId].useCnt.ToString() : "0";
+
+ if (string.IsNullOrEmpty(guid))
+ {
+ numForm.SetActive(false);
+ }
+ else
+ {
+ numForm.SetActive(true);
+ btnPlus.onPress.RemoveAllListeners();
+ btnPlus.SetListener(OnClickPlus);
+ btnPlus.onPress.AddListener(OnClickPlus);
+ btnReduce.onPress.RemoveAllListeners();
+ btnReduce.SetListener(OnClickReduce);
+ btnReduce.onPress.AddListener(OnClickReduce);
+ }
+ }
+
+ void OnClickPlus()
+ {
+ ItemModel itemModel = PackManager.Instance.GetItemByGuid(guid);
+ if (itemModel == null)
+ return;
+
+ if (BoxGetItemModel.Instance.GetNowChooseItemCount() >= itemModel.count)
+ return;
+ BoxGetItemModel.Instance.IncreaseUserChooseItemCount(itemId, itemModel.guid, itemId, 1);
+ txtNumber.text = BoxGetItemModel.Instance.userChooseItemDict.ContainsKey(itemId) ? BoxGetItemModel.Instance.userChooseItemDict[itemId].useCnt.ToString() : "0";
+
+ }
+
+ void OnClickReduce()
+ {
+ ItemModel itemModel = PackManager.Instance.GetItemByGuid(guid);
+ if (itemModel == null)
+ return;
+ if (!BoxGetItemModel.Instance.userChooseItemDict.ContainsKey(itemId))
+ return;
+ if (BoxGetItemModel.Instance.userChooseItemDict[itemId].useCnt <= 0)
+ return;
+ BoxGetItemModel.Instance.IncreaseUserChooseItemCount(itemId, itemModel.guid, itemId, -1);
+ txtNumber.text = BoxGetItemModel.Instance.userChooseItemDict.ContainsKey(itemId) ? BoxGetItemModel.Instance.userChooseItemDict[itemId].useCnt.ToString() : "0";
+
+ }
+
+}
+
+
+
+
+
diff --git a/Main/Component/UI/Core/DelayButton.cs.meta b/Main/System/ItemTip/ChooseItemsCell.cs.meta
similarity index 68%
rename from Main/Component/UI/Core/DelayButton.cs.meta
rename to Main/System/ItemTip/ChooseItemsCell.cs.meta
index 3596531..a94d2b8 100644
--- a/Main/Component/UI/Core/DelayButton.cs.meta
+++ b/Main/System/ItemTip/ChooseItemsCell.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: f91c143a16d59de4b80b2b0ffbb455e4
-timeCreated: 1501494723
-licenseType: Free
+guid: 7eacdda8b7c863e48b2ae4acd2027167
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/ItemTip/ChooseItemsWin.cs b/Main/System/ItemTip/ChooseItemsWin.cs
new file mode 100644
index 0000000..942ef49
--- /dev/null
+++ b/Main/System/ItemTip/ChooseItemsWin.cs
@@ -0,0 +1,109 @@
+锘縰sing System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class ChooseItemsWin : UIBase
+{
+ [SerializeField] ItemCell itemCell;
+ [SerializeField] Text nameText;
+ [SerializeField] Text descText;
+ [SerializeField] ScrollerController scroller;
+ [SerializeField] Button openButton;
+ [SerializeField] Text txtChooseNum;
+ [SerializeField] CellView _InitCell;
+
+ string guid;
+ int itemID;
+ int itemCount;
+ int[][] selectArray;
+ protected override void InitComponent()
+ {
+ openButton.AddListener(() =>
+ {
+ BoxGetItemModel.Instance.TrySendUse();
+ });
+ }
+
+ protected override void Start()
+ {
+ _InitCell.cellIdentifier = _InitCell.cellIdentifier + this.GetInstanceID().ToString();
+ }
+
+
+ protected override void OnPreOpen()
+ {
+ BoxGetItemModel.Instance.countChangeAction += OnCountChangeAction;
+ scroller.OnRefreshCell += OnRefreshCell;
+ itemID = ItemTipUtility.mainTipData.baseInfo.itemId;
+ itemCount = ItemTipUtility.mainTipData.baseInfo.count;
+ guid = ItemTipUtility.mainTipData.guid;
+ InitItemsData();
+
+ itemCell.Init(new ItemCellModel(itemID, false, (ulong)itemCount));
+ var itemConfig = ItemConfig.Get(itemID);
+ nameText.text = itemConfig.ItemName;
+ descText.text = itemConfig.Description;
+
+ if (string.IsNullOrEmpty(guid))
+ {
+ //棰勮
+ openButton.SetActive(false);
+ }
+ else
+ {
+ BoxGetItemModel.Instance.ClearAll();
+ openButton.SetActive(true);
+ }
+
+ int nowChooseItemCount = BoxGetItemModel.Instance.GetNowChooseItemCount();
+ txtChooseNum.text = Language.Get("L1100", Language.Get("L1107"),
+ UIHelper.AppendColor(TextColType.DarkGreen, $"{nowChooseItemCount}/{itemCount}"));
+
+ CreateScroller();
+ }
+
+ protected override void OnPreClose()
+ {
+ scroller.OnRefreshCell -= OnRefreshCell;
+ }
+
+ void CreateScroller()
+ {
+ scroller.Refresh();
+ for (int i = 0; i < selectArray.Length; i++)
+ {
+ scroller.AddCell(ScrollerDataType.Header, i);
+ }
+ scroller.Restart();
+ }
+
+
+ void OnRefreshCell(ScrollerDataType type, CellView cell)
+ {
+
+ var _cell = cell as ChooseItemsCell;
+ _cell.Display(selectArray[cell.index], guid);
+ }
+
+
+
+ void InitItemsData()
+ {
+ selectArray = BoxGetItemModel.Instance.GetSelectItemsByID(itemID);
+ }
+
+
+
+ private void OnCountChangeAction()
+ {
+ int nowChooseItemCount = BoxGetItemModel.Instance.GetNowChooseItemCount();
+ txtChooseNum.text = Language.Get("L1100", Language.Get("L1107"),
+ UIHelper.AppendColor(TextColType.DarkGreen, $"{nowChooseItemCount}/{itemCount}"));
+ }
+
+
+
+}
+
+
diff --git a/Main/Component/UI/Core/DelayButton.cs.meta b/Main/System/ItemTip/ChooseItemsWin.cs.meta
similarity index 68%
copy from Main/Component/UI/Core/DelayButton.cs.meta
copy to Main/System/ItemTip/ChooseItemsWin.cs.meta
index 3596531..fe1436b 100644
--- a/Main/Component/UI/Core/DelayButton.cs.meta
+++ b/Main/System/ItemTip/ChooseItemsWin.cs.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
-guid: f91c143a16d59de4b80b2b0ffbb455e4
-timeCreated: 1501494723
-licenseType: Free
+guid: 80c2b6d2ef0dcfb46b0971eddae69ab7
MonoImporter:
+ externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
diff --git a/Main/System/ItemTip/ItemTipUtility.cs b/Main/System/ItemTip/ItemTipUtility.cs
index f5a71c6..2fab85d 100644
--- a/Main/System/ItemTip/ItemTipUtility.cs
+++ b/Main/System/ItemTip/ItemTipUtility.cs
@@ -7,6 +7,7 @@
using UnityEngine.UI;
using System.Collections.Generic;
using System.Linq;
+using LitJson;
public class ItemTipUtility
{
@@ -14,14 +15,9 @@
{
Item,
Equip,
- Dogz,
- GatherSoul, //搴熷純
- KingTreasure, //鐜嬭�呮硶瀹漷ip
PetMount,
- SpiritWeapon,
- PeerlessChest,
- TreasureShow, //鍏朵粬娉曞疂tip
- BoxItem, //瀹濈鐗╁搧
+ BoxItem, //瀹濈闅忔満鐗╁搧
+ BoxChooseItem, //瀹濈鑷�夌墿鍝�
TreasurePavilion, //鍙ゅ疂鐗╁搧锛堢鐗囷級
}
@@ -30,7 +26,7 @@
public string guid;
public int itemId;
public int goodId;
- public int exchangeItemId;
+ public int exchangeItemId; //閮ㄥ垎鐣岄潰瑕佸姩鎬佸彉鍖栫墿鍝佺殑鎯呭喌
public BaseInfo baseInfo;
public BaseProperty baseProperty;
@@ -224,7 +220,7 @@
// static ItemOverdueModel itemOverdueModel { get { return ModelCenter.Instance.GetModel<ItemOverdueModel>(); } }
// static BoxGetItemModel boxGetItemModel { get { return ModelCenter.Instance.GetModel<BoxGetItemModel>(); } }
- public static TipData mainTipData { get; private set; }
+ public static TipData mainTipData { get; private set; } // 娉ㄦ剰褰撻�掕繘鐐瑰嚮鎵撳紑澶氫釜tip鐣岄潰浼氬彉鏇存暟鎹紝涓嶈兘渚濊禆姝ゅ��
public static TipData secondaryData { get; private set; }
public static void Show(int itemId)
@@ -252,99 +248,64 @@
// secondaryData = null;
- // var config = ItemConfig.Get(itemId);
- // PrintItemBrief(itemId);
+ var config = ItemConfig.Get(itemId);
+ PrintItemBrief(itemId);
- // var tipType = GetTipType(itemId);
- // switch (tipType)
- // {
- // case TipType.Equip:
- // mainTipData = CreateNormalEquipData(itemId);
- // if (item.isAuctionEquip && !item.legendProperty.Equals(default(LegendProperty)))
- // {
- // mainTipData.legendProperty = item.legendProperty;
- // mainTipData.baseInfo.score = item.score;
- // mainTipData.baseInfo.isPreview = false;
- // }
+ var tipType = GetTipType(itemId);
+ switch (tipType)
+ {
+ case TipType.Equip:
+ // mainTipData = CreateNormalEquipData(itemId);
+ // if (item.isAuctionEquip && !item.legendProperty.Equals(default(LegendProperty)))
+ // {
+ // mainTipData.legendProperty = item.legendProperty;
+ // mainTipData.baseInfo.score = item.score;
+ // mainTipData.baseInfo.isPreview = false;
+ // }
- // if (item.compare)
- // {
- // if (ItemLogicUtility.Instance.IsJobCompatibleItem(itemId))
- // {
- // var equipedGuid = equipModel.GetEquip(new Int2(config.LV, config.EquipPlace));
- // if (equipedGuid != string.Empty)
- // {
- // secondaryData = CreateNormalEquipData(equipedGuid, false);
- // }
- // }
- // }
- // break;
- // case TipType.Dogz:
- // mainTipData = CreateDogzEquipData(itemId);
- // break;
- // case TipType.PeerlessChest:
- // mainTipData = CreateItemData(itemId);
- // mainTipData.getWay = default(GetWay);
- // Dictionary<int, int> selectItems;
- // if (boxGetItemModel.IsSelectItemByID(itemId, out selectItems))
- // {
- // secondaryData = CreateNormalEquipData(selectItems.Keys.First());
- // secondaryData.getWay = default(GetWay);
- // }
- // break;
- // default:
- // mainTipData = CreateItemData(itemId);
- // break;
- // }
+ // if (item.compare)
+ // {
+ // if (ItemLogicUtility.Instance.IsJobCompatibleItem(itemId))
+ // {
+ // var equipedGuid = equipModel.GetEquip(new Int2(config.LV, config.EquipPlace));
+ // if (equipedGuid != string.Empty)
+ // {
+ // secondaryData = CreateNormalEquipData(equipedGuid, false);
+ // }
+ // }
+ // }
+ break;
+ default:
+ mainTipData = CreateItemData(itemId);
+ break;
+ }
- // mainTipData.getWay.defaultUnfold = item.unfoldGetWay;
- // switch (tipType)
- // {
- // case TipType.Equip:
- // WindowCenter.Instance.Open<EquipTipWin>();
- // break;
- // case TipType.Dogz:
- // WindowCenter.Instance.Open<EquipTipWin>();
- // break;
- // case TipType.KingTreasure:
- // var kingTreasureShow = ModelCenter.Instance.GetModel<KingTreasureShowModel>();
- // kingTreasureShow.SetInitData(itemId);
- // break;
- // case TipType.PetMount:
- // WindowCenter.Instance.Open<PetMountTipWin>();
- // break;
- // case TipType.SpiritWeapon:
- // WindowCenter.Instance.Open<SpiritWeaponTipWin>();
- // break;
- // case TipType.PeerlessChest:
- // WindowCenter.Instance.Open<PeerlessChestTipWin>();
- // break;
- // case TipType.TreasureShow:
- // TreasureEffectModel effectModel = ModelCenter.Instance.GetModel<TreasureEffectModel>();
- // if (config.Effect1 == 232)
- // {
- // effectModel.SetTreasureID(config.EffectValueA1, 0);
- // }
- // break;
- // case TipType.BoxItem:
- // if (WindowCenter.Instance.IsOpen<ItemBoxTipWin>())
- // {
- // WindowCenter.Instance.Open<ItemTipWin>();
- // }
- // else
- // {
- // WindowCenter.Instance.Open<ItemBoxTipWin>();
- // }
- // break;
- // case TipType.TreasurePavilion:
- // TreasurePavilionModel.Instance.selectGubao = config.EffectValueA1;
- // TreasurePavilionModel.Instance.showTipFromPiece = config.ID;
- // WindowCenter.Instance.OpenIL<TreasurePavilionTipWin>();
- // break;
- // default:
- // WindowCenter.Instance.Open<ItemTipWin>();
- // break;
- // }
+ mainTipData.getWay.defaultUnfold = item.unfoldGetWay;
+ switch (tipType)
+ {
+ case TipType.Equip:
+ // WindowCenter.Instance.Open<EquipTipWin>();
+ break;
+
+ // case TipType.PetMount:
+ // WindowCenter.Instance.Open<PetMountTipWin>();
+ // break;
+
+ case TipType.BoxItem:
+ UIManager.Instance.OpenWindow<BoxItemWin>();
+ break;
+ case TipType.BoxChooseItem:
+ UIManager.Instance.OpenWindow<ChooseItemsWin>();
+ break;
+ case TipType.TreasurePavilion:
+ // TreasurePavilionModel.Instance.selectGubao = config.EffectValueA1;
+ // TreasurePavilionModel.Instance.showTipFromPiece = config.ID;
+ // WindowCenter.Instance.OpenIL<TreasurePavilionTipWin>();
+ break;
+ default:
+ UIManager.Instance.OpenWindow<ItemTipWin>();
+ break;
+ }
}
public static void Show(string guid, bool operatable = true)
@@ -407,16 +368,12 @@
// case TipType.PetMount:
// WindowCenter.Instance.Open<PetMountTipWin>();
// break;
- // case TipType.BoxItem:
- // if (WindowCenter.Instance.IsOpen<ItemBoxTipWin>())
- // {
- // WindowCenter.Instance.Open<ItemTipWin>();
- // }
- // else
- // {
- // WindowCenter.Instance.Open<ItemBoxTipWin>();
- // }
- // break;
+ case TipType.BoxItem:
+ UIManager.Instance.OpenWindow<BoxItemWin>();
+ break;
+ case TipType.BoxChooseItem:
+ UIManager.Instance.OpenWindow<ChooseItemsWin>();
+ break;
// case TipType.TreasurePavilion:
// TreasurePavilionModel.Instance.selectGubao = item.config.EffectValueA1;
// TreasurePavilionModel.Instance.showTipFromPiece = item.itemId;
@@ -429,51 +386,6 @@
}
- public static void ShowGood(int goodId, int itemId)
- {
- secondaryData = null;
-
- var isEquip = ItemLogicUtility.Instance.IsRealmEquip(itemId);
- if (isEquip)
- {
- mainTipData = CreateGoodEquipData(itemId, goodId);
- }
- else
- {
- mainTipData = CreateGoodItemData(itemId, goodId);
- }
-
- BuyItemController.Instance.SetGood(goodId);
- var itemConfig = ItemConfig.Get(itemId);
- if (isEquip)
- {
- // WindowCenter.Instance.Open<EquipTipWin>();
- }
- else
- {
- var tipType = GetTipType(itemId);
-
- // switch (tipType)
- // {
- // case TipType.PetMount:
- // WindowCenter.Instance.Open<PetMountTipWin>();
- // break;
- // case TipType.BoxItem:
- // if (WindowCenter.Instance.IsOpen<ItemBoxTipWin>())
- // {
- // WindowCenter.Instance.Open<ItemTipWin>();
- // }
- // else
- // {
- // WindowCenter.Instance.Open<ItemBoxTipWin>();
- // }
- // break;
- // default:
- // WindowCenter.Instance.Open<ItemTipWin>();
- // break;
- // }
- }
- }
// public static void ShowCustomEquip(CustomEquipInfo info)
// {
@@ -798,21 +710,21 @@
};
}
- // static TipData CreateItemData(int itemId)
- // {
- // return new TipData()
- // {
- // itemId = itemId,
- // baseInfo = GetBaseInfo(itemId),
- // baseProperty = GetBaseProperty(itemId),
- // exchangeItemId = itemId,
- // spiritWeaponProperty = GetSpiritWeaponProperty(itemId),
- // legendProperty = GetLegendProperty(itemId),
- // petMountBaseProperty = GetPetMountBaseProperty(itemId),
- // getWay = GetGetWay(itemId),
- // shenProperty = GetShenProperty(itemId)
- // };
- // }
+ static TipData CreateItemData(int itemId)
+ {
+ return new TipData()
+ {
+ itemId = itemId,
+ baseInfo = GetBaseInfo(itemId),
+ // baseProperty = GetBaseProperty(itemId),
+ exchangeItemId = itemId,
+ // spiritWeaponProperty = GetSpiritWeaponProperty(itemId),
+ // legendProperty = GetLegendProperty(itemId),
+ // petMountBaseProperty = GetPetMountBaseProperty(itemId),
+ // getWay = GetGetWay(itemId),
+ // shenProperty = GetShenProperty(itemId)
+ };
+ }
static TipData CreateGoodItemData(int itemId, int goodId)
{
@@ -1622,35 +1534,7 @@
// return skillInfo;
// }
- // private static WingRefineMaterials GetWingRefineMaterials(string guid)
- // {
- // var item = packModel.GetItemByGuid(guid);
- // if (item == null)
- // {
- // return default(WingRefineMaterials);
- // }
-
- // if (item.config.Type != 113)
- // {
- // return default(WingRefineMaterials);
- // }
-
- // var refineMaterials = new WingRefineMaterials();
- // refineMaterials.materials = new List<Int2>();
-
- // var ids = item.GetUseData((int)ItemUseDataKey.wingMaterialItemID);
- // var values = item.GetUseData((int)ItemUseDataKey.wingMaterialItemCount);
- // if (!ids.IsNullOrEmpty() && !values.IsNullOrEmpty())
- // {
- // var min = Mathf.Min(ids.Count, values.Count);
- // for (int i = 0; i < min; i++)
- // {
- // refineMaterials.materials.Add(new Int2(ids[i], values[i]));
- // }
- // }
-
- // return refineMaterials;
- // }
+
// private static GetWay GetGetWay(int itemId)
// {
@@ -1687,212 +1571,7 @@
// return getWay;
// }
- // private static List<ItemOperateType> GetOperates(int itemId, int itemCount = 0)
- // {
- // var config = ItemConfig.Get(itemId);
- // var operates = new List<ItemOperateType>();
- // var lsItemID = 150;
- // if (config.CanSell == 1 && itemId != lsItemID)
- // {
- // operates.Add(ItemOperateType.sell);
- // }
-
- // // if (itemCount > 1 && itemId != lsItemID)
- // // {
- // // operates.Add(ItemOperateType.split);
- // // }
-
- // if (config.UseTag == 1)
- // {
- // if (itemId != lsItemID)
- // operates.Add(ItemOperateType.makeUse);
- // else
- // operates.Add(ItemOperateType.lsExchange);
- // }
-
- // if (config.Type == 25 || config.Effect1 == 225)
- // {
- // operates.Add(ItemOperateType.inlay);
- // }
-
- // if (!config.JumpComposeCondi.IsNullOrEmpty())
- // {
- // var jumpId = 0;
- // if (composeModel.CheckComposeItemById(itemId, out jumpId))
- // {
- // operates.Add(ItemOperateType.compose);
- // }
- // }
-
- // return operates;
- // }
-
- // private static List<ItemOperateType> GetOperates(string guid)
- // {
- // var item = packModel.GetItemByGuid(guid);
- // if (item == null)
- // {
- // return null;
- // }
-
- // var operates = new List<ItemOperateType>();
-
- // var packType = item.packType;
- // if (WindowCenter.Instance.IsOpen("DepotWin"))
- // {
- // switch (packType)
- // {
- // case PackType.Warehouse:
- // operates.Add(ItemOperateType.putOut);
- // break;
- // default:
- // operates.Add(ItemOperateType.putIn);
- // break;
- // }
-
- // return operates;
- // }
-
- // if (packType == PackType.Equip)
- // {
- // if (WindowCenter.Instance.IsOpen("RealmEquipWin"))
- // {
- // operates.Add(ItemOperateType.putOff);
-
- // if (FuncOpen.Instance.IsFuncOpen(1))
- // {
- // operates.Add(ItemOperateType.strength);
- // }
-
- // if (FuncOpen.Instance.IsFuncOpen(172))
- // {
- // operates.Add(ItemOperateType.star);
- // }
-
- // if (FuncOpen.Instance.IsFuncOpen(2))
- // {
- // operates.Add(ItemOperateType.inlay);
- // }
-
- // if (FuncOpen.Instance.IsFuncOpen(91))
- // {
- // int limitLevel = 0;
- // if (equipModel.EquipLevelFuncID != null)
- // limitLevel = equipModel.EquipLevelFuncID[91];
- // if (item.config.LV >= limitLevel)
- // operates.Add(ItemOperateType.train);
- // }
-
- // if (EquipEvolveModel.Instance.IsShowEvolveBtn(item.itemId))
- // {
- // operates.Add(ItemOperateType.default1);
- // }
- // return operates;
- // }
-
- // if (ItemLogicUtility.Instance.IsRealmEquip(item.itemId) && WindowCenter.Instance.IsOpen("RoleEquipWin"))
- // {
- // operates.Add(ItemOperateType.putOff);
- // return operates;
- // }
-
- // if (ItemLogicUtility.Instance.IsSpiritWeapon(item.itemId) && WindowCenter.Instance.IsOpen("SpiritEquipBagWin"))
- // {
- // operates.Add(ItemOperateType.putOff);
- // return operates;
- // }
- // }
-
- // if (packType == PackType.Warehouse)
- // {
- // operates.Add(ItemOperateType.putOut);
- // return operates;
- // }
-
- // if (item.isAuction)
- // {
- // operates.Add(ItemOperateType.putAway);
- // }
-
- // var isEquip = ItemLogicUtility.Instance.IsRealmEquip(item.itemId);
- // var isSpiritWeapon = ItemLogicUtility.Instance.IsSpiritWeapon(item.itemId);
- // if (isEquip || isSpiritWeapon)
- // {
- // var isOverdue = ItemLogicUtility.Instance.IsOverdue(guid);
- // if (item.config.CanSell == 1)
- // {
- // operates.Add(ItemOperateType.sell);
- // }
-
- // if (item.config.ExpireTime > 0 && isOverdue && itemOverdueModel.CanRenewal(item.itemId))
- // {
- // operates.Add(ItemOperateType.renewal);
- // }
-
- // if (!isOverdue)
- // {
- // if (ItemLogicUtility.Instance.IsJobCompatibleItem(item.itemId))
- // {
- // if (isEquip)
- // {
- // operates.Add(ItemOperateType.putOn);
-
- // if (!item.config.JumpComposeCondi.IsNullOrEmpty())
- // {
- // var jumpId = 0;
- // if (composeModel.CheckComposeItemById(item.itemId, out jumpId))
- // {
- // operates.Add(ItemOperateType.compose);
- // }
- // }
- // }
-
- // if (isSpiritWeapon)
- // {
- // if (WindowCenter.Instance.IsOpen<RoleEquipWin>())
- // {
- // operates.Add(ItemOperateType.putOn);
- // }
- // else if (WindowCenter.Instance.IsOpen<MainInterfaceWin>() || WindowCenter.Instance.IsOpen("SpiritEquipBagWin"))
- // {
- // operates.Add(ItemOperateType.putOn);
- // }
- // }
- // }
- // //else
- // //{
- // // if (item.config.ItemColor > 3)
- // // {
- // // operates.Add(ItemOperateType.exchange);
- // // }
- // //}
- // }
-
- // return operates;
- // }
- // if (ItemLogicUtility.Instance.IsDogzEquip(item.itemId))
- // {
- // if (packType == PackType.DogzItem)
- // {
- // if (item.config.ItemColor > 2 && item.config.ItemColor < 6)
- // {
- // operates.Add(ItemOperateType.compose);
- // }
- // operates.Add(ItemOperateType.putOn);
- // }
- // else if (packType == PackType.DogzEquip)
- // {
- // operates.Add(ItemOperateType.putOff);
- // }
- // return operates;
- // }
-
- // operates.AddRange(GetOperates(item.itemId, item.count));
-
- // return operates;
- // }
-
private static List<ItemOperateType> GetGoodOperates(int goodId)
@@ -1939,15 +1618,16 @@
private static TipType GetTipType(int itemId)
{
- if (GeneralDefine.chestDisplayItems.Contains(itemId))
+ var boxType = ChestsAwardConfig.GetBoxType(itemId);
+ if (boxType == 1)
+ {
+ return TipType.BoxItem;
+ }
+ else if (boxType == 2)
{
- return TipType.PeerlessChest;
+ return TipType.BoxChooseItem;
}
- // if (ChestsAwardConfig.IsBox(itemId))
- // {
- // return TipType.BoxItem;
- // }
var config = ItemConfig.Get(itemId);
switch (config.Type)
@@ -1965,18 +1645,23 @@
case 111:
case 112:
return TipType.Equip;
- case 26:
- case 41:
- case 42:
- return TipType.PetMount;
+ // case 26:
+ // case 41:
+ // case 42:
+ // return TipType.PetMount;
case 147:
return TipType.TreasurePavilion;
default:
return TipType.Item;
}
+
}
+
+
+
+
[System.Diagnostics.Conditional("UNITY_EDITOR")]
private static void PrintItemBrief(int itemId)
{
diff --git a/Main/System/KnapSack/BackpackData.cs b/Main/System/KnapSack/BackpackData.cs
index 20015b7..058bfab 100644
--- a/Main/System/KnapSack/BackpackData.cs
+++ b/Main/System/KnapSack/BackpackData.cs
@@ -6,69 +6,37 @@
using System.Collections;
- public struct Item
+public struct Item
+{
+ public int id;
+ public ulong countEx;
+ public int quality;
+ public int bind; //缁戝畾 鎴栬�� 鎷嶅崠 浜ゆ槗
+
+ public Item(int _id, ulong _count)
{
- public int id;
- public int count; //鍏煎鏃т唬鐮佷繚鐣�
- public ulong countEx; //鍏煎鏃т唬鐮乧ount锛屽綋鏁伴噺瓒呰繃浜�32浣嶆棤娉曡〃绀烘椂浣跨敤
- public int quality;
- public int bind;
+ this.id = _id;
+ this.quality = 0;
+ this.bind = 0;
+ this.countEx = _count;
+ }
+
- public Item(int _id, ulong _count)
- {
- this.id = _id;
- this.count = (int)_count;
- this.quality = 0;
- this.bind = 0;
- this.countEx = _count;
- }
+ public Item(int _id, ulong _count, int _quality)
+ {
+ this.id = _id;
+ this.quality = _quality;
+ this.bind = 0;
+ this.countEx = _count;
+ }
- public Item(int _id, ulong _count, int _quality)
- {
- this.id = _id;
- this.count = (int)_count;
- this.quality = _quality;
- this.bind = 0;
- this.countEx = _count;
- }
+ public Item(int _id, ulong _count, int _bind = 0, int _quality = 0)
+ {
+ this.id = _id;
+ this.quality = _quality;
+ this.bind = _bind;
+ this.countEx = _count;
+ }
- public Item(int _id, ulong _count, int _bind = 0, int _quality = 0)
- {
- this.id = _id;
- this.count = (int)_count;
- this.quality = _quality;
- this.bind = _bind;
- this.countEx = _count;
- }
-
- #region 鏃т唬鐮佸吋瀹� 鏄剧ず鏃犳硶瓒呰繃32浣�
-
- public Item(int _id, int _count)
- {
- this.id = _id;
- this.count = _count;
- this.quality = 0;
- this.bind = 0;
- this.countEx = (ulong)_count;
- }
-
- public Item(int _id, int _count, int _quality)
- {
- this.id = _id;
- this.count = _count;
- this.quality = _quality;
- this.bind = 0;
- this.countEx = (ulong)_count;
- }
-
-
- public Item(int _id, int _count, int _bind = 0, int _quality = 0)
- {
- this.id = _id;
- this.count = _count;
- this.quality = _quality;
- this.bind = _bind;
- this.countEx = (ulong)_count;
- }
- #endregion
- }
\ No newline at end of file
+
+}
\ No newline at end of file
diff --git a/Main/System/KnapSack/Logic/CommonGetItemCell.cs b/Main/System/KnapSack/Logic/CommonGetItemCell.cs
index e067abe..d16ba2b 100644
--- a/Main/System/KnapSack/Logic/CommonGetItemCell.cs
+++ b/Main/System/KnapSack/Logic/CommonGetItemCell.cs
@@ -1,32 +1,24 @@
锘縰sing System.Collections.Generic;
-using System.Linq;
using UnityEngine;
using UnityEngine.UI;
- public class CommonGetItemCell : CellView
+public class CommonGetItemCell : CellView
+{
+ [SerializeField] List<CommonGetItem> commonGetItems = new List<CommonGetItem>();
+ public void Display(int index, List<Item> showItems)
{
- [SerializeField] List<CommonGetItem> commonGetItems = new List<CommonGetItem>();
- [SerializeField] HorizontalLayoutGroup horizontalLayout;
- public void Display(int rowIndex)
+ for (int i = 0; i < commonGetItems.Count; i++)
{
- var dict = ItemLogicUtility.Instance.totalShowItems;
- var list = dict.Keys.ToList();
- int rowCount = (int)Mathf.Ceil((float)list.Count / 5);
- horizontalLayout.childAlignment= rowCount > 1?TextAnchor.MiddleLeft: TextAnchor.MiddleCenter;
-
- for (int i = 0; i < commonGetItems.Count; i++)
+ if (index + i < showItems.Count)
{
- int index = rowIndex * 5 + i;
- if (index < list.Count)
- {
- int itemId = list[index];
- commonGetItems[i].Display(itemId);
- commonGetItems[i].SetActive(true);
- }
- else
- {
- commonGetItems[i].SetActive(false);
- }
+ int itemId = showItems[index + i].id;
+ commonGetItems[i].Display(itemId);
+ commonGetItems[i].SetActive(true);
+ }
+ else
+ {
+ commonGetItems[i].SetActive(false);
}
}
}
+}
diff --git a/Main/System/KnapSack/Logic/CommonGetItemWin.cs b/Main/System/KnapSack/Logic/CommonGetItemWin.cs
index 7e7f3d6..a2ebe00 100644
--- a/Main/System/KnapSack/Logic/CommonGetItemWin.cs
+++ b/Main/System/KnapSack/Logic/CommonGetItemWin.cs
@@ -1,111 +1,87 @@
-锘縰sing System.Linq;
+锘縰sing System.Collections.Generic;
+using System.Linq;
using UnityEngine;
using UnityEngine.UI;
- //鐢ㄤ簬鏄剧ず鑾峰緱鐗╁搧鐨勭獥鍙�
- public class CommonGetItemWin : UIBase
+//鐢ㄤ簬鏄剧ず鑾峰緱鐗╁搧鐨勭獥鍙�
+public class CommonGetItemWin : UIBase
+{
+ [SerializeField] ScrollerController scroller;
+
+
+ protected override void OnPreOpen()
{
- [SerializeField] ScrollerController scroller;
- [SerializeField] RichText desc;
- [SerializeField] Button sureBtn;
- [SerializeField] Text sureText;
- [SerializeField] TextEx closeText;
+ ItemLogicUtility.Instance.OnGetItemShowEvent += OnGetItemShowEvent;
+ scroller.OnRefreshCell += OnRefreshCell;
+ CreateScroller();
+ }
- float openTime;
+ protected override void OnPreClose()
+ {
+ ItemLogicUtility.Instance.OnGetItemShowEvent -= OnGetItemShowEvent;
+ scroller.OnRefreshCell -= OnRefreshCell;
+ ItemLogicUtility.Instance.ClearGetItem();
- protected override void InitComponent()
+ }
+
+ List<Item> showItems = new List<Item>();
+ void CreateScroller()
+ {
+ scroller.Refresh();
+ showItems = ItemLogicUtility.Instance.totalShowItems.Values.ToList();
+ showItems.Sort(SortItem);
+ for (int i = 0; i < showItems.Count; i++)
{
- base.InitComponent();
- Debug.Log("鍒濆鍖栭�氱敤鑾峰緱鐗╁搧绐楀彛");
- sureBtn.SetListener(() => UIManager.Instance.CloseWindow<CommonGetItemWin>());
- }
-
- public override void Refresh()
- {
- base.Refresh();
- Debug.Log("鍒锋柊閫氱敤鑾峰緱鐗╁搧绐楀彛");
- }
-
- protected override void OnPreOpen()
- {
- Refresh();
- ItemLogicUtility.Instance.OnGetItemShowEvent += OnGetItemShowEvent;
- scroller.OnRefreshCell += OnRefreshCell;
- desc.SetActive(!string.IsNullOrEmpty(ItemLogicUtility.Instance.getItemInfo));
- desc.text = ItemLogicUtility.Instance.getItemInfo;
- sureText.text = ItemLogicUtility.Instance.getItemBtnText;
- CreateScroller();
- closeText.text = Language.Get("L2004");
- openTime = Time.time;
- }
-
-
- protected override void OnPreClose()
- {
- ItemLogicUtility.Instance.OnGetItemShowEvent -= OnGetItemShowEvent;
- scroller.OnRefreshCell -= OnRefreshCell;
- ItemLogicUtility.Instance.OnGetItem?.Invoke();
- ItemLogicUtility.Instance.ClearGetItem();
-
- }
-
- void CreateScroller()
- {
- scroller.Refresh();
- var keys = ItemLogicUtility.Instance.totalShowItems.Keys.ToList();
- int rowCount = (int)Mathf.Ceil((float)keys.Count / 5);
- for (int i = 0; i < rowCount; i++)
- {
+ if (i % 5 == 0)
+ {
scroller.AddCell(ScrollerDataType.Header, i);
}
- scroller.Restart();
}
-
- float needRefreshTime; //閬垮厤灏佸寘杩囧鍗¢】
- void OnGetItemShowEvent()
- {
- needRefreshTime = Time.time + 0.3f;
-
- }
-
- void RefreshScroller()
- {
- if (needRefreshTime <= 0)
- return;
-
- if (Time.time < needRefreshTime)
- return;
-
- if (scroller.GetNumberOfCells(scroller.m_Scorller) != ItemLogicUtility.Instance.totalShowItems.Count)
- {
- CreateScroller();
- }
- else
- {
- scroller.m_Scorller.RefreshActiveCellViews();
- }
- needRefreshTime = 0;
- }
-
- protected void LateUpdate()
- {
- RefreshScroller();
- if (ItemLogicUtility.Instance.closeSeconds == 0)
- return;
-
- float closeTime = ItemLogicUtility.Instance.closeSeconds - (Time.time - openTime);
- if (closeTime <= 0)
- {
- UIManager.Instance.CloseWindow<CommonGetItemWin>();
- return;
- }
- closeText.text = Language.Get("AutoCloseAfterSeconds", (int)closeTime);
- }
-
- void OnRefreshCell(ScrollerDataType type, CellView cell)
- {
- var _cell = cell as CommonGetItemCell;
- _cell?.Display(cell.index);
- }
+ scroller.Restart();
}
+
+ int SortItem(Item itemA, Item itemB)
+ {
+ var itemConfigA = ItemConfig.Get(itemA.id);
+ var itemConfigB = ItemConfig.Get(itemB.id);
+ return itemConfigB.ItemColor - itemConfigA.ItemColor;
+ }
+
+ float needRefreshTime; //閬垮厤灏佸寘杩囧鍗¢】
+ void OnGetItemShowEvent()
+ {
+ needRefreshTime = Time.time + 0.3f;
+
+ }
+
+ void RefreshScroller()
+ {
+ if (needRefreshTime <= 0)
+ return;
+
+ if (Time.time < needRefreshTime)
+ return;
+
+ if (scroller.GetNumberOfCells(scroller.m_Scorller) != ItemLogicUtility.Instance.totalShowItems.Count)
+ {
+ CreateScroller();
+ }
+ else
+ {
+ scroller.m_Scorller.RefreshActiveCellViews();
+ }
+ needRefreshTime = 0;
+ }
+
+ protected void LateUpdate()
+ {
+ RefreshScroller();
+ }
+
+ void OnRefreshCell(ScrollerDataType type, CellView cell)
+ {
+ var _cell = cell as CommonGetItemCell;
+ _cell?.Display(cell.index, showItems);
+ }
+}
diff --git a/Main/System/KnapSack/Logic/ItemLogicUtility.cs b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
index 40bbc65..818c197 100644
--- a/Main/System/KnapSack/Logic/ItemLogicUtility.cs
+++ b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
@@ -1272,7 +1272,7 @@
// 閫氱敤鏄剧ず鑾峰緱鐨勭墿鍝�
- public void ShowGetItem(List<Item> items, string info = "", int seconds = 3, string btnName = "", Action func = null, bool isNameShow = true, string eventName = "default")
+ public void ShowGetItem(List<Item> items, string eventName = "default", bool isNameShow = true)
{
if (getItemEventName != eventName)
{
@@ -1300,12 +1300,6 @@
}
- getItemInfo = info;
- OnGetItem = func;
- if (btnName == "")
- btnName = Language.Get("PopConfirmWin_OK");
- getItemBtnText = btnName;
- closeSeconds = seconds;
this.isNameShow = isNameShow;
OnGetItemShowEvent?.Invoke();
if (!UIManager.Instance.IsOpenedInList<CommonGetItemWin>())
@@ -1363,5 +1357,117 @@
getItemEventName = "";
}
-
+ public void UseItem(string guid, int useCnt = 1, int extra = 0)
+ {
+ var item = packModel.GetItemByGuid(guid);
+ if (item == null)
+ {
+ return;
+ }
+
+ var error = 0;
+ if (CanUseItem(guid, useCnt, out error))
+ {
+ UseItemSendServer(guid, useCnt, extra);
+ }
+ else
+ {
+ switch (error)
+ {
+ case 1:
+ SysNotifyMgr.Instance.ShowTip("EverydayUseLimit");
+ break;
+ case 2:
+ SysNotifyMgr.Instance.ShowTip("UseCntLimit");
+ break;
+ case 3:
+ SysNotifyMgr.Instance.ShowTip("GeRen_chenxin_749572");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ public bool CanUseItem(string guid, int useCnt, out int error)
+ {
+ var item = packModel.GetItemByGuid(guid);
+ if (item == null)
+ {
+ error = 999;
+ return false;
+ }
+
+
+ if (item.config.Type == 145 && item.config.CDTime > 0)
+ {
+ var createTime = item.GetUseDataFirstValue((int)ItemUseDataKey.createTime);
+ if (createTime > 0)
+ {
+ DateTime useTime;
+ if (item.config.CDTypeEx == 1)
+ {
+ //itemConfig.CDTime 涓哄ぉ锛岃繃0鐐瑰彲鐢�
+ useTime = TimeUtility.GetTime((uint)createTime).AddDays(item.config.CDTime);
+ useTime = TimeUtility.GetDayStartTime(useTime.Year, useTime.Month, useTime.Day);
+ }
+ else
+ {
+ useTime = TimeUtility.GetTime((uint)createTime).AddSeconds(item.config.CDTime);
+ }
+ if (TimeUtility.ServerNow < useTime)
+ {
+ error = 3;
+ return false;
+ }
+ }
+ }
+
+
+ var usedCountToday = packModel.GetItemUsedTimesToday(item.itemId);
+ if (item.config.MaxSkillCnt > 0 && item.config.MaxSkillCnt <= usedCountToday)
+ {
+ error = 1;
+ return false;
+ }
+
+ //var usedCountTotal = packModel.GetItemTotalUsedTimes(item.itemId);
+ // var fruitConfig = AttrFruitConfig.Get(item.itemId);
+ // if (fruitConfig != null)
+ // {
+ // var limitTimes = 0;
+ // if (fruitConfig.FuncID == 2)
+ // {
+ // limitTimes = alchemyModel.GetAlchemyDrugUseLimit(item.itemId);
+ // }
+ // else
+ // {
+ // limitTimes = fruitConfig.basicUseLimit;
+ // }
+ // if (usedCountTotal >= limitTimes || useCnt > limitTimes)
+ // {
+ // error = 1;
+ // return false;
+ // }
+ // }
+
+ error = 0;
+ return true;
+ }
+
+ void UseItemSendServer(string guid, int useCnt, int extra)
+ {
+ var itemModel = packModel.GetItemByGuid(guid);
+ if (itemModel == null)
+ {
+ return;
+ }
+
+ var useItem = new CA323_tagCMUseItems();
+ useItem.ItemIndex = (byte)itemModel.gridIndex;
+ useItem.UseCnt = (ushort)useCnt;
+ useItem.ExData = (uint)extra;
+ GameNetSystem.Instance.SendInfo(useItem); //浣跨敤鐗╁搧
+ }
+
}
diff --git a/Main/System/KnapSack/Logic/PackGirdCell.cs b/Main/System/KnapSack/Logic/PackGirdCell.cs
index d61fc3e..0ceae9e 100644
--- a/Main/System/KnapSack/Logic/PackGirdCell.cs
+++ b/Main/System/KnapSack/Logic/PackGirdCell.cs
@@ -13,7 +13,19 @@
var guid = PackManager.Instance.GetSinglePack(PackType.Item).itemGuidList[index];
if (string.IsNullOrEmpty(guid))
return;
- itemCell.Init(PackManager.Instance.GetItemByGuid(guid));
+
+ var item = PackManager.Instance.GetItemByGuid(guid);
+ ulong count = 0;
+ if (GeneralDefine.itemMoneyCountDict.ContainsKey(item.itemId))
+ {
+ //灞曠ず璐у竵鏁伴噺鐨勭墿鍝�
+ count = UIHelper.GetMoneyCnt(GeneralDefine.itemMoneyCountDict[item.itemId]);
+ }
+ else
+ {
+ count = (ulong)item.count;
+ }
+ itemCell.Init(new ItemCellModel(item.itemId, false, count));
itemCell.button.AddListener(()=>
{
ItemTipUtility.Show(guid);
diff --git a/Main/System/KnapSack/New/CommonItemBaisc.cs b/Main/System/KnapSack/New/CommonItemBaisc.cs
index 57644ef..cd349d3 100644
--- a/Main/System/KnapSack/New/CommonItemBaisc.cs
+++ b/Main/System/KnapSack/New/CommonItemBaisc.cs
@@ -220,7 +220,7 @@
if (packModel.textCountShow.ContainsKey(itemId))
{
countText.SetActive(true);
- countText.text = count > 1 ? packModel.textCountShow[itemId] + "x" + count : packModel.textCountShow[itemId];
+ countText.text = count > 0 ? packModel.textCountShow[itemId] + "x" + count : packModel.textCountShow[itemId];
}
else if (packModel.gameCashShow.Contains(itemId))
{
@@ -235,8 +235,8 @@
}
else
{
- countText.SetActive(count > 1);
- if (count > 1)
+ countText.SetActive(count > 0);
+ if (count > 0)
{
countText.text = UIHelper.ReplaceLargeNum((double)count);
}
diff --git a/Main/System/KnapSack/PackManager.cs b/Main/System/KnapSack/PackManager.cs
index ae9f4fb..b307a4e 100644
--- a/Main/System/KnapSack/PackManager.cs
+++ b/Main/System/KnapSack/PackManager.cs
@@ -26,7 +26,7 @@
//AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } }
//ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
- List<string> commonShowAwardEvents = new List<string>();
+
public int[] autoUseItemIDs;
public override void Init()
@@ -480,10 +480,9 @@
#region 鐜╁瑁呭鐗规畩閫昏緫
void ParseConfig()
{
- var config = FuncConfigConfig.Get("CommonShowAwards");
- commonShowAwardEvents = JsonMapper.ToObject<List<string>>(config.Numerical1);
- config= FuncConfigConfig.Get("InitBagCellCount");
+
+ var config= FuncConfigConfig.Get("InitBagCellCount");
initBagGridCount = int.Parse(config.Numerical1);
PackInitCountDict = ConfigParse.ParseIntDict(config.Numerical2);
@@ -786,17 +785,17 @@
{
int useCnt = 0;
List<int> shareIdlist = null;
- bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
- if (isShare)
- {
- foreach (var id in shareIdlist)
- {
- int singleUseCnt = 0;
- itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
- useCnt += singleUseCnt;
- }
- }
- else
+ // bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
+ // if (isShare)
+ // {
+ // foreach (var id in shareIdlist)
+ // {
+ // int singleUseCnt = 0;
+ // itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
+ // useCnt += singleUseCnt;
+ // }
+ // }
+ // else
{
itemDayUseCntDict.TryGetValue(itemId, out useCnt);
}
@@ -972,44 +971,44 @@
#endregion
#region 鍒ゆ柇鐗╁搧鏄惁杈惧埌浣跨敤涓婇檺
- // public bool IsReachUseLimit(string guid, out ulong count)
- // {
- // count = 0;
- // ItemModel itemModel = GetItemByGuid(guid);
- // if (itemModel == null) return false;
+ public bool IsReachUseLimit(string guid, out ulong count)
+ {
+ count = 0;
+ ItemModel itemModel = GetItemByGuid(guid);
+ if (itemModel == null) return false;
- // AttrFruitConfig fruitConfig = AttrFruitConfig.Get(itemModel.itemId);
- // int haveUseCnt = GetItemUsedTimesToday(itemModel.itemId);
- // int sumHaveUseCnt = GetItemTotalUsedTimes(itemModel.itemId);
- // count = (ulong)itemModel.count;
- // bool isReach = false;
- // int remainDayCnt = 0;
- // if (itemModel.config.MaxSkillCnt > 0)
- // {
- // remainDayCnt = itemModel.config.MaxSkillCnt - haveUseCnt;
- // if (itemModel.count > remainDayCnt)
- // {
- // count = (ulong)remainDayCnt;
- // }
- // }
+ // AttrFruitConfig fruitConfig = AttrFruitConfig.Get(itemModel.itemId);
+ int haveUseCnt = GetItemUsedTimesToday(itemModel.itemId);
+ int sumHaveUseCnt = GetItemTotalUsedTimes(itemModel.itemId);
+ count = (ulong)itemModel.count;
+ bool isReach = false;
+ int remainDayCnt = 0;
+ if (itemModel.config.MaxSkillCnt > 0)
+ {
+ remainDayCnt = itemModel.config.MaxSkillCnt - haveUseCnt;
+ if (itemModel.count > remainDayCnt)
+ {
+ count = (ulong)remainDayCnt;
+ }
+ }
- // int remainSumCnt = 0;
- // if (fruitConfig != null)
- // {
- // remainSumCnt = fruitConfig.basicUseLimit - sumHaveUseCnt;
- // if (remainSumCnt <= remainDayCnt && itemModel.count > remainSumCnt)
- // {
- // count = (ulong)remainSumCnt;
- // }
- // }
+ int remainSumCnt = 0;
+ // if (fruitConfig != null)
+ // {
+ // remainSumCnt = fruitConfig.basicUseLimit - sumHaveUseCnt;
+ // if (remainSumCnt <= remainDayCnt && itemModel.count > remainSumCnt)
+ // {
+ // count = (ulong)remainSumCnt;
+ // }
+ // }
- // if (count < (ulong)itemModel.count)
- // {
- // isReach = true;
- // }
+ if (count < (ulong)itemModel.count)
+ {
+ isReach = true;
+ }
- // return isReach;
- // }
+ return isReach;
+ }
#endregion
@@ -1028,60 +1027,4 @@
}
-
-
- public void ReceiveAwardNotify(HA801_tagMCGiveAwardInfo netPack)
- {
- var eventName = UIHelper.ServerStringTrim(netPack.EventName);
- if (eventName == "BuyItem")
- return;
-
- // 浠欑洘鏀诲煄鎴�
- // if (eventName == "FamilyGCZSQGrid" || eventName == "FamilyGCZSQPass" || eventName == "FamilyGCZSQPassAll" ||
- // eventName == "FamilyGCZContiribution" || eventName == "FamilyGCZAtk")
- // {
- // ModelCenter.Instance.GetModel<FairySiegeActModel>()?.OnUpdateAwardInfoAction(netPack);
- // return;
- // }
- if (!commonShowAwardEvents.Contains(eventName))
- return;
-
- List<Item> showItems = new List<Item>();
-
- if (netPack.Exp != 0 || netPack.ExpPoint != 0)
- {
- ulong expValue = netPack.Exp + netPack.ExpPoint * (ulong)Constants.ExpPointValue;
- showItems.Add(new Item(GeneralDefine.expDisplayId, expValue));
- }
- if (netPack.MoneyList.Length != 0)
- {
- for (int i = 0; i < netPack.MoneyLen; i++)
- {
- var moneyType = netPack.MoneyList[i].MoneyType;
- if (GeneralDefine.moneyDisplayIds.ContainsKey(moneyType) && netPack.MoneyList[i].MoneyValue != 0)
- {
- showItems.Add(new Item(GeneralDefine.moneyDisplayIds[moneyType], netPack.MoneyList[i].MoneyValue));
- }
-
- }
- }
-
- if (netPack.ItemList.Length != 0)
- {
- for (int i = 0; i < netPack.ItemLen; i++)
- {
- showItems.Add(new Item((int)netPack.ItemList[i].ItemID, netPack.ItemList[i].Count, netPack.ItemList[i].IsBind));
- }
- }
-
-
- string info = string.Empty;
- if (LanguageConfig.HasKey("commonShowAwardEvents_" + eventName))
- info = Language.Get("commonShowAwardEvents_" + eventName);
-
- if (showItems.Count == 0)
- return;
-
- ItemLogicUtility.Instance.ShowGetItem(showItems, info, 0, eventName: eventName);
- }
}
diff --git a/Main/System/Recharge/DailySpecialsModel.cs b/Main/System/Recharge/DailySpecialsModel.cs
index 31dc062..27c7802 100644
--- a/Main/System/Recharge/DailySpecialsModel.cs
+++ b/Main/System/Recharge/DailySpecialsModel.cs
@@ -55,7 +55,7 @@
List<Item> itemList = new List<Item>();
for (int j = 0; j < giftInfoDict[giftInfokeyList[i]].Count; j++)
{
- Item item = new Item(giftInfoDict[giftInfokeyList[i]][j][0], giftInfoDict[giftInfokeyList[i]][j][1]);
+ Item item = new Item(giftInfoDict[giftInfokeyList[i]][j][0], (ulong)giftInfoDict[giftInfokeyList[i]][j][1]);
itemList.Add(item);
}
itemAllList.Add(itemList);
diff --git a/Main/System/Recharge/RechargeManager.cs b/Main/System/Recharge/RechargeManager.cs
index c3460bf..e15f1b3 100644
--- a/Main/System/Recharge/RechargeManager.cs
+++ b/Main/System/Recharge/RechargeManager.cs
@@ -204,7 +204,7 @@
m_RechargeGainItemDict.Add(configs[i].CTGID, _itemList);
for (int k = 0; k < _itemArray.Length; k++)
{
- Item _item = new Item(_itemArray[k][0], _itemArray[k][1]);
+ Item _item = new Item(_itemArray[k][0], (ulong)_itemArray[k][1]);
_itemList.Add(_item);
}
}
@@ -262,7 +262,7 @@
for (int i = 0; i < _itemJson[jobstr].Count; i++)
{
m_FirstChargeItemDict[day][job].Add(new Item(int.Parse(_itemJson[jobstr][i][0].ToString()),
- int.Parse(_itemJson[jobstr][i][1].ToString())));
+ ulong.Parse(_itemJson[jobstr][i][1].ToString())));
}
}
@@ -274,7 +274,7 @@
var _itemCommon = JsonMapper.ToObject<int[][]>(config.CommItemList);
for (int i = 0; i < _itemCommon.Length; i++)
{
- m_FirstChargeCommonItemDict[day].Add(new Item(_itemCommon[i][0], _itemCommon[i][1]));
+ m_FirstChargeCommonItemDict[day].Add(new Item(_itemCommon[i][0], (ulong)_itemCommon[i][1]));
}
diff --git a/Main/System/Store/StoreModel.cs b/Main/System/Store/StoreModel.cs
index b072931..93d17e5 100644
--- a/Main/System/Store/StoreModel.cs
+++ b/Main/System/Store/StoreModel.cs
@@ -911,7 +911,7 @@
public void OnClickShopCell(StoreConfig shopInfo)
{
int itemId = GetReplaceId(shopInfo.ID, shopInfo.ItemID);
- ItemTipUtility.ShowGood(shopInfo.ID, itemId);
+ ItemTipUtility.Show(itemId);
}
public int BuyCnt { get; private set; }
diff --git a/Main/System/Tip/ItemsConfirmCell.cs b/Main/System/Tip/ItemsConfirmCell.cs
index 34b818d..3fd9d7c 100644
--- a/Main/System/Tip/ItemsConfirmCell.cs
+++ b/Main/System/Tip/ItemsConfirmCell.cs
@@ -9,7 +9,7 @@
public void Display(int index)
{
int itemID = ConfirmCancel.getItems[index].id;
- itemCell.Init(new ItemCellModel(itemID, false, (ulong)ConfirmCancel.getItems[index].count));
+ itemCell.Init(new ItemCellModel(itemID, false, (ulong)ConfirmCancel.getItems[index].countEx));
itemCell.button.SetListener(() =>
{
ItemTipUtility.Show(itemID);
diff --git a/Main/Utility/MaterialUtility.cs b/Main/Utility/MaterialUtility.cs
index 3044113..2249278 100644
--- a/Main/Utility/MaterialUtility.cs
+++ b/Main/Utility/MaterialUtility.cs
@@ -7,7 +7,7 @@
public static Material GetDefaultSpriteGrayMaterial()
{
- return ResManager.Instance.LoadAsset<Material>("Materials", "SpriteGray");
+ return ResManager.Instance.LoadAsset<Material>("BuiltIn/Materials", "SpriteGray");
}
public static Material GetInstantiatedSpriteGrayMaterial()
@@ -18,12 +18,12 @@
public static Material GetSmoothMaskGrayMaterial()
{
- return ResManager.Instance.LoadAsset<Material>("Materials", "SmoothMaskGray");
+ return ResManager.Instance.LoadAsset<Material>("BuiltIn/Materials", "SmoothMaskGray");
}
public static Material GetInstantiatedSpriteTwinkleMaterial()
{
- var material = ResManager.Instance.LoadAsset<Material>("Materials", "Flash");
+ var material = ResManager.Instance.LoadAsset<Material>("BuiltIn/Materials", "Flash");
return new Material(material);
}
@@ -34,7 +34,7 @@
public static Material GetGUIRenderTextureMaterial()
{
- return ResManager.Instance.LoadAsset<Material>("Materials", "UI_RenderTexture");
+ return ResManager.Instance.LoadAsset<Material>("BuiltIn/Materials", "UI_RenderTexture");
}
public static void SetRenderSortingOrder(this GameObject root, int sortingOrder, bool includeChildren)
--
Gitblit v1.8.0