Beispiel #1
0
 private void ClickSelect(ObjectUseBase select)
 {
     if (select.IsSelect == StateSelect.UNSELECT)
     {
         UnSelectEvent?.Invoke();
         select.IsSelect = StateSelect.SELECT;
         SelectShip      = (UIShipUse)select;
         EventSelectShip?.Invoke(SelectShip);
     }
 }
Beispiel #2
0
    public void OnSelectShip(UIShipUse ship)
    {
        payAndPlayButton.onClick.RemoveAllListeners();

        if (ship.IsLock == StateLock.LOCK)
        {
            _shipManager.Name.text = $"{ship.Name} ({ship.Cost} coins)";

            payAndPlayButton.GetComponentInChildren <Text>().text = "Pay";
            payAndPlayButton.onClick.AddListener(OnPay);
        }
        else
        {
            payAndPlayButton.GetComponentInChildren <Text>().text = "Play";
            payAndPlayButton.onClick.AddListener(OnPlay);
        }
    }
Beispiel #3
0
    private void Start()
    {
        foreach (UIShipUse shipPrefab in _shipPrefabs)
        {
            UIShipUse ship   = Instantiate(shipPrefab, Vector3.zero, Quaternion.identity, Content.transform);
            var       config = Saving.Instance.data.Ships.Find(conf => conf.Name == ship.Name);
            if (config != null)
            {
                ship.IsLock   = config.Lock;
                ship.IsSelect = config.Select;
            }
            ship.EventClickSelect += ClickSelect;
        }

        if (Saving.Instance.data.Ships.Count == 0)
        {
            var ships = Content.GetComponentsInChildren <UIShipUse>();
            ships[0].IsSelect = StateSelect.SELECT;
            ships[0].IsLock   = StateLock.UNLOCK;
        }
    }