Skip to content
Snippets Groups Projects
Commit 854d4067 authored by WJohnM18's avatar WJohnM18
Browse files

Create basic window with a button that creates a label and preserves state

parent 4581d9aa
No related branches found
No related tags found
No related merge requests found
Showing
with 99 additions and 44 deletions
......@@ -22,7 +22,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_2_18;UNITY_2018_2;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;UNITY_ANALYTICS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_TEXTURE_STREAMING;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_VIDEO;ENABLE_PACKMAN;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_OSX;PLATFORM_STANDALONE;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_NATIVE_CRASH_REPORTING;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_SPATIALTRACKING;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0_SUBSET;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_2_18;UNITY_2018_2;UNITY_2018;PLATFORM_ARCH_64;UNITY_64;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITES;ENABLE_GRID;ENABLE_TILEMAP;ENABLE_TERRAIN;ENABLE_TEXTURE_STREAMING;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_VIDEO;ENABLE_PACKMAN;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_LOCALIZATION;PLATFORM_STANDALONE_OSX;PLATFORM_STANDALONE;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_NATIVE_CRASH_REPORTING;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_SPATIALTRACKING;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0_SUBSET;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
......@@ -53,11 +53,16 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\Scripts\BallCameraController.cs" />
<Compile Include="Assets\Scripts\CameraFlyer.cs" />
<Compile Include="Assets\Scripts\NewMenuItem.cs" />
<Compile Include="Assets\Scripts\PlayerBallController.cs" />
<Compile Include="Assets\Scripts\Rotator.cs" />
<Compile Include="Assets\Scripts\BallGame\BallCameraController.cs" />
<Compile Include="Assets\Scripts\BallGame\PlayerBallController.cs" />
<Compile Include="Assets\Scripts\BallGame\Rotator.cs" />
<Compile Include="Assets\Scripts\LivingRoom\CameraFlyer.cs" />
<Compile Include="Assets\Scripts\RenderSettings\Implementations\RenderSettingPreset.cs" />
<Compile Include="Assets\Scripts\RenderSettings\Implementations\RenderSettingPresetBuilder.cs" />
<Compile Include="Assets\Scripts\RenderSettings\Interfaces\IRenderSettingPreset.cs" />
<Compile Include="Assets\Scripts\RenderSettings\Interfaces\IRenderSettingPresetBuilder.cs" />
<Compile Include="Assets\Scripts\RenderSettings\RenderSettingsMenu.cs" />
<Compile Include="Assets\Scripts\RenderSettings\RenderSettingsWindow.cs" />
<Reference Include="UnityEditor.StandardEvents">
<HintPath>/Users/williammacdonald/University/cs408-configurablevirtualrealityrendering/src/RollABall/Library/ScriptAssemblies/UnityEditor.StandardEvents.dll</HintPath>
</Reference>
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class RenderSettingsWindow : EditorWindow {
[MenuItem("Render Settings/Show Window %6")]
public static void ShowWindow() {
EditorWindow.GetWindow(typeof(RenderSettingsWindow));
}
string myString = "Hello world";
bool groupEnabled;
bool myBool = true;
float myFloat = 1.23f;
void OnGUI() {
GUILayout.Label("Base Settings", EditorStyles.boldLabel);
myString = EditorGUILayout.TextField("TextField", myString);
groupEnabled = EditorGUILayout.BeginToggleGroup("Optional Settings", groupEnabled);
myBool = EditorGUILayout.Toggle("Toggle", myBool);
myFloat = EditorGUILayout.Slider("Slider", myFloat, -3, 3);
EditorGUILayout.EndToggleGroup();
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RenderSettingPreset : IRenderSettingPreset {
private string name;
public string GetName() {
return name;
}
public void SetName(string name) {
this.name = name;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RenderSettingPresetBuilder : IRenderSettingPresetBuilder {
public IRenderSettingPreset Build(string name) {
IRenderSettingPreset preset = new RenderSettingPreset();
preset.SetName(name);
return preset;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IRenderSettingPreset {
string GetName();
void SetName(string name);
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IRenderSettingPresetBuilder {
IRenderSettingPreset Build(string name);
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class RenderSettingsMenu {
[MenuItem("Render Settings/Show Window")]
public static void ShowWindow() {
EditorWindow.GetWindow(typeof(RenderSettingsWindow));
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class RenderSettingsWindow : EditorWindow {
static HashSet<IRenderSettingPreset> presets = new HashSet<IRenderSettingPreset>();
IRenderSettingPresetBuilder presetBuilder = new RenderSettingPresetBuilder();
void OnGUI() {
if (presets.Count == 0) {
EditorGUILayout.LabelField("No presets available");
} else {
foreach (IRenderSettingPreset preset in presets) {
DrawPreset(preset);
}
}
if(GUILayout.Button("Create new preset")) {
presets.Add(presetBuilder.Build("Apple"));
Repaint();
}
}
private void DrawPreset(IRenderSettingPreset preset) {
EditorGUILayout.LabelField(preset.GetName());
}
}
fileFormatVersion: 2
guid: 533c80152cc404979a7546338f5aaef6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment