/// <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; }
/// <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; }
/// <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; }
/// <summary> /// Remove all context and reset the player /// </summary> public void Reset() { _contextMap.Clear(); _currentContext = null; }