Beispiel #1
0
    public void Select(bool select)
    {
        if (isOpponentCardGroup)
        {
            if (select && Game.Instance.Opponent.cardGroupSelectedForBattle != null)
            {
                Game.Instance.Opponent.cardGroupSelectedForBattle.Select(false);
            }

            Game.Instance.Opponent.cardGroupSelectedForBattle = select ? this : null;
        }
        else
        {
            if (select && Game.Instance.Player.cardGroupSelectedForBattle != null)
            {
                Game.Instance.Player.cardGroupSelectedForBattle.Select(false);
            }

            Game.Instance.Player.cardGroupSelectedForBattle = select ? this : null;
        }

        spriteRenderer.color = select ? selectedColor : unselectedColor;

        if (select)
        {
            OnGroupSelected?.Invoke();
        }
    }
    public static void SelectGroup(int index)
    {
        if (_groups[index] == null)
        {
            return;
        }

        SelectShips(_groups[index].ships);
        OnGroupSelected?.Invoke(index);
    }
Beispiel #3
0
        public virtual void OnToggleValueChanged(bool value)
        {
            toggleGroup.allowSwitchOff = false;

            List <Toggle> active = toggleGroup.ActiveToggles().ToList();
            int           idx    = -1;

            if (active.Count == 1)
            {
                idx = toggles.IndexOf(active[0]);
                Debug.Log("active toggles " + active.Count + " itemId: " + idx);
                OnGroupSelected.Invoke(questionId, idx);
            }
            else if (active.Count == 0)
            {
                OnGroupSelected.Invoke(questionId, idx);
            }
            else
            {
                Debug.LogError("Error! multiple items are selected in a radio group");
            }
        }