Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ValueAttributeDynamicDescription.c
Go to the documentation of this file.
1 
6 {
7  [Attribute(desc: "If the current value is x to value given condition than display the description", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EAttributeValueDynamicDescription))]
8  protected EAttributeValueDynamicDescription m_eDisplayIfValue;
9 
10  [Attribute(desc: "The value condition that is changed compaired to the attribute value")]
11  protected float m_fValueCondition;
12 
13  [Attribute("0", desc: "If true it will only show the description if the condition was false before and is now true (meaning if you save the attributes and open it again it will not show the warning), else it will always set the warning if the condition is true wether it was changed or not")]
14  protected bool m_bOnlyShowIfConditionChanged;
15 
16  protected float m_fStartingValue;
17 
18  //------------------------------------------------------------------------------------------------
19  override void InitDynamicDescription(notnull SCR_BaseEditorAttribute attribute, notnull SCR_BaseEditorAttributeUIComponent attributeUi)
20  {
21  super.InitDynamicDescription(attribute);
22 
23  //~ No need to set starting value if always checks if condition true
24  if (!m_bOnlyShowIfConditionChanged)
25  return;
26 
27  SCR_BaseEditorAttributeVar var = attribute.GetVariableOrCopy();
28  if (!var)
29  return;
30 
31  m_fStartingValue = var.GetFloat();
32  }
33 
34  //------------------------------------------------------------------------------------------------
35  override bool IsValid(notnull SCR_BaseEditorAttribute attribute, notnull SCR_BaseEditorAttributeUIComponent attributeUi)
36  {
37  if (!super.IsValid(attribute, attributeUi))
38  return false;
39 
40  SCR_BaseEditorAttributeVar var = attribute.GetVariableOrCopy();
41  if (!var)
42  return false;
43 
44  float value = var.GetFloat();
45 
46  switch (m_eDisplayIfValue)
47  {
48  case EAttributeValueDynamicDescription.LESS_THAN :
49  {
50  if (!m_bOnlyShowIfConditionChanged)
51  return value < m_fValueCondition;
52 
53  return m_fStartingValue >= m_fValueCondition && value < m_fValueCondition;
54  }
55  case EAttributeValueDynamicDescription.LESS_OR_EQUAL_THAN :
56  {
57  if (!m_bOnlyShowIfConditionChanged)
58  return value <= m_fValueCondition;
59 
60  return m_fStartingValue > m_fValueCondition && value <= m_fValueCondition;
61  }
62  case EAttributeValueDynamicDescription.EQUAL_TO :
63  {
64  if (!m_bOnlyShowIfConditionChanged)
65  return value == m_fValueCondition;
66 
67  return value != m_fStartingValue && value == m_fValueCondition;
68  }
69  case EAttributeValueDynamicDescription.GREATER_THAN :
70  {
71  if (!m_bOnlyShowIfConditionChanged)
72  return value > m_fValueCondition;
73 
74  return m_fStartingValue <= m_fValueCondition && value > m_fValueCondition;
75  }
76  case EAttributeValueDynamicDescription.GREATER_OR_EQUAL_THAN :
77  {
78  if (!m_bOnlyShowIfConditionChanged)
79  return value >= m_fValueCondition;
80 
81  return m_fStartingValue < m_fValueCondition && value >= m_fValueCondition;
82  }
83  case EAttributeValueDynamicDescription.NOT_EQUAL_TO :
84  {
85  if (!m_bOnlyShowIfConditionChanged)
86  return value != m_fValueCondition;
87 
88  return value != m_fStartingValue && value != m_fValueCondition;
89  }
90  }
91 
92  return false;
93  }
94 };
95 
97 {
98  LESS_THAN = 0,
100  EQUAL_TO = 2,
104 };
SCR_BaseAttributeDynamicDescription
Definition: SCR_BaseAttributeDynamicDescription.c:5
SCR_BaseContainerCustomTitleEnum
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
Definition: SCR_CampaignHintStorage.c:22
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_ValueAttributeDynamicDescription
Definition: SCR_ValueAttributeDynamicDescription.c:5
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
NOT_EQUAL_TO
@ NOT_EQUAL_TO
Definition: SCR_ValueAttributeDynamicDescription.c:103
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_BaseEditorAttribute
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Definition: SCR_BaseEditorAttribute.c:3
EAttributeValueDynamicDescription
EAttributeValueDynamicDescription
Definition: SCR_ValueAttributeDynamicDescription.c:96
SCR_BaseEditorAttributeUIComponent
Definition: SCR_BaseEditorAttributeUIComponent.c:3
LESS_OR_EQUAL_THAN
@ LESS_OR_EQUAL_THAN
Definition: SCR_ValueAttributeDynamicDescription.c:99
EQUAL_TO
@ EQUAL_TO
Definition: SCR_ValueAttributeDynamicDescription.c:100
GREATER_OR_EQUAL_THAN
@ GREATER_OR_EQUAL_THAN
Definition: SCR_ValueAttributeDynamicDescription.c:102
LESS_THAN
@ LESS_THAN
Definition: SCR_ValueAttributeDynamicDescription.c:98
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468
GREATER_THAN
@ GREATER_THAN
Definition: SCR_ValueAttributeDynamicDescription.c:101