protected override void Init() { var flow = this.flow; if (flow == null) { Debug.LogError("Flow data was not set to WindowSystemFlow. Set "); return; } #if UNITY_MOBILE if (this.flowMobileOnly != null) flow = this.flowMobileOnly; #endif #if UNITY_STANDALONE if (this.flowStandaloneOnly != null) flow = this.flowStandaloneOnly; #endif #if UNITY_CONSOLE if (this.flowConsoleOnly != null) flow = this.flowConsoleOnly; #endif FlowSystem.SetData(flow); this.defaults.AddRange(flow.GetDefaultScreens()); this.windows.AddRange(flow.GetAllScreens()); base.Init(); this.OnStart(); }
public static void SetData(FlowData data) { var _data = FlowSystem.instance.data; if (_data != data && data != null) data.ResetCache(); FlowSystem.instance.data = data; }
public static void SetData(FlowData data) { FlowSystem.instance.data = data; if (data != null) { data.ResetCache(); } }
public static void Run(FlowData data) { UnityEditor.EditorUtility.DisplayProgressBar("Upgrading", string.Format("Migrating from {0} to {1}", data.version, VersionInfo.BUNDLE_VERSION), 0f); var type = data.GetType(); while (data.version < VersionInfo.BUNDLE_VERSION) { var nextVersion = data.version + 1; try { // Try to find upgrade method var methodName = "UpgradeTo" + nextVersion.ToSmallWithoutTypeString(); var methodInfo = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public); if (methodInfo != null) { var result = (bool)methodInfo.Invoke(data, null); if (result == true) { // Need to recompile var prevData = FlowSystem.GetData(); FlowSystem.SetData(data); UnityEngine.UI.Windows.Plugins.FlowCompiler.CompilerSystem.currentNamespace = data.namespaceName; var path = UnityEditor.AssetDatabase.GetAssetPath(data); UnityEngine.UI.Windows.Plugins.FlowCompiler.CompilerSystem.Generate(path, recompile: true); FlowSystem.SetData(prevData); } Debug.Log("[UPGRADE] Invoked: `" + methodName + "`, version " + nextVersion); } else { Debug.Log("[UPGRADE] Method `" + methodName + "` was not found: version " + nextVersion + " skipped"); } UnityEditor.EditorUtility.DisplayProgressBar("Upgrading", string.Format("Migrating from {0} to {1}", data.version, nextVersion), 0.5f); } catch (UnityException) { } finally { UnityEditor.EditorUtility.ClearProgressBar(); } data.version = nextVersion; UnityEditor.EditorUtility.SetDirty(data); } UnityEditor.EditorUtility.DisplayProgressBar("Upgrading", string.Format("Migrating from {0} to {1}", data.version, VersionInfo.BUNDLE_VERSION), 1f); UnityEditor.EditorUtility.ClearProgressBar(); }
public static void SetData(FlowData data) { var _data = FlowSystem.instance.data; if (_data != data && data != null) { data.ResetCache(); } FlowSystem.instance.data = data; }
protected override void Init() { var flow = this.flow; FlowSystem.SetData(flow); #if UNITY_MOBILE if (this.flowMobileOnly != null) flow = this.flowMobileOnly; #endif #if UNITY_STANDALONE if (this.flowStandaloneOnly != null) flow = this.flowStandaloneOnly; #endif this.defaults.AddRange(flow.GetDefaultScreens()); this.windows.AddRange(flow.GetAllScreens()); base.Init(); }
public void OpenFlowData(FlowData flowData) { this.guiSplash.cachedData = flowData; FlowSystem.SetData(flowData); }
public void OpenFlowData(FlowData flowData) { if (this.guiSplash == null) { this.ChangeFlowData(); return; } FlowSystem.SetData(flowData); }
public static void SetData(FlowData data) { FlowSystem.instance.data = data; }
public void DrawProjectSelector() { var darkLabel = ME.Utilities.CacheStyle("FlowEditor.DataSelection.Styles", "DarkLabel", (name) => { var style = new GUIStyle(FlowSystemEditorWindow.defaultSkin.FindStyle(name)); style.alignment = TextAnchor.MiddleLeft; return style; }); var headerStyle = new GUIStyle("LODLevelNotifyText"); headerStyle.normal.textColor = EditorGUIUtility.isProSkin == true ? Color.white : Color.black; headerStyle.fontSize = 18; headerStyle.alignment = TextAnchor.MiddleCenter; GUILayoutExt.LabelWithShadow("UI.Windows Flow Extension v" + VersionInfo.BUNDLE_VERSION, headerStyle); GUILayout.Space(10f); GUILayout.Label("Open one of your projects:", darkLabel); var backStyle = new GUIStyle("sv_iconselector_labelselection"); var skin = GUI.skin; GUI.skin = FlowSystemEditorWindow.defaultSkin; this.dataSelectionScroll = GUILayout.BeginScrollView(this.dataSelectionScroll, false, true, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, backStyle); { GUI.skin = skin; this.scannedData = EditorUtilities.GetAssetsOfType<FlowData>(); if (this.scannedData.Length == 0) { var center = new GUIStyle(darkLabel); center.fixedWidth = 0f; center.fixedHeight = 0f; center.stretchWidth = true; center.stretchHeight = true; center.alignment = TextAnchor.MiddleCenter; center.wordWrap = true; GUILayout.Label("No projects was found. Create a new one by Right-Click on any folder in Project View and choosing Create->UI.Windows->Flow->Graph option.", center); } else { var buttonStyle = new GUIStyle("U2D.createRect"); buttonStyle.padding = new RectOffset(15, 15, 15, 15); buttonStyle.margin = new RectOffset(2, 2, 2, 2); buttonStyle.fixedWidth = 0f; buttonStyle.fixedHeight = 0f; buttonStyle.stretchWidth = true; buttonStyle.stretchHeight = false; buttonStyle.normal.textColor = Color.black; buttonStyle.fontSize = 12; buttonStyle.richText = true; var buttonStyleSelected = new GUIStyle(buttonStyle); buttonStyle.normal.background = null; this.scannedData = this.scannedData.OrderByDescending((data) => (data != null ? data.lastModified : string.Empty)).ToArray(); foreach (var data in this.scannedData) { if (data == null) continue; var title = data.name + "\n"; title += "<color=#777><size=10>Modified: " + data.lastModified + "</size></color>\n"; title += "<color=#888><size=10>Version: " + data.version + "</size></color>"; if (GUILayout.Button(title, this.cachedData == data ? buttonStyleSelected : buttonStyle) == true) { this.cachedData = data; } } } GUILayout.FlexibleSpace(); } GUILayout.EndScrollView(); GUILayout.Space(10f); GUILayout.Label("Or select the project file:", darkLabel); this.cachedData = GUILayoutExt.ObjectField<FlowData>(this.cachedData, false, FlowSystemEditorWindow.defaultSkin.FindStyle("ObjectField")); CustomGUI.Splitter(); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Create Project...", FlowSystemEditorWindow.defaultSkin.button, GUILayout.Width(150f), GUILayout.Height(40f)) == true) { this.state = State.NewProject; } GUILayout.FlexibleSpace(); var oldState = GUI.enabled; GUI.enabled = oldState && this.cachedData != null; if (this.cachedData != null && this.cachedData.version < VersionInfo.BUNDLE_VERSION) { // Need to upgrade if (GUILayout.Button("Upgrade to " + VersionInfo.BUNDLE_VERSION, FlowSystemEditorWindow.defaultSkin.button, GUILayout.Width(150f), GUILayout.Height(40f)) == true) { UnityEditor.EditorUtility.DisplayProgressBar("Upgrading", string.Format("Migrating from {0} to {1}", this.cachedData.version, VersionInfo.BUNDLE_VERSION), 0f); var type = this.cachedData.GetType(); while (this.cachedData.version < VersionInfo.BUNDLE_VERSION) { var nextVersion = this.cachedData.version + 1; // Try to find upgrade method var methodName = "UpgradeTo" + nextVersion.ToSmallWithoutTypeString(); var methodInfo = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public); if (methodInfo != null) { methodInfo.Invoke(this.cachedData, null); Debug.Log("[UPGRADE] Invoked: `" + methodName + "`, version " + nextVersion); } else { Debug.Log("[UPGRADE] Method `" + methodName + "` was not found: version " + nextVersion + " skipped"); } UnityEditor.EditorUtility.DisplayProgressBar("Upgrading", string.Format("Migrating from {0} to {1}", this.cachedData.version, nextVersion), 0.5f); this.cachedData.version = nextVersion; UnityEditor.EditorUtility.SetDirty(this.cachedData); } UnityEditor.EditorUtility.DisplayProgressBar("Upgrading", string.Format("Migrating from {0} to {1}", this.cachedData.version, VersionInfo.BUNDLE_VERSION), 1f); UnityEditor.EditorUtility.ClearProgressBar(); } } else if (this.cachedData != null && this.cachedData.version > VersionInfo.BUNDLE_VERSION) { EditorGUILayout.HelpBox(string.Format("Selected Project has {0} version while UI.Windows System has {1} version number. Please, download a new version.", this.cachedData.version, VersionInfo.BUNDLE_VERSION), MessageType.Warning); if (GUILayout.Button("Download", FlowSystemEditorWindow.defaultSkin.button, GUILayout.Width(100f), GUILayout.Height(40f)) == true) { Application.OpenURL(VersionInfo.DOWNLOAD_LINK); } } else { if (GUILayout.Button("Open", FlowSystemEditorWindow.defaultSkin.button, GUILayout.Width(100f), GUILayout.Height(40f)) == true) { FlowSystem.SetData(this.cachedData); } } GUI.enabled = oldState; } GUILayout.EndHorizontal(); }
public static void SetData(FlowData data) { FlowSystem.instance.data = data; if (data != null) data.ResetCache(); }
public void DrawProjectSelector() { var darkLabel = ME.Utilities.CacheStyle("FlowEditor.DataSelection.Styles", "DarkLabel", (name) => { var style = new GUIStyle(FlowSystemEditorWindow.defaultSkin.FindStyle(name)); style.alignment = TextAnchor.MiddleLeft; return style; }); var headerStyle = new GUIStyle("LODLevelNotifyText"); headerStyle.normal.textColor = EditorGUIUtility.isProSkin == true ? Color.white : Color.black; headerStyle.fontSize = 18; headerStyle.alignment = TextAnchor.MiddleCenter; GUILayoutExt.LabelWithShadow("UI.Windows Flow Extension v" + VersionInfo.BUNDLE_VERSION, headerStyle); GUILayout.Space(10f); GUILayout.Label("Open one of your projects:", darkLabel); var backStyle = new GUIStyle("sv_iconselector_labelselection"); var skin = GUI.skin; GUI.skin = FlowSystemEditorWindow.defaultSkin; this.dataSelectionScroll = GUILayout.BeginScrollView(this.dataSelectionScroll, false, true, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, backStyle); { GUI.skin = skin; this.scannedData = EditorUtilities.GetAssetsOfType<FlowData>(useCache: false); if (this.scannedData.Length == 0) { var center = new GUIStyle(darkLabel); center.fixedWidth = 0f; center.fixedHeight = 0f; center.stretchWidth = true; center.stretchHeight = true; center.alignment = TextAnchor.MiddleCenter; center.wordWrap = true; GUILayout.Label("No projects was found. Create a new one by Right-Click on any folder in Project View and choosing Create->UI.Windows->Flow->Graph option.", center); } else { var buttonStyle = new GUIStyle("U2D.createRect"); buttonStyle.padding = new RectOffset(15, 15, 15, 15); buttonStyle.margin = new RectOffset(2, 2, 2, 2); buttonStyle.fixedWidth = 0f; buttonStyle.fixedHeight = 0f; buttonStyle.stretchWidth = true; buttonStyle.stretchHeight = false; buttonStyle.normal.textColor = Color.black; buttonStyle.fontSize = 12; buttonStyle.richText = true; var buttonStyleSelected = new GUIStyle(buttonStyle); buttonStyle.normal.background = null; this.scannedData = this.scannedData.OrderByDescending((data) => (data != null ? data.lastModifiedUnix : 0)).ToArray(); foreach (var data in this.scannedData) { if (data == null) continue; var title = data.name + "\n"; title += "<color=#777><size=10>Modified: " + data.lastModified + "</size></color>\n"; title += "<color=#888><size=10>Version: " + data.version + "</size></color>"; if (GUILayout.Button(title, this.cachedData == data ? buttonStyleSelected : buttonStyle) == true) { this.cachedData = data; } } } GUILayout.FlexibleSpace(); } GUILayout.EndScrollView(); GUILayout.Space(10f); GUILayout.Label("Or select the project file:", darkLabel); this.cachedData = GUILayoutExt.ObjectField<FlowData>(this.cachedData, false, FlowSystemEditorWindow.defaultSkin.FindStyle("ObjectField")); CustomGUI.Splitter(); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Create Project...", FlowSystemEditorWindow.defaultSkin.button, GUILayout.Width(150f), GUILayout.Height(40f)) == true) { this.state = State.NewProject; } GUILayout.FlexibleSpace(); var oldState = GUI.enabled; GUI.enabled = oldState && this.cachedData != null; if (this.cachedData != null && this.cachedData.version < VersionInfo.BUNDLE_VERSION) { // Need to upgrade if (GUILayout.Button("Upgrade to " + VersionInfo.BUNDLE_VERSION, FlowSystemEditorWindow.defaultSkin.button, GUILayout.Width(150f), GUILayout.Height(40f)) == true) { FlowUpdater.Run(this.cachedData); } } else if (this.cachedData != null && this.cachedData.version > VersionInfo.BUNDLE_VERSION) { var info = string.Format( "Selected Project has `{0}` version while UI.Windows System has `{1}` version number. Click here to download a new version.", this.cachedData.version, VersionInfo.BUNDLE_VERSION ); if (GUILayout.Button(new GUIContent(info, new GUIStyle("CN EntryWarn").normal.background), EditorStyles.helpBox, GUILayout.Height(40f)) == true) { Application.OpenURL(VersionInfo.DOWNLOAD_LINK); } } else { if (GUILayout.Button("Open", FlowSystemEditorWindow.defaultSkin.button, GUILayout.Width(100f), GUILayout.Height(40f)) == true) { FlowSystem.SetData(this.cachedData); } } GUI.enabled = oldState; } GUILayout.EndHorizontal(); }
public void OpenFlowData(FlowData flowData) { if (this.guiSplash == null) this.guiSplash = new FlowSplash(this); this.guiSplash.cachedData = flowData; FlowSystem.SetData(flowData); }
private void DrawDataSelection() { this.DrawBackground(); if (this.splash == null) this.splash = Resources.Load("UI.Windows/Flow/Splash") as Texture; var darkLabel = FlowSystemEditorWindow.defaultSkin.FindStyle("DarkLabel"); var rect = FlowSystemEditor.GetCenterRect(this.position, this.splash.width, this.splash.height); var boxStyle = new GUIStyle(GUI.skin.box); boxStyle.margin = new RectOffset(0, 0, 0, 0); boxStyle.padding = new RectOffset(0, 0, 0, 0); boxStyle.normal.background = null; GUI.Box(rect, this.splash, boxStyle); var width = 730f; var height = 456f; var rectOffset = FlowSystemEditor.GetCenterRect(this.position, width, height); var marginLeft = 240f; var margin = 20f; var padding = 20f; GUILayout.BeginArea(rectOffset); { var borderWidth = width - marginLeft - margin; var borderHeight = height - margin * 2f; GUILayout.BeginArea(new Rect(marginLeft, margin, borderWidth, borderHeight), new GUIStyle("sv_iconselector_labelselection")); { GUILayout.BeginArea(new Rect(padding, padding, borderWidth - padding * 2f, borderHeight - padding * 2f)); { var headerStyle = new GUIStyle("LODLevelNotifyText"); headerStyle.fontSize = 18; headerStyle.alignment = TextAnchor.MiddleCenter; GUILayoutExt.LabelWithShadow("UI.Windows Flow Extension v" + VersionInfo.bundleVersion, headerStyle); GUILayout.Space(10f); GUILayout.Label("Open one of your projects:", darkLabel); var backStyle = new GUIStyle("sv_iconselector_labelselection"); var skin = GUI.skin; GUI.skin = FlowSystemEditorWindow.defaultSkin; this.dataSelectionScroll = GUILayout.BeginScrollView(this.dataSelectionScroll, false, true, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, backStyle); { GUI.skin = skin; this.scannedData = EditorUtilities.GetAssetsOfType<FlowData>(); if (this.scannedData.Length == 0) { var center = new GUIStyle(darkLabel); center.fixedWidth = 0f; center.fixedHeight = 0f; center.stretchWidth = true; center.stretchHeight = true; center.alignment = TextAnchor.MiddleCenter; center.wordWrap = true; GUILayout.Label("No projects was found. Create a new one by Right-Click on any folder in Project View and choose Create->UI.Windows->Flow->Graph option.", center); } else { var buttonStyle = new GUIStyle("U2D.createRect"); buttonStyle.padding = new RectOffset(15, 15, 15, 15); buttonStyle.margin = new RectOffset(2, 2, 2, 2); buttonStyle.fixedWidth = 0f; buttonStyle.fixedHeight = 0f; buttonStyle.stretchWidth = true; buttonStyle.stretchHeight = false; buttonStyle.normal.textColor = Color.black; buttonStyle.fontSize = 12; buttonStyle.richText = true; var buttonStyleSelected = new GUIStyle(buttonStyle); buttonStyle.normal.background = null; this.scannedData = this.scannedData.OrderByDescending((data) => (data != null ? data.lastModified : string.Empty)).ToArray(); foreach (var data in this.scannedData) { if (data == null) continue; var title = data.name + "\n<color=#777><size=10>Modified: " + data.lastModified + "</size></color>"; if (GUILayout.Button(title, this.cachedData == data ? buttonStyleSelected : buttonStyle) == true) { this.cachedData = data; } } } GUILayout.FlexibleSpace(); } GUILayout.EndScrollView(); GUILayout.Space(10f); GUILayout.Label("Or select the project file:", darkLabel); this.cachedData = GUILayoutExt.ObjectField<FlowData>(this.cachedData, false, FlowSystemEditorWindow.defaultSkin.FindStyle("ObjectField")); CustomGUI.Splitter(); GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); var oldState = GUI.enabled; GUI.enabled = oldState && this.cachedData != null; if (GUILayout.Button("Open", FlowSystemEditorWindow.defaultSkin.button, GUILayout.Width(100f), GUILayout.Height(40f)) == true) { FlowSystem.SetData(this.cachedData); } GUI.enabled = oldState; } GUILayout.EndHorizontal(); } GUILayout.EndArea(); } GUILayout.EndArea(); } GUILayout.EndArea(); }