Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
EditVoltageLevelDialog.cs
浏览该文件的文档.
1
using
System.Xml.Linq;
2
3
namespace
Game
{
4
public
class
EditVoltageLevelDialog
:
Dialog
{
5
public
Action<int>
m_handler
;
6
7
public
ButtonWidget
m_okButton
;
8
9
public
ButtonWidget
m_cancelButton
;
10
11
public
SliderWidget
m_voltageSlider
;
12
13
public
int
m_voltageLevel
;
14
15
public
EditVoltageLevelDialog
(
int
voltageLevel, Action<int> handler) {
16
XElement node =
ContentManager
.
Get
<XElement>(
"Dialogs/EditVoltageLevelDialog"
);
17
LoadContents
(
this
, node);
18
m_okButton
=
Children
.Find<
ButtonWidget
>(
"EditVoltageLevelDialog.OK"
);
19
m_cancelButton
=
Children
.Find<
ButtonWidget
>(
"EditVoltageLevelDialog.Cancel"
);
20
m_voltageSlider
=
Children
.Find<
SliderWidget
>(
"EditVoltageLevelDialog.VoltageSlider"
);
21
m_handler
= handler;
22
m_voltageLevel
= voltageLevel;
23
UpdateControls
();
24
}
25
26
public
override
void
Update
() {
27
if
(
m_voltageSlider
.IsSliding) {
28
m_voltageLevel
= (int)
m_voltageSlider
.Value;
29
}
30
if
(
m_okButton
.IsClicked) {
31
Dismiss
(
m_voltageLevel
);
32
}
33
if
(Input.Cancel
34
||
m_cancelButton
.IsClicked) {
35
Dismiss
(
null
);
36
}
37
UpdateControls
();
38
}
39
40
public
virtual
void
UpdateControls
() {
41
m_voltageSlider.Text =
42
$
"{1.5f * m_voltageLevel / 15f:0.0}V ({(m_voltageLevel < 8 ? LanguageControl.Get("
EditBatteryDialog
", 1) : LanguageControl.Get("
EditBatteryDialog
", 2))})"
;
43
m_voltageSlider.Value =
m_voltageLevel
;
44
}
45
46
public
void
Dismiss
(
int
? result) {
47
DialogsManager
.
HideDialog
(
this
);
48
if
(
m_handler
!=
null
49
&& result.HasValue) {
50
m_handler
(result.Value);
51
}
52
}
53
}
54
}
Game.ButtonWidget
定义
ButtonWidget.cs:5
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.Dialog.Dialog
Dialog()
定义
Dialog.cs:5
Game.DialogsManager
定义
DialogsManager.cs:4
Game.DialogsManager.HideDialog
static void HideDialog(Dialog dialog)
定义
DialogsManager.cs:58
Game.EditVoltageLevelDialog.m_voltageLevel
int m_voltageLevel
定义
EditVoltageLevelDialog.cs:13
Game.EditVoltageLevelDialog.UpdateControls
virtual void UpdateControls()
定义
EditVoltageLevelDialog.cs:40
Game.EditVoltageLevelDialog.Dismiss
void Dismiss(int? result)
定义
EditVoltageLevelDialog.cs:46
Game.EditVoltageLevelDialog.EditVoltageLevelDialog
EditVoltageLevelDialog(int voltageLevel, Action< int > handler)
定义
EditVoltageLevelDialog.cs:15
Game.EditVoltageLevelDialog.m_okButton
ButtonWidget m_okButton
定义
EditVoltageLevelDialog.cs:7
Game.EditVoltageLevelDialog.m_voltageSlider
SliderWidget m_voltageSlider
定义
EditVoltageLevelDialog.cs:11
Game.EditVoltageLevelDialog.m_handler
Action< int > m_handler
定义
EditVoltageLevelDialog.cs:5
Game.EditVoltageLevelDialog.m_cancelButton
ButtonWidget m_cancelButton
定义
EditVoltageLevelDialog.cs:9
Game.EditVoltageLevelDialog.Update
override void Update()
定义
EditVoltageLevelDialog.cs:26
Game.SliderWidget
定义
SliderWidget.cs:6
Game.Widget.LoadContents
virtual void LoadContents(object eventsTarget, XElement node)
定义
Widget.cs:507
Game
定义
ContentFileBridge.cs:4
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Dialog
EditVoltageLevelDialog.cs
制作者
1.16.1