public void Draw() { GUILayout.BeginArea(new Rect(_hostWindow.position.width - s_InspectorWidth, 25, s_InspectorWidth, _hostWindow.position.height - 25f)); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition); if (_selectedThing == null) { GUILayout.Label("Select an object to see more info"); } else { var nativeObject = _selectedThing as NativeUnityEngineObject; if (nativeObject != null) { GUILayout.Label("NativeUnityEngineObject", EditorStyles.boldLabel); GUILayout.Space(5); EditorGUILayout.LabelField("Name", nativeObject.name); EditorGUILayout.LabelField("ClassName", nativeObject.className); EditorGUILayout.LabelField("instanceID", nativeObject.instanceID.ToString()); EditorGUILayout.LabelField("isDontDestroyOnLoad", nativeObject.isDontDestroyOnLoad.ToString()); EditorGUILayout.LabelField("isPersistent", nativeObject.isPersistent.ToString()); EditorGUILayout.LabelField("isManager", nativeObject.isManager.ToString()); EditorGUILayout.LabelField("hideFlags", nativeObject.hideFlags.ToString()); EditorGUILayout.LabelField("hideFlags", nativeObject.size.ToString()); DrawSpecificTexture2D(nativeObject); } var managedObject = _selectedThing as ManagedObject; if (managedObject != null) { GUILayout.Label("ManagedObject"); EditorGUILayout.LabelField("Type", managedObject.typeDescription.name); EditorGUILayout.LabelField("Address", managedObject.address.ToString("X")); EditorGUILayout.LabelField("size", managedObject.size.ToString()); if (managedObject.typeDescription.name == "System.String") { EditorGUILayout.LabelField("value", StringTools.ReadString(_unpackedCrawl.managedHeap.Find(managedObject.address, _unpackedCrawl.virtualMachineInformation), _unpackedCrawl.virtualMachineInformation)); } DrawFields(managedObject); if (managedObject.typeDescription.isArray) { DrawArray(managedObject); } } if (_selectedThing is GCHandle) { GUILayout.Label("GCHandle"); EditorGUILayout.LabelField("size", _selectedThing.size.ToString()); } var staticFields = _selectedThing as StaticFields; if (staticFields != null) { GUILayout.Label("Static Fields"); GUILayout.Label("Of type: " + staticFields.typeDescription.name); GUILayout.Label("size: " + staticFields.size); DrawFields(staticFields.typeDescription, new BytesAndOffset() { bytes = staticFields.typeDescription.staticFieldBytes, offset = 0, pointerSize = _unpackedCrawl.virtualMachineInformation.pointerSize }, true); } if (managedObject == null) { GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("References:", labelWidth); GUILayout.BeginVertical(); DrawLinks(_selectedThing.references); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUILayout.Space(10); GUILayout.Label("Referenced by:"); DrawLinks(_selectedThing.referencedBy); GUILayout.Space(10); if (_shortestPath != null) { if (_shortestPath.Length > 1) { GUILayout.Label("ShortestPathToRoot"); DrawLinks(_shortestPath); } string reason; _shortestPathToRootFinder.IsRoot(_shortestPath.Last(), out reason); GUILayout.Label("This is a root because:"); GUILayout.TextArea(reason); } else { GUILayout.TextArea("No root is keeping this object alive. It will be collected next UnloadUnusedAssets() or scene load"); } } GUILayout.EndScrollView(); GUILayout.EndArea(); }
/// <summary> /// Raises the GUI event. /// /// Adds a number of buttons used to test the SDK. /// /// </summary> void OnGUI() { // 240 is a magical number, derived from a scale factor of 2 looking well on a 480*800 device and 4.5 on a 1080*1920 device float scaleFactor = Screen.width / 240f; float screenWidth = Screen.width / scaleFactor; float screenHeight = Screen.height / scaleFactor; float spacerSize = 10f; GUI.matrix = Matrix4x4.Scale(new Vector3(scaleFactor, scaleFactor, scaleFactor)); float buttonAreaOriginX = 0f; float buttonAreaOriginY = textureSize + 10f; float buttonAreaWidth = screenWidth; float buttonAreaHeight = screenHeight; GUI.skin.button.margin = new RectOffset(10, 10, 10, 10); GUI.DrawTexture(new Rect(10.0f, 10.0f, (float)textureSize, (float)textureSize), avatarTexture, ScaleMode.ScaleToFit, true); GUILayout.Space((float)textureSize + spacerSize); GUILayout.BeginVertical(); GUILayout.BeginArea(new Rect(buttonAreaOriginX, buttonAreaOriginY, buttonAreaWidth, buttonAreaHeight - textureSize)); scrollPosition = GUILayout.BeginScrollView(scrollPosition); GUILayoutOption buttonWidth = GUILayout.Width(screenWidth - (spacerSize * 2)); if (GUILayout.Button("Initialize SDK", buttonWidth)) { ZendeskSDK.ZDKConfig.Initialize(gameObject, "https://{subdomain}.zendesk.com", "{applicationId}", "{oauthClientId}"); ZendeskSDK.ZDKConfig.AuthenticateAnonymousIdentity(); // Uncomment this line if you want to override the langauge that Help Center content is requested in // ZendeskSDK.ZDKConfig.SetUserLocale ("en-US"); // If you use JWT identities, then comment out the AuthenticateAnonymousIdentity line above, and uncomment this line. //ZendeskSDK.ZDKConfig.AuthenticateJwtUserIdentity ("MyTestID"); } if (GUILayout.Button("Set Custom Fields", buttonWidth)) { Hashtable customFields = new Hashtable(); string customFieldId = "customFieldId"; customFields[customFieldId] = "customFieldValue"; ZendeskSDK.ZDKConfig.SetCustomFields(customFields); } if (GUILayout.Button(pushEnabled ? "Disable Push" : "Enable Push", buttonWidth)) { if (!pushEnabled) { ZendeskSDK.ZDKPush.EnableWithIdentifier("{deviceOrChannelId}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKPush.Enable - " + error.Description); } else { pushEnabled = true; Debug.Log("ZDKPush.Enable Successful Callback - " + MakeResultString(result)); } }); } else { ZendeskSDK.ZDKPush.Disable("{deviceOrChannelId}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKPush.Disable - " + error.Description); } else { pushEnabled = false; Debug.Log("ZDKPush.Disable Successful Callback - " + MakeResultString(result)); } }); } } if (GUILayout.Button("Show Help Center", buttonWidth)) { // Shows all Help Center content ZendeskSDK.ZDKHelpCenter.ShowHelpCenter(); } if (GUILayout.Button("Show Help Center With Options", buttonWidth)) { // Shows Help Center content with additional options ZendeskSDK.ZDKHelpCenter.HelpCenterOptions options = new ZendeskSDK.ZDKHelpCenter.HelpCenterOptions(); // Optional: Specify any category IDs that you wish to restrict your content to // options.IncludeCategoryIds = new [] { 203260428L, 203260368L }; // Optional: Specify any section IDs that you wish to restrict your content to // options.IncludeSectionIds = new [] { 205095568L, 205095528L }; // Optional: Specify any label names that you wish to use to filter the content. // options.IncludeLabelNames = new [] { "vip", "another_label" }; // Optional: Specify contact configuration // ZDKHelpCenter.ContactConfiguration config = new ZDKHelpCenter.ContactConfiguration (); // config.RequestSubject = "My printer is on fire!"; // config.Tags = new[] {"printer", "technical"}; // config.AdditionalInfo = " - Sent from Unity!"; // options.ContactConfiguration = config; // Optional: Show / hide the contact us button // options.ContactUsButtonVisibility = ZendeskSDK.ZDKHelpCenter.ContactUsButtonVisibility.ArticleListOnly; // options.ArticleVoting = false; ZendeskSDK.ZDKHelpCenter.ShowHelpCenter(options); } if (GUILayout.Button("Show Request Creation", buttonWidth)) { ZDKRequestCreationConfig config = new ZDKRequestCreationConfig(); config.RequestSubject = "My printer is still on fire"; config.Tags = new [] { "printer" }; config.AdditionalRequestInfo = " - Sent from Unity!"; ZendeskSDK.ZDKRequests.ShowRequestCreationWithConfig(config); } if (GUILayout.Button("Show Request List", buttonWidth)) { ZendeskSDK.ZDKRequests.ShowRequestList(); } if (GUILayout.Button("Get Ticket Form", buttonWidth)) { int [] x = new int[1]; // x[0] = <your ticket form id>; ZendeskSDK.ZDKRequestProvider.GetTicketForms(x, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKRequestProvider.GetTicketForms - " + error.Description); } else { Debug.Log("ZDKRequestProvider.GetTicketForms Successful Callback - " + MakeResultString(result)); } }); } if (GUILayout.Button("Run Provider Tests", buttonWidth)) { RunProviderTests(); } if (GUILayout.Button("Run Appearance Tests", buttonWidth)) { RunAppearanceTests(); } GUI.EndScrollView(); GUILayout.EndArea(); GUILayout.EndVertical(); }
/// <summary> /// This will render the main menu /// </summary> private void RenderMainMenu() { if (_editorButtons == null) { Initialize(); return; //Editor is getting refreshed } EditorGUILayout.HelpBox("Please note when using source control to please ignore the FNWizardData.bin that is generated because of the NCW. This is because the serialization is based on the computer that has done it. The serialization is a process to help make upgrading easier, so this file is not necessary unless upgrading.", MessageType.Info); GUILayout.BeginHorizontal(); GUILayout.Label("Search", GUILayout.Width(50)); _searchField = GUILayout.TextField(_searchField); Rect verticleButton = EditorGUILayout.BeginVertical("Button", GUILayout.Width(100), GUILayout.Height(15)); if (ProVersion) { GUI.color = TealBlue; } if (GUI.Button(verticleButton, GUIContent.none)) { ActiveButton = new ForgeEditorButton(""); ActiveButton.IsCreated = true; ChangeMenu(ForgeEditorActiveMenu.Create); } GUI.color = Color.white; GUILayout.BeginHorizontal(); GUILayout.Label(Star); GUILayout.Label("Create", EditorStyles.boldLabel); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); _scrollView = GUILayout.BeginScrollView(_scrollView); for (int i = 0; i < _editorButtons.Count; ++i) { if (_editorButtons[i].IsNetworkBehavior) { continue; } if (string.IsNullOrEmpty(_searchField) || _editorButtons[i].PossiblyMatches(_searchField)) { _editorButtons[i].Render(); } if (_editorButtons[i].MarkedForDeletion) { if (EditorUtility.DisplayDialog("Confirmation", "Are you sure? This will delete the class", "Yes", "No")) { if (_editorButtons[i].TiedObject.IsNetworkObject || _editorButtons[i].TiedObject.IsNetworkBehavior) { //Then we will need to remove this from the factory and destroy the other object as well string searchName = _editorButtons[i].TiedObject.StrippedSearchName; string folderPath = _editorButtons[i].TiedObject.FileLocation.Substring(0, _editorButtons[i].TiedObject.FileLocation.Length - _editorButtons[i].TiedObject.Filename.Length); string filePathBehavior = Path.Combine(folderPath, searchName + "Behavior.cs"); string filePathNetworkedObj = Path.Combine(folderPath, searchName + "NetworkObject.cs"); if (File.Exists(filePathBehavior)) //Delete the behavior { File.Delete(filePathBehavior); } if (File.Exists(filePathNetworkedObj)) //Delete the object { File.Delete(filePathNetworkedObj); } _editorButtons.RemoveAt(i); string factoryData = SourceCodeFactory(); using (StreamWriter sw = File.CreateText(Path.Combine(_storingPath, "NetworkObjectFactory.cs").Checkout())) { sw.Write(factoryData); } string networkManagerData = SourceCodeNetworkManager(); using (StreamWriter sw = File.CreateText(Path.Combine(_storingPath, "NetworkManager.cs").Checkout())) { sw.Write(networkManagerData); } //IFormatter previousSavedState = new BinaryFormatter(); //using (Stream s = new FileStream(Path.Combine(Application.persistentDataPath, FN_WIZARD_DATA), FileMode.OpenOrCreate, FileAccess.Write, FileShare.None)) //{ // previousSavedState.Serialize(s, _editorButtons); //} } else { //Random object //File.Delete(_editorButtons[i].TiedObject.FileLocation); } AssetDatabase.Refresh(); CloseFinal(); break; } else { _editorButtons[i].MarkedForDeletion = false; } } } GUILayout.EndScrollView(); Rect backBtn = EditorGUILayout.BeginVertical("Button", GUILayout.Height(50)); if (ProVersion) { GUI.color = ShadedBlue; } if (GUI.Button(backBtn, GUIContent.none)) { //CloseFinal(); Close(); _instance = null; return; } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); GUI.color = Color.white; GUILayout.FlexibleSpace(); GUIStyle boldStyle = new GUIStyle(GUI.skin.GetStyle("boldLabel")); boldStyle.alignment = TextAnchor.UpperCenter; GUILayout.Label("Close", boldStyle); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }
private void Window(int windowID) { GUILayout.Label(MakeEnable("[F2] Speed ", Cheat.speed)); GUILayout.Label("[O] Toggle Infinite Ammo"); if (GUILayout.Button("Toggle Creative & Debug Mode")) { cmDm = !cmDm; ToggleCmDm(); } if (GUILayout.Button("Level Up")) { if (O.localPlayer) { Progression prog = O.localPlayer.Progression; prog.AddLevelExp(prog.ExpToNextLevel); } } if (GUILayout.Button("Add 10 Skill Points")) { if (O.localPlayer) { Progression prog = O.localPlayer.Progression; prog.SkillPoints += 10; } } GUILayout.BeginVertical("Options", GUI.skin.box); { GUILayout.Space(20f); GUILayout.BeginHorizontal(); { Cheat.magicBullet = GUILayout.Toggle(Cheat.magicBullet, "Magic Bullet"); Cheat.chams = GUILayout.Toggle(Cheat.chams, "Chams"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { Cheat.noWeaponBob = GUILayout.Toggle(Cheat.noWeaponBob, "No Weapon Bob"); Cheat.aimbot = GUILayout.Toggle(Cheat.aimbot, "Aimbot"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { ESP.crosshair = GUILayout.Toggle(ESP.crosshair, "Crosshair"); ESP.fovCircle = GUILayout.Toggle(ESP.fovCircle, "Draw FOV"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { ESP.playerBox = GUILayout.Toggle(ESP.playerBox, "Player Box"); ESP.playerName = GUILayout.Toggle(ESP.playerName, "Player Name"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { ESP.playerHealth = GUILayout.Toggle(ESP.playerHealth, "Player Health"); ESP.zombieBox = GUILayout.Toggle(ESP.zombieBox, "Zombie Box"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { ESP.zombieName = GUILayout.Toggle(ESP.zombieName, "Zombie Name"); ESP.zombieHealth = GUILayout.Toggle(ESP.zombieHealth, "Zombie Health"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { ESP.playerCornerBox = GUILayout.Toggle(ESP.playerCornerBox, "Player Corner Box"); ESP.zombieCornerBox = GUILayout.Toggle(ESP.zombieCornerBox, "Zombie Corner Box"); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.BeginVertical("Teleport", GUI.skin.box); { GUILayout.Space(20f); scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.MaxWidth(300f)); { if (O.PlayerList.Count > 1) { foreach (EntityPlayer player in O.PlayerList) { if (!player || player == O.localPlayer || !player.IsAlive()) { continue; } if (GUILayout.Button(player.EntityName)) { O.localPlayer.TeleportToPosition(player.GetPosition()); } } } else { GUILayout.Label("No players found."); } } GUILayout.EndScrollView(); } GUILayout.EndVertical(); GUI.DragWindow(); }
public UITab RenderToolingTab() { MaybeUpdate(); if (!_isToolingTempDisabled && !ToolingManager.Instance.toolingEnabled) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Part tooling is disabled", HighLogic.Skin.label); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); return(UITab.Tooling); } _currentToolingType = null; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Tooling Types", HighLogic.Skin.label); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); int counter = 0; GUILayout.BeginHorizontal(); foreach (string type in ToolingDatabase.toolings.Keys) { if (counter % 3 == 0 && counter != 0) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); } counter++; if (GUILayout.Button(type, HighLogic.Skin.button)) { _currentToolingType = type; } } GUILayout.EndHorizontal(); if (_isToolingTempDisabled || _untooledParts.Count > 0) { GUILayout.BeginHorizontal(); GUILayout.Label("Untooled Parts:", HighLogic.Skin.label, GUILayout.Width(312)); GUILayout.Label("Tooling cost", RightLabel, GUILayout.Width(72)); GUILayout.Label("Untooled", RightLabel, GUILayout.Width(72)); GUILayout.Label("Tooled", RightLabel, GUILayout.Width(72)); GUILayout.EndHorizontal(); _untooledTypesScroll = GUILayout.BeginScrollView(_untooledTypesScroll, GUILayout.Height(204), GUILayout.Width(572)); foreach (UntooledPart up in _untooledParts) { GUILayout.BeginHorizontal(); GUILayout.Label(up.Name, BoldLabel, GUILayout.Width(312)); GUILayout.Label($"{up.ToolingCost:N0}f", RightLabel, GUILayout.Width(72)); float untooledExtraCost = GetUntooledExtraCost(up); GUILayout.Label($"{up.TotalCost:N0}f", RightLabel, GUILayout.Width(72)); GUILayout.Label($"{(up.TotalCost - untooledExtraCost):N0}f", RightLabel, GUILayout.Width(72)); GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); GUILayout.Label($"Total vessel cost if all parts are tooled: {_allTooledCost:N0}"); GUILayout.EndHorizontal(); GUILayout.BeginVertical(); try { RenderToolingPreviewButton(); RenderToolAllButton(); } catch (Exception ex) { Debug.LogException(ex); } GUILayout.EndVertical(); } return(_currentToolingType == null ? UITab.Tooling : UITab.ToolingType); }
protected void DrawVessel( ) { string Title = ""; string Text = ""; if (SelectedObject.vessel != null && SelectedObject.vessel.protoVessel != null) { if (SelectedObject.vessel.DiscoveryInfo.Level != DiscoveryLevels.Owned) { Title = "Unowned object"; } else { Title = SelectedObject.vessel.GetName( ); ProtoVessel proto = SelectedObject.vessel.protoVessel; double mass = 0; var res = new SortedDictionary <string, xResourceData>(); foreach (ProtoPartSnapshot p in proto.protoPartSnapshots) { foreach (var r in p.resources) { xResourceData d; if (res.ContainsKey(r.resourceName)) { d = res[r.resourceName]; } else { d = new xResourceData(r.resourceName); } d.current += r.amount; d.max += r.maxAmount; res[r.resourceName] = d; } mass += p.mass; CheckCommand(p); } var texts = res.Values.ToList().ConvertAll(d => d.ToString()); if (!SelectedObject.vessel.isEVA) { texts.Add(""); var crew = proto.GetVesselCrew().Count(); mass += res.Values.Sum(d => d.GetMass()); var parts = proto.protoPartSnapshots.Count(); texts.Add(string.Format("Crew: {0}, Parts: {1}, Mass: {2:f2}t", crew, parts, mass)); switch (this.status) { case Statuses.pod: break; case Statuses.none: texts.Add("No command pod"); break; case Statuses.seat: texts.Add("Has command seat"); break; } } Text = string.Join("\n", texts.ToArray()); } } scrollPosition = GUILayout.BeginScrollView(scrollPosition); GUILayout.BeginVertical(GUILayout.ExpandWidth(true)); GUILayout.Label(Title, sectionStyle, GUILayout.ExpandWidth(true)); GUILayout.Space(wScale(16)); GUILayout.Label(Text, labelStyle, GUILayout.ExpandWidth(true)); GUILayout.EndVertical( ); GUILayout.EndScrollView( ); GUILayout.Space(wScale(8)); }
internal static void Draw(LightingSettings lightingSettings, SkyboxManager skyboxManager, bool showAdvanced) { GUILayout.BeginVertical(GUIStyles.Skin.box); { GUILayout.Label("Environment Skybox", GUIStyles.boldlabel); GUILayout.Space(1); //inactivate controls if no cubemap if (skyboxManager.TexturePaths.IsNullOrEmpty()) { GUILayout.Label("No custom cubemaps found"); } else { cubeMapScrollView = GUILayout.BeginScrollView(cubeMapScrollView); int selectedCubeMapIdx = GUILayout.SelectionGrid(skyboxManager.CurrentTextureIndex, skyboxManager.Previews.ToArray(), Inspector.Width / 150, GUIStyles.Skin.box); if (-1 != selectedCubeMapIdx) { skyboxManager.CurrentTexturePath = skyboxManager.TexturePaths[selectedCubeMapIdx]; } GUILayout.EndScrollView(); } GUILayout.Space(10); if (showAdvanced) { Label("Skybox Material", lightingSettings?.SkyboxSetting?.name ?? ""); Label("Sun Source", lightingSettings?.SunSetting?.name ?? ""); GUILayout.Space(10); } GUILayout.Label("Environment Lighting", GUIStyles.boldlabel); GUILayout.Space(1); Selection("Source", lightingSettings.AmbientModeSetting, mode => { lightingSettings.AmbientModeSetting = mode; if (mode != LightingSettings.AIAmbientMode.Skybox) { skyboxManager.CurrentTexturePath = SkyboxManager.noCubemap; } }); Slider("Intensity", lightingSettings.AmbientIntensity, LightSettings.IntensityMin, LightSettings.IntensityMax, "N1", intensity => { lightingSettings.AmbientIntensity = intensity; }); GUI.enabled = null != lightingSettings.SkyboxSetting; if (null != skyboxManager.Skybox && null != skyboxManager.Skyboxbg) { Slider("Exposure", skyboxManager.Exposure, ExposureMin, ExposureMax, "N1", exp => { skyboxManager.Exposure = exp; skyboxManager.Update = true; }); Slider("Rotation", skyboxManager.Rotation, RotationMin, RotationMax, "N1", rot => { skyboxManager.Rotation = rot; skyboxManager.Update = true; }); GUILayout.Space(10); SliderColor("Skybox Tint", skyboxManager.Tint, c => { skyboxManager.Tint = c; skyboxManager.Update = true; }, true); } GUILayout.Space(10); GUILayout.Label("Environment Reflections", GUIStyles.boldlabel); GUILayout.Space(1); Selection("Resolution", lightingSettings.ReflectionResolution, LightingSettings.ReflectionResolutions, resolution => lightingSettings.ReflectionResolution = resolution); Slider("Intensity", lightingSettings.ReflectionIntensity, 0f, 1f, "N1", intensity => { lightingSettings.ReflectionIntensity = intensity; }); Slider("Bounces", lightingSettings.ReflectionBounces, 1, 5, bounces => { lightingSettings.ReflectionBounces = bounces; }); } GUILayout.EndVertical(); GUILayout.Space(1); GUILayout.BeginVertical(GUIStyles.Skin.box); { GUILayout.Label("Reflection Probes", GUIStyles.boldlabel); ReflectionProbe[] rps = skyboxManager.GetReflectinProbes(); if (0 < rps.Length) { string[] probeNames = rps.Select(probe => probe.name).ToArray(); selectedProbe = GUILayout.SelectionGrid(selectedProbe, probeNames, 3, GUIStyles.toolbarbutton); ReflectionProbe rp = rps[selectedProbe]; GUILayout.Space(1); GUILayout.BeginVertical(GUIStyles.Skin.box); probeSettingsScrollView = GUILayout.BeginScrollView(probeSettingsScrollView); { Label("Type", rp.mode.ToString()); GUILayout.Label("Runtime settings"); Slider("Importance", rp.importance, 0, 1000, importance => rp.importance = importance); Slider("Intensity", rp.intensity, 0, 10, "N2", intensity => rp.intensity = intensity); rp.boxProjection = Toggle("Box Projection", rp.boxProjection); rp.blendDistance = Text("Blend Distance", rp.blendDistance); Dimension("Box Size", rp.size, size => rp.size = size); Dimension("Box Offset", rp.center, size => rp.center = size); GUILayout.Space(10); GUILayout.Label("Cubemap capture settings"); Selection("Resolution", rp.resolution, LightingSettings.ReflectionResolutions, resolution => rp.resolution = resolution); rp.hdr = Toggle("HDR", rp.hdr); rp.shadowDistance = Text("Shadow Distance", rp.shadowDistance); GUILayout.Label("Clear Flags"); Selection("Clear Flags", rp.clearFlags, flag => rp.clearFlags = flag); SliderColor("Background", rp.backgroundColor, colour => { rp.backgroundColor = colour; }); Label("Culling Mask", rp.cullingMask.ToString()); rp.nearClipPlane = Text("Clipping Planes - Near", rp.nearClipPlane, "N1"); rp.farClipPlane = Text("Clipping Planes - Far", rp.farClipPlane, "N1"); Selection("Time Slicing Mode", rp.timeSlicingMode, mode => rp.timeSlicingMode = mode); } GUILayout.EndScrollView(); GUILayout.EndVertical(); } } GUILayout.EndVertical(); GUI.enabled = true; }
public static bool EditFsmXmlSourceField(Fsm fsm, FsmXmlSource source) { source.sourceSelection = EditorGUILayout.Popup("Source selection", source.sourceSelection, source.sourceTypes); if (source.sourceString == null) { source.sourceString = new FsmString(); } source.sourceString.UseVariable = source.sourceSelection == 2; bool showPreview = false; string preview = ""; if (source.sourceSelection == 0) { source._sourceEdit = EditorGUILayout.Foldout(source._sourceEdit, new GUIContent("Edit")); if (source._sourceEdit) { source.sourceString.Value = EditorGUILayout.TextArea(source.sourceString.Value, GUILayout.Height(200)); } } else if (source.sourceSelection == 1) { source.sourcetextAsset = (TextAsset)EditorGUILayout.ObjectField("TextAsset Object", source.sourcetextAsset, typeof(TextAsset), false); if (source.sourcetextAsset != null) { source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview")); showPreview = source._sourcePreview; preview = source.sourcetextAsset.text; } } else if (source.sourceSelection == 2) { source.sourceString = VariableEditor.FsmStringField(new GUIContent("Fsm String"), fsm, source.sourceString, null); if (!source.sourceString.UseVariable) { source.sourceSelection = 0; return(true); } if (!source.sourceString.IsNone) { source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview")); showPreview = source._sourcePreview; preview = source.sourceString.Value; } } else if (source.sourceSelection == 3) { if (source.sourceProxyGameObject == null) { source.sourceProxyGameObject = new FsmGameObject(); source.sourceProxyReference = new FsmString(); } source.sourceProxyGameObject = VariableEditor.FsmGameObjectField(new GUIContent("GameObject"), fsm, source.sourceProxyGameObject); source.sourceProxyReference = VariableEditor.FsmStringField(new GUIContent("Reference"), fsm, source.sourceProxyReference, null); if (source.sourceProxyGameObject != null) { DataMakerXmlProxy proxy = DataMakerCore.GetDataMakerProxyPointer(typeof(DataMakerXmlProxy), source.sourceProxyGameObject.Value, source.sourceProxyReference.Value, true) as DataMakerXmlProxy; if (proxy != null) { if (proxy.XmlTextAsset != null) { source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview")); showPreview = source._sourcePreview; preview = proxy.XmlTextAsset.text; } else { //oupss... } } else { //oupss.. } } } else if (source.sourceSelection == 4) { if (source.inMemoryReference == null) { source.inMemoryReference = new FsmString(); } source.inMemoryReference = VariableEditor.FsmStringField(new GUIContent("Memory Reference"), fsm, source.inMemoryReference, null); if (!string.IsNullOrEmpty(source.inMemoryReference.Value)) { source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview")); showPreview = source._sourcePreview; preview = DataMakerXmlUtils.XmlNodeToString(DataMakerXmlUtils.XmlRetrieveNode(source.inMemoryReference.Value)); } } if (showPreview) { if (string.IsNullOrEmpty(preview)) { GUILayout.Label("-- empty --"); } else { source._scroll = GUILayout.BeginScrollView(source._scroll, "box", GUILayout.Height(200)); GUI.skin.box.alignment = TextAnchor.UpperLeft; GUILayout.Box(preview, "Label", null); GUILayout.EndScrollView(); } } return(false); }
private static void DrawMainGUI(int id) { GUILayout.BeginVertical(); { GUILayout.Space(20); ScrollPos = GUILayout.BeginScrollView(ScrollPos, GUIStyle.none, GUI.skin.verticalScrollbar, GUILayout.ExpandHeight(true), GUILayout.MaxHeight(MaxHeight - 22)); { GUILayout.BeginHorizontal(GUILayout.MaxWidth(WidthLim)); { GUILayout.Space(5); GUILayout.BeginVertical(); { if (EasyMode) { var maxWidth = GUILayout.ExpandWidth(true); //GUILayout.MaxWidth(WidthLim - 5); if (Utilities.CurrClassData?.data?.charFile == null) { GUILayout.Label( "This tool can change uniforms of all characters to the same style. Select a character to copy uniforms from.", maxWidth); //GUI.enabled = false; } else { GUILayout.Label("Copy uniforms from the selected character to all characters in:", maxWidth); if (GUILayout.Button("This Class")) { Utilities.LoadColorsFromCharacter(false); ThreadingHelper.Instance.StartSyncInvoke(() => { Clothes.StrictUniform = 0; // This needs to happen next frame after loading data Utilities.ApplySettings(Utilities.Apply.Class); }); } if (GUILayout.Button("All Classes")) { Utilities.LoadColorsFromCharacter(false); ThreadingHelper.Instance.StartSyncInvoke(() => { Clothes.StrictUniform = 0; // This needs to happen next frame after loading data Utilities.ApplySettings(Utilities.Apply.All); }); } } GUILayout.Space(5); if (GUILayout.Button("Advanced mode")) { EasyMode = false; } } else { if (GUILayout.Button("Load From Selected")) { Utilities.LoadColorsFromCharacter(); } AdvancedMode = GUILayout.Toggle(AdvancedMode, "Advanced Controls"); if (AdvancedMode) { AdvancedColor(); } DrawOutfitsToChange(); DrawPartsToChange(); DrawColorsToChange(); DrawUniformToApply(); Outfits.EmblemFlag = GUILayout.Toggle(Outfits.EmblemFlag, "Change Emblem"); if (!GUIChanged) { GUI.enabled = false; } if (GUILayout.Button("Apply to Selected")) { Utilities.ApplySettings(Utilities.Apply.Card); } if (GUILayout.Button("Apply to Class")) { Utilities.ApplySettings(Utilities.Apply.Class); } if (GUILayout.Button("Apply to All")) { Utilities.ApplySettings(Utilities.Apply.All); } } } GUILayout.EndVertical(); GUILayout.Space(24); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } if (GUI.changed) { GUIChanged = true; } }
internal void OnGUI() { Event e = Event.current; LoadIcons(); if (!m_HasUpdatedGuiStyles) { m_LineHeight = Mathf.RoundToInt(Constants.ErrorStyle.lineHeight); m_BorderHeight = Constants.ErrorStyle.border.top + Constants.ErrorStyle.border.bottom; UpdateListView(); } GUILayout.BeginHorizontal(Constants.Toolbar); if (GUILayout.Button(Constants.ClearLabel, Constants.MiniButton)) { LogEntries.Clear(); GUIUtility.keyboardControl = 0; } int currCount = LogEntries.GetCount(); if (m_ListView.totalRows != currCount && m_ListView.totalRows > 0) { // scroll bar was at the bottom? if (m_ListView.scrollPos.y >= m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight) { m_ListView.scrollPos.y = currCount * RowHeight - ms_LVHeight; } } EditorGUILayout.Space(); bool wasCollapsed = HasFlag(ConsoleFlags.Collapse); SetFlag(ConsoleFlags.Collapse, GUILayout.Toggle(wasCollapsed, Constants.CollapseLabel, Constants.MiniButton)); bool collapsedChanged = (wasCollapsed != HasFlag(ConsoleFlags.Collapse)); if (collapsedChanged) { // unselect if collapsed flag changed m_ListView.row = -1; // scroll to bottom m_ListView.scrollPos.y = LogEntries.GetCount() * RowHeight; } SetFlag(ConsoleFlags.ClearOnPlay, GUILayout.Toggle(HasFlag(ConsoleFlags.ClearOnPlay), Constants.ClearOnPlayLabel, Constants.MiniButton)); SetFlag(ConsoleFlags.ClearOnBuild, GUILayout.Toggle(HasFlag(ConsoleFlags.ClearOnBuild), Constants.ClearOnBuildLabel, Constants.MiniButton)); SetFlag(ConsoleFlags.ErrorPause, GUILayout.Toggle(HasFlag(ConsoleFlags.ErrorPause), Constants.ErrorPauseLabel, Constants.MiniButton)); ConnectionGUILayout.AttachToPlayerDropdown(m_ConsoleAttachToPlayerState, EditorStyles.toolbarDropDown); EditorGUILayout.Space(); if (m_DevBuild) { GUILayout.FlexibleSpace(); SetFlag(ConsoleFlags.StopForAssert, GUILayout.Toggle(HasFlag(ConsoleFlags.StopForAssert), Constants.StopForAssertLabel, Constants.MiniButton)); SetFlag(ConsoleFlags.StopForError, GUILayout.Toggle(HasFlag(ConsoleFlags.StopForError), Constants.StopForErrorLabel, Constants.MiniButton)); } GUILayout.FlexibleSpace(); // Search bar GUILayout.Space(4f); SearchField(e); GUILayout.Space(4f); // Flags int errorCount = 0, warningCount = 0, logCount = 0; LogEntries.GetCountsByType(ref errorCount, ref warningCount, ref logCount); EditorGUI.BeginChangeCheck(); bool setLogFlag = GUILayout.Toggle(HasFlag(ConsoleFlags.LogLevelLog), new GUIContent((logCount <= 999 ? logCount.ToString() : "999+"), logCount > 0 ? iconInfoSmall : iconInfoMono), Constants.MiniButton); bool setWarningFlag = GUILayout.Toggle(HasFlag(ConsoleFlags.LogLevelWarning), new GUIContent((warningCount <= 999 ? warningCount.ToString() : "999+"), warningCount > 0 ? iconWarnSmall : iconWarnMono), Constants.MiniButton); bool setErrorFlag = GUILayout.Toggle(HasFlag(ConsoleFlags.LogLevelError), new GUIContent((errorCount <= 999 ? errorCount.ToString() : "999+"), errorCount > 0 ? iconErrorSmall : iconErrorMono), Constants.MiniButton); // Active entry index may no longer be valid if (EditorGUI.EndChangeCheck()) { SetActiveEntry(null); } SetFlag(ConsoleFlags.LogLevelLog, setLogFlag); SetFlag(ConsoleFlags.LogLevelWarning, setWarningFlag); SetFlag(ConsoleFlags.LogLevelError, setErrorFlag); GUILayout.EndHorizontal(); // Console entries SplitterGUILayout.BeginVerticalSplit(spl); int rowHeight = RowHeight; EditorGUIUtility.SetIconSize(new Vector2(rowHeight, rowHeight)); GUIContent tempContent = new GUIContent(); int id = GUIUtility.GetControlID(0); int rowDoubleClicked = -1; /////@TODO: Make Frame selected work with ListViewState using (new GettingLogEntriesScope(m_ListView)) { int selectedRow = -1; bool openSelectedItem = false; bool collapsed = HasFlag(ConsoleFlags.Collapse); foreach (ListViewElement el in ListViewGUI.ListView(m_ListView, Constants.Box)) { if (e.type == EventType.MouseDown && e.button == 0 && el.position.Contains(e.mousePosition)) { selectedRow = m_ListView.row; if (e.clickCount == 2) { openSelectedItem = true; } } else if (e.type == EventType.Repaint) { int mode = 0; string text = null; LogEntries.GetLinesAndModeFromEntryInternal(el.row, Constants.LogStyleLineCount, ref mode, ref text); // Draw the background GUIStyle s = el.row % 2 == 0 ? Constants.OddBackground : Constants.EvenBackground; s.Draw(el.position, false, false, m_ListView.row == el.row, false); // Draw the icon GUIStyle iconStyle = GetStyleForErrorMode(mode, true, Constants.LogStyleLineCount == 1); iconStyle.Draw(el.position, false, false, m_ListView.row == el.row, false); // Draw the text tempContent.text = text; GUIStyle errorModeStyle = GetStyleForErrorMode(mode, false, Constants.LogStyleLineCount == 1); if (string.IsNullOrEmpty(m_SearchText)) { errorModeStyle.Draw(el.position, tempContent, id, m_ListView.row == el.row); } else { //the whole text contains the searchtext, we have to know where it is int startIndex = text.IndexOf(m_SearchText, StringComparison.OrdinalIgnoreCase); if (startIndex == -1) // the searchtext is not in the visible text, we don't show the selection { errorModeStyle.Draw(el.position, tempContent, id, m_ListView.row == el.row); } else // the searchtext is visible, we show the selection { int endIndex = startIndex + m_SearchText.Length; const bool isActive = false; const bool hasKeyboardFocus = true; // This ensure we draw the selection text over the label. const bool drawAsComposition = false; Color selectionColor = GUI.skin.settings.selectionColor; errorModeStyle.DrawWithTextSelection(el.position, tempContent, isActive, hasKeyboardFocus, startIndex, endIndex, drawAsComposition, selectionColor); } } if (collapsed) { Rect badgeRect = el.position; tempContent.text = LogEntries.GetEntryCount(el.row) .ToString(CultureInfo.InvariantCulture); Vector2 badgeSize = Constants.CountBadge.CalcSize(tempContent); badgeRect.xMin = badgeRect.xMax - badgeSize.x; badgeRect.yMin += ((badgeRect.yMax - badgeRect.yMin) - badgeSize.y) * 0.5f; badgeRect.x -= 5f; GUI.Label(badgeRect, tempContent, Constants.CountBadge); } } } if (selectedRow != -1) { if (m_ListView.scrollPos.y >= m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight) { m_ListView.scrollPos.y = m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight - 1; } } // Make sure the selected entry is up to date if (m_ListView.totalRows == 0 || m_ListView.row >= m_ListView.totalRows || m_ListView.row < 0) { if (m_ActiveText.Length != 0) { SetActiveEntry(null); } } else { LogEntry entry = new LogEntry(); LogEntries.GetEntryInternal(m_ListView.row, entry); SetActiveEntry(entry); // see if selected entry changed. if so - clear additional info LogEntries.GetEntryInternal(m_ListView.row, entry); if (m_ListView.selectionChanged || !m_ActiveText.Equals(entry.message)) { SetActiveEntry(entry); } } // Open entry using return key if ((GUIUtility.keyboardControl == m_ListView.ID) && (e.type == EventType.KeyDown) && (e.keyCode == KeyCode.Return) && (m_ListView.row != 0)) { selectedRow = m_ListView.row; openSelectedItem = true; } if (e.type != EventType.Layout && ListViewGUI.ilvState.rectHeight != 1) { ms_LVHeight = ListViewGUI.ilvState.rectHeight; } if (openSelectedItem) { rowDoubleClicked = selectedRow; e.Use(); } } // Prevent dead locking in EditorMonoConsole by delaying callbacks (which can log to the console) until after LogEntries.EndGettingEntries() has been // called (this releases the mutex in EditorMonoConsole so logging again is allowed). Fix for case 1081060. if (rowDoubleClicked != -1) { LogEntries.RowGotDoubleClicked(rowDoubleClicked); } EditorGUIUtility.SetIconSize(Vector2.zero); // Display active text (We want word wrapped text with a vertical scrollbar) m_TextScroll = GUILayout.BeginScrollView(m_TextScroll, Constants.Box); string stackWithHyperlinks = StacktraceWithHyperlinks(m_ActiveText); float height = Constants.MessageStyle.CalcHeight(GUIContent.Temp(stackWithHyperlinks), position.width); EditorGUILayout.SelectableLabel(stackWithHyperlinks, Constants.MessageStyle, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true), GUILayout.MinHeight(height)); GUILayout.EndScrollView(); SplitterGUILayout.EndVerticalSplit(); // Copy & Paste selected item if ((e.type == EventType.ValidateCommand || e.type == EventType.ExecuteCommand) && e.commandName == EventCommandNames.Copy && m_ActiveText != string.Empty) { if (e.type == EventType.ExecuteCommand) { EditorGUIUtility.systemCopyBuffer = m_ActiveText; } e.Use(); } }
internal static void ShaderErrorListUI(UnityEngine.Object shader, ShaderError[] errors, ref Vector2 scrollPosition) { int num = errors.Length; GUILayout.Space(5f); GUILayout.Label(string.Format("Errors ({0}):", num), EditorStyles.boldLabel, new GUILayoutOption[0]); int controlID = GUIUtility.GetControlID(CustomShaderInspector.kErrorViewHash, FocusType.Passive); float minHeight = Mathf.Min(( float )num * 20f + 40f, 150f); scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUISkinEx.GetCurrentSkin().box, new GUILayoutOption[] { GUILayout.MinHeight(minHeight) }); EditorGUIUtility.SetIconSize(new Vector2(16f, 16f)); float height = CustomShaderInspector.Styles.messageStyle.CalcHeight(EditorGUIUtilityEx.TempContent(CustomShaderInspector.Styles.errorIcon), 100f); Event current = Event.current; for (int i = 0; i < num; i++) { Rect controlRect = EditorGUILayout.GetControlRect(false, height, new GUILayoutOption[0]); string message = errors[i].message; string platform = errors[i].platform; bool flag = errors[i].warning != 0; string lastPathNameComponent = FileUtilEx.GetLastPathNameComponent(errors[i].file); int line = errors[i].line; if (current.type == EventType.MouseDown && current.button == 0 && controlRect.Contains(current.mousePosition)) { GUIUtility.keyboardControl = controlID; if (current.clickCount == 2) { string file = errors[i].file; UnityEngine.Object @object = (!string.IsNullOrEmpty(file)) ? AssetDatabase.LoadMainAssetAtPath(file) : null; AssetDatabase.OpenAsset(@object ?? shader, line); GUIUtility.ExitGUI(); } current.Use(); } if (current.type == EventType.ContextClick && controlRect.Contains(current.mousePosition)) { current.Use(); GenericMenu genericMenu = new GenericMenu(); int errorIndex = i; genericMenu.AddItem(new GUIContent("Copy error text"), false, delegate { string text = errors[errorIndex].message; if (!string.IsNullOrEmpty(errors[errorIndex].messageDetails)) { text += '\n'; text += errors[errorIndex].messageDetails; } EditorGUIUtility.systemCopyBuffer = text; }); genericMenu.ShowAsContext(); } if (current.type == EventType.Repaint && (i & 1) == 0) { GUIStyle evenBackground = CustomShaderInspector.Styles.evenBackground; evenBackground.Draw(controlRect, false, false, false, false); } Rect rect = controlRect; rect.xMin = rect.xMax; if (line > 0) { GUIContent content; if (string.IsNullOrEmpty(lastPathNameComponent)) { content = EditorGUIUtilityEx.TempContent(line.ToString(System.Globalization.CultureInfo.InvariantCulture)); } else { content = EditorGUIUtilityEx.TempContent(lastPathNameComponent + ":" + line.ToString(System.Globalization.CultureInfo.InvariantCulture)); } Vector2 vector = EditorStyles.miniLabel.CalcSize(content); rect.xMin -= vector.x; GUI.Label(rect, content, EditorStyles.miniLabel); rect.xMin -= 2f; if (rect.width < 30f) { rect.xMin = rect.xMax - 30f; } } Rect position = rect; position.width = 0f; if (platform.Length > 0) { GUIContent content2 = EditorGUIUtilityEx.TempContent(platform); Vector2 vector2 = EditorStyles.miniLabel.CalcSize(content2); position.xMin -= vector2.x; Color contentColor = GUI.contentColor; GUI.contentColor = new Color(1f, 1f, 1f, 0.5f); GUI.Label(position, content2, EditorStyles.miniLabel); GUI.contentColor = contentColor; position.xMin -= 2f; } Rect position2 = controlRect; position2.xMax = position.xMin; GUI.Label(position2, EditorGUIUtilityEx.TempContent(message, (!flag) ? CustomShaderInspector.Styles.errorIcon : CustomShaderInspector.Styles.warningIcon), CustomShaderInspector.Styles.messageStyle); } EditorGUIUtility.SetIconSize(Vector2.zero); GUILayout.EndScrollView(); }
public void RenderOnGUI() { GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height)); GUILayout.Label("Variables:"); GUILayout.Label("m_Image:"); GUILayout.Label(m_Image); GUILayout.Label("m_FilterTextInputMessage:"); m_FilterTextInputMessage = GUILayout.TextField(m_FilterTextInputMessage, 40); GUILayout.EndArea(); GUILayout.BeginVertical("box"); m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33)); GUILayout.Label("GetSecondsSinceAppActive() : " + SteamUtils.GetSecondsSinceAppActive()); GUILayout.Label("GetSecondsSinceComputerActive() : " + SteamUtils.GetSecondsSinceComputerActive()); GUILayout.Label("GetConnectedUniverse() : " + SteamUtils.GetConnectedUniverse()); GUILayout.Label("GetServerRealTime() : " + SteamUtils.GetServerRealTime()); GUILayout.Label("GetIPCountry() : " + SteamUtils.GetIPCountry()); { uint ImageWidth = 0; uint ImageHeight = 0; bool ret = SteamUtils.GetImageSize(1, out ImageWidth, out ImageHeight); GUILayout.Label("SteamUtils.GetImageSize(1, out ImageWidth, out ImageHeight) : " + ret + " -- " + ImageWidth + " -- " + ImageHeight); if (GUILayout.Button("SteamUtils.GetImageRGBA(1, Image, (int)(ImageWidth * ImageHeight * 4)")) { if (ImageWidth > 0 && ImageHeight > 0) { byte[] Image = new byte[ImageWidth * ImageHeight * 4]; ret = SteamUtils.GetImageRGBA(1, Image, (int)(ImageWidth * ImageHeight * 4)); print("SteamUtils.GetImageRGBA(1, " + Image + ", " + (int)(ImageWidth * ImageHeight * 4) + ") - " + ret + " -- " + ImageWidth + " -- " + ImageHeight); if (ret) { m_Image = new Texture2D((int)ImageWidth, (int)ImageHeight, TextureFormat.RGBA32, false, true); m_Image.LoadRawTextureData(Image); m_Image.Apply(); } } } } { uint IP; ushort Port; bool ret = SteamUtils.GetCSERIPPort(out IP, out Port); GUILayout.Label("GetCSERIPPort(out IP, out Port) : " + ret + " -- " + IP + " -- " + Port); } GUILayout.Label("GetCurrentBatteryPower() : " + SteamUtils.GetCurrentBatteryPower()); GUILayout.Label("GetAppID() : " + SteamUtils.GetAppID()); if (GUILayout.Button("SetOverlayNotificationPosition(ENotificationPosition.k_EPositionTopRight)")) { SteamUtils.SetOverlayNotificationPosition(ENotificationPosition.k_EPositionTopRight); print("SteamUtils.SetOverlayNotificationPosition(" + ENotificationPosition.k_EPositionTopRight + ")"); } //GUILayout.Label("SteamUtils.IsAPICallCompleted() : " + SteamUtils.IsAPICallCompleted()); // N/A - These 3 functions are used to dispatch CallResults. //GUILayout.Label("SteamUtils.GetAPICallFailureReason() : " + SteamUtils.GetAPICallFailureReason()); // N/A //GUILayout.Label("SteamUtils.GetAPICallResult() : " + SteamUtils.GetAPICallResult()); // N/A GUILayout.Label("GetIPCCallCount() : " + SteamUtils.GetIPCCallCount()); //GUILayout.Label("SteamUtils.SetWarningMessageHook() : " + SteamUtils.SetWarningMessageHook()); // N/A - Check out SteamTest.cs for example usage. GUILayout.Label("IsOverlayEnabled() : " + SteamUtils.IsOverlayEnabled()); GUILayout.Label("BOverlayNeedsPresent() : " + SteamUtils.BOverlayNeedsPresent()); if (GUILayout.Button("CheckFileSignature(\"FileNotFound.txt\")")) { SteamAPICall_t handle = SteamUtils.CheckFileSignature("FileNotFound.txt"); OnCheckFileSignatureCallResult.Set(handle); print("SteamUtils.CheckFileSignature(" + "\"FileNotFound.txt\"" + ") : " + handle); } if (GUILayout.Button("ShowGamepadTextInput(EGamepadTextInputMode.k_EGamepadTextInputModeNormal, EGamepadTextInputLineMode.k_EGamepadTextInputLineModeSingleLine, \"Description Test!\", 32, \"test\")")) { bool ret = SteamUtils.ShowGamepadTextInput(EGamepadTextInputMode.k_EGamepadTextInputModeNormal, EGamepadTextInputLineMode.k_EGamepadTextInputLineModeSingleLine, "Description Test!", 32, "test"); print("SteamUtils.ShowGamepadTextInput(" + EGamepadTextInputMode.k_EGamepadTextInputModeNormal + ", " + EGamepadTextInputLineMode.k_EGamepadTextInputLineModeSingleLine + ", " + "\"Description Test!\"" + ", " + 32 + ", " + "\"test\"" + ") : " + ret); } // Only called from within GamepadTextInputDismissed_t Callback! /*GUILayout.Label("SteamUtils.GetEnteredGamepadTextLength() : " + SteamUtils.GetEnteredGamepadTextLength()); * * { * string Text; * bool ret = SteamUtils.GetEnteredGamepadTextInput(out Text, 32); * GUILayout.Label("SteamUtils.GetEnteredGamepadTextInput(out Text, 32) - " + ret + " -- " + Text); * }*/ GUILayout.Label("GetSteamUILanguage() : " + SteamUtils.GetSteamUILanguage()); GUILayout.Label("IsSteamRunningInVR() : " + SteamUtils.IsSteamRunningInVR()); if (GUILayout.Button("SetOverlayNotificationInset(400, 400)")) { SteamUtils.SetOverlayNotificationInset(400, 400); print("SteamUtils.SetOverlayNotificationInset(" + 400 + ", " + 400 + ")"); } GUILayout.Label("IsSteamInBigPictureMode() : " + SteamUtils.IsSteamInBigPictureMode()); if (GUILayout.Button("StartVRDashboard()")) { SteamUtils.StartVRDashboard(); print("SteamUtils.StartVRDashboard()"); } GUILayout.Label("IsVRHeadsetStreamingEnabled() : " + SteamUtils.IsVRHeadsetStreamingEnabled()); if (GUILayout.Button("SetVRHeadsetStreamingEnabled(!SteamUtils.IsVRHeadsetStreamingEnabled())")) { SteamUtils.SetVRHeadsetStreamingEnabled(!SteamUtils.IsVRHeadsetStreamingEnabled()); print("SteamUtils.SetVRHeadsetStreamingEnabled(" + !SteamUtils.IsVRHeadsetStreamingEnabled() + ")"); } GUILayout.Label("IsSteamChinaLauncher() : " + SteamUtils.IsSteamChinaLauncher()); if (GUILayout.Button("InitFilterText()")) { bool ret = SteamUtils.InitFilterText(); print("SteamUtils.InitFilterText() : " + ret); } if (GUILayout.Button("FilterText(out OutFilteredText, (uint)m_FilterTextInputMessage.Length, m_FilterTextInputMessage, false)")) { string OutFilteredText; int ret = SteamUtils.FilterText(out OutFilteredText, (uint)m_FilterTextInputMessage.Length, m_FilterTextInputMessage, false); print("SteamUtils.FilterText(" + "out OutFilteredText" + ", " + (uint)m_FilterTextInputMessage.Length + ", " + m_FilterTextInputMessage + ", " + false + ") : " + ret + " -- " + OutFilteredText); } if (GUILayout.Button("GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol.k_ESteamIPv6ConnectivityProtocol_HTTP)")) { ESteamIPv6ConnectivityState ret = SteamUtils.GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol.k_ESteamIPv6ConnectivityProtocol_HTTP); print("SteamUtils.GetIPv6ConnectivityState(" + ESteamIPv6ConnectivityProtocol.k_ESteamIPv6ConnectivityProtocol_HTTP + ") : " + ret); } GUILayout.EndScrollView(); GUILayout.EndVertical(); }
private void OnWindow(int window_id) { try { GUILayout.BeginVertical(); // Get all modules of the selected part: var part_title = ""; Part part = null; KRnDModule rnd_module = null; List <ModuleEngines> engine_modules = null; ModuleRCS rcs_module = null; ModuleReactionWheel reaction_wheel_module = null; ModuleDeployableSolarPanel solar_panel_module = null; ModuleWheelBase landing_leg_module = null; PartResource electric_charge_resource = null; ModuleGenerator generator_module = null; PartModule fission_generator = null; List <ModuleResourceConverter> converter_modules = null; ModuleParachute parachute_module = null; ModuleDataTransmitter antenna_module = null; ModuleScienceLab science_lab = null; List <PartResource> fuel_resources = null; ModuleResourceHarvester harvester_module = null; ModuleActiveRadiator radiator_module = null; ELConverter el_converter = null; if (selectedPart != null) { foreach (var a_part in PartLoader.LoadedPartsList) { if (a_part.partPrefab.name == selectedPart.name) { part = a_part.partPrefab; part_title = a_part.title; break; } } if (part) { antenna_module = PartStats.GetModuleDataTransmitter(part); science_lab = PartStats.GetModuleScienceLab(part); rnd_module = PartStats.GetKRnDModule(part); engine_modules = PartStats.GetModuleEnginesList(part); rcs_module = PartStats.GetModuleRCS(part); reaction_wheel_module = PartStats.GetModuleReactionWheel(part); solar_panel_module = PartStats.GetModuleDeployableSolarPanel(part); landing_leg_module = PartStats.GetModuleWheelBase(part); electric_charge_resource = PartStats.GetElectricCharge(part); generator_module = PartStats.GetModuleGenerator(part); fission_generator = PartStats.GetFissionGenerator(part); converter_modules = PartStats.GetModuleResourceConverterList(part); parachute_module = PartStats.GetModuleParachute(part); fuel_resources = PartStats.GetFuelResources(part); harvester_module = PartStats.GetModuleResourceHarvester(part); radiator_module = PartStats.GetModuleActiveRadiator(part); el_converter = PartStats.GetModuleElConverter(part); } } if (!part) { // No part selected: GUILayout.BeginArea(new Rect(10, 5, _windowStyle.fixedWidth, 20)); GUILayout.Label("<b>Kerbal R&D: Select a part to improve</b>", _labelStyle); GUILayout.EndArea(); GUILayout.EndVertical(); GUI.DragWindow(); return; } if (!rnd_module) { // Invalid part selected: GUILayout.BeginArea(new Rect(10, 5, _windowStyle.fixedWidth, 20)); GUILayout.Label("<b>Kerbal R&D: Select a different part to improve</b>", _labelStyle); GUILayout.EndArea(); GUILayout.EndVertical(); GUI.DragWindow(); return; } // Get stats of the current version of the selected part: if (!KRnD.upgrades.TryGetValue(part.name, out var current_upgrade)) { current_upgrade = new PartUpgrades(); } var current_info = BuildPartInfoString(part, current_upgrade); // Create a copy of the part-stats which we can use to mock an upgrade further below: var next_upgrade = current_upgrade.Clone(); // Title: GUILayout.BeginArea(new Rect(10, 5, _windowStyle.fixedWidth, 20)); var version = rnd_module.GetVersion(); if (version != "") { version = " - " + version; } GUILayout.Label("<b>" + part_title + version + "</b>", _labelStyle); GUILayout.EndArea(); // List with upgrade-options: float options_width = 100; var options_height = _windowStyle.fixedHeight - 30 - 30 - 20; GUILayout.BeginArea(new Rect(10, 30 + 20, options_width, options_height)); GUILayout.BeginVertical(); var options = new List <string> { "Dry Mass", "Max Temp" }; if (engine_modules != null || rcs_module) { options.Add("ISP Vac"); options.Add("ISP Atm"); options.Add("Fuel Flow"); } if (antenna_module != null) { options.Add("Antenna Power"); } if (antenna_module != null && antenna_module.antennaType != AntennaType.INTERNAL) { options.Add("Packet Size"); } if (science_lab != null) { options.Add("Data Storage"); } if (reaction_wheel_module != null) { options.Add("Torque"); } if (solar_panel_module != null) { options.Add("Charge Rate"); } if (landing_leg_module != null) { options.Add("Crash Tolerance"); } if (electric_charge_resource != null) { options.Add("Battery"); } //if (fuel_resources != null) options.Add("Fuel Pressure"); if (generator_module || fission_generator) { options.Add("Generator"); } if (converter_modules != null) { options.Add("Converter"); } if (parachute_module) { options.Add("Parachute"); } if (harvester_module) { options.Add("Harvester"); } if (radiator_module) { options.Add("Radiator"); } if (el_converter) { options.Add("EL Converter"); } if (_selectedUpgradeOption >= options.Count) { _selectedUpgradeOption = 0; } _selectedUpgradeOption = GUILayout.SelectionGrid(_selectedUpgradeOption, options.ToArray(), 1, _buttonStyle); GUILayout.EndVertical(); GUILayout.EndArea(); var selected_upgrade_option = options.ToArray()[_selectedUpgradeOption]; int current_upgrade_level; int next_upgrade_level; int science_cost; float current_improvement_factor; float next_improvement_factor; UpgradeConstants u_constants; if (!KRnD.originalStats.TryGetValue(part.name, out var original_stats)) { throw new Exception("no original-stats for part '" + part.name + "'"); } //Func<PartUpgrades, int> improve_function; if (selected_upgrade_option == "ISP Vac") { //improve_function = KRnD.ImproveIspVac; current_upgrade_level = current_upgrade.ispVac; next_upgrade_level = ++next_upgrade.ispVac; u_constants = ValueConstants.GetData(StringConstants.ISP_VAC); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.ispVac); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.ispVac); science_cost = u_constants.CalculateScienceCost(0, next_upgrade.ispVac); } else if (selected_upgrade_option == "ISP Atm") { //improve_function = KRnD.ImproveIspAtm; current_upgrade_level = current_upgrade.ispAtm; next_upgrade_level = ++next_upgrade.ispAtm; u_constants = ValueConstants.GetData(StringConstants.ISP_ATM); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.ispAtm); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.ispAtm); science_cost = u_constants.CalculateScienceCost(0, next_upgrade.ispAtm); } else if (selected_upgrade_option == "Fuel Flow") { //improve_function = KRnD.ImproveFuelFlow; current_upgrade_level = current_upgrade.fuelFlow; next_upgrade_level = ++next_upgrade.fuelFlow; u_constants = ValueConstants.GetData(StringConstants.FUEL_FLOW); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.fuelFlow); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.fuelFlow); science_cost = u_constants.CalculateScienceCost(0, next_upgrade.fuelFlow); } else if (selected_upgrade_option == "Dry Mass") { //improve_function = KRnD.ImproveDryMass; current_upgrade_level = current_upgrade.dryMass; next_upgrade_level = ++next_upgrade.dryMass; u_constants = ValueConstants.GetData(StringConstants.DRY_MASS); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.dryMass); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.dryMass); science_cost = u_constants.CalculateScienceCost(original_stats.dryMass, next_upgrade.dryMass); } else if (selected_upgrade_option == "Torque") { //improve_function = KRnD.ImproveTorque; current_upgrade_level = current_upgrade.torqueStrength; next_upgrade_level = ++next_upgrade.torqueStrength; u_constants = ValueConstants.GetData(StringConstants.TORQUE); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.torqueStrength); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.torqueStrength); science_cost = u_constants.CalculateScienceCost(original_stats.torqueStrength, next_upgrade.torqueStrength); } else if (selected_upgrade_option == "Antenna Power") { //improve_function = KRnD.ImproveAntennaPower; current_upgrade_level = current_upgrade.antennaPower; next_upgrade_level = ++next_upgrade.antennaPower; u_constants = ValueConstants.GetData(StringConstants.ANTENNA_POWER); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.antennaPower); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.antennaPower); science_cost = u_constants.CalculateScienceCost((float)original_stats.antennaPower, next_upgrade.antennaPower); } else if (selected_upgrade_option == "Packet Size") { //improve_function = KRnD.ImprovePacketSize; current_upgrade_level = current_upgrade.packetSize; next_upgrade_level = ++next_upgrade.packetSize; u_constants = ValueConstants.GetData(StringConstants.PACKET_SIZE); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.packetSize); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.packetSize); science_cost = u_constants.CalculateScienceCost(original_stats.packetSize, next_upgrade.packetSize); } else if (selected_upgrade_option == "Data Storage") { //improve_function = KRnD.ImproveDataStorage; current_upgrade_level = current_upgrade.dataStorage; next_upgrade_level = ++next_upgrade.dataStorage; u_constants = ValueConstants.GetData(StringConstants.DATA_STORAGE); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.dataStorage); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.dataStorage); science_cost = u_constants.CalculateScienceCost(original_stats.dataStorage, next_upgrade.dataStorage); } else if (selected_upgrade_option == "Harvester") { //improve_function = KRnD.ImproveResourceHarvester; current_upgrade_level = current_upgrade.resourceHarvester; next_upgrade_level = ++next_upgrade.resourceHarvester; u_constants = ValueConstants.GetData(StringConstants.RESOURCE_HARVESTER); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.resourceHarvester); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.resourceHarvester); science_cost = u_constants.CalculateScienceCost(original_stats.resourceHarvester, next_upgrade.resourceHarvester); } else if (selected_upgrade_option == "Radiator") { //improve_function = KRnD.ImproveActiveRadiator; current_upgrade_level = current_upgrade.maxEnergyTransfer; next_upgrade_level = ++next_upgrade.maxEnergyTransfer; u_constants = ValueConstants.GetData(StringConstants.ENERGY_TRANSFER); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.maxEnergyTransfer); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.maxEnergyTransfer); science_cost = u_constants.CalculateScienceCost((float)original_stats.maxEnergyTransfer, next_upgrade.maxEnergyTransfer); } else if (selected_upgrade_option == "Charge Rate") { //improve_function = KRnD.ImproveChargeRate; current_upgrade_level = current_upgrade.efficiencyMult; next_upgrade_level = ++next_upgrade.efficiencyMult; u_constants = ValueConstants.GetData(StringConstants.CHARGE_RATE); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.efficiencyMult); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.efficiencyMult); science_cost = u_constants.CalculateScienceCost(original_stats.efficiencyMult, next_upgrade.efficiencyMult); } else if (selected_upgrade_option == "Crash Tolerance") { //improve_function = KRnD.ImproveCrashTolerance; current_upgrade_level = current_upgrade.crashTolerance; next_upgrade_level = ++next_upgrade.crashTolerance; u_constants = ValueConstants.GetData(StringConstants.CRASH_TOLERANCE); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.crashTolerance); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.crashTolerance); science_cost = u_constants.CalculateScienceCost(original_stats.crashTolerance, next_upgrade.crashTolerance); } else if (selected_upgrade_option == "Battery") { //improve_function = KRnD.ImproveBatteryCharge; current_upgrade_level = current_upgrade.batteryCharge; next_upgrade_level = ++next_upgrade.batteryCharge; u_constants = ValueConstants.GetData(StringConstants.BATTERY_CHARGE); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.batteryCharge); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.batteryCharge); science_cost = u_constants.CalculateScienceCost((float)original_stats.batteryCharge, next_upgrade.batteryCharge); } else if (selected_upgrade_option == "Fuel Pressure") { //improve_function = KRnD.ImproveFuelCapacity; current_upgrade_level = current_upgrade.fuelCapacity; next_upgrade_level = ++next_upgrade.fuelCapacity; u_constants = ValueConstants.GetData(StringConstants.FUEL_CAPACITY); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.fuelCapacity); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.fuelCapacity); science_cost = u_constants.CalculateScienceCost((float)original_stats.fuelCapacitiesSum, next_upgrade.fuelCapacity); } else if (selected_upgrade_option == "Generator") { //improve_function = KRnD.ImproveGeneratorEfficiency; current_upgrade_level = current_upgrade.generatorEfficiency; next_upgrade_level = ++next_upgrade.generatorEfficiency; u_constants = ValueConstants.GetData(StringConstants.GENERATOR_EFFICIENCY); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.generatorEfficiency); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.generatorEfficiency); science_cost = u_constants.CalculateScienceCost(0, next_upgrade.generatorEfficiency); } else if (selected_upgrade_option == "Converter") { //improve_function = KRnD.ImproveConverterEfficiency; current_upgrade_level = current_upgrade.converterEfficiency; next_upgrade_level = ++next_upgrade.converterEfficiency; u_constants = ValueConstants.GetData(StringConstants.CONVERTER_EFFICIENCY); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.converterEfficiency); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.converterEfficiency); science_cost = u_constants.CalculateScienceCost(0, next_upgrade.converterEfficiency); } else if (selected_upgrade_option == "Parachute") { //improve_function = KRnD.ImproveParachuteStrength; current_upgrade_level = current_upgrade.parachuteStrength; next_upgrade_level = ++next_upgrade.parachuteStrength; u_constants = ValueConstants.GetData(StringConstants.PARACHUTE_STRENGTH); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.parachuteStrength); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.parachuteStrength); science_cost = u_constants.CalculateScienceCost((float)original_stats.chuteMaxTemp, next_upgrade.parachuteStrength); } else if (selected_upgrade_option == "Max Temp") { //improve_function = KRnD.ImproveMaxTemperature; current_upgrade_level = current_upgrade.maxTemperature; next_upgrade_level = ++next_upgrade.maxTemperature; u_constants = ValueConstants.GetData(StringConstants.MAX_TEMPERATURE); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.maxTemperature); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.maxTemperature); science_cost = u_constants.CalculateScienceCost((float)original_stats.intMaxTemp, next_upgrade.maxTemperature); } else if (selected_upgrade_option == "EL Converter") { //improve_function = KRnD.ImproveMaxTemperature; current_upgrade_level = current_upgrade.elConverter; next_upgrade_level = ++next_upgrade.elConverter; u_constants = ValueConstants.GetData(StringConstants.EL_CONVERTER); current_improvement_factor = u_constants.CalculateImprovementFactor(current_upgrade.elConverter); next_improvement_factor = u_constants.CalculateImprovementFactor(next_upgrade.elConverter); science_cost = u_constants.CalculateScienceCost((float)original_stats.ELConverter, next_upgrade.elConverter); } else { throw new Exception("unexpected option '" + selected_upgrade_option + "'"); } var new_info = BuildPartInfoString(part, next_upgrade); // Calculate part-info if the selected stat was upgraded. new_info = HighlightChanges(current_info, new_info); // Current stats: GUILayout.BeginArea(new Rect(10 + options_width + 10, 30, _windowStyle.fixedWidth, 20)); GUILayout.Label("<color=#FFFFFF><b>Current:</b> " + current_upgrade_level + " (" + current_improvement_factor.ToString("+0.##%;-0.##%;-") + ")</color>", _labelStyle); GUILayout.EndArea(); var area_width = (_windowStyle.fixedWidth - 20 - options_width) / 2; var area_height = options_height; GUILayout.BeginArea(new Rect(10 + options_width, 30 + 20, area_width, area_height)); _scrollPos = GUILayout.BeginScrollView(_scrollPos, _scrollStyle, GUILayout.Width(area_width), GUILayout.Height(area_height)); GUILayout.Label(current_info, _labelStyleSmall); GUILayout.EndScrollView(); GUILayout.EndArea(); // Next stats: GUILayout.BeginArea(new Rect(10 + options_width + area_width + 10, 30, _windowStyle.fixedWidth, 20)); GUILayout.Label("<color=#FFFFFF><b>Next upgrade:</b> " + next_upgrade_level + " (" + next_improvement_factor.ToString("+0.##%;-0.##%;-") + ")</color>", _labelStyle); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(10 + options_width + area_width, 30 + 20, area_width, area_height)); _scrollPos = GUILayout.BeginScrollView(_scrollPos, _scrollStyle, GUILayout.Width(area_width), GUILayout.Height(area_height)); GUILayout.Label(new_info, _labelStyleSmall); GUILayout.EndScrollView(); GUILayout.EndArea(); // Bottom-line (display only if the upgrade would have an effect): if (Math.Abs(current_improvement_factor - next_improvement_factor) > float.Epsilon) { GUILayout.BeginArea(new Rect(10, _windowStyle.fixedHeight - 25, _windowStyle.fixedWidth, 30)); float current_science = 0; if (ResearchAndDevelopment.Instance != null) { current_science = ResearchAndDevelopment.Instance.Science; } var color = "FF0000"; if (current_science >= science_cost) { color = "00FF00"; } GUILayout.Label("<b>Science: <color=#" + color + ">" + science_cost + " / " + Math.Floor(current_science) + "</color></b>", _labelStyle); GUILayout.EndArea(); if (current_science >= science_cost && ResearchAndDevelopment.Instance != null && u_constants != null /*&& improve_function != null*/) { GUILayout.BeginArea(new Rect(_windowStyle.fixedWidth - 110, _windowStyle.fixedHeight - 30, 100, 30)); if (GUILayout.Button("Research", _buttonStyle)) { //upgrade_function(part); try { if (!KRnD.upgrades.TryGetValue(part.name, out var store)) { store = new PartUpgrades(); KRnD.upgrades.Add(part.name, store); } u_constants.upgradeFunction(store); //improve_function(store); KRnD.UpdateGlobalParts(); KRnD.UpdateEditorVessel(); } catch (Exception e) { Debug.LogError("[KRnD] UpgradeIspVac(): " + e); } ResearchAndDevelopment.Instance.AddScience(-science_cost, TransactionReasons.RnDTechResearch); } GUILayout.EndArea(); } } GUILayout.EndVertical(); GUI.DragWindow(); } catch (Exception e) { Debug.LogError("[KRnD] GenerateWindow(): " + e); } }
// Render the log output in a scroll view. void GUIDisplayLog() { scrollViewVector = GUILayout.BeginScrollView(scrollViewVector); GUILayout.Label(logText); GUILayout.EndScrollView(); }
void OnGUI() { if (_isCompiling != EditorApplication.isCompiling) { _isCompiling = EditorApplication.isCompiling; Reload(); } GUILayout.BeginHorizontal(); GUILayout.Label("WrapFolder:", GUILayout.Width(100)); _wrapFolder = GUILayout.TextField(_wrapFolder); GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.Label(" You can make Wrap with this tool simply.\n" + " Step 1 : Type Full class name in the box below(eg . UnityEngine.Vector3)\n" + " Step 2 : Click \"Add/Update\" button"); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUI.backgroundColor = Color.green; GUILayout.Label("Full Classname : ", GUILayout.Width(100)); _classInput = GUILayout.TextField(_classInput, GUILayout.MinWidth(100)); GUI.enabled = !string.IsNullOrEmpty(_classInput); if (GUILayout.Button("Add/Update", GUILayout.Width(100))) { string className = ""; string assemblyName = ""; //string[] s = _classInput.Split('.'); //if(s.Length == 1) { // assemblyName = ""; // className = s[0]; //} //else if(s.Length == 2) { // assemblyName = s[0]; // className = s[1]; //} int dotIndex = _classInput.LastIndexOf('.'); if (dotIndex == -1) { assemblyName = ""; className = _classInput; } else { assemblyName = _classInput.Substring(0, dotIndex); className = _classInput.Substring(dotIndex + 1); } WrapClass wc = GetWrapClass(assemblyName); if (wc == null) { wc = new WrapClass(assemblyName); AddClass(assemblyName, className); } else { if (!wc.m_classes.Contains(className)) { AddClass(assemblyName, className); } else { UpdateClass(assemblyName, className); } } _classInput = ""; } GUI.enabled = true; GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); //GUILayout.BeginHorizontal(); //if(GUILayout.Button("UpdateAll")) { // // Reload(); //} //GUI.backgroundColor = Color.red; //if(GUILayout.Button("Clear", GUILayout.Width(60))) { // ClearAll(); //} //GUI.backgroundColor = Color.white; //GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.Label("Wraps : "); mScroll = GUILayout.BeginScrollView(mScroll); GUILayout.BeginVertical(); foreach (var kvp in m_wrapClasses) { GUILayout.BeginHorizontal(); if (_folderNamespace.Contains(kvp.m_nameSpace)) { if (GUILayout.Button("\u25BC", GUILayout.Width(25))) { _folderNamespace.Remove(kvp.m_nameSpace); } } else { if (GUILayout.Button("\u25BA", GUILayout.Width(25))) { _folderNamespace.Add(kvp.m_nameSpace); } } GUILayout.Label("Namespace", GUILayout.Width(80)); GUILayout.TextField(kvp.m_nameSpace, GUILayout.Width(200)); GUILayout.Label(" " + kvp.m_classes.Count + " Classes", GUILayout.Width(80)); //GUILayout.Space(90); GUILayout.EndHorizontal(); if (_folderNamespace.Contains(kvp.m_nameSpace)) { for (int i = 0; i < kvp.m_classes.Count; i++) { GUILayout.BeginHorizontal(); GUILayout.Space(60); GUILayout.Label(" Class", GUILayout.Width(54)); GUILayout.TextField(kvp.m_classes[i]); GUI.backgroundColor = Color.cyan; if (GUILayout.Button("Update", GUILayout.Width(60))) { UpdateClass(kvp.m_nameSpace, kvp.m_classes[i]); } GUI.backgroundColor = Color.red; if (GUILayout.Button("X", GUILayout.Width(25))) { RemoveClass(kvp.m_nameSpace, kvp.m_classes[i]); return; } GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); } } GUILayout.Space(5); } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.Space(10); GUILayout.Label("If the Serializable Field is missing, Click the button below ↓"); GUILayout.Space(5); if (GUILayout.Button("Reload")) { Reload(); } GUILayout.Space(10); }
public void OnGUI() { mWindowUiScrollPos = GUILayout.BeginScrollView(mWindowUiScrollPos); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("AB目录:", GUILayout.Width(50.0f)); ABFolderPath = EditorGUILayout.TextField("", ABFolderPath); if (GUILayout.Button("选择AB目录", GUILayout.Width(150.0f))) { ABFolderPath = EditorUtility.OpenFolderPanel("AB目录", "请选择需要分析的AB所在目录!", ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("MD5输出目录:", GUILayout.Width(80.0f)); ABMd5OutputFolderPath = EditorGUILayout.TextField("", ABMd5OutputFolderPath); if (GUILayout.Button("选择MD5输出目录", GUILayout.Width(150.0f))) { ABMd5OutputFolderPath = EditorUtility.OpenFolderPanel("MD5输出目录", "请选择需要AB的MD5分析输出目录!", ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("计算目标目录AB的MD5", GUILayout.Width(150.0f))) { doAssetBundleMd5Caculation(); } GUILayout.EndHorizontal(); displayAssetBundleMd5CaculationResult(); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("MD5对比旧文件路径:", GUILayout.Width(120.0f)); ABMd5CompareSourceFilePath = EditorGUILayout.TextField("", ABMd5CompareSourceFilePath); if (GUILayout.Button("选择MD5对比旧文件", GUILayout.Width(150.0f))) { ABMd5CompareSourceFilePath = EditorUtility.OpenFilePanel("MD5对比旧文件", "请选择需要对比的旧MD5分析文件路径!", "txt"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("MD5对比新文件路径:", GUILayout.Width(120.0f)); ABMd5CompareTargetFilePath = EditorGUILayout.TextField("", ABMd5CompareTargetFilePath); if (GUILayout.Button("选择MD5对比新文件", GUILayout.Width(150.0f))) { ABMd5CompareTargetFilePath = EditorUtility.OpenFilePanel("MD5对比新文件", "请选择需要对比的新MD5分析文件路径!", "txt"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("对比新老版本的MD5", GUILayout.Width(150.0f))) { doAssetBundleMd5Comparison(); } GUILayout.EndHorizontal(); displayComparisonResult(); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("热更新AB准备目录:", GUILayout.Width(100.0f)); HotUpdateABOutputFolderPath = EditorGUILayout.TextField("", HotUpdateABOutputFolderPath); if (GUILayout.Button("选择热更新AB准备目录", GUILayout.Width(150.0f))) { HotUpdateABOutputFolderPath = EditorUtility.OpenFolderPanel("热更新AB准备目录", "请选择热更新AB准备目录!", ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("执行热更新AB准备任务", GUILayout.Width(150.0f))) { doHotUpdateABPreparationTask(); } GUILayout.EndHorizontal(); displayHotUpdateABPreparationResult(); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("热更新版本号:", GUILayout.Width(100.0f)); mHotUpdateVersion = EditorGUILayout.TextField(mHotUpdateVersion, GUILayout.Width(100.0f)); EditorGUILayout.LabelField("热更新资源版本号:", GUILayout.Width(100.0f)); mHotUpdateResourceVersion = EditorGUILayout.TextField(mHotUpdateResourceVersion, GUILayout.Width(100.0f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("热更新目录:", GUILayout.Width(100.0f)); HotUpdateOutputFolderPath = EditorGUILayout.TextField("", HotUpdateOutputFolderPath); if (GUILayout.Button("选择热更新目录", GUILayout.Width(150.0f))) { HotUpdateOutputFolderPath = EditorUtility.OpenFolderPanel("热更新目录", "请选择热更新目录!", ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("执行热更新准备任务", GUILayout.Width(150.0f))) { doHotUpdatePreparationTask(); } GUILayout.EndHorizontal(); displayHotUpdatePreparationResult(); displayNotice(); GUILayout.EndVertical(); GUILayout.EndScrollView(); }
void OnGUI() { if (richLabelStyle == null) { richLabelStyle = new GUIStyle(GUI.skin.label); richLabelStyle.richText = true; richLabelStyle.wordWrap = true; richButtonStyle = new GUIStyle(GUI.skin.button); richButtonStyle.richText = true; iconButtonStyle = new GUIStyle(GUI.skin.button); iconButtonStyle.normal.background = null; iconButtonStyle.imagePosition = ImagePosition.ImageOnly; iconButtonStyle.fixedWidth = 80; iconButtonStyle.fixedHeight = 80; } Rect headerRect = new Rect(0, 0, 530, 207); GUI.DrawTexture(headerRect, headerPic, ScaleMode.ScaleAndCrop, false); #if UNITY_4_3 GUILayout.Space(204); #else GUILayout.Space(214); #endif GUILayout.BeginVertical(); // Doc GUILayout.BeginHorizontal(); if (GUILayout.Button("<b>Documentation</b>\n<size=9>Complete manual, examples, tips & tricks</size>", richButtonStyle, GUILayout.MaxWidth(260), GUILayout.Height(36))) { Application.OpenURL("file://" + Application.dataPath + pathManual); } if (GUILayout.Button("<b>Rate it</b>\n<size=9>Leave a review on the Asset Store</size>", richButtonStyle, GUILayout.Height(36))) { Application.OpenURL("https://www.assetstore.unity3d.com/#/content/3842"); } GUILayout.EndHorizontal(); // Contact HR(4, 2); GUILayout.BeginHorizontal(); if (GUILayout.Button("<b>E-mail</b>\n<size=9>[email protected]</size>", richButtonStyle, GUILayout.MaxWidth(172), GUILayout.Height(36))) { Application.OpenURL("mailto:[email protected]"); } if (GUILayout.Button("<b>Twitter</b>\n<size=9>@Chman</size>", richButtonStyle, GUILayout.Height(36))) { Application.OpenURL("http://twitter.com/Chman"); } if (GUILayout.Button("<b>Support Forum</b>\n<size=9>Unity Community</size>", richButtonStyle, GUILayout.MaxWidth(172), GUILayout.Height(36))) { Application.OpenURL("http://forum.unity3d.com/threads/colorful-post-fx-photoshop-like-color-correction-tools.143417/"); } GUILayout.EndHorizontal(); // Changelog HR(4, 0); changelogScroll = GUILayout.BeginScrollView(changelogScroll); GUILayout.Label(changelogText, richLabelStyle); GUILayout.EndScrollView(); // Promo HR(0, 0); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(iconTypogenic, iconButtonStyle)) { Application.OpenURL("https://www.assetstore.unity3d.com/#/content/19182"); } if (GUILayout.Button(iconChromatica, iconButtonStyle)) { Application.OpenURL("https://www.assetstore.unity3d.com/#/content/20743"); } if (GUILayout.Button(iconColorful, iconButtonStyle)) { Application.OpenURL("https://www.assetstore.unity3d.com/#/content/3842"); } if (GUILayout.Button(iconSSAOPro, iconButtonStyle)) { Application.OpenURL("https://www.assetstore.unity3d.com/#/content/22369"); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
void drawBaseManagerWindow(int windowID) { string Base; float Range; LaunchSite lNearest; LaunchSite lBase; string smessage = ""; BoxNoBorder = new GUIStyle(GUI.skin.box); BoxNoBorder.normal.background = null; BoxNoBorder.normal.textColor = Color.white; LabelInfo = new GUIStyle(GUI.skin.label); LabelInfo.normal.background = null; LabelInfo.normal.textColor = Color.white; LabelInfo.fontSize = 13; LabelInfo.fontStyle = FontStyle.Bold; LabelInfo.padding.left = 3; LabelInfo.padding.top = 0; LabelInfo.padding.bottom = 0; DeadButton = new GUIStyle(GUI.skin.button); DeadButton.normal.background = null; DeadButton.hover.background = null; DeadButton.active.background = null; DeadButton.focused.background = null; DeadButton.normal.textColor = Color.white; DeadButton.hover.textColor = Color.white; DeadButton.active.textColor = Color.white; DeadButton.focused.textColor = Color.white; DeadButton.fontSize = 14; DeadButton.fontStyle = FontStyle.Bold; DeadButtonRed = new GUIStyle(GUI.skin.button); DeadButtonRed.normal.background = null; DeadButtonRed.hover.background = null; DeadButtonRed.active.background = null; DeadButtonRed.focused.background = null; DeadButtonRed.normal.textColor = Color.red; DeadButtonRed.hover.textColor = Color.yellow; DeadButtonRed.active.textColor = Color.red; DeadButtonRed.focused.textColor = Color.red; DeadButtonRed.fontSize = 12; DeadButtonRed.fontStyle = FontStyle.Bold; GUILayout.BeginHorizontal(); { GUI.enabled = false; GUILayout.Button("-KK-", DeadButton, GUILayout.Height(16)); GUILayout.FlexibleSpace(); GUILayout.Button("Inflight Base Boss", DeadButton, GUILayout.Height(16)); GUILayout.FlexibleSpace(); GUI.enabled = true; if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(16))) { bShowFacilities = false; KerbalKonstructs.instance.showFlightManager = false; } } GUILayout.EndHorizontal(); GUILayout.Space(1); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(5); GUILayout.Box("Flight Tools", BoxNoBorder); GUILayout.BeginHorizontal(); { GUILayout.Space(2); GUILayout.Label("ATC ", LabelInfo); if (KerbalKonstructs.instance.enableATC) { tToggle = tIconOpen; } else { tToggle = tIconClosed; } if (GUILayout.Button(tToggle, GUILayout.Height(18), GUILayout.Width(18))) { if (KerbalKonstructs.instance.enableATC) { KerbalKonstructs.instance.enableATC = false; } else { KerbalKonstructs.instance.enableATC = true; } } KerbalKonstructs.instance.showATC = (KerbalKonstructs.instance.enableATC); GUILayout.FlexibleSpace(); GUILayout.Label("NGS ", LabelInfo); if (KerbalKonstructs.instance.enableNGS) { tToggle2 = tIconOpen; } else { tToggle2 = tIconClosed; } if (GUILayout.Button(tToggle2, GUILayout.Height(18), GUILayout.Width(18))) { if (KerbalKonstructs.instance.enableNGS) { KerbalKonstructs.instance.enableNGS = false; } else { KerbalKonstructs.instance.enableNGS = true; } } KerbalKonstructs.instance.showNGS = (KerbalKonstructs.instance.enableNGS); GUILayout.FlexibleSpace(); GUILayout.Label("Downlink ", LabelInfo); if (KerbalKonstructs.instance.enableDownlink) { tToggle2 = tIconOpen; } else { tToggle2 = tIconClosed; } if (GUILayout.Button(tToggle2, GUILayout.Height(18), GUILayout.Width(18))) { if (KerbalKonstructs.instance.enableDownlink) { KerbalKonstructs.instance.enableDownlink = false; } else { KerbalKonstructs.instance.enableDownlink = true; } } KerbalKonstructs.instance.showDownlink = (KerbalKonstructs.instance.enableDownlink); GUILayout.Space(2); } GUILayout.EndHorizontal(); GUILayout.Space(6); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box("Base Proximity", BoxNoBorder); if (MiscUtils.isCareerGame()) { GUILayout.BeginHorizontal(); { string snearestopen = ""; LaunchSiteManager.getNearestOpenBase(FlightGlobals.ActiveVessel.GetTransform().position, out Base, out Range, out lNearest); if (Range < 10000) { snearestopen = Base + " at " + Range.ToString("#0.0") + " m"; } else { snearestopen = Base + " at " + (Range / 1000).ToString("#0.0") + " km"; } GUILayout.Space(5); GUILayout.Label("Nearest Open: ", LabelInfo); GUILayout.Label(snearestopen, LabelInfo, GUILayout.Width(150)); if (KerbalKonstructs.instance.enableNGS) { GUILayout.FlexibleSpace(); if (GUILayout.Button("NGS", GUILayout.Height(21))) { NavGuidanceSystem.setTargetSite(lNearest); smessage = "NGS set to " + Base; MiscUtils.HUDMessage(smessage, 10, 2); } } } GUILayout.EndHorizontal(); GUILayout.Space(2); } GUILayout.BeginHorizontal(); { string sNearestbase = ""; LaunchSiteManager.getNearestBase(FlightGlobals.ActiveVessel.GetTransform().position, out Base, out Range, out lBase); if (Range < 10000) { sNearestbase = Base + " at " + Range.ToString("#0.0") + " m"; } else { sNearestbase = Base + " at " + (Range / 1000).ToString("#0.0") + " km"; } GUILayout.Space(5); GUILayout.Label("Nearest Base: ", LabelInfo); GUILayout.Label(sNearestbase, LabelInfo, GUILayout.Width(150)); if (KerbalKonstructs.instance.enableNGS) { GUILayout.FlexibleSpace(); if (GUILayout.Button("NGS", GUILayout.Height(21))) { NavGuidanceSystem.setTargetSite(lBase); smessage = "NGS set to " + Base; MiscUtils.HUDMessage(smessage, 10, 2); } } } GUILayout.EndHorizontal(); if (MiscUtils.isCareerGame()) { bool bLanded = (FlightGlobals.ActiveVessel.Landed); if (Range < 2000) { string sClosed; float fOpenCost; LaunchSiteManager.getSiteOpenCloseState(Base, out sClosed, out fOpenCost); fOpenCost = fOpenCost / 2f; if (bLanded && sClosed == "Closed") { GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); if (GUILayout.Button("Open Base for " + fOpenCost + " funds", GUILayout.Height(23))) { double currentfunds = Funding.Instance.Funds; if (fOpenCost > currentfunds) { MiscUtils.HUDMessage("Insufficient funds to open this site!", 10, 0); } else { Funding.Instance.AddFunds(-fOpenCost, TransactionReasons.Cheating); LaunchSiteManager.setSiteOpenCloseState(Base, "Open"); smessage = Base + " opened"; MiscUtils.HUDMessage(smessage, 10, 2); } } } if (bLanded && sClosed == "Open") { GUI.enabled = false; GUILayout.Button("Base is Open", GUILayout.Height(23)); GUI.enabled = true; } GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); } if (Range > 100000) { if (bLanded) { GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); if (GUILayout.Button("Found a New Base", GUILayout.Height(23))) { foundingBase = true; } GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); } } } if (FlightGlobals.ActiveVessel.Landed) { if (GUILayout.Button("Nearby Facilities", GUILayout.Height(23))) { if (bShowFacilities) { bShowFacilities = false; } else { foreach (StaticObject soStaticobj in KerbalKonstructs.instance.getStaticDB().getAllStatics()) { if ((string)soStaticobj.model.getSetting("DefaultFacilityType") == "None") { continue; } if (soStaticobj.pqsCity.sphere == FlightGlobals.currentMainBody.pqsController) { var dist2 = Vector3.Distance(FlightGlobals.ActiveVessel.GetTransform().position, soStaticobj.gameObject.transform.position); if (dist2 > 5000f) { continue; } } else { continue; } PersistenceUtils.loadStaticPersistence(soStaticobj); } bShowFacilities = true; } } scrollPos = GUILayout.BeginScrollView(scrollPos); if (bShowFacilities) { foreach (StaticObject obj in KerbalKonstructs.instance.getStaticDB().getAllStatics()) { bool isLocal = true; if (obj.pqsCity.sphere == FlightGlobals.currentMainBody.pqsController) { var dist = Vector3.Distance(FlightGlobals.ActiveVessel.GetTransform().position, obj.gameObject.transform.position); isLocal = dist < 5000f; } else { isLocal = false; } if ((string)obj.model.getSetting("DefaultFacilityType") == "None") { isLocal = false; } if (isLocal) { GUILayout.BeginHorizontal(); { bIsOpen = ((string)obj.getSetting("OpenCloseState") == "Open"); if (!bIsOpen) { iFundsOpen2 = (float)obj.model.getSetting("cost"); if (iFundsOpen2 == 0) { bIsOpen = true; } } if (GUILayout.Button((string)obj.model.getSetting("title"), GUILayout.Height(23))) { selectedObject = obj; KerbalKonstructs.instance.selectObject(obj, false, true, false); PersistenceUtils.loadStaticPersistence(obj); FacilityManager.setSelectedFacility(obj); KerbalKonstructs.instance.showFacilityManager = true; } if (bIsOpen) { GUILayout.Label(tIconOpen, GUILayout.Height(23), GUILayout.Width(23)); } if (!bIsOpen) { GUILayout.Label(tIconClosed, GUILayout.Height(23), GUILayout.Width(23)); } } GUILayout.EndHorizontal(); } } } else { GUILayout.Label("Click the button above to display a list of nearby operational facilities.", LabelInfo); if (KerbalKonstructs.instance.DebugMode) { GUILayout.Box("Debug Mode ActiveVessel Report"); GUILayout.Label("Name " + FlightGlobals.ActiveVessel.vesselName); GUILayout.Label("Acceleration " + FlightGlobals.ActiveVessel.acceleration.ToString()); GUILayout.Label("Angular Momentum " + FlightGlobals.ActiveVessel.angularMomentum.ToString("#0.000")); GUILayout.Label("Angular Velocity " + FlightGlobals.ActiveVessel.angularVelocity.ToString("#0.000")); GUILayout.Label("Centrifugal Acc " + FlightGlobals.ActiveVessel.CentrifugalAcc.ToString()); GUILayout.Label("Horiz Srf Speed " + FlightGlobals.ActiveVessel.horizontalSrfSpeed.ToString("#0.00")); GUILayout.Label("Indicated Air Speed " + FlightGlobals.ActiveVessel.indicatedAirSpeed.ToString("#0.00")); GUILayout.Label("Mach " + FlightGlobals.ActiveVessel.mach.ToString("#0.00")); GUILayout.Label("Orbit Speed " + FlightGlobals.ActiveVessel.obt_speed.ToString("#0.00")); GUILayout.Label("Orbit Velocity " + FlightGlobals.ActiveVessel.obt_velocity.ToString()); GUILayout.Label("Perturbation " + FlightGlobals.ActiveVessel.perturbation.ToString()); GUILayout.Label("rb_velocity " + FlightGlobals.ActiveVessel.rb_velocity.ToString("#0.000")); GUILayout.Label("Specific Acc " + FlightGlobals.ActiveVessel.specificAcceleration.ToString("#0.00")); GUILayout.Label("speed " + FlightGlobals.ActiveVessel.speed.ToString("#0.00")); GUILayout.Label("srf_velocity " + FlightGlobals.ActiveVessel.srf_velocity.ToString()); GUILayout.Label("srfspeed " + FlightGlobals.ActiveVessel.srfSpeed.ToString("#0.00")); } } } GUILayout.EndScrollView(); GUILayout.Space(2); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.FlexibleSpace(); GUILayout.Space(3); if (GUILayout.Button("I want to race!", GUILayout.Height(23))) { KerbalKonstructs.instance.showRacingApp = true; AirRacing.runningRace = true; KerbalKonstructs.instance.showNGS = false; KerbalKonstructs.instance.showFlightManager = false; } GUILayout.Space(5); GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUI.DragWindow(new Rect(0, 0, 10000, 10000)); }
protected void OnGUI() { GUILayout.BeginVertical(); // Display Logo GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(cinemaSuiteLogo); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); // Display installed products GUILayout.Space(5); GUILayout.FlexibleSpace(); if (isDirectorInstalled) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(CINEMA_DIRECTOR); GUILayout.FlexibleSpace(); GUILayout.Label(string.Format("version {0}", directorProductVersion)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } if (isMocapInstalled) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(CINEMA_MO_CAP); GUILayout.FlexibleSpace(); GUILayout.Label(string.Format("version {0}", mocapProductVersion)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } if (EditorPrefs.HasKey("CinemaProCamsVersion")) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(CINEMA_PRO_CAMS); GUILayout.FlexibleSpace(); GUILayout.Label(string.Format("version {0}", EditorPrefs.GetString("CinemaProCamsVersion"))); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } // Display links and emails GUILayout.Space(5); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.Space(50f); GUILayout.Label(VISIT_WEBSITE); GUILayout.FlexibleSpace(); if (GUILayout.Button(WEBSITE)) { Application.OpenURL(WEBSITE); } GUILayout.Space(50f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(50f); GUILayout.Label(SUPPORT); GUILayout.FlexibleSpace(); if (GUILayout.Button(SUPPORT_WEBSITE)) { Application.OpenURL(SUPPORT_WEBSITE); } GUILayout.Space(50f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(50f); GUILayout.Label(EMAIL_SUPPORT); GUILayout.FlexibleSpace(); GUILayout.Label(EMAIL); GUILayout.Space(50f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(50f); GUILayout.Label(LIKE_US); GUILayout.FlexibleSpace(); if (GUILayout.Button(facebookLogo)) { Application.OpenURL("www.facebook.com/CinemaSuiteInc"); } GUILayout.Label(CINEMA_SUITE_INC); GUILayout.Space(50f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(50f); GUILayout.Label(FOLLOW_US); GUILayout.FlexibleSpace(); if (GUILayout.Button(twitterLogo)) { Application.OpenURL("www.twitter.com/CinemaSuiteInc"); } GUILayout.Label(CINEMA_SUITE_INC); GUILayout.Space(50f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(50f); GUILayout.Label(WATCH_US); GUILayout.FlexibleSpace(); if (GUILayout.Button(youtubeLogo)) { Application.OpenURL("www.youtube.com/CinemaSuiteInc"); } GUILayout.Label(CINEMA_SUITE_INC); GUILayout.Space(50f); GUILayout.EndHorizontal(); // Display disclaimer GUILayout.Space(5); GUILayout.FlexibleSpace(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true); GUILayout.TextArea(DISCLAIMER1 + DISCLAIMER2 + DISCLAIMER3 + DISCLAIMER4 + DISCLAIMER5 + DISCLAIMER6); GUILayout.EndScrollView(); // Display supporters GUILayout.Space(10f); GUILayout.TextArea(CMF_THANKS); GUILayout.Space(5f); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(cmfLogo); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.EndVertical(); }
void OnGUI() { GUI.color = Color.gray; EditorGUILayout.HelpBox("Customized Prefab Palette", MessageType.None); GUI.color = Color.white; EditorGUILayout.Space(); FOLDER = (Object)EditorGUILayout.ObjectField("Input Folder", FOLDER, typeof(Object), false); if (GUI.changed && FOLDER != null) { folderPath = AssetDatabase.GetAssetPath(FOLDER); CHECKDIR = File.GetAttributes(folderPath); if (CHECKDIR == FileAttributes.Directory) { DIRINFO = new DirectoryInfo(folderPath); DICPREFABSDATA.Clear(); foreach (var t in DIRINFO.GetFiles()) { try { if (DICPREFABSDATA.Count > 49) { break; } } catch { } if (t.Name.Contains(".meta") && t.Name.Contains(".prefab")) { continue; } else if (t.Name.Contains(".prefab")) { DICPREFABSDATA[t.ToString()] = t; } } PREFABSCHECK.Clear(); PREFABSCHECK = DICPREFABSDATA.Values.Select(s => (GameObject)AssetDatabase.LoadAssetAtPath(DirPathNameFactory(s.ToString()), typeof(GameObject))).ToList(); foreach (var t in PREFABSCHECK) { if (!PREFABS.Contains(t)) { PREFABS.Add(t); } } PREFABTEXTURELIST.Clear(); AssetPreview.SetPreviewTextureCacheSize(0); AssetPreview.SetPreviewTextureCacheSize(5000); } else { string title1 = "Error Meassage"; string msg1 = "폴더가 아닙니다. 폴더를 선택해 주세요.\n Must Imported Folder!"; EditorUtility.DisplayDialog(title1, msg1, "OK"); } FOLDER = null; Repaint(); } PREFAB = (GameObject)EditorGUILayout.ObjectField("Input Prefab", PREFAB, typeof(GameObject), false); if (GUI.changed) { if (AssetDatabase.GetAssetPath(PREFAB).Contains(".prefab") && !PREFABS.Contains((GameObject)PREFAB)) { PREFABS.Add((GameObject)PREFAB); } PREFAB = null; Repaint(); } if (GUILayout.Button(" LOAD SELECTED PREFABS", GUILayout.Height(22)) && Selection.objects.Length > 0) { foreach (var t in Selection.objects) { if (AssetDatabase.GetAssetPath(t).Contains(".prefab") && !PREFABS.Contains((GameObject)t)) { PREFABS.Add((GameObject)t); } } } int columns = Mathf.FloorToInt(Screen.width / 85); GUI.color = new Color(0.3f, 0.3f, 0.3f); GUILayout.BeginHorizontal(GUI.skin.box); SCROLLVIEWPREVIEW = GUILayout.BeginScrollView(SCROLLVIEWPREVIEW); GUILayout.BeginHorizontal(); for (int i = 0; i < PREFABS.Count; i++) { if (PREFABS[i] == null) { MapMagEditor.RandomFrefabOn = false; MapMag.selectPrefab = null; SceneView.RepaintAll(); PREFABS.RemoveAt(i); Repaint(); } try { if (i % columns == 0) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); } GUI.color = Color.white; if (AssetPreview.GetAssetPreview(PREFABS[i]) == null) { buttonTexture = AssetPreview.GetMiniThumbnail(PREFABS[i]); } else { buttonTexture = AssetPreview.GetAssetPreview(PREFABS[i]); } GUILayout.BeginVertical(GUILayout.Width(80)); if (GUILayout.Button(buttonTexture, GUILayout.Width(80), GUILayout.Height(80))) { MapMagEditor.RandomFrefabOn = false; MapMag.selectPrefab = PREFABS[i]; SceneView.RepaintAll(); } GUI.color = new Color(0.3f, 0.3f, 0.3f); prefabName = PREFABS[i].name; if (prefabName.Length > 11) { prefabName = prefabName.Substring(0, 10); } EditorGUILayout.HelpBox(prefabName, MessageType.None); GUI.color = new Color(0.4f, 0.4f, 0.4f); if (GUILayout.Button("Delete", GUILayout.Width(80), GUILayout.Height(18))) { MapMagEditor.RandomFrefabOn = false; MapMag.selectPrefab = null; SceneView.RepaintAll(); PREFABS.RemoveAt(i); } GUILayout.EndVertical(); Repaint(); GUI.color = Color.white; } catch { } } GUILayout.EndHorizontal(); GUILayout.EndScrollView(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("REMOVE ALL PREFABS DATA", GUILayout.MaxWidth(220))) { PREFABS.Clear(); PREFABTEXTURELIST.Clear(); DICPREFABSDATA.Clear(); FOLDER = null; } GUI.color = PREFABS.Count >= 50 ? Color.yellow : Color.white; EditorGUILayout.HelpBox(" Current Buttons : " + PREFABS.Count + "", MessageType.None); GUILayout.EndHorizontal(); }
void OnGUI() { if (!PhotonNetwork.connected) { ShowConnectingGUI(); return; //Wait for a connection } if (PhotonNetwork.room != null) { return; //Only when we're not in a Room } GUILayout.BeginArea(new Rect((Screen.width - 400) / 2, (Screen.height - 300) / 2, 400, 300)); GUILayout.Label("Main Menu"); //Player name GUILayout.BeginHorizontal(); GUILayout.Label("Player name:", GUILayout.Width(150)); PhotonNetwork.playerName = GUILayout.TextField(PhotonNetwork.playerName); if (GUI.changed)//Save name { PlayerPrefs.SetString("playerName", PhotonNetwork.playerName); } GUILayout.EndHorizontal(); GUILayout.Space(15); //Join room by title GUILayout.BeginHorizontal(); GUILayout.Label("JOIN ROOM:", GUILayout.Width(150)); roomName = GUILayout.TextField(roomName); if (GUILayout.Button("GO")) { PhotonNetwork.JoinRoom(roomName); } GUILayout.EndHorizontal(); //Create a room (fails if exist!) GUILayout.BeginHorizontal(); GUILayout.Label("CREATE ROOM:", GUILayout.Width(150)); roomName = GUILayout.TextField(roomName); if (GUILayout.Button("GO")) { PhotonNetwork.CreateRoom(roomName, true, true, 10); } GUILayout.EndHorizontal(); //Join random room GUILayout.BeginHorizontal(); GUILayout.Label("JOIN RANDOM ROOM:", GUILayout.Width(150)); if (PhotonNetwork.GetRoomList().Length == 0) { GUILayout.Label("..no games available..."); } else { if (GUILayout.Button("GO")) { PhotonNetwork.JoinRandomRoom(); } } GUILayout.EndHorizontal(); GUILayout.Space(30); GUILayout.Label("ROOM LISTING:"); if (PhotonNetwork.GetRoomList().Length == 0) { GUILayout.Label("..no games available.."); } else { //Room listing: simply call GetRoomList: no need to fetch/poll whatever! scrollPos = GUILayout.BeginScrollView(scrollPos); foreach (RoomInfo game in PhotonNetwork.GetRoomList()) { GUILayout.BeginHorizontal(); GUILayout.Label(game.name + " " + game.playerCount + "/" + game.maxPlayers); if (GUILayout.Button("JOIN")) { PhotonNetwork.JoinRoom(game.name); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } GUILayout.EndArea(); }
void OnGUI() { if (!initedStyle) { GUIStyle entryInfoTyle = "CN EntryInfo"; textAreaStyle.richText = true; textAreaStyle.normal.textColor = entryInfoTyle.normal.textColor; initedStyle = true; } string[] statehints = new string[LuaState.statemap.Count]; LuaState[] states = new LuaState[LuaState.statemap.Count]; int n = 0; foreach (var k in LuaState.statemap.Values) { states[n] = k; statehints[n++] = k.Name; } stateIndex = EditorGUILayout.Popup(stateIndex, statehints); LuaState l = null; if (stateIndex >= 0 && stateIndex < states.Length) { l = states[stateIndex]; } if (current != null && current != l) { current.logDelegate -= AddLog; current.errorDelegate -= AddError; } if (current != l && l != null) { l.logDelegate += AddLog; l.errorDelegate += AddError; current = l; } //Output Text Area scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(Screen.width), GUILayout.ExpandHeight(true)); EditorGUILayout.TextArea(outputText, textAreaStyle, GUILayout.ExpandHeight(true)); GUILayout.EndScrollView(); //Filter Option Toggles GUILayout.BeginHorizontal(); bool oldToggleLog = toggleLog; bool oldToggleErr = toggleErr; toggleLog = GUILayout.Toggle(oldToggleLog, "log", GUILayout.ExpandWidth(false)); toggleErr = GUILayout.Toggle(oldToggleErr, "error", GUILayout.ExpandWidth(false)); //Filter Input Field GUILayout.Space(10f); GUILayout.Label("filter:", GUILayout.ExpandWidth(false)); string oldFilterPattern = filterText; filterText = GUILayout.TextField(oldFilterPattern, GUILayout.Width(200f)); //Menu Buttons if (GUILayout.Button("clear", GUILayout.ExpandWidth(false))) { recordList.Clear(); ConsoleFlush(); } GUILayout.EndHorizontal(); if (toggleLog != oldToggleLog || toggleErr != oldToggleErr || filterText != oldFilterPattern) { ConsoleFlush(); } if (Event.current.type == EventType.Repaint) { inputAreaPosY = GUILayoutUtility.GetLastRect().yMax; } //Drag Spliter ResizeScrollView(); //Input Area GUI.SetNextControlName("Input"); inputText = EditorGUILayout.TextField(inputText, GUILayout.Height(inputAreaHeight)); if (Event.current.isKey && Event.current.type == EventType.KeyUp) { bool refresh = false; if (Event.current.keyCode == KeyCode.Return) { if (inputText != "") { if (history.Count == 0 || history[history.Count - 1] != inputText) { history.Add(inputText); } AddLog(inputText); DoCommand(inputText); inputText = ""; refresh = true; historyIndex = history.Count; } } else if (Event.current.keyCode == KeyCode.UpArrow) { if (history.Count > 0) { historyIndex = historyIndex - 1; if (historyIndex < 0) { historyIndex = 0; } else { inputText = history[historyIndex]; refresh = true; } } } else if (Event.current.keyCode == KeyCode.DownArrow) { if (history.Count > 0) { historyIndex = historyIndex + 1; if (historyIndex > history.Count - 1) { historyIndex = history.Count - 1; } else { inputText = history[historyIndex]; refresh = true; } } } if (refresh) { Repaint(); EditorGUIUtility.editingTextField = false; GUI.FocusControl("Input"); } } }
/// <summary> /// Draws controls for the materials that were auto generated. /// </summary> private void DrawMaterials() { // setup button style to use for each item in the list var buttonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.UpperCenter, imagePosition = ImagePosition.ImageAbove, fixedWidth = 64, fixedHeight = 64 }; // get reference to the selected texture if any // var texture = EditorUtility.InstanceIDToObject(this.selectedTextureId) as Texture2D; var texture = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(this.selectedTextureId)) as Texture2D; GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); // save delete buttons // if a texture is specified then show the save button if (texture != null && this.tileMaterials.ContainsKey(this.selectedTextureId) && GUILayout.Button("Save")) { // save the selected material is the save button was clicked this.SaveMaterial(); } // draw selected texture name GUILayout.FlexibleSpace(); GUILayout.Label(texture == null ? string.Empty : texture.name); GUILayout.FlexibleSpace(); // provide a delete button if (GUILayout.Button("Delete")) { } GUILayout.EndHorizontal(); // save delete buttons GUILayout.BeginHorizontal(GUILayout.MinHeight(85), GUILayout.MaxHeight(85)); GUILayout.Space(4); this.showTextures = GUILayout.Toggle(this.showTextures, ">", GUI.skin.button, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)); this.materialScroll = GUILayout.BeginScrollView(this.materialScroll, false, false); GUILayout.BeginHorizontal(); // check if the user is wanting to show the textures if (this.showTextures) { foreach (var pair in this.tileMaterials) { // texture = EditorUtility.InstanceIDToObject(pair.Key) as Texture2D; texture = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(pair.Key)) as Texture2D; if (texture == null) { continue; } var assetPreview = AssetPreview.GetAssetPreview(texture) != null?AssetPreview.GetAssetPreview(texture) : AssetPreview.GetMiniTypeThumbnail(typeof(Texture2D)); if (GUILayout.Button(new GUIContent(texture.name, assetPreview), buttonStyle)) { this.selectedTextureId = pair.Key; this.showTextures = false; this.materialControls.TextureAsset = texture; } } } else { if (this.tileMaterials.ContainsKey(this.selectedTextureId)) { var list = this.tileMaterials[this.selectedTextureId]; for (var i = 0; i < list.Count; i++) { var tile = list[i]; var result = GUILayout.Toggle(this.materialSelectionIndex == i, new GUIContent(tile.Material.name, tile.TexturePreview), buttonStyle); if (!result) { continue; } // update material selection index this.materialSelectionIndex = i; // set active material GridMappingService.Instance.CurrentMaterial = tile.Material; // set main preview information this.mainPreview.TileWidth = tile.TileSize.Width; this.mainPreview.TileHeight = tile.TileSize.Height; this.mainPreview.SelectTiles(new Rect(tile.Min.X, tile.Min.Y, tile.TileSize.Width, tile.TileSize.Height)); } } } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndScrollView(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
void RenderWindow(int windowID) { if (Event.current.type == EventType.Repaint) { windowRect.height = 0; } GUI.DragWindow(new Rect(0, 0, 10000, 20)); var inReplay = BabboSettings.Instance.IsReplayActive(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(400), GUILayout.Height(750)); { //Label("Switch: " + PatchData.Instance.isSwitch()); //Label("spawn_switch: " + PatchData.Instance.spawn_switch); //Label("last_is_switch: " + PatchData.Instance.last_is_switch); //Label("just_respawned: " + PatchData.Instance.just_respawned); //cameraController.pov_rot_shift.x = Slider("X", cameraController.pov_rot_shift.x, -180, 180); ??? //cameraController.pov_rot_shift.y = Slider("Y", cameraController.pov_rot_shift.y, -180, 180); //cameraController.pov_rot_shift.z = Slider("Z", cameraController.pov_rot_shift.z, -180, 180); if (choosing_name) { name_text = GUILayout.TextField(name_text); BeginHorizontal(); if (name_text != "" && Button("Confirm")) { choosing_name = false; if (Main.presets.ContainsKey(name_text)) { Logger.Log("Preset already exists"); } else { Preset new_preset = new Preset(name_text); Main.presets[new_preset.name] = new_preset; Main.settings.presetOrder.Add(new_preset.name, true); Main.settings.replay_presetOrder.Add(new_preset.name, true); } name_text = ""; } if (Button("Cancel")) { choosing_name = false; name_text = ""; } EndHorizontal(); } else if (editing_preset) { Separator(); #region FOV override edited_preset.OVERRIDE_FOV = Toggle(edited_preset.OVERRIDE_FOV, "Override camera FOV (overrides the camera FOV slider)"); if (edited_preset.OVERRIDE_FOV) { edited_preset.OVERRIDE_FOV_VALUE = Slider("FOV", "FOV_OVERRIDE", edited_preset.OVERRIDE_FOV_VALUE, 1, 179); } #endregion Separator(); #region Ambient Occlusion BeginHorizontal(); edited_preset.AO.enabled.Override(Toggle(edited_preset.AO.enabled.value, "Ambient occlusion")); if (edited_preset.AO.enabled.value) { sp_AO = Spoiler(sp_AO ? "hide" : "show") ? !sp_AO : sp_AO; } EndHorizontal(); if (edited_preset.AO.enabled.value && sp_AO) { edited_preset.AO.intensity.Override(Slider("Intensity", "AO_intensity", edited_preset.AO.intensity.value, 0, 4)); edited_preset.AO.quality.Override((AmbientOcclusionQuality)GUILayout.SelectionGrid((int)edited_preset.AO.quality.value, ao_quality, ao_quality.Length)); edited_preset.AO.mode.Override((AmbientOcclusionMode)GUILayout.SelectionGrid((int)edited_preset.AO.mode.value, ao_mode, ao_mode.Length)); if (Button("Reset")) { gameEffects.reset(ref edited_preset.AO); } } #endregion Separator(); #region Automatic Exposure BeginHorizontal(); edited_preset.EXPO.enabled.Override(Toggle(edited_preset.EXPO.enabled.value, "Automatic Exposure")); if (edited_preset.EXPO.enabled.value) { sp_EXPO = Spoiler(sp_EXPO ? "hide" : "show") ? !sp_EXPO : sp_EXPO; } EndHorizontal(); if (edited_preset.EXPO.enabled.value && sp_EXPO) { edited_preset.EXPO.keyValue.Override(Slider("Compensation", "EXPO_compensation", edited_preset.EXPO.keyValue.value, 0, 4)); if (Button("Reset")) { gameEffects.reset(ref edited_preset.EXPO); } } #endregion Separator(); #region Bloom BeginHorizontal(); edited_preset.BLOOM.enabled.Override(Toggle(edited_preset.BLOOM.enabled.value, "Bloom")); if (edited_preset.BLOOM.enabled.value) { sp_BLOOM = Spoiler(sp_BLOOM ? "hide" : "show") ? !sp_BLOOM : sp_BLOOM; } EndHorizontal(); if (edited_preset.BLOOM.enabled.value && sp_BLOOM) { edited_preset.BLOOM.intensity.Override(Slider("Intensity", "BLOOM_intensity", edited_preset.BLOOM.intensity.value, 0, 4)); edited_preset.BLOOM.threshold.Override(Slider("Threshold", "BLOOM_threshold", edited_preset.BLOOM.threshold.value, 0, 4)); edited_preset.BLOOM.diffusion.Override(Slider("Diffusion", "BLOOM_diffusion", edited_preset.BLOOM.diffusion.value, 1, 10)); edited_preset.BLOOM.fastMode.Override(Toggle(edited_preset.BLOOM.fastMode.value, "Fast mode")); if (Button("Reset")) { gameEffects.reset(ref edited_preset.BLOOM); } } #endregion Separator(); #region Chromatic aberration BeginHorizontal(); edited_preset.CA.enabled.Override(Toggle(edited_preset.CA.enabled.value, "Chromatic aberration")); if (edited_preset.CA.enabled.value) { sp_CA = Spoiler(sp_CA ? "hide" : "show") ? !sp_CA : sp_CA; } EndHorizontal(); if (edited_preset.CA.enabled.value && sp_CA) { edited_preset.CA.intensity.Override(Slider("Intensity", "CA_intensity", edited_preset.CA.intensity.value, 0, 1)); edited_preset.CA.fastMode.Override(Toggle(edited_preset.CA.fastMode.value, "Fast mode")); if (Button("Reset")) { gameEffects.reset(ref edited_preset.CA); } } #endregion Separator(); #region Color Grading BeginHorizontal(); edited_preset.COLOR.enabled.Override(Toggle(edited_preset.COLOR.enabled.value, "Color Grading")); if (edited_preset.COLOR.enabled) { sp_COLOR = Spoiler(sp_COLOR ? "hide" : "show") ? !sp_COLOR : sp_COLOR; } EndHorizontal(); if (edited_preset.COLOR.enabled && sp_COLOR) { BeginHorizontal(); Label("Tonemapper: "); edited_preset.COLOR.tonemapper.Override((Tonemapper)GUILayout.SelectionGrid((int)edited_preset.COLOR.tonemapper.value, tonemappers, tonemappers.Length)); EndHorizontal(); edited_preset.COLOR.temperature.Override(Slider("Temperature", "COLOR_temperature", edited_preset.COLOR.temperature.value, -100, 100)); edited_preset.COLOR.tint.Override(Slider("Tint", "COLOR_tint", edited_preset.COLOR.tint.value, -100, 100)); edited_preset.COLOR.postExposure.Override(Slider("Post-exposure", "COLOR_post-exposure", edited_preset.COLOR.postExposure.value, 0, 5)); edited_preset.COLOR.hueShift.Override(Slider("Hue shift", "COLOR_hue shift", edited_preset.COLOR.hueShift.value, -180, 180)); edited_preset.COLOR.saturation.Override(Slider("Saturation", "COLOR_saturation", edited_preset.COLOR.saturation.value, -100, 100)); edited_preset.COLOR.contrast.Override(Slider("Contrast", "COLOR_contrast", edited_preset.COLOR.contrast.value, -100, 100)); Label(" "); BeginHorizontal(); Label("Advanced"); sp_COLOR_ADV = Spoiler(sp_COLOR_ADV ? "hide" : "show") ? !sp_COLOR_ADV : sp_COLOR_ADV; EndHorizontal(); if (sp_COLOR_ADV) { Label("Lift"); edited_preset.COLOR.lift.value.x = Slider("r", "COLOR_ADV_LIFT_x", edited_preset.COLOR.lift.value.x, -2, 2); edited_preset.COLOR.lift.value.y = Slider("g", "COLOR_ADV_LIFT_y", edited_preset.COLOR.lift.value.y, -2, 2); edited_preset.COLOR.lift.value.z = Slider("b", "COLOR_ADV_LIFT_z", edited_preset.COLOR.lift.value.z, -2, 2); edited_preset.COLOR.lift.value.w = Slider("w", "COLOR_ADV_LIFT_w", edited_preset.COLOR.lift.value.w, -2, 2); Label("Gamma"); edited_preset.COLOR.gamma.value.x = Slider("r", "COLOR_ADV_GAMMA_x", edited_preset.COLOR.gamma.value.x, -2, 2); edited_preset.COLOR.gamma.value.y = Slider("g", "COLOR_ADV_GAMMA_y", edited_preset.COLOR.gamma.value.y, -2, 2); edited_preset.COLOR.gamma.value.z = Slider("b", "COLOR_ADV_GAMMA_z", edited_preset.COLOR.gamma.value.z, -2, 2); edited_preset.COLOR.gamma.value.w = Slider("w", "COLOR_ADV_GAMMA_w", edited_preset.COLOR.gamma.value.w, -2, 2); Label("Gain"); edited_preset.COLOR.gain.value.x = Slider("r", "COLOR_ADV_GAIN_x", edited_preset.COLOR.gain.value.x, -2, 2); edited_preset.COLOR.gain.value.y = Slider("g", "COLOR_ADV_GAIN_y", edited_preset.COLOR.gain.value.y, -2, 2); edited_preset.COLOR.gain.value.z = Slider("b", "COLOR_ADV_GAIN_z", edited_preset.COLOR.gain.value.z, -2, 2); edited_preset.COLOR.gain.value.w = Slider("w", "COLOR_ADV_GAIN_w", edited_preset.COLOR.gain.value.w, -2, 2); } Label(" "); if (Button("Reset")) { gameEffects.reset(ref edited_preset.COLOR); } } #endregion Separator(); #region Depth Of Field BeginHorizontal(); edited_preset.DOF.enabled.Override(Toggle(edited_preset.DOF.enabled.value, "Depth Of Field")); if (edited_preset.DOF.enabled.value) { sp_DOF = Spoiler(sp_DOF ? "hide" : "show") ? !sp_DOF : sp_DOF; } EndHorizontal(); if (edited_preset.DOF.enabled.value && sp_DOF) { edited_preset.FOCUS_MODE = (FocusMode)GUILayout.SelectionGrid((int)edited_preset.FOCUS_MODE, focus_modes, focus_modes.Length); if (edited_preset.FOCUS_MODE == FocusMode.Custom) { edited_preset.DOF.focusDistance.Override(Slider("Focus distance", "DOF_focus", edited_preset.DOF.focusDistance.value, 0, 20)); } else { Label("focus distance: " + gameEffects.effectSuite.DOF.focusDistance.value.ToString("0.00")); } edited_preset.DOF.aperture.Override(Slider("Aperture (f-stop)", "DOF_aperture", edited_preset.DOF.aperture.value, 0.1f, 32)); edited_preset.DOF.focalLength.Override(Slider("Focal length (mm)", "DOF_focal", edited_preset.DOF.focalLength.value, 1, 300)); BeginHorizontal(); Label("Max blur size: "); edited_preset.DOF.kernelSize.Override((KernelSize)GUILayout.SelectionGrid((int)edited_preset.DOF.kernelSize.value, max_blur, max_blur.Length)); EndHorizontal(); if (Button("Reset")) { gameEffects.reset(ref edited_preset.DOF); edited_preset.FOCUS_MODE = FocusMode.Custom; } } #endregion Separator(); #region Grain BeginHorizontal(); edited_preset.GRAIN.enabled.Override(Toggle(edited_preset.GRAIN.enabled.value, "Grain")); if (edited_preset.GRAIN.enabled.value) { sp_GRAIN = Spoiler(sp_GRAIN ? "hide" : "show") ? !sp_GRAIN : sp_GRAIN; } EndHorizontal(); if (edited_preset.GRAIN.enabled.value && sp_GRAIN) { edited_preset.GRAIN.colored.Override(Toggle(edited_preset.GRAIN.colored.value, "colored")); edited_preset.GRAIN.intensity.Override(Slider("Intensity", "GRAIN_intensity", edited_preset.GRAIN.intensity.value, 0, 1)); edited_preset.GRAIN.size.Override(Slider("Size", "GRAIN_size", edited_preset.GRAIN.size.value, 0.3f, 3)); edited_preset.GRAIN.lumContrib.Override(Slider("Luminance contribution", "GRAIN_luminance", edited_preset.GRAIN.lumContrib.value, 0, 1)); if (Button("Reset")) { gameEffects.reset(ref edited_preset.GRAIN); } } #endregion Separator(); #region Lens Distortion BeginHorizontal(); edited_preset.LENS.enabled.Override(Toggle(edited_preset.LENS.enabled.value, "Lens distortion")); if (edited_preset.LENS.enabled.value) { sp_LENS = Spoiler(sp_LENS ? "hide" : "show") ? !sp_LENS : sp_LENS; } EndHorizontal(); if (edited_preset.LENS.enabled.value && sp_LENS) { edited_preset.LENS.intensity.Override(Slider("Intensity", "LENS_intensity", edited_preset.LENS.intensity.value, -100, 100)); edited_preset.LENS.intensityX.Override(Slider("X", "LENS_X", edited_preset.LENS.intensityX.value, 0, 1)); edited_preset.LENS.intensityY.Override(Slider("Y", "LENS_Y", edited_preset.LENS.intensityY.value, 0, 1)); edited_preset.LENS.scale.Override(Slider("Scale", "LENS_scale", edited_preset.LENS.scale.value, 0.1f, 5)); if (Button("Reset")) { gameEffects.reset(ref edited_preset.LENS); } } #endregion Separator(); #region Motion Blur BeginHorizontal(); edited_preset.BLUR.enabled.Override(Toggle(edited_preset.BLUR.enabled.value, "Motion blur")); if (edited_preset.BLUR.enabled.value) { sp_BLUR = Spoiler(sp_BLUR ? "hide" : "show") ? !sp_BLUR : sp_BLUR; } EndHorizontal(); if (edited_preset.BLUR.enabled.value && sp_BLUR) { edited_preset.BLUR.shutterAngle.Override(Slider("Shutter angle", "BLUR_angle", edited_preset.BLUR.shutterAngle, 0, 360)); edited_preset.BLUR.sampleCount.Override(SliderInt("Sample count", "BLUR_count", edited_preset.BLUR.sampleCount, 4, 32)); if (Button("Reset")) { gameEffects.reset(ref edited_preset.BLUR); } } #endregion Separator(); #region Screen Space Reflections BeginHorizontal(); edited_preset.REFL.enabled.Override(Toggle(edited_preset.REFL.enabled.value, "Reflections")); if (edited_preset.REFL.enabled.value) { sp_REFL = Spoiler(sp_REFL ? "hide" : "show") ? !sp_REFL : sp_REFL; } EndHorizontal(); if (edited_preset.REFL.enabled.value && sp_REFL) { edited_preset.REFL.preset.Override((ScreenSpaceReflectionPreset)GUILayout.SelectionGrid((int)edited_preset.REFL.preset.value, refl_presets, refl_presets.Length)); if (Button("Reset")) { gameEffects.reset(ref edited_preset.REFL); } } #endregion Separator(); #region Vignette BeginHorizontal(); edited_preset.VIGN.enabled.Override(Toggle(edited_preset.VIGN.enabled.value, "Vignette")); if (edited_preset.VIGN.enabled.value) { sp_VIGN = Spoiler(sp_VIGN ? "hide" : "show") ? !sp_VIGN : sp_VIGN; } EndHorizontal(); if (edited_preset.VIGN.enabled.value && sp_VIGN) { edited_preset.VIGN.intensity.Override(Slider("Intensity", "VIGN_intensity", edited_preset.VIGN.intensity.value, 0, 1)); edited_preset.VIGN.smoothness.Override(Slider("Smoothness", "VIGN_smoothness", edited_preset.VIGN.smoothness.value, 0.1f, 1)); edited_preset.VIGN.roundness.Override(Slider("Roundness", "VIGN_roundness", edited_preset.VIGN.roundness.value, 0, 1)); BeginHorizontal(); edited_preset.VIGN.rounded.Override(Toggle(edited_preset.VIGN.rounded.value, "Rounded")); if (Button("Reset")) { gameEffects.reset(ref edited_preset.VIGN); } EndHorizontal(); } #endregion Separator(); #region Light on camera BeginHorizontal(); edited_preset.LIGHT_ENABLED = Toggle(edited_preset.LIGHT_ENABLED, "Light On Camera"); if (edited_preset.LIGHT_ENABLED) { sp_LIGHT = Spoiler(sp_LIGHT ? "hide" : "show") ? !sp_LIGHT : sp_LIGHT; } EndHorizontal(); if (edited_preset.LIGHT_ENABLED && sp_LIGHT) { edited_preset.LIGHT_INTENSITY = Slider("Intensity", "LIGHT_INTENSITY", edited_preset.LIGHT_INTENSITY, 0, 8, digits: 6); edited_preset.LIGHT_RANGE = Slider("Range", "LIGHT_RANGE", edited_preset.LIGHT_RANGE, 0, 1000); edited_preset.LIGHT_ANGLE = Slider("Angle", "LIGHT_ANGLE", edited_preset.LIGHT_ANGLE, 0, 360); Separator(); Label("Color"); edited_preset.LIGHT_COLOR.r = Slider("red", "LIGHT_COLOR_R", edited_preset.LIGHT_COLOR.r, 0, 255); edited_preset.LIGHT_COLOR.g = Slider("green", "LIGHT_COLOR_G", edited_preset.LIGHT_COLOR.g, 0, 255); edited_preset.LIGHT_COLOR.b = Slider("blue", "LIGHT_COLOR_B", edited_preset.LIGHT_COLOR.b, 0, 255); Separator(); Label("Shift light"); edited_preset.LIGHT_POSITION.x = Slider("X", "LIGHT_SHIFT_X", edited_preset.LIGHT_POSITION.x, -20, 20); edited_preset.LIGHT_POSITION.y = Slider("Y", "LIGHT_SHIFT_Y", edited_preset.LIGHT_POSITION.y, -20, 20); edited_preset.LIGHT_POSITION.z = Slider("Z", "LIGHT_SHIFT_Z", edited_preset.LIGHT_POSITION.z, -20, 20); Separator(); Label("Cookie"); var values = lightController.CookieNames; int selected = Array.IndexOf(values, edited_preset.LIGHT_COOKIE); if (selected == -1) { // if not found, set to no cookie selected = 0; } selected = GUILayout.SelectionGrid(selected, values, 2); edited_preset.LIGHT_COOKIE = values[selected]; } #endregion Separator(); if (Button("Save")) { editing_preset = false; } } else { BeginHorizontal(); selectedTab = (SelectedTab)GUILayout.SelectionGrid((int)selectedTab, tab_names, tab_names.Length); EndHorizontal(); if (selectedTab == SelectedTab.Basic) { #region Post in general gameEffects.post_volume.enabled = Toggle(gameEffects.post_volume.enabled, "Enable post processing"); #endregion Separator(); #region VSync BeginHorizontal(); Label("Vsync"); QualitySettings.vSyncCount = GUILayout.SelectionGrid(QualitySettings.vSyncCount, vsync_names, vsync_names.Length); EndHorizontal(); #endregion Separator(); #region Fullscreen BeginHorizontal(); Label("Fullscreen"); Screen.fullScreenMode = (FullScreenMode)GUILayout.SelectionGrid((int)Screen.fullScreenMode, screen_modes, screen_modes.Length); EndHorizontal(); #endregion Separator(); #region AntiAliasing Label("AntiAliasing"); gameEffects.post_layer.antialiasingMode = (Antialiasing)(GUILayout.SelectionGrid((int)gameEffects.post_layer.antialiasingMode, aa_names, aa_names.Length)); if (gameEffects.post_layer.antialiasingMode == Antialiasing.SubpixelMorphologicalAntialiasing) { sp_AA = Spoiler(sp_AA ? "hide" : "show") ? !sp_AA : sp_AA; if (sp_AA) { gameEffects.SMAA.quality = (SubpixelMorphologicalAntialiasing.Quality)GUILayout.SelectionGrid((int)gameEffects.SMAA.quality, smaa_quality, smaa_quality.Length); } } else if (gameEffects.post_layer.antialiasingMode == Antialiasing.TemporalAntialiasing) { sp_AA = Spoiler(sp_AA ? "hide" : "show") ? !sp_AA : sp_AA; if (sp_AA) { gameEffects.TAA.sharpness = Slider("Sharpness", "TAA_sharpness", gameEffects.TAA.sharpness, 0, 3); gameEffects.TAA.jitterSpread = Slider("Jitter spread", "TAA_jitter", gameEffects.TAA.jitterSpread, 0, 1); gameEffects.TAA.stationaryBlending = Slider("Stationary blending", "TAA_stationary", gameEffects.TAA.stationaryBlending, 0, 1); gameEffects.TAA.motionBlending = Slider("Motion Blending", "TAA_motion", gameEffects.TAA.motionBlending, 0, 1); if (Button("Default TAA")) { gameEffects.TAA = gameEffects.post_layer.temporalAntialiasing = new TemporalAntialiasing(); } } } #endregion Separator(); #region PayPal if (GUILayout.Button(paypalTexture)) { Application.OpenURL("https://www.paypal.me/andreamatte"); } #endregion } else if (selectedTab == SelectedTab.Presets) { var presetOrder = inReplay ? Main.settings.replay_presetOrder : Main.settings.presetOrder; for (int i = 0; i < presetOrder.Count; i++) { var name = presetOrder.names[i]; var enabled = presetOrder.enables[i]; var preset = Main.presets[name]; BeginHorizontal(); presetOrder.enables[i] = enabled = Toggle(enabled, preset.name); GUILayout.FlexibleSpace(); if (enabled && Button("edit")) { editing_preset = true; edited_preset = preset; } GUILayout.FlexibleSpace(); if (Button("Λ")) { if (i > 0) { presetOrder.Left(i); } } if (Button("V")) { if (i < presetOrder.Count - 1) { presetOrder.Right(i); } } EndHorizontal(); } // map preset is separate BeginHorizontal(); presetOrder.map_enabled = Toggle(presetOrder.map_enabled, Main.map_name); GUILayout.FlexibleSpace(); if (enabled && Button("edit")) { editing_preset = true; edited_preset = Main.presets[Main.map_name]; } GUILayout.FlexibleSpace(); // map preset cannot be moved since it should always be at the bottom EndHorizontal(); if (Button("NEW PRESET")) { choosing_name = true; } } else if (selectedTab == SelectedTab.Camera) { // Modes if (inReplay) { Main.settings.fovSpeed = Slider("FOV mouse wheel speed", "FOV mouse wheel speed", Main.settings.fovSpeed, 1, 200); Main.settings.positionSpeed = Slider("WASD move speed", "WASD move speed", Main.settings.positionSpeed, 1, 200); Main.settings.rotationSpeed = Slider("mouse look speed", "mouse look speed", Main.settings.rotationSpeed, 1, 200); Separator(); if (cameraController.override_fov) { Label("There is a preset overriding the FOV. Disable that to use this slider", labelStyleRed); } else { Label("While in replay only normal mode is available"); cameraController.replay_fov = Slider("Field of View", "REPLAY_FOV", cameraController.replay_fov, 1, 179); if (Button("Reset")) { cameraController.replay_fov = 60; } } } else { cameraController.cameraMode = (CameraMode)GUILayout.SelectionGrid((int)cameraController.cameraMode, camera_names, camera_names.Length); if (cameraController.cameraMode == CameraMode.Normal) { if (cameraController.override_fov) { Label("There is a preset overriding the FOV. Disable that to use this slider", labelStyleRed); } else { cameraController.normal_fov = Slider("Field of View", "NORMAL_FOV", cameraController.normal_fov, 1, 179); if (Button("Reset")) { cameraController.normal_fov = 60; } } Separator(); cameraController.normal_clip = Slider("Near clipping", "NORMAL_CLIP", cameraController.normal_clip, 0.01f, 1); Separator(); Label("Responsiveness. Suggested: 1, 1"); cameraController.normal_react = Slider("Position", "NORMAL_REACT", cameraController.normal_react, 0.01f, 1); cameraController.normal_react_rot = Slider("Rotation", "NORMAL_REACT_ROT", cameraController.normal_react_rot, 0.01f, 1); } else if (cameraController.cameraMode == CameraMode.Low) { Label("No controls here"); Label("If you want them, use follow cam"); } else if (cameraController.cameraMode == CameraMode.Follow) { if (cameraController.override_fov) { Label("There is a preset overriding the FOV. Disable that to use this slider", labelStyleRed); } else { cameraController.follow_fov = Slider("Field of View", "FOLLOW_FOV", cameraController.follow_fov, 1, 179); if (Button("Reset")) { cameraController.follow_fov = 60; } } Separator(); cameraController.follow_clip = Slider("Near clipping", "FOLLOW_CLIP", cameraController.follow_clip, 0.01f, 1); Separator(); Label("Responsiveness. Suggested: 0.8, 0.6"); cameraController.follow_react = Slider("Position", "FOLLOW_REACT", cameraController.follow_react, 0.01f, 1); cameraController.follow_react_rot = Slider("Rotation", "FOLLOW_REACT_ROT", cameraController.follow_react_rot, 0.01f, 1); Separator(); Label("Move camera: "); cameraController.follow_shift.x = Slider("x", "FOLLOW_SHIFT_x", cameraController.follow_shift.x, -2, 2); cameraController.follow_shift.y = Slider("y", "FOLLOW_SHIFT_y", cameraController.follow_shift.y, -2, 2); cameraController.follow_shift.z = Slider("z", "FOLLOW_SHIFT_z", cameraController.follow_shift.z, -2, 2); if (Button("Reset to player")) { cameraController.follow_shift = new Vector3(); } } else if (cameraController.cameraMode == CameraMode.POV) { if (cameraController.override_fov) { Label("There is a preset overriding the FOV. Disable that to use this slider", labelStyleRed); } else { cameraController.pov_fov = Slider("Field of View", "POV_FOV", cameraController.pov_fov, 1, 179); if (Button("Reset")) { cameraController.pov_fov = 60; } } Separator(); cameraController.hide_head = Toggle(cameraController.hide_head, "Hide head"); cameraController.pov_clip = Slider("Near clipping", "POV_CLIP", cameraController.pov_clip, 0.01f, 1); Separator(); Label("Responsiveness. Suggested: 1, 0.1"); cameraController.pov_react = Slider("Position", "POV_REACT", cameraController.pov_react, 0.01f, 1); cameraController.pov_react_rot = Slider("Rotation", "POV_REACT_ROT", cameraController.pov_react_rot, 0.01f, 1); Separator(); Label("Move camera: "); cameraController.pov_shift.x = Slider("x", "POV_SHIFT_x", cameraController.pov_shift.x, -2, 2); cameraController.pov_shift.y = Slider("y", "POV_SHIFT_y", cameraController.pov_shift.y, -2, 2); cameraController.pov_shift.z = Slider("z", "POV_SHIFT_z", cameraController.pov_shift.z, -2, 2); if (Button("Reset to head")) { cameraController.pov_shift = new Vector3(); } } else if (cameraController.cameraMode == CameraMode.Skate) { if (cameraController.override_fov) { Label("There is a preset overriding the FOV. Disable that to use this slider", labelStyleRed); } else { cameraController.skate_fov = Slider("Field of View", "SKATE_FOV", cameraController.skate_fov, 1, 179); if (Button("Reset")) { cameraController.skate_fov = 60; } } Separator(); cameraController.skate_clip = Slider("Near clipping", "SKATE_CLIP", cameraController.skate_clip, 0.01f, 1); Separator(); Label("Responsiveness. Suggested: 1, 1"); cameraController.skate_react = Slider("Position", "SKATE_REACT", cameraController.skate_react, 0.01f, 1); cameraController.skate_react_rot = Slider("Rotation", "SKATE_REACT_ROT", cameraController.skate_react_rot, 0.01f, 1); Separator(); Label("Move camera: "); cameraController.skate_shift.x = Slider("x", "SKATE_SHIFT_x", cameraController.skate_shift.x, -2, 2); cameraController.skate_shift.y = Slider("y", "SKATE_SHIFT_y", cameraController.skate_shift.y, -2, 2); cameraController.skate_shift.z = Slider("z", "SKATE_SHIFT_z", cameraController.skate_shift.z, -2, 2); if (Button("Reset to skate")) { cameraController.skate_shift = new Vector3(); } } } } GUILayout.FlexibleSpace(); Separator(); // Preset selection, save, close { BeginHorizontal(); if (Button("Save")) { Main.Save(); } if (Button("Save and close")) { Close(); } EndHorizontal(); } } } GUILayout.EndScrollView(); // apply presets while window is open presetsManager.ApplyPresets(); }
/// <summary> /// Draw the custom wizard. /// </summary> void OnGUI() { #pragma warning disable 0618 List <UIPanel> panels = GetListOfPanels(); if (panels != null && panels.Count > 0) { UIPanel selectedPanel = NGUITools.FindInParents <UIPanel>(Selection.activeGameObject); // First, collect a list of panels with their associated widgets List <Entry> entries = new List <Entry>(); Entry selectedEntry = null; bool allEnabled = true; foreach (UIPanel panel in panels) { Entry ent = new Entry(); ent.panel = panel; ent.widgets = GetWidgets(panel); ent.isEnabled = panel.enabled && panel.gameObject.active; ent.widgetsEnabled = ent.isEnabled; if (ent.widgetsEnabled) { foreach (UIWidget w in ent.widgets) { if (!w.gameObject.active) { allEnabled = false; ent.widgetsEnabled = false; break; } } } else { allEnabled = false; } entries.Add(ent); } // Sort the list alphabetically entries.Sort(Compare); #pragma warning disable 0618 EditorGUIUtility.LookLikeControls(80f); #pragma warning restore 0618 bool showAll = DrawRow(null, null, allEnabled); NGUIEditorTools.DrawSeparator(); mScroll = GUILayout.BeginScrollView(mScroll); foreach (Entry ent in entries) { if (DrawRow(ent, selectedPanel, ent.widgetsEnabled)) { selectedEntry = ent; } } GUILayout.EndScrollView(); if (showAll) { foreach (Entry ent in entries) { SetActiveState(ent.panel, !allEnabled); } } else if (selectedEntry != null) { SetActiveState(selectedEntry.panel, !selectedEntry.widgetsEnabled); } } else { GUILayout.Label("No UI Panels found in the scene"); } #pragma warning restore 0618 }
void OnGUI() { // Dragging events if (Event.current.type == EventType.mouseDrag) { if (currentRect.Contains(Event.current.mousePosition)) { if (!dragging) { dragging = true; startPos = currentPos; } } currentPos = Event.current.mousePosition; } if (Event.current.type == EventType.mouseUp) { dragging = false; } scrollPosition = GUILayout.BeginScrollView(scrollPosition); GUI.DrawTexture(imageBackgroundRect, backgroundPreviewTex); for (int i = 0; i < sceneRef.getBarriersList().getBarriersList().Count; i++) { Rect aRect = new Rect(sceneRef.getBarriersList().getBarriersList()[i].getX(), sceneRef.getBarriersList().getBarriersList()[i].getY(), sceneRef.getBarriersList().getBarriersList()[i].getWidth(), sceneRef.getBarriersList().getBarriersList()[i].getHeight()); GUI.DrawTexture(aRect, barrierTex); // Frame around current area if (calledBarrierIndexRef == i) { currentRect = aRect; GUI.DrawTexture(currentRect, selectedBarrierTex); } } GUILayout.EndScrollView(); /* * HANDLE EVENTS */ if (dragging) { OnBeingDragged(); } GUILayout.BeginHorizontal(); GUILayout.Box("X", GUILayout.Width(0.25f * backgroundPreviewTex.width)); GUILayout.Box("Y", GUILayout.Width(0.25f * backgroundPreviewTex.width)); GUILayout.Box(TC.get("SPEP.Width"), GUILayout.Width(0.25f * backgroundPreviewTex.width)); GUILayout.Box(TC.get("SPEP.Height"), GUILayout.Width(0.25f * backgroundPreviewTex.width)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); x = EditorGUILayout.IntField(sceneRef.getBarriersList().getBarriersList()[calledBarrierIndexRef].getX(), GUILayout.Width(0.25f * backgroundPreviewTex.width)); y = EditorGUILayout.IntField(sceneRef.getBarriersList().getBarriersList()[calledBarrierIndexRef].getY(), GUILayout.Width(0.25f * backgroundPreviewTex.width)); width = EditorGUILayout.IntField(sceneRef.getBarriersList().getBarriersList()[calledBarrierIndexRef].getWidth(), GUILayout.Width(0.25f * backgroundPreviewTex.width)); heigth = EditorGUILayout.IntField(sceneRef.getBarriersList().getBarriersList()[calledBarrierIndexRef].getHeight(), GUILayout.Width(0.25f * backgroundPreviewTex.width)); sceneRef.getBarriersList().getBarriersList()[calledBarrierIndexRef].setValues(x, y, width, heigth); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Ok")) { reference.OnDialogOk("Applied"); this.Close(); } //if (GUILayout.Button(TC.get("GeneralText.Cancel"))) //{ // reference.OnDialogCanceled(); // this.Close(); //} GUILayout.EndHorizontal(); }
void OnGUI() { if (preferences == null) { preferences = UnisavePreferences.LoadOrCreate(); OnPrefencesLoaded(); } windowScroll = GUILayout.BeginScrollView(windowScroll); DrawUnisaveLogo(); GUILayout.Label("Unisave server connection", EditorStyles.boldLabel); preferences.ServerUrl = EditorGUILayout.TextField("Server URL", preferences.ServerUrl); preferences.GameToken = EditorGUILayout.TextField("Game token", preferences.GameToken); preferences.EditorKey = EditorGUILayout.TextField("Editor key", preferences.EditorKey); GUILayout.Space(15f); GUILayout.Label("Server emulation", EditorStyles.boldLabel); preferences.AlwaysEmulate = EditorGUILayout.Toggle("Emulate", preferences.AlwaysEmulate); preferences.EmulatedDatabaseName = EditorGUILayout.TextField("Emulated database name", preferences.EmulatedDatabaseName); GUILayout.Space(15f); GUILayout.Label("Backend folder uploading", EditorStyles.boldLabel); preferences.BackendFolder = EditorGUILayout.TextField("Backend assets folder", preferences.BackendFolder); preferences.AutomaticBackendUploading = EditorGUILayout.Toggle("Automatic", preferences.AutomaticBackendUploading); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Manual", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); if (GUILayout.Button("Upload", GUILayout.Width(50f))) RunManualCodeUpload(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Last upload at", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.LabelField(preferences.LastBackendUploadAt?.ToString("yyyy-MM-dd H:mm:ss") ?? "Never"); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Backend hash", GUILayout.Width(EditorGUIUtility.labelWidth - 4)); EditorGUILayout.LabelField( string.IsNullOrWhiteSpace(preferences.BackendHash) ? "<not computed yet>" : preferences.BackendHash ); EditorGUILayout.EndHorizontal(); // GUILayout.Label("Environment configuration", EditorStyles.boldLabel); // preferences.DevelopmentEnv = (TextAsset) EditorGUILayout.ObjectField( // "Development", preferences.DevelopmentEnv, typeof(TextAsset), false // ); // preferences.TestingEnv = (TextAsset) EditorGUILayout.ObjectField( // "Testing", preferences.TestingEnv, typeof(TextAsset), false // ); GUILayout.Space(30f); GUILayout.Label("Changes to configuration are saved automatically."); GUILayout.Space(30f); GUILayout.Label("Unisave framework version: " + FrameworkMeta.Version); GUILayout.EndScrollView(); // detect mouse leave if (Event.current.type == EventType.MouseLeaveWindow) OnLostFocus(); }
public void DrawPart2() { this.DrawHeader(this.partTitles[this.partIndex]); GUILayout.FlexibleSpace(); this.tagsScroll = GUILayout.BeginScrollView(this.tagsScroll); var tagStyles = new GUIStyle[7] { new GUIStyle("sv_label_1"), new GUIStyle("sv_label_2"), new GUIStyle("sv_label_3"), new GUIStyle("sv_label_4"), new GUIStyle("sv_label_5"), new GUIStyle("sv_label_6"), new GUIStyle("sv_label_7") }; var allTags = FlowSystem.GetData().tags; foreach (var tag in allTags) { var tagStyle = tagStyles[tag.color]; tagStyle.alignment = TextAnchor.MiddleLeft; tagStyle.stretchWidth = false; tagStyle.stretchHeight = false; tagStyle.margin = new RectOffset(0, 0, 2, 2); var backStyle = new GUIStyle(EditorStyles.toolbar); backStyle.stretchHeight = false; backStyle.fixedHeight = 0f; backStyle.padding = new RectOffset(4, 4, 4, 4); GUILayout.BeginHorizontal(backStyle); { var oldState = !this.tagsIgnored.Contains(tag.id); var state = GUILayout.Toggle(oldState, string.Empty); if (GUILayout.Button(tag.title, tagStyle) == true) { state = !oldState; } if (oldState != state) { if (state == false) { this.tagsIgnored.Add(tag.id); } else { this.tagsIgnored.Remove(tag.id); } } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); this.readyToNext = true; if (allTags.Count == 0) { var style = new GUIStyle(GUI.skin.label); style.wordWrap = true; GUILayout.Label("Current project has no tags. You can add tags (`Android`, `iOS`, etc.) to improve your flow.", style); } else { if (this.tagsIgnored.Count == allTags.Count) { this.readyToNext = false; } EditorGUILayout.HelpBox("All tags included by default.", MessageType.Info); this.DrawSaveToDefaultToggle(); } this.DrawBottom(); }
/// <summary> /// This will render the modify window /// </summary> private void RenderModifyWindow() { if (_editorButtons == null || ActiveButton == null) { Initialize(); return; //Editor is getting refreshed } EditorGUILayout.Space(); _scrollView = GUILayout.BeginScrollView(_scrollView); bool renderSuccessful = ActiveButton.RenderExposed(_modifyUndo); GUILayout.EndScrollView(); if (!renderSuccessful) { return; } bool generatedMonobehavior = EditorGUILayout.Toggle("Generate MonoBehavior", ActiveButton.BaseType != ForgeBaseClassType.NetworkBehavior); if (generatedMonobehavior) { ActiveButton.BaseType = ForgeBaseClassType.MonoBehavior; } else { ActiveButton.BaseType = ForgeBaseClassType.NetworkBehavior; } GUILayout.BeginHorizontal(); Rect backBtn = EditorGUILayout.BeginVertical("Button", GUILayout.Width(100), GUILayout.Height(50)); GUI.color = Color.red; if (GUI.Button(backBtn, GUIContent.none)) { if (_modifyUndo != null) { _modifyUndo(); } } GUI.color = Color.white; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); GUI.color = Color.white; GUILayout.FlexibleSpace(); GUIStyle boldStyle = new GUIStyle(GUI.skin.GetStyle("boldLabel")); boldStyle.alignment = TextAnchor.UpperCenter; GUILayout.Label("Back", boldStyle); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); Rect verticleButton = EditorGUILayout.BeginVertical("Button", GUILayout.Width(100), GUILayout.Height(50)); if (ProVersion) { GUI.color = TealBlue; } if (GUI.Button(verticleButton, GUIContent.none)) { _editorButtons.Add(ActiveButton); Compile(); ChangeMenu(ForgeEditorActiveMenu.Main); } GUI.color = Color.white; EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.Label(SaveIcon); GUILayout.Label("Save & Compile", EditorStyles.boldLabel); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); }
// ReSharper disable UnusedMember.Local void OnGUI() // ReSharper restore UnusedMember.Local { if (_doFocusOut) { _doFocusOut = false; GUIUtility.keyboardControl = 0; } EditorWindowContentWrapper.Start(); if (null == PanelRenderer.ChromeStyle) { PanelRenderer.ChromeStyle = StyleCache.Instance.PanelChromeSquared; } PanelRenderer.RenderStart(GuiContentCache.Instance.PersistenceDebuggerPanelTitle, true); PanelContentWrapper.Start(); if (PanelRenderer.ClickedTools.Count > 0) { if (PanelRenderer.ClickedTools.Contains("options")) { PanelRenderer.ClickedTools.Remove("options"); } ShowHelp = PanelRenderer.ClickedTools.Contains("help"); } else { ShowHelp = false; } if (ShowHelp) { EditorGUILayout.HelpBox(Help.PersistenceDebugWindow, MessageType.Info, true); } EditorGUILayout.BeginHorizontal(StyleCache.Instance.Toolbar, GUILayout.Height(35)); #region Refresh EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false)); GUILayout.FlexibleSpace(); if (GUILayout.Button(GuiContentCache.Instance.Refresh, StyleCache.Instance.Button, GUILayout.ExpandWidth(false), GUILayout.Height(30))) { GUIUtility.keyboardControl = 0; ProcessInfo(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); #endregion #region Abandon chages EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false)); GUILayout.FlexibleSpace(); if (GUILayout.Button(GuiContentCache.Instance.AbandonChanges, StyleCache.Instance.Button, GUILayout.ExpandWidth(false), GUILayout.Height(30))) { PersistenceManager.Instance.AbandonChanges(); HierarchyChangeProcessor.Instance.Reset(); ProcessInfo(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); #endregion #region Copy EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false)); GUILayout.FlexibleSpace(); if (GUILayout.Button(GuiContentCache.Instance.CopyToClipboard, StyleCache.Instance.Button, GUILayout.ExpandWidth(false), GUILayout.Height(30))) { GUIUtility.keyboardControl = 0; TextEditor te = new TextEditor { content = new GUIContent(_text) }; te.SelectAll(); te.Copy(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); #endregion GUILayout.FlexibleSpace(); #region Auto-update EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false)); GUILayout.FlexibleSpace(); bool oldAutoUpdate = GUILayout.Toggle(EditorSettings.PersistenceWindowAutoUpdate, EditorSettings.PersistenceWindowAutoUpdate ? GuiContentCache.Instance.AutoUpdateOn : GuiContentCache.Instance.AutoUpdateOff, StyleCache.Instance.Toggle, GUILayout.ExpandWidth(false), GUILayout.Height(30)); if (EditorSettings.PersistenceWindowAutoUpdate != oldAutoUpdate) { GUIUtility.keyboardControl = 0; EditorSettings.PersistenceWindowAutoUpdate = oldAutoUpdate; } GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); #endregion #region Write to log EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false)); GUILayout.FlexibleSpace(); bool oldWriteToLog = GUILayout.Toggle(EditorSettings.PersistenceWindowWriteToLog, GuiContentCache.Instance.WriteToLog, StyleCache.Instance.GreenToggle, GUILayout.ExpandWidth(false), GUILayout.Height(30)); if (EditorSettings.PersistenceWindowWriteToLog != oldWriteToLog) { GUIUtility.keyboardControl = 0; EditorSettings.PersistenceWindowWriteToLog = oldWriteToLog; } GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); #endregion EditorGUILayout.EndHorizontal(); GUILayout.Space(1); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); //GUILayout.Label(_text, StyleCache.Instance.NormalLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); GUI.SetNextControlName(TextAreaControlName); _textToDisplay = EditorGUILayout.TextArea(_textToDisplay, StyleCache.Instance.RichTextLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); bool isInFocus = GUI.GetNameOfFocusedControl() == TextAreaControlName; _textToDisplay = isInFocus ? _text : _richText; GUILayout.EndScrollView(); RenderStatus( EditorSettings.WatchChanges ? (EditorApplication.isPlaying ? "Monitoring..." : "Will monitor in play mode.") : "Not monitoring.", EditorSettings.WatchChanges && EditorApplication.isPlaying ); PanelContentWrapper.End(); PanelRenderer.RenderEnd(); //GUILayout.Space(3); EditorWindowContentWrapper.End(); }