Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
CraftingRecipeSlotWidget.cs
浏览该文件的文档.
1
using
System.Xml.Linq;
2
using
Engine
;
3
4
namespace
Game
{
5
public
class
CraftingRecipeSlotWidget
:
CanvasWidget
{
6
public
BlockIconWidget
m_blockIconWidget
;
7
8
public
LabelWidget
m_labelWidget
;
9
10
public
string
m_ingredient
;
11
12
public
int
m_resultValue
;
13
14
public
int
m_resultCount
;
15
16
public
CraftingRecipeSlotWidget
() {
17
XElement node =
ContentManager
.
Get
<XElement>(
"Widgets/CraftingRecipeSlot"
);
18
LoadContents
(
this
, node);
19
m_blockIconWidget
=
Children
.Find<
BlockIconWidget
>(
"CraftingRecipeSlotWidget.Icon"
);
20
m_labelWidget
=
Children
.Find<
LabelWidget
>(
"CraftingRecipeSlotWidget.Count"
);
21
}
22
23
public
void
SetIngredient
(
string
ingredient) {
24
m_ingredient
= ingredient;
25
m_resultValue
= 0;
26
m_resultCount
= 0;
27
}
28
29
public
void
SetResult
(
int
value,
int
count) {
30
m_resultValue
= value;
31
m_resultCount
= count;
32
m_ingredient
=
null
;
33
}
34
35
public
override
void
MeasureOverride
(
Vector2
parentAvailableSize) {
36
m_blockIconWidget.IsVisible =
false
;
37
m_labelWidget.IsVisible =
false
;
38
if
(!
string
.IsNullOrEmpty(
m_ingredient
)) {
39
CraftingRecipesManager
.
DecodeIngredient
(
m_ingredient
, out
string
craftingId, out
int
? data);
40
Block
[] array =
BlocksManager
.
FindBlocksByCraftingId
(craftingId);
41
if
(array.Length != 0) {
42
Block
block = array[(int)(1.0 *
Time
.
RealTime
) % array.Length];
43
if
(block !=
null
) {
44
m_blockIconWidget.Value =
Terrain
.
MakeBlockValue
(block.
BlockIndex
, 0, data ?? 0);
45
m_blockIconWidget.Light = 15;
46
m_blockIconWidget.IsVisible =
true
;
47
}
48
}
49
}
50
else
if
(
m_resultValue
!= 0) {
51
m_blockIconWidget.Value =
m_resultValue
;
52
m_blockIconWidget.Light = 15;
53
m_labelWidget.Text =
m_resultCount
.ToString();
54
m_blockIconWidget.IsVisible =
true
;
55
m_labelWidget.IsVisible =
true
;
56
}
57
base.MeasureOverride(parentAvailableSize);
58
}
59
}
60
}
Engine.Time
定义
Time.cs:4
Engine.Time.RealTime
static double RealTime
定义
Time.cs:38
Game.Block
定义
Block.cs:5
Game.Block.BlockIndex
int BlockIndex
定义
Block.cs:6
Game.BlockIconWidget
定义
BlockIconWidget.cs:5
Game.BlocksManager
定义
BlocksManager.cs:10
Game.BlocksManager.FindBlocksByCraftingId
static Block[] FindBlocksByCraftingId(string craftingId)
定义
BlocksManager.cs:443
Game.CanvasWidget
定义
CanvasWidget.cs:4
Game.ContainerWidget.Children
readonly WidgetsList Children
定义
ContainerWidget.cs:5
Game.ContentManager
定义
ContentManager.cs:50
Game.ContentManager.Get
static object Get(Type type, string name)
定义
ContentManager.cs:70
Game.CraftingRecipeSlotWidget.m_resultCount
int m_resultCount
定义
CraftingRecipeSlotWidget.cs:14
Game.CraftingRecipeSlotWidget.m_labelWidget
LabelWidget m_labelWidget
定义
CraftingRecipeSlotWidget.cs:8
Game.CraftingRecipeSlotWidget.m_ingredient
string m_ingredient
定义
CraftingRecipeSlotWidget.cs:10
Game.CraftingRecipeSlotWidget.SetResult
void SetResult(int value, int count)
定义
CraftingRecipeSlotWidget.cs:29
Game.CraftingRecipeSlotWidget.m_resultValue
int m_resultValue
定义
CraftingRecipeSlotWidget.cs:12
Game.CraftingRecipeSlotWidget.SetIngredient
void SetIngredient(string ingredient)
定义
CraftingRecipeSlotWidget.cs:23
Game.CraftingRecipeSlotWidget.m_blockIconWidget
BlockIconWidget m_blockIconWidget
定义
CraftingRecipeSlotWidget.cs:6
Game.CraftingRecipeSlotWidget.CraftingRecipeSlotWidget
CraftingRecipeSlotWidget()
定义
CraftingRecipeSlotWidget.cs:16
Game.CraftingRecipeSlotWidget.MeasureOverride
override void MeasureOverride(Vector2 parentAvailableSize)
定义
CraftingRecipeSlotWidget.cs:35
Game.CraftingRecipesManager
定义
CraftingRecipesManager.cs:7
Game.CraftingRecipesManager.DecodeIngredient
static void DecodeIngredient(string ingredient, out string craftingId, out int? data)
定义
CraftingRecipesManager.cs:199
Game.LabelWidget
定义
LabelWidget.cs:4
Game.Terrain
定义
Terrain.cs:5
Game.Terrain.MakeBlockValue
static int MakeBlockValue(int contents)
定义
Terrain.cs:298
Game.Widget.LoadContents
virtual void LoadContents(object eventsTarget, XElement node)
定义
Widget.cs:507
Engine
定义
BaseSound.cs:10
Game
定义
ContentFileBridge.cs:4
Engine.Vector2
定义
Vector2.cs:2
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Widget
CraftingRecipeSlotWidget.cs
制作者
1.16.1