コード例 #1
0
ファイル: InputEvents.cs プロジェクト: rozniak/Junkbot
        /// <summary>
        /// Reports an input release.
        /// </summary>
        /// <param name="input">The fully-qualified input name.</param>
        public void ReportRelease(string input)
        {
            AssertNotReadOnly();

            if (ActiveDownedInputs.Contains(input))
                ActiveDownedInputs.Remove(input);
        }
コード例 #2
0
ファイル: InputEvents.cs プロジェクト: rozniak/Junkbot
        /// <summary>
        /// Performs a comparison of this input update versus the last, and finalizes
        /// the state so no further reports can be made.
        /// </summary>
        public void FinalizeForReporting()
        {
            AssertNotReadOnly();

            // Set up downed inputs
            //
            DownedInputs = new List<string>(ActiveDownedInputs).AsReadOnly();

            // Set up new presses
            //
            var newPresses = LastDownedInputs == null ?
                ActiveDownedInputs :
                ActiveDownedInputs.Except(LastDownedInputs);

            NewPresses = new List<string>(newPresses).AsReadOnly();

            // Set up new releases
            //
            var newReleases = LastDownedInputs == null ?
                new List<string>() :
                LastDownedInputs.Except(ActiveDownedInputs);

            NewReleases = new List<string>(newReleases).AsReadOnly();
            
            IsReadOnly = true;
        }
コード例 #3
0
ファイル: InputEvents.cs プロジェクト: rozniak/Junkbot
        /// <summary>
        /// Reports an input press.
        /// </summary>
        /// <param name="input">The fully-qualified input name.</param>
        public void ReportPress(string input)
        {
            AssertNotReadOnly();

            if (!ActiveDownedInputs.Contains(input))
                ActiveDownedInputs.Add(input);
        }