Elin Decompiled Documentation EA 23.360 Nightly
Loading...
Searching...
No Matches
WidgetHotbar Class Reference
Inheritance diagram for WidgetHotbar:
Widget IDragParent EMono IChangeResolution ISkinRoot

Classes

class  Extra
 

Public Member Functions

override object CreateExtra ()
 
override bool CanShowContextMenu ()
 
override void OnActivate ()
 
override void OnChangeActionMode ()
 
void Rebuild ()
 
void RebuildPage (int page=-1)
 
void SwitchPage ()
 
HotItem GetItem (int index)
 
void TryUse (int index)
 
void OnClickEmptyItem (ButtonHotItem b)
 
override void OnSetContextMenu (UIContextMenu m)
 
void SetShortcutMenu (ButtonHotItem b, UIContextMenu m)
 
void SetItem (ButtonHotItem b, HotItem item)
 
bool RefreshHighlight ()
 
void _OnDirtyInventory ()
 
void SetVisible ()
 
void ToggleVisible ()
 
void CheckAutoHide ()
 
void OnStartDrag (UIButton b)
 
void OnDrag (UIButton b)
 
ButtonHotItem GetSwapButton (UIButton b)
 
void OnEndDrag (UIButton b, bool cancel=false)
 
- Public Member Functions inherited from Widget
void Test ()
 
bool IsInRightMode ()
 
void Activate ()
 
void RefreshOrder ()
 
virtual void OnActivate ()
 
virtual object CreateExtra ()
 
void Deactivate ()
 
virtual void OnDeactivate ()
 
void Close ()
 
void Reactivate ()
 
virtual void OnManagerActivate ()
 
virtual void OnManagerDeactivate ()
 
void SetAnchor (RectPosition p)
 
TextAnchor RectPositionToTextAnchor (RectPosition p)
 
void SetPivot (RectPosition p)
 
virtual void OnChangePivot ()
 
void UpdateConfig ()
 
virtual void OnUpdateConfig ()
 
void ClampToScreen ()
 
virtual void OnChangeResolution ()
 
void OnChangePosition ()
 
virtual void OnChangeActionMode ()
 
virtual void OnFlip ()
 
bool IsAlignTop ()
 
Layer AddLayer (Layer l, Transform trans)
 
void RefreshTipPivotPosition ()
 
SkinSet GetSkin ()
 
SkinConfig GetSkinConfig ()
 
void SetSkin (int id, int v=0)
 
void TestSkin ()
 
virtual void ApplySkin ()
 
virtual void OnApplySkin ()
 
void InstantiateDeco (SkinDeco deco)
 
void AddDeco (SkinDeco deco)
 
void RemoveDeco (SkinDeco deco)
 
virtual bool CanShowContextMenu ()
 
void ShowContextMenu ()
 
void SetBaseContextMenu (UIContextMenu m)
 
virtual void OnSetContextMenu (UIContextMenu m)
 
void SetGridContextMenu (UIContextMenu m)
 
void SoundActivate ()
 
void OnChangeResolution ()
 
SkinSet GetSkin ()
 
SkinConfig GetSkinConfig ()
 
void OnStartDrag (UIButton b)
 
void OnDrag (UIButton b)
 
void OnEndDrag (UIButton b, bool cancel=false)
 

Static Public Member Functions

static void RebuildPages ()
 
static void RefreshHighlights ()
 
static void RefreshButtons ()
 
- Static Public Member Functions inherited from EMono
static int rnd (int a)
 

Public Attributes

int idHotbar
 
GridLayoutGroup layout
 
ButtonHotItem mold
 
RawImage imageGrid
 
Image imageSelect
 
Hotbar.Type type
 
bool useMask
 
List< ButtonHotItem > buttons = new List<ButtonHotItem>()
 
- Public Attributes inherited from Widget
Image imageBG
 
SoundData soundActivate
 
UIDragPanel dragPanel
 
RectTransform tipPivotLeft
 
RectTransform tipPivotRight
 

Static Public Attributes

static bool registering
 
static bool dirtyCurrentItem
 
static HotItem registeringItem
 
static WidgetHotbar HotbarBuild
 
static WidgetHotbar HotBarMainMenu
 
static WidgetHotbar HotbarExtra
 
- Static Public Attributes inherited from EMono
static Core core
 

Properties

Extra extra [get]
 
Hotbar hotbar [get]
 
bool Visible [get, set]
 
override bool ShowInBuildMode [get]
 
bool IsHotbarSpeed [get]
 
bool CanRegisterItem [get]
 
- Properties inherited from Widget
string ID [get]
 
Config config [get]
 
SkinRoot skinRoot [get]
 
bool IsSealed [get]
 
virtual bool ShowStyleMenu [get]
 
virtual bool AlwaysTop [get]
 
virtual bool IsStaticPosition [get]
 
virtual bool AlwaysBottom [get]
 
virtual Type SetSiblingAfter [get]
 
virtual bool ShowInBuildMode [get]
 
virtual bool RightClickToClose [get]
 
virtual bool AllowRightClickToClose [get]
 
- Properties inherited from EMono
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static CoreDebug debug [get]
 

Private Attributes

bool showThisWidget
 
float timeSinceBecomeVisible
 

Additional Inherited Members

- Public Types inherited from Widget
enum  WidgetType { Default , ZoomMenu }
 
enum  State { Active , Inactive }
 
- Protected Member Functions inherited from Widget
void ClampToScreenEnsured (Component c, Vector2 anchoredPos)
 
void ClampToScreen (RectTransform rect, float margin=10f)
 
- Protected Attributes inherited from Widget
bool flip
 

Detailed Description

Definition at line 7 of file WidgetHotbar.cs.

Member Function Documentation

◆ _OnDirtyInventory()

void WidgetHotbar._OnDirtyInventory ( )
inline

Definition at line 516 of file WidgetHotbar.cs.

517 {
518 foreach (ButtonHotItem button in buttons)
519 {
520 if (button.item != null)
521 {
522 button.Refresh();
523 }
524 }
525 }
Item item
Definition: UIButton.cs:172
List< ButtonHotItem > buttons
Definition: WidgetHotbar.cs:57

References buttons, UIButton.item, and ButtonHotItem.Refresh().

◆ CanShowContextMenu()

override bool WidgetHotbar.CanShowContextMenu ( )
inlinevirtual

Reimplemented from Widget.

Definition at line 90 of file WidgetHotbar.cs.

91 {
93 {
94 ButtonHotItem componentOf = InputModuleEX.GetComponentOf<ButtonHotItem>();
95 if ((bool)componentOf && componentOf.item != null)
96 {
97 return true;
98 }
99 }
100 return base.CanShowContextMenu();
101 }
bool IsUserHotbar
Definition: Hotbar.cs:102
Hotbar hotbar
Definition: WidgetHotbar.cs:65

References hotbar, and Hotbar.IsUserHotbar.

◆ CheckAutoHide()

void WidgetHotbar.CheckAutoHide ( )
inline

Definition at line 596 of file WidgetHotbar.cs.

597 {
598 if (!Visible)
599 {
600 return;
601 }
603 if (timeSinceBecomeVisible < 1f)
604 {
605 return;
606 }
607 if (Input.GetMouseButton(0) || EMono.ui.contextMenu.currentMenu != null || registering)
608 {
610 return;
611 }
612 if (InputModuleEX.IsPointerOver(base.transform))
613 {
615 return;
616 }
617 foreach (ButtonHotItem button in buttons)
618 {
619 if (button.item != null && button.item.KeepVisibleWhenHighlighted && button.item.ShouldHighlight())
620 {
621 return;
622 }
623 }
625 }
Definition: EMono.cs:4
static UI ui
Definition: EMono.cs:15
static bool IsPointerOver(Component c)
virtual bool ShouldHighlight()
Definition: UIButton.cs:51
virtual bool KeepVisibleWhenHighlighted
Definition: UIButton.cs:31
float timeSinceBecomeVisible
Definition: WidgetHotbar.cs:61
void ToggleVisible()
static bool registering
Definition: WidgetHotbar.cs:30

References buttons, InputModuleEX.IsPointerOver(), UIButton.item, UIButton.Item.KeepVisibleWhenHighlighted, registering, UIButton.Item.ShouldHighlight(), timeSinceBecomeVisible, ToggleVisible(), EMono.ui, and Visible.

◆ CreateExtra()

override object WidgetHotbar.CreateExtra ( )
inlinevirtual

Reimplemented from Widget.

Definition at line 85 of file WidgetHotbar.cs.

86 {
87 return new Extra();
88 }

◆ GetItem()

HotItem WidgetHotbar.GetItem ( int  index)
inline

Definition at line 205 of file WidgetHotbar.cs.

206 {
207 return hotbar.CurrentPage.items.TryGet(index, returnNull: true);
208 }
List< HotItem > items
Definition: Hotbar.cs:16
Page CurrentPage
Definition: Hotbar.cs:115

References Hotbar.CurrentPage, hotbar, and Hotbar.Page.items.

Referenced by TryUse(), and WidgetCodex.Update().

◆ GetSwapButton()

ButtonHotItem WidgetHotbar.GetSwapButton ( UIButton  b)
inline

Definition at line 646 of file WidgetHotbar.cs.

647 {
648 foreach (Widget item in EMono.ui.widgets.list)
649 {
650 WidgetHotbar widgetHotbar = item as WidgetHotbar;
651 if (widgetHotbar == null)
652 {
653 continue;
654 }
655 foreach (ButtonHotItem button in widgetHotbar.buttons)
656 {
657 if (InputModuleEX.IsPointerOver(button) && b != button)
658 {
659 return button;
660 }
661 }
662 }
663 return null;
664 }
Definition: Widget.cs:7

References UIButton.buttons, InputModuleEX.IsPointerOver(), item, and EMono.ui.

Referenced by OnDrag(), and OnEndDrag().

◆ OnActivate()

override void WidgetHotbar.OnActivate ( )
inlinevirtual

Reimplemented from Widget.

Definition at line 103 of file WidgetHotbar.cs.

104 {
105 mold = layout.CreateMold<ButtonHotItem>();
106 if (idHotbar == 2)
107 {
108 HotBarMainMenu = this;
109 }
110 if (idHotbar == 3)
111 {
112 HotbarBuild = this;
113 }
114 if (idHotbar == 5)
115 {
116 HotbarExtra = this;
117 }
118 if (extra.rows == 0)
119 {
120 extra.rows = hotbar.itemsPerPage;
121 }
122 hotbar.actor = this;
123 Rebuild();
124 }
int itemsPerPage
Definition: Hotbar.cs:81
static WidgetHotbar HotBarMainMenu
Definition: WidgetHotbar.cs:38
void Rebuild()
ButtonHotItem mold
Definition: WidgetHotbar.cs:46
GridLayoutGroup layout
Definition: WidgetHotbar.cs:44
static WidgetHotbar HotbarExtra
Definition: WidgetHotbar.cs:40
static WidgetHotbar HotbarBuild
Definition: WidgetHotbar.cs:36

References extra, hotbar, HotbarBuild, HotbarExtra, HotBarMainMenu, idHotbar, Hotbar.itemsPerPage, layout, mold, Rebuild(), and WidgetHotbar.Extra.rows.

◆ OnChangeActionMode()

override void WidgetHotbar.OnChangeActionMode ( )
inlinevirtual

Reimplemented from Widget.

Definition at line 126 of file WidgetHotbar.cs.

127 {
128 base.OnChangeActionMode();
129 if (hotbar.dirty)
130 {
131 hotbar.dirty = false;
132 Rebuild();
133 }
135 }
bool dirty
Definition: Hotbar.cs:89
bool RefreshHighlight()

References Hotbar.dirty, hotbar, Rebuild(), and RefreshHighlight().

◆ OnClickEmptyItem()

void WidgetHotbar.OnClickEmptyItem ( ButtonHotItem  b)
inline

Definition at line 223 of file WidgetHotbar.cs.

224 {
225 UIContextMenu uIContextMenu = EMono.ui.CreateContextMenu();
226 SetShortcutMenu(b, uIContextMenu);
227 uIContextMenu.Show();
228 }
void Show(UIItem i)
void SetShortcutMenu(ButtonHotItem b, UIContextMenu m)

References SetShortcutMenu(), UIContextMenu.Show(), and EMono.ui.

◆ OnDrag()

void WidgetHotbar.OnDrag ( UIButton  b)
inline

Implements IDragParent.

Definition at line 632 of file WidgetHotbar.cs.

633 {
634 string text = "";
635 if ((bool)GetSwapButton(b))
636 {
637 text = "hotitemSwap";
638 }
639 else if (!EMono.ui.isPointerOverUI)
640 {
641 text = "hotitemTrash";
642 }
643 EMono.ui.hud.SetDragText(text);
644 }
ButtonHotItem GetSwapButton(UIButton b)

References GetSwapButton(), and EMono.ui.

◆ OnEndDrag()

void WidgetHotbar.OnEndDrag ( UIButton  b,
bool  cancel = false 
)
inline

Implements IDragParent.

Definition at line 666 of file WidgetHotbar.cs.

667 {
668 EMono.ui.hud.imageDrag.SetActive(enable: false);
669 ButtonHotItem swapButton = GetSwapButton(b);
670 if ((bool)swapButton)
671 {
672 SE.SelectHotitem();
673 ButtonHotItem buttonHotItem = b as ButtonHotItem;
674 HotItem hotItem = (HotItem)swapButton.item;
675 HotItem hotItem2 = (HotItem)buttonHotItem.item;
676 Hotbar hotbar = swapButton.widget.hotbar;
677 Hotbar hotbar2 = buttonHotItem.widget.hotbar;
678 hotbar.actor.SetItem(swapButton, hotItem2);
679 hotbar2.actor.SetItem(buttonHotItem, hotItem);
680 if (hotItem != null)
681 {
682 hotItem.button = buttonHotItem;
683 hotItem.hotbar = hotbar2;
684 }
685 if (hotItem2 != null)
686 {
687 hotItem2.button = swapButton;
688 hotItem2.hotbar = hotbar;
689 }
691 }
692 else if (EMono.ui.isPointerOverUI)
693 {
694 SE.Beep();
695 }
696 else
697 {
698 SE.Trash();
699 SetItem(b as ButtonHotItem, null);
701 }
702 }
WidgetHotbar widget
Definition: Hotbar.cs:5
WidgetHotbar actor
Definition: Hotbar.cs:91
static void RefreshAllList()
Definition: UIInventory.cs:201
void SetItem(ButtonHotItem b, HotItem item)

References Hotbar.actor, GetSwapButton(), hotbar, UIButton.item, UIInventory.RefreshAllList(), SetItem(), EMono.ui, and ButtonHotItem.widget.

◆ OnSetContextMenu()

override void WidgetHotbar.OnSetContextMenu ( UIContextMenu  m)
inlinevirtual

Reimplemented from Widget.

Definition at line 230 of file WidgetHotbar.cs.

231 {
232 ButtonHotItem b = InputModuleEX.GetComponentOf<ButtonHotItem>();
233 if (showThisWidget || !b || b.item == null || base.IsSealed || b.widget.hotbar.IsLocked)
234 {
235 showThisWidget = false;
236 _ = base.config.skin.Skin;
237 UIContextMenu uIContextMenu = m.AddChild("setting");
238 UIContextMenu uIContextMenu2 = m.AddChild("style");
239 if (!base.IsSealed)
240 {
241 uIContextMenu.AddSlider("numSlot", (float n) => n.ToString() ?? "", extra.rows, delegate(float a)
242 {
243 extra.rows = (int)a;
244 hotbar.SetSlotNum((int)a);
245 Rebuild();
247 }, 1f, 20f, isInt: true, hideOther: false);
248 }
249 uIContextMenu2.AddSlider("iconSize", (float n) => n.ToString() ?? "", extra.iconSize, delegate(float a)
250 {
251 extra.iconSize = (int)a;
252 Rebuild();
254 }, 0f, EMono.setting.ui.iconSizes.Count - 1, isInt: true);
255 SetGridContextMenu(uIContextMenu2);
256 uIContextMenu.AddToggle("vertical", extra.vertical, delegate(bool a)
257 {
258 extra.vertical = a;
259 Rebuild();
261 });
262 uIContextMenu.AddToggle("doubleBar", extra.width == 2, delegate(bool a)
263 {
264 extra.width = ((!a) ? 1 : 2);
265 Rebuild();
267 });
268 uIContextMenu.AddToggle("reverseOrder", extra.reverse, delegate(bool a)
269 {
270 extra.reverse = a;
271 Rebuild();
273 });
274 if (!base.IsSealed)
275 {
276 uIContextMenu.AddToggle("alwaysShow2", extra.alwaysShow, delegate(bool a)
277 {
278 extra.alwaysShow = a;
279 });
280 }
282 if (base.IsSealed)
283 {
284 return;
285 }
286 m.AddButton("resetHotbar", delegate
287 {
288 Dialog.YesNo("dialogResetHotbar", delegate
289 {
291 SE.Trash();
292 });
293 });
294 return;
295 }
296 m.AddButton("removeHotItem", delegate
297 {
298 hotbar.SetItem(null, b.index);
299 RebuildPage();
300 });
302 m.AddToggle("alwaysShow", b.item.always, delegate(bool on)
303 {
304 b.item.always = on;
305 });
306 m.AddButton("thisWidget", delegate
307 {
308 showThisWidget = true;
309 EMono.core.actionsNextFrame.Add(delegate
310 {
312 });
313 });
314 }
List< Action > actionsNextFrame
Definition: BaseCore.cs:31
new int index
Definition: ButtonHotItem.cs:8
Definition: Dialog.cs:7
static Dialog YesNo(string langDetail, Action actionYes, Action actionNo=null, string langYes="yes", string langNo="no")
Definition: Dialog.cs:252
static Core core
Definition: EMono.cs:5
static Player player
Definition: EMono.cs:11
void ResetHotbar(int id)
Definition: HotbarManager.cs:8
void SetSlotNum(int a)
Definition: Hotbar.cs:117
bool IsLocked
Definition: Hotbar.cs:99
HotItem SetItem(HotItem item, int index=-1, int pageIndex=-1, bool refreshActor=false)
Definition: Hotbar.cs:173
int id
Definition: Hotbar.cs:84
HotbarManager hotbars
Definition: Player.cs:1164
virtual void OnShowContextMenu(UIContextMenu m)
Definition: UIButton.cs:60
bool always
Definition: UIButton.cs:15
UIContextMenuItem AddToggle(string idLang="", bool isOn=false, UnityAction< bool > action=null)
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
void AddButton(Func< string > funcText, UnityAction action=null)
UIContextMenu AddChild(string idLang, TextAnchor anchor)
void RebuildPage(int page=-1)
bool showThisWidget
Definition: WidgetHotbar.cs:59
void ShowContextMenu()
Definition: Widget.cs:635
void SetBaseContextMenu(UIContextMenu m)
Definition: Widget.cs:642
void SetGridContextMenu(UIContextMenu m)
Definition: Widget.cs:743
void ClampToScreen()
Definition: Widget.cs:456

References BaseCore.actionsNextFrame, UIContextMenu.AddButton(), UIContextMenu.AddChild(), UIContextMenu.AddSlider(), UIContextMenu.AddToggle(), UIButton.Item.always, WidgetHotbar.Extra.alwaysShow, Widget.ClampToScreen(), EMono.core, extra, hotbar, Player.hotbars, WidgetHotbar.Extra.iconSize, Hotbar.id, ButtonHotItem.index, Hotbar.IsLocked, UIButton.item, UIButton.Item.OnShowContextMenu(), EMono.player, Rebuild(), RebuildPage(), HotbarManager.ResetHotbar(), WidgetHotbar.Extra.reverse, WidgetHotbar.Extra.rows, Widget.SetBaseContextMenu(), Widget.SetGridContextMenu(), Hotbar.SetItem(), Hotbar.SetSlotNum(), Widget.ShowContextMenu(), showThisWidget, WidgetHotbar.Extra.vertical, ButtonHotItem.widget, WidgetHotbar.Extra.width, and Dialog.YesNo().

◆ OnStartDrag()

void WidgetHotbar.OnStartDrag ( UIButton  b)
inline

Implements IDragParent.

Definition at line 627 of file WidgetHotbar.cs.

628 {
629 EMono.ui.hud.SetDragImage(b.icon);
630 }
Image icon
Definition: UIButton.cs:110

References UIButton.icon, and EMono.ui.

◆ Rebuild()

void WidgetHotbar.Rebuild ( )
inline

Definition at line 137 of file WidgetHotbar.cs.

138 {
139 buttons.Clear();
140 layout.cellSize = EMono.setting.ui.iconSizes[extra.iconSize];
141 layout.constraintCount = extra.width;
142 layout.constraint = (extra.vertical ? GridLayoutGroup.Constraint.FixedColumnCount : GridLayoutGroup.Constraint.FixedRowCount);
143 layout.startCorner = (extra.reverse ? GridLayoutGroup.Corner.LowerRight : GridLayoutGroup.Corner.UpperLeft);
144 int num = extra.rows;
145 if (extra.autoSize)
146 {
147 num = 0;
148 for (int i = 0; i < hotbar.CurrentPage.items.Count && hotbar.CurrentPage.items[i] != null; i++)
149 {
150 num++;
151 }
152 }
153 int num2 = (num - 1) / extra.width + 1;
154 int num3 = (extra.vertical ? extra.width : num2);
155 int num4 = (extra.vertical ? num2 : extra.width);
156 imageGrid.uvRect = new Rect(1f, 1f, num3, num4);
157 layout.DestroyChildren();
158 for (int j = 0; j < num; j++)
159 {
160 ButtonHotItem buttonHotItem = Util.Instantiate(mold, layout);
161 buttonHotItem.index = j;
162 buttonHotItem.mainText.text = ((j > 10) ? "" : ((j + 1).ToString() ?? ""));
163 buttonHotItem.widget = this;
164 buttons.Add(buttonHotItem);
165 if (useMask)
166 {
167 buttonHotItem.gameObject.AddComponent<RectMask2D>();
168 }
169 }
170 layout.RebuildLayout();
171 this.RebuildLayout();
172 RebuildPage();
173 }
static GameSetting setting
Definition: EMono.cs:31
List< Vector2 > iconSizes
Definition: GameSetting.cs:29
UISetting ui
Definition: GameSetting.cs:354
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References WidgetHotbar.Extra.autoSize, buttons, Hotbar.CurrentPage, extra, hotbar, WidgetHotbar.Extra.iconSize, GameSetting.UISetting.iconSizes, Hotbar.Page.items, layout, mold, RebuildPage(), WidgetHotbar.Extra.rows, EMono.setting, GameSetting.ui, useMask, Util, WidgetHotbar.Extra.vertical, and WidgetHotbar.Extra.width.

Referenced by OnActivate(), OnChangeActionMode(), OnSetContextMenu(), and HotbarManager.ResetHotbar().

◆ RebuildPage()

void WidgetHotbar.RebuildPage ( int  page = -1)
inline

Definition at line 175 of file WidgetHotbar.cs.

176 {
177 hotbar.SetPage((page == -1) ? hotbar.currentPage : page);
178 foreach (ButtonHotItem button in buttons)
179 {
180 HotItem item = hotbar.GetItem(button.index);
181 button.SetItem(item);
182 }
183 SetVisible();
185 }
void SetItem(GridItem i)
Definition: ButtonGrid.cs:405
HotItem GetItem(int index, int pageIndex=-1)
Definition: Hotbar.cs:168
int currentPage
Definition: Hotbar.cs:78
void SetPage(int pageIndex)
Definition: Hotbar.cs:149
void SetVisible()

References buttons, Hotbar.currentPage, Hotbar.GetItem(), hotbar, ButtonHotItem.index, item, RefreshHighlight(), ButtonGrid.SetItem(), Hotbar.SetPage(), and SetVisible().

Referenced by CoreDebug.EnableDebugResource(), OnSetContextMenu(), Rebuild(), RebuildPages(), Hotbar.SetItem(), and SwitchPage().

◆ RebuildPages()

static void WidgetHotbar.RebuildPages ( )
inlinestatic

Definition at line 187 of file WidgetHotbar.cs.

188 {
189 foreach (Widget item in EMono.ui.widgets.list)
190 {
191 WidgetHotbar widgetHotbar = item as WidgetHotbar;
192 if ((bool)widgetHotbar)
193 {
194 widgetHotbar.RebuildPage();
195 }
196 }
197 }

References item, RebuildPage(), and EMono.ui.

Referenced by ContentConfigTest.OnInstantiate().

◆ RefreshButtons()

static void WidgetHotbar.RefreshButtons ( )
inlinestatic

Definition at line 462 of file WidgetHotbar.cs.

463 {
464 foreach (Widget item in EMono.ui.widgets.list)
465 {
466 WidgetHotbar widgetHotbar = item as WidgetHotbar;
467 if (!widgetHotbar)
468 {
469 continue;
470 }
471 foreach (ButtonHotItem button in widgetHotbar.buttons)
472 {
473 button.RefreshItem();
474 }
475 }
476 }
override void RefreshItem()

References UIButton.buttons, item, ButtonHotItem.RefreshItem(), and EMono.ui.

Referenced by Recipe.ToggleTrack().

◆ RefreshHighlight()

bool WidgetHotbar.RefreshHighlight ( )
inline

Definition at line 478 of file WidgetHotbar.cs.

479 {
480 bool result = false;
481 foreach (ButtonHotItem button in buttons)
482 {
483 if (button.item == null)
484 {
485 continue;
486 }
487 if (button.item.UseIconForHighlight)
488 {
489 if (button.item.ShouldHighlight())
490 {
491 result = true;
492 button.icon.sprite = button.item.GetSprite(highlight: true);
493 }
494 else
495 {
496 button.icon.sprite = button.item.GetSprite();
497 }
498 }
499 else if (button.item.ShouldHighlight())
500 {
501 result = true;
502 button.image.sprite = button.item.SpriteHighlight;
504 {
506 }
507 }
508 else
509 {
510 button.image.sprite = EMono.core.refs.spritesHighlight[0];
511 }
512 }
513 return result;
514 }
List< Sprite > spritesHighlight
Definition: CoreRef.cs:374
CoreRef refs
Definition: Core.cs:51
virtual Sprite SpriteHighlight
Definition: UIButton.cs:21
virtual bool UseIconForHighlight
Definition: UIButton.cs:29
virtual Sprite GetSprite()
Definition: UIButton.cs:41

References buttons, EMono.core, UIButton.Item.GetSprite(), UIButton.item, UIButton.Item.KeepVisibleWhenHighlighted, Core.refs, UIButton.Item.ShouldHighlight(), UIButton.Item.SpriteHighlight, CoreRef.spritesHighlight, ToggleVisible(), UIButton.Item.UseIconForHighlight, and Visible.

Referenced by OnChangeActionMode(), HotItemToggle.OnClick(), HotItemToggleVisible.OnClick(), RebuildPage(), RefreshHighlights(), and SetItem().

◆ RefreshHighlights()

static void WidgetHotbar.RefreshHighlights ( )
inlinestatic

Definition at line 450 of file WidgetHotbar.cs.

451 {
452 foreach (Widget item in EMono.ui.widgets.list)
453 {
454 WidgetHotbar widgetHotbar = item as WidgetHotbar;
455 if ((bool)widgetHotbar)
456 {
457 widgetHotbar.RefreshHighlight();
458 }
459 }
460 }

References item, RefreshHighlight(), and EMono.ui.

Referenced by BaseGameScreen.Activate(), ActionMode.ChangeGameSpeed(), ActionMode.DoFunc(), and Scene.OnToggle().

◆ SetItem()

void WidgetHotbar.SetItem ( ButtonHotItem  b,
HotItem  item 
)
inline

◆ SetShortcutMenu()

void WidgetHotbar.SetShortcutMenu ( ButtonHotItem  b,
UIContextMenu  m 
)
inline

Definition at line 316 of file WidgetHotbar.cs.

317 {
318 Action<UIContextMenu, HotItem> action = delegate(UIContextMenu _m, HotItem i)
319 {
320 _m.AddButton(i.Name, delegate
321 {
322 SetItem(b, i);
323 });
324 };
325 UIContextMenu arg = m.AddChild("layerShortcuts");
326 action(arg, new HotItemLayer
327 {
328 id = "LayerHelp"
329 });
330 action(arg, new HotItemLayer
331 {
332 id = "stash"
333 });
334 action(arg, new HotItemLayer
335 {
336 id = "LayerAbility"
337 });
338 action(arg, new HotItemLayer
339 {
340 id = "LayerChara"
341 });
342 action(arg, new HotItemLayer
343 {
344 id = "LayerJournal"
345 });
346 action(arg, new HotItemWidget
347 {
348 id = "Roster"
349 });
350 action(arg, new HotItemWidget
351 {
352 id = "Codex"
353 });
354 action(arg, new HotItemWidget
355 {
356 id = "Search"
357 });
358 action(arg, new HotItemWidget
359 {
360 id = "Tracker"
361 });
362 action(arg, new HotItemWidget
363 {
364 id = "Memo"
365 });
366 action(arg, new HotItemWidget
367 {
368 id = "QuestTracker"
369 });
370 arg = m.AddChild("utilShortcuts");
371 action(arg, new HotItemToggle
372 {
373 type = HotItemToggle.Type.ToggleNoRoof
374 });
375 action(arg, new HotItemToggle
376 {
377 type = HotItemToggle.Type.muteBGM
378 });
379 action(arg, new HotItemToggle
380 {
381 type = HotItemToggle.Type.showBalloon
382 });
383 action(arg, new HotItemActionAudoDump());
384 arg.AddButton("hotActionWidgetSet".lang(), delegate
385 {
386 SetItem(b, new HotItemWidgetSet().Register());
387 });
389 {
390 arg = m.AddChild("menuShortcuts");
391 action(arg, new HotItemContext
392 {
393 id = "system"
394 });
395 if ((bool)this == IsHotbarSpeed)
396 {
397 arg = m.AddChild("uniqueShortcuts");
398 action(arg, new HotItemSpeed
399 {
400 id = 0
401 });
402 action(arg, new HotItemSpeed
403 {
404 id = 1
405 });
406 action(arg, new HotItemSpeed
407 {
408 id = 2
409 });
410 action(arg, new HotItemSpeed
411 {
412 id = 3
413 });
414 }
415 }
416 arg = m.AddChild("specialShortcuts");
417 action(arg, new HotItemTogglePage());
418 action(arg, new HotItemToggleVisible());
419 m.AddButton("registerPos".lang(), delegate
420 {
422 {
423 zone = EMono.game.activeZone,
424 x = EMono.pc.pos.x,
425 y = EMono.pc.pos.z
426 });
427 });
428 m.AddButton("hotActionEQSet".lang(), delegate
429 {
430 SetItem(b, new HotItemEQSet().Register());
431 });
432 m.AddButton("hotActionSleep".lang(), delegate
433 {
434 SetItem(b, new HotItemActionSleep());
435 });
436 m.AddButton("hotActionBinocular".lang(), delegate
437 {
439 });
440 }
Point pos
Definition: Card.cs:60
CoreConfig config
Definition: Core.cs:70
static Chara pc
Definition: EMono.cs:13
static Game game
Definition: EMono.cs:7
Zone activeZone
Definition: Game.cs:252
int x
Definition: Point.cs:36
virtual string Name
Definition: UIButton.cs:19
Hotbar.Type type
Definition: WidgetHotbar.cs:52
bool IsHotbarSpeed
Definition: WidgetHotbar.cs:81

References Game.activeZone, UIContextMenu.AddButton(), UIContextMenu.AddChild(), Core.config, EMono.core, EMono.game, IsHotbarSpeed, UIButton.Item.Name, EMono.pc, Card.pos, SetItem(), CoreConfig.test, type, CoreConfig.Test.unsealWidgets, and Point.x.

Referenced by OnClickEmptyItem().

◆ SetVisible()

void WidgetHotbar.SetVisible ( )
inline

Definition at line 527 of file WidgetHotbar.cs.

528 {
529 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
530 int num = 0;
531 bool flag = false;
532 foreach (ButtonHotItem button in buttons)
533 {
534 bool flag2 = button.item is HotItemToggleVisible;
535 bool flag3 = Visible || flag2 || (button.item != null && button.item.always);
536 button.image.enabled = flag3;
537 button.mainText.enabled = flag3;
538 button.icon.SetActive(flag3);
539 if (!flag2 && button != componentOf)
540 {
541 button.DoNormalTransition();
542 }
543 if (flag3)
544 {
545 num++;
546 }
547 if (flag2)
548 {
549 flag = true;
550 }
551 }
552 if (num == 0 && !Visible)
553 {
554 Visible = true;
555 SetVisible();
556 }
557 CancelInvoke("CheckAutoHide");
558 if (flag)
559 {
561 InvokeRepeating("CheckAutoHide", 0.1f, 0.2f);
562 }
563 Image image = imageBG;
564 bool flag4 = (imageGrid.enabled = extra.visible);
565 image.enabled = flag4;
566 dragPanel.SetActive(extra.visible);
567 }
void DoNormalTransition(bool instant=true)
Definition: UIButton.cs:531
UIDragPanel dragPanel
Definition: Widget.cs:154
Image imageBG
Definition: Widget.cs:150

References UIButton.Item.always, buttons, UIButton.DoNormalTransition(), Widget.dragPanel, extra, UIButton.icon, Widget.imageBG, UIButton.item, SetVisible(), timeSinceBecomeVisible, WidgetHotbar.Extra.visible, and Visible.

Referenced by RebuildPage(), SetItem(), SetVisible(), and ToggleVisible().

◆ SwitchPage()

void WidgetHotbar.SwitchPage ( )
inline

Definition at line 199 of file WidgetHotbar.cs.

200 {
201 SE.ClickGeneral();
202 RebuildPage((hotbar.currentPage == 0) ? 1 : 0);
203 }

References Hotbar.currentPage, hotbar, and RebuildPage().

Referenced by HotItemTogglePage.OnClick().

◆ ToggleVisible()

void WidgetHotbar.ToggleVisible ( )
inline

Definition at line 569 of file WidgetHotbar.cs.

570 {
571 extra.visible = !extra.visible;
572 SetVisible();
573 if (!Visible)
574 {
575 return;
576 }
577 imageBG.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
578 imageBG.transform.DOScale(1f, 0.12f).SetEase(Ease.Linear);
579 imageGrid.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
580 imageGrid.transform.DOScale(1f, 0.12f).SetEase(Ease.Linear);
581 foreach (ButtonHotItem button in buttons)
582 {
583 if (!(button.item is HotItemToggleVisible) && (button.item == null || !button.item.always))
584 {
585 button.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
586 button.transform.DOScale(1f, 0.12f).SetEase(Ease.Linear);
587 }
588 }
589 imageBG.SetAlpha(0f);
590 imageGrid.SetAlpha(0f);
591 SkinConfig skin = base.config.skin;
592 imageBG.DOFade(skin.bgColor.a, 0.4f).SetEase(Ease.OutQuint);
593 imageGrid.DOFade(skin.gridColor.a, 0.4f).SetEase(Ease.OutQuint);
594 }
Color bgColor
Definition: SkinConfig.cs:67
Color gridColor
Definition: SkinConfig.cs:79
RawImage imageGrid
Definition: WidgetHotbar.cs:48

References UIButton.Item.always, SkinConfig.bgColor, buttons, extra, SkinConfig.gridColor, Widget.imageBG, imageGrid, UIButton.item, SetVisible(), WidgetHotbar.Extra.visible, and Visible.

Referenced by CheckAutoHide(), HotItemToggleVisible.OnClick(), RefreshHighlight(), ButtonHotItem.RefreshItem(), and LayerRegisterHotbar.Show().

◆ TryUse()

void WidgetHotbar.TryUse ( int  index)
inline

Definition at line 210 of file WidgetHotbar.cs.

211 {
212 HotItem item = GetItem(index);
213 if (item == null)
214 {
215 SE.BeepSmall();
216 }
217 else
218 {
219 item.OnClick(item.button, hotbar);
220 }
221 }
HotItem GetItem(int index)

References GetItem(), hotbar, and item.

Referenced by ActionMode.UpdateInput().

Member Data Documentation

◆ buttons

◆ dirtyCurrentItem

bool WidgetHotbar.dirtyCurrentItem
static

Definition at line 32 of file WidgetHotbar.cs.

Referenced by Scene.OnUpdate().

◆ HotbarBuild

WidgetHotbar WidgetHotbar.HotbarBuild
static

Definition at line 36 of file WidgetHotbar.cs.

Referenced by CoreDebug.EnableDebugResource(), and OnActivate().

◆ HotbarExtra

WidgetHotbar WidgetHotbar.HotbarExtra
static

Definition at line 40 of file WidgetHotbar.cs.

Referenced by OnActivate(), WidgetCodex.Update(), and ActionMode.UpdateInput().

◆ HotBarMainMenu

WidgetHotbar WidgetHotbar.HotBarMainMenu
static

Definition at line 38 of file WidgetHotbar.cs.

Referenced by OnActivate().

◆ idHotbar

int WidgetHotbar.idHotbar

Definition at line 42 of file WidgetHotbar.cs.

Referenced by OnActivate().

◆ imageGrid

RawImage WidgetHotbar.imageGrid

Definition at line 48 of file WidgetHotbar.cs.

Referenced by ToggleVisible().

◆ imageSelect

Image WidgetHotbar.imageSelect

Definition at line 50 of file WidgetHotbar.cs.

◆ layout

GridLayoutGroup WidgetHotbar.layout

Definition at line 44 of file WidgetHotbar.cs.

Referenced by OnActivate(), and Rebuild().

◆ mold

ButtonHotItem WidgetHotbar.mold

Definition at line 46 of file WidgetHotbar.cs.

Referenced by OnActivate(), and Rebuild().

◆ registering

bool WidgetHotbar.registering
static

Definition at line 30 of file WidgetHotbar.cs.

Referenced by CheckAutoHide(), ButtonHotItem.OnHover(), and ButtonHotItem.RefreshItem().

◆ registeringItem

HotItem WidgetHotbar.registeringItem
static

Definition at line 34 of file WidgetHotbar.cs.

Referenced by ButtonHotItem.RegisterHotbar().

◆ showThisWidget

bool WidgetHotbar.showThisWidget
private

Definition at line 59 of file WidgetHotbar.cs.

Referenced by OnSetContextMenu().

◆ timeSinceBecomeVisible

float WidgetHotbar.timeSinceBecomeVisible
private

Definition at line 61 of file WidgetHotbar.cs.

Referenced by CheckAutoHide(), and SetVisible().

◆ type

Hotbar.Type WidgetHotbar.type

Definition at line 52 of file WidgetHotbar.cs.

Referenced by SetShortcutMenu().

◆ useMask

bool WidgetHotbar.useMask

Definition at line 54 of file WidgetHotbar.cs.

Referenced by Rebuild().

Property Documentation

◆ CanRegisterItem

bool WidgetHotbar.CanRegisterItem
get

Definition at line 83 of file WidgetHotbar.cs.

Referenced by ButtonHotItem.RefreshItem(), and LayerRegisterHotbar.Show().

◆ extra

Extra WidgetHotbar.extra
get

◆ hotbar

◆ IsHotbarSpeed

bool WidgetHotbar.IsHotbarSpeed
get

Definition at line 81 of file WidgetHotbar.cs.

Referenced by SetShortcutMenu().

◆ ShowInBuildMode

override bool WidgetHotbar.ShowInBuildMode
get

Definition at line 79 of file WidgetHotbar.cs.

◆ Visible

bool WidgetHotbar.Visible
getset

Definition at line 67 of file WidgetHotbar.cs.

68 {
69 get
70 {
71 return extra.visible;
72 }
73 set
74 {
75 extra.visible = value;
76 }
77 }

Referenced by CheckAutoHide(), HotItemToggleVisible.OnClick(), HotItemToggleVisible.OnHover(), RefreshHighlight(), ButtonHotItem.RefreshItem(), SetVisible(), LayerRegisterHotbar.Show(), and ToggleVisible().


The documentation for this class was generated from the following file: