Browse Source

雅集改名消耗

zhaoyang 2 years ago
parent
commit
89d02e0b32

+ 12 - 8
GameClient/Assets/Game/HotUpdate/Views/League/LeagueChangeNameView.cs

@@ -99,11 +99,13 @@ namespace GFGGame
             }
             if (_ui.m_c1.selectedIndex == 0)//改徽章
             {
-                int needCount = GlobalCfgArray.globalCfg.consumeChangeBadgeArr[0][1];
-                long hasCount = ItemDataManager.GetItemNum(GlobalCfgArray.globalCfg.consumeChangeBadgeArr[0][0]);
-                if (needCount > hasCount)
+                int costId = GlobalCfgArray.globalCfg.consumeChangeBadgeArr[0][1];
+                long needCount = ItemDataManager.GetItemNum(GlobalCfgArray.globalCfg.consumeChangeBadgeArr[0][1]);
+
+                if (!ItemUtil.CheckItemEnough(costId, needCount))
                 {
-                    PromptController.Instance.ShowFloatTextPrompt("消耗不足");
+                    long has = ItemDataManager.GetItemNum(costId);
+                    ItemUtil.BuyCurrency(costId, needCount - has);
                     return;
                 }
                 LeagueSproxy.ReqChangeLeagueNameOrIcon(2, GlobalCfgArray.globalCfg.badgeResArr[_ui.m_listIcon.selectedIndex]).Coroutine();
@@ -128,7 +130,7 @@ namespace GFGGame
                     PromptController.Instance.ShowFloatTextPrompt("雅集名字仅允许汉字、数字、下划线");
                     return;
                 }
-                
+
                 //判断是否和旧的名字一样
                 if (leagueName == LeagueDataManager.Instance.LeagueData.Name)
                 {
@@ -136,11 +138,13 @@ namespace GFGGame
                     return;
                 }
 
+                int costId = GlobalCfgArray.globalCfg.consumeChangeNameArr[0][0];
                 int needCount = GlobalCfgArray.globalCfg.consumeChangeNameArr[0][1];
-                long hasCount = ItemDataManager.GetItemNum(GlobalCfgArray.globalCfg.consumeChangeNameArr[0][0]);
-                if (needCount > hasCount)
+
+                if (!ItemUtil.CheckItemEnough(costId, needCount))
                 {
-                    PromptController.Instance.ShowFloatTextPrompt("消耗不足");
+                    long has = ItemDataManager.GetItemNum(costId);
+                    ItemUtil.BuyCurrency(costId, needCount - has);
                     return;
                 }
                 LeagueSproxy.ReqChangeLeagueNameOrIcon(1, leagueName).Coroutine();