Client LuaCsForBarotrauma
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs
1
using
System.Collections.Generic;
2
using
System.Linq;
3
4
namespace
Barotrauma
5
{
6
partial class
ConditionalSprite
7
{
8
public
readonly List<PropertyConditional>
conditionals
=
new
List<PropertyConditional>();
9
public
bool
IsActive
{
get
;
private
set
; } =
true
;
10
11
public
readonly
PropertyConditional
.
LogicalOperatorType
LogicalOperator
;
12
public
readonly
bool
Exclusive
;
13
public
ISerializableEntity
Target
{
get
;
private
set
; }
14
public
Sprite
Sprite
{
get
;
private
set
; }
15
public
DeformableSprite
DeformableSprite
{
get
;
private
set
; }
16
public
Sprite
ActiveSprite
=>
Sprite
??
DeformableSprite
.
Sprite
;
17
18
public
ConditionalSprite
(
ContentXElement
element,
ISerializableEntity
target,
string
file =
""
,
bool
lazyLoad =
false
,
float
sourceRectScale = 1)
19
{
20
Target
= target;
21
Exclusive
= element.
GetAttributeBool
(
"exclusive"
,
Exclusive
);
22
LogicalOperator
= element.GetAttributeEnum(
"comparison"
,
LogicalOperator
);
23
foreach
(var subElement
in
element.Elements())
24
{
25
switch
(subElement.Name.ToString().ToLowerInvariant())
26
{
27
case
"conditional"
:
28
conditionals
.AddRange(
PropertyConditional
.
FromXElement
(subElement));
29
break
;
30
case
"sprite"
:
31
Sprite
=
new
Sprite
(subElement, file: file, lazyLoad: lazyLoad, sourceRectScale: sourceRectScale);
32
break
;
33
case
"deformablesprite"
:
34
DeformableSprite
=
new
DeformableSprite
(subElement, filePath: file, lazyLoad: lazyLoad, sourceRectScale: sourceRectScale);
35
break
;
36
}
37
}
38
}
39
40
public
void
CheckConditionals
()
41
{
42
if
(
Target
==
null
)
43
{
44
IsActive
=
false
;
45
}
46
else
47
{
48
IsActive
=
LogicalOperator
==
PropertyConditional
.
LogicalOperatorType
.And ?
conditionals
.All(c => c.Matches(
Target
)) :
conditionals
.Any(c => c.Matches(
Target
));
49
}
50
}
51
}
52
}
Barotrauma.ConditionalSprite
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:7
Barotrauma.ConditionalSprite.Exclusive
readonly bool Exclusive
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:12
Barotrauma.ConditionalSprite.ActiveSprite
Sprite ActiveSprite
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:16
Barotrauma.ConditionalSprite.conditionals
readonly List< PropertyConditional > conditionals
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:8
Barotrauma.ConditionalSprite.Sprite
Sprite Sprite
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:14
Barotrauma.ConditionalSprite.LogicalOperator
readonly PropertyConditional.LogicalOperatorType LogicalOperator
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:11
Barotrauma.ConditionalSprite.CheckConditionals
void CheckConditionals()
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:40
Barotrauma.ConditionalSprite.IsActive
bool IsActive
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:9
Barotrauma.ConditionalSprite.ConditionalSprite
ConditionalSprite(ContentXElement element, ISerializableEntity target, string file="", bool lazyLoad=false, float sourceRectScale=1)
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:18
Barotrauma.ConditionalSprite.Target
ISerializableEntity Target
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:13
Barotrauma.ConditionalSprite.DeformableSprite
DeformableSprite DeformableSprite
Definition:
BarotraumaShared/SharedSource/Sprite/ConditionalSprite.cs:15
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeBool
bool GetAttributeBool(string key, bool def)
Barotrauma.DeformableSprite
Definition:
BarotraumaShared/SharedSource/Sprite/DeformableSprite.cs:7
Barotrauma.DeformableSprite.Sprite
Sprite Sprite
Definition:
BarotraumaShared/SharedSource/Sprite/DeformableSprite.cs:19
Barotrauma.PropertyConditional
Conditionals are used by some in-game mechanics to require one or more conditions to be met for those...
Definition:
PropertyConditional.cs:19
Barotrauma.PropertyConditional.FromXElement
static IEnumerable< PropertyConditional > FromXElement(ContentXElement element, Predicate< XAttribute >? predicate=null)
Definition:
PropertyConditional.cs:206
Barotrauma.PropertyConditional.LogicalOperatorType
LogicalOperatorType
Definition:
PropertyConditional.cs:111
Barotrauma.Sprite
Definition:
BarotraumaShared/SharedSource/Sprite/Sprite.cs:14
Barotrauma.ISerializableEntity
Definition:
ISerializableEntity.cs:6
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma
BarotraumaShared
SharedSource
Sprite
ConditionalSprite.cs
Generated by
1.9.1