Esempio n. 1
0
    private void ViewNormalTab()
    {
        SetActive((Enum)UI.OBJ_NORMAL, true);
        SetActive((Enum)UI.OBJ_TAB_ROOT, true);
        SetActive((Enum)UI.OBJ_ON_TAB_NORMAL, true);
        SetActive((Enum)UI.OBJ_ON_TAB_EVENT, false);
        SetActive((Enum)UI.OBJ_EVENT_LIST, false);
        PointShop shop = pointShop.First((PointShop x) => !x.isEvent);

        currentPointShopItem = GetBuyableItemList();
        if (filter != null)
        {
            filter.DoFiltering(ref currentPointShopItem);
        }
        SetLabelText((Enum)UI.LBL_NORMAL_POINT, string.Format(StringTable.Get(STRING_CATEGORY.POINT_SHOP, 2u), shop.userPoint));
        UITexture component = GetCtrl(UI.TEX_NORMAL_POINT_ICON).GetComponent <UITexture>();

        ResourceLoad.LoadPointIconImageTexture(component, (uint)shop.pointShopId);
        maxPage = currentPointShopItem.Count / GameDefine.POINT_SHOP_LIST_COUNT;
        if (currentPointShopItem.Count % GameDefine.POINT_SHOP_LIST_COUNT > 0)
        {
            maxPage++;
        }
        SetLabelText((Enum)UI.LBL_ARROW_NOW, (maxPage <= 0) ? "0" : currentPage.ToString());
        SetLabelText((Enum)UI.LBL_ARROW_MAX, maxPage.ToString());
        int item_num = Mathf.Min(GameDefine.POINT_SHOP_LIST_COUNT, currentPointShopItem.Count - (currentPage - 1) * GameDefine.POINT_SHOP_LIST_COUNT);

        SetGrid(UI.GRD_NORMAL, "PointShopListItem", item_num, true, delegate(int i, Transform t, bool b)
        {
            int index         = i + (currentPage - 1) * GameDefine.POINT_SHOP_LIST_COUNT;
            object event_data = new object[3]
            {
                currentPointShopItem[index],
                shop,
                new Action <PointShopItem, int>(OnBuy)
            };
            SetEvent(t, "CONFIRM_BUY", event_data);
            PointShopItemList component2 = t.GetComponent <PointShopItemList>();
            component2.SetUp(currentPointShopItem[index], (uint)shop.pointShopId, currentPointShopItem[index].needPoint <= shop.userPoint);
            int num          = -1;
            REWARD_TYPE type = (REWARD_TYPE)currentPointShopItem[index].type;
            if (type == REWARD_TYPE.ITEM)
            {
                num = MonoBehaviourSingleton <InventoryManager> .I.GetHaveingItemNum((uint)currentPointShopItem[index].itemId);
            }
            SetLabelText(t, UI.LBL_HAVE, string.Format(StringTable.Get(STRING_CATEGORY.POINT_SHOP, 6u), num.ToString()));
            SetActive(t, UI.LBL_HAVE, num >= 0);
        });
        bool flag = pointShop.Any((PointShop x) => x.isEvent);

        SetActive((Enum)UI.OBJ_EVENT_NON_ACTIVE, !flag);
        SetActive((Enum)UI.BTN_EVENT, flag);
    }
Esempio n. 2
0
    private void SetList()
    {
        currentPointShopItem = GetBuyableItemList();
        if (filter != null)
        {
            filter.DoFiltering(ref currentPointShopItem);
        }
        maxPage = currentPointShopItem.Count / GameDefine.POINT_SHOP_LIST_COUNT;
        if (currentPointShopItem.Count % GameDefine.POINT_SHOP_LIST_COUNT > 0)
        {
            maxPage++;
        }
        SetLabelText((Enum)UI.LBL_ARROW_NOW, (maxPage <= 0) ? "0" : currentPage.ToString());
        SetLabelText((Enum)UI.LBL_ARROW_MAX, maxPage.ToString());
        int item_num = Mathf.Min(GameDefine.POINT_SHOP_LIST_COUNT, currentPointShopItem.Count - (currentPage - 1) * GameDefine.POINT_SHOP_LIST_COUNT);

        SetGrid(UI.GRD_LIST, "PointShopListItem", item_num, true, delegate(int i, Transform t, bool b)
        {
            int index         = i + (currentPage - 1) * GameDefine.POINT_SHOP_LIST_COUNT;
            object event_data = new object[3]
            {
                currentPointShopItem[index],
                data,
                new Action <PointShopItem, int>(OnBuy)
            };
            SetEvent(t, "CONFIRM_BUY", event_data);
            PointShopItemList component = t.GetComponent <PointShopItemList>();
            component.SetUp(currentPointShopItem[index], (uint)data.pointShopId, currentPointShopItem[index].needPoint <= data.userPoint);
            int num          = -1;
            REWARD_TYPE type = (REWARD_TYPE)currentPointShopItem[index].type;
            if (type == REWARD_TYPE.ITEM)
            {
                num = MonoBehaviourSingleton <InventoryManager> .I.GetHaveingItemNum((uint)currentPointShopItem[index].itemId);
            }
            SetLabelText(t, UI.LBL_HAVE, string.Format(StringTable.Get(STRING_CATEGORY.POINT_SHOP, 6u), num.ToString()));
            SetActive(t, UI.LBL_HAVE, num >= 0);
        });
    }