@@ -57,7 +57,6 @@ public abstract class CacheObjectBase
57
57
public abstract bool ShouldAutoEvaluate { get ; }
58
58
public abstract bool HasArguments { get ; }
59
59
public abstract bool CanWrite { get ; }
60
- public bool HadException { get ; protected set ; }
61
60
public Exception LastException { get ; protected set ; }
62
61
63
62
public virtual void SetFallbackType ( Type fallbackType )
@@ -106,8 +105,8 @@ public void SetUserValue(object value)
106
105
if ( CellView != null )
107
106
SetDataToCell ( CellView ) ;
108
107
109
- // If the owner's parent CacheObject is set, we are setting the value of an inspected struct.
110
- // Set the inspector target as the value back to that parent cacheobject .
108
+ // If the owner's ParentCacheObject is set, we are setting the value of an inspected struct.
109
+ // Set the inspector target as the value back to that parent.
111
110
if ( Owner . ParentCacheObject != null )
112
111
Owner . ParentCacheObject . SetUserValue ( Owner . Target ) ;
113
112
}
@@ -137,7 +136,7 @@ protected virtual void ProcessOnEvaluate()
137
136
{
138
137
var prevState = State ;
139
138
140
- if ( HadException )
139
+ if ( LastException != null )
141
140
{
142
141
LastValueWasNull = true ;
143
142
LastValueType = FallbackType ;
@@ -158,7 +157,7 @@ protected virtual void ProcessOnEvaluate()
158
157
{
159
158
// If we changed states (always needs IValue change)
160
159
// or if the value is null, and the fallback type isnt string (we always want to edit strings).
161
- if ( State != prevState || ( State != ValueState . String && Value . IsNullOrDestroyed ( ) ) )
160
+ if ( State != prevState || ( State != ValueState . String && State != ValueState . Exception && Value . IsNullOrDestroyed ( ) ) )
162
161
{
163
162
// need to return IValue
164
163
ReleaseIValue ( ) ;
@@ -206,7 +205,7 @@ protected string GetValueLabel()
206
205
return $ "<i>{ NOT_YET_EVAL } ({ SignatureHighlighter . Parse ( FallbackType , true ) } )</i>";
207
206
208
207
case ValueState . Exception :
209
- return $ "<i><color=red >{ LastException . ReflectionExToString ( ) } </color></i>";
208
+ return $ "<i><color=#eb4034 >{ LastException . ReflectionExToString ( ) } </color></i>";
210
209
211
210
// bool and number dont want the label for the value at all
212
211
case ValueState . Boolean :
@@ -291,36 +290,36 @@ public virtual void SetDataToCell(CacheObjectCell cell)
291
290
switch ( State )
292
291
{
293
292
case ValueState . Exception :
294
- SetValueState ( cell , ValueStateArgs . Default ) ;
293
+ SetValueState ( cell , new ( true , subContentButtonActive : true ) ) ;
295
294
break ;
296
295
case ValueState . Boolean :
297
- SetValueState ( cell , new ValueStateArgs ( false , toggleActive : true , applyActive : CanWrite ) ) ;
296
+ SetValueState ( cell , new ( false , toggleActive : true , applyActive : CanWrite ) ) ;
298
297
break ;
299
298
case ValueState . Number :
300
- SetValueState ( cell , new ValueStateArgs ( false , typeLabelActive : true , inputActive : true , applyActive : CanWrite ) ) ;
299
+ SetValueState ( cell , new ( false , typeLabelActive : true , inputActive : true , applyActive : CanWrite ) ) ;
301
300
break ;
302
301
case ValueState . String :
303
302
if ( LastValueWasNull )
304
- SetValueState ( cell , new ValueStateArgs ( true , subContentButtonActive : true ) ) ;
303
+ SetValueState ( cell , new ( true , subContentButtonActive : true ) ) ;
305
304
else
306
- SetValueState ( cell , new ValueStateArgs ( true , false , SignatureHighlighter . StringOrange , subContentButtonActive : true ) ) ;
305
+ SetValueState ( cell , new ( true , false , SignatureHighlighter . StringOrange , subContentButtonActive : true ) ) ;
307
306
break ;
308
307
case ValueState . Enum :
309
- SetValueState ( cell , new ValueStateArgs ( true , subContentButtonActive : CanWrite ) ) ;
308
+ SetValueState ( cell , new ( true , subContentButtonActive : CanWrite ) ) ;
310
309
break ;
311
310
case ValueState . Color :
312
311
case ValueState . ValueStruct :
313
312
if ( ParseUtility . CanParse ( LastValueType ) )
314
- SetValueState ( cell , new ValueStateArgs ( false , false , null , true , false , true , CanWrite , true , true ) ) ;
313
+ SetValueState ( cell , new ( false , false , null , true , false , true , CanWrite , true , true ) ) ;
315
314
else
316
- SetValueState ( cell , new ValueStateArgs ( true , inspectActive : true , subContentButtonActive : true ) ) ;
315
+ SetValueState ( cell , new ( true , inspectActive : true , subContentButtonActive : true ) ) ;
317
316
break ;
318
317
case ValueState . Collection :
319
318
case ValueState . Dictionary :
320
- SetValueState ( cell , new ValueStateArgs ( true , inspectActive : ! LastValueWasNull , subContentButtonActive : ! LastValueWasNull ) ) ;
319
+ SetValueState ( cell , new ( true , inspectActive : ! LastValueWasNull , subContentButtonActive : ! LastValueWasNull ) ) ;
321
320
break ;
322
321
case ValueState . Unsupported :
323
- SetValueState ( cell , new ValueStateArgs ( true , inspectActive : ! LastValueWasNull ) ) ;
322
+ SetValueState ( cell , new ( true , inspectActive : ! LastValueWasNull ) ) ;
324
323
break ;
325
324
}
326
325
@@ -368,8 +367,10 @@ protected virtual void SetValueState(CacheObjectCell cell, ValueStateArgs args)
368
367
if ( cell . InspectButton != null )
369
368
cell . InspectButton . Component . gameObject . SetActive ( args . inspectActive && ! LastValueWasNull ) ;
370
369
371
- // allow IValue for null strings though
372
- cell . SubContentButton . Component . gameObject . SetActive ( args . subContentButtonActive && ( ! LastValueWasNull || State == ValueState . String ) ) ;
370
+ // set subcontent button if needed, and for null strings and exceptions
371
+ cell . SubContentButton . Component . gameObject . SetActive (
372
+ args . subContentButtonActive
373
+ && ( ! LastValueWasNull || State == ValueState . String || State == ValueState . Exception ) ) ;
373
374
}
374
375
375
376
// CacheObjectCell Apply
@@ -401,7 +402,7 @@ public virtual void OnCellSubContentToggle()
401
402
{
402
403
if ( this . IValue == null )
403
404
{
404
- var ivalueType = InteractiveValue . GetIValueTypeForState ( State ) ;
405
+ Type ivalueType = InteractiveValue . GetIValueTypeForState ( State ) ;
405
406
406
407
if ( ivalueType == null )
407
408
return ;
@@ -455,6 +456,7 @@ internal static GameObject InactiveIValueHolder
455
456
{
456
457
inactiveIValueHolder = new GameObject ( "Temp_IValue_Holder" ) ;
457
458
GameObject . DontDestroyOnLoad ( inactiveIValueHolder ) ;
459
+ inactiveIValueHolder . hideFlags = HideFlags . HideAndDontSave ;
458
460
inactiveIValueHolder . transform . parent = UniversalUI . PoolHolder . transform ;
459
461
inactiveIValueHolder . SetActive ( false ) ;
460
462
}
@@ -467,9 +469,20 @@ internal static GameObject InactiveIValueHolder
467
469
468
470
public struct ValueStateArgs
469
471
{
470
- public ValueStateArgs ( bool valueActive = true , bool valueRichText = true , Color ? valueColor = null ,
471
- bool typeLabelActive = false , bool toggleActive = false , bool inputActive = false , bool applyActive = false ,
472
- bool inspectActive = false , bool subContentButtonActive = false )
472
+ public static ValueStateArgs Default { get ; } = new ( true ) ;
473
+
474
+ public Color valueColor ;
475
+ public bool valueActive , valueRichText , typeLabelActive , toggleActive , inputActive , applyActive , inspectActive , subContentButtonActive ;
476
+
477
+ public ValueStateArgs ( bool valueActive = true ,
478
+ bool valueRichText = true ,
479
+ Color ? valueColor = null ,
480
+ bool typeLabelActive = false ,
481
+ bool toggleActive = false ,
482
+ bool inputActive = false ,
483
+ bool applyActive = false ,
484
+ bool inspectActive = false ,
485
+ bool subContentButtonActive = false )
473
486
{
474
487
this . valueActive = valueActive ;
475
488
this . valueRichText = valueRichText ;
@@ -481,14 +494,6 @@ public ValueStateArgs(bool valueActive = true, bool valueRichText = true, Color?
481
494
this . inspectActive = inspectActive ;
482
495
this . subContentButtonActive = subContentButtonActive ;
483
496
}
484
-
485
- public static ValueStateArgs Default => _default ;
486
- private static ValueStateArgs _default = new ValueStateArgs ( true ) ;
487
-
488
- public bool valueActive , valueRichText , typeLabelActive , toggleActive ,
489
- inputActive , applyActive , inspectActive , subContentButtonActive ;
490
-
491
- public Color valueColor ;
492
497
}
493
498
}
494
499
}
0 commit comments