12
12
using UnityExplorer . UI . Reusable ;
13
13
using UnityExplorer . UI . Main . CSConsole ;
14
14
using UnityExplorer . Core ;
15
+ using UnityExplorer . Core . Unity ;
15
16
#if CPP
16
17
using UnityExplorer . Core . Runtime . Il2Cpp ;
17
18
#endif
@@ -56,13 +57,10 @@ public override bool Init()
56
57
DummyBehaviour . Setup ( ) ;
57
58
#endif
58
59
59
- ResetConsole ( ) ;
60
+ ResetConsole ( false ) ;
60
61
// Make sure compiler is supported on this platform
61
62
Evaluator . Compile ( "" ) ;
62
63
63
- foreach ( string use in DefaultUsing )
64
- AddUsing ( use ) ;
65
-
66
64
return true ;
67
65
}
68
66
catch ( Exception e )
@@ -79,7 +77,7 @@ public override bool Init()
79
77
}
80
78
}
81
79
82
- public void ResetConsole ( )
80
+ public void ResetConsole ( bool log = true )
83
81
{
84
82
if ( Evaluator != null )
85
83
Evaluator . Dispose ( ) ;
@@ -89,14 +87,19 @@ public void ResetConsole()
89
87
Evaluator = new ScriptEvaluator ( new StringWriter ( m_evalLogBuilder ) ) { InteractiveBaseClass = typeof ( ScriptInteraction ) } ;
90
88
91
89
UsingDirectives = new List < string > ( ) ;
90
+
91
+ foreach ( string use in DefaultUsing )
92
+ AddUsing ( use ) ;
93
+
94
+ if ( log )
95
+ ExplorerCore . Log ( $ "C# Console reset. Using directives:\r \n { Evaluator . GetUsing ( ) } ") ;
92
96
}
93
97
94
98
public override void Update ( )
95
99
{
96
100
UpdateConsole ( ) ;
97
101
98
102
AutoCompleter . Update ( ) ;
99
-
100
103
#if CPP
101
104
Il2CppCoroutine . Process ( ) ;
102
105
#endif
@@ -572,11 +575,40 @@ void SuggestToggleCallback(bool val)
572
575
highlightTextInput . supportRichText = true ;
573
576
highlightTextInput . fontSize = fontSize ;
574
577
575
- #endregion
578
+ #endregion
579
+
580
+ #region COMPILE BUTTON BAR
581
+
582
+ var horozGroupObj = UIFactory . CreateHorizontalGroup ( Content , new Color ( 1 , 1 , 1 , 0 ) ) ;
583
+ var horozGroup = horozGroupObj . GetComponent < HorizontalLayoutGroup > ( ) ;
584
+ horozGroup . padding . left = 2 ;
585
+ horozGroup . padding . top = 2 ;
586
+ horozGroup . padding . right = 2 ;
587
+ horozGroup . padding . bottom = 2 ;
588
+
589
+ var resetBtnObj = UIFactory . CreateButton ( horozGroupObj ) ;
590
+ var resetBtnLayout = resetBtnObj . AddComponent < LayoutElement > ( ) ;
591
+ resetBtnLayout . preferredWidth = 80 ;
592
+ resetBtnLayout . flexibleWidth = 0 ;
593
+ resetBtnLayout . minHeight = 45 ;
594
+ resetBtnLayout . flexibleHeight = 0 ;
595
+ var resetButton = resetBtnObj . GetComponent < Button > ( ) ;
596
+ var resetBtnColors = resetButton . colors ;
597
+ resetBtnColors . normalColor = "666666" . ToColor ( ) ;
598
+ resetButton . colors = resetBtnColors ;
599
+ var resetBtnText = resetBtnObj . GetComponentInChildren < Text > ( ) ;
600
+ resetBtnText . text = "Reset" ;
601
+ resetBtnText . fontSize = 18 ;
602
+ resetBtnText . color = Color . white ;
576
603
577
- #region COMPILE BUTTON
604
+ // Set compile button callback now that we have the Input Field reference
605
+ resetButton . onClick . AddListener ( ResetCallback ) ;
606
+ void ResetCallback ( )
607
+ {
608
+ ResetConsole ( ) ;
609
+ }
578
610
579
- var compileBtnObj = UIFactory . CreateButton ( Content ) ;
611
+ var compileBtnObj = UIFactory . CreateButton ( horozGroupObj ) ;
580
612
var compileBtnLayout = compileBtnObj . AddComponent < LayoutElement > ( ) ;
581
613
compileBtnLayout . preferredWidth = 80 ;
582
614
compileBtnLayout . flexibleWidth = 0 ;
@@ -601,7 +633,7 @@ void CompileCallback()
601
633
}
602
634
}
603
635
604
- #endregion
636
+ #endregion
605
637
606
638
//mainTextInput.supportRichText = false;
607
639
0 commit comments