Beispiel #1
0
 public string[] Parse()
 {
     for (int k = 0; k < input.Length; ++k)
     {
         input_char = input[k];
         Input_Type input_char_type = 0;
         if (input_char == ' ')
         {
             input_char_type = Input_Type.Space;
         }
         else if (input_char == '"')
         {
             input_char_type = Input_Type.Quote;
         }
         else
         {
             input_char_type = Input_Type.Character;
         }
         state = state_table[state.StateID, input_char_type];
         if (state.FetchAction != null)
         {
             state.FetchAction(this);
         }
     }
     state = state_table[state.StateID, Input_Type.Space];
     if (state.FetchAction != null)
     {
         state.FetchAction(this);
     }
     return(result.ToArray());
 }
Beispiel #2
0
 public ParseState this[byte state, Input_Type input]
 {
     get
     {
         return(states[state][input]);
     }
     set
     {
         if (!states.ContainsKey(state))
         {
             states[state] = new Dictionary <Input_Type, ParseState>();
         }
         states[state][input] = value;
     }
 }
Beispiel #3
0
            public void Get(bool _fixedUpdate_happened, Input_Type _input_type)
            {
                if (!m_enabled)
                {
                    down = false;
                    held = false;
                    up   = false;
                    return;
                }

                if (!m_getting_input)
                {
                    return;
                }

                switch (_input_type)
                {
                case Input_Type.Controller:
                    if (_fixedUpdate_happened)
                    {
                        down = Input.GetButtonDown(k_buttons_to_name[controller_buttons]);
                        held = Input.GetButton(k_buttons_to_name[controller_buttons]);
                        up   = Input.GetButtonUp(k_buttons_to_name[controller_buttons]);

                        m_after_fixed_update_down = down;
                        m_after_fixed_update_held = held;
                        m_after_fixed_update_up   = up;
                    }
                    else
                    {
                        down = Input.GetButtonDown(k_buttons_to_name[controller_buttons]) || m_after_fixed_update_down;
                        held = Input.GetButton(k_buttons_to_name[controller_buttons]) || m_after_fixed_update_held;
                        up   = Input.GetButtonUp(k_buttons_to_name[controller_buttons]) || m_after_fixed_update_up;

                        m_after_fixed_update_down |= down;
                        m_after_fixed_update_held |= held;
                        m_after_fixed_update_up   |= up;
                    }
                    break;

                case Input_Type.MouseAndKeyboard:
                    if (_fixedUpdate_happened)
                    {
                        down = Input.GetKeyDown(key);
                        held = Input.GetKey(key);
                        up   = Input.GetKeyUp(key);

                        m_after_fixed_update_down = down;
                        m_after_fixed_update_held = held;
                        m_after_fixed_update_up   = up;
                    }
                    else
                    {
                        down = Input.GetKeyDown(key) || m_after_fixed_update_down;
                        held = Input.GetKey(key) || m_after_fixed_update_held;
                        up   = Input.GetKeyUp(key) || m_after_fixed_update_up;

                        m_after_fixed_update_down |= down;
                        m_after_fixed_update_held |= held;
                        m_after_fixed_update_up   |= up;
                    }
                    break;
                }

                if (m_after_fixed_update_down)
                {
                    m_click_time_from_last_click = Time.time - m_last_click_time;
                }

                if (m_after_fixed_update_up)
                {
                    m_last_click_time = Time.time;
                }
            }