private static void CheckWichTriggerToChange(string adding, string removing, Trigger trigger)
		{
			if (trigger.GetType() == typeof(KeyTrigger))
				ChangeKeyButtonInCommandList(adding, removing, trigger);
			if (trigger.GetType() == typeof(MouseButtonTrigger))
				ChangeMouseButtonInCommandList(adding, removing, trigger); //ncrunch: no coverage
			if (trigger.GetType() == typeof(GamePadButtonTrigger))
				ChangeGamepadButtonInCommandList(adding, removing, trigger);
		}
Пример #2
0
		private static void CheckWichTriggerTypeToChange(string adding, string key, Trigger trigger)
		{
			if (trigger.GetType() == typeof(KeyTrigger))
				ChangeKeyTriggerStateInCommandList(adding, key, trigger);
			//if (trigger.GetType() == typeof(MouseButtonTrigger))
			//	ChangeMouseButtonTriggerStateInCommandList(adding, key, trigger);
			if (trigger.GetType() == typeof(GamePadButtonTrigger))
				ChangeGamepadButtonTriggerStateInCommandList(adding, key, trigger);
		}
		private bool CheckTriggerTypeOfAlreadyHas(string adding, Trigger trigger)
		{
			if (trigger.GetType() == typeof(KeyTrigger))
				isAlreadyInList = CheckIfKeyTriggerIsInList(adding, trigger);
			if (trigger.GetType() == typeof(MouseButtonTrigger))
				isAlreadyInList = CheckIfMouseTriggerIsInList(adding, trigger); //ncrunch: no coverage
			if (trigger.GetType() == typeof(GamePadButtonTrigger))
				isAlreadyInList = CheckIfGamepadTriggerIsInList(adding, trigger);
			return isAlreadyInList;
		}
Пример #4
0
		private static void SetTrigger(Trigger trigger, XmlData xmlData)
		{
			XmlData child = null;
			if (trigger.GetType() == typeof(KeyTrigger))
			{
				var keyTrigger = trigger as KeyTrigger;
				child = new XmlData("KeyTrigger") { Value = keyTrigger.Key + " " + keyTrigger.State };
			}
			if (trigger.GetType() == typeof(MouseButtonTrigger))
			{
				var mouseButtonTrigger = trigger as MouseButtonTrigger;
				child = new XmlData("MouseButtonTrigger");
				child.Value = mouseButtonTrigger.Button + " " + mouseButtonTrigger.State;
			}
			if (trigger.GetType() == typeof(MouseDragDropTrigger))
			{
				var mouseDragDropTrigger = trigger as MouseDragDropTrigger;
				child = new XmlData("MouseDragAndDropTrigger");
				child.Value = mouseDragDropTrigger.Button.ToString();
			}
			if (trigger.GetType() == typeof(MouseHoldTrigger))
			{
				var mouseHoldTrigger = trigger as MouseHoldTrigger;
				child = new XmlData("MouseHoldTrigger");
				child.Value = mouseHoldTrigger.Button.ToString();
			}
			if (trigger.GetType() == typeof(MouseHoverTrigger))
				child = new XmlData("MouseHoverTrigger");
			if (trigger.GetType() == typeof(MouseMovementTrigger))
				child = new XmlData("MouseMovementTrigger");
			if (trigger.GetType() == typeof(GamePadButtonTrigger))
			{
				var gamePadButtonTrigger = trigger as GamePadButtonTrigger;
				child = new XmlData("GamePadButtonTrigger");
				child.Value = gamePadButtonTrigger.Button + " " + gamePadButtonTrigger.State;
			}
			if (trigger.GetType() == typeof(TouchPressTrigger))
			{
				var touchPressTrigger = trigger as TouchPressTrigger;
				child = new XmlData("TouchPressTrigger") { Value = touchPressTrigger.State.ToString() };
			}
			xmlData.AddChild(child);
		}
Пример #5
0
		private static bool CheckIfGamePadButtonIsALreadyUsed(Trigger newTrigger, object key,
			bool keyAlreadyUsed)
		{
			if (newTrigger.GetType() != typeof(GamePadButtonTrigger))
				return keyAlreadyUsed;
			var mouseButtonTrigger = (GamePadButtonTrigger)newTrigger;
			if (mouseButtonTrigger.Button.ToString() == key.ToString())
				keyAlreadyUsed = true;
			return keyAlreadyUsed;
		}
Пример #6
0
		private static bool CheckIfKeyIsAlreadyUsed(Trigger newTrigger, object key,
			bool keyAlreadyUsed)
		{
			if (newTrigger.GetType() != typeof(KeyTrigger))
				return keyAlreadyUsed;
			var keyTrigger = (KeyTrigger)newTrigger;
			if (keyTrigger.Key.ToString() == key.ToString())
				keyAlreadyUsed = true;
			return keyAlreadyUsed;
		}
Пример #7
0
		private void CheckWhichTriggerToAdd(Trigger trigger)
		{
			if (trigger.GetType() == typeof(KeyTrigger))
				AddKeyTriggerToList(trigger);
			if (trigger.GetType() == typeof(MouseButtonTrigger))
				AddMouseTriggerToList(trigger); //ncrunch: no coverage
			if (trigger.GetType() == typeof(MouseDragDropTrigger))
				AddMouseDragDropTriggerToList(trigger); //ncrunch: no coverage
			if (trigger.GetType() == typeof(MouseHoldTrigger))
				AddMouseHoldTriggerToList(trigger); //ncrunch: no coverage
			if (trigger.GetType() == typeof(MouseHoverTrigger))
				AddMouseHoverTriggerToList(); //ncrunch: no coverage
			if (trigger.GetType() == typeof(MouseMovementTrigger))
				AddMouseMovementTriggerToList(); //ncrunch: no coverage
			if (trigger.GetType() == typeof(GamePadButtonTrigger))
				AddGamePadTriggerToList(trigger);
			if (trigger.GetType() == typeof(TouchPressTrigger))
				AddTouchPadTriggerToList(trigger); //ncrunch: no coverage
		}