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

Classes

class  Item
 
class  Page
 

Public Types

enum  Mode {
  Help , Announce , Book , Parchment ,
  Gallery , About
}
 

Public Member Functions

void Search (string s)
 
void ClearSearch ()
 
void ModPage (int a)
 
void Show (string _idFile=null, string _idTopic=null, string title=null, BookList.Item _bookItem=null)
 
void Show ()
 
void BuildPages ()
 
void AddPage (Page page)
 
void RefreshTopics ()
 
void AddButtonClose ()
 
UIButton AddButton (string lang, Action action)
 

Public Attributes

Mode mode
 
int currentPage
 
List< Pagepages = new List<Page>()
 
UINote note
 
UINote note2
 
UINote noteSearch
 
UIList list
 
UIDynamicList listSearchResult
 
UIText textTitle
 
UIText textPage
 
UIText textPage2
 
string idFile
 
string idTopic
 
string idFirstFile
 
string idFirstTopic
 
SkinRootStatic skin
 
LayoutGroup layoutButton
 
UIButton moldButton
 
BookList.Item bookItem
 
Scrollbar scrollbar
 
Window window
 
UIButton buttonPrev
 
UIButton buttonNext
 
InputField inputSearch
 
UIButton buttonClear
 
UIScrollView scrollView
 
Transform transSearchResult
 
string lastSearch
 
bool showSearchResult
 
float searchResultHeight
 
float marginSearchResult
 
Color colorSearchHit
 

Static Public Attributes

static string str_pc
 
static string searchWord
 
static Dictionary< string, string > helpTitles = new Dictionary<string, string>()
 
static SearchContext searchContext
 

Private Member Functions

void Awake ()
 
void Update ()
 

Detailed Description

Definition at line 8 of file UIBook.cs.

Member Enumeration Documentation

◆ Mode

Enumerator
Help 
Announce 
Book 
Parchment 
Gallery 
About 

Definition at line 10 of file UIBook.cs.

Member Function Documentation

◆ AddButton()

UIButton UIBook.AddButton ( string  lang,
Action  action 
)
inline

Definition at line 621 of file UIBook.cs.

624 {
625 item2 = item3;
626 idFirstFile = null;
627 }
628 }
629 list.Refresh();
630 if (item2 != null)
UIList list
Definition: UIBook.cs:274
string idFirstFile
Definition: UIBook.cs:291
virtual void Refresh(bool highlightLast=false)
Definition: UIList.cs:424

◆ AddButtonClose()

void UIBook.AddButtonClose ( )
inline

Definition at line 613 of file UIBook.cs.

616 {
617 item.items.Add(item3);
618 }
619 else

Referenced by UIBook.Page.BuildNote().

◆ AddPage()

void UIBook.AddPage ( Page  page)
inline

Definition at line 538 of file UIBook.cs.

539 {
540 page.idx = pages.Count;
541 pages.Add(page);
542 page.book = this;
543 }
List< Page > pages
Definition: UIBook.cs:266

References pages.

Referenced by BuildPages(), and ContentGallery.Refresh().

◆ Awake()

void UIBook.Awake ( )
inlineprivate

Definition at line 332 of file UIBook.cs.

333 {
334 if (searchContext == null || Application.isEditor)
335 {
338 }
339 if ((bool)inputSearch)
340 {
341 inputSearch.onValueChanged.AddListener(Search);
342 inputSearch.onSubmit.AddListener(Search);
343 lastSearch = null;
344 }
345 }
string lastSearch
Definition: UIBook.cs:320
InputField inputSearch
Definition: UIBook.cs:312
static SearchContext searchContext
Definition: UIBook.cs:330

References SearchContext.Init(), inputSearch, lastSearch, Search, and searchContext.

◆ BuildPages()

void UIBook.BuildPages ( )
inline

Definition at line 493 of file UIBook.cs.

494 {
495 pages.Clear();
496 string[] array = IO.LoadTextArray(CorePath.CorePackage.Help + idFile);
497 if (idFile == "version" && Lang.langCode == "CN")
498 {
500 }
501 if (array.IsEmpty())
502 {
504 }
505 if (array.IsEmpty())
506 {
508 }
509 if (array.IsEmpty())
510 {
512 }
513 if (array.IsEmpty())
514 {
516 }
517 Page page = new Page();
518 int num = 0;
519 string[] array2 = array;
520 foreach (string text in array2)
521 {
522 if (bookItem != null && num == 0)
523 {
524 num++;
525 continue;
526 }
527 if (text == "{p}")
528 {
529 AddPage(page);
530 page = new Page();
531 }
532 page.lines.Add(text);
533 num++;
534 }
535 AddPage(page);
536 }
static string Help
Definition: CorePath.cs:75
static string TextEN
Definition: CorePath.cs:69
static string Text
Definition: CorePath.cs:67
static string HelpEN
Definition: CorePath.cs:77
static string TextCommon
Definition: CorePath.cs:65
Definition: IO.cs:11
static string[] LoadTextArray(string _path)
Definition: IO.cs:470
Definition: Lang.cs:6
static string langCode
Definition: Lang.cs:28
void AddPage(Page page)
Definition: UIBook.cs:538
BookList.Item bookItem
Definition: UIBook.cs:302
string idFile
Definition: UIBook.cs:285

References AddPage(), bookItem, CorePath.CorePackage.Help, CorePath.CorePackage.HelpEN, idFile, Lang.langCode, pages, CorePath.CorePackage.Text, CorePath.CorePackage.TextCommon, and CorePath.CorePackage.TextEN.

Referenced by RefreshTopics(), and Show().

◆ ClearSearch()

void UIBook.ClearSearch ( )
inline

Definition at line 432 of file UIBook.cs.

433 {
434 inputSearch.text = "";
435 lastSearch = null;
436 }

References lastSearch.

◆ ModPage()

void UIBook.ModPage ( int  a)
inline

Definition at line 438 of file UIBook.cs.

439 {
440 SE.Play("read_paper");
441 if ((bool)note2)
442 {
443 a *= 2;
444 }
445 currentPage += a;
446 if (currentPage < 0)
447 {
448 currentPage = 0;
449 }
450 if (currentPage >= pages.Count)
451 {
452 currentPage = pages.Count - ((!note2) ? 1 : 2);
453 }
454 ShowPage(currentPage);
455 }
int currentPage
Definition: UIBook.cs:264
UINote note2
Definition: UIBook.cs:270

References currentPage, note2, and pages.

◆ RefreshTopics()

void UIBook.RefreshTopics ( )
inline

Definition at line 545 of file UIBook.cs.

546 {
547 string[] array = IO.LoadTextArray(CorePath.CorePackage.Help + "_topics.txt");
548 List<UIList> lists = new List<UIList>();
549 lists.Add(list);
550 list.Clear();
551 list.callbacks = new UIList.Callback<Item, ButtonCategory>
552 {
553 onClick = delegate(Item a, ButtonCategory b)
554 {
555 if (a.items.Count > 0)
556 {
557 b.buttonFold.onClick.Invoke();
558 }
559 else
560 {
561 idFile = a.idFile;
562 idTopic = a.id;
563 textTitle.SetText(a.title);
564 BuildPages();
565 ShowPage();
566 }
567 },
568 onInstantiate = delegate(Item a, ButtonCategory b)
569 {
570 b.mainText.text = a.title;
571 bool flag = false;
572 if (a.items.Count > 0)
573 {
574 foreach (Item item4 in a.items)
575 {
576 if (item4.idFile == idFile && item4.id == idTopic)
577 {
578 flag = true;
579 }
580 }
581 }
582 b.SetFold(a.items.Count > 0, !flag, delegate(UIList l)
583 {
584 lists.Add(l);
585 foreach (Item item5 in a.items)
586 {
587 l.Add(item5);
588 }
589 });
590 },
591 onRefresh = null
592 };
593 string oldValue = '\t'.ToString();
594 Item item = null;
595 Item item2 = null;
596 helpTitles.Clear();
597 string[] array2 = array;
598 for (int i = 0; i < array2.Length; i++)
599 {
600 string[] array3 = array2[i].Replace(oldValue, "").Split(',');
601 string[] array4 = array3[0].Split('-');
602 Item item3 = new Item
603 {
604 idFile = array4[0],
605 id = array4[1],
606 title = array3[1]
607 };
608 helpTitles[array3[0]] = item3.title.Replace("$", "");
609 if (item3.title.StartsWith("$"))
610 {
611 item = item3;
item3. title
Definition: UIBook.cs:616
UIButton buttonFold
void SetFold(bool show, bool folded)
string idTopic
Definition: UIBook.cs:288
UIText textTitle
Definition: UIBook.cs:278
static Dictionary< string, string > helpTitles
Definition: UIBook.cs:259
void BuildPages()
Definition: UIBook.cs:493
Definition: UIList.cs:9
override void Clear()
Definition: UIList.cs:349
void SetText(string s)
Definition: UIText.cs:159

References BuildPages(), ButtonCategory.buttonFold, UIList.Clear(), CorePath.CorePackage.Help, helpTitles, UIBook.Item.id, UIBook.Item.idFile, idFile, idTopic, item, UIBook.Item.items, list, ButtonCategory.SetFold(), UIText.SetText(), textTitle, UIBook.Item.title, and title.

Referenced by Show().

◆ Search()

void UIBook.Search ( string  s)
inline

Definition at line 369 of file UIBook.cs.

370 {
371 if (s == lastSearch)
372 {
373 return;
374 }
375 lastSearch = s;
376 if (s.IsEmpty())
377 {
378 return;
379 }
380 transSearchResult.SetActive(enable: true);
382 listSearchResult.callbacks = new UIList.Callback<SearchContext.Item, UIButton>
383 {
384 onClick = delegate(SearchContext.Item a, UIButton b)
385 {
386 if (!a.system)
387 {
388 SE.Play("click_recipe");
389 searchWord = s;
390 Show(a.idFile, a.idTopic);
391 }
392 },
393 onRedraw = delegate(SearchContext.Item a, UIButton b, int i)
394 {
395 if (a.system)
396 {
397 b.mainText.text = "";
398 b.subText.text = a.text;
399 }
400 else
401 {
402 string text = helpTitles.TryGetValue(a.idFile + "-") ?? "";
403 string text2 = helpTitles.TryGetValue(a.idFile + "-" + a.idTopic) ?? a.idTopic;
404 b.mainText.text = (text.IsEmpty() ? "" : (text + " - ")) + text2;
405 string text3 = a.text;
406 if (!text3.Contains("</color>"))
407 {
408 int num = a.textSearch.IndexOf(s.ToLower());
409 if (num != -1)
410 {
411 text3 = text3.Substring(0, num) + text3.Substring(num, s.Length).TagColor(colorSearchHit) + text3.Substring(num + s.Length);
412 }
413 }
414 b.subText.text = text3;
415 }
416 },
417 onList = delegate
418 {
420 {
422 }
423 },
424 onRefresh = null
425 };
427 scrollView.content.RebuildLayout(recursive: true);
428 RectTransform rectTransform = transSearchResult.Rect();
429 rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, Mathf.Min(searchResultHeight, scrollView.content.sizeDelta.y + marginSearchResult));
430 }
List< Item > Search(string s)
static string searchWord
Definition: UIBook.cs:257
void Show()
Definition: UIBook.cs:470
UIDynamicList listSearchResult
Definition: UIBook.cs:276
float marginSearchResult
Definition: UIBook.cs:326
UIScrollView scrollView
Definition: UIBook.cs:316
float searchResultHeight
Definition: UIBook.cs:324
Color colorSearchHit
Definition: UIBook.cs:328
Transform transSearchResult
Definition: UIBook.cs:318
override void List()
override void Add(object o)
override void Clear()

References UIDynamicList.Add(), UIDynamicList.Clear(), colorSearchHit, helpTitles, item, lastSearch, UIDynamicList.List(), listSearchResult, marginSearchResult, scrollView, SearchContext.Search(), searchContext, searchResultHeight, searchWord, Show(), and transSearchResult.

◆ Show() [1/2]

void UIBook.Show ( )
inline

Definition at line 470 of file UIBook.cs.

471 {
472 note.Clear();
473 if ((bool)note2)
474 {
475 note2.Clear();
476 }
477 if ((bool)layoutButton)
478 {
479 moldButton = layoutButton.CreateMold<UIButton>();
480 }
481 if (mode == Mode.Help)
482 {
486 }
487 else
488 {
489 ShowPage(currentPage);
490 }
491 }
Mode
Definition: UIBook.cs:11
void RefreshTopics()
Definition: UIBook.cs:545
Mode mode
Definition: UIBook.cs:261
LayoutGroup layoutButton
Definition: UIBook.cs:298
string idFirstTopic
Definition: UIBook.cs:294
UIButton moldButton
Definition: UIBook.cs:300
UINote note
Definition: UIBook.cs:268
void Clear()
Definition: UINote.cs:35

References UINote.Clear(), currentPage, idFile, idFirstFile, idFirstTopic, idTopic, layoutButton, mode, moldButton, note, note2, and RefreshTopics().

Referenced by Search(), and Show().

◆ Show() [2/2]

void UIBook.Show ( string  _idFile = null,
string  _idTopic = null,
string  title = null,
BookList::Item  _bookItem = null 
)
inline

Definition at line 457 of file UIBook.cs.

458 {
459 if (!title.IsEmpty() && (bool)window)
460 {
462 }
463 idFile = _idFile;
464 idTopic = _idTopic;
465 bookItem = _bookItem;
466 BuildPages();
467 Show();
468 }
Window window
Definition: UIBook.cs:306
UIText textCaption
Definition: Window.cs:610

References bookItem, BuildPages(), idFile, idTopic, UIText.SetText(), Show(), Window.textCaption, title, and window.

Referenced by LayerHelp.OnAfterInit(), ContentGallery.Refresh(), and LayerHelp.Toggle().

◆ Update()

void UIBook.Update ( )
inlineprivate

Definition at line 347 of file UIBook.cs.

348 {
349 if ((bool)inputSearch)
350 {
351 if (inputSearch.isFocused)
352 {
353 showSearchResult = true;
354 }
355 else if (Input.GetMouseButtonDown(0) && !InputModuleEX.IsPointerOver(scrollView) && !InputModuleEX.IsPointerOver(inputSearch))
356 {
357 showSearchResult = false;
358 }
359 buttonClear.SetActive(inputSearch.text != "");
360 transSearchResult.SetActive((inputSearch.isFocused || showSearchResult) && inputSearch.text != "");
361 if (Input.GetKeyDown(KeyCode.Escape) && inputSearch.text == "")
362 {
364 EInput.Consume(consumeAxis: false, 5);
365 }
366 }
367 }
Definition: EInput.cs:8
static void Consume(int _skipFrame)
Definition: EInput.cs:656
static bool IsPointerOver(Component c)
virtual void Close()
Definition: Layer.cs:463
bool showSearchResult
Definition: UIBook.cs:322
UIButton buttonClear
Definition: UIBook.cs:314
Layer layer
Definition: Window.cs:677

References buttonClear, Layer.Close(), EInput.Consume(), inputSearch, InputModuleEX.IsPointerOver(), Window.layer, scrollView, showSearchResult, transSearchResult, and window.

Member Data Documentation

◆ bookItem

BookList.Item UIBook.bookItem

Definition at line 302 of file UIBook.cs.

Referenced by BuildPages(), and Show().

◆ buttonClear

UIButton UIBook.buttonClear

Definition at line 314 of file UIBook.cs.

Referenced by Update().

◆ buttonNext

UIButton UIBook.buttonNext

Definition at line 310 of file UIBook.cs.

◆ buttonPrev

UIButton UIBook.buttonPrev

Definition at line 308 of file UIBook.cs.

◆ colorSearchHit

Color UIBook.colorSearchHit

Definition at line 328 of file UIBook.cs.

Referenced by UIBook.Page.BuildNote(), and Search().

◆ currentPage

int UIBook.currentPage

Definition at line 264 of file UIBook.cs.

Referenced by ModPage(), ContentGallery.OnDestroy(), Show(), and ContentGallery.ToggleMode().

◆ helpTitles

Dictionary<string, string> UIBook.helpTitles = new Dictionary<string, string>()
static

Definition at line 259 of file UIBook.cs.

Referenced by RefreshTopics(), and Search().

◆ idFile

string UIBook.idFile

Definition at line 285 of file UIBook.cs.

Referenced by BuildPages(), LayerHelp.OnDestroy(), RefreshTopics(), and Show().

◆ idFirstFile

string UIBook.idFirstFile

Definition at line 291 of file UIBook.cs.

Referenced by Show().

◆ idFirstTopic

string UIBook.idFirstTopic

Definition at line 294 of file UIBook.cs.

Referenced by Show().

◆ idTopic

string UIBook.idTopic

Definition at line 288 of file UIBook.cs.

Referenced by UIBook.Page.BuildNote(), LayerHelp.OnDestroy(), RefreshTopics(), and Show().

◆ inputSearch

InputField UIBook.inputSearch

Definition at line 312 of file UIBook.cs.

Referenced by Awake(), LayerHelp.OnRightClick(), and Update().

◆ lastSearch

string UIBook.lastSearch

Definition at line 320 of file UIBook.cs.

Referenced by Awake(), ClearSearch(), and Search().

◆ layoutButton

LayoutGroup UIBook.layoutButton

Definition at line 298 of file UIBook.cs.

Referenced by Show().

◆ list

UIList UIBook.list

Definition at line 274 of file UIBook.cs.

Referenced by RefreshTopics().

◆ listSearchResult

UIDynamicList UIBook.listSearchResult

Definition at line 276 of file UIBook.cs.

Referenced by Search().

◆ marginSearchResult

float UIBook.marginSearchResult

Definition at line 326 of file UIBook.cs.

Referenced by Search().

◆ mode

Mode UIBook.mode

◆ moldButton

UIButton UIBook.moldButton

Definition at line 300 of file UIBook.cs.

Referenced by Show().

◆ note

UINote UIBook.note

Definition at line 268 of file UIBook.cs.

Referenced by Show().

◆ note2

UINote UIBook.note2

Definition at line 270 of file UIBook.cs.

Referenced by ModPage(), and Show().

◆ noteSearch

UINote UIBook.noteSearch

Definition at line 272 of file UIBook.cs.

◆ pages

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

Definition at line 266 of file UIBook.cs.

Referenced by AddPage(), BuildPages(), ModPage(), and ContentGallery.Refresh().

◆ scrollbar

Scrollbar UIBook.scrollbar

Definition at line 304 of file UIBook.cs.

◆ scrollView

UIScrollView UIBook.scrollView

Definition at line 316 of file UIBook.cs.

Referenced by Search(), and Update().

◆ searchContext

SearchContext UIBook.searchContext
static

Definition at line 330 of file UIBook.cs.

Referenced by Awake(), and Search().

◆ searchResultHeight

float UIBook.searchResultHeight

Definition at line 324 of file UIBook.cs.

Referenced by Search().

◆ searchWord

string UIBook.searchWord
static

Definition at line 257 of file UIBook.cs.

Referenced by UIBook.Page.BuildNote(), and Search().

◆ showSearchResult

bool UIBook.showSearchResult

Definition at line 322 of file UIBook.cs.

Referenced by Update().

◆ skin

SkinRootStatic UIBook.skin

Definition at line 296 of file UIBook.cs.

◆ str_pc

string UIBook.str_pc
static

Definition at line 255 of file UIBook.cs.

Referenced by UIBook.Page.BuildNote().

◆ textPage

UIText UIBook.textPage

Definition at line 280 of file UIBook.cs.

◆ textPage2

UIText UIBook.textPage2

Definition at line 282 of file UIBook.cs.

◆ textTitle

UIText UIBook.textTitle

Definition at line 278 of file UIBook.cs.

Referenced by RefreshTopics().

◆ transSearchResult

Transform UIBook.transSearchResult

Definition at line 318 of file UIBook.cs.

Referenced by LayerHelp.OnRightClick(), Search(), and Update().

◆ window

Window UIBook.window

Definition at line 306 of file UIBook.cs.

Referenced by Show(), and Update().


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