Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
BasicButtonComponent.c
Go to the documentation of this file.
1 class BasicButtonComponent : ScriptedWidgetComponent
2 {
3  const ref Color COLOR_DEFAULT = new Color(0,0,0,0.6);
4  const ref Color COLOR_FOCUSED = new Color(1,1,1,0.06);
5  const ref Color COLOR_HOVERED = new Color(1,1,1,0.06);
6  const ref Color COLOR_PRESSED = new Color(0.8,0.8,0.8,0.06);
7 
8  [Attribute(SCR_SoundEvent.FOCUS, UIWidgets.EditBox, "")]
9  protected string m_sSoundFocused;
10 
11  [Attribute(SCR_SoundEvent.CLICK, UIWidgets.EditBox, "")]
12  protected string m_sSoundClicked;
13 
14  //------------------------------------------------------------------------------------------------
15  override void HandlerAttached(Widget w)
16  {
17  w.SetColor(COLOR_DEFAULT);
18 
19  if (!w.IsEnabled())
20  w.SetOpacity(0.5);
21  }
22 
23  //------------------------------------------------------------------------------------------------
24  override bool OnClick(Widget w, int x, int y, int button)
25  {
26  SCR_UISoundEntity.SoundEvent(m_sSoundClicked);
27  AnimateWidget.Color(w, COLOR_PRESSED, UIConstants.FADE_RATE_DEFAULT);
28 
29  return false;
30  }
31 
32  //------------------------------------------------------------------------------------------------
33  override bool OnFocus(Widget w, int x, int y)
34  {
35  SCR_UISoundEntity.SoundEvent(m_sSoundFocused);
36  AnimateWidget.Color(w, COLOR_FOCUSED, UIConstants.FADE_RATE_DEFAULT);
37  return false;
38  }
39 
40  //------------------------------------------------------------------------------------------------
41  override bool OnFocusLost(Widget w, int x, int y)
42  {
43  AnimateWidget.Color(w, COLOR_DEFAULT, UIConstants.FADE_RATE_DEFAULT);
44  return false;
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  override bool OnMouseEnter(Widget w, int x, int y)
49  {
50  GetGame().GetWorkspace().SetFocusedWidget(w);
51  return false;
52  }
53 };
SCR_UISoundEntity
Definition: SCR_UISoundEntity.c:7
UIConstants
Definition: Constants.c:130
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
BasicButtonComponent
Definition: BasicButtonComponent.c:1