Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
LayerGacha Class Reference
Inheritance diagram for LayerGacha:
ELayer Layer IUISkin

Public Member Functions

override void OnAfterInit ()
 
void OnClickGoldGacha (int num)
 
void OnClickSilverGacha (int num)
 
void PlayGacha (bool gold, int num)
 
void RefreshCoin ()
 
void OnClickBuyCoin ()
 
override void OnKill ()
 
- Public Member Functions inherited from ELayer
override void OnBeforeAddLayer ()
 
void InitInspector ()
 
sealed override void Init ()
 
override void OnAfterAddLayer ()
 
void TryShowHelp ()
 
void AddLayerToUI (string id)
 
void TryShowHint (string _langHint=null)
 
void TalkHomeMemeber (string id)
 
void TalkMaid (string id)
 
override void OnRightClick ()
 
- Public Member Functions inherited from Layer
virtual string GetTextHeader (Window window)
 
virtual bool HeaderIsListOf (int id)
 
virtual void Init ()
 
virtual void OnInit ()
 
virtual void OnAfterInit ()
 
virtual void ApplySkin ()
 
void ShowScreenLock (string id)
 
void UpdateInput ()
 
virtual void OnUpdateInput ()
 
virtual void OnRightClick ()
 
virtual bool OnBack ()
 
virtual void OnChangeLayer ()
 
virtual void OnCreate ()
 
void _AddLayer (string id)
 
Layer AddLayer (string id)
 
AddLayer< T > ()
 
AddLayer< T > (string id)
 
AddLayerDontCloseOthers< T > ()
 
Layer AddLayerDontCloseOthers (Layer l)
 
GetOrAddLayer< T > ()
 
virtual void OnBeforeAddLayer ()
 
virtual void OnAfterAddLayer ()
 
Layer AddLayer (Layer l)
 
void ToggleLayer (string id)
 
ToggleLayer< T > (string id=null)
 
void WaitAndClose ()
 
void OnClickClose ()
 
virtual void Close ()
 
void CloseLayers ()
 
void RemoveLayers (bool removeImportant=false)
 
bool RemoveLayer< T > ()
 
void RemoveLayer (Layer l)
 
virtual void OnKill ()
 
Layer SetOnKill (Action action)
 
void DisableClose ()
 
void Delay (float duration=0.05f)
 
Layer SetDelay (float d)
 
Layer GetLayer (string id)
 
GetLayer< T > (bool fromTop=false)
 
Layer GetTopLayer ()
 
void SwitchContent (int idWindow, int i)
 
virtual void OnSwitchContent (Window window)
 
Layer SetTitles (string langList, string idHeaderRow=null)
 
bool IsBlockWidgetClick ()
 
bool IsHideHud ()
 
bool IsAllowGeneralInput ()
 
bool IsUseBlur ()
 
bool IsPointerOnLayer ()
 
void ApplySkin ()
 

Public Attributes

GameObject goFree
 
Color colorC
 
Color colorR
 
Color colorSR
 
Color colorSSR
 
Color colorLE
 
DOTweenAnimation[] randomAnimes
 
bool alt
 
UIList listCoin
 
- Public Attributes inherited from Layer
Option option
 
UnityEvent onKill
 
Anime animeIn
 
Anime animeOut
 
bool closeOthers
 
bool defaultActionMode = true
 
Button screenLock
 
Layer parent
 
string idLayer
 
List< Layerlayers = new List<Layer>()
 
Vector2 lastParentPos
 
List< Windowwindows = new List<Window>()
 
string langHint
 

Static Public Attributes

static GameObject slot
 
- Static Public Attributes inherited from Layer
static int skipInput
 
static bool closeOnRightClick
 
static bool rightClicked
 
static bool cancelKeyDown
 
static bool ignoreSounds
 
static Transform blurStopInstance
 
static string[] searchPath = new string[3] { "Layer", "Layer/Dialog", "Layer/LayerHome" }
 

Private Member Functions

void RandomAnime ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ELayer
static int rnd (int a)
 
- Static Public Member Functions inherited from Layer
static T Create< T > ()
 
static T Create< T > (string path)
 
static Layer Create (string path)
 
- Protected Member Functions inherited from ELayer
sealed override void _Close ()
 
sealed override void Kill ()
 
- Protected Member Functions inherited from Layer
virtual void Awake ()
 
virtual void _Close ()
 
virtual void Kill ()
 
- Protected Attributes inherited from Layer
RectTransform _rect
 
bool isDestroyed
 
- Properties inherited from ELayer
static Core core [get]
 
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static FactionBranch Branch [get]
 
static Faction Home [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static CoreConfig config [get]
 
static GameSetting setting [get]
 
static ColorProfile Colors [get]
 
static SourceManager sources [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 
bool IsFloat [get]
 
virtual string IdHelp [get]
 
- Properties inherited from Layer
Layer TopLayer [get]
 
string uid [get]
 
virtual RectTransform rectLayers [get]
 
virtual bool blockWidgetClick [get]
 

Detailed Description

Definition at line 4 of file LayerGacha.cs.

Member Function Documentation

◆ OnAfterInit()

override void LayerGacha.OnAfterInit ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 26 of file LayerGacha.cs.

27 {
28 Msg.TalkHomeMemeber("layerGacha");
29 if (alt)
30 {
32 }
34 InvokeRepeating("RandomAnime", 2f, 2f);
35 }
void Activate(bool toggle=true, bool forceActivate=false)
Definition: ActionMode.cs:339
static AM_NoMap NoMap
Definition: ActionMode.cs:25
void RefreshCoin()
Definition: LayerGacha.cs:154
bool alt
Definition: LayerGacha.cs:22
Definition: Msg.cs:5
static PopItem TalkHomeMemeber(string id)
Definition: Msg.cs:219

References ActionMode.Activate(), alt, ActionMode.NoMap, RefreshCoin(), and Msg.TalkHomeMemeber().

◆ OnClickBuyCoin()

void LayerGacha.OnClickBuyCoin ( )
inline

Definition at line 172 of file LayerGacha.cs.

173 {
174 SE.Beep();
175 }

◆ OnClickGoldGacha()

void LayerGacha.OnClickGoldGacha ( int  num)
inline

Definition at line 42 of file LayerGacha.cs.

43 {
44 PlayGacha(gold: true, num);
45 }
void PlayGacha(bool gold, int num)
Definition: LayerGacha.cs:52

References PlayGacha().

◆ OnClickSilverGacha()

void LayerGacha.OnClickSilverGacha ( int  num)
inline

Definition at line 47 of file LayerGacha.cs.

48 {
49 PlayGacha(gold: false, num);
50 }

References PlayGacha().

◆ OnKill()

override void LayerGacha.OnKill ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 177 of file LayerGacha.cs.

178 {
179 if (alt)
180 {
182 }
183 }
static ActionMode DefaultMode
Definition: ActionMode.cs:7

References ActionMode.Activate(), alt, and ActionMode.DefaultMode.

◆ PlayGacha()

void LayerGacha.PlayGacha ( bool  gold,
int  num 
)
inline

Definition at line 52 of file LayerGacha.cs.

53 {
54 Thing thing = null;
55 if (ELayer.player.dailyGacha && !gold && num == 1)
56 {
57 ELayer.player.dailyGacha = false;
58 }
59 else
60 {
61 thing = ELayer.pc.things.Find("gacha_coin", gold ? "gold" : "silver");
62 if (thing == null || thing.Num < num)
63 {
64 SE.Beep();
65 return;
66 }
67 thing.ModNum(-num);
68 }
70 Dialog d = Layer.Create("DialogGacha") as Dialog;
71 d.windows[0].setting.textCaption = "confirm".lang();
72 d.note.AddPrefab("Media/Graphics/Image/IllustGacha");
73 d.note.Space();
74 bool lose = true;
75 for (int i = 0; i < num; i++)
76 {
77 int num2 = 1;
78 if (ELayer.rnd(6) == 0)
79 {
80 num2 = 2;
81 }
82 if (ELayer.rnd(30) == 0)
83 {
84 num2 = 3;
85 }
86 if (ELayer.rnd(100) == 0)
87 {
88 num2 = 4;
89 }
90 if (ELayer.rnd(1000) == 0)
91 {
92 num2 = 5;
93 }
94 if (gold)
95 {
96 num2++;
97 }
98 if (i == 9)
99 {
100 if (gold)
101 {
102 if (num2 < 4)
103 {
104 num2 = 4;
105 }
106 }
107 else if (num2 < 3)
108 {
109 num2 = 3;
110 }
111 }
112 if (num2 > 5)
113 {
114 num2 = 5;
115 }
117 int rarity = item.Source.rarity;
118 if (rarity == 4 || rarity == 5)
119 {
120 lose = false;
121 }
122 d.note.AddText(null, item.Name(1), ELayer.Colors.GetRarityColor(rarity));
123 }
124 d.note.Space();
125 if (thing == null)
126 {
127 d.note.AddText("dailyGacha".lang() + " 1 > 0");
128 }
129 else
130 {
131 d.note.AddText(thing.NameSimple + " " + (thing.Num + num) + " > " + thing.Num);
132 }
133 d.note.Build();
134 d.windows[0].Find<Transform>("GachaAnime").SetActive(enable: true);
135 d.list.AddButton(null, Lang.Get("ok"), delegate
136 {
137 d.Close();
138 });
139 ELayer.ui.AddLayer(d);
140 ELayer.Sound.Play("gacha");
141 TweenUtil.Delay(0.5f, delegate
142 {
143 ELayer.Sound.Play(lose ? "gacha_lose" : "gacha_win");
144 });
145 d.SetOnKill(delegate
146 {
147 if (!lose)
148 {
149 Msg.TalkHomeMemeber("ding_other");
150 }
151 });
152 }
ThingContainer things
Definition: Card.cs:34
string NameSimple
Definition: Card.cs:2015
int Num
Definition: Card.cs:154
void ModNum(int a, bool notify=true)
Definition: Card.cs:3262
Color GetRarityColor(int r, bool light=false)
Definition: Dialog.cs:7
UINote note
Definition: Dialog.cs:23
UIButtonList list
Definition: Dialog.cs:25
Definition: ELayer.cs:4
static Chara pc
Definition: ELayer.cs:15
static Player player
Definition: ELayer.cs:13
static int rnd(int a)
Definition: ELayer.cs:49
static ColorProfile Colors
Definition: ELayer.cs:35
static UI ui
Definition: ELayer.cs:21
static SoundManager Sound
Definition: ELayer.cs:41
Item AddRandom(int r, bool msg=true)
Definition: Hoard.cs:149
Definition: Lang.cs:6
static string Get(string id)
Definition: Lang.cs:91
Definition: Layer.cs:9
List< Window > windows
Definition: Layer.cs:116
static Layer Create(string path)
Definition: Layer.cs:299
Layer SetOnKill(Action action)
Definition: Layer.cs:579
bool dailyGacha
Definition: Player.cs:778
Hoard hoard
Definition: Player.cs:892
Thing Find(int uid)
Definition: Thing.cs:8
void AddButton(object obj, string text, Action onClick, Action< UIButton > onInstantiate=null)
Definition: UIButtonList.cs:11
Transform AddPrefab(string path)
Definition: UINote.cs:218
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void Build()
Definition: UINote.cs:49

References UIButtonList.AddButton(), UINote.AddPrefab(), Hoard.AddRandom(), UINote.AddText(), UINote.Build(), ELayer.Colors, Layer.Create(), Player.dailyGacha, ThingContainer.Find(), Lang.Get(), ColorProfile.GetRarityColor(), Player.hoard, item, Dialog.list, Card.ModNum(), Card.NameSimple, Dialog.note, Card.Num, ELayer.pc, ELayer.player, RefreshCoin(), ELayer.rnd(), Layer.SetOnKill(), ELayer.Sound, UINote.Space(), Msg.TalkHomeMemeber(), Card.things, ELayer.ui, and Layer.windows.

Referenced by OnClickGoldGacha(), and OnClickSilverGacha().

◆ RandomAnime()

void LayerGacha.RandomAnime ( )
inlineprivate

Definition at line 37 of file LayerGacha.cs.

38 {
39 randomAnimes.RandomItem().DORestart();
40 }
DOTweenAnimation[] randomAnimes
Definition: LayerGacha.cs:20

References randomAnimes.

◆ RefreshCoin()

void LayerGacha.RefreshCoin ( )
inline

Definition at line 154 of file LayerGacha.cs.

155 {
156 goFree.SetActive(ELayer.player.dailyGacha);
157 listCoin.Clear();
158 listCoin.callbacks = new UIList.Callback<Thing, ButtonGrid>
159 {
160 onInstantiate = delegate(Thing a, ButtonGrid b)
161 {
162 b.SetCard(a);
163 },
164 onClick = delegate(Thing a, ButtonGrid b)
165 {
166 ELayer.ui.AddLayer<LayerInfo>().Set(a);
167 }
168 };
170 }
void SetCard(Card c, Mode mode=Mode.Default, Action< UINote > onWriteNote=null)
Definition: ButtonGrid.cs:184
GameObject goFree
Definition: LayerGacha.cs:8
UIList listCoin
Definition: LayerGacha.cs:24
Definition: UIList.cs:9
override void Clear()
Definition: UIList.cs:349
virtual void Refresh(bool highlightLast=false)
Definition: UIList.cs:424

References UIList.Clear(), Player.dailyGacha, goFree, listCoin, ELayer.player, UIList.Refresh(), ButtonGrid.SetCard(), and ELayer.ui.

Referenced by OnAfterInit(), and PlayGacha().

Member Data Documentation

◆ alt

bool LayerGacha.alt

Definition at line 22 of file LayerGacha.cs.

Referenced by OnAfterInit(), and OnKill().

◆ colorC

Color LayerGacha.colorC

Definition at line 10 of file LayerGacha.cs.

◆ colorLE

Color LayerGacha.colorLE

Definition at line 18 of file LayerGacha.cs.

◆ colorR

Color LayerGacha.colorR

Definition at line 12 of file LayerGacha.cs.

◆ colorSR

Color LayerGacha.colorSR

Definition at line 14 of file LayerGacha.cs.

◆ colorSSR

Color LayerGacha.colorSSR

Definition at line 16 of file LayerGacha.cs.

◆ goFree

GameObject LayerGacha.goFree

Definition at line 8 of file LayerGacha.cs.

Referenced by RefreshCoin().

◆ listCoin

UIList LayerGacha.listCoin

Definition at line 24 of file LayerGacha.cs.

Referenced by RefreshCoin().

◆ randomAnimes

DOTweenAnimation [] LayerGacha.randomAnimes

Definition at line 20 of file LayerGacha.cs.

Referenced by RandomAnime().

◆ slot

GameObject LayerGacha.slot
static

Definition at line 6 of file LayerGacha.cs.


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