コード例 #1
0
 public void Init(int id, bool realtime, float timeout, RepeatStyle repeat)
 {
     this._id       = id;
     this._realtime = realtime;
     this._timeout  = timeout;
     this._repeat   = repeat == RepeatStyle.eRepeat ? true : false;
     this._remains  = timeout;
     this._evt      = false;
 }
コード例 #2
0
        public Timer StartTimer(bool realtime, float timeout, RepeatStyle repeat)
        {
            int id = FindFreeSlot();

            if (id == -1)
            {
                Display("Timer.asc: timers limit reached, cannot start another timer before any of the active ones has stopped.");
                return(null);
            }
            Timer timer = new Timer();

            timer.Init(id, realtime, timeout, repeat);
            Timers[id] = timer;
            return(timer);
        }
コード例 #3
0
        private List <TokenExpression> ReadTokens(TokenReader reader, TokenType returnType, bool allowEmpty, RepeatStyle repeatStyle, params TokenType[] tokenTypes)
        {
            var token = reader.Peek();

            if (token == null)
            {
                return(null);
            }
            var list = new List <TokenExpression>();

            TokenType continuationToken;
            TokenType exitToken;

            switch (repeatStyle)
            {
            case RepeatStyle.RepeatUntilEndOfBlock:
                continuationToken = TokenType.Optional;
                exitToken         = TokenType.CloseBrace;
                break;

            case RepeatStyle.RepeatWithCommaUntilCloseParenthesis:
                continuationToken = TokenType.Comma;
                exitToken         = TokenType.ClosedParenthesis;
                break;

            case RepeatStyle.RepeatWithCommaUntilSemicolon:
                continuationToken = TokenType.Comma;
                exitToken         = TokenType.Semicolon;
                break;

            default:
                throw new ArgumentOutOfRangeException("returnType");
            }

            if (allowEmpty)
            {
                if (token.TokenType == exitToken)
                {
                    reader.Read();
                    goto leave;
                }
            }

            while (true)
            {
                if (tokenTypes.Length > 1)
                {
                    token = ReadToken(reader, returnType, tokenTypes);
                }
                else if (tokenTypes.Length == 1)
                {
                    token = ReadToken(reader, tokenTypes[0]);
                }
                if (token != null)
                {
                    list.Add(token);
                }
                if (token == null)
                {
                    return(null);
                }
                token = reader.Peek();
                if (token == null)
                {
                    return(null);
                }
                if (token.TokenType == exitToken)
                {
                    reader.Read();
                    break;
                }
                if (continuationToken != TokenType.Optional)
                {
                    if (token.TokenType != continuationToken)
                    {
                        return(null);
                    }
                    reader.Read();
                }
            }
leave:
            return(list);
        }
コード例 #4
0
 private List <TokenExpression> ReadTokens(TokenReader reader, bool allowEmpty, RepeatStyle repeatStyle, TokenType tokenType)
 {
     return(ReadTokens(reader, tokenType, allowEmpty, repeatStyle, tokenType));
 }
コード例 #5
0
 public static Timer StartTimer(bool realtime, float timeout, RepeatStyle repeat)
 {
     return(GlobalBase.TimerInstance.StartTimer(realtime, timeout, repeat));
 }
コード例 #6
0
 public static Timer StartRT(float timeout_s, RepeatStyle repeat = eOnce)
 {
     return(StartTimer(true, timeout_s, repeat));
 }
コード例 #7
0
 public static Timer Start(int timeout, RepeatStyle repeat = eOnce)
 {
     return(StartTimer(false, IntToFloat(timeout), repeat));
 }