Exemple #1
0
    private void Start()
    {
        GameObject m = scrollview.GetChild(0).gameObject;

        for (int i = 0; i < shopitemlist.Count; i++)
        {
            if (Player.item[i] == 1 && i != 0 && i != 1)
            {
                GameObject gg = Instantiate(m, scrollview);
                gg.transform.GetChild(0).GetComponent <Image>().sprite          = shopitemlist[i].image;
                gg.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = shopitemlist[i].price.ToString();
                btn = gg.transform.GetChild(2).GetComponent <Button>();
                btn.transform.GetChild(0).GetComponent <Text>().text = "Ownd";
                btn.interactable = false;
                continue;
            }
            GameObject g = Instantiate(m, scrollview);
            g.transform.GetChild(0).GetComponent <Image>().sprite          = shopitemlist[i].image;
            g.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = shopitemlist[i].price.ToString();
            btn = g.transform.GetChild(2).GetComponent <Button>();
            if (i == 0 || i == 1)
            {
                btn.AddEvent(i, clickbomb);
            }
            else
            {
                btn.AddEvent(i, click);
            }
        }
        text.text = Player.coin.ToString();
        Destroy(m);
    }
            public RandoMenuItem(MenuButton baseObj, Vector2 position, string name, params T[] values)
            {
                if (string.IsNullOrEmpty(name))
                {
                    throw new ArgumentNullException(nameof(name));
                }

                if (baseObj == null)
                {
                    throw new ArgumentNullException(nameof(baseObj));
                }

                if (values == null || values.Length == 0)
                {
                    throw new ArgumentNullException(nameof(values));
                }

                _selections = values;
                Name        = name;

                Button = baseObj.Clone(name + "Button", MenuButton.MenuButtonType.Activate, position, string.Empty);

                _text          = Button.transform.Find("Text").GetComponent <Text>();
                _text.fontSize = 36;
                _align         = Button.gameObject.GetComponentInChildren <FixVerticalAlign>(true);

                Button.ClearEvents();
                Button.AddEvent(EventTriggerType.Submit, GotoNext);

                RefreshText();
            }
Exemple #3
0
        public MenuItem(Type valueType, MenuPage page, string name, IList items, MenuItemFormatter formatter) : base(page, name)
        {
            Name       = name;
            _align     = GameObject.GetComponentInChildren <FixVerticalAlign>(true);
            _formatter = formatter;
            ValueType  = valueType;
            Items      = items;

            Button.ClearEvents();
            Button.AddEvent(EventTriggerType.Submit, OnMenuItemClick);
        }
Exemple #4
0
 protected override void Awake()
 {
     close.AddEvent(OnClick_Close);
 }
Exemple #5
0
 protected override void Awake()
 {
     edit.AddEvent(OnClick_Edit);
     close.AddEvent(OnClick_Close);
 }
Exemple #6
0
 private void Awake()
 {
     backlobby.AddEvent(OnClick_BackLobby);
 }