Elin Decompiled Documentation EA 23.102 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)
 
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< ButtonHotItembuttons = 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 512 of file WidgetHotbar.cs.

513 {
514 foreach (ButtonHotItem button in buttons)
515 {
516 if (button.item != null)
517 {
518 button.Refresh();
519 }
520 }
521 }
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 592 of file WidgetHotbar.cs.

593 {
594 if (!Visible)
595 {
596 return;
597 }
599 if (timeSinceBecomeVisible < 1f)
600 {
601 return;
602 }
603 if (Input.GetMouseButton(0) || EMono.ui.contextMenu.currentMenu != null || registering)
604 {
606 return;
607 }
608 if (InputModuleEX.IsPointerOver(base.transform))
609 {
611 return;
612 }
613 foreach (ButtonHotItem button in buttons)
614 {
615 if (button.item != null && button.item.KeepVisibleWhenHighlighted && button.item.ShouldHighlight())
616 {
617 return;
618 }
619 }
621 }
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 642 of file WidgetHotbar.cs.

643 {
644 foreach (Widget item in EMono.ui.widgets.list)
645 {
646 WidgetHotbar widgetHotbar = item as WidgetHotbar;
647 if (widgetHotbar == null)
648 {
649 continue;
650 }
651 foreach (ButtonHotItem button in widgetHotbar.buttons)
652 {
653 if (InputModuleEX.IsPointerOver(button) && b != button)
654 {
655 return button;
656 }
657 }
658 }
659 return null;
660 }
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 628 of file WidgetHotbar.cs.

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

References GetSwapButton(), and EMono.ui.

◆ OnEndDrag()

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

Implements IDragParent.

Definition at line 662 of file WidgetHotbar.cs.

663 {
664 EMono.ui.hud.imageDrag.SetActive(enable: false);
665 ButtonHotItem swapButton = GetSwapButton(b);
666 if ((bool)swapButton)
667 {
668 SE.SelectHotitem();
669 ButtonHotItem buttonHotItem = b as ButtonHotItem;
670 HotItem hotItem = (HotItem)swapButton.item;
671 HotItem hotItem2 = (HotItem)buttonHotItem.item;
672 Hotbar hotbar = swapButton.widget.hotbar;
673 Hotbar hotbar2 = buttonHotItem.widget.hotbar;
674 hotbar.actor.SetItem(swapButton, hotItem2);
675 hotbar2.actor.SetItem(buttonHotItem, hotItem);
676 if (hotItem != null)
677 {
678 hotItem.button = buttonHotItem;
679 hotItem.hotbar = hotbar2;
680 }
681 if (hotItem2 != null)
682 {
683 hotItem2.button = swapButton;
684 hotItem2.hotbar = hotbar;
685 }
687 }
688 else if (EMono.ui.isPointerOverUI)
689 {
690 SE.Beep();
691 }
692 else
693 {
694 SE.Trash();
695 SetItem(b as ButtonHotItem, null);
697 }
698 }
WidgetHotbar widget
Definition: Hotbar.cs:5
WidgetHotbar actor
Definition: Hotbar.cs:91
static void RefreshAllList()
Definition: UIInventory.cs:198
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:244
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:886
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:601
void SetBaseContextMenu(UIContextMenu m)
Definition: Widget.cs:608
void SetGridContextMenu(UIContextMenu m)
Definition: Widget.cs:709
void ClampToScreen()
Definition: Widget.cs:437

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 623 of file WidgetHotbar.cs.

624 {
625 EMono.ui.hud.SetDragImage(b.icon);
626 }
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:28
UISetting ui
Definition: GameSetting.cs:307
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:398
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 458 of file WidgetHotbar.cs.

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

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

Referenced by Recipe.ToggleTrack().

◆ RefreshHighlight()

bool WidgetHotbar.RefreshHighlight ( )
inline

Definition at line 474 of file WidgetHotbar.cs.

475 {
476 bool result = false;
477 foreach (ButtonHotItem button in buttons)
478 {
479 if (button.item == null)
480 {
481 continue;
482 }
483 if (button.item.UseIconForHighlight)
484 {
485 if (button.item.ShouldHighlight())
486 {
487 result = true;
488 button.icon.sprite = button.item.GetSprite(highlight: true);
489 }
490 else
491 {
492 button.icon.sprite = button.item.GetSprite();
493 }
494 }
495 else if (button.item.ShouldHighlight())
496 {
497 result = true;
498 button.image.sprite = button.item.SpriteHighlight;
500 {
502 }
503 }
504 else
505 {
506 button.image.sprite = EMono.core.refs.spritesHighlight[0];
507 }
508 }
509 return result;
510 }
List< Sprite > spritesHighlight
Definition: CoreRef.cs:355
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 446 of file WidgetHotbar.cs.

447 {
448 foreach (Widget item in EMono.ui.widgets.list)
449 {
450 WidgetHotbar widgetHotbar = item as WidgetHotbar;
451 if ((bool)widgetHotbar)
452 {
453 widgetHotbar.RefreshHighlight();
454 }
455 }
456 }

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 }
Point pos
Definition: Card.cs:55
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:245
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 523 of file WidgetHotbar.cs.

524 {
525 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
526 int num = 0;
527 bool flag = false;
528 foreach (ButtonHotItem button in buttons)
529 {
530 bool flag2 = button.item is HotItemToggleVisible;
531 bool flag3 = Visible || flag2 || (button.item != null && button.item.always);
532 button.image.enabled = flag3;
533 button.mainText.enabled = flag3;
534 button.icon.SetActive(flag3);
535 if (!flag2 && button != componentOf)
536 {
537 button.DoNormalTransition();
538 }
539 if (flag3)
540 {
541 num++;
542 }
543 if (flag2)
544 {
545 flag = true;
546 }
547 }
548 if (num == 0 && !Visible)
549 {
550 Visible = true;
551 SetVisible();
552 }
553 CancelInvoke("CheckAutoHide");
554 if (flag)
555 {
557 InvokeRepeating("CheckAutoHide", 0.1f, 0.2f);
558 }
559 Image image = imageBG;
560 bool flag4 = (imageGrid.enabled = extra.visible);
561 image.enabled = flag4;
562 dragPanel.SetActive(extra.visible);
563 }
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 565 of file WidgetHotbar.cs.

566 {
567 extra.visible = !extra.visible;
568 SetVisible();
569 if (!Visible)
570 {
571 return;
572 }
573 imageBG.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
574 imageBG.transform.DOScale(1f, 0.12f).SetEase(Ease.Linear);
575 imageGrid.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
576 imageGrid.transform.DOScale(1f, 0.12f).SetEase(Ease.Linear);
577 foreach (ButtonHotItem button in buttons)
578 {
579 if (!(button.item is HotItemToggleVisible) && (button.item == null || !button.item.always))
580 {
581 button.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
582 button.transform.DOScale(1f, 0.12f).SetEase(Ease.Linear);
583 }
584 }
585 imageBG.SetAlpha(0f);
586 imageGrid.SetAlpha(0f);
587 SkinConfig skin = base.config.skin;
588 imageBG.DOFade(skin.bgColor.a, 0.4f).SetEase(Ease.OutQuint);
589 imageGrid.DOFade(skin.gridColor.a, 0.4f).SetEase(Ease.OutQuint);
590 }
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: