コード例 #1
0
        public void AdjustEndSubtick(LogicLevel level)
        {
            if (this.m_endTimestamp != -1)
            {
                int currentTime = LogicDataTables.GetGlobals().AdjustEndSubtickUseCurrentTime()
                    ? level.GetGameMode().GetServerTimeInSecondsSince1970()
                    : level.GetGameMode().GetStartTime();

                if (currentTime != -1)
                {
                    int remainingSecs = this.m_endTimestamp - currentTime;
                    int clamp         = LogicDataTables.GetGlobals().GetClampLongTimeStampsToDays();

                    if (clamp * 86400 > 0)
                    {
                        if (remainingSecs > 86400 * clamp)
                        {
                            remainingSecs = 86400 * clamp;
                        }
                        else if (remainingSecs < -86400 * clamp)
                        {
                            remainingSecs = -86400 * clamp;
                        }
                    }

                    this.m_remainingTime = level.GetLogicTime().GetTick() + LogicTime.GetSecondsInTicks(remainingSecs);
                }
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 public void FastForward(int totalSecs)
 {
     this.m_remainingTime -= LogicTime.GetSecondsInTicks(totalSecs);
 }