Skip to content

Commit 936a87f

Browse files
committed
version 0.9a
- Flow: Arrows visual fixes - Flow: Window states fixed - Flow: Minor GUI fixes - Layout: Light skin size fixes
1 parent 2e41545 commit 936a87f

4 files changed

Lines changed: 82 additions & 24 deletions

File tree

Assets/UI.Windows/Addons/Flow/Core/Editor/FlowSystemEditorWindow.cs

Lines changed: 71 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,6 +2033,8 @@ private void DrawWindowToolbar(FlowWindow window) {
20332033
if (window.isDefaultLink == false && FlowSceneView.IsActive() == false) {
20342034

20352035
if (GUILayout.Button("Select", buttonStyle) == true) {
2036+
2037+
for (int i = 0; i < window.states.Length; ++i) window.SetCompletedState(i, CompletedState.NotReady);
20362038

20372039
if (window.compiled == false) {
20382040

@@ -2043,30 +2045,60 @@ private void DrawWindowToolbar(FlowWindow window) {
20432045
Selection.activeObject = AssetDatabase.LoadAssetAtPath(window.compiledDirectory.Trim('/'), typeof(Object));
20442046
EditorGUIUtility.PingObject(Selection.activeObject);
20452047

2046-
if (window.screen == null) {
2048+
//if (window.screen == null) {
20472049

2048-
var files = AssetDatabase.FindAssets("t:GameObject", new string[] { window.compiledDirectory + "Screens" });
2049-
foreach (var file in files) {
2050+
window.SetCompletedState(0, CompletedState.NotReady);
20502051

2051-
var path = AssetDatabase.GUIDToAssetPath(file);
2052-
2053-
var go = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject;
2054-
if (go != null) {
2052+
var files = AssetDatabase.FindAssets("t:GameObject", new string[] { window.compiledDirectory.Trim('/') + "/Screens" });
2053+
foreach (var file in files) {
2054+
2055+
var path = AssetDatabase.GUIDToAssetPath(file);
2056+
2057+
var go = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject;
2058+
if (go != null) {
2059+
2060+
var screen = go.GetComponent<WindowBase>();
2061+
if (screen != null) {
2062+
2063+
window.SetScreen(screen);
2064+
window.SetCompletedState(0, CompletedState.Ready);
2065+
2066+
var lWin = screen as LayoutWindowType;
2067+
if (lWin != null) {
2068+
2069+
if (lWin.layout.layout != null) {
20552070

2056-
var screen = go.GetComponent<WindowBase>();
2057-
if (screen != null) {
2071+
window.SetCompletedState(1, CompletedState.Ready);
2072+
window.SetCompletedState(2, (lWin.layout.components.Any((c) => c == null) == true) ? CompletedState.ReadyButWarnings : CompletedState.Ready);
20582073

2059-
window.SetScreen(screen);
2060-
break;
2074+
} else {
2075+
2076+
window.SetCompletedState(0, CompletedState.NotReady);
2077+
window.SetCompletedState(1, CompletedState.NotReady);
2078+
window.SetCompletedState(2, CompletedState.NotReady);
2079+
2080+
}
2081+
2082+
} else {
2083+
2084+
window.SetCompletedState(1, CompletedState.Ready);
20612085

20622086
}
20632087

2088+
break;
2089+
2090+
} else {
2091+
2092+
window.SetCompletedState(0, CompletedState.ReadyButWarnings);
2093+
20642094
}
20652095

20662096
}
20672097

20682098
}
20692099

2100+
//}
2101+
20702102
}
20712103

20722104
}
@@ -2383,32 +2415,47 @@ private void DrawNodeCurve(FlowWindow from, FlowWindow to, bool doubleSide) {
23832415
var toRect = to.rect;
23842416
Rect centerEnd = toRect;
23852417

2418+
var fromComponent = false;
2419+
var toComponent = false;
2420+
23862421
if (FlowSystem.GetData().flowWindowWithLayout == true) {
23872422

2388-
var comp = from.attachedComponents.FirstOrDefault((c) => c.targetWindowId == to.id);
2389-
if (comp.sourceComponentTag != LayoutTag.None) {
2423+
var comps = from.attachedComponents.Where((c) => c.targetWindowId == to.id && c.sourceComponentTag != LayoutTag.None);
2424+
foreach (var comp in comps) {
23902425

23912426
var component = from.GetLayoutComponent(comp.sourceComponentTag);
23922427
if (component != null) {
23932428

2429+
fromRect = centerStart;
2430+
23942431
var rect = component.tempEditorRect;
23952432
fromRect = new Rect(fromRect.x + rect.x, fromRect.y + rect.y, rect.width, rect.height);
23962433

2434+
this.DrawNodeCurve(from.GetContainer(), to.GetContainer(), centerStart, centerEnd, fromRect, toRect, doubleSide, 0f);
2435+
2436+
fromComponent = true;
2437+
23972438
}
23982439

23992440
}
24002441

24012442
if (doubleSide == true) {
24022443

2403-
comp = to.attachedComponents.FirstOrDefault((c) => c.targetWindowId == from.id);
2404-
if (comp.sourceComponentTag != LayoutTag.None) {
2444+
comps = to.attachedComponents.Where((c) => c.targetWindowId == from.id && c.sourceComponentTag != LayoutTag.None);
2445+
foreach (var comp in comps) {
24052446

24062447
var component = to.GetLayoutComponent(comp.sourceComponentTag);
24072448
if (component != null) {
24082449

2450+
toRect = centerEnd;
2451+
24092452
var rect = component.tempEditorRect;
24102453
toRect = new Rect(toRect.x + rect.x, toRect.y + rect.y, rect.width, rect.height);
24112454

2455+
this.DrawNodeCurve(from.GetContainer(), to.GetContainer(), centerStart, centerEnd, fromRect, toRect, doubleSide, 0f);
2456+
2457+
toComponent = true;
2458+
24122459
}
24132460

24142461
}
@@ -2417,28 +2464,32 @@ private void DrawNodeCurve(FlowWindow from, FlowWindow to, bool doubleSide) {
24172464

24182465
}
24192466

2467+
if (fromComponent == false && toComponent == false) this.DrawNodeCurve(from.GetContainer(), to.GetContainer(), centerStart, centerEnd, fromRect, toRect, doubleSide);
2468+
2469+
}
2470+
2471+
private void DrawNodeCurve(FlowWindow fromContainer, FlowWindow toContainer, Rect centerStart, Rect centerEnd, Rect fromRect, Rect toRect, bool doubleSide, float size = 6f) {
2472+
24202473
Rect start = fromRect;
24212474
Rect end = toRect;
24222475

24232476
var color1 = Color.white;
24242477
var color2 = Color.white;
24252478

2426-
if (from.GetContainer() != to.GetContainer()) {
2479+
if (fromContainer != toContainer) {
24272480

24282481
color1 = Color.gray;
24292482
color2 = Color.gray;
24302483

2431-
if (to.GetContainer() != null) color1 = to.GetContainer().randomColor;
2432-
if (from.GetContainer() != null) color2 = from.GetContainer().randomColor;
2484+
if (toContainer != null) color1 = toContainer.randomColor;
2485+
if (fromContainer != null) color2 = fromContainer.randomColor;
24332486

24342487
}
24352488

24362489
var zOffset = -4f;
24372490

24382491
if (doubleSide == true) {
24392492

2440-
var size = 6f;
2441-
24422493
var rot = Quaternion.AngleAxis(90f, Vector3.back);
24432494
var ray = new Ray(Vector3.zero, (rot * (end.center - start.center)).normalized);
24442495

Assets/UI.Windows/Addons/Flow/Core/FlowWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public ComponentLink(int targetWindowId, LayoutTag sourceComponentTag, string co
4242

4343
}
4444

45-
private const int STATES_COUNT = 5;
45+
private const int STATES_COUNT = 3;
4646

4747
public int id;
4848
public string title = string.Empty;

Assets/UI.Windows/Addons/Flow/Editor/FlowAddon.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using UnityEngine.UI.Windows;
33
using UnityEngine.UI.Windows.Plugins.Flow;
44
using UnityEngine;
5+
using ME;
56

67
namespace UnityEditor.UI.Windows.Plugins.Flow {
78

@@ -28,7 +29,7 @@ public class Flow : IWindowAddon {
2829

2930
public static void DrawModuleSettingsGUI(string caption, System.Action onGUI) {
3031

31-
GUILayout.Label(caption, EditorStyles.boldLabel);
32+
GUILayout.Label(caption.ToSentenceCase().UppercaseWords(), EditorStyles.boldLabel);
3233

3334
GUILayout.BeginVertical(FlowSystemEditorWindow.defaultSkin.box);//GUI.skin.box);
3435
{

Assets/UI.Windows/Layouts/Editor/WindowLayoutEditor.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ public void OnPreviewGUI(Color color, Rect r, GUIStyle background, bool drawInfo
175175

176176
GUI.color = oldColor;
177177

178+
var boxColor = EditorGUIUtility.isProSkin ? oldColor : new Color(1f, 1f, 1f, 0.2f);
179+
178180
var marginX = 4f;
179181
var marginY = 2f;
180182

@@ -185,8 +187,10 @@ public void OnPreviewGUI(Color color, Rect r, GUIStyle background, bool drawInfo
185187
vRect.y = vRect.y + vRect.height * 0.5f - vertArrowsStyle.fixedHeight * 0.5f;
186188
vRect.width -= marginX * 2f;
187189
vRect.height = vertArrowsStyle.fixedHeight;
188-
190+
191+
GUI.color = oldColor;
189192
GUI.Label(vRect, string.Empty, vertArrowsStyle);
193+
GUI.color = boxColor;
190194
GUI.Label(vRect, string.Empty, vertStyle);
191195

192196
}
@@ -198,8 +202,10 @@ public void OnPreviewGUI(Color color, Rect r, GUIStyle background, bool drawInfo
198202
vRect.y += marginY;
199203
vRect.width = horArrowsStyle.fixedWidth;
200204
vRect.height -= marginY * 2f;
201-
205+
206+
GUI.color = oldColor;
202207
GUI.Label(vRect, string.Empty, horArrowsStyle);
208+
GUI.color = boxColor;
203209
GUI.Label(vRect, string.Empty, horStyle);
204210

205211
}

0 commit comments

Comments
 (0)