Elin Modding Docs Doc
Loading...
Searching...
No Matches
MiniGame.cs
1using System;
2using System.Collections.Generic;
3using System.IO;
4using UnityEngine;
5
6// Token: 0x0200059E RID: 1438
7public class MiniGame
8{
9 // Token: 0x06002770 RID: 10096 RVA: 0x000DF7B4 File Offset: 0x000DD9B4
10 public static void RegisterMiniGame(string id, MiniGame g, string _path)
11 {
12 g.path = new FileInfo(_path).DirectoryName;
13 MiniGame.minigames[id] = g;
14 Debug.Log("Registered:" + ((g != null) ? g.ToString() : null) + " at " + g.path);
15 }
16
17 // Token: 0x06002771 RID: 10097 RVA: 0x000DF808 File Offset: 0x000DDA08
18 public static void Activate(MiniGame.Type type)
19 {
20 if (!MiniGame.minigames.ContainsKey("Basket"))
21 {
22 MiniGame.minigames.Add("Basket", new MiniGame_Basket());
23 }
24 if (!MiniGame.minigames.ContainsKey("Blackjack"))
25 {
26 MiniGame.minigames.Add("Blackjack", new MiniGame_Blackjack());
27 }
28 Debug.Log("Activating:" + type.ToString());
29 MiniGame miniGame = MiniGame.minigames.TryGetValue(type.ToString(), null);
30 if (miniGame == null)
31 {
32 Msg.Say("minigame_notSupported");
33 return;
34 }
35 LayerMiniGame layerMiniGame = EClass.ui.AddLayer<LayerMiniGame>();
36 Debug.Log(layerMiniGame);
37 Debug.Log(miniGame);
38 miniGame.balance = new MiniGame.Balance();
39 layerMiniGame.mini = miniGame;
40 layerMiniGame.type = type;
41 Debug.Log("aaa");
42 layerMiniGame.Run();
43 }
44
45 // Token: 0x17000BAD RID: 2989
46 // (get) Token: 0x06002772 RID: 10098 RVA: 0x000DF8E1 File Offset: 0x000DDAE1
47 public virtual string id
48 {
49 get
50 {
51 return "";
52 }
53 }
54
55 // Token: 0x06002773 RID: 10099 RVA: 0x000DF8E8 File Offset: 0x000DDAE8
56 public virtual void OnActivate()
57 {
58 }
59
60 // Token: 0x06002774 RID: 10100 RVA: 0x000DF8EA File Offset: 0x000DDAEA
61 public virtual void OnDeactivate()
62 {
63 }
64
65 // Token: 0x06002775 RID: 10101 RVA: 0x000DF8EC File Offset: 0x000DDAEC
66 public void Deactivate()
67 {
68 this.OnDeactivate();
69 Debug.Log(this.balance.lastCoin);
70 Debug.Log(this.balance.changeCoin);
71 if (this.balance.changeCoin != 0)
72 {
73 EClass.pc.ModCurrency(this.balance.changeCoin, "casino_coin");
74 }
75 LayerMiniGame layer = EClass.ui.GetLayer<LayerMiniGame>(false);
76 if (layer != null)
77 {
78 layer.mini = null;
79 layer.Close();
80 }
81 }
82
83 // Token: 0x06002776 RID: 10102 RVA: 0x000DF974 File Offset: 0x000DDB74
84 public void SetAudioMixer(GameObject go)
85 {
86 AudioSource[] componentsInChildren = go.GetComponentsInChildren<AudioSource>();
87 for (int i = 0; i < componentsInChildren.Length; i++)
88 {
89 componentsInChildren[i].outputAudioMixerGroup = SoundManager.current.mixer.FindMatchingGroups("SFX")[0];
90 }
91 }
92
93 // Token: 0x06002777 RID: 10103 RVA: 0x000DF9B4 File Offset: 0x000DDBB4
94 public void Say(string lang)
95 {
96 Msg.Say(lang);
97 }
98
99 // Token: 0x06002778 RID: 10104 RVA: 0x000DF9BD File Offset: 0x000DDBBD
100 public virtual bool CanExit()
101 {
102 return true;
103 }
104
105 // Token: 0x06002779 RID: 10105 RVA: 0x000DF9C0 File Offset: 0x000DDBC0
106 public void Exit()
107 {
108 LayerMiniGame layer = EClass.ui.GetLayer<LayerMiniGame>(false);
109 if (layer == null)
110 {
111 return;
112 }
113 layer.Close();
114 }
115
116 // Token: 0x0600277A RID: 10106 RVA: 0x000DF9D8 File Offset: 0x000DDBD8
117 public bool OnPlay(int a)
118 {
119 LayerMiniGame layer = EClass.ui.GetLayer<LayerMiniGame>(false);
120 if (layer)
121 {
122 switch (layer.type)
123 {
124 case MiniGame.Type.Slot:
125 EClass.pc.ModExp(134, 10);
126 break;
127 case MiniGame.Type.Blackjack:
128 EClass.pc.ModExp(135, 10);
129 break;
130 case MiniGame.Type.Basket:
131 EClass.pc.ModExp(108, 15);
132 break;
133 }
134 }
135 EClass.pc.stamina.Mod(-a);
136 EClass.player.EndTurn(true);
137 return !EClass.pc.isDead && !EClass.pc.IsDisabled;
138 }
139
140 // Token: 0x0600277B RID: 10107 RVA: 0x000DFA84 File Offset: 0x000DDC84
141 public void GetSlotReward(string id, int pay = 1, int bet = 1)
142 {
143 if (id == null)
144 {
145 id = new string[]
146 {
147 "ehe",
148 "wild",
149 "cat",
150 "larnneire",
151 "lomias",
152 "bread"
153 }.RandomItem<string>();
154 Debug.Log(id);
155 }
156 Thing c = ThingGen.Create("casino_coin", -1, -1).SetNum(pay * bet);
157 Msg.Say("slot_win", c, null, null, null);
158 }
159
160 // Token: 0x040015E6 RID: 5606
161 public static Dictionary<string, MiniGame> minigames = new Dictionary<string, MiniGame>();
162
163 // Token: 0x040015E7 RID: 5607
164 public MiniGame.Balance balance = new MiniGame.Balance();
165
166 // Token: 0x040015E8 RID: 5608
167 public GameObject go;
168
169 // Token: 0x040015E9 RID: 5609
170 public AssetBundle asset;
171
172 // Token: 0x040015EA RID: 5610
173 public string path;
174
175 // Token: 0x040015EB RID: 5611
176 public bool isActive;
177
178 // Token: 0x02000AE8 RID: 2792
179 public class Balance
180 {
181 // Token: 0x04002C39 RID: 11321
182 public int lastCoin;
183
184 // Token: 0x04002C3A RID: 11322
185 public int changeCoin;
186 }
187
188 // Token: 0x02000AE9 RID: 2793
189 public enum Type
190 {
191 // Token: 0x04002C3C RID: 11324
192 Slot,
193 // Token: 0x04002C3D RID: 11325
194 Blackjack,
195 // Token: 0x04002C3E RID: 11326
196 Scratch,
197 // Token: 0x04002C3F RID: 11327
198 Basket,
199 // Token: 0x04002C40 RID: 11328
200 CoinDrop
201 }
202}
Definition Msg.cs:7
Definition Thing.cs:10