public JumperGame(JumperEngine engine, Grid gameGrid, int numberOfRows = 6) : base(gameGrid, "jumper") { this.engine = engine; userControls = Finder.FindElementsWithTag(allControls, "UserControls"); setUserControlsEnabled(false); foreach (Control c in userControls) { (c as Button).Click += addToAnswer; } this.numberOfRows = numberOfRows; answer = new int[] { 0, 0, 0, 0 }; setMainDisp(allControls); setCorrectCombinationDisplay(allControls); nextRowButton = (Button)Finder.FindElementWithTag(allControls, "NextRowButton"); nextRowButton.Click += startGame; nextRowButton.IsEnabled = true; engine.Subscribe(mainDisp); GUIElements.Add(mainDisp); }
public override void OnInspectorGUI() { #if UNITY_5_6_OR_NEWER serializedObject.UpdateIfRequiredOrScript(); #else serializedObject.UpdateIfDirtyOrScript(); #endif GUILayout.Space(5); if (basicEditor.boolValue) { drawHit(); if (GUIElements.BasicHelpBox(TEXT_HELP)) { basicEditor.boolValue = false; Repaint(); } } else { drawHit(); drawAdvanced(); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { #if UNITY_5_6_OR_NEWER serializedObject.UpdateIfRequiredOrScript(); #else serializedObject.UpdateIfDirtyOrScript(); #endif GUILayout.Space(5); var display = GUIElements.Header(TEXT_SMOOTHING_HEADER, enableSmoothing, enableSmoothing, enableSmoothing_prop); if (display) { EditorGUI.indentLevel++; using (new EditorGUI.DisabledGroupScope(!enableSmoothing.boolValue)) { instance.SmoothingFactor = EditorGUILayout.FloatField(TEXT_SMOOTHING_FACTOR, instance.SmoothingFactor); EditorGUILayout.LabelField(TEXT_SMOOTHING_FACTOR_DESC, GUIElements.HelpBox); instance.PositionThreshold = EditorGUILayout.FloatField(TEXT_POSITION_THRESHOLD, instance.PositionThreshold); instance.RotationThreshold = EditorGUILayout.FloatField(TEXT_ROTATION_THRESHOLD, instance.RotationThreshold); instance.ScaleThreshold = EditorGUILayout.FloatField(TEXT_SCALE_THRESHOLD, instance.ScaleThreshold); EditorGUILayout.PropertyField(allowChangingFromOutside, TEXT_ALLOW_CHANGING); } EditorGUI.indentLevel--; } EditorGUILayout.PropertyField(limitYAxis, TEXT_LIMIT_Y_AXIS); EditorGUILayout.LabelField(TEXT_HELP, GUIElements.HelpBox); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); GUILayout.Space(5); EditorGUILayout.PropertyField(useDPI, TEXT_DPI_HEADER); if (useDPI.boolValue) { EditorGUILayout.PropertyField(cursorSize, TEXT_POINTER_SIZE); } else { EditorGUILayout.PropertyField(cursorPixelSize, TEXT_POINTER_PIXEL_SIZE); } var display = GUIElements.Header(TEXT_CURSORS_HEADER, cursorsProps); if (display) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(mousePointerProxy, new GUIContent("Mouse Pointer Proxy")); EditorGUILayout.PropertyField(touchPointerProxy, new GUIContent("Touch Pointer Proxy")); EditorGUILayout.PropertyField(penPointerProxy, new GUIContent("Pen Pointer Proxy")); EditorGUILayout.PropertyField(objectPointerProxy, new GUIContent("Object Pointer Proxy")); EditorGUI.indentLevel--; } serializedObject.ApplyModifiedProperties(); }
public JumperGame(MetroPanel gamePanel, int numberOfRows = 6) : base(new JumperEngine(4), gamePanel) { List <Control> jumperControls = Finder.GetAllElementsInPanel(gamePanel); engine = mainEngine as JumperEngine; userControls = Finder.FindElementsWithTag(jumperControls, "UserControls"); foreach (Control c in userControls) { c.MouseClick += addToAnswer; c.Enabled = false; } this.numberOfRows = numberOfRows; answer = new int[] { 0, 0, 0, 0 }; setMainDisp(jumperControls); setCorrectCombinationDisplay(jumperControls); nextRowButton = Finder.FindElementWithTag(jumperControls, "NextRowButton"); nextRowButton.MouseClick += startGame; nextRowButton.Enabled = true; engine.Subscribe(mainDisp); GUIElements.Add(mainDisp); }
/// <summary> Finishes the game. </summary> public override void GameOver() { ScoreInterface.Instance.StopTimeControler(); foreach (Control c in userControls) { c.Enabled = false; } GUIElements.Remove(mainDisp); for (int i = 0; i < correctCombinationDisplay.NumberOfElements; i++) { correctCombinationDisplay.Update(IntToImageConverter.Instance.Convert(engine.GetCombination()[i])); correctCombinationDisplay.Show(); correctCombinationDisplay.CurrentElement++; } if (engine.Check(answer)) { Grader(); } GameManager.Instance.NextGame(); }
public override void OnInspectorGUI() { #if UNITY_5_6_OR_NEWER serializedObject.UpdateIfRequiredOrScript(); #else serializedObject.UpdateIfDirtyOrScript(); #endif GUILayout.Space(5); if (basicEditor.boolValue) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(emulateSecondMousePointer, TEXT_EMULATE_MOUSE); if (EditorGUI.EndChangeCheck()) { instance.EmulateSecondMousePointer = emulateSecondMousePointer.boolValue; } if (GUIElements.BasicHelpBox(TEXT_HELP)) { basicEditor.boolValue = false; Repaint(); } } else { drawGeneral(); drawWindows(); drawWebGL(); } serializedObject.ApplyModifiedProperties(); base.OnInspectorGUI(); }
public MyNumberControler(IAnimatableGUI gui, MyNumberEngine engine, Grid grid, int numberOfFields = 9) : base(grid, "mynumber") { if (gui is MyNumberComposite) { this.gui = gui as MyNumberComposite; } else { throw new ArgumentException("Wrong GUI type"); } this.engine = engine; engine.Subscribe(gui); engine.Broadcast(engine.GetAllNumbers()); expression = string.Empty; expressionDisplay = new Display(Finder.FindElementWithTag(allControls, "ExpressionDisplay")); GUIElements.Add(expressionDisplay); graphicalElements.Add(gui); anims.Add(gui); gui.Enable(false); this.numberOfFields = numberOfFields; }
public override void OnInspectorGUI() { #if UNITY_5_6_OR_NEWER serializedObject.UpdateIfRequiredOrScript(); #else serializedObject.UpdateIfDirtyOrScript(); #endif GUILayout.Space(5); if (basicEditor != null && basicEditor.boolValue) { drawLayers(); if (GUIElements.BasicHelpBox(TEXT_HELP)) { basicEditor.boolValue = false; Repaint(); } } else { drawDefaults(); drawLayers(); drawUnityEvents(); drawSendMessage(); drawDebug(); } GUILayout.Label("v. " + TouchManager.VERSION + (string.IsNullOrEmpty(TouchManager.VERSION_SUFFIX) ? "" : " " + TouchManager.VERSION_SUFFIX), GUIElements.SmallTextRight); serializedObject.ApplyModifiedProperties(); }
private void drawDefaults() { var display = GUIElements.Header(TEXT_DEFAULTS_HEADER, shouldCreateCameraLayer); if (display) { EditorGUI.indentLevel++; using (new EditorGUI.DisabledGroupScope(Application.isPlaying)) { EditorGUILayout.PropertyField(shouldCreateCameraLayer, TEXT_CREATE_CAMERA_LAYER); EditorGUILayout.PropertyField(shouldCreateStandardInput, TEXT_CREATE_STANDARD_INPUT); } var r = EditorGUILayout.GetControlRect(true, 16f, EditorStyles.objectField); var label = EditorGUI.BeginProperty(r, TEXT_DISPLAY_DEVICE, displayDevice); EditorGUI.BeginChangeCheck(); r = EditorGUI.PrefixLabel(r, label); var newDevice = EditorGUI.ObjectField(r, instance.DisplayDevice as Object, typeof(IDisplayDevice), true) as IDisplayDevice; if (EditorGUI.EndChangeCheck()) { instance.DisplayDevice = newDevice; EditorUtility.SetDirty(instance); } EditorGUI.EndProperty(); EditorGUI.indentLevel--; } }
private void drawSendMessage() { var display = GUIElements.Header(TEXT_USE_SEND_MESSAGE_HEADER, useSendMessage, useSendMessage, useSendMessage_prop); if (display) { EditorGUI.indentLevel++; using (new EditorGUI.DisabledGroupScope(!useSendMessage.boolValue)) { EditorGUILayout.PropertyField(sendMessageTarget, TEXT_SEND_MESSAGE_TARGET); var r = EditorGUILayout.GetControlRect(true, 16f, EditorStyles.layerMaskField); var label = EditorGUI.BeginProperty(r, TEXT_SEND_MESSAGE_EVENTS, sendMessageEvents); EditorGUI.BeginChangeCheck(); r = EditorGUI.PrefixLabel(r, label); var sMask = (TouchManager.MessageType)EditorGUI.EnumFlagsField(r, instance.SendMessageEvents); if (EditorGUI.EndChangeCheck()) { instance.SendMessageEvents = sMask; EditorUtility.SetDirty(instance); } EditorGUI.EndProperty(); } EditorGUI.indentLevel--; } }
public void CloseGUI() { OnClose(); GUIActive = false; if (RemoveOnClose) { GUIElements.Remove(this); } }
public override void OnInspectorGUI() { if (layerButtonStyle == null) { layerButtonStyle = new GUIStyle(EditorStyles.miniButton); layerButtonStyle.fontSize = 9; layerButtonStyle.contentOffset = new Vector2(0, 0); } serializedObject.Update(); GUI.changed = false; EditorGUILayout.PropertyField(liveDPI, new GUIContent("Live DPI", TEXT_LIVEDPI)); EditorGUILayout.PropertyField(editorDPI, new GUIContent("Editor DPI", TEXT_EDITORDPI)); showLayers = GUIElements.Foldout(showLayers, new GUIContent(String.Format("Layers ({0})", layers.arraySize)), () => { EditorGUILayout.BeginVertical(); for (int i = 0; i < layers.arraySize; i++) { var layer = layers.GetArrayElementAtIndex(i).objectReferenceValue as TouchLayer; string name; if (layer == null) { name = "Unknown"; } else { name = layer.Name; } var rect = EditorGUILayout.BeginHorizontal(GUIElements.BoxStyle, GUILayout.Height(23)); EditorGUILayout.LabelField(name, GUIElements.BoxLabelStyle, GUILayout.ExpandWidth(true)); if (GUILayout.Button(new GUIContent("v", TEXT_MOVEDOWN), layerButtonStyle, GUILayout.Width(20), GUILayout.Height(18))) { layers.MoveArrayElement(i, i + 1); } else if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject(layer); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); GUILayout.Space(5f); if (GUILayout.Button("Refresh", GUILayout.MaxWidth(100))) { refresh(); } }); serializedObject.ApplyModifiedProperties(); }
private void drawWebGL() { var display = GUIElements.Header(TEXT_WEBGL_HEADER, webglProps); if (display) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(webGLTouch); EditorGUI.indentLevel--; } }
private void drawAdvanced() { var display = GUIElements.Header(TEXT_ADVANCED_HEADER, advancedProps); if (display) { EditorGUI.indentLevel++; doDrawAdvanced(); EditorGUI.indentLevel--; } }
private void drawHit() { var display = GUIElements.Header(TEXT_HIT_HEADER, hitProps); if (display) { EditorGUI.indentLevel++; doDrawHit(); EditorGUI.indentLevel--; } }
protected override void drawOtherGUI() { var display = GUIElements.Header(TEXT_PROJECTION_HEADER, projectionProps); if (display) { EditorGUI.indentLevel++; customProjection = drawProjection(customProjection); EditorGUILayout.Space(); EditorGUI.indentLevel--; } }
public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); EditorGUILayout.PropertyField(projection, new GUIContent("Projection Type", TEXT_PROJECTION)); if (projection.enumValueIndex != (int)Transform2DGestureBase.ProjectionType.Camera) { GUIElements.CompactVector3(new GUIContent("Projection Normal", TEXT_PROJECTIONNORMAL), projectionNormal); } serializedObject.ApplyModifiedProperties(); base.OnInspectorGUI(); }
/// <summary> Finishes the game. </summary> public override void GameOver() { ScoreInterface.Instance.StopTimeControler(); setUserControlsEnabled(false); GUIElements.Remove(mainDisp); showCorrectCombinationDisplay(); Grader(); GameManager.Instance.NextGame(); }
public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); var limitTouches = (minTouches.intValue > 0) || (maxTouches.intValue > 0); var newLimitTouches = EditorGUILayout.ToggleLeft(LIMIT_TOUCHES, limitTouches); if (newLimitTouches) { if (!limitTouches) { minTouchesFloat = 0; maxTouchesFloat = 10; } EditorGUI.indentLevel++; EditorGUILayout.LabelField("Min: " + (int)minTouchesFloat + ", Max: " + (int)maxTouchesFloat); EditorGUILayout.MinMaxSlider(ref minTouchesFloat, ref maxTouchesFloat, 0, 10); EditorGUI.indentLevel--; } else { if (limitTouches) { minTouchesFloat = 0; maxTouchesFloat = 0; } } minTouches.intValue = (int)minTouchesFloat; maxTouches.intValue = (int)maxTouchesFloat; EditorGUI.BeginChangeCheck(); var expanded = GUIElements.BeginFoldout(advanced.isExpanded, TEXT_ADVANCED_HEADER); if (EditorGUI.EndChangeCheck()) { advanced.isExpanded = expanded; } if (expanded) { GUILayout.BeginVertical(GUIElements.FoldoutStyle); drawAdvanced(); GUILayout.EndVertical(); } GUIElements.EndFoldout(); drawFriendlyGestures(); serializedObject.ApplyModifiedProperties(); }
private void drawLayers() { var display = GUIElements.Header(TEXT_LAYERS_HEADER, layers); if (display) { EditorGUILayout.LabelField(TEXT_LAYERS_HELP, GUIElements.HelpBox); EditorGUI.indentLevel++; using (new EditorGUI.DisabledGroupScope(Application.isPlaying)) { layersList.DoLayoutList(); } EditorGUI.indentLevel--; } }
private void drawWindows() { var display = GUIElements.Header(TEXT_WINDOWS_HEADER, windowsProps); if (display) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(windows8Touch, TEXT_WINDOWS8); EditorGUILayout.PropertyField(windows7Touch, TEXT_WINDOWS7); EditorGUILayout.LabelField(TEXT_WINDOWS_API, GUIElements.HelpBox); EditorGUILayout.PropertyField(windows8Mouse, TEXT_WINDOWS8_MOUSE); EditorGUILayout.PropertyField(windows7Mouse, TEXT_WINDOWS7_MOUSE); EditorGUILayout.PropertyField(universalWindowsMouse, TEXT_UWP_MOUSE); EditorGUI.indentLevel--; } }
private void drawGeneral() { var display = GUIElements.Header(TEXT_GENERAL_HEADER, generalProps); if (display) { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(emulateSecondMousePointer, TEXT_EMULATE_MOUSE); if (EditorGUI.EndChangeCheck()) { instance.EmulateSecondMousePointer = emulateSecondMousePointer.boolValue; } EditorGUI.indentLevel--; } }
public LoLGameControler(LoLGUI mainDisplay, LoLEngine engine, Grid gameGrid) : base(gameGrid, "letteronletter") { this.engine = engine; this.mainDisplay = mainDisplay; engine.Subscribe(mainDisplay); engine.Broadcast(engine.GetLetters()); answer = string.Empty; wordDisplay = new Display(Finder.FindElementWithTag(allControls, "CurrentWord")); checkDisplay = Finder.FindElementWithTag(allControls, "CheckFeedback") as TextBox; graphicalElements.Add(mainDisplay); GUIElements.Add(wordDisplay); anims.Add(mainDisplay); }
protected virtual void drawFriendlyGestures() { EditorGUI.BeginChangeCheck(); var expanded = GUIElements.BeginFoldout(friendlyGestures.isExpanded, new GUIContent(string.Format("Friendly gestures ({0})", friendlyGestures.arraySize), TEXT_FRIENDLY_HEADER)); if (EditorGUI.EndChangeCheck()) { friendlyGestures.isExpanded = expanded; } if (expanded) { GUILayout.BeginVertical(GUIElements.FoldoutStyle); drawGestureList(friendlyGestures, addFriendlyGesture); GUILayout.EndVertical(); } GUIElements.EndFoldout(); }
private void drawAdvanced() { EditorGUI.BeginChangeCheck(); var expanded = GUIElements.BeginFoldout(advanced.isExpanded, new GUIContent("Advanced", TEXT_FRIENDLY_HEADER)); if (EditorGUI.EndChangeCheck()) { advanced.isExpanded = expanded; } if (expanded) { GUILayout.BeginVertical(GUIElements.FoldoutStyle); drawSendMessage(); drawCombineTouches(); drawRequireToFail(); GUILayout.EndVertical(); } GUIElements.EndFoldout(); }
private void drawUnityEvents() { var display = GUIElements.Header(TEXT_USE_UNITY_EVENTS_HEADER, useUnityEvents, useUnityEvents, useUnityEvents_prop); if (display) { EditorGUI.indentLevel++; using (new EditorGUI.DisabledGroupScope(!useUnityEvents.boolValue)) { EditorGUILayout.PropertyField(OnFrameStart); EditorGUILayout.PropertyField(OnFrameFinish); EditorGUILayout.PropertyField(OnPointersAdd); EditorGUILayout.PropertyField(OnPointersUpdate); EditorGUILayout.PropertyField(OnPointersPress); EditorGUILayout.PropertyField(OnPointersRelease); EditorGUILayout.PropertyField(OnPointersRemove); EditorGUILayout.PropertyField(OnPointersCancel); } EditorGUI.indentLevel--; } }
public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); EditorGUI.BeginChangeCheck(); var expanded = GUIElements.BeginFoldout(advanced.isExpanded, new GUIContent("Advanced", TEXT_ADVANCED_HEADER)); if (EditorGUI.EndChangeCheck()) { advanced.isExpanded = expanded; } if (expanded) { GUILayout.BeginVertical(GUIElements.FoldoutStyle); drawAdvanced(); GUILayout.EndVertical(); } GUIElements.EndFoldout(); serializedObject.ApplyModifiedProperties(); }
public LoLGame(MetroPanel gamePanel) : base(new LoLEngine(12), gamePanel) { List <Control> WoWControls = Finder.GetAllElementsInPanel(gamePanel); letterDisp = Finder.FindElementsWithTag(WoWControls, "CharacterDisplayButton"); foreach (Control b in letterDisp) { b.MouseClick += addToAnswer; b.Enabled = false; } usedLetters = new List <Control>(); currentWordDisplay = new Display(Finder.FindElementWithTag(WoWControls, "CurrentWord")); longestWordDisplay = new Display(Finder.FindElementWithTag(WoWControls, "LongestWord")); mainDisp = new LoLDisplay(letterDisp.ToArray(), letterDisp.Count); engine = mainEngine as LoLEngine; engine.Subscribe(mainDisp); GUIElements.Add(mainDisp); GUIElements.Add(currentWordDisplay); GUIElements.Add(longestWordDisplay); anims.Add(mainDisp); checkBox = Finder.FindElementWithTag(WoWControls, "CheckFeedback"); check = Finder.FindElementWithTag(WoWControls, "CheckerButton"); check.MouseClick += wordFeedback; submit = Finder.FindElementWithTag(WoWControls, "SSButton"); submit.MouseClick += ssClick; undo = Finder.FindElementWithTag(WoWControls, "UndoButton"); undo.MouseClick += undoLastLetter; answer = ""; engine.Broadcast(engine.GetLetters()); }
private void drawGeneral() { var display = GUIElements.Header(TEXT_GENERAL_HEADER, generalProps); if (display) { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(emulateSecondMousePointer, TEXT_EMULATE_MOUSE); if (EditorGUI.EndChangeCheck()) { instance.EmulateSecondMousePointer = emulateSecondMousePointer.boolValue; } GUILayout.BeginHorizontal(); GUILayout.Label(TEXT_FAKE_GESTURE.text); EditorGUILayout.EnumPopup(instance.FakeGestureType); GUILayout.EndHorizontal(); EditorGUI.indentLevel--; } }