Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
StackPanelWidget.cs
浏览该文件的文档.
1
using
Engine
;
2
3
namespace
Game
{
4
public
class
StackPanelWidget
:
ContainerWidget
{
5
public
float
m_fixedSize
;
6
7
public
int
m_fillCount
;
8
9
public
LayoutDirection
Direction
{
get
;
set
; }
10
11
public
bool
IsInverted
{
get
;
set
; }
12
13
public
override
void
MeasureOverride
(
Vector2
parentAvailableSize) {
14
m_fixedSize
= 0f;
15
m_fillCount
= 0;
16
float
num = 0f;
17
foreach
(
Widget
child
in
Children
) {
18
if
(child.
IsVisible
) {
19
child.
Measure
(
Vector2
.
Max
(parentAvailableSize - child.
MarginHorizontalSumAndVerticalSum
,
Vector2
.
Zero
));
20
if
(
Direction
==
LayoutDirection
.Horizontal) {
21
if
(child.
ParentDesiredSize
.
X
!=
float
.PositiveInfinity) {
22
m_fixedSize
+= child.ParentDesiredSize.X + child.
MarginHorizontalSum
;
23
parentAvailableSize.X =
MathUtils
.
Max
(parentAvailableSize.X - (child.
ParentDesiredSize
.
X
+ child.
MarginHorizontalSum
), 0f);
24
}
25
else
{
26
m_fillCount
++;
27
}
28
num =
MathUtils
.
Max
(num, child.
ParentDesiredSize
.
Y
+ child.
MarginVerticalSum
);
29
}
30
else
{
31
if
(child.
ParentDesiredSize
.
Y
!=
float
.PositiveInfinity) {
32
m_fixedSize
+= child.ParentDesiredSize.Y + child.
MarginVerticalSum
;
33
parentAvailableSize.Y =
MathUtils
.
Max
(parentAvailableSize.Y - (child.
ParentDesiredSize
.
Y
+ child.
MarginVerticalSum
), 0f);
34
}
35
else
{
36
m_fillCount
++;
37
}
38
num =
MathUtils
.
Max
(num, child.
ParentDesiredSize
.
X
+ child.
MarginHorizontalSum
);
39
}
40
}
41
}
42
if
(
Direction
==
LayoutDirection
.Horizontal) {
43
DesiredSize
=
m_fillCount
== 0 ?
new
Vector2
(
m_fixedSize
, num) :
new
Vector2
(
float
.PositiveInfinity, num);
44
}
45
else
{
46
DesiredSize
=
m_fillCount
== 0 ?
new
Vector2
(num,
m_fixedSize
) :
new
Vector2
(num,
float
.PositiveInfinity);
47
}
48
}
49
50
public
override
void
ArrangeOverride
() {
51
float
num = 0f;
52
foreach
(
Widget
child
in
Children
) {
53
if
(child.
IsVisible
) {
54
if
(
Direction
==
LayoutDirection
.Horizontal) {
55
float
num2 = child.ParentDesiredSize.X == float.PositiveInfinity
56
?
m_fillCount
> 0 ?
MathUtils
.
Max
(
ActualSize
.X -
m_fixedSize
, 0f) /
m_fillCount
: 0f
57
: child.ParentDesiredSize.X + child.
MarginHorizontalSum
;
58
Vector2
c;
59
Vector2
c2;
60
if
(!
IsInverted
) {
61
c =
new
Vector2
(num, 0f);
62
c2 =
new
Vector2
(num + num2,
ActualSize
.Y);
63
}
64
else
{
65
c =
new
Vector2
(
ActualSize
.X - (num + num2), 0f);
66
c2 =
new
Vector2
(
ActualSize
.X - num,
ActualSize
.Y);
67
}
68
ArrangeChildWidgetInCell
(c, c2, child);
69
num += num2;
70
}
71
else
{
72
float
num3 = child.ParentDesiredSize.Y == float.PositiveInfinity
73
?
m_fillCount
> 0 ?
MathUtils
.
Max
(
ActualSize
.Y -
m_fixedSize
, 0f) /
m_fillCount
: 0f
74
: child.ParentDesiredSize.Y + child.
MarginVerticalSum
;
75
Vector2
c3;
76
Vector2
c4;
77
if
(!
IsInverted
) {
78
c3 =
new
Vector2
(0f, num);
79
c4 =
new
Vector2
(
ActualSize
.X, num + num3);
80
}
81
else
{
82
c3 =
new
Vector2
(0f,
ActualSize
.Y - (num + num3));
83
c4 =
new
Vector2
(
ActualSize
.X,
ActualSize
.Y - num);
84
}
85
ArrangeChildWidgetInCell
(c3, c4, child);
86
num += num3;
87
}
88
}
89
}
90
}
91
}
92
}
Engine.MathUtils
定义
MathUtils.cs:2
Engine.MathUtils.Max
static int Max(int x1, int x2)
定义
MathUtils.cs:18
Game.ContainerWidget.ContainerWidget
ContainerWidget()
定义
ContainerWidget.cs:20
Game.ContainerWidget.Children
readonly WidgetsList Children
定义
ContainerWidget.cs:5
Game.ContainerWidget.ArrangeChildWidgetInCell
static void ArrangeChildWidgetInCell(Vector2 c1, Vector2 c2, Widget widget)
定义
ContainerWidget.cs:68
Game.StackPanelWidget
定义
StackPanelWidget.cs:4
Game.StackPanelWidget.Direction
LayoutDirection Direction
定义
StackPanelWidget.cs:9
Game.StackPanelWidget.ArrangeOverride
override void ArrangeOverride()
定义
StackPanelWidget.cs:50
Game.StackPanelWidget.MeasureOverride
override void MeasureOverride(Vector2 parentAvailableSize)
定义
StackPanelWidget.cs:13
Game.StackPanelWidget.IsInverted
bool IsInverted
定义
StackPanelWidget.cs:11
Game.StackPanelWidget.m_fillCount
int m_fillCount
定义
StackPanelWidget.cs:7
Game.StackPanelWidget.m_fixedSize
float m_fixedSize
定义
StackPanelWidget.cs:5
Game.Widget
定义
Widget.cs:10
Game.Widget.MarginVerticalSum
virtual float MarginVerticalSum
定义
Widget.cs:439
Game.Widget.ParentDesiredSize
Vector2 ParentDesiredSize
定义
Widget.cs:454
Game.Widget.IsVisible
virtual bool IsVisible
定义
Widget.cs:356
Game.Widget.MarginHorizontalSum
virtual float MarginHorizontalSum
定义
Widget.cs:437
Game.Widget.DesiredSize
Vector2 DesiredSize
定义
Widget.cs:449
Game.Widget.MarginHorizontalSumAndVerticalSum
virtual Vector2 MarginHorizontalSumAndVerticalSum
定义
Widget.cs:441
Game.Widget.ActualSize
Vector2 ActualSize
定义
Widget.cs:447
Game.Widget.Measure
virtual void Measure(Vector2 parentAvailableSize)
定义
Widget.cs:628
Engine
定义
BaseSound.cs:10
Game
定义
ContentFileBridge.cs:4
Game.LayoutDirection
LayoutDirection
定义
LayoutDirection.cs:2
Engine.Vector2
定义
Vector2.cs:2
Engine.Vector2.Zero
static readonly Vector2 Zero
定义
Vector2.cs:7
Engine.Vector2.Max
static Vector2 Max(Vector2 v, float f)
定义
Vector2.cs:83
Engine.Vector2.Y
float Y
定义
Vector2.cs:5
Engine.Vector2.X
float X
定义
Vector2.cs:3
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Widget
StackPanelWidget.cs
制作者
1.16.1