Beispiel #1
0
        /// <summary>
        /// Create a new context
        /// </summary>
        /// <param name="name">Name of the context</param>
        /// <returns>Return a VirtualInput instance</returns>
        public VirtualInput CreateContext(string name)
        {
            if (_contextMap.ContainsKey(name)) throw new Exception(string.Format("A context named {0} already exists", name));
            VirtualInput vInput = new VirtualInput(_playerIndex);
            _contextMap.Add(name, vInput);

            return vInput;
        }
Beispiel #2
0
 /// <summary>
 /// Constructor of InputEvent class
 /// </summary>
 /// <param name="name">Name of the input event</param>
 /// <param name="owner">Owner of the input event</param>
 internal InputEvent(string name, VirtualInput owner)
 {
     Name = name;
     Owner = owner;
 }
Beispiel #3
0
        /// <summary>
        /// Set the current context
        /// </summary>
        /// <param name="name">Name of the context</param>
        public void SetCurrentContext(string name)
        {
            VirtualInput input;
            if (!_contextMap.TryGetValue(name, out input)) throw new Exception(string.Format("Failed to find a context named {0}", name));

            _currentContext = input;
        }
Beispiel #4
0
 /// <summary>
 /// Remove all context and reset the player
 /// </summary>
 public void Reset()
 {
     _contextMap.Clear();
     _currentContext = null;
 }