|
@@ -3,14 +3,18 @@ using UI.CommonGame;
|
|
|
using FairyGUI;
|
|
|
using System.Collections.Generic;
|
|
|
using ET;
|
|
|
+using System;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
|
public class StoreChargeAddUpView : BaseWindow
|
|
|
{
|
|
|
- private UI_StoreGiftBagUI _ui;
|
|
|
+ private UI_StoreChargeAddUpUI _ui;
|
|
|
private ValueBarController _valueBarController;
|
|
|
private List<ShopCfg> _shopCfgs;
|
|
|
+ private DressUpObjUI _dressUpObjUI;
|
|
|
+ private List<DressUpObjUI> _dressUpObjUIs = new List<DressUpObjUI>();
|
|
|
+ private int _curSelectIndex = 0;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -19,10 +23,24 @@ namespace GFGGame
|
|
|
_valueBarController.Dispose();
|
|
|
_valueBarController = null;
|
|
|
}
|
|
|
+ if (_dressUpObjUI != null)
|
|
|
+ {
|
|
|
+ _dressUpObjUI.Dispose();
|
|
|
+ _dressUpObjUI = null;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < _dressUpObjUIs.Count; i++)
|
|
|
+ {
|
|
|
+ if (_dressUpObjUIs[i] != null)
|
|
|
+ {
|
|
|
+ _dressUpObjUIs[i].Dispose();
|
|
|
+ _dressUpObjUIs[i] = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (_ui != null)
|
|
|
{
|
|
|
_ui.Dispose();
|
|
|
}
|
|
|
+
|
|
|
_ui = null;
|
|
|
base.Dispose();
|
|
|
}
|
|
@@ -30,14 +48,22 @@ namespace GFGGame
|
|
|
protected override void OnInit()
|
|
|
{
|
|
|
base.OnInit();
|
|
|
- packageName = UI_StoreGiftBagUI.PACKAGE_NAME;
|
|
|
- _ui = UI_StoreGiftBagUI.Create();
|
|
|
+ packageName = UI_StoreChargeAddUpUI.PACKAGE_NAME;
|
|
|
+ _ui = UI_StoreChargeAddUpUI.Create();
|
|
|
this.viewCom = _ui.target;
|
|
|
isfullScreen = true;
|
|
|
this.clickBlankToClose = false;
|
|
|
|
|
|
- _ui.m_list.itemRenderer = ListItemRenderer;
|
|
|
+ _dressUpObjUI = new DressUpObjUI("SceneSuitFoster");
|
|
|
_valueBarController = new ValueBarController(_ui.m_valueBar);
|
|
|
+
|
|
|
+ _ui.m_list.itemRenderer = ListItemRenderer;
|
|
|
+ _ui.m_list.SetVirtual();
|
|
|
+ _ui.m_list.scrollPane.onScrollEnd.Add(UpdateSuitView);
|
|
|
+ _ui.m_list.scrollPane.decelerationRate = 0.8f;
|
|
|
+
|
|
|
+ _ui.m_btnLeft.onClick.Add(OnBtnLeftClick);
|
|
|
+ _ui.m_btnRight.onClick.Add(OnBtnRightClick);
|
|
|
}
|
|
|
protected override void AddEventListener()
|
|
|
{
|
|
@@ -46,11 +72,13 @@ namespace GFGGame
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
- int menu2 = (int)this.viewData;
|
|
|
- _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_GIFT_BAG, menu2);
|
|
|
- _shopCfgs = ShopDataManager.Instance.SortShopGoodsCfgs(_shopCfgs);
|
|
|
- _ui.m_list.numItems = _shopCfgs.Count;
|
|
|
_valueBarController.OnShown();
|
|
|
+
|
|
|
+ _ui.m_list.numItems = VipCfgArray.Instance.dataArray.Length - 1;
|
|
|
+ _curSelectIndex = Math.Max(0, RoleDataManager.vipLv - 1);
|
|
|
+ _ui.m_list.selectedIndex = _curSelectIndex;
|
|
|
+ _ui.m_list.ScrollToView(_curSelectIndex);
|
|
|
+ ShopViewManager.Instance.UpdateVipProgressCom(_ui.m_comVipLv.target);
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -63,11 +91,119 @@ namespace GFGGame
|
|
|
base.RemoveEventListener();
|
|
|
}
|
|
|
|
|
|
+ private void RefreshList()
|
|
|
+ {
|
|
|
|
|
|
+ }
|
|
|
private void ListItemRenderer(int index, GObject obj)
|
|
|
{
|
|
|
- ShopCfg shopCfg = _shopCfgs[index];
|
|
|
- ShopViewManager.Instance.UptadeItem(obj, shopCfg);
|
|
|
+ VipCfg lastVipCfg = VipCfgArray.Instance.dataArray[index];
|
|
|
+ VipCfg vipCfg = VipCfgArray.Instance.dataArray[index + 1];
|
|
|
+ UI_ListVipItem item = UI_ListVipItem.Proxy(obj);
|
|
|
+ string name = SuitCfgArray.Instance.GetCfg(vipCfg.suitId).name;
|
|
|
+ item.m_txtName0.text = name.Length > 0 ? name.Substring(0, 1) : "";
|
|
|
+ item.m_txtName1.text = name.Length > 1 ? name.Substring(1, 1) : "";
|
|
|
+ item.m_txtName2.text = name.Length > 2 ? name.Substring(2, 1) : "";
|
|
|
+ item.m_txtName3.text = name.Length > 3 ? name.Substring(3, 1) : "";
|
|
|
+ item.m_txtName4.text = name.Length > 4 ? name.Substring(4) : "";
|
|
|
+
|
|
|
+ item.m_txtGiftBag.SetVar("value", vipCfg.id.ToString()).FlushVars();
|
|
|
+ if (item.m_listGiftBag.data == null)
|
|
|
+ {
|
|
|
+ item.m_listGiftBag.itemRenderer = ListRewardItemRender;
|
|
|
+ }
|
|
|
+ item.m_listGiftBag.data = lastVipCfg.bonusOnceArr;
|
|
|
+ item.m_listGiftBag.numItems = lastVipCfg.bonusOnceArr.Length;
|
|
|
+
|
|
|
+ item.m_txtWeekGiftBag.SetVar("value", vipCfg.id.ToString()).FlushVars();
|
|
|
+ if (item.m_listWeekGiftBag.data == null)
|
|
|
+ {
|
|
|
+ item.m_listWeekGiftBag.itemRenderer = ListRewardItemRender;
|
|
|
+ }
|
|
|
+ item.m_listWeekGiftBag.data = vipCfg.bonusWeekArr;
|
|
|
+ item.m_listWeekGiftBag.numItems = vipCfg.bonusWeekArr.Length;
|
|
|
+
|
|
|
+ if (item.m_holder.data == null)
|
|
|
+ {
|
|
|
+ DressUpObjUI dressUpObjUI = new DressUpObjUI("SceneSuitFoster");
|
|
|
+ item.m_holder.data = dressUpObjUI;
|
|
|
+ _dressUpObjUIs.Add(dressUpObjUI);
|
|
|
+ }
|
|
|
+ _dressUpObjUI = item.m_holder.data as DressUpObjUI;
|
|
|
+ _dressUpObjUI.ResetSceneObj(90, false, true, null, false);
|
|
|
+ _dressUpObjUI.dressUpObj.PutOnSuitCfg(vipCfg.suitId, true, new int[] { ConstDressUpItemType.BEI_JING }, true, false);
|
|
|
+ _dressUpObjUI.UpdateWrapper(item.m_holder);
|
|
|
+
|
|
|
+ if (item.m_btnGetGiftBag.data == null)
|
|
|
+ {
|
|
|
+ item.m_btnGetGiftBag.onClick.Add(OnBtnGetGiftBagClick);
|
|
|
+ }
|
|
|
+ item.m_btnGetGiftBag.data = vipCfg.id;
|
|
|
+ bool isGet = MathHelper.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.VipGetStatus), vipCfg.id);
|
|
|
+ item.m_btnGetGiftBag.enabled = !isGet;
|
|
|
+ if (item.m_btnGetWeekGiftBag.data == null)
|
|
|
+ {
|
|
|
+ item.m_btnGetWeekGiftBag.onClick.Add(OnBtnGetWeekGiftBagClick);
|
|
|
+ }
|
|
|
+ item.m_btnGetWeekGiftBag.data = vipCfg.id;
|
|
|
+ bool isWeekGet = MathHelper.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.VipWeekGetStatus), vipCfg.id);
|
|
|
+ item.m_btnGetWeekGiftBag.enabled = !isWeekGet;
|
|
|
+ UI_ListVipItem.ProxyEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ListRewardItemRender(int index, GObject obj)
|
|
|
+ {
|
|
|
+ int[][] rewards = (int[][])obj.parent.data;
|
|
|
+
|
|
|
+ if (obj.data == null)
|
|
|
+ {
|
|
|
+ obj.data = new ItemView(obj as GComponent);
|
|
|
+ }
|
|
|
+ ItemData itemData = ItemUtil.createItemData(rewards[index]);
|
|
|
+ (obj.data as ItemView).SetData(itemData);
|
|
|
+ (obj.data as ItemView).ChangeTxtCountStyle();
|
|
|
+ }
|
|
|
+ private void OnBtnGetGiftBagClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject obj = context.sender as GObject;
|
|
|
+ int vipLv = (int)obj.data;
|
|
|
+ if (RoleDataManager.vipLv < vipLv)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("会员等级不足");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ShopSProxy.ReqGetVipGiftBag(vipLv).Coroutine();
|
|
|
+ }
|
|
|
+ private void OnBtnGetWeekGiftBagClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject obj = context.sender as GObject;
|
|
|
+ int vipLv = (int)obj.data;
|
|
|
+ if (RoleDataManager.vipLv < vipLv)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("会员等级不足");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ShopSProxy.ReqGetVipWeekGiftBag(vipLv).Coroutine();
|
|
|
+ }
|
|
|
+ private void OnBtnLeftClick()
|
|
|
+ {
|
|
|
+
|
|
|
+ if (_curSelectIndex == 0) return;
|
|
|
+ _curSelectIndex = _curSelectIndex - 1;
|
|
|
+ _ui.m_list.ScrollToView(_curSelectIndex, true);
|
|
|
+ _ui.m_list.selectedIndex = _curSelectIndex;
|
|
|
+ }
|
|
|
+ private void OnBtnRightClick()
|
|
|
+ {
|
|
|
+ if (_curSelectIndex == _ui.m_list.numItems - 1) return;
|
|
|
+ _curSelectIndex = _curSelectIndex + 1;
|
|
|
+ _ui.m_list.ScrollToView(_curSelectIndex, true);
|
|
|
+ _ui.m_list.selectedIndex = _curSelectIndex;
|
|
|
+ }
|
|
|
+ private void UpdateSuitView()
|
|
|
+ {
|
|
|
+ _curSelectIndex = _ui.m_list.GetFirstChildInView();
|
|
|
+ _ui.m_list.selectedIndex = _curSelectIndex;
|
|
|
}
|
|
|
}
|
|
|
}
|