|
@@ -35,12 +35,14 @@ namespace GFGGame
|
|
|
this.modal = true;
|
|
|
viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
|
|
|
- _ui.m_btnClose.onClick.Add(Hide);
|
|
|
+ _ui.m_btnBack.onClick.Add(OnBtnBackClick);
|
|
|
_ui.m_btnGet.onClick.Add(OnBtnGetClick);
|
|
|
_ui.m_btnRule.onClick.Add(RuleController.ShowRuleView);
|
|
|
_ui.m_btnRule.data = 300003;
|
|
|
_ui.m_listBuy.itemRenderer = RenderListBuyItem;
|
|
|
+ _ui.m_listBuy.itemProvider = GetListBuyItemResource;
|
|
|
_ui.m_listGet.itemRenderer = RenderListGetItem;
|
|
|
+ _ui.m_listGet.itemProvider = GetListGetItemResource;
|
|
|
}
|
|
|
protected override void AddEventListener()
|
|
|
{
|
|
@@ -67,7 +69,10 @@ namespace GFGGame
|
|
|
EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBuyList);
|
|
|
EventAgent.RemoveEventListener(ConstMessage.LEAGUE_NUMBERIC_CHANGE, UpdateView);
|
|
|
}
|
|
|
-
|
|
|
+ private void OnBtnBackClick()
|
|
|
+ {
|
|
|
+ ViewManager.GoBackFrom(typeof(LeagueGiftView).FullName);
|
|
|
+ }
|
|
|
private void OnBtnCreatClick()
|
|
|
{
|
|
|
|
|
@@ -81,7 +86,7 @@ namespace GFGGame
|
|
|
{
|
|
|
_getDatas = LeagueDataManager.Instance.GetGiftGetDatas();
|
|
|
_ui.m_listGet.numItems = _getDatas.Count;
|
|
|
- _ui.m_txtTips.visible = _getDatas.Count == 0;
|
|
|
+ _ui.m_grpTips.visible = _getDatas.Count == 0;
|
|
|
}
|
|
|
private void UpdateBuyList()
|
|
|
{
|
|
@@ -90,23 +95,24 @@ namespace GFGGame
|
|
|
}
|
|
|
private void RenderListGetItem(int index, GObject obj)
|
|
|
{
|
|
|
- UI_ListGiftGetItem item = UI_ListGiftGetItem.Proxy(obj);
|
|
|
+ UI_ListGiftGetItemTop item = UI_ListGiftGetItemTop.Proxy(obj);
|
|
|
if (item.m_listGift.data == null)
|
|
|
{
|
|
|
item.m_listGift.itemRenderer = RenderListRewardItem;
|
|
|
}
|
|
|
item.m_listGift.data = _getDatas[index].GiftCfg.bonusArr;
|
|
|
item.m_listGift.numItems = _getDatas[index].GiftCfg.bonusArr.Length;
|
|
|
- UI_ListGiftGetItem.ProxyEnd();
|
|
|
+ UI_ListGiftGetItemTop.ProxyEnd();
|
|
|
}
|
|
|
private void RenderListBuyItem(int index, GObject obj)
|
|
|
{
|
|
|
- UI_ListGiftBuyItem item = UI_ListGiftBuyItem.Proxy(obj);
|
|
|
+ UI_ListGiftBuyItemTop item = UI_ListGiftBuyItemTop.Proxy(obj);
|
|
|
LeagueGiftBuyData buyData = _buyDatas[index];
|
|
|
string strCount = buyData.GiftCfg.limitType == 1 ? "今日剩余:{0}/{1}" : "本周剩余:{0}/{1}";
|
|
|
item.m_txtCount.text = string.Format(strCount, buyData.GiftCfg.limit - buyData.BuyCount, buyData.GiftCfg.limit);
|
|
|
int day = TimeUtil.FormattingTime11(TimeHelper.ServerNow(), buyData.EndTime);
|
|
|
- item.m_txtTime.text = buyData.EndTime == 0 ? "" : string.Format("(剩余{0}天)", day);
|
|
|
+ // item.m_txtTime.text = buyData.EndTime == 0 ? "" : string.Format("(剩余{0}天)", day);
|
|
|
+ item.m_txtTime.SetVar("value", buyData.EndTime == 0 ? "" : day.ToString());
|
|
|
ItemUtil.UpdateItemNeedNum(item.m_comCost, buyData.GiftCfg.consumeArr[0]);
|
|
|
|
|
|
if (item.m_listGift.data == null)
|
|
@@ -122,7 +128,7 @@ namespace GFGGame
|
|
|
}
|
|
|
item.m_btnBuy.data = buyData;
|
|
|
|
|
|
- UI_ListGiftBuyItem.ProxyEnd();
|
|
|
+ UI_ListGiftBuyItemTop.ProxyEnd();
|
|
|
}
|
|
|
private void RenderListRewardItem(int index, GObject obj)
|
|
|
{
|
|
@@ -133,10 +139,39 @@ namespace GFGGame
|
|
|
obj.data = new ItemView(obj as GComponent);
|
|
|
}
|
|
|
(obj.data as ItemView).SetData(itemData);
|
|
|
- (obj.data as ItemView).SetComItemScale = 0.7f;
|
|
|
+ (obj.data as ItemView).SetComItemScale = 0.6f;
|
|
|
(obj.data as ItemView).SetTxtCountPos(185, 155);
|
|
|
}
|
|
|
-
|
|
|
+ private string GetListGetItemResource(int index)
|
|
|
+ {
|
|
|
+ if (index < _ui.m_listBuy.columnCount)
|
|
|
+ {
|
|
|
+ return "ui://League/ListGiftGetItemTop";
|
|
|
+ }
|
|
|
+ else if (index >= _ui.m_listBuy.numItems - _ui.m_listBuy.columnCount - 1)
|
|
|
+ {
|
|
|
+ return "ui://League/ListGiftGetItemBottom";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return "ui://League/ListGiftGetItemCenter";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private string GetListBuyItemResource(int index)
|
|
|
+ {
|
|
|
+ if (index < _ui.m_listBuy.columnCount)
|
|
|
+ {
|
|
|
+ return "ui://League/ListGiftBuyItemTop";
|
|
|
+ }
|
|
|
+ else if (index >= _ui.m_listBuy.numItems - _ui.m_listBuy.columnCount - 1)
|
|
|
+ {
|
|
|
+ return "ui://League/ListGiftBuyItemBottom";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return "ui://League/ListGiftBuyItemCenter";
|
|
|
+ }
|
|
|
+ }
|
|
|
private void OnBtnBuyClick(EventContext context)
|
|
|
{
|
|
|
GObject obj = context.sender as GObject;
|
|
@@ -171,7 +206,12 @@ namespace GFGGame
|
|
|
}
|
|
|
private void OnBtnGetClick()
|
|
|
{
|
|
|
- // LeagueSproxy.ReqGetLeagueWelfare().Coroutine();
|
|
|
+ // bool result = await LeagueSproxy.ReqGetLeagueWelfare();
|
|
|
+ // if (result)
|
|
|
+ // {
|
|
|
+ // UpdateGetList();
|
|
|
+ // }
|
|
|
+ LeagueSproxy.ReqGetLeagueWelfare().Coroutine();
|
|
|
}
|
|
|
}
|
|
|
}
|