Ejemplo n.º 1
0
    private void updatePage()
    {
        List <UIIconButton> buttons = new List <UIIconButton>();

        buttons.Add(centerButton);

        buttonMap = new Dictionary <UISelectable, Character>();

        foreach (Character character in PlacementController.charactersToPlace)
        {
            Character    c          = character;
            UIIconButton iconButton = Instantiate(iconButtonPrefab);
            iconButton.SetIconSprite(character.identity.icon);
            iconButton.transform.SetParent(iconButtonParent);
            iconButton.onClick.AddListener(() => click(c));

            buttons.Add(iconButton);
        }

        for (int i = 0; i < buttons.Count; i++)
        {
            buttons[i].neighborLeft  = buttons[NeverdawnUtility.RepeatIndex(i - 1, buttons.Count)];
            buttons[i].neighborRight = buttons[NeverdawnUtility.RepeatIndex(i + 1, buttons.Count)];
        }

        buttons[0].Select();
    }
Ejemplo n.º 2
0
    void Start()
    {
        buttons = new List <UIIconButton>();

        foreach (AbilityBase ability in combatItem.abilities)
        {
            UIAbilityIconButton button = Instantiate(UIFactory.uiAbilityButton);
            button.ability = ability;
            button.menu    = menu;
            button.label   = label;

            buttons.Add(button);
        }

        UIIconButton buttonCancel = Instantiate(UIFactory.uiIconButton);

        buttonCancel.SetIconSprite(iconCancel);
        buttonCancel.onSelect.AddListener(() => label.text = labelCancel);
        buttonCancel.onClick.AddListener(() => menu.GoBack());
        buttons.Add(buttonCancel);

        for (int i = 0; i < buttons.Count; i++)
        {
            buttons[i].transform.SetParent(buttonParent);
            buttons[i].neighborLeft  = buttons[NeverdawnUtility.RepeatIndex(i - 1, buttons.Count)];
            buttons[i].neighborRight = buttons[NeverdawnUtility.RepeatIndex(i + 1, buttons.Count)];
        }
    }
Ejemplo n.º 3
0
    void Start()
    {
        buttons = new List <UIIconButton>();

        if (character.mannequin)
        {
            foreach (CombatItem item in character.mannequin.GetEquippedCombatItems())
            {
                UICombatItemIconButton combatItemButton = Instantiate(UIFactory.uiCombatItemButton);
                combatItemButton.combatItem = item;
                combatItemButton.menu       = menu;
                combatItemButton.label      = label;
                buttons.Add(combatItemButton);
            }
        }

        if (character.unarmed)
        {
            UICombatItemIconButton combatItemButton = Instantiate(UIFactory.uiCombatItemButton);
            combatItemButton.combatItem  = character.unarmed;
            combatItemButton.menu        = menu;
            combatItemButton.label       = label;
            combatItemButton.customLabel = "Self";
            buttons.Add(combatItemButton);
        }

        if (includeWalk)
        {
            AbilityBase walkAbility = Instantiate(CombatController.walkAbility);
            walkAbility.Initialize(character.gameObject);

            UIAbilityIconButton walkButton = Instantiate(UIFactory.uiAbilityButton);
            walkButton.ability = walkAbility;
            walkButton.menu    = menu;
            walkButton.label   = label;
            buttons.Add(walkButton);
        }

        if (includeDoNothing)
        {
            UIIconButton buttonDoNothing = Instantiate(UIFactory.uiIconButton);
            buttonDoNothing.SetIconSprite(iconDoNothing);
            buttonDoNothing.onSelect.AddListener(() => label.text = labelDoNothing);
            buttonDoNothing.onClick.AddListener(() => doNothing());
            buttons.Add(buttonDoNothing);
        }

        for (int i = 0; i < buttons.Count; i++)
        {
            buttons[i].transform.SetParent(buttonParent);
            buttons[i].neighborLeft  = buttons[NeverdawnUtility.RepeatIndex(i - 1, buttons.Count)];
            buttons[i].neighborRight = buttons[NeverdawnUtility.RepeatIndex(i + 1, buttons.Count)];
        }
    }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        List <UIIconButton> buttons = new List <UIIconButton>();

        buttonMap = new Dictionary <UISelectable, Character>();

        foreach (Character character in possibleTargets)
        {
            UIIconButton iconButton = Instantiate(iconButtonPrefab);
            iconButton.SetIconSprite(character.identity.icon);
            iconButton.transform.SetParent(iconButtonParent);

            buttonMap.Add(iconButton, character);

            buttons.Add(iconButton);
        }

        selectionController.peripherals = buttons.ToArray();
        selectionController.center      = cancelButton;
        selectionController.inputModule = avatarController.inputModule;
    }
 private void setIcon(UIIconButton button)
 {
     button.SetIconSprite(ability.icon);
 }