public void OnGui() { var visibleWindow = IsVisible(); if (visibleWindow == VisibleWindow.None) { _lastVisibleWindow = VisibleWindow.None; if (_guiActive) { _folderTreeView?.StopMonitoringFiles(); } _guiActive = false; return; } _guiActive = true; if (_lastVisibleWindow != visibleWindow) { RefreshCurrentWindow(); } var screenRect = GetDisplayRect(); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select character folder"); IMGUIUtils.EatInputInRect(screenRect); }
public void OnGui() { var guiShown = false; // Check the opened category if (_catToggle != null && _catToggle.isOn && _targetScene == Scene.Instance.AddSceneName) { // Check opened tab if (_loadCharaToggle != null && _loadCharaToggle.isOn || _saveCharaToggle != null && _saveCharaToggle.isOn) { // Check if the character picture take screen is displayed if (_saveFront == null || !_saveFront.activeSelf) { if (_refreshList) { _folderTreeView.ResetTreeCache(); OnFolderChanged(); _refreshList = false; } var screenRect = new Rect((int)(Screen.width * 0.004), (int)(Screen.height * 0.57f), (int)(Screen.width * 0.125), (int)(Screen.height * 0.35)); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select character folder"); IMGUIUtils.EatInputInRect(screenRect); guiShown = true; } } } if (!guiShown) { _folderTreeView?.StopMonitoringFiles(); } }
public void OnGui() { //todo When loading a coordinate it resets to the main folder without deselect in menu var visibleWindow = IsVisible(); if (visibleWindow == VisibleWindow.None) { _lastRefreshed = VisibleWindow.None; if (_guiActive) { _folderTreeView?.StopMonitoringFiles(); _guiActive = false; } return; } _guiActive = true; if (_lastRefreshed != visibleWindow) { RefreshCurrentWindow(); } var screenRect = MakerFolders.GetDisplayRect(); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select clothes folder"); IMGUIUtils.EatInputInRect(screenRect); }
private void OnGUI() { if(show) { GUILayout.Window(0, rect, DrawWindow, "", GUI.skin.box); IMGUIUtils.EatInputInRect(rect); } }
protected void OnGUI() { if (uiShow) { IMGUIUtils.DrawSolidBox(uiRect); uiRect = GUILayout.Window(uiWindowHash, uiRect, WindowFunction, "Screenshot settings"); IMGUIUtils.EatInputInRect(uiRect); } }
public void OnGui() { if (_newGame != null && _targetScene == Scene.AddSceneName && !Scene.IsOverlap && !Scene.IsNowLoadingFade) { var screenRect = GetFullscreenBrowserRect(); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select character folder"); IMGUIUtils.EatInputInRect(screenRect); } else { _folderTreeView?.StopMonitoringFiles(); } }
public void OnGui() { if (_customCharaFile != null && _customCharaFile.isVisible && _targetScene == Scene.Instance.AddSceneName) { var screenRect = GetFullscreenBrowserRect(); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select character folder"); IMGUIUtils.EatInputInRect(screenRect); } else { _folderTreeView?.StopMonitoringFiles(); } }
public void OnGui() { if (_studioInitObject != null) { var screenRect = new Rect((int)(Screen.width / 11.3f), (int)(Screen.height / 90f), (int)(Screen.width / 2.5f), (int)(Screen.height / 5f)); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select folder with scenes to view"); IMGUIUtils.EatInputInRect(screenRect); } else { _folderTreeView?.StopMonitoringFiles(); } }
public void OnGui() { if (_uiObject && _uiObject.activeSelf && _sceneName == Scene.AddSceneName && !Scene.IsOverlap && !Scene.IsNowLoadingFade) { var screenRect = new Rect((int)(Screen.width * 0.004), (int)(Screen.height * 0.57f), (int)(Screen.width * 0.125), (int)(Screen.height * 0.35)); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(36, screenRect, TreeWindow, "Select outfit folder"); IMGUIUtils.EatInputInRect(screenRect); } else { _folderTreeView?.StopMonitoringFiles(); } }
public void OnGui() { if (_uiObject && _uiObject.activeSelf && _sceneName == Manager.Scene.Instance.AddSceneName) { _guiActive = true; var screenRect = new Rect((int)(Screen.width * 0.04), (int)(Screen.height * 0.57f), (int)(Screen.width * 0.125), (int)(Screen.height * 0.35)); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select outfit folder"); IMGUIUtils.EatInputInRect(screenRect); } else if (_guiActive) { _folderTreeView?.StopMonitoringFiles(); _guiActive = false; } }
public void OnGui() { if (_freeHFile != null && !_isLive && _targetScene == Scene.Instance.AddSceneName) { _guiActive = true; var screenRect = ClassroomFolders.GetFullscreenBrowserRect(); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select character folder"); IMGUIUtils.EatInputInRect(screenRect); } else if (_guiActive) { _folderTreeView?.StopMonitoringFiles(); _guiActive = false; } }
public void OnGui() { if (_motionIKUI != null && _targetScene == Scene.Instance.AddSceneName) { if (_refreshList) { _refreshList = false; } var screenRect = new Rect((int)(Screen.width * 0.004), (int)(Screen.height * 0.57f), (int)(Screen.width * 0.125), (int)(Screen.height * 0.35)); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select hik folder"); IMGUIUtils.EatInputInRect(screenRect); } }
public void OnGui() { // Check the opened category if (_hEditLoadSceneWindow != null && _targetScene == Scene.Instance.AddSceneName) { if (_refreshList) { OnFolderChanged(); _refreshList = false; } var screenRect = new Rect((int)(Screen.width * 0.004), (int)(Screen.height * 0.55f), (int)(Screen.width * 0.125), (int)(Screen.height * 0.35)); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select scene folder"); IMGUIUtils.EatInputInRect(screenRect); } }
public void OnGui() { if (_costumeInfoEntry != null) { if (_costumeInfoEntry.isActive()) { var windowRect = new Rect((int)(Screen.width * 0.06f), (int)(Screen.height * 0.32f), (int)(Screen.width * 0.13f), (int)(Screen.height * 0.4f)); IMGUIUtils.DrawSolidBox(windowRect); GUILayout.Window(363, windowRect, id => TreeWindow(), "Folder with outfits to view"); IMGUIUtils.EatInputInRect(windowRect); } else { _costumeInfoEntry.FolderTreeView?.StopMonitoringFiles(); } } }
void Start() { Steamworks.SteamAPI.Init(); DontDestroyOnLoad(this.gameObject); netManager = new NetManager(); modLogo = Client.LoadAsset <Texture2D>("Assets/Textures/MSCMPLogo.png"); IMGUIUtils.Setup(); #if !PUBLIC_RELEASE // Skip splash screen in development builds. Application.LoadLevel("MainMenu"); DevTools.OnInit(); #endif }
public void OnGui() { if (!IsVisible()) { return; } if (_refreshList) { OnFolderChanged(); _refreshList = false; } var screenRect = new Rect((int)(Screen.width * 0.004), (int)(Screen.height * 0.57f), (int)(Screen.width * 0.125), (int)(Screen.height * 0.35)); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select outfit folder"); IMGUIUtils.EatInputInRect(screenRect); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (property.serializedObject.isEditingMultipleObjects || property.objectReferenceValue == null) { base.OnGUI(position, property, label); return; } var inner = new SerializedObject(property.objectReferenceValue); var valueProp = inner.FindProperty("_value"); var width = GetPreviewSpace(valueProp.type) + (property.depth == 0 ? EditorGUIUtility.labelWidth : 0); var restRect = IMGUIUtils.SnipRectH(position, width, out position, 6f); base.OnGUI(position, property, GUIContent.none); EditorGUI.BeginDisabledGroup(true); EditorGUI.PropertyField(restRect, valueProp, label, false); EditorGUI.EndDisabledGroup(); }
public void OnGui() { var entry = _charaListEntries.Values.SingleOrDefault(x => x.isActiveAndEnabled); if (_lastEntry != null && _lastEntry != entry) { _lastEntry.FolderTreeView?.StopMonitoringFiles(); _lastEntry = null; } if (entry == null) { return; } _lastEntry = entry; var windowRect = new Rect((int)(Screen.width * 0.06f), (int)(Screen.height * 0.32f), (int)(Screen.width * 0.13f), (int)(Screen.height * 0.4f)); IMGUIUtils.DrawSolidBox(windowRect); GUILayout.Window(363, windowRect, id => TreeWindow(entry), "Select folder with cards to view"); IMGUIUtils.EatInputInRect(windowRect); }
public void OnGui() { var entry = Helper.GetActiveEntry(); if (_lastEntry != null && _lastEntry != entry) { _lastEntry.FolderTreeView?.StopMonitoringFiles(); _lastEntry = null; } if (entry == null) { return; } _lastEntry = entry; var windowRect = GetMainRect(); IMGUIUtils.DrawSolidBox(windowRect); GUILayout.Window(363, windowRect, id => TreeWindow(entry), WindowLabel); IMGUIUtils.EatInputInRect(windowRect); }
public void OnGui() { var guiShown = false; if (_hToggle) //if preset window is active draw file select { if (Input.GetMouseButtonDown(1) || Input.GetKeyDown(KeyCode.F1)) //if right click or F1 close { GameObject.Find("Canvas/clothesFileWindow").SetActive(false); DisablePreset(); } var screenRect = new Rect((int)(Screen.width * 0.04), (int)(Screen.height * 0.57f), (int)(Screen.width * 0.125), (int)(Screen.height * 0.35)); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select outfit folder"); IMGUIUtils.EatInputInRect(screenRect); guiShown = true; } if (!guiShown) { _folderTreeView?.StopMonitoringFiles(); } }
void Start() { Steamworks.SteamAPI.Init(); DontDestroyOnLoad(this.gameObject); netManager = new NetManager(); modLogo = Client.LoadAsset <Texture2D>("Assets/Textures/MSCMPLogo.png"); IMGUIUtils.Setup(); string initialLevel = string.Empty; bool noSplash = Client.IsCdlParamSet("-nosplash"); #if !PUBLIC_RELEASE // Always skip splash screen in development builds. noSplash = true; DevTools.OnInit(); #endif if (noSplash) { initialLevel = "MainMenu"; } // Add option to automatically host game via command line. if (Client.IsCdlParamSet("-autohost")) { initialLevel = "GAME"; } if (initialLevel != string.Empty) { Application.LoadLevel(initialLevel); } }
public void ShowAdvEditor() { if (!Enabled) { return; } if (CurrentScenario == null) { Enabled = false; return; } _addWinRect = GUILayout.Window(4207123, _addWinRect, TesterWindow, "ADV Command Creator"); _listWinRect = GUILayout.Window(4207124, _listWinRect, CommandListWindow, "ADV Command List"); _varWinRect = GUILayout.Window(4207125, _varWinRect, VariableWindow, "ADV Inspector"); if (SolidBackground) { IMGUIUtils.DrawSolidBox(_addWinRect); IMGUIUtils.DrawSolidBox(_listWinRect); IMGUIUtils.DrawSolidBox(_varWinRect); } }
/// <summary> /// Temporay GUI used for customising the characters look /// </summary> private void OnGUI() { #region Redundant //if (runInEditor) //{ //var nativeSize = new Vector2(res.x, res.y); // //Vector3 scale = new Vector3(Screen.width / nativeSize.x, Screen.height / nativeSize.y, 1.0f); //var matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scale); #endregion Vector2 res = new Vector2(1920, 1080); GUI.matrix = IMGUIUtils.IMGUIMatrix(res); #region Styles GUIStyle _style = new GUIStyle(GUI.skin.box); _style.fontSize = 50; _style.alignment = TextAnchor.UpperCenter; #endregion #region Group Variables Vector2 groupOneLayoutPosition = layouts[0].position; Vector2 groupOneLayoutSize = layouts[0].size; Vector2 groupTwoLayoutPostion = layouts[1].position; Vector2 groupTwoLayoutSize = layouts[1].size; Vector2 buttonPos = layouts[3].position; Vector2 buttonSize = layouts[3].size; Vector2 _buttonPos = layouts[4].position; Vector2 _buttonSize = layouts[4].size; #endregion #region Box and Button Variables Vector2 _position = layouts[2].position; Vector2 _size = layouts[2].size; #endregion #region Rectangles Rect groupOne = new Rect(groupOneLayoutPosition.x, groupOneLayoutPosition.y, groupOneLayoutSize.x, groupOneLayoutSize.y); Rect groupOneBox = new Rect(0, 0, groupOneLayoutSize.x, groupOneLayoutSize.y); Rect groupTwo = new Rect(groupTwoLayoutPostion.x, groupTwoLayoutPostion.y, groupTwoLayoutSize.x, groupTwoLayoutSize.y); Rect groupTwoBox = new Rect(0, 0, groupTwoLayoutSize.x, groupTwoLayoutSize.y); #endregion #region Styles GUIStyle matNameStyle = new GUIStyle(GUI.skin.box); matNameStyle.fontSize = 25; matNameStyle.alignment = TextAnchor.MiddleCenter; #endregion #region TextureCustomisation GUI.BeginGroup(groupOne); GUI.Box(groupOneBox, "Textures", _style); for (int i = 0; i < matName.Length; i++) { #region Variables var x = (i * 55); Rect buttonRectLeft = new Rect(buttonPos.x, buttonPos.y + x, buttonSize.x, buttonSize.y); Rect buttonRectRight = new Rect(_buttonPos.x, _buttonPos.y + x, _buttonSize.x, _buttonSize.y); #endregion GUI.Box(new Rect(_position.x, _position.y + x, _size.x, _size.y), matName[i], matNameStyle); if (GUI.Button(buttonRectLeft, ">", matNameStyle)) { SetTexture(matName[i], 1); } if (GUI.Button(buttonRectRight, "<", matNameStyle)) { SetTexture(matName[i], -1); } } GUI.EndGroup(); #endregion #region GroupTwo GUI.BeginGroup(groupTwo); GUI.Box(groupTwoBox, "Testing Text", _style); GUI.EndGroup(); #endregion //} }
private void OnGUI() { if (_currentHeroine.Count == 0) { return; } var pos = new Vector2(Input.mousePosition.x, -(Input.mousePosition.y - Screen.height)); var heroineRect = _currentHeroine.FirstOrDefault(x => { if (x.Value == null) { return(false); } return(GetOccupiedScreenRect(x).Contains(pos)); }); var chara = heroineRect.Key; if (chara == null) { return; } var pregData = chara.GetPregnancyData(); var status = chara.GetCharaStatus(pregData); var heroine = chara as SaveData.Heroine; var windowHeight = status == HeroineStatus.Unknown ? 100 : status == HeroineStatus.Pregnant || status == HeroineStatus.OnLeave ? 180 : 370; var screenRect = new Rect((int)pos.x + 30, (int)pos.y - windowHeight / 2, 180, windowHeight); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.BeginArea(screenRect, GUI.skin.box); { GUILayout.BeginVertical(); { GUILayout.FlexibleSpace(); switch (status) { case HeroineStatus.Unknown: GUILayout.Label("This character didn't tell you their risky day schedule yet."); GUILayout.FlexibleSpace(); GUILayout.Label("Become closer to learn it!"); break; case HeroineStatus.OnLeave: GUILayout.Label("This character is on a maternal leave and will not appear until it is over."); GUILayout.FlexibleSpace(); GUILayout.Label("Consider using a rubber next time!"); break; case HeroineStatus.Pregnant: GUILayout.Label($"This character is pregnant (on week {pregData.Week} / 40)."); GUILayout.FlexibleSpace(); if (pregData.GameplayEnabled) { GUILayout.Label(heroine != null ? "The character's body will slowly change, and at the end they will temporarily leave." : "The character's body will slowly change."); } GUILayout.FlexibleSpace(); var previousPregcount = Mathf.Max(0, pregData.PregnancyCount - 1); GUILayout.Label($"This character was pregnant {previousPregcount} times before."); break; case HeroineStatus.Safe: case HeroineStatus.Risky: if (heroine == null) { break; } GUILayout.Label(status == HeroineStatus.Safe ? "This character is on a safe day, have fun!" : "This character is on a risky day, be careful!"); //GUILayout.Space(5); GUILayout.FlexibleSpace(); var day = Singleton <Cycle> .Instance.nowWeek; GUILayout.Label("Forecast for this week:"); switch (pregData.MenstruationSchedule) { case MenstruationSchedule.AlwaysSafe: GUILayout.Label("It's always safe!"); break; case MenstruationSchedule.AlwaysRisky: GUILayout.Label("It's always risky!"); break; default: GUILayout.Label($"Today ({day}): {status}"); for (var dayOffset = 1; dayOffset < 7; dayOffset++) { var adjustedDay = (Cycle.Week)((int)(day + dayOffset) % Enum.GetValues(typeof(Cycle.Week)).Length); var adjustedSafe = HFlag.GetMenstruation((byte)((heroine.MenstruationDay + dayOffset) % HFlag.menstruations.Length)) == HFlag.MenstruationType.安全日; GUILayout.Label($"{adjustedDay}: {(adjustedSafe ? "Safe" : "Risky")}"); } break; } var pregnancyCount = pregData.IsPregnant ? pregData.PregnancyCount - 1 : pregData.PregnancyCount; if (pregnancyCount > 0) { GUILayout.FlexibleSpace(); GUILayout.Label($"This character was pregnant {pregnancyCount} times."); } if (pregData.WeeksSinceLastPregnancy > 0) { GUILayout.FlexibleSpace(); GUILayout.Label($"Last pregnancy was {pregData.WeeksSinceLastPregnancy} weeks ago."); } break; default: throw new ArgumentOutOfRangeException(); } GUILayout.FlexibleSpace(); } GUILayout.EndVertical(); } GUILayout.EndArea(); }
/// <summary> /// Draw network statistics. /// </summary> public void Draw() { GUI.color = Color.white; const int WINDOW_WIDTH = 300; const int WINDOW_HEIGHT = 600; Rect statsWindowRect = new Rect(Screen.width - WINDOW_WIDTH - 10, Screen.height - WINDOW_HEIGHT - 10, WINDOW_WIDTH, WINDOW_HEIGHT); GUI.Window(666, statsWindowRect, (int window) => { // Draw traffic graph title. var rct = new Rect(10, 20, 200, 25); GUI.Label(rct, $"Traffic graph (last {HISTORY_SIZE} frames):"); rct.y += 25; var graphRect = new Rect(rct.x, rct.y, WINDOW_WIDTH - 20, 100); // Draw graph background. GUI.color = new Color(0.0f, 0.0f, 0.0f, 0.35f); IMGUIUtils.DrawPlainColorRect(graphRect); // Draw the graph itself. graphRect.x += statsWindowRect.x; graphRect.y += statsWindowRect.y; DrawGraph(graphRect); GUI.color = Color.white; rct.y += 5; rct.x += 5; IMGUIUtils.DrawSmallLabel($"{FormatBytes(maxBytesSentInHistory)} sent/frame", rct, Color.red, true); rct.y += 12; IMGUIUtils.DrawSmallLabel( $"{FormatBytes(maxBytesReceivedInHistory)} recv/frame", rct, Color.green, true); rct.y -= 12 - 5; rct.x -= 5; rct.y += graphRect.height; rct.height = 20; // Draw separator GUI.color = Color.black; IMGUIUtils.DrawPlainColorRect(new Rect(0, rct.y, WINDOW_WIDTH, 2)); rct.y += 2; // Draw stats background GUI.color = new Color(0.0f, 0.0f, 0.0f, 0.5f); IMGUIUtils.DrawPlainColorRect( new Rect(0, rct.y, WINDOW_WIDTH, WINDOW_HEIGHT - rct.y)); // Draw statistics DrawStatHelper(ref rct, "packetsSendTotal", packetsSendTotal); DrawStatHelper(ref rct, "packetsReceivedTotal", packetsReceivedTotal); DrawStatHelper(ref rct, "packetsSendLastFrame", packetsSendLastFrame, 1000); DrawStatHelper( ref rct, "packetsReceivedLastFrame", packetsReceivedLastFrame, 1000); DrawStatHelper( ref rct, "packetsSendCurrentFrame", packetsSendCurrentFrame, 1000); DrawStatHelper(ref rct, "packetsReceivedCurrentFrame", packetsReceivedCurrentFrame, 1000); DrawStatHelper(ref rct, "bytesSendTotal", bytesSentTotal, -1, true); DrawStatHelper(ref rct, "bytesReceivedTotal", bytesReceivedTotal, -1, true); DrawStatHelper( ref rct, "bytesSendLastFrame", bytesSentLastFrame, 1000, true); DrawStatHelper( ref rct, "bytesReceivedLastFrame", bytesReceivedLastFrame, 1000, true); DrawStatHelper( ref rct, "bytesSendCurrentFrame", bytesSentCurrentFrame, 1000, true); DrawStatHelper(ref rct, "bytesReceivedCurrentFrame", bytesReceivedCurrentFrame, 1000, true); // Draw separator rct.y += 2; GUI.color = Color.black; IMGUIUtils.DrawPlainColorRect(new Rect(0, rct.y, WINDOW_WIDTH, 2)); rct.y += 2; // Draw P2P session state. DrawTextHelper(ref rct, "Steam session state:", ""); Steamworks.P2PSessionState_t sessionState = new Steamworks.P2PSessionState_t(); if (netManager.GetP2PSessionState(out sessionState)) { DrawTextHelper( ref rct, "Is Connecting", sessionState.m_bConnecting.ToString()); DrawTextHelper(ref rct, "Is connection active", sessionState.m_bConnectionActive == 0 ? "no" : "yes"); DrawTextHelper(ref rct, "Using relay?", sessionState.m_bConnectionActive == 0 ? "no" : "yes"); DrawTextHelper(ref rct, "Session error", Utils.P2PSessionErrorToString( (Steamworks.EP2PSessionError)sessionState.m_eP2PSessionError)); DrawTextHelper(ref rct, "Bytes queued for send", FormatBytes(sessionState.m_nBytesQueuedForSend)); DrawTextHelper(ref rct, "Packets queued for send", sessionState.m_nPacketsQueuedForSend.ToString()); uint uip = sessionState.m_nRemoteIP; string ip = string.Format("{0}.{1}.{2}.{3}", (uip >> 24) & 0xff, (uip >> 16) & 0xff, (uip >> 8) & 0xff, uip & 0xff); DrawTextHelper(ref rct, "Remote ip", ip); DrawTextHelper( ref rct, "Remote port", sessionState.m_nRemotePort.ToString()); } else { DrawTextHelper(ref rct, "Session inactive.", ""); } }, "Network statistics"); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (property.serializedObject.isEditingMultipleObjects) { EditorGUI.PropertyField(position, property, label, true); return; } EditorGUI.BeginProperty(position, label, property); DrawerData drawerData = GetDrawerData(property.propertyPath); var isCreatingSO = drawerData.UserClickedToCreateAtom && property.objectReferenceValue == null; var restWidth = drawerData.UserClickedToCreateAtom ? 50 : 58; var gutter = drawerData.UserClickedToCreateAtom ? 2f : 6f; Rect restRect = new Rect(); Rect warningRect = new Rect(); if (drawerData.WarningText.Length > 0) { position = IMGUIUtils.SnipRectV(position, EditorGUIUtility.singleLineHeight, out warningRect, 2f); } if (property.objectReferenceValue == null) { position = IMGUIUtils.SnipRectH(position, position.width - restWidth, out restRect, gutter); } var defaultGUIColor = GUI.color; GUI.color = isCreatingSO ? Color.yellow : defaultGUIColor; position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), isCreatingSO && label != GUIContent.none ? new GUIContent("Name of New Atom") : label); GUI.color = defaultGUIColor; var indent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; GUI.SetNextControlName(NAMING_FIELD_CONTROL_NAME); drawerData.NameOfNewAtom = EditorGUI.TextField(isCreatingSO ? position : Rect.zero, drawerData.NameOfNewAtom); if (!isCreatingSO) { EditorGUI.BeginChangeCheck(); var obj = EditorGUI.ObjectField(position, property.objectReferenceValue, typeof(T), false); if (EditorGUI.EndChangeCheck()) { property.objectReferenceValue = obj; } } if (property.objectReferenceValue == null) { if (isCreatingSO) { var buttonWidth = 24; Rect secondButtonRect; Rect firstButtonRect = IMGUIUtils.SnipRectH(restRect, restRect.width - buttonWidth, out secondButtonRect, gutter); if (GUI.Button(firstButtonRect, "✓") || (Event.current.keyCode == KeyCode.Return && GUI.GetNameOfFocusedControl() == NAMING_FIELD_CONTROL_NAME)) { if (drawerData.NameOfNewAtom.Length > 0) { try { string path = AssetDatabase.GetAssetPath(property.serializedObject.targetObject); path = path == "" ? "Assets/" : Path.GetDirectoryName(path) + "/"; // Create asset T so = ScriptableObject.CreateInstance <T>(); AssetDatabase.CreateAsset(so, path + drawerData.NameOfNewAtom + ".asset"); AssetDatabase.SaveAssets(); // Assign the newly created SO property.objectReferenceValue = so; } catch { Debug.LogError("Not able to create Atom"); } drawerData.UserClickedToCreateAtom = false; drawerData.WarningText = ""; } else { drawerData.WarningText = "Name of new Atom must be specified!"; EditorGUI.FocusTextInControl(NAMING_FIELD_CONTROL_NAME); } } if (GUI.Button(secondButtonRect, "✗") || (Event.current.keyCode == KeyCode.Escape && GUI.GetNameOfFocusedControl() == NAMING_FIELD_CONTROL_NAME)) { drawerData.UserClickedToCreateAtom = false; drawerData.WarningText = ""; } if (drawerData.WarningText.Length > 0) { EditorGUI.HelpBox(warningRect, drawerData.WarningText, MessageType.Warning); } } else { if (GUI.Button(restRect, "Create")) { drawerData.NameOfNewAtom = ""; drawerData.UserClickedToCreateAtom = true; EditorGUI.FocusTextInControl(NAMING_FIELD_CONTROL_NAME); } } } EditorGUI.indentLevel = indent; EditorGUI.EndProperty(); }
/// <summary> /// Updates invite panel IMGUI. /// </summary> private void UpdateInvitePanel() { if (!IsInvitePanelVisible()) { GUI.color = Color.white; GUI.Label(new Rect(0, Screen.height - 100, 200.0f, 20.0f), "[ESCAPE] - Invite friend"); return; } const float invitePanelHeight = 400.0f; const float invitePanelWidth = 300.0f; const float rowHeight = 20.0f; Rect invitePanelRect = new Rect(Screen.width - invitePanelWidth - 10.0f, Screen.height / 2 - invitePanelHeight / 2, invitePanelWidth, 20.0f); // Draw header GUI.color = new Color(1.0f, 0.5f, 0.0f, 0.8f); IMGUIUtils.DrawPlainColorRect(invitePanelRect); GUI.color = Color.white; invitePanelRect.x += 2.0f; GUI.Label(invitePanelRect, "Invite friend"); invitePanelRect.x -= 2.0f; // Draw contents invitePanelRect.y += 21.0f; invitePanelRect.height = invitePanelHeight; GUI.color = new Color(0.0f, 0.0f, 0.0f, 0.8f); IMGUIUtils.DrawPlainColorRect(invitePanelRect); GUI.color = new Color(1.0f, 0.5f, 0.0f, 0.8f); int onlineFriendsCount = onlineFriends.Count; invitePanelRect.height -= 2.0f; if (onlineFriendsCount == 0) { GUI.color = Color.white; var previousAlignment = GUI.skin.label.alignment; GUI.skin.label.alignment = TextAnchor.MiddleCenter; bool playerIsOffline = Steamworks.SteamFriends.GetPersonaState() == Steamworks.EPersonaState.k_EPersonaStateOffline; if (playerIsOffline) { GUI.Label(invitePanelRect, "You cannot invite friends while in steam offline mode.\n\nSwitch back your steam status to online to be able to invite players."); } else { GUI.Label(invitePanelRect, "You don't have any friends online."); } GUI.skin.label.alignment = previousAlignment; return; } friendsScrollViewPos = GUI.BeginScrollView(invitePanelRect, friendsScrollViewPos, new Rect(0, 0, invitePanelWidth - 20.0f, 20.0f * onlineFriendsCount)); int firstVisibleFriendId = (int)(friendsScrollViewPos.y / rowHeight); int maxVisibleFriends = (int)(invitePanelHeight / rowHeight); int lastIndex = firstVisibleFriendId + maxVisibleFriends + 1; if (lastIndex > onlineFriendsCount) { lastIndex = onlineFriendsCount; } for (int i = firstVisibleFriendId; i < lastIndex; ++i) { FriendEntry friend = onlineFriends[i]; if (friend.playingMSC) { GUI.color = Color.green; } else { GUI.color = Color.white; } Rect friendRect = new Rect(2, 1 + rowHeight * i, 200.0f, rowHeight); GUI.Label(friendRect, friend.name); friendRect.x += 180.0f; friendRect.width = 100.0f; Steamworks.CSteamID friendSteamId = friend.steamId; if (invitedFriendSteamId == friendSteamId) { GUI.Label(friendRect, String.Format("INVITED! ({0:F1}s)", inviteCooldown)); continue; } if (inviteCooldown > 0.0f) { continue; } if (GUI.Button(friendRect, "Invite")) { if (netManager.InviteToMyLobby(friendSteamId)) { invitedFriendSteamId = friendSteamId; inviteCooldown = INVITE_COOLDOWN; } else { UI.MPGUI.Instance.ShowMessageBox("Failed to invite friend due to steam error."); } } } GUI.EndScrollView(); }
private void OnGUI() { if (_currentHeroine.Count == 0) { return; } var pos = new Vector2(Input.mousePosition.x, -(Input.mousePosition.y - Screen.height)); var heroine = _currentHeroine.FirstOrDefault(x => x.Value.Contains(pos)).Key; if (heroine == null) { return; } var status = GetHeroineStatus(heroine); var windowHeight = status == HeroineStatus.Unknown || status == HeroineStatus.Pregnant ? 110 : 270; var screenRect = new Rect(pos.x + 30, pos.y - windowHeight / 2, 180, windowHeight); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.BeginArea(screenRect, GUI.skin.box); { GUILayout.BeginVertical(); { GUILayout.FlexibleSpace(); switch (status) { case HeroineStatus.Unknown: GUILayout.Label("This character didn't tell you their risky day schedule yet.\n\nBecome closer to learn it!"); break; case HeroineStatus.Pregnant: GUILayout.Label("This character is pregnant.\n\nOver time the character's belly will grow, and at the end they will leave school temporarily."); break; case HeroineStatus.Safe: case HeroineStatus.Risky: GUILayout.Label(status == HeroineStatus.Safe ? "This character is on a safe day, have fun!" : "This character is on a risky day, be careful!"); GUILayout.Space(5); var day = Singleton <Cycle> .Instance.nowWeek; GUILayout.Label("Forecast for this week:"); GUILayout.Label($"Today ({day}): {status}"); for (var dayOffset = 1; dayOffset < 7; dayOffset++) { var adjustedDay = (Cycle.Week)((int)(day + dayOffset) % Enum.GetValues(typeof(Cycle.Week)).Length); var adjustedSafe = HFlag.GetMenstruation( (byte)((heroine.MenstruationDay + dayOffset) % HFlag.menstruations.Length)) == HFlag.MenstruationType.安全日; GUILayout.Label($"{adjustedDay}: {(adjustedSafe ? "Safe" : "Risky")}"); } break; default: throw new ArgumentOutOfRangeException(); } GUILayout.FlexibleSpace(); } GUILayout.EndVertical(); } GUILayout.EndArea(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (property.serializedObject.isEditingMultipleObjects) { EditorGUI.PropertyField(position, property, label, true); return; } EditorGUI.BeginProperty(position, label, property); DrawerData drawerData = GetDrawerData(property.propertyPath); var isCreatingSO = drawerData.UserClickedToCreateAtom && property.objectReferenceValue == null; var restWidth = drawerData.UserClickedToCreateAtom ? 50 : 58; var gutter = drawerData.UserClickedToCreateAtom ? 2f : 6f; Rect restRect = new Rect(); Rect warningRect = new Rect(); if (drawerData.WarningText.Length > 0) { position = IMGUIUtils.SnipRectV(position, EditorGUIUtility.singleLineHeight, out warningRect, 2f); } if (property.objectReferenceValue == null) { position = IMGUIUtils.SnipRectH(position, position.width - restWidth, out restRect, gutter); } var defaultGUIColor = GUI.color; GUI.color = isCreatingSO ? Color.yellow : defaultGUIColor; position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), isCreatingSO ? new GUIContent("Name of New Atom") : label); GUI.color = defaultGUIColor; var indent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; if (isCreatingSO) { drawerData.NameOfNewAtom = EditorGUI.TextField(position, drawerData.NameOfNewAtom); } else { property.objectReferenceValue = EditorGUI.ObjectField(position, property.objectReferenceValue, typeof(T), false); } if (property.objectReferenceValue == null) { if (isCreatingSO) { var buttonWidth = 24; Rect secondButtonRect; Rect firstButtonRect = IMGUIUtils.SnipRectH(restRect, restRect.width - buttonWidth, out secondButtonRect, gutter); if (GUI.Button(firstButtonRect, "✓")) { if (drawerData.NameOfNewAtom.Length > 0) { try { // Create asset T so = ScriptableObject.CreateInstance <T>(); AssetDatabase.CreateAsset(so, "Assets/" + drawerData.NameOfNewAtom + ".asset"); AssetDatabase.SaveAssets(); // Assign the newly created SO property.objectReferenceValue = so; } catch { Debug.LogError("Not able to create Atom"); } drawerData.UserClickedToCreateAtom = false; drawerData.WarningText = ""; } else { drawerData.WarningText = "Name of new Atom must be specified!"; } } if (GUI.Button(secondButtonRect, "✗")) { drawerData.UserClickedToCreateAtom = false; drawerData.WarningText = ""; } if (drawerData.WarningText.Length > 0) { EditorGUI.HelpBox(warningRect, drawerData.WarningText, MessageType.Warning); } } else { if (GUI.Button(restRect, "Create")) { drawerData.NameOfNewAtom = ""; drawerData.UserClickedToCreateAtom = true; } } } EditorGUI.indentLevel = indent; EditorGUI.EndProperty(); }
private void OnPropertyGUI(Rect position, SerializedProperty property, GUIContent label) { Rect lower; Rect buttonRect = new Rect(); var scene = property.FindPropertyRelative("_sceneAsset")?.objectReferenceValue; if (scene == null) { // Update values cause the build index could've changed property.FindPropertyRelative("_sceneName").stringValue = ""; property.FindPropertyRelative("_scenePath").stringValue = ""; property.FindPropertyRelative("_buildIndex").intValue = -1; } position = IMGUIUtils.SnipRectV(position, EditorGUIUtility.singleLineHeight, out lower, 2f); if (HasValidBuildIndex(property)) { if (scene != null) { // Update values cause the build index could've changed property.FindPropertyRelative("_sceneName").stringValue = scene.name; property.FindPropertyRelative("_scenePath").stringValue = AssetDatabase.GetAssetPath(scene); property.FindPropertyRelative("_buildIndex").intValue = SceneUtility.GetBuildIndexByScenePath( property.FindPropertyRelative("_scenePath").stringValue ); } } else { position = IMGUIUtils.SnipRectH(position, position.width - 70, out buttonRect, 6f); property.FindPropertyRelative("_buildIndex").intValue = -1; } SceneAsset sceneAsset = scene as SceneAsset; position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); EditorGUI.BeginChangeCheck(); scene = EditorGUI.ObjectField(position, scene, typeof(SceneAsset), false); if (EditorGUI.EndChangeCheck()) { property.FindPropertyRelative("_sceneAsset").objectReferenceValue = scene; sceneAsset = scene as SceneAsset; if (sceneAsset != null) { property.FindPropertyRelative("_sceneName").stringValue = scene.name; property.FindPropertyRelative("_scenePath").stringValue = AssetDatabase.GetAssetPath(scene); property.FindPropertyRelative("_buildIndex").intValue = SceneUtility.GetBuildIndexByScenePath( property.FindPropertyRelative("_scenePath").stringValue ); } } if (property.FindPropertyRelative("_buildIndex").intValue != -1) { return; } if (scene != null && scene is SceneAsset) { EditorGUI.HelpBox(lower, "Scene is not added in the build settings", MessageType.Warning); if (GUI.Button(buttonRect, "Fix Now")) { AddSceneToBuildSettings(sceneAsset); } } }