Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_RadialMenuSegmentComponent.c
Go to the documentation of this file.
1 
5 {
6  protected const string BACKGROUND = "Background";
7  protected const string CATEGORY_WRAP = "CategoryWrap";
8  protected const string CATEGORY = "Category";
9  protected const string CATEGORY_ARROW = "CategoryArrow";
10 
11  protected ImageWidget m_wBackground;
12  protected Widget m_wCategoryWrap;
13  protected ImageWidget m_wCategory;
14  protected ImageWidget m_wCategoryArrow;
15 
16  //------------------------------------------------------------------------------------------------
17  override void HandlerAttached(Widget w)
18  {
19  super.HandlerAttached(w);
20 
21  m_wBackground = ImageWidget.Cast(w.FindAnyWidget(BACKGROUND));
22  m_wCategoryWrap = w.FindAnyWidget(CATEGORY_WRAP);
23  m_wCategory = ImageWidget.Cast(w.FindAnyWidget(CATEGORY));
24  m_wCategoryArrow = ImageWidget.Cast(w.FindAnyWidget(CATEGORY_ARROW));
25  }
26 
27  const float CATEGORY_OFFSET = 4;
28 
29  //------------------------------------------------------------------------------------------------
30  void SetupSegment(float range, float angle, bool isCategory)
31  {
32  float angleDist = range * 360;
33  float rot = angle - angleDist * 0.5;
34 
35  m_wBackground.SetMaskProgress(range);
36  m_wBackground.SetRotation(rot);
37 
38  // Category
39  m_wCategoryWrap.SetVisible(isCategory);
40 
41  if (isCategory)
42  {
43  m_wCategory.SetMaskProgress(range - CATEGORY_OFFSET / 360);
44  m_wCategory.SetRotation(rot + CATEGORY_OFFSET * 0.5);
45 
46  m_wCategoryArrow.SetRotation(angle);
47 
48  float arrowRot = angle * Math.DEG2RAD;
49  float radius = FrameSlot.GetPosY(m_wCategoryArrow);
50 
51  vector pos = Vector(
52  radius * Math.Cos(arrowRot - 0.5 * Math.PI),
53  radius * Math.Sin(arrowRot - 0.5 * Math.PI),
54  0.0);
55 
56  FrameSlot.SetPos(m_wCategoryArrow, pos[0], pos[1]);
57  }
58  }
59 
60  //------------------------------------------------------------------------------------------------
61  ImageWidget GetBackgroundWidget()
62  {
63  return m_wBackground;
64  }
65 
66  //------------------------------------------------------------------------------------------------
67  Widget GetCategoryWrapWidget()
68  {
69  return m_wCategoryWrap;
70  }
71 }
m_wBackground
protected ImageWidget m_wBackground
Definition: SCR_InventoryHitZonePointUI.c:382
SCR_ScriptedWidgetComponent
Definition: SCR_ScriptedWidgetComponent.c:7
SCR_RadialMenuSegmentComponent
Definition: SCR_RadialMenuSegmentComponent.c:4
BACKGROUND
BACKGROUND
Definition: SCR_HUDManagerComponent.c:2