Exemplo n.º 1
0
    void Update()
    {
        if (isFinished)
        {
            return;
        }

        timeLeft = finishTime - DateTime.Now.Ticks;

        // Debug.Log($"Time Left : {timeLeft} : {timeLeft / TimeSpan.TicksPerSecond }");
        if (CheckCompleteTimer())
        {
            return;
        }

        if (slider == null)
        {
            return;
        }

        GetSlider();
        slider.GetComponent <Slider>().value = (((finishTime - activityInformation.startPoint) - timeLeft) / TimeSpan.TicksPerSecond) + 1;
        long timer = ((finishTime - activityInformation.startPoint) / TimeSpan.TicksPerSecond) - (((finishTime - activityInformation.startPoint) - timeLeft) / TimeSpan.TicksPerSecond);

        int hours   = Mathf.FloorToInt(timer / 3600);
        int minutes = Mathf.FloorToInt(timer % 3600 / 60);
        int seconds = Mathf.FloorToInt(timer % 3600 % 60f);

        int speedUpCostTemp = speedUpCost;

        activityInformation.currentPoint = timer;
        speedUpCost = ItemManager.Instance.GetSpeedUpCost(timer * 20);
        if (speedUpCostTemp != speedUpCost)
        {
            notificationPanel.ChangeSpeedUpCost(activityInformation, speedUpCost);
        }

        if (timerTemp != timer)
        {
            timerTemp = timer;
            slider.GetComponentInChildren <Text>().text = String.Format("{0:00}:{1:00}:{2:00}", hours, minutes, seconds);
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        if (isFinished)
        {
            return;
        }

        timer = (long)((activityInformation.requiredPoint - activityInformation.currentPoint) / productionPoint);
        if (CheckCompleteTimer())
        {
            return;
        }

        if (slider != null)
        {
            InitializeSlider();

            int hours   = Mathf.FloorToInt(timer / 3600);
            int minutes = Mathf.FloorToInt(timer % 3600 / 60);
            int seconds = Mathf.FloorToInt(timer % 3600 % 60f);

            if (timerTemp != timer)
            {
                timerTemp = timer;
                slider.GetComponent <Slider>().value        = activityInformation.currentPoint;
                slider.GetComponentInChildren <Text>().text = String.Format("{0:00}:{1:00}:{2:00}", hours, minutes, seconds);
            }

            int speedUpCostTemp = speedUpCost;

            speedUpCost = ItemManager.Instance.GetSpeedUpCost(timer * 20);
            if (speedUpCostTemp != speedUpCost)
            {
                notificationPanel.ChangeSpeedUpCost(activityInformation, speedUpCost);
            }
        }
    }