/// <summary> /// Compare to another state. /// </summary> /// <param name="state"></param> /// <returns></returns> public string[] CompareTo(DirectInputState state) { var list = new List<string>(); list.AddRange(CompareAxisAndSliders(Axis, state.Axis, "Axis")); list.AddRange(CompareAxisAndSliders(Sliders, state.Sliders, "Slider")); // Compare Buttons if (Buttons.Length == state.Buttons.Length) { for (int i = 0; i < Buttons.Length; i++) { if (Buttons[i] != state.Buttons[i]) { list.Add(string.Format("Button {0}", i + 1)); } } }; // Compare POVs. if (Pows.Length == state.Pows.Length) { for (int i = 0; i < Pows.Length; i++) { if (Pows[i] != state.Pows[i]) { //list.Add(string.Format("DPad {0}", i + 1)); var v = state.Pows[0]; if ((DPadEnum)v == DPadEnum.Up) list.Add(string.Format("DPad {0} {1}", i + 1, DPadEnum.Up.ToString())); if ((DPadEnum)v == DPadEnum.Right) list.Add(string.Format("DPad {0} {1}", i + 1, DPadEnum.Right.ToString())); if ((DPadEnum)v == DPadEnum.Down) list.Add(string.Format("DPad {0} {1}", i + 1, DPadEnum.Down.ToString())); if ((DPadEnum)v == DPadEnum.Left) list.Add(string.Format("DPad {0} {1}", i + 1, DPadEnum.Left.ToString())); } } }; return list.ToArray(); }
/// <summary> /// Compare to another state. /// </summary> /// <param name="state"></param> /// <returns></returns> public string[] CompareTo(DirectInputState state) { var list = new List <string>(); list.AddRange(CompareAxisAndSliders(Axis, state.Axis, "Axis")); list.AddRange(CompareAxisAndSliders(Sliders, state.Sliders, "Slider")); // Compare Buttons if (Buttons.Length == state.Buttons.Length) { for (int i = 0; i < Buttons.Length; i++) { if (Buttons[i] != state.Buttons[i]) { list.Add(string.Format("Button {0}", i + 1)); } } } ; // Compare POVs. if (Pows.Length == state.Pows.Length) { for (int i = 0; i < Pows.Length; i++) { if (Pows[i] != state.Pows[i]) { //list.Add(string.Format("DPad {0}", i + 1)); var v = state.Pows[0]; if ((DPadEnum)v == DPadEnum.Up) { list.Add(string.Format("DPad {0} {1}", i + 1, DPadEnum.Up.ToString())); } if ((DPadEnum)v == DPadEnum.Right) { list.Add(string.Format("DPad {0} {1}", i + 1, DPadEnum.Right.ToString())); } if ((DPadEnum)v == DPadEnum.Down) { list.Add(string.Format("DPad {0} {1}", i + 1, DPadEnum.Down.ToString())); } if ((DPadEnum)v == DPadEnum.Left) { list.Add(string.Format("DPad {0} {1}", i + 1, DPadEnum.Left.ToString())); } } } } ; return(list.ToArray()); }