|
@@ -24,11 +24,12 @@ namespace GFGGame
|
|
|
_selDic.Clear();
|
|
|
_selDic = null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
for (int i = 0; i < _listLongPress.Count; i++)
|
|
|
{
|
|
|
_listLongPress[i].Dispose();
|
|
|
}
|
|
|
+
|
|
|
_listLongPress.Clear();
|
|
|
|
|
|
if (_ui != null)
|
|
@@ -36,7 +37,7 @@ namespace GFGGame
|
|
|
_ui.Dispose();
|
|
|
_ui = null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
base.Dispose();
|
|
|
}
|
|
|
|
|
@@ -122,28 +123,53 @@ namespace GFGGame
|
|
|
uiItemChild.m_loaIcon.onClick.Add(OnListSelectorItemClick);
|
|
|
uiItemChild.m_txtNum.text = itemChildArr[1].ToString();
|
|
|
uiItemChild.m_txtSelNum.text = "0";
|
|
|
- //uiItemChild.m_btnAdd.onClick.Add(OnChildBtnAddClick);
|
|
|
+ uiItemChild.m_btnAdd.onClick.Add(OnBtnAddClick);
|
|
|
uiItemChild.m_btnReduce.onClick.Add(OnChildBtnReduceClick);
|
|
|
-
|
|
|
+
|
|
|
if (uiItemChild.target.data == null)
|
|
|
{
|
|
|
LongPressGesture longPressGesture = new LongPressGesture(uiItemChild.m_btnAdd);
|
|
|
- longPressGesture.once = true;
|
|
|
+ longPressGesture.trigger = 0.3f;
|
|
|
+ longPressGesture.interval = 0.1f;
|
|
|
+ longPressGesture.once = false;
|
|
|
longPressGesture.onAction.Add(OnLongPress);
|
|
|
_listLongPress.Add(longPressGesture);
|
|
|
+
|
|
|
+ LongPressGesture longPressGesture2 = new LongPressGesture(uiItemChild.m_btnReduce);
|
|
|
+ longPressGesture2.trigger = 0.3f;
|
|
|
+ longPressGesture2.interval = 0.1f;
|
|
|
+ longPressGesture2.once = false;
|
|
|
+ longPressGesture2.onAction.Add(OnLongPressReduce);
|
|
|
+ _listLongPress.Add(longPressGesture);
|
|
|
}
|
|
|
|
|
|
uiItemChild.target.data = itemCfgChild;
|
|
|
UI_ListSelectorItem.ProxyEnd();
|
|
|
}
|
|
|
|
|
|
- private void OnLongPress(EventContext context)
|
|
|
+ private void OnBtnAddClick(EventContext context)
|
|
|
{
|
|
|
- LongPressGesture gesture = (LongPressGesture)context.sender;
|
|
|
GObject sender = context.sender as GObject;
|
|
|
GObject obj = sender.parent;
|
|
|
UI_ListSelectorItem listItem = UI_ListSelectorItem.Proxy(obj);
|
|
|
|
|
|
+ ItemCfg itemCfg = obj.data as ItemCfg;
|
|
|
+ UpdateSel(listItem, itemCfg);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnLongPress(EventContext context)
|
|
|
+ {
|
|
|
+ LongPressGesture gesture = (LongPressGesture)context.sender;
|
|
|
+ var host = gesture.host;
|
|
|
+ GObject obj = host.parent;
|
|
|
+ UI_ListSelectorItem listItem = UI_ListSelectorItem.Proxy(obj);
|
|
|
+
|
|
|
+ ItemCfg itemCfg = obj.data as ItemCfg;
|
|
|
+ UpdateSel(listItem, itemCfg);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateSel(UI_ListSelectorItem listItem, ItemCfg itemCfg)
|
|
|
+ {
|
|
|
if (_selCount == _count)
|
|
|
{
|
|
|
return;
|
|
@@ -154,8 +180,6 @@ namespace GFGGame
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- ItemCfg itemCfg = obj.data as ItemCfg;
|
|
|
-
|
|
|
if (_selDic.TryGetValue(itemCfg.id, out int num))
|
|
|
{
|
|
|
if (num == _count)
|
|
@@ -176,18 +200,30 @@ namespace GFGGame
|
|
|
|
|
|
SetSelAllNum();
|
|
|
}
|
|
|
-
|
|
|
- private void SetSelAllNum()
|
|
|
- {
|
|
|
- _ui.m_txtSelRewardStr.text = $"已选奖励:{_selCount}/{_count}";
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
private void OnChildBtnReduceClick(EventContext context)
|
|
|
{
|
|
|
GObject sender = context.sender as GObject;
|
|
|
GObject obj = sender.parent;
|
|
|
UI_ListSelectorItem listItem = UI_ListSelectorItem.Proxy(obj);
|
|
|
|
|
|
+ ItemCfg itemCfg = obj.data as ItemCfg;
|
|
|
+ UpdateReduceSel(listItem, itemCfg);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnLongPressReduce(EventContext context)
|
|
|
+ {
|
|
|
+ LongPressGesture gesture = (LongPressGesture)context.sender;
|
|
|
+ var host = gesture.host;
|
|
|
+ GObject obj = host.parent;
|
|
|
+ UI_ListSelectorItem listItem = UI_ListSelectorItem.Proxy(obj);
|
|
|
+
|
|
|
+ ItemCfg itemCfg = obj.data as ItemCfg;
|
|
|
+ UpdateReduceSel(listItem, itemCfg);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateReduceSel(UI_ListSelectorItem listItem, ItemCfg itemCfg)
|
|
|
+ {
|
|
|
if (_selCount == 0)
|
|
|
{
|
|
|
return;
|
|
@@ -197,10 +233,7 @@ namespace GFGGame
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- ItemCfg itemCfg = obj.data as ItemCfg;
|
|
|
-
|
|
|
+
|
|
|
if (_selDic.TryGetValue(itemCfg.id, out int num))
|
|
|
{
|
|
|
if (num == 0)
|
|
@@ -222,6 +255,12 @@ namespace GFGGame
|
|
|
SetSelAllNum();
|
|
|
}
|
|
|
|
|
|
+ private void SetSelAllNum()
|
|
|
+ {
|
|
|
+ _ui.m_txtSelRewardStr.text = $"已选奖励:{_selCount}/{_count}";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//弹出物品详细描述框
|
|
|
private void OnListSelectorItemClick(EventContext context)
|
|
|
{
|