private void OnEnable() { // Reference the selected client client = (SimpleClient)target; // Get a reference to the serialized connection property connection = serializedObject.FindProperty("Connection"); // Load configuration data AmqpConfigurationEditor.LoadConfiguration(); // Restore the connection index var connectionNames = AmqpConfigurationEditor.GetConnectionNames(); for (var i = 0; i < connectionNames.Length; i++) { var cName = connectionNames[i]; if (connection.stringValue == cName) { index = i; break; } } lightGreen = CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.LightGreen); lightRed = CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.LightRed); lightYellow = CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.LightYellow); }
private void DrawSearchResults() { Rect resultLine = new Rect(0, 0, 300, 40); if (locationQuery != null) { if (locationQuery.searchResults.Count > 0) { if (lightGreen == null) { lightGreen = CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.LightGreen); } for (int i = 0; i < locationQuery.searchResults.Count; i++) { Location location = locationQuery.searchResults[i]; resultLine.y = (resultLine.height * (i + 1)); GUILayout.BeginArea(resultLine); GUILayout.Label(location.ToString(), lightGreen); GUILayout.EndArea(); if (resultLine.Contains(Event.current.mousePosition)) { Debug.Log("mouseOver " + location); if (Event.current.type == EventType.MouseUp) { TileManager.OriginLatitude = location.lat; TileManager.OriginLongitude = location.lon; Debug.Log("Set YouAreHere to " + location.ToString()); SetDirty(); } } } } } }
static void Init() { Debug.Log("Init"); clients = FindObjectsOfType <SimpleClient>(); // Load configuration data AmqpConfigurationEditor.LoadConfiguration(); //Restore the connection index RestoreConfigurationIndex(); osmMapRect = new OSMMapRect(); // Prepare GUI-Styles lightGreen = CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.LightGreen); lightRed = CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.LightRed); lightYellow = CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.LightYellow); darkgrey = CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.DarkGrey); timerFontStyle.font = (Font)Resources.Load("digitalmono"); timerFontStyle.fontSize = 34; // Get existing open window or if none, make a new one: window = (SimpleClientEditorWindow)EditorWindow.GetWindow(typeof(SimpleClientEditorWindow)); window.Show(); }
static void Init() { here = Resources.Load("here") as Texture2D; lightGreen = CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.LightGreen); }
/// <summary> /// GUI of the FlatEarthCreator /// </summary> public void OnGUI() { clients = FindObjectsOfType <SimpleClient>(); if (clients == null) { GUILayout.Label("No Clients available...", lightRed); Debug.Log("No Clients available..."); return; } if (clients.Length == 0) { GUILayout.Label("No Clients available...", lightRed); Debug.Log("No Clients available.."); return; } foreach (SimpleClient item in clients) { if (item.ServerMode) { client = item; break; } } if (client == null) { return; } CheckDone(); GUILayout.BeginArea(new Rect(0, 0, position.width, 39), CustomGUIUtils.GetColorBackgroundStyle(XKCDColors.Bluegrey)); CustomGUIUtils.BeginGroup(5); GUILayout.BeginHorizontal(); Color normalColor = GUI.backgroundColor; GUI.backgroundColor = selectedMenu == 0 ? XKCDColors.LightGrey : Color.grey; if (GUILayout.Button("Client Settings", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)) || selectedMenu == 0) { selectedMenu = 0; } GUI.backgroundColor = selectedMenu == 1 ? XKCDColors.LightGrey : Color.grey; if (GUILayout.Button("FlatEarth Creation", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)) || selectedMenu == 1) { selectedMenu = 1; } GUI.backgroundColor = selectedMenu == 2 ? XKCDColors.LightGrey : Color.grey; if (GUILayout.Button("Worker Status", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)) || selectedMenu == 2) { selectedMenu = 2; } GUI.backgroundColor = normalColor; if (GUILayout.Button("Reset Everything", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) { client.ResetMaster(); startTime = null; stopTime = null; } #region Timer string timer; if (stopTime == null) { timer = startTime != null?startTime.Duration() : "00:00:00.000"; } else { timer = TimeStamp.Duration(TimeStamp.Duration(startTime, stopTime)); } if (timerFontStyle == null) { timerFontStyle.font = (Font)Resources.Load("digitalmono"); timerFontStyle.fontSize = 34; } EditorGUI.LabelField(new Rect(this.position.width - 190, 0, 180, 20), timer, timerFontStyle); #endregion // Timer GUI.backgroundColor = normalColor; GUILayout.EndHorizontal(); CustomGUIUtils.EndGroup(); GUILayout.EndArea(); GUILayout.Space(buttonHeight + 20); switch (selectedMenu) { case 0: // Client Settings ClientSettingsGUI(); break; case 1: // FlatEarth Creation JobCreationGUI(); break; case 2: // Worker Status WorkerStatusGUI(); break; default: break; } }
/// <summary> /// Draws a colored Box /// </summary> /// <param name="rect"></param> /// <param name="backgroundColor"></param> public static void DrawBox(Rect rect, Color backgroundColor) { GUI.Box(rect, "", CustomGUIUtils.GetColorBackgroundStyle(backgroundColor)); }