@@ -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
0 commit comments