|
@@ -8,7 +8,7 @@ namespace GFGGame
|
|
public class GiftBagBuyView : BaseWindow
|
|
public class GiftBagBuyView : BaseWindow
|
|
{
|
|
{
|
|
private UI_GiftBagBuyUI _ui;
|
|
private UI_GiftBagBuyUI _ui;
|
|
- private int _giftId;
|
|
|
|
|
|
+ private int _goodsId;
|
|
public override void Dispose()
|
|
public override void Dispose()
|
|
{
|
|
{
|
|
|
|
|
|
@@ -41,21 +41,15 @@ namespace GFGGame
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
{
|
|
{
|
|
base.OnShown();
|
|
base.OnShown();
|
|
- _giftId = (int)this.viewData;
|
|
|
|
- GiftBagCfg cfg = GiftBagCfgArray.Instance.GetCfg(_giftId);
|
|
|
|
- _ui.m_txtName.text = cfg.name;
|
|
|
|
- _ui.m_loaIcon.url = ResPathUtil.GetIconPath(cfg.res, "png");//string.Format("ui://RechargeStore/{0}", cfg.res);
|
|
|
|
- _ui.m_list.numItems = cfg.itemsArr.Length;
|
|
|
|
- _ui.m_c1.selectedIndex = ShopDataManager.Instance.GetShopGoodsStateById(_giftId) ? 0 : 1;
|
|
|
|
- if (cfg.lockType == LockType.STORY_LV)
|
|
|
|
- {
|
|
|
|
- StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(cfg.storyLevelId);
|
|
|
|
- _ui.m_txtLock.text = string.Format("通关{0}-{1}解锁", StoryUtil.GetChapterOrder(storyLevelCfg.chapterId), storyLevelCfg.order);
|
|
|
|
- }
|
|
|
|
- else if (cfg.lockType == LockType.ROLE_LV)
|
|
|
|
- {
|
|
|
|
- _ui.m_txtLock.text = string.Format("角色达到{0}级解锁", cfg.lv);
|
|
|
|
- }
|
|
|
|
|
|
+ _goodsId = (int)this.viewData;
|
|
|
|
+ ShopCfg cfg = ShopCfgArray.Instance.GetCfg(_goodsId);
|
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
|
|
|
|
+ _ui.m_txtName.text = itemCfg.name;
|
|
|
|
+ _ui.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);//string.Format("ui://RechargeStore/{0}", cfg.res);
|
|
|
|
+ _ui.m_list.numItems = itemCfg.itemsArr.Length;
|
|
|
|
+ _ui.m_c1.selectedIndex = ShopDataManager.Instance.GetShopGoodsStateById(_goodsId) ? 0 : 1;
|
|
|
|
+ _ui.m_txtLock.text = ShopDataManager.Instance.GetShopGoodsStateTips(cfg.id);
|
|
|
|
+
|
|
int buyNum = ShopDataManager.Instance.GetGoodsBuyNumById(cfg.id);
|
|
int buyNum = ShopDataManager.Instance.GetGoodsBuyNumById(cfg.id);
|
|
_ui.m_txtLimit.text = string.Format("{0}({1}/{2})", ShopDataManager.Instance.refreshType[cfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#DA8870"), cfg.maxBuyNum);
|
|
_ui.m_txtLimit.text = string.Format("{0}({1}/{2})", ShopDataManager.Instance.refreshType[cfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#DA8870"), cfg.maxBuyNum);
|
|
// if (cfg.refreshType == RefreshType.NONE) _ui.m_txtLimit.text = "永久限购";
|
|
// if (cfg.refreshType == RefreshType.NONE) _ui.m_txtLimit.text = "永久限购";
|
|
@@ -77,8 +71,8 @@ namespace GFGGame
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.costId);
|
|
|
|
- _ui.m_loaPriceIcon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
|
|
|
|
+ ItemCfg itemCostCfg = ItemCfgArray.Instance.GetCfg(cfg.costId);
|
|
|
|
+ _ui.m_loaPriceIcon.url = ResPathUtil.GetIconPath(itemCostCfg);
|
|
_ui.m_loaPriceIcon.visible = true;
|
|
_ui.m_loaPriceIcon.visible = true;
|
|
_ui.m_txtIcon.visible = false;
|
|
_ui.m_txtIcon.visible = false;
|
|
}
|
|
}
|
|
@@ -95,8 +89,9 @@ namespace GFGGame
|
|
|
|
|
|
private void ListItemRender(int index, GObject item)
|
|
private void ListItemRender(int index, GObject item)
|
|
{
|
|
{
|
|
- GiftBagCfg cfg = GiftBagCfgArray.Instance.GetCfg(_giftId);
|
|
|
|
- ItemData itemData = ItemUtil.createItemData(cfg.itemsArr[index]);
|
|
|
|
|
|
+ ShopCfg cfg = ShopCfgArray.Instance.GetCfg(_goodsId);
|
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
|
|
|
|
+ ItemData itemData = ItemUtil.createItemData(itemCfg.itemsArr[index]);
|
|
if (item.data == null)
|
|
if (item.data == null)
|
|
{
|
|
{
|
|
item.data = new ItemView(item as GComponent);
|
|
item.data = new ItemView(item as GComponent);
|
|
@@ -105,8 +100,8 @@ namespace GFGGame
|
|
}
|
|
}
|
|
private async void OnBtnBuyClick()
|
|
private async void OnBtnBuyClick()
|
|
{
|
|
{
|
|
-
|
|
|
|
- GiftBagCfg cfg = GiftBagCfgArray.Instance.GetCfg(_giftId);
|
|
|
|
|
|
+ ShopCfg cfg = ShopCfgArray.Instance.GetCfg(_goodsId);
|
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
|
|
if (cfg.costType == CostType.ITEM)
|
|
if (cfg.costType == CostType.ITEM)
|
|
{
|
|
{
|
|
long hasNum = ItemDataManager.GetItemNum(cfg.costId);
|
|
long hasNum = ItemDataManager.GetItemNum(cfg.costId);
|
|
@@ -116,7 +111,7 @@ namespace GFGGame
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- bool result = await RechargeSProxy.ReqBuyGiftBag(_giftId);
|
|
|
|
|
|
+ bool result = await RechargeSProxy.ReqBuyGiftBag(_goodsId);
|
|
if (result)
|
|
if (result)
|
|
{
|
|
{
|
|
LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
|
|
LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
|