|
@@ -7,121 +7,121 @@ namespace GFGGame
|
|
|
{
|
|
|
public class GiftBagBuyView : BaseWindow
|
|
|
{
|
|
|
- private UI_GiftBagBuyUI _ui;
|
|
|
- private int _goodsId;
|
|
|
- public override void Dispose()
|
|
|
- {
|
|
|
+ // private UI_GiftBagBuyUI _ui;
|
|
|
+ // private int _goodsId;
|
|
|
+ // public override void Dispose()
|
|
|
+ // {
|
|
|
|
|
|
- if (_ui != null)
|
|
|
- {
|
|
|
- _ui.Dispose();
|
|
|
- }
|
|
|
- _ui = null;
|
|
|
- base.Dispose();
|
|
|
- }
|
|
|
- protected override void OnHide()
|
|
|
- {
|
|
|
- base.OnHide();
|
|
|
+ // if (_ui != null)
|
|
|
+ // {
|
|
|
+ // _ui.Dispose();
|
|
|
+ // }
|
|
|
+ // _ui = null;
|
|
|
+ // base.Dispose();
|
|
|
+ // }
|
|
|
+ // protected override void OnHide()
|
|
|
+ // {
|
|
|
+ // base.OnHide();
|
|
|
|
|
|
- }
|
|
|
- protected override void OnInit()
|
|
|
- {
|
|
|
- base.OnInit();
|
|
|
- packageName = UI_GiftBagBuyUI.PACKAGE_NAME;
|
|
|
- _ui = UI_GiftBagBuyUI.Create();
|
|
|
- this.viewCom = _ui.target;
|
|
|
- this.viewCom.Center();
|
|
|
- this.modal = true;
|
|
|
- viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
+ // }
|
|
|
+ // protected override void OnInit()
|
|
|
+ // {
|
|
|
+ // base.OnInit();
|
|
|
+ // packageName = UI_GiftBagBuyUI.PACKAGE_NAME;
|
|
|
+ // _ui = UI_GiftBagBuyUI.Create();
|
|
|
+ // this.viewCom = _ui.target;
|
|
|
+ // this.viewCom.Center();
|
|
|
+ // this.modal = true;
|
|
|
+ // viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
|
|
|
- _ui.m_btnBuy.onClick.Add(OnBtnBuyClick);
|
|
|
- _ui.m_list.itemRenderer = ListItemRender;
|
|
|
- }
|
|
|
+ // _ui.m_btnBuy.onClick.Add(OnBtnBuyClick);
|
|
|
+ // _ui.m_list.itemRenderer = ListItemRender;
|
|
|
+ // }
|
|
|
|
|
|
- protected override void OnShown()
|
|
|
- {
|
|
|
- base.OnShown();
|
|
|
- _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);
|
|
|
+ // protected override void OnShown()
|
|
|
+ // {
|
|
|
+ // base.OnShown();
|
|
|
+ // _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);
|
|
|
- _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 = "永久限购";
|
|
|
- _ui.m_txtEndTime.text = ShopDataManager.Instance.GetEndTime(cfg.id);
|
|
|
- _ui.m_grpEndTime.visible = cfg.endTime != "";
|
|
|
+ // 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);
|
|
|
+ // // if (cfg.refreshType == RefreshType.NONE) _ui.m_txtLimit.text = "永久限购";
|
|
|
+ // _ui.m_txtEndTime.text = ShopDataManager.Instance.GetEndTime(cfg.id);
|
|
|
+ // _ui.m_grpEndTime.visible = cfg.endTime != "";
|
|
|
|
|
|
- _ui.m_txtOriginalPrice.text = NumberUtil.ChangeNumberUnit(cfg.originalPrice);// cfg.originalPrice.ToString();
|
|
|
- if (cfg.price > 0 && cfg.costType != CostType.FREE)
|
|
|
- {
|
|
|
- _ui.m_grpOriginalPrice.visible = cfg.originalPrice > 0;
|
|
|
- _ui.m_grpIcon.visible = true;
|
|
|
- _ui.m_txtPrice.text = NumberUtil.ChangeNumberUnit(cfg.price);// cfg.price.ToString();
|
|
|
+ // _ui.m_txtOriginalPrice.text = NumberUtil.ChangeNumberUnit(cfg.originalPrice);// cfg.originalPrice.ToString();
|
|
|
+ // if (cfg.price > 0 && cfg.costType != CostType.FREE)
|
|
|
+ // {
|
|
|
+ // _ui.m_grpOriginalPrice.visible = cfg.originalPrice > 0;
|
|
|
+ // _ui.m_grpIcon.visible = true;
|
|
|
+ // _ui.m_txtPrice.text = NumberUtil.ChangeNumberUnit(cfg.price);// cfg.price.ToString();
|
|
|
|
|
|
- if (cfg.costType == CostType.RMB)
|
|
|
- {
|
|
|
- _ui.m_loaPriceIcon.visible = false;
|
|
|
- _ui.m_txtIcon.visible = true;
|
|
|
- _ui.m_txtIcon.text = "¥";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ItemCfg itemCostCfg = ItemCfgArray.Instance.GetCfg(cfg.costId);
|
|
|
- _ui.m_loaPriceIcon.url = ResPathUtil.GetIconPath(itemCostCfg);
|
|
|
- _ui.m_loaPriceIcon.visible = true;
|
|
|
- _ui.m_txtIcon.visible = false;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _ui.m_grpIcon.visible = false;
|
|
|
- _ui.m_grpOriginalPrice.visible = false;
|
|
|
- _ui.m_txtPrice.text = "免费";
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (cfg.costType == CostType.RMB)
|
|
|
+ // {
|
|
|
+ // _ui.m_loaPriceIcon.visible = false;
|
|
|
+ // _ui.m_txtIcon.visible = true;
|
|
|
+ // _ui.m_txtIcon.text = "¥";
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // ItemCfg itemCostCfg = ItemCfgArray.Instance.GetCfg(cfg.costId);
|
|
|
+ // _ui.m_loaPriceIcon.url = ResPathUtil.GetIconPath(itemCostCfg);
|
|
|
+ // _ui.m_loaPriceIcon.visible = true;
|
|
|
+ // _ui.m_txtIcon.visible = false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // _ui.m_grpIcon.visible = false;
|
|
|
+ // _ui.m_grpOriginalPrice.visible = false;
|
|
|
+ // _ui.m_txtPrice.text = "免费";
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
|
|
|
- private void ListItemRender(int index, GObject item)
|
|
|
- {
|
|
|
- ShopCfg cfg = ShopCfgArray.Instance.GetCfg(_goodsId);
|
|
|
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
|
|
|
- ItemData itemData = ItemUtil.createItemData(itemCfg.itemsArr[index]);
|
|
|
- if (item.data == null)
|
|
|
- {
|
|
|
- item.data = new ItemView(item as GComponent);
|
|
|
- }
|
|
|
- (item.data as ItemView).SetData(itemData);
|
|
|
- }
|
|
|
- private async void OnBtnBuyClick()
|
|
|
- {
|
|
|
- ShopCfg cfg = ShopCfgArray.Instance.GetCfg(_goodsId);
|
|
|
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
|
|
|
- if (cfg.costType == CostType.ITEM)
|
|
|
- {
|
|
|
- long hasNum = ItemDataManager.GetItemNum(cfg.costId);
|
|
|
- if (hasNum < cfg.price)
|
|
|
- {
|
|
|
- PromptController.Instance.ShowFloatTextPrompt("道具不足");
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- bool result = await RechargeSProxy.ReqBuyGiftBag(_goodsId);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
|
|
|
- this.Hide();
|
|
|
- if (cfg.costType == CostType.RMB)
|
|
|
- {
|
|
|
+ // private void ListItemRender(int index, GObject item)
|
|
|
+ // {
|
|
|
+ // ShopCfg cfg = ShopCfgArray.Instance.GetCfg(_goodsId);
|
|
|
+ // ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
|
|
|
+ // ItemData itemData = ItemUtil.createItemData(itemCfg.itemsArr[index]);
|
|
|
+ // if (item.data == null)
|
|
|
+ // {
|
|
|
+ // item.data = new ItemView(item as GComponent);
|
|
|
+ // }
|
|
|
+ // (item.data as ItemView).SetData(itemData);
|
|
|
+ // }
|
|
|
+ // private async void OnBtnBuyClick()
|
|
|
+ // {
|
|
|
+ // ShopCfg cfg = ShopCfgArray.Instance.GetCfg(_goodsId);
|
|
|
+ // ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
|
|
|
+ // if (cfg.costType == CostType.ITEM)
|
|
|
+ // {
|
|
|
+ // long hasNum = ItemDataManager.GetItemNum(cfg.costId);
|
|
|
+ // if (hasNum < cfg.price)
|
|
|
+ // {
|
|
|
+ // PromptController.Instance.ShowFloatTextPrompt("道具不足");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // bool result = await RechargeSProxy.ReqBuyGiftBag(_goodsId);
|
|
|
+ // if (result)
|
|
|
+ // {
|
|
|
+ // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
|
|
|
+ // this.Hide();
|
|
|
+ // if (cfg.costType == CostType.RMB)
|
|
|
+ // {
|
|
|
|
|
|
- PromptController.Instance.ShowFloatTextPrompt("虚拟充值购买成功");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // PromptController.Instance.ShowFloatTextPrompt("虚拟充值购买成功");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
}
|