コード例 #1
0
    public void RefreshBoostSlots()
    {
        var boosts = PlayerManager.Instance.BoostsSlotsActive;

        int b = 0;

        foreach (var boostSlot in _boostSlots)
        {
            BoostSlot boost = b >= boosts.Count ? null : boosts[b];
            boostSlot.Init(boost);

            b++;
        }

        foreach (var boostChoice in _boostChoices)
        {
            boostChoice.InitDataOnly(boostChoice.boostData);
        }

        if (boosts.Count >= GlobalProps.BOOST_LIMIT.GetInt())
        {
            btnBoostAddSlot.interactable = false;
            txtBoostAddSlot.text         = "<color=#dddddd>NO MORE\nSLOTS\nAVAILABLE</color>"; //<size=-5></size>
        }
        else
        {
            btnBoostAddSlot.interactable = true;
            var cost = CurrencyManager.ParseToCost(GlobalProps.BOOST_SLOT_COST.GetString());
            txtBoostAddSlot.text = "ADD SLOT\n<size=-3>FOR {0} {1}</size>".Format2(cost.amount, cost.type);
        }
    }
コード例 #2
0
    public float GetBoost(BoostType type)
    {
        //print(" ||||| [Boosts] Re-implement me");
        //return 1f;
        if (BoostsSlotsActive.Count <= 0)
        {
            return(1f);
        }

        BoostSlot boost = BoostsSlotsActive.Find(b => b.data != null && b.data.boostType == type);

        if (boost == null)
        {
            return(1f);
        }
        return(boost.data.value);
    }
コード例 #3
0
    public void Init(BoostSlot boostSlot)
    {
        Image bg = this.GetComponent <Image>();

        if (boostSlot == null || boostSlot.data == null || boostSlot.count == 0)
        {
            badge.gameObject.SetActive(false);
            icon.gameObject.SetActive(false);
            bg.color = (boostSlot == null) ? COLOR_DISABLED : COLOR_ENABLED;
            return;
        }

        badge.gameObject.SetActive(true);
        icon.gameObject.SetActive(true);
        bg.color = COLOR_ENABLED;

        txtCount.text = boostSlot.count.ToString();

        InitDataOnly(boostSlot.data);
    }