|
@@ -102,12 +102,12 @@ namespace GFGGame
|
|
|
|
|
|
private void AddEffect()
|
|
private void AddEffect()
|
|
{
|
|
{
|
|
- //邊框左上角特效
|
|
|
|
|
|
+ //边框左上角特效
|
|
string resPath1 = ResPathUtil.GetViewEffectPath("ui_Activity", "Com_window_L_up");
|
|
string resPath1 = ResPathUtil.GetViewEffectPath("ui_Activity", "Com_window_L_up");
|
|
SceneController.AddObjectToView(null, null, _ui.m_holderLeftTop, resPath1,
|
|
SceneController.AddObjectToView(null, null, _ui.m_holderLeftTop, resPath1,
|
|
out _gameObject1, out _wrapper1);
|
|
out _gameObject1, out _wrapper1);
|
|
|
|
|
|
- //邊框右下角特效
|
|
|
|
|
|
+ //边框右下角特效
|
|
string resPath2 = ResPathUtil.GetViewEffectPath("ui_Activity", "Com_window_R_Down");
|
|
string resPath2 = ResPathUtil.GetViewEffectPath("ui_Activity", "Com_window_R_Down");
|
|
SceneController.AddObjectToView(null, null, _ui.m_holderRightDowm, resPath2,
|
|
SceneController.AddObjectToView(null, null, _ui.m_holderRightDowm, resPath2,
|
|
out _gameObject2, out _wrapper2);
|
|
out _gameObject2, out _wrapper2);
|
|
@@ -145,7 +145,7 @@ namespace GFGGame
|
|
uiItemChild.m_loaIcon.onClick.Add(OnListSelectorItemClick);
|
|
uiItemChild.m_loaIcon.onClick.Add(OnListSelectorItemClick);
|
|
uiItemChild.m_txtNum.text = itemChildArr[1].ToString();
|
|
uiItemChild.m_txtNum.text = itemChildArr[1].ToString();
|
|
uiItemChild.m_txtSelNum.text = "0";
|
|
uiItemChild.m_txtSelNum.text = "0";
|
|
- uiItemChild.m_txtSelNum.onChanged.Add(OnChangedTxtSelNum);
|
|
|
|
|
|
+ uiItemChild.m_txtSelNum.onFocusOut.Add(OnChangedTxtSelNum);
|
|
uiItemChild.m_btnAdd.onClick.Add(OnBtnAddClick);
|
|
uiItemChild.m_btnAdd.onClick.Add(OnBtnAddClick);
|
|
uiItemChild.m_btnReduce.onClick.Add(OnChildBtnReduceClick);
|
|
uiItemChild.m_btnReduce.onClick.Add(OnChildBtnReduceClick);
|
|
|
|
|
|
@@ -310,23 +310,29 @@ namespace GFGGame
|
|
_selDic.TryGetValue(itemCfg.id, out var snumx);
|
|
_selDic.TryGetValue(itemCfg.id, out var snumx);
|
|
var snum = _selCount - snumx + txtSelNum;
|
|
var snum = _selCount - snumx + txtSelNum;
|
|
|
|
|
|
|
|
+ //输入的数量大于剩余闲置的量,就设置成最大闲置的量
|
|
if (snum > _count)
|
|
if (snum > _count)
|
|
{
|
|
{
|
|
- _selDic.TryGetValue(itemCfg.id, out var numx);
|
|
|
|
- listItem.m_txtSelNum.text = numx.ToString();
|
|
|
|
-
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (_selDic.TryGetValue(itemCfg.id, out int num))
|
|
|
|
- {
|
|
|
|
- _selDic[itemCfg.id] = txtSelNum;
|
|
|
|
|
|
+ //其他选择的量
|
|
|
|
+ var otherNum = _selDic.Where(a => a.Key != itemCfg.id).Select(a => a.Value).Sum();
|
|
|
|
+ //物品总量-其他物品选择的量=当前物品最大可以选择的量
|
|
|
|
+ var curSelTotalCount = _count - otherNum;
|
|
|
|
+ listItem.m_txtSelNum.text = curSelTotalCount.ToString();
|
|
|
|
+ _selDic[itemCfg.id] = curSelTotalCount;
|
|
_selCount = _selDic.Values.Sum();
|
|
_selCount = _selDic.Values.Sum();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- _selDic[itemCfg.id] = txtSelNum;
|
|
|
|
- _selCount = _selDic.Values.Sum();
|
|
|
|
|
|
+ if (_selDic.TryGetValue(itemCfg.id, out int num))
|
|
|
|
+ {
|
|
|
|
+ _selDic[itemCfg.id] = txtSelNum;
|
|
|
|
+ _selCount = _selDic.Values.Sum();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ _selDic[itemCfg.id] = txtSelNum;
|
|
|
|
+ _selCount = _selDic.Values.Sum();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
SetSelAllNum();
|
|
SetSelAllNum();
|
|
@@ -355,16 +361,19 @@ namespace GFGGame
|
|
private void OnBtnSubClick()
|
|
private void OnBtnSubClick()
|
|
{
|
|
{
|
|
List<GiftBoxSelChildItemProto> reqItemList = new List<GiftBoxSelChildItemProto>();
|
|
List<GiftBoxSelChildItemProto> reqItemList = new List<GiftBoxSelChildItemProto>();
|
|
-
|
|
|
|
|
|
+ _selDic = _selDic.Where(pair => pair.Value != 0).ToDictionary(pair => pair.Key, pair => pair.Value);
|
|
if (_selDic.Keys.Count > 0)
|
|
if (_selDic.Keys.Count > 0)
|
|
{
|
|
{
|
|
foreach (var itemKv in _selDic)
|
|
foreach (var itemKv in _selDic)
|
|
{
|
|
{
|
|
- reqItemList.Add(new GiftBoxSelChildItemProto
|
|
|
|
|
|
+ if (itemKv.Value != 0)
|
|
{
|
|
{
|
|
- ChildItemId = itemKv.Key,
|
|
|
|
- ChildItemCount = itemKv.Value
|
|
|
|
- });
|
|
|
|
|
|
+ reqItemList.Add(new GiftBoxSelChildItemProto
|
|
|
|
+ {
|
|
|
|
+ ChildItemId = itemKv.Key,
|
|
|
|
+ ChildItemCount = itemKv.Value
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
ItemProxy.ReqUseGiftBoxSelItem(_itemId, reqItemList).Coroutine();
|
|
ItemProxy.ReqUseGiftBoxSelItem(_itemId, reqItemList).Coroutine();
|