Beispiel #1
0
    protected override List <ButtonData> CreateMyButtonData()
    {
        var itemData = (ItemDBData)UIController.Instance.GetFlashData_static("item");
        var result   = new List <ButtonData>();
        int maxNum   = ShopDB.GetBuyableCount(itemData);

        for (int i = 1; i <= maxNum; i++)
        {
            UnityEvent click = new UnityEvent();
            int        num   = i;
            click.AddListener(() =>
            {
                UIController.Instance.SetFlashData("num", num.ToString());
                UIController.Instance.SetFlashData("item", itemData);
                _MyUIBase.AddUI(_nextUI);
            });
            var    price  = itemData._data._price * i;
            Action cursor = () =>
            {
                _priceText.text = $"{price}G";
            };
            var add = new ButtonData(i.ToString(), click, cursor, ButtonData.ButtonType.Selectable);
            result.Add(add);
        }
        return(result);
    }
Beispiel #2
0
    protected override List <ButtonData> CreateMyButtonData()
    {
        var result = new List <ButtonData>();;

        foreach (var item in ResourceDB_mono.Instance._nowShopData._itemList)
        {
            var bttype      = (ShopDB.GetBuyableCount(item) == 0) ? ButtonData.ButtonType.Unselectable : ButtonData.ButtonType.Selectable;
            var clickAction = new UnityEvent();
            clickAction.AddListener(() => {
                UIController.Instance.SetFlashData("item", item);
                _MyUIBase.AddUI(_nextUI);
            });
            var add = new ButtonData(item._data._displayName, clickAction, bttype);
            add._buttonImage   = item._data._itemImage;
            add._additonalText = $"{item._data._price}G";
            result.Add(add);
        }
        return(result);
    }