Elin Decompiled Documentation EA 23.102 Nightly
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
WidgetMascot Class Reference
Inheritance diagram for WidgetMascot:
Widget EMono IChangeResolution ISkinRoot

Public Member Functions

override void OnActivate ()
 
void _Update ()
 
override void OnFlip ()
 
void Say (string[] lines)
 
void Say (string str)
 
override void OnSetContextMenu (UIContextMenu m)
 
- 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 ()
 

Public Attributes

RawImage image
 
UIText text
 
int intervalSay
 
string[] linesDefault
 
string[] linesSiege
 
string[] linesShutup
 
Vector2 textPos
 
- Public Attributes inherited from Widget
Image imageBG
 
SoundData soundActivate
 
UIDragPanel dragPanel
 
RectTransform tipPivotLeft
 
RectTransform tipPivotRight
 

Properties

override bool ShowStyleMenu [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 Member Functions

void Update ()
 

Private Attributes

int nextSay = 2
 
bool first = true
 
bool isSiege
 
bool isShut
 

Additional Inherited Members

- Public Types inherited from Widget
enum  WidgetType { Default , ZoomMenu }
 
enum  State { Active , Inactive }
 
- Static Public Member Functions inherited from EMono
static int rnd (int a)
 
- Static Public Attributes inherited from EMono
static Core core
 
- 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 5 of file WidgetMascot.cs.

Member Function Documentation

◆ _Update()

void WidgetMascot._Update ( )
inline

Definition at line 69 of file WidgetMascot.cs.

70 {
71 if (nextSay > 0)
72 {
73 nextSay--;
74 }
75 else
76 {
77 if (isShut)
78 {
79 return;
80 }
81 isSiege = EMono._zone.events.GetEvent<ZoneEventSiege>() != null;
82 string[] array = (isSiege ? linesSiege : linesDefault);
83 if (array != null)
84 {
85 string str = ((EMono.rnd(2) == 0) ? "" : array.RandomItem());
86 if (first)
87 {
88 str = array[0];
89 first = false;
90 }
91 Say(str);
92 }
93 }
94 }
Definition: EMono.cs:4
static Zone _zone
Definition: EMono.cs:19
static int rnd(int a)
Definition: EMono.cs:47
string[] linesDefault
Definition: WidgetMascot.cs:13
void Say(string[] lines)
string[] linesSiege
Definition: WidgetMascot.cs:15
ZoneEventManager events
Definition: Zone.cs:40

References EMono._zone, Zone.events, first, isShut, isSiege, linesDefault, linesSiege, nextSay, EMono.rnd(), and Say().

◆ OnActivate()

override void WidgetMascot.OnActivate ( )
inlinevirtual

Reimplemented from Widget.

Definition at line 31 of file WidgetMascot.cs.

32 {
33 string path = string.Concat(CorePath.coreWidget + base.config.id + "/", "default.png");
34 string obj = Lang.setting.dir + "Widget/" + base.config.id + "/";
35 string path2 = obj + "default.txt";
36 string path3 = obj + "siege.txt";
37 string path4 = obj + "shutup.txt";
38 if (File.Exists(path2))
39 {
41 }
42 if (File.Exists(path3))
43 {
45 }
46 if (File.Exists(path4))
47 {
49 }
50 if (File.Exists(path))
51 {
52 image.texture = IO.LoadPNG(path);
53 }
54 Say("");
55 InvokeRepeating("_Update", 1f, 1f);
56 }
static string coreWidget
Definition: CorePath.cs:188
Definition: IO.cs:11
static string[] LoadTextArray(string _path)
Definition: IO.cs:470
static Texture2D LoadPNG(string _path, FilterMode filter=FilterMode.Point)
Definition: IO.cs:421
string[] linesShutup
Definition: WidgetMascot.cs:17

References CorePath.coreWidget, linesDefault, linesShutup, linesSiege, and Say().

◆ OnFlip()

override void WidgetMascot.OnFlip ( )
inlinevirtual

Reimplemented from Widget.

Definition at line 96 of file WidgetMascot.cs.

97 {
98 image.transform.localScale = new Vector3(flip ? 1 : (-1), 1f, 1f);
99 }
bool flip
Definition: Widget.cs:164

References Widget.flip.

◆ OnSetContextMenu()

override void WidgetMascot.OnSetContextMenu ( UIContextMenu  m)
inlinevirtual

Reimplemented from Widget.

Definition at line 126 of file WidgetMascot.cs.

127 {
128 m.AddToggle("shutup", isShut, delegate(bool a)
129 {
130 isShut = a;
131 base.config.annoyPlayer = isShut;
132 if (isShut)
133 {
135 }
136 });
138 }
UIContextMenuItem AddToggle(string idLang="", bool isOn=false, UnityAction< bool > action=null)
void SetBaseContextMenu(UIContextMenu m)
Definition: Widget.cs:608

References UIContextMenu.AddToggle(), isShut, linesShutup, Say(), and Widget.SetBaseContextMenu().

◆ Say() [1/2]

void WidgetMascot.Say ( string  str)
inline

Definition at line 106 of file WidgetMascot.cs.

107 {
108 Transform parent = text.transform.parent;
109 if (str.IsEmpty())
110 {
111 parent.SetActive(enable: false);
112 }
113 else
114 {
115 parent.SetActive(enable: true);
116 text.text = str;
118 }
120 if (isSiege)
121 {
122 nextSay /= 2;
123 }
124 }
UIText text
Definition: WidgetMascot.cs:9
Vector2 textPos
Definition: WidgetMascot.cs:19
void ClampToScreenEnsured(Component c, Vector2 anchoredPos)
Definition: Widget.cs:424

References Widget.ClampToScreenEnsured(), intervalSay, isSiege, nextSay, EMono.rnd(), text, and textPos.

◆ Say() [2/2]

void WidgetMascot.Say ( string[]  lines)
inline

Definition at line 101 of file WidgetMascot.cs.

102 {
103 Say(lines.RandomItem());
104 }

References Say().

Referenced by _Update(), OnActivate(), OnSetContextMenu(), and Say().

◆ Update()

void WidgetMascot.Update ( )
inlineprivate

Definition at line 58 of file WidgetMascot.cs.

59 {
60 if (isShut && InputModuleEX.IsPointerOver(base.transform))
61 {
62 SE.Play("teleport");
63 base.transform.position = new Vector3(EMono.rnd(Screen.width), EMono.rnd(Screen.height), 0f);
66 }
67 }
static bool IsPointerOver(Component c)
void OnChangePosition()
Definition: Widget.cs:462
void ClampToScreen()
Definition: Widget.cs:437

References Widget.ClampToScreen(), InputModuleEX.IsPointerOver(), isShut, Widget.OnChangePosition(), and EMono.rnd().

Member Data Documentation

◆ first

bool WidgetMascot.first = true
private

Definition at line 23 of file WidgetMascot.cs.

Referenced by _Update().

◆ image

RawImage WidgetMascot.image

Definition at line 7 of file WidgetMascot.cs.

◆ intervalSay

int WidgetMascot.intervalSay

Definition at line 11 of file WidgetMascot.cs.

Referenced by Say().

◆ isShut

bool WidgetMascot.isShut
private

Definition at line 27 of file WidgetMascot.cs.

Referenced by _Update(), OnSetContextMenu(), and Update().

◆ isSiege

bool WidgetMascot.isSiege
private

Definition at line 25 of file WidgetMascot.cs.

Referenced by _Update(), and Say().

◆ linesDefault

string [] WidgetMascot.linesDefault

Definition at line 13 of file WidgetMascot.cs.

Referenced by _Update(), and OnActivate().

◆ linesShutup

string [] WidgetMascot.linesShutup

Definition at line 17 of file WidgetMascot.cs.

Referenced by OnActivate(), and OnSetContextMenu().

◆ linesSiege

string [] WidgetMascot.linesSiege

Definition at line 15 of file WidgetMascot.cs.

Referenced by _Update(), and OnActivate().

◆ nextSay

int WidgetMascot.nextSay = 2
private

Definition at line 21 of file WidgetMascot.cs.

Referenced by _Update(), and Say().

◆ text

UIText WidgetMascot.text

Definition at line 9 of file WidgetMascot.cs.

Referenced by Say().

◆ textPos

Vector2 WidgetMascot.textPos

Definition at line 19 of file WidgetMascot.cs.

Referenced by Say().

Property Documentation

◆ ShowStyleMenu

override bool WidgetMascot.ShowStyleMenu
get

Definition at line 29 of file WidgetMascot.cs.


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