Beispiel #1
0
        public PinButton CreateButton(string name, PinButton.Mode mode, Action onClick)
        {
            var button = new GameObject(name, typeof(RectTransform)).AddComponent <PinButton>();

            button.transform.SetParent(transform, false);

            button.SetMode(mode);
            button.onClick += onClick;

            return(button);
        }
Beispiel #2
0
        public void SetMode(PinButton.Mode mode)
        {
            this.mode = mode;
            switch (mode)
            {
            case Mode.Add:
                image.sprite = addPinSprite;
                break;

            case Mode.Remove:
                image.sprite = removePinSprite;
                break;

            case Mode.Cross:
                image.sprite = crossSprite;
                break;
            }
            Update();
        }