Tanoda
CacheEntryBase.cs
Go to the documentation of this file.
1
using
System;
2
using
RuntimeUnityEditor
.
Core
.
Utils
;
3
4
namespace
RuntimeUnityEditor.Core.Inspector.Entries
5
{
6
public
abstract
class
CacheEntryBase
:
ICacheEntry
7
{
8
// todo add gui option
9
public
static
bool
CachingEnabled
10
{
11
get
12
{
13
return
s_cachingEnabled;
14
}
15
set
16
{
17
s_cachingEnabled = value;
18
}
19
}
20
protected
CacheEntryBase
(
string
name)
21
{
22
_name = name;
23
}
24
25
public
virtual
object
EnterValue
()
26
{
27
if
(!
CachingEnabled
)
return
GetValue
();
28
29
return
_valueCache = (
GetValueToCache
() ??
GetValue
());
30
}
31
32
public
abstract
object
GetValueToCache
();
33
private
object
_valueCache;
34
public
virtual
object
GetValue
()
35
{
36
if
(!
CachingEnabled
)
return
GetValueToCache
();
37
38
return
_valueCache ?? (_valueCache =
GetValueToCache
());
39
}
40
41
public
void
SetValue
(
object
newValue)
42
{
43
if
(
OnSetValue
(newValue))
44
_valueCache = newValue;
45
}
46
47
protected
abstract
bool
OnSetValue
(
object
newValue);
48
49
public
abstract
Type
Type
();
50
public
abstract
bool
CanSetValue
();
51
52
private
readonly
string
_name;
53
private
string
_typeName;
54
55
public
string
Name
()
56
{
57
return
_name;
58
}
59
60
public
string
TypeName
()
61
{
62
if
(_typeName ==
null
)
63
{
64
var type =
Type
();
65
if
(type !=
null
)
66
_typeName = type.GetSourceCodeRepresentation();
67
else
68
_typeName =
"INVALID"
;
69
}
70
return
_typeName;
71
}
72
73
private
bool
? _canEnter;
74
private
static
bool
s_cachingEnabled =
false
;
75
76
public
virtual
bool
CanEnterValue
()
77
{
78
if
(_canEnter ==
null
)
79
{
80
var type =
Type
();
81
_canEnter = type !=
null
&& !type.IsPrimitive;
82
}
83
return
_canEnter.Value;
84
}
85
}
86
}
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase
Definition:
CacheEntryBase.cs:7
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.GetValueToCache
abstract object GetValueToCache()
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.SetValue
void SetValue(object newValue)
Definition:
CacheEntryBase.cs:41
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.CanSetValue
abstract bool CanSetValue()
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.Type
abstract Type Type()
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.CanEnterValue
virtual bool CanEnterValue()
Definition:
CacheEntryBase.cs:76
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.Name
string Name()
Definition:
CacheEntryBase.cs:55
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.CachingEnabled
static bool CachingEnabled
Definition:
CacheEntryBase.cs:10
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.EnterValue
virtual object EnterValue()
Get object that is entered when variable name is clicked in inspector
Definition:
CacheEntryBase.cs:25
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.OnSetValue
abstract bool OnSetValue(object newValue)
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.TypeName
string TypeName()
Definition:
CacheEntryBase.cs:60
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.CacheEntryBase
CacheEntryBase(string name)
Definition:
CacheEntryBase.cs:20
RuntimeUnityEditor.Core.Inspector.Entries.CacheEntryBase.GetValue
virtual object GetValue()
Definition:
CacheEntryBase.cs:34
RuntimeUnityEditor.Core.Inspector.Entries.ICacheEntry
Definition:
ICacheEntry.cs:6
RuntimeUnityEditor.Core.Inspector.Entries
Definition:
CacheEntryBase.cs:5
RuntimeUnityEditor.Core.Utils
Definition:
AssetBundleManagerHelper.cs:8
RuntimeUnityEditor.Core
Definition:
GameObjectSearcher.cs:9
RuntimeUnityEditor
Definition:
GameObjectSearcher.cs:9
Source
Assets
Scripts
BepinRUE
Inspector
Entries
Contents
CacheEntryBase.cs
Generated by
1.9.3