public void StartTimer(int totalSecs, LogicTime time, bool setEndTimestamp, int currentTimestamp)
        {
            this.m_remainingTime = LogicTime.GetSecondsInTicks(totalSecs) + time.GetTick();

            if (currentTimestamp != -1 && setEndTimestamp)
            {
                this.m_endTimestamp = currentTimestamp + totalSecs;
            }
        }
        public int GetRemainingMS(LogicTime time)
        {
            int remaining = this.m_remainingTime - time.GetTick() - this.m_fastForward;

            if (LogicDataTables.GetGlobals().MoreAccurateTime())
            {
                return(16 * remaining);
            }

            int ms = 1000 * (remaining / 60);

            if (ms % 60 != 0)
            {
                ms += (2133 * ms) >> 7;
            }

            return(ms);
        }
        public static LogicTimer GetLogicTimer(LogicJSONObject jsonObject, LogicTime time, string key, int maxTime)
        {
            LogicJSONNumber number = (LogicJSONNumber)jsonObject.Get(key);

            if (number != null)
            {
                LogicTimer timer = new LogicTimer();

                int remainingSeconds = LogicMath.Min(number.GetIntValue(), maxTime);
                int tick             = time.GetTick();

                timer.m_remainingTime = tick + LogicTime.GetSecondsInTicks(remainingSeconds);

                return(timer);
            }

            return(null);
        }
        public int GetRemainingSeconds(LogicTime time)
        {
            int remaining = this.m_remainingTime - time.GetTick() - this.m_fastForward;

            if (LogicDataTables.GetGlobals().MoreAccurateTime())
            {
                if (remaining > 0)
                {
                    return(LogicMath.Max((int)(16L * remaining / 1000 + 1), 1));
                }
            }
            else
            {
                if (remaining > 0)
                {
                    return(LogicMath.Max((remaining + 59) / 60, 1));
                }
            }

            return(0);
        }