chenxin
2020-12-12 000e8cbabb0639d2c4b90ebc28f08256f028d209
Assets/Scripts/TowerDefense/UI/HUD/EndlessRandomTower.cs
@@ -86,10 +86,7 @@
    public void UpdateDescDisplay()
    {
        int minLevel = 0;
        if (EndlessUIStart.instance.GameStartTime >= JsonDataCenter.DOUBLE_GEM_TIME)
            minLevel = Mathf.Min(EndlessGameUI.instance.MinLevel, 1);
        int minLevel = GameConfig.IsUpgradeTowerLevel ? 1 : 0;
        NormalDesc.text = $"购买{minLevel + 1}级宝石";
    }
@@ -229,7 +226,7 @@
        if (EndlessGameUI.instance.tdBuyDisable)
        {
            cashText.color = new Color(1f, 0f, 0f);
            cashText.color = new Color(218f / 255f, 32f / 255f, 32f / 255f);
            DOTween.To(() => cashText.color, (Color v) => cashText.color = v, cashText.color, 0.2f)
                .OnComplete(CheckCurrencyEnough);
            return;
@@ -261,7 +258,21 @@
    public void SetCountDown(bool isOn, bool isReset = false)
    {
        isCountStartDown = isOn;
        if (isReset) countDownTime = 0;
        if (isReset)
        {
            countDownTime = 0;
            if (needClickPS.isPlaying)
                needClickPS.Stop();
        }
    }
    public void SetPS(bool isOn)
    {
        if (needClickPS.gameObject.activeSelf != isOn)
        {
            needClickPS.gameObject.SetActive(isOn);
        }
    }
    float countDownTime = 0f;
    float countDownLimit = 5f;
@@ -274,7 +285,6 @@
        if (isCountStartDown)
        {
            countDownTime += Time.deltaTime;
            Debug.Log("倒计时中");
            if (countDownTime > countDownLimit)
            {
@@ -299,12 +309,24 @@
        if (current >= result && num < 10)//自己的钱多
        {
            //Debug.Log($"当前金币 :{current}  下一次购买需要金币:{result}  塔的数量:{num}");
            isCountStartDown = false;
            needClickPS.Play();
        }
    }
    public void CheckMoney()
    {
        int result;
        int.TryParse(cashText.text.ToString(), out result);
        int current = EndlessLevelManager.instance.Currency.currentCurrency;
        if (current < result && needClickPS.isPlaying)//自己的钱多
        {
            needClickPS.Stop();
            isCountStartDown = true;
            countDownTime = 0;
        }
    }
    private void CheckCurrencyEnough()
    {
@@ -331,15 +353,9 @@
        if (gameUI.isBuilding)
            gameUI.CancelGhostPlacement();
        if (EndlessUIStart.instance.GameStartTime >= JsonDataCenter.DOUBLE_GEM_TIME)
        if (level == -1)
        {
            if (level == -1)
                level = Mathf.Min(EndlessGameUI.instance.MinLevel, 1);
        }
        else
        {
            if (level == -1)
                level = 0;
            level = GameConfig.IsUpgradeTowerLevel ? 1 : 0;
        }
        return gameUI.RandomPlaceTower(tower, posx, posy, level, cost, false, isFirstAppear);