public override void OnInspectorGUI() { GUIHelpers.IsInspector = true; // DrawTitleBar("Scene Management Service"); base.OnInspectorGUI(); serializedObject.Update(); if (Application.isPlaying) { if (GUIHelpers.DoToolbarEx("Loaded Scenes")) { if (Service != null) { foreach (IScene instance in Service.LoadedScenes) { if (GUIHelpers.DoTriggerButton(new UFStyle { BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall, Label = string.Format("{0}", instance.GetType().Name) })) { Selection.activeGameObject = (instance as MonoBehaviour).gameObject; } } } } } if (serializedObject.ApplyModifiedProperties()) { //var t = Target as GameManager; //t.ApplyRenderSettings(); } GUIHelpers.IsInspector = false; }
private void DoMarketScreen() { foreach (var item in jsonInfo.MarketItems) { if ( GUIHelpers.DoTriggerButton(new UFStyle(string.Format("{0} {1:C}", item.Name, item.Price), ElementDesignerStyles.EventButtonStyleSmall) { FullWidth = false })) { } } if (GUILayout.Button("Logout")) { MarketPlace.Token = null; MarketPlace.Cookies = null; loginResponse = null; jsonInfo = null; } }
public override void OnInspectorGUI() { GUIHelpers.IsInsepctor = true; DrawTitleBar("Scene Manager"); base.OnInspectorGUI(); if (EditorApplication.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode) { //if (GUI.Button(GUIHelpers.GetRect(ElementDesignerStyles.ButtonStyle), "Serialize To String", ElementDesignerStyles.ButtonStyle)) //{ // var sm = (target as SceneManager); // sm.SaveState(new TextAssetStorage() { AssetPath = "Assets/TestData.txt" }, new JsonStream() { UseReferences = true }); //} //if (GUI.Button(GUIHelpers.GetRect(ElementDesignerStyles.ButtonStyle), "Load From String", ElementDesignerStyles.ButtonStyle)) //{ // var sm = (target as SceneManager); // sm.LoadState(new TextAssetStorage() { AssetPath = "Assets/TestData.txt" }, new JsonStream() { UseReferences = true }); //} if (GUIHelpers.DoToolbarEx("Persistable Views")) { foreach (var viewBase in GameManager.ActiveSceneManager.PersistantViews) { if (viewBase == null) { continue; } if (GUIHelpers.DoTriggerButton(new UFStyle(viewBase.Identifier + ": " + viewBase.name, ElementDesignerStyles.EventButtonStyleSmall, null, null, null, false, TextAnchor.MiddleCenter) { })) { //var fileStorage = new TextAssetStorage(); var stringStorage = new StringSerializerStorage(); var stream = new JsonStream(); viewBase.Write(stream); stringStorage.Save(stream); Debug.Log(stringStorage); } } } if (GUIHelpers.DoToolbarEx("Persistable View-Models")) { foreach (var viewBase in GameManager.ActiveSceneManager.PersistantViewModels) { if (viewBase == null) { continue; } if (GUIHelpers.DoTriggerButton(new UFStyle(viewBase.Identifier + ": " + viewBase.GetType().Name, ElementDesignerStyles.EventButtonStyleSmall, null, null, null, false, TextAnchor.MiddleCenter) { })) { //var fileStorage = new TextAssetStorage(); var stringStorage = new StringSerializerStorage(); var stream = new JsonStream(); viewBase.Write(stream); stringStorage.Save(stream); Debug.Log(stringStorage); } } } } GUIHelpers.IsInsepctor = false; }
public override void OnGUIScrollView() { if (Event.current != null && Event.current.isKey && Event.current.keyCode == KeyCode.UpArrow && Event.current.type == EventType.KeyUp) { MoveDown(); } if (Event.current != null && Event.current.isKey && Event.current.keyCode == KeyCode.DownArrow && Event.current.type == EventType.KeyUp) { MoveUp(); } if (AllowNode) { if ( GUIHelpers.DoTriggerButton(new UFStyle() { Label = "[NONE]", IsWindow = true, FullWidth = true, BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall })) { SelectedAction(null); IsClosing = true; } } if (ItemGroups == null) { return; } var index = 0; var isFirst = true; foreach (var group in ItemGroups) { if (group.Any()) { if (string.IsNullOrEmpty(_SearchText)) { if (GUIHelpers.DoToolbarEx(group.Key)) { foreach (var item in group) { var item1 = item; if (item == null) { continue; } if ( GUIHelpers.DoTriggerButton(new UFStyle() { Label = item.Title, IsWindow = true, FullWidth = true, BackgroundStyle = index == HighlightedIndex ? ElementDesignerStyles.Item1 : ElementDesignerStyles.EventButtonStyleSmall })) { SelectedAction(item1); IsClosing = true; } if (index == HighlightedIndex && Event.current != null && Event.current.isKey && Event.current.keyCode == KeyCode.Return) { SelectedAction(item1); } isFirst = false; index++; } } } else { foreach (var item in group) { if (item == null) { continue; } var item1 = item; if (GUIHelpers.DoTriggerButton(new UFStyle() { Label = item.Group + " : " + item.Title, IsWindow = true, FullWidth = true, BackgroundStyle = index == HighlightedIndex ? ElementDesignerStyles.Item1 : ElementDesignerStyles.EventButtonStyleSmall })) { SelectedAction(item1); IsClosing = true; } if (index == HighlightedIndex && Event.current != null && Event.current.isKey && Event.current.keyCode == KeyCode.Return) { SelectedAction(item1); IsClosing = true; } isFirst = false; index++; } } } } }
public override void OnInspectorGUI() { GUIHelpers.IsInspector = true; //base.OnInspectorGUI(); DrawTitleBar("UFrame MVVM Kernel"); serializedObject.Update(); if (!EditorBuildSettings.scenes.Any(s => { return(s.path.EndsWith("KernelScene.unity")); })) { Warning("Please add this scene to the build settings!"); } if (Application.isPlaying) { if (!uFrameKernel.IsKernelLoaded) { Warning("Kernel is not loaded!"); } if (uFrameKernel.Instance == null) { return; } if (GUIHelpers.DoToolbarEx("Services")) { foreach (ISystemService instance in uFrameKernel.Instance.Services) { if (GUIHelpers.DoTriggerButton(new UFStyle { BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall, Label = string.Format("{0}", instance.GetType().Name) })) { Selection.activeGameObject = (instance as MonoBehaviour).gameObject; } } } if (GUIHelpers.DoToolbarEx("Systems")) { foreach (ISystemLoader instance in uFrameKernel.Instance.SystemLoaders) { if (GUIHelpers.DoTriggerButton(new UFStyle { BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall, Label = string.Format("{0}", instance.GetType().Name.Replace("Loader", "")) })) { Selection.activeGameObject = (instance as MonoBehaviour).gameObject; } } } if (GUIHelpers.DoToolbarEx("Scene Loaders")) { if (GUIHelpers.DoTriggerButton(new UFStyle { BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall, Label = string.Format("{0}", "DefaultSceneLoader") })) { } //foreach (var instance in uFrameMVVMKernel.Instance.SceneLoaders) //{ // if (GUIHelpers.DoTriggerButton(new UFStyle() // { // BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall, // Label = string.Format("{0}", instance.GetType().Name) // })) // { // Selection.activeGameObject = (instance as MonoBehaviour).gameObject; // } //} } if (GUIHelpers.DoToolbarEx(String.Format("Dependency Container - Instances ({0})", uFrameKernel.Container.Instances.Count), defOn: false, prefsKey: "Dependency Container - Instances")) { foreach (KeyValuePair <Tuple <Type, string>, object> instance in uFrameKernel.Container.Instances) { if (GUIHelpers.DoTriggerButton(new UFStyle { Label = string.Format("'{0}': {1}->{2}", instance.Key.Item1, instance.Key.Item2, instance.Value.GetType().Name), BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall })) { Debug.Log(instance.Value); } } } if (GUIHelpers.DoToolbarEx(String.Format("Dependency Container - Mappings ({0})", uFrameKernel.Container.Mappings.Count), defOn: false, prefsKey: "Dependency Container - Mappings")) { foreach (KeyValuePair <Tuple <Type, string>, Type> instance in uFrameKernel.Container.Mappings) { if (GUIHelpers.DoTriggerButton(new UFStyle { BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall, Label = string.Format("{0}: {1}->{2}", instance.Key.Item2, instance.Key.Item1.Name, instance.Value.Name) })) { } } } } if (serializedObject.ApplyModifiedProperties()) { //var t = Target as GameManager; //t.ApplyRenderSettings(); } GUIHelpers.IsInspector = false; }
public override void OnInspectorGUI() { GUIHelpers.IsInsepctor = true; //base.OnInspectorGUI(); DrawTitleBar("Game Manager"); serializedObject.Update(); if (Application.isPlaying) { if (GUIHelpers.DoToolbarEx("Dependency Container - Instances")) { foreach (var instance in GameManager.Container.Instances) { if (GUIHelpers.DoTriggerButton(new UFStyle() { Label = string.Format("'{0}': {1}->{2}", instance.Name, instance.Base.Name, instance.Instance.GetType().Name), BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall })) { Debug.Log(instance.Instance); } } } if (GUIHelpers.DoToolbarEx("Dependency Container - Mappings")) { foreach (var instance in GameManager.Container.Mappings) { if (GUIHelpers.DoTriggerButton(new UFStyle() { BackgroundStyle = ElementDesignerStyles.EventButtonStyleSmall, Label = string.Format("{0}: {1}->{2}", instance.Name, instance.From.Name, instance.To.Name) })) { } } } } else { EditorGUILayout.HelpBox("The View to load when the scene starts.", MessageType.None); var p = serializedObject.FindProperty("_Start"); if (p.objectReferenceValue == null) { EditorGUILayout.HelpBox("Error start scene manager is not set.", MessageType.Error); } EditorGUILayout.PropertyField(p); EditorGUILayout.HelpBox("The loading scene that will be used when switching scenes via GameManager.SwitchSceneAndLevel<View>().", MessageType.None); p = serializedObject.FindProperty("_LoadingLevel"); EditorGUILayout.PropertyField(p); EditorGUILayout.HelpBox("Pro Users: Will use non asynchronous loading.", MessageType.None); p = serializedObject.FindProperty("_DontUseAsyncLoading"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_ShowLogs"); EditorGUILayout.PropertyField(p); EditorGUILayout.HelpBox("The render settings that will apply when the scene loads.", MessageType.None); //_RenderSettingsOpen = Toggle("Render Settings", _RenderSettingsOpen); if (GUIHelpers.DoToolbarEx("Render Settings")) { p = serializedObject.FindProperty("_Fog"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_FogColor"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_FogMode"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_FogDensity"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_LinearFogStart"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_LinearFogEnd"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_AmbientLight"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_SkyboxMaterial"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_HaloStrength"); EditorGUILayout.PropertyField(p); p = serializedObject.FindProperty("_FlareStrength"); EditorGUILayout.PropertyField(p); if (GUILayout.Button("Load From Scene")) { var t = Target as GameManager; t.LoadRenderSettings(); } } } if (serializedObject.ApplyModifiedProperties()) { //var t = Target as GameManager; //t.ApplyRenderSettings(); } GUIHelpers.IsInsepctor = false; }