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";
11 protected ImageWidget m_wBackground;
12 protected Widget m_wCategoryWrap;
13 protected ImageWidget m_wCategory;
14 protected ImageWidget m_wCategoryArrow;
17 override void HandlerAttached(Widget w)
19 super.HandlerAttached(w);
22 m_wCategoryWrap = w.FindAnyWidget(CATEGORY_WRAP);
23 m_wCategory = ImageWidget.Cast(w.FindAnyWidget(CATEGORY));
24 m_wCategoryArrow = ImageWidget.Cast(w.FindAnyWidget(CATEGORY_ARROW));
27 const float CATEGORY_OFFSET = 4;
30 void SetupSegment(
float range,
float angle,
bool isCategory)
32 float angleDist = range * 360;
33 float rot = angle - angleDist * 0.5;
39 m_wCategoryWrap.SetVisible(isCategory);
43 m_wCategory.SetMaskProgress(range - CATEGORY_OFFSET / 360);
44 m_wCategory.SetRotation(rot + CATEGORY_OFFSET * 0.5);
46 m_wCategoryArrow.SetRotation(angle);
48 float arrowRot = angle * Math.DEG2RAD;
49 float radius = FrameSlot.GetPosY(m_wCategoryArrow);
52 radius * Math.Cos(arrowRot - 0.5 * Math.PI),
53 radius * Math.Sin(arrowRot - 0.5 * Math.PI),
56 FrameSlot.SetPos(m_wCategoryArrow, pos[0], pos[1]);
61 ImageWidget GetBackgroundWidget()
67 Widget GetCategoryWrapWidget()
69 return m_wCategoryWrap;