|
@@ -18,22 +18,32 @@ namespace GFGGame
|
|
public static void ExchangeItemById(int itemId, long num, bool showTips = true, Action onSuccess = null, bool openSource = false, int maxCount = 9990, bool showTxtBuyTips = false, string prefix = "")
|
|
public static void ExchangeItemById(int itemId, long num, bool showTips = true, Action onSuccess = null, bool openSource = false, int maxCount = 9990, bool showTxtBuyTips = false, string prefix = "")
|
|
{
|
|
{
|
|
|
|
|
|
- if (itemId == ConstItemID.GOLD)
|
|
|
|
- {
|
|
|
|
- AddGold(num, onSuccess);
|
|
|
|
- }
|
|
|
|
- else if (itemId == ConstItemID.POWER)
|
|
|
|
- {
|
|
|
|
- AddPower();
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
|
|
+ if (!BuyCurrency(itemId, onSuccess))
|
|
{
|
|
{
|
|
BuyItemConteoller.Show(itemId, num, ConstBuyType.TYPE_ITEM, onSuccess, showTips, openSource, maxCount);
|
|
BuyItemConteoller.Show(itemId, num, ConstBuyType.TYPE_ITEM, onSuccess, showTips, openSource, maxCount);
|
|
BuyItemConteoller.showTxtBuyTips = showTxtBuyTips;
|
|
BuyItemConteoller.showTxtBuyTips = showTxtBuyTips;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- public static void AddPower(string prefix = "", Action onSuccess = null, int type = 0)
|
|
|
|
|
|
+ public static bool BuyCurrency(int itemId, Action onSuccess = null)
|
|
|
|
+ {
|
|
|
|
+ switch (itemId)
|
|
|
|
+ {
|
|
|
|
+ case ConstItemID.GOLD:
|
|
|
|
+ AddGold(onSuccess);
|
|
|
|
+ return true;
|
|
|
|
+ case ConstItemID.POWER:
|
|
|
|
+ AddPower();
|
|
|
|
+ return true;
|
|
|
|
+ case ConstItemID.DIAMOND_RED:
|
|
|
|
+ AddDiamondRed();
|
|
|
|
+ return true;
|
|
|
|
+ case ConstItemID.DIAMOND_PURPLE:
|
|
|
|
+ ItemUtil.AddDiamondPurple();
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ public static void AddPower(Action onSuccess = null, int type = 0)
|
|
{
|
|
{
|
|
EnduringGiftBoxController.Show(ConstItemID.POWER, 1, () =>
|
|
EnduringGiftBoxController.Show(ConstItemID.POWER, 1, () =>
|
|
{
|
|
{
|
|
@@ -44,7 +54,7 @@ namespace GFGGame
|
|
}, "", type);
|
|
}, "", type);
|
|
}
|
|
}
|
|
|
|
|
|
- public static void AddGold(long value = 0, Action onSuccess = null, int type = 0)
|
|
|
|
|
|
+ public static void AddGold(Action onSuccess = null, int type = 0)
|
|
{
|
|
{
|
|
EnduringGiftBoxController.Show(ConstItemID.GOLD, 1, () =>
|
|
EnduringGiftBoxController.Show(ConstItemID.GOLD, 1, () =>
|
|
{
|
|
{
|
|
@@ -324,6 +334,6 @@ namespace GFGGame
|
|
(component.data as ItemView)?.SetData(itemData);
|
|
(component.data as ItemView)?.SetData(itemData);
|
|
(component.data as ItemView)?.ChangeTxtCountStyle();
|
|
(component.data as ItemView)?.ChangeTxtCountStyle();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|