Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_UIInfo.c
Go to the documentation of this file.
1
6
[
BaseContainerProps
(),
SCR_BaseContainerLocalizedTitleField
(
"Name"
)]
7
class
SCR_UIInfo
:
SCR_UIDescription
8
{
9
[
Attribute
(
params
:
"edds imageset"
, uiwidget:
UIWidgets
.ResourcePickerThumbnail)]
10
protected
ResourceName
Icon
;
11
12
[
Attribute
(
desc
:
"When 'Icon' is an image set, this defines name of the image in the set."
)]
13
protected
string
IconSetName
;
14
15
//------------------------------------------------------------------------------------------------
20
ResourceName
GetIconPath
()
21
{
22
string
ext;
23
FilePath
.StripExtension(
Icon
, ext);
24
if
(ext ==
"imageset"
)
25
{
26
Print
(
string
.Format(
"Unable to return texture path, it's an image set '%1'! Use SCR_UIInfo.SetIconTo() instead."
,
Icon
),
LogLevel
.WARNING);
27
return
ResourceName
.Empty;
28
}
29
else
30
{
31
return
Icon
;
32
}
33
}
34
35
36
//------------------------------------------------------------------------------------------------
37
ResourceName
GetIcon
()
38
{
39
return
Icon
;
40
}
41
42
//------------------------------------------------------------------------------------------------
47
ResourceName
GetImageSetPath
()
48
{
49
string
ext;
50
FilePath
.StripExtension(
Icon
, ext);
51
if
(ext ==
"imageset"
)
52
{
53
return
Icon
;
54
}
55
else
56
{
57
Print
(
string
.Format(
"Unable to return ImageSet path, it's a Texture '%1'! Use SCR_UIInfo.SetIconTo() instead."
,
Icon
),
LogLevel
.WARNING);
58
return
ResourceName
.Empty;
59
}
60
}
61
62
//------------------------------------------------------------------------------------------------
65
string
GetIconSetName
()
66
{
67
string
ext;
68
FilePath
.StripExtension(
Icon
, ext);
69
70
if
(ext ==
"imageset"
)
71
return
IconSetName
;
72
else
73
return
""
;
74
}
75
76
//------------------------------------------------------------------------------------------------
79
bool
HasIcon
()
80
{
81
if
(
Icon
.IsEmpty())
82
return
false
;
83
84
//Check if image set name is assigned
85
string
ext;
86
FilePath
.StripExtension(
Icon
, ext);
87
if
(ext ==
"imageset"
)
88
return
!
GetIconSetName
().IsEmpty();
89
90
return
true
;
91
}
92
93
//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
94
// This class is meant to hold data, not manipulate widgets! Such methods should be in SCR_WidgetTools or SCR_WidgetHelper
95
96
//------------------------------------------------------------------------------------------------
102
bool
SetIconTo
(
ImageWidget
imageWidget)
103
{
104
if
(!imageWidget ||
Icon
.IsEmpty())
105
return
false
;
106
107
string
ext;
108
FilePath
.StripExtension(
Icon
, ext);
109
if
(ext ==
"imageset"
)
110
imageWidget.LoadImageFromSet(0,
Icon
,
GetIconSetName
());
111
else
112
imageWidget.LoadImageTexture(0,
GetIconPath
());
113
114
return
true
;
115
}
116
117
//---- REFACTOR NOTE END ----
118
119
//------------------------------------------------------------------------------------------------
123
override
void
Log
(
string
prefix =
string
.Empty,
LogLevel
logLevel =
LogLevel
.VERBOSE)
124
{
125
Print
(
string
.Format(prefix +
"%1: \"%2\", \"%3\", \"%4\""
,
Type
(),
Name
,
Description
,
Icon
), logLevel);
126
}
127
128
//------------------------------------------------------------------------------------------------
133
static
SCR_UIInfo
GetInfo
(
BaseContainer
source,
string
varName)
134
{
135
BaseContainer
infoSource = source.GetObject(varName);
136
if
(infoSource)
137
return
SCR_UIInfo
.Cast(
BaseContainerTools
.CreateInstanceFromContainer(infoSource));
138
else
139
return
null;
140
}
141
142
//------------------------------------------------------------------------------------------------
146
static
SCR_UIInfo
CreateInfo
(
UIInfo
source)
147
{
148
if
(!source)
149
return
null;
150
151
SCR_UIInfo
info =
new
SCR_UIInfo
();
152
info.Name = source.GetName();
153
info.Description = source.GetDescription();
154
info.
Icon
= source.GetIconPath();
155
return
info;
156
}
157
158
//------------------------------------------------------------------------------------------------
165
static
SCR_UIInfo
CreateInfo
(
LocalizedString
name,
LocalizedString
description =
LocalizedString
.Empty,
ResourceName
icon =
ResourceName
.Empty,
string
iconSetName =
string
.Empty)
166
{
167
SCR_UIInfo
info =
new
SCR_UIInfo
();
168
info.Name = name;
169
info.Description = description;
170
info.
Icon
= icon;
171
info.
IconSetName
= iconSetName;
172
return
info;
173
}
174
175
//------------------------------------------------------------------------------------------------
179
static
SCR_UIInfo
CreatePlaceholderInfo
(
typename
type
)
180
{
181
SCR_UIInfo
info =
SCR_UIInfo
.Cast(
type
.Spawn());
182
info.Name =
string
.Format(
"ERROR: Missing info for %1"
,
type
);
183
return
info;
184
}
185
186
//------------------------------------------------------------------------------------------------
187
//--- Protected, to be overridden and/or made public by inherited classes
188
protected
override
void
CopyFrom
(
SCR_UIName
source)
189
{
190
SCR_UIInfo
sourceInfo =
SCR_UIInfo
.Cast(source);
191
if
(sourceInfo)
192
{
193
Icon
= sourceInfo.
Icon
;
194
IconSetName
= sourceInfo.
IconSetName
;
195
}
196
197
super.
CopyFrom
(source);
198
}
199
}
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
type
EDamageType type
Definition
SCR_DestructibleTreeV2.c:32
SCR_BaseContainerLocalizedTitleField
SCR_PlayerCommandingConfigActionPair Managed SCR_BaseContainerLocalizedTitleField("m_sCommandName")
Definition
SCR_PlayerCommandsConfig.c:58
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
Type
int Type
Definition
ScriptCamera.c:17
BaseContainer
Definition
BaseContainer.c:13
BaseContainerTools
Definition
BaseContainerTools.c:13
FilePath
Definition
FilePath.c:13
ImageWidget
Definition
ImageWidget.c:13
LocalizedString
Definition
LocalizedString.c:22
ResourceName
Definition
ResourceName.c:13
SCR_UIDescription
Definition
SCR_UIDescription.c:6
SCR_UIDescription::Description
LocalizedString Description
Definition
SCR_UIDescription.c:8
SCR_UIInfo
Definition
SCR_UIInfo.c:8
SCR_UIInfo::GetIcon
ResourceName GetIcon()
Definition
SCR_UIInfo.c:37
SCR_UIInfo::IconSetName
string IconSetName
Definition
SCR_UIInfo.c:13
SCR_UIInfo::GetIconSetName
string GetIconSetName()
Definition
SCR_UIInfo.c:65
SCR_UIInfo::CreatePlaceholderInfo
static SCR_UIInfo CreatePlaceholderInfo(typename type)
Definition
SCR_UIInfo.c:179
SCR_UIInfo::HasIcon
bool HasIcon()
Definition
SCR_UIInfo.c:79
SCR_UIInfo::CreateInfo
static SCR_UIInfo CreateInfo(UIInfo source)
Definition
SCR_UIInfo.c:146
SCR_UIInfo::SetIconTo
bool SetIconTo(ImageWidget imageWidget)
Definition
SCR_UIInfo.c:102
SCR_UIInfo::Log
override void Log(string prefix=string.Empty, LogLevel logLevel=LogLevel.VERBOSE)
Definition
SCR_UIInfo.c:123
SCR_UIInfo::GetIconPath
ResourceName GetIconPath()
Definition
SCR_UIInfo.c:20
SCR_UIInfo::Icon
ResourceName Icon
Definition
SCR_UIInfo.c:10
SCR_UIInfo::CopyFrom
override void CopyFrom(SCR_UIName source)
Definition
SCR_UIInfo.c:188
SCR_UIInfo::GetInfo
static SCR_UIInfo GetInfo(BaseContainer source, string varName)
Definition
SCR_UIInfo.c:133
SCR_UIInfo::GetImageSetPath
ResourceName GetImageSetPath()
Definition
SCR_UIInfo.c:47
SCR_UIInfo::CreateInfo
static SCR_UIInfo CreateInfo(LocalizedString name, LocalizedString description=LocalizedString.Empty, ResourceName icon=ResourceName.Empty, string iconSetName=string.Empty)
Definition
SCR_UIInfo.c:165
SCR_UIName
Definition
SCR_UIName.c:6
SCR_UIName::Name
LocalizedString Name
Definition
SCR_UIName.c:8
UIInfo
UIInfo - allows to define UI elements.
Definition
UIInfo.c:14
UIWidgets
Definition
attributes.c:40
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Editor
Containers
UIInfo
SCR_UIInfo.c
Generated by
1.17.0