Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Hotbar Class Reference
Inheritance diagram for Hotbar:
EClass

Classes

class  Page
 

Public Types

enum  Type { Default , Main , ZoomMenu }
 

Public Member Functions

void SetSlotNum (int a)
 
void AddPage ()
 
void ValidatePage (Page page, int num=-1)
 
void SetPage (int pageIndex)
 
void Remove (HotItem item)
 
HotItem GetItem (int index, int pageIndex=-1)
 
HotItem SetItem (HotItem item, int index=-1, int pageIndex=-1, bool refreshActor=false)
 
void Select (HotItem item)
 
void ToggleDisable (HotItem item)
 
void Unselect (int pageIndex=-1)
 
HotItem GetSelectedItem ()
 
int GetNextSelectableIndex (int pageIndex=-1)
 
int GetPrevSelectableIndex (int pageIndex=-1)
 

Public Attributes

int currentPage
 
int itemsPerPage = 6
 
int id
 
List< Pagepages = new List<Page>()
 
bool dirty
 
WidgetHotbar actor
 

Static Public Attributes

const int IDMainMenu = 2
 
const int IDBuild = 3
 
const int IDUser2 = 5
 
const int IDUser3 = 6
 
const int IDSpeed = 7
 
- Static Public Attributes inherited from EClass
static Core core
 

Properties

HotbarManager manager [get]
 
HotItem SelectedItem [get]
 
HotItem DefaultItem [get]
 
bool IsLocked [get]
 
bool IsUserHotbar [get]
 
bool ShowFunctionKey [get]
 
Page CurrentPage [get]
 
- Properties inherited from EClass
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 Faction Wilds [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 SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Detailed Description

Definition at line 4 of file Hotbar.cs.

Member Enumeration Documentation

◆ Type

Enumerator
Default 
Main 
ZoomMenu 

Definition at line 6 of file Hotbar.cs.

7 {
9 Main,
11 }

Member Function Documentation

◆ AddPage()

void Hotbar.AddPage ( )
inline

Definition at line 126 of file Hotbar.cs.

127 {
128 Page page = new Page();
129 pages.Add(page);
130 ValidatePage(page);
131 }
void ValidatePage(Page page, int num=-1)
Definition: Hotbar.cs:133
List< Page > pages
Definition: Hotbar.cs:87

References pages, and ValidatePage().

Referenced by HotbarManager.SetHobar(), and SetItem().

◆ GetItem()

HotItem Hotbar.GetItem ( int  index,
int  pageIndex = -1 
)
inline

Definition at line 168 of file Hotbar.cs.

169 {
170 return pages[(pageIndex == -1) ? currentPage : pageIndex].GetItem(index);
171 }
HotItem GetItem(int index, int pageIndex=-1)
Definition: Hotbar.cs:168
int currentPage
Definition: Hotbar.cs:78

References currentPage, GetItem(), and pages.

Referenced by GetItem(), and WidgetHotbar.RebuildPage().

◆ GetNextSelectableIndex()

int Hotbar.GetNextSelectableIndex ( int  pageIndex = -1)
inline

Definition at line 238 of file Hotbar.cs.

239 {
240 if (pageIndex == -1)
241 {
242 pageIndex = currentPage;
243 }
244 Page page = pages[pageIndex];
245 int num = page.selected + 1;
246 if (num >= itemsPerPage)
247 {
248 num = -1;
249 }
250 ValidatePage(page);
251 return num;
252 }
int itemsPerPage
Definition: Hotbar.cs:81

References currentPage, itemsPerPage, pages, and ValidatePage().

◆ GetPrevSelectableIndex()

int Hotbar.GetPrevSelectableIndex ( int  pageIndex = -1)
inline

Definition at line 254 of file Hotbar.cs.

255 {
256 if (pageIndex == -1)
257 {
258 pageIndex = currentPage;
259 }
260 Page page = pages[pageIndex];
261 int num = page.selected - 1;
262 if (num < -1)
263 {
264 num = itemsPerPage - 1;
265 }
266 ValidatePage(page);
267 return num;
268 }

References currentPage, itemsPerPage, pages, and ValidatePage().

◆ GetSelectedItem()

HotItem Hotbar.GetSelectedItem ( )
inline

Definition at line 228 of file Hotbar.cs.

229 {
230 int selected = pages[currentPage].selected;
231 if (selected == -1)
232 {
233 return null;
234 }
235 return pages[currentPage].items[selected];
236 }

References currentPage, and pages.

◆ Remove()

void Hotbar.Remove ( HotItem  item)
inline

Definition at line 154 of file Hotbar.cs.

155 {
156 for (int i = 0; i < pages.Count; i++)
157 {
158 for (int j = 0; j < pages[i].items.Count; j++)
159 {
160 if (pages[i].items[j] == item)
161 {
162 SetItem(null, j, i, refreshActor: true);
163 }
164 }
165 }
166 }
HotItem SetItem(HotItem item, int index=-1, int pageIndex=-1, bool refreshActor=false)
Definition: Hotbar.cs:173

References item, pages, and SetItem().

◆ Select()

void Hotbar.Select ( HotItem  item)
inline

Definition at line 199 of file Hotbar.cs.

200 {
201 SE.SelectHotitem();
203 }
Definition: EClass.cs:5
static Player player
Definition: EClass.cs:12
void SetCurrentHotItem(HotItem item)
Definition: Player.cs:2046

References item, EClass.player, and Player.SetCurrentHotItem().

Referenced by HotItemGameAction.OnClick(), and HotItemGameAction.OnRightClick().

◆ SetItem()

HotItem Hotbar.SetItem ( HotItem  item,
int  index = -1,
int  pageIndex = -1,
bool  refreshActor = false 
)
inline

Definition at line 173 of file Hotbar.cs.

174 {
175 if (item == null)
176 {
178 }
179 if (pageIndex == -1)
180 {
181 pageIndex = currentPage;
182 }
183 if (pageIndex >= pages.Count)
184 {
185 AddPage();
186 pageIndex = pages.Count - 1;
187 }
188 Page page = pages[pageIndex];
189 ValidatePage(page, index + 1);
190 page.SetItem(this, item, index);
191 item?.OnAddedToBar();
192 if (refreshActor && (bool)actor)
193 {
195 }
196 return item;
197 }
HotItem DefaultItem
Definition: Hotbar.cs:97
void AddPage()
Definition: Hotbar.cs:126
WidgetHotbar actor
Definition: Hotbar.cs:91
void RebuildPage(int page=-1)

References actor, AddPage(), currentPage, DefaultItem, item, pages, WidgetHotbar.RebuildPage(), Hotbar.Page.SetItem(), and ValidatePage().

Referenced by WidgetHotbar.OnSetContextMenu(), Remove(), HotbarManager.ResetHotbar(), and WidgetHotbar.SetItem().

◆ SetPage()

void Hotbar.SetPage ( int  pageIndex)
inline

Definition at line 149 of file Hotbar.cs.

150 {
151 currentPage = pageIndex;
152 }

References currentPage.

Referenced by WidgetHotbar.RebuildPage().

◆ SetSlotNum()

void Hotbar.SetSlotNum ( int  a)
inline

Definition at line 117 of file Hotbar.cs.

118 {
119 itemsPerPage = a;
120 foreach (Page page in pages)
121 {
122 ValidatePage(page);
123 }
124 }

References itemsPerPage, pages, and ValidatePage().

Referenced by WidgetHotbar.OnSetContextMenu().

◆ ToggleDisable()

void Hotbar.ToggleDisable ( HotItem  item)
inline

Definition at line 205 of file Hotbar.cs.

206 {
207 item.disabled = !item.disabled;
208 if (item.disabled)
209 {
210 item.OnUnselect();
211 }
212 SE.SelectHotitem();
213 EClass.player.SetCurrentHotItem(item.disabled ? null : item);
214 }

References item, EClass.player, and Player.SetCurrentHotItem().

◆ Unselect()

void Hotbar.Unselect ( int  pageIndex = -1)
inline

Definition at line 216 of file Hotbar.cs.

217 {
218 if (pageIndex == -1)
219 {
220 pageIndex = currentPage;
221 }
222 HotItem selectedItem = pages[pageIndex].SelectedItem;
223 pages[pageIndex].selected = -1;
224 selectedItem?.OnUnselect();
226 }
virtual void OnUnselect()
Definition: HotItem.cs:87

References currentPage, HotItem.OnUnselect(), pages, EClass.player, and Player.SetCurrentHotItem().

◆ ValidatePage()

void Hotbar.ValidatePage ( Page  page,
int  num = -1 
)
inline

Definition at line 133 of file Hotbar.cs.

134 {
135 if (num != -1 && itemsPerPage < num)
136 {
137 itemsPerPage = num;
138 }
139 if (page.items.Count < itemsPerPage)
140 {
141 int num2 = itemsPerPage - page.items.Count;
142 for (int i = 0; i < num2; i++)
143 {
144 page.items.Add(DefaultItem);
145 }
146 }
147 }

References DefaultItem, Hotbar.Page.items, and itemsPerPage.

Referenced by AddPage(), GetNextSelectableIndex(), GetPrevSelectableIndex(), SetItem(), and SetSlotNum().

Member Data Documentation

◆ actor

WidgetHotbar Hotbar.actor

Definition at line 91 of file Hotbar.cs.

Referenced by WidgetHotbar.OnEndDrag(), HotbarManager.ResetHotbar(), and SetItem().

◆ currentPage

◆ dirty

bool Hotbar.dirty

Definition at line 89 of file Hotbar.cs.

Referenced by WidgetHotbar.OnChangeActionMode(), and BuildMenu.Toggle().

◆ id

int Hotbar.id

Definition at line 84 of file Hotbar.cs.

Referenced by WidgetHotbar.OnSetContextMenu().

◆ IDBuild

const int Hotbar.IDBuild = 3
static

Definition at line 69 of file Hotbar.cs.

◆ IDMainMenu

const int Hotbar.IDMainMenu = 2
static

Definition at line 67 of file Hotbar.cs.

◆ IDSpeed

const int Hotbar.IDSpeed = 7
static

Definition at line 75 of file Hotbar.cs.

◆ IDUser2

const int Hotbar.IDUser2 = 5
static

Definition at line 71 of file Hotbar.cs.

◆ IDUser3

const int Hotbar.IDUser3 = 6
static

Definition at line 73 of file Hotbar.cs.

◆ itemsPerPage

int Hotbar.itemsPerPage = 6

◆ pages

List<Page> Hotbar.pages = new List<Page>()

Property Documentation

◆ CurrentPage

Page Hotbar.CurrentPage
get

Definition at line 115 of file Hotbar.cs.

Referenced by WidgetHotbar.GetItem(), WidgetHotbar.Rebuild(), and HotItem.TextHotkey().

◆ DefaultItem

HotItem Hotbar.DefaultItem
get

Definition at line 97 of file Hotbar.cs.

Referenced by SetItem(), and ValidatePage().

◆ IsLocked

bool Hotbar.IsLocked
get

Definition at line 99 of file Hotbar.cs.

Referenced by WidgetHotbar.OnSetContextMenu(), and LayerRegisterHotbar.Show().

◆ IsUserHotbar

bool Hotbar.IsUserHotbar
get

Definition at line 101 of file Hotbar.cs.

102 {
103 get
104 {
105 if (id != 5)
106 {
107 return id == 6;
108 }
109 return true;
110 }
111 }

Referenced by WidgetHotbar.CanShowContextMenu(), and ButtonHotItem.RefreshItem().

◆ manager

HotbarManager Hotbar.manager
get

Definition at line 93 of file Hotbar.cs.

◆ SelectedItem

HotItem Hotbar.SelectedItem
get

Definition at line 95 of file Hotbar.cs.

◆ ShowFunctionKey

bool Hotbar.ShowFunctionKey
get

Definition at line 113 of file Hotbar.cs.

Referenced by HotItem.TextHotkey().


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