PlayerData.cs 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651
  1. //================================================================================
  2. //
  3. //================================================================================
  4. using UnityEngine;
  5. using System.Collections;
  6. //================================================================================
  7. //
  8. //================================================================================
  9. namespace ReaderRabbit
  10. {
  11. //================================================================================
  12. // Progress report.
  13. //================================================================================
  14. public enum ProgressType
  15. {
  16. None = 0,
  17. Unknown,
  18. Ok,
  19. Good,
  20. Wow,
  21. };
  22. //================================================================================
  23. // Videos played ingame.
  24. //================================================================================
  25. public enum VideoType
  26. {
  27. Introduction = 0,
  28. CloudNine,
  29. QueenCumulus,
  30. ArtGallery,
  31. Irvin,
  32. EndGame,
  33. Quantity,
  34. // The following two videos are not locked/unlocked because the player cannot play them in Options/Movies screen.
  35. GameTitle,
  36. CompanyLogo,
  37. GotoRaingearIsland,
  38. GotoEdgeOfCloudNine,
  39. };
  40. //================================================================================
  41. // DowntownCloudNine.
  42. //================================================================================
  43. public enum DCN_BackTypeEnum
  44. {
  45. // Queen Cumulus will speak different phrases based on the following player actions.
  46. DidNotVisitIslandFirstTimeOnly = 0,
  47. DidNotVisitIsland,
  48. AfterVisitingIslandFirstTimeOnly,
  49. AfterVisitingIsland,
  50. AfterVisitingIrvinsHouseFirstTimeOnly,
  51. AfterVisitingIrvinsHouse,
  52. };
  53. //================================================================================
  54. //
  55. //================================================================================
  56. public class PlayerData
  57. {
  58. //================================================================================
  59. // Singleton
  60. //================================================================================
  61. private static PlayerData s_Instance = null;
  62. public static PlayerData Instance()
  63. {
  64. if (s_Instance == null)
  65. s_Instance = new PlayerData();
  66. return s_Instance;
  67. }
  68. //================================================================================
  69. //
  70. //================================================================================
  71. const string PRACTICE_MODE_FILENAME = "_practice_mode_";
  72. private bool m_IsPracticeMode;
  73. private string m_PlayerName;
  74. private ItemState[] m_Items;
  75. private int m_SandwichCount;
  76. private int m_RedMarbleCount;
  77. private int m_OrangeMarbleCount;
  78. private int m_YellowMarbleCount;
  79. private int m_GreenMarbleCount;
  80. private int m_BlueMarbleCount;
  81. private int m_UsedRedMarbleCount;
  82. private int m_UsedOrangeMarbleCount;
  83. private int m_UsedYellowMarbleCount;
  84. private int m_UsedGreenMarbleCount;
  85. private int m_UsedBlueMarbleCount;
  86. private bool[] m_Visited;
  87. private Location m_CurrentLocation;
  88. private Location m_PreviousLocation;
  89. // Flags for blocked scenes.
  90. private bool[] m_BlockedLocation;
  91. private bool[] BlockedLocation =
  92. {
  93. true, //EdgeOfCloudNine,
  94. true, //CloudNineGateway,
  95. false, //CloudSpellingChallenge,
  96. false, //DowntownCloudNine,
  97. false, //CloudNineArtGallery,
  98. false, //AmazingArtGallery,
  99. true, //CloudSheepCrossing,
  100. false, //NewspaperCarrierScene,
  101. false, //RaingearIsland,
  102. false, //IrvinsHouse,
  103. false, //GumballScience,
  104. true, //RaingearThrowingMachine,
  105. false, //MusicalMarblePatterns,
  106. false, //RaingearForest,
  107. false, //RaingearForestMath,
  108. false, //SillySandwichShop,
  109. true, //RockHead,
  110. false, //FlowerpotPhonics,
  111. false, //RaingearRescue,
  112. };
  113. // Player levels.
  114. private int[] m_ActivityLevel;
  115. private bool[] m_IsActivityLocked;
  116. private bool[] m_IsActivityAutoLevel;
  117. private ProgressType[] m_ProgressLevel1;
  118. private ProgressType[] m_ProgressLevel2;
  119. private ProgressType[] m_ProgressLevel3;
  120. private int[] m_RaingearRescueProgressLevels;
  121. private int m_AmazingArtGalleryPagesCreated;
  122. private bool[] m_IsVideoLocked;
  123. private bool m_IsBackgroundMusicEnabled;
  124. private bool m_IsPrinterEnabled;
  125. // EdgeOfCloudNine
  126. private bool m_EOCN_IsSecondTime;
  127. private bool m_EOCN_IsCloudVisible;
  128. // CloudSpellingChallenge
  129. private int m_CSC_WinsCount;
  130. // CloudNineGateway
  131. private bool m_CNG_IsFirstClickWelcomeSign;
  132. private bool m_CNG_IsFirstClickPaigeWithoutBell;
  133. private bool m_CNG_IsFirstClickPaigeWithBell;
  134. private bool m_CNG_IsFirstClickPaigeAfterOpeningGate;
  135. private bool m_CNG_IsFirstClickReaderWithoutBell;
  136. private bool m_CNG_IsFirstClickReaderWithBell;
  137. private bool m_CNG_IsFirstClickReaderAfterOpeningGate;
  138. // DowntownCloudNine
  139. private DCN_BackTypeEnum m_DCN_BackType;
  140. private int m_DCN_BackAfterIrvinsHouseQueenSpeech;
  141. private int m_DCN_EnteredFromCatapultCount;
  142. private bool m_DCN_IsFirstClickCloudNineArtGallery;
  143. private bool m_DCN_BackAfterOneItem;
  144. private bool m_DCN_BackAfterTwoItems;
  145. private bool m_DCN_BackAfterThreeItems;
  146. // CloudSheepCrossing
  147. private bool m_CSC_IsFirstWhistle;
  148. private bool m_CSC_IsFirstSheepClick;
  149. // RaingearIslandRainbow
  150. private int m_RGIR_Direction;
  151. // NewspaperCarrierScene
  152. private bool m_NCS_IsSecondTime;
  153. private bool m_NCS_IsCarryInScene;
  154. private bool m_NCS_IsFirstClickRainbow;
  155. private bool m_NCS_IsFirstClickCarry;
  156. private bool m_NCS_IsFirstTimeWithWagon;
  157. // IrvinsHouse
  158. private int m_IH_GameState;
  159. private int m_IH_ReEntryCount;
  160. private bool m_IH_IsFirstFromRaingearThrowingMachine;
  161. // RaingearThrowingMachine
  162. private int m_RTM_VisitCount;
  163. private int m_RTM_UsedCatapultCount;
  164. private bool m_RTM_IsFluffySleeping;
  165. private bool m_RTM_IsCatapultReady;
  166. private bool m_RTM_IsFirstSandwich;
  167. // RockHead
  168. private int m_RH_GameState;
  169. private bool m_RH_IsFirstTimeFromRainbow;
  170. private bool m_RH_DidTalkToRockHead;
  171. private int m_RH_RockClickCount;
  172. // CloudNineArtGallery
  173. private int m_CNAG_GameState;
  174. private bool m_CNAG_DidSaySS4Speech;
  175. private bool m_CNAG_DidSayAct4Speech;
  176. private bool m_CNAG_IsFirstEditSpeech;
  177. private bool m_CNAG_IsFromSample;
  178. private int m_CNAG_VisitCount;
  179. // AmazingArtGallery
  180. private int m_AAG_NextClickCount;
  181. private bool m_AAG_PaigeClicked;
  182. private int m_AAG_Enter1Count;
  183. private int m_AAG_Enter2Count;
  184. private int m_AAG_Enter3Count;
  185. private bool m_AAG_PaintUsed;
  186. private bool m_AAG_EraseUsed;
  187. private bool m_AAG_StampUsed;
  188. private bool m_AAG_FillUsed;
  189. private bool m_AAG_BombUsed;
  190. private bool m_AAG_TwoPagesUsed;
  191. private bool m_AAG_PlayUsed;
  192. private string m_AAG_framePath; //mycode --rafael
  193. // RaingearForestMath
  194. private int m_RFM_RoundsCompleted;
  195. // FlowerpotPhonics
  196. private int m_FP_GameState;
  197. private bool m_FP_WagonHere;
  198. private Map.MapOpenedType m_MapOpenedType;
  199. //================================================================================
  200. //
  201. //================================================================================
  202. public PlayerData()
  203. {
  204. Reset();
  205. }
  206. //================================================================================
  207. //
  208. //================================================================================
  209. public void Reset()
  210. {
  211. m_PlayerName = "";
  212. if (m_Items == null)
  213. m_Items = new ItemState[(int)ItemEnum.Quantity];
  214. for (int i = 0; i < (int)ItemEnum.Quantity; ++i)
  215. m_Items[i] = ItemState.None;
  216. m_SandwichCount = 0;
  217. m_RedMarbleCount = 0;
  218. m_OrangeMarbleCount = 0;
  219. m_YellowMarbleCount = 0;
  220. m_GreenMarbleCount = 0;
  221. m_BlueMarbleCount = 0;
  222. m_UsedRedMarbleCount = 0;
  223. m_UsedOrangeMarbleCount = 0;
  224. m_UsedYellowMarbleCount = 0;
  225. m_UsedGreenMarbleCount = 0;
  226. m_UsedBlueMarbleCount = 0;
  227. if (m_Visited == null)
  228. m_Visited = new bool[(int)Location.Quantity];
  229. if (m_BlockedLocation == null)
  230. m_BlockedLocation = new bool[(int)Location.Quantity];
  231. for (int i = 0; i < (int)Location.Quantity; ++i)
  232. {
  233. m_Visited[i] = false;
  234. m_BlockedLocation[i] = true;
  235. }
  236. m_CurrentLocation = Location.EdgeOfCloudNine;
  237. m_PreviousLocation = Location.EdgeOfCloudNine;
  238. if (m_ActivityLevel == null)
  239. m_ActivityLevel = new int[(int)Activity.Quantity];
  240. if (m_IsActivityLocked == null)
  241. m_IsActivityLocked = new bool[(int)Activity.Quantity];
  242. if (m_IsActivityAutoLevel == null)
  243. m_IsActivityAutoLevel = new bool[(int)Activity.Quantity];
  244. for (int i = 0; i < (int)Activity.Quantity; ++i)
  245. {
  246. m_ActivityLevel[i] = 1;
  247. m_IsActivityLocked[i] = true;
  248. m_IsActivityAutoLevel[i] = true;
  249. }
  250. // We don't keep progress of Raingear Rescue and Amazing Art Gallery using ProgressType.
  251. // Raingear Rescue progress is defined by the number of times the player completed the activity.
  252. // Amazing Art Gallery progress is defined by the number of pages created in the activity.
  253. if (m_ProgressLevel1 == null)
  254. m_ProgressLevel1 = new ProgressType[(int)Activity.Quantity - 2];
  255. if (m_ProgressLevel2 == null)
  256. m_ProgressLevel2 = new ProgressType[(int)Activity.Quantity - 2];
  257. if (m_ProgressLevel3 == null)
  258. m_ProgressLevel3 = new ProgressType[(int)Activity.Quantity - 2];
  259. for (int i = 0; i < (int)Activity.Quantity - 2; ++i)
  260. {
  261. m_ProgressLevel1[i] = ProgressType.None;
  262. m_ProgressLevel2[i] = ProgressType.None;
  263. m_ProgressLevel3[i] = ProgressType.None;
  264. }
  265. if (m_RaingearRescueProgressLevels == null)
  266. m_RaingearRescueProgressLevels = new int[3];
  267. for (int i = 0; i < 3; ++i)
  268. m_RaingearRescueProgressLevels[i] = 0;
  269. m_AmazingArtGalleryPagesCreated = 0;
  270. if (m_IsVideoLocked == null)
  271. m_IsVideoLocked = new bool[(int)VideoType.Quantity];
  272. for (int i = 0; i < (int)VideoType.Quantity; ++i)
  273. m_IsVideoLocked[i] = true;
  274. m_IsBackgroundMusicEnabled = true;
  275. m_IsPrinterEnabled = true;
  276. ResetSceneSpecificVariables();
  277. m_MapOpenedType = Map.MapOpenedType.None;
  278. }
  279. //================================================================================
  280. //
  281. //================================================================================
  282. void ResetSceneSpecificVariables()
  283. {
  284. m_EOCN_IsSecondTime = false;
  285. m_EOCN_IsCloudVisible = true;
  286. m_CSC_WinsCount = 0;
  287. m_CNG_IsFirstClickWelcomeSign = true;
  288. m_CNG_IsFirstClickPaigeWithoutBell = true;
  289. m_CNG_IsFirstClickPaigeWithBell = true;
  290. m_CNG_IsFirstClickPaigeAfterOpeningGate = true;
  291. m_CNG_IsFirstClickReaderWithoutBell = true;
  292. m_CNG_IsFirstClickReaderWithBell = true;
  293. m_CNG_IsFirstClickReaderAfterOpeningGate = true;
  294. m_DCN_BackType = DCN_BackTypeEnum.DidNotVisitIslandFirstTimeOnly;
  295. m_DCN_BackAfterIrvinsHouseQueenSpeech = 0;
  296. m_DCN_EnteredFromCatapultCount = 0;
  297. m_DCN_IsFirstClickCloudNineArtGallery = true;
  298. m_DCN_BackAfterOneItem = false;
  299. m_DCN_BackAfterTwoItems = false;
  300. m_DCN_BackAfterThreeItems = false;
  301. m_CSC_IsFirstWhistle = true;
  302. m_CSC_IsFirstSheepClick = true;
  303. m_RGIR_Direction = 0;
  304. m_NCS_IsSecondTime = false;
  305. m_NCS_IsCarryInScene = true;
  306. m_NCS_IsFirstClickRainbow = true;
  307. m_NCS_IsFirstClickCarry = true;
  308. m_NCS_IsFirstTimeWithWagon = true;
  309. m_IH_GameState = 1;
  310. m_IH_ReEntryCount = 0;
  311. m_IH_IsFirstFromRaingearThrowingMachine = true;
  312. m_RTM_VisitCount = 0;
  313. m_RTM_UsedCatapultCount = 0;
  314. m_RTM_IsFluffySleeping = false;
  315. m_RTM_IsCatapultReady = false;
  316. m_RTM_IsFirstSandwich = true;
  317. m_RH_GameState = 1;
  318. m_RH_IsFirstTimeFromRainbow = true;
  319. m_RH_DidTalkToRockHead = false;
  320. m_RH_RockClickCount = 0;
  321. m_CNAG_GameState = 1;
  322. m_CNAG_DidSaySS4Speech = false;
  323. m_CNAG_DidSayAct4Speech = false;
  324. m_CNAG_IsFirstEditSpeech = true;
  325. m_CNAG_IsFromSample = false;
  326. m_CNAG_VisitCount = 0;
  327. m_AAG_NextClickCount = 0;
  328. m_AAG_PaigeClicked = false;
  329. m_AAG_Enter1Count = 0;
  330. m_AAG_Enter2Count = 0;
  331. m_AAG_Enter3Count = 0;
  332. m_AAG_PaintUsed = false;
  333. m_AAG_EraseUsed = false;
  334. m_AAG_StampUsed = false;
  335. m_AAG_FillUsed = false;
  336. m_AAG_framePath = ""; //mycode --rafael
  337. m_AAG_BombUsed = false;
  338. m_AAG_TwoPagesUsed = false;
  339. m_AAG_PlayUsed = false;
  340. m_RFM_RoundsCompleted = 0;
  341. m_FP_GameState = 1;
  342. m_FP_WagonHere = false;
  343. }
  344. //================================================================================
  345. //
  346. //================================================================================
  347. public bool IsPracticeMode()
  348. {
  349. return m_IsPracticeMode;
  350. }
  351. //================================================================================
  352. //
  353. //================================================================================
  354. public void SetPracticeMode(bool isPracticeMode)
  355. {
  356. m_IsPracticeMode = isPracticeMode;
  357. if (m_IsPracticeMode)
  358. {
  359. m_PlayerName = GameStrings.Instance().GetString(GameStringsEnum.PracticeMode);
  360. for (int i = 0; i < (int)ItemEnum.Quantity; ++i)
  361. m_Items[i] = ItemState.None;
  362. m_SandwichCount = 0;
  363. m_RedMarbleCount = 0;
  364. m_OrangeMarbleCount = 0;
  365. m_YellowMarbleCount = 0;
  366. m_GreenMarbleCount = 0;
  367. m_BlueMarbleCount = 0;
  368. m_UsedRedMarbleCount = 0;
  369. m_UsedOrangeMarbleCount = 0;
  370. m_UsedYellowMarbleCount = 0;
  371. m_UsedGreenMarbleCount = 0;
  372. m_UsedBlueMarbleCount = 0;
  373. for (int i = 0; i < (int)Location.Quantity; ++i)
  374. {
  375. m_Visited[i] = false;
  376. m_BlockedLocation[i] = true;
  377. }
  378. m_CurrentLocation = Location.Quantity;
  379. m_PreviousLocation = Location.Quantity;
  380. for (int i = 0; i < (int)Activity.Quantity; ++i)
  381. {
  382. m_ActivityLevel[i] = 1;
  383. m_IsActivityLocked[i] = false;
  384. m_IsActivityAutoLevel[i] = true;
  385. }
  386. for (int i = 0; i < (int)Activity.Quantity - 2; ++i)
  387. {
  388. m_ProgressLevel1[i] = ProgressType.None;
  389. m_ProgressLevel2[i] = ProgressType.None;
  390. m_ProgressLevel3[i] = ProgressType.None;
  391. }
  392. for (int i = 0; i < 3; ++i)
  393. m_RaingearRescueProgressLevels[i] = 0;
  394. m_AmazingArtGalleryPagesCreated = 0;
  395. // All videos are locked in Practice Mode.
  396. for (int i = 0; i < (int)VideoType.Quantity; ++i)
  397. m_IsVideoLocked[i] = true;
  398. m_IsBackgroundMusicEnabled = true;
  399. m_IsPrinterEnabled = true;
  400. ResetSceneSpecificVariables();
  401. }
  402. else
  403. {
  404. m_PlayerName = "";
  405. }
  406. }
  407. //================================================================================
  408. //
  409. //================================================================================
  410. public bool IsInActivity(Activity activity)
  411. {
  412. switch (activity)
  413. {
  414. case Activity.CloudSpellingChallenge:
  415. return m_CurrentLocation == Location.CloudSpellingChallenge;
  416. case Activity.RaingearForestMath:
  417. return m_CurrentLocation == Location.RaingearForestMath;
  418. case Activity.FlowerpotPhonics:
  419. return m_CurrentLocation == Location.FlowerpotPhonics;
  420. case Activity.SillySandwichShop:
  421. return m_CurrentLocation == Location.SillySandwichShop;
  422. case Activity.MusicalMarblePatterns:
  423. return m_CurrentLocation == Location.MusicalMarblePatterns;
  424. case Activity.GumballScience:
  425. return m_CurrentLocation == Location.GumballScience;
  426. case Activity.RaingearRescue:
  427. return m_CurrentLocation == Location.RaingearRescue;
  428. case Activity.AmazingArtGallery:
  429. return m_CurrentLocation == Location.AmazingArtGallery;
  430. }
  431. return false;
  432. }
  433. //================================================================================
  434. //
  435. //================================================================================
  436. public string GetPlayerName()
  437. {
  438. return m_PlayerName;
  439. }
  440. //================================================================================
  441. //
  442. //================================================================================
  443. public void SetPlayerName(string name)
  444. {
  445. m_PlayerName = name;
  446. }
  447. //================================================================================
  448. //
  449. //================================================================================
  450. public ItemState GetItemState(int index)
  451. {
  452. return m_Items[index];
  453. }
  454. //================================================================================
  455. //
  456. //================================================================================
  457. public ItemState GetItemState(ItemEnum item)
  458. {
  459. return m_Items[(int)item];
  460. }
  461. //================================================================================
  462. //
  463. //================================================================================
  464. public void SetItemState(ItemEnum item, ItemState state)
  465. {
  466. m_Items[(int)item] = state;
  467. }
  468. //================================================================================
  469. //
  470. //================================================================================
  471. public ItemState GetBell()
  472. {
  473. return m_Items[(int)ItemEnum.Bell];
  474. }
  475. //================================================================================
  476. //
  477. //================================================================================
  478. public void SetBell(ItemState state)
  479. {
  480. m_Items[(int)ItemEnum.Bell] = state;
  481. }
  482. //================================================================================
  483. //
  484. //================================================================================
  485. public ItemState GetWhistle()
  486. {
  487. return m_Items[(int)ItemEnum.Whistle];
  488. }
  489. //================================================================================
  490. //
  491. //================================================================================
  492. public void SetWhistle(ItemState state)
  493. {
  494. m_Items[(int)ItemEnum.Whistle] = state;
  495. }
  496. //================================================================================
  497. //
  498. //================================================================================
  499. public ItemState GetLadder()
  500. {
  501. return m_Items[(int)ItemEnum.Ladder];
  502. }
  503. //================================================================================
  504. //
  505. //================================================================================
  506. public void SetLadder(ItemState state)
  507. {
  508. m_Items[(int)ItemEnum.Ladder] = state;
  509. }
  510. //================================================================================
  511. //
  512. //================================================================================
  513. public ItemState GetWagon()
  514. {
  515. return m_Items[(int)ItemEnum.Wagon];
  516. }
  517. //================================================================================
  518. //
  519. //================================================================================
  520. public void SetWagon(ItemState state)
  521. {
  522. m_Items[(int)ItemEnum.Wagon] = state;
  523. }
  524. //================================================================================
  525. //
  526. //================================================================================
  527. public ItemState GetRubberBand()
  528. {
  529. return m_Items[(int)ItemEnum.RubberBand];
  530. }
  531. //================================================================================
  532. //
  533. //================================================================================
  534. public void SetRubberBand(ItemState state)
  535. {
  536. m_Items[(int)ItemEnum.RubberBand] = state;
  537. }
  538. //================================================================================
  539. //
  540. //================================================================================
  541. public ItemState GetHat()
  542. {
  543. return m_Items[(int)ItemEnum.Hat];
  544. }
  545. //================================================================================
  546. //
  547. //================================================================================
  548. public void SetHat(ItemState state)
  549. {
  550. m_Items[(int)ItemEnum.Hat] = state;
  551. }
  552. //================================================================================
  553. //
  554. //================================================================================
  555. public ItemState GetHoop()
  556. {
  557. return m_Items[(int)ItemEnum.Hoop];
  558. }
  559. //================================================================================
  560. //
  561. //================================================================================
  562. public void SetHoop(ItemState state)
  563. {
  564. m_Items[(int)ItemEnum.Hoop] = state;
  565. }
  566. //================================================================================
  567. //
  568. //================================================================================
  569. public ItemState GetPillow()
  570. {
  571. return m_Items[(int)ItemEnum.Pillow];
  572. }
  573. //================================================================================
  574. //
  575. //================================================================================
  576. public void SetPillow(ItemState state)
  577. {
  578. m_Items[(int)ItemEnum.Pillow] = state;
  579. }
  580. //================================================================================
  581. //
  582. //================================================================================
  583. public ItemState GetSandwich()
  584. {
  585. return m_Items[(int)ItemEnum.Sandwich];
  586. }
  587. //================================================================================
  588. //
  589. //================================================================================
  590. public void SetSandwich(ItemState state)
  591. {
  592. m_Items[(int)ItemEnum.Sandwich] = state;
  593. }
  594. //================================================================================
  595. //
  596. //================================================================================
  597. public ItemState GetRedMarble()
  598. {
  599. return m_Items[(int)ItemEnum.MarbleRed];
  600. }
  601. //================================================================================
  602. //
  603. //================================================================================
  604. public void SetRedMarble(ItemState state)
  605. {
  606. m_Items[(int)ItemEnum.MarbleRed] = state;
  607. }
  608. //================================================================================
  609. //
  610. //================================================================================
  611. public ItemState GetOrangeMarble()
  612. {
  613. return m_Items[(int)ItemEnum.MarbleOrange];
  614. }
  615. //================================================================================
  616. //
  617. //================================================================================
  618. public void SetOrangeMarble(ItemState state)
  619. {
  620. m_Items[(int)ItemEnum.MarbleOrange] = state;
  621. }
  622. //================================================================================
  623. //
  624. //================================================================================
  625. public ItemState GetYellowMarble()
  626. {
  627. return m_Items[(int)ItemEnum.MarbleYellow];
  628. }
  629. //================================================================================
  630. //
  631. //================================================================================
  632. public void SetYellowMarble(ItemState state)
  633. {
  634. m_Items[(int)ItemEnum.MarbleYellow] = state;
  635. }
  636. //================================================================================
  637. //
  638. //================================================================================
  639. public ItemState GetGreenMarble()
  640. {
  641. return m_Items[(int)ItemEnum.MarbleGreen];
  642. }
  643. //================================================================================
  644. //
  645. //================================================================================
  646. public void SetGreenMarble(ItemState state)
  647. {
  648. m_Items[(int)ItemEnum.MarbleGreen] = state;
  649. }
  650. //================================================================================
  651. //
  652. //================================================================================
  653. public ItemState GetBlueMarble()
  654. {
  655. return m_Items[(int)ItemEnum.MarbleBlue];
  656. }
  657. //================================================================================
  658. //
  659. //================================================================================
  660. public void SetBlueMarble(ItemState state)
  661. {
  662. m_Items[(int)ItemEnum.MarbleBlue] = state;
  663. }
  664. //================================================================================
  665. //
  666. //================================================================================
  667. public ItemState GetRubberBandNone()
  668. {
  669. return m_Items[(int)ItemEnum.RubberBandNone];
  670. }
  671. //================================================================================
  672. //
  673. //================================================================================
  674. public void SetRubberBandNone(ItemState state)
  675. {
  676. m_Items[(int)ItemEnum.RubberBandNone] = state;
  677. }
  678. //================================================================================
  679. //
  680. //================================================================================
  681. public ItemState GetHoopNone()
  682. {
  683. return m_Items[(int)ItemEnum.HoopNone];
  684. }
  685. //================================================================================
  686. //
  687. //================================================================================
  688. public void SetHoopNone(ItemState state)
  689. {
  690. m_Items[(int)ItemEnum.HoopNone] = state;
  691. }
  692. //================================================================================
  693. //
  694. //================================================================================
  695. public ItemState GetPillowNone()
  696. {
  697. return m_Items[(int)ItemEnum.PillowNone];
  698. }
  699. //================================================================================
  700. //
  701. //================================================================================
  702. public void SetPillowNone(ItemState state)
  703. {
  704. m_Items[(int)ItemEnum.PillowNone] = state;
  705. }
  706. //================================================================================
  707. //
  708. //================================================================================
  709. public int GetSandwichCount()
  710. {
  711. return m_SandwichCount;
  712. }
  713. //================================================================================
  714. //
  715. //================================================================================
  716. public void SetSandwichCount(int count)
  717. {
  718. m_SandwichCount = count;
  719. }
  720. //================================================================================
  721. //
  722. //================================================================================
  723. public void IncSandwichCount()
  724. {
  725. ++m_SandwichCount;
  726. }
  727. //================================================================================
  728. //
  729. //================================================================================
  730. public void DecSandwichCount()
  731. {
  732. --m_SandwichCount;
  733. }
  734. //================================================================================
  735. //
  736. //================================================================================
  737. public int GetRedMarbleCount()
  738. {
  739. return m_RedMarbleCount;
  740. }
  741. //================================================================================
  742. //
  743. //================================================================================
  744. public void SetRedMarbleCount(int count)
  745. {
  746. m_RedMarbleCount = count;
  747. }
  748. //================================================================================
  749. //
  750. //================================================================================
  751. public void IncRedMarbleCount()
  752. {
  753. ++m_RedMarbleCount;
  754. }
  755. //================================================================================
  756. //
  757. //================================================================================
  758. public void DecRedMarbleCount()
  759. {
  760. --m_RedMarbleCount;
  761. }
  762. //================================================================================
  763. //
  764. //================================================================================
  765. public int GetOrangeMarbleCount()
  766. {
  767. return m_OrangeMarbleCount;
  768. }
  769. //================================================================================
  770. //
  771. //================================================================================
  772. public void SetOrangeMarbleCount(int count)
  773. {
  774. m_OrangeMarbleCount = count;
  775. }
  776. //================================================================================
  777. //
  778. //================================================================================
  779. public void IncOrangeMarbleCount()
  780. {
  781. ++m_OrangeMarbleCount;
  782. }
  783. //================================================================================
  784. //
  785. //================================================================================
  786. public void DecOrangeMarbleCount()
  787. {
  788. --m_OrangeMarbleCount;
  789. }
  790. //================================================================================
  791. //
  792. //================================================================================
  793. public int GetYellowMarbleCount()
  794. {
  795. return m_YellowMarbleCount;
  796. }
  797. //================================================================================
  798. //
  799. //================================================================================
  800. public void SetYellowMarbleCount(int count)
  801. {
  802. m_YellowMarbleCount = count;
  803. }
  804. //================================================================================
  805. //
  806. //================================================================================
  807. public void IncYellowMarbleCount()
  808. {
  809. ++m_YellowMarbleCount;
  810. }
  811. //================================================================================
  812. //
  813. //================================================================================
  814. public void DecYellowMarbleCount()
  815. {
  816. --m_YellowMarbleCount;
  817. }
  818. //================================================================================
  819. //
  820. //================================================================================
  821. public int GetGreenMarbleCount()
  822. {
  823. return m_GreenMarbleCount;
  824. }
  825. //================================================================================
  826. //
  827. //================================================================================
  828. public void SetGreenMarbleCount(int count)
  829. {
  830. m_GreenMarbleCount = count;
  831. }
  832. //================================================================================
  833. //
  834. //================================================================================
  835. public void IncGreenMarbleCount()
  836. {
  837. ++m_GreenMarbleCount;
  838. }
  839. //================================================================================
  840. //
  841. //================================================================================
  842. public void DecGreenMarbleCount()
  843. {
  844. --m_GreenMarbleCount;
  845. }
  846. //================================================================================
  847. //
  848. //================================================================================
  849. public int GetBlueMarbleCount()
  850. {
  851. return m_BlueMarbleCount;
  852. }
  853. //================================================================================
  854. //
  855. //================================================================================
  856. public void SetBlueMarbleCount(int count)
  857. {
  858. m_BlueMarbleCount = count;
  859. }
  860. //================================================================================
  861. //
  862. //================================================================================
  863. public void IncBlueMarbleCount()
  864. {
  865. ++m_BlueMarbleCount;
  866. }
  867. //================================================================================
  868. //
  869. //================================================================================
  870. public void DecBlueMarbleCount()
  871. {
  872. --m_BlueMarbleCount;
  873. }
  874. //================================================================================
  875. //
  876. //================================================================================
  877. public bool DidVisit(int locationIndex)
  878. {
  879. return m_Visited[locationIndex];
  880. }
  881. //================================================================================
  882. //
  883. //================================================================================
  884. public bool DidVisit(Location location)
  885. {
  886. return m_Visited[(int)location];
  887. }
  888. //================================================================================
  889. //
  890. //================================================================================
  891. public bool DidVisit(SceneIndex sceneIndex)
  892. {
  893. switch (sceneIndex)
  894. {
  895. case SceneIndex.AmazingArtGallery:
  896. return m_Visited[(int)Location.AmazingArtGallery];
  897. case SceneIndex.CloudNineArtGallery:
  898. return m_Visited[(int)Location.CloudNineArtGallery];
  899. case SceneIndex.CloudNineGateway:
  900. return m_Visited[(int)Location.CloudNineGateway];
  901. case SceneIndex.CloudSheepCrossing:
  902. return m_Visited[(int)Location.CloudSheepCrossing];
  903. case SceneIndex.CloudSpellingChallenge:
  904. return m_Visited[(int)Location.CloudSpellingChallenge];
  905. case SceneIndex.DowntownCloudNine:
  906. return m_Visited[(int)Location.DowntownCloudNine];
  907. case SceneIndex.EdgeOfCloudNine:
  908. return m_Visited[(int)Location.EdgeOfCloudNine];
  909. case SceneIndex.FlowerpotPhonics:
  910. return m_Visited[(int)Location.FlowerpotPhonics];
  911. case SceneIndex.GumballScience:
  912. return m_Visited[(int)Location.GumballScience];
  913. case SceneIndex.IrvinsHouse:
  914. return m_Visited[(int)Location.IrvinsHouse];
  915. case SceneIndex.MusicalMarblePatterns:
  916. return m_Visited[(int)Location.MusicalMarblePatterns];
  917. case SceneIndex.NewspaperCarrierScene:
  918. return m_Visited[(int)Location.NewspaperCarrierScene];
  919. case SceneIndex.RaingearForest:
  920. return m_Visited[(int)Location.RaingearForest];
  921. case SceneIndex.RaingearForestMath:
  922. return m_Visited[(int)Location.RaingearForestMath];
  923. case SceneIndex.RaingearIsland:
  924. return m_Visited[(int)Location.RaingearIsland];
  925. case SceneIndex.RaingearRescue:
  926. return m_Visited[(int)Location.RaingearRescue];
  927. case SceneIndex.RaingearThrowingMachine:
  928. return m_Visited[(int)Location.RaingearThrowingMachine];
  929. case SceneIndex.RockHead:
  930. return m_Visited[(int)Location.RockHead];
  931. case SceneIndex.SillySandwichShop:
  932. return m_Visited[(int)Location.SillySandwichShop];
  933. }
  934. return false;
  935. }
  936. //================================================================================
  937. //
  938. //================================================================================
  939. public bool DidVisit(Activity activity)
  940. {
  941. switch (activity)
  942. {
  943. case Activity.CloudSpellingChallenge:
  944. return m_Visited[(int)Location.CloudSpellingChallenge];
  945. case Activity.RaingearForestMath:
  946. return m_Visited[(int)Location.RaingearForestMath];
  947. case Activity.FlowerpotPhonics:
  948. return m_Visited[(int)Location.FlowerpotPhonics];
  949. case Activity.SillySandwichShop:
  950. return m_Visited[(int)Location.SillySandwichShop];
  951. case Activity.MusicalMarblePatterns:
  952. return m_Visited[(int)Location.MusicalMarblePatterns];
  953. case Activity.GumballScience:
  954. return m_Visited[(int)Location.GumballScience];
  955. case Activity.RaingearRescue:
  956. return m_Visited[(int)Location.RaingearRescue];
  957. case Activity.AmazingArtGallery:
  958. return m_Visited[(int)Location.AmazingArtGallery];
  959. }
  960. return false;
  961. }
  962. //================================================================================
  963. //
  964. //================================================================================
  965. public void SetVisited(Location location, bool visited)
  966. {
  967. m_Visited[(int)location] = visited;
  968. }
  969. //================================================================================
  970. //
  971. //================================================================================
  972. public bool DidVisitEdgeOfCloudNine()
  973. {
  974. return m_Visited[(int)Location.EdgeOfCloudNine];
  975. }
  976. //================================================================================
  977. //
  978. //================================================================================
  979. public void SetVisitedEdgeOfCloudNine(bool visited)
  980. {
  981. m_Visited[(int)Location.EdgeOfCloudNine] = visited;
  982. }
  983. //================================================================================
  984. //
  985. //================================================================================
  986. public bool DidVisitCloudNineGateway()
  987. {
  988. return m_Visited[(int)Location.CloudNineGateway];
  989. }
  990. //================================================================================
  991. //
  992. //================================================================================
  993. public void SetVisitedCloudNineGateway(bool visited)
  994. {
  995. m_Visited[(int)Location.CloudNineGateway] = visited;
  996. }
  997. //================================================================================
  998. //
  999. //================================================================================
  1000. public bool DidVisitCloudSpellingChallenge()
  1001. {
  1002. return m_Visited[(int)Location.CloudSpellingChallenge];
  1003. }
  1004. //================================================================================
  1005. //
  1006. //================================================================================
  1007. public void SetVisitedCloudSpellingChallenge(bool visited)
  1008. {
  1009. m_Visited[(int)Location.CloudSpellingChallenge] = visited;
  1010. }
  1011. //================================================================================
  1012. //
  1013. //================================================================================
  1014. public bool DidVisitDowntownCloudNine()
  1015. {
  1016. return m_Visited[(int)Location.DowntownCloudNine];
  1017. }
  1018. //================================================================================
  1019. //
  1020. //================================================================================
  1021. public void SetVisitedDowntownCloudNine(bool visited)
  1022. {
  1023. m_Visited[(int)Location.DowntownCloudNine] = visited;
  1024. }
  1025. //================================================================================
  1026. //
  1027. //================================================================================
  1028. public bool DidVisitCloudNineArtGallery()
  1029. {
  1030. return m_Visited[(int)Location.CloudNineArtGallery];
  1031. }
  1032. //================================================================================
  1033. //
  1034. //================================================================================
  1035. public void SetVisitedCloudNineArtGallery(bool visited)
  1036. {
  1037. m_Visited[(int)Location.CloudNineArtGallery] = visited;
  1038. }
  1039. //================================================================================
  1040. //
  1041. //================================================================================
  1042. public bool DidVisitAmazingArtGallery()
  1043. {
  1044. return m_Visited[(int)Location.AmazingArtGallery];
  1045. }
  1046. //================================================================================
  1047. //
  1048. //================================================================================
  1049. public void SetVisitedAmazingArtGallery(bool visited)
  1050. {
  1051. m_Visited[(int)Location.AmazingArtGallery] = visited;
  1052. }
  1053. //================================================================================
  1054. //
  1055. //================================================================================
  1056. public bool DidVisitCloudSheepCrossing()
  1057. {
  1058. return m_Visited[(int)Location.CloudSheepCrossing];
  1059. }
  1060. //================================================================================
  1061. //
  1062. //================================================================================
  1063. public void SetVisitedCloudSheepCrossing(bool visited)
  1064. {
  1065. m_Visited[(int)Location.CloudSheepCrossing] = visited;
  1066. }
  1067. //================================================================================
  1068. //
  1069. //================================================================================
  1070. public bool DidVisitNewspaperCarrierScene()
  1071. {
  1072. return m_Visited[(int)Location.NewspaperCarrierScene];
  1073. }
  1074. //================================================================================
  1075. //
  1076. //================================================================================
  1077. public void SetVisitedNewspaperCarrierScene(bool visited)
  1078. {
  1079. m_Visited[(int)Location.NewspaperCarrierScene] = visited;
  1080. }
  1081. //================================================================================
  1082. //
  1083. //================================================================================
  1084. public bool DidVisitRaingearIsland()
  1085. {
  1086. return m_Visited[(int)Location.RaingearIsland];
  1087. }
  1088. //================================================================================
  1089. //
  1090. //================================================================================
  1091. public void SetVisitedRaingearIsland(bool visited)
  1092. {
  1093. m_Visited[(int)Location.RaingearIsland] = visited;
  1094. }
  1095. //================================================================================
  1096. //
  1097. //================================================================================
  1098. public bool DidVisitIrvinsHouse()
  1099. {
  1100. return m_Visited[(int)Location.IrvinsHouse];
  1101. }
  1102. //================================================================================
  1103. //
  1104. //================================================================================
  1105. public void SetVisitedIrvinsHouse(bool visited)
  1106. {
  1107. m_Visited[(int)Location.IrvinsHouse] = visited;
  1108. }
  1109. //================================================================================
  1110. //
  1111. //================================================================================
  1112. public bool DidVisitGumballScience()
  1113. {
  1114. return m_Visited[(int)Location.GumballScience];
  1115. }
  1116. //================================================================================
  1117. //
  1118. //================================================================================
  1119. public void SetVisitedGumballScience(bool visited)
  1120. {
  1121. m_Visited[(int)Location.GumballScience] = visited;
  1122. }
  1123. //================================================================================
  1124. //
  1125. //================================================================================
  1126. public bool DidVisitRaingearThrowingMachine()
  1127. {
  1128. return m_Visited[(int)Location.RaingearThrowingMachine];
  1129. }
  1130. //================================================================================
  1131. //
  1132. //================================================================================
  1133. public void SetVisitedRaingearThrowingMachine(bool visited)
  1134. {
  1135. m_Visited[(int)Location.RaingearThrowingMachine] = visited;
  1136. }
  1137. //================================================================================
  1138. //
  1139. //================================================================================
  1140. public bool DidVisitMusicalMarblePatterns()
  1141. {
  1142. return m_Visited[(int)Location.MusicalMarblePatterns];
  1143. }
  1144. //================================================================================
  1145. //
  1146. //================================================================================
  1147. public void SetVisitedMusicalMarblePatterns(bool visited)
  1148. {
  1149. m_Visited[(int)Location.MusicalMarblePatterns] = visited;
  1150. }
  1151. //================================================================================
  1152. //
  1153. //================================================================================
  1154. public bool DidVisitRaingearForest()
  1155. {
  1156. return m_Visited[(int)Location.RaingearForest];
  1157. }
  1158. //================================================================================
  1159. //
  1160. //================================================================================
  1161. public void SetVisitedRaingearForest(bool visited)
  1162. {
  1163. m_Visited[(int)Location.RaingearForest] = visited;
  1164. }
  1165. //================================================================================
  1166. //
  1167. //================================================================================
  1168. public bool DidVisitRaingearForestMath()
  1169. {
  1170. return m_Visited[(int)Location.RaingearForestMath];
  1171. }
  1172. //================================================================================
  1173. //
  1174. //================================================================================
  1175. public void SetVisitedRaingearForestMath(bool visited)
  1176. {
  1177. m_Visited[(int)Location.RaingearForestMath] = visited;
  1178. }
  1179. //================================================================================
  1180. //
  1181. //================================================================================
  1182. public bool DidVisitSillySandwichShop()
  1183. {
  1184. return m_Visited[(int)Location.SillySandwichShop];
  1185. }
  1186. //================================================================================
  1187. //
  1188. //================================================================================
  1189. public void SetVisitedSillySandwichShop(bool visited)
  1190. {
  1191. m_Visited[(int)Location.SillySandwichShop] = visited;
  1192. }
  1193. //================================================================================
  1194. //
  1195. //================================================================================
  1196. public bool DidVisitRockHead()
  1197. {
  1198. return m_Visited[(int)Location.RockHead];
  1199. }
  1200. //================================================================================
  1201. //
  1202. //================================================================================
  1203. public void SetVisitedRockHead(bool visited)
  1204. {
  1205. m_Visited[(int)Location.RockHead] = visited;
  1206. }
  1207. //================================================================================
  1208. //
  1209. //================================================================================
  1210. public bool DidVisitFlowerpotPhonics()
  1211. {
  1212. return m_Visited[(int)Location.FlowerpotPhonics];
  1213. }
  1214. //================================================================================
  1215. //
  1216. //================================================================================
  1217. public void SetVisitedFlowerpotPhonics(bool visited)
  1218. {
  1219. m_Visited[(int)Location.FlowerpotPhonics] = visited;
  1220. }
  1221. //================================================================================
  1222. //
  1223. //================================================================================
  1224. public bool DidVisitRaingearRescue()
  1225. {
  1226. return m_Visited[(int)Location.RaingearRescue];
  1227. }
  1228. //================================================================================
  1229. //
  1230. //================================================================================
  1231. public void SetVisitedRaingearRescue(bool visited)
  1232. {
  1233. m_Visited[(int)Location.RaingearRescue] = visited;
  1234. }
  1235. //================================================================================
  1236. //
  1237. //================================================================================
  1238. public Location GetCurrentLocation()
  1239. {
  1240. return m_CurrentLocation;
  1241. }
  1242. //================================================================================
  1243. //
  1244. //================================================================================
  1245. public void SetCurrentLocation(Location location)
  1246. {
  1247. m_PreviousLocation = m_CurrentLocation;
  1248. m_CurrentLocation = location;
  1249. }
  1250. //================================================================================
  1251. //
  1252. //================================================================================
  1253. public Location GetPreviousLocation()
  1254. {
  1255. return m_PreviousLocation;
  1256. }
  1257. //================================================================================
  1258. //
  1259. //================================================================================
  1260. public bool MustUnblock(Location location)
  1261. {
  1262. return BlockedLocation[(int)location];
  1263. }
  1264. //================================================================================
  1265. //
  1266. //================================================================================
  1267. public bool IsLocationBlocked(Location location)
  1268. {
  1269. return m_BlockedLocation[(int)location];
  1270. }
  1271. //================================================================================
  1272. //
  1273. //================================================================================
  1274. public void SetLocationBlocked(Location location, bool blocked)
  1275. {
  1276. m_BlockedLocation[(int)location] = blocked;
  1277. }
  1278. //================================================================================
  1279. //
  1280. //================================================================================
  1281. public void BlockLocation(Location location)
  1282. {
  1283. m_BlockedLocation[(int)location] = true;
  1284. }
  1285. //================================================================================
  1286. //
  1287. //================================================================================
  1288. public void UnblockLocation(Location location)
  1289. {
  1290. m_BlockedLocation[(int)location] = false;
  1291. }
  1292. //================================================================================
  1293. //
  1294. //================================================================================
  1295. public int GetActivityLevel(Activity activity)
  1296. {
  1297. return m_ActivityLevel[(int)activity];
  1298. }
  1299. //================================================================================
  1300. //
  1301. //================================================================================
  1302. public void SetActivityLevel(Activity activity, int level)
  1303. {
  1304. m_ActivityLevel[(int)activity] = level;
  1305. }
  1306. //================================================================================
  1307. //
  1308. //================================================================================
  1309. public bool IsActivityLocked(Activity activity)
  1310. {
  1311. return m_IsActivityLocked[(int)activity];
  1312. }
  1313. //================================================================================
  1314. //
  1315. //================================================================================
  1316. public void LockActivity(Activity activity)
  1317. {
  1318. m_IsActivityLocked[(int)activity] = true;
  1319. }
  1320. //================================================================================
  1321. //
  1322. //================================================================================
  1323. public void UnlockActivity(Activity activity)
  1324. {
  1325. m_IsActivityLocked[(int)activity] = false;
  1326. }
  1327. //================================================================================
  1328. //
  1329. //================================================================================
  1330. public void ToggleActivityLocked(Activity activity)
  1331. {
  1332. m_IsActivityLocked[(int)activity] = !m_IsActivityLocked[(int)activity];
  1333. }
  1334. //================================================================================
  1335. //
  1336. //================================================================================
  1337. public bool IsActivityAutoLevel(Activity activity)
  1338. {
  1339. return m_IsActivityAutoLevel[(int)activity];
  1340. }
  1341. //================================================================================
  1342. //
  1343. //================================================================================
  1344. public void SetActivityAutoLevel(Activity activity, bool isAutoLevel)
  1345. {
  1346. m_IsActivityAutoLevel[(int)activity] = isAutoLevel;
  1347. }
  1348. //================================================================================
  1349. //
  1350. //================================================================================
  1351. public void ToggleActivityAutoLevel(Activity activity)
  1352. {
  1353. m_IsActivityAutoLevel[(int)activity] = !m_IsActivityAutoLevel[(int)activity];
  1354. }
  1355. //================================================================================
  1356. //
  1357. //================================================================================
  1358. public ProgressType GetProgressTypeLevel1(Activity activity)
  1359. {
  1360. return m_ProgressLevel1[(int)activity];
  1361. }
  1362. //================================================================================
  1363. //
  1364. //================================================================================
  1365. public void SetProgressTypeLevel1(Activity activity, ProgressType progressType)
  1366. {
  1367. m_ProgressLevel1[(int)activity] = progressType;
  1368. }
  1369. //================================================================================
  1370. //
  1371. //================================================================================
  1372. public ProgressType GetProgressTypeLevel2(Activity activity)
  1373. {
  1374. return m_ProgressLevel2[(int)activity];
  1375. }
  1376. //================================================================================
  1377. //
  1378. //================================================================================
  1379. public void SetProgressTypeLevel2(Activity activity, ProgressType progressType)
  1380. {
  1381. m_ProgressLevel2[(int)activity] = progressType;
  1382. }
  1383. //================================================================================
  1384. //
  1385. //================================================================================
  1386. public ProgressType GetProgressTypeLevel3(Activity activity)
  1387. {
  1388. return m_ProgressLevel3[(int)activity];
  1389. }
  1390. //================================================================================
  1391. //
  1392. //================================================================================
  1393. public void SetProgressTypeLevel3(Activity activity, ProgressType progressType)
  1394. {
  1395. m_ProgressLevel3[(int)activity] = progressType;
  1396. }
  1397. //================================================================================
  1398. //
  1399. //================================================================================
  1400. public int GetRaingearRescueProgress(int level)
  1401. {
  1402. return m_RaingearRescueProgressLevels[level];
  1403. }
  1404. //================================================================================
  1405. //
  1406. //================================================================================
  1407. public void IncRaingearRescueProgress(int level)
  1408. {
  1409. ++m_RaingearRescueProgressLevels[level];
  1410. }
  1411. //================================================================================
  1412. //
  1413. //================================================================================
  1414. public int GetAmazingArtGalleryPagesCreated()
  1415. {
  1416. return m_AmazingArtGalleryPagesCreated;
  1417. }
  1418. //================================================================================
  1419. // We consider that a page is created only when the player first modify it.
  1420. // If the player go to "next" page but does nothing on the new page, we do not
  1421. // count it as a new page created.
  1422. //================================================================================
  1423. public void IncAmazingArtGalleryPagesCreated()
  1424. {
  1425. ++m_AmazingArtGalleryPagesCreated;
  1426. }
  1427. //================================================================================
  1428. //
  1429. //================================================================================
  1430. public bool IsVideoLocked(VideoType video)
  1431. {
  1432. return m_IsVideoLocked[(int)video];
  1433. }
  1434. //================================================================================
  1435. //
  1436. //================================================================================
  1437. public void LockVideo(VideoType video)
  1438. {
  1439. m_IsVideoLocked[(int)video] = true;
  1440. }
  1441. //================================================================================
  1442. //
  1443. //================================================================================
  1444. public void UnlockVideo(VideoType video)
  1445. {
  1446. m_IsVideoLocked[(int)video] = false;
  1447. }
  1448. //================================================================================
  1449. //
  1450. //================================================================================
  1451. public void ToggleVideoLocked(VideoType video)
  1452. {
  1453. m_IsVideoLocked[(int)video] = !m_IsVideoLocked[(int)video];
  1454. }
  1455. //================================================================================
  1456. //
  1457. //================================================================================
  1458. public bool IsBackgroundMusicEnabled()
  1459. {
  1460. return m_IsBackgroundMusicEnabled;
  1461. }
  1462. //================================================================================
  1463. //
  1464. //================================================================================
  1465. public void EnableBackgroundMusic()
  1466. {
  1467. m_IsBackgroundMusicEnabled = true;
  1468. }
  1469. //================================================================================
  1470. //
  1471. //================================================================================
  1472. public void DisableBackgroundMusic()
  1473. {
  1474. m_IsBackgroundMusicEnabled = false;
  1475. }
  1476. //================================================================================
  1477. //
  1478. //================================================================================
  1479. public void ToggleBackgroundMusic()
  1480. {
  1481. m_IsBackgroundMusicEnabled = !m_IsBackgroundMusicEnabled;
  1482. }
  1483. //================================================================================
  1484. //
  1485. //================================================================================
  1486. public bool IsPrinterEnabled()
  1487. {
  1488. return m_IsPrinterEnabled;
  1489. }
  1490. //================================================================================
  1491. //
  1492. //================================================================================
  1493. public void EnablePrinter()
  1494. {
  1495. m_IsPrinterEnabled = true;
  1496. }
  1497. //================================================================================
  1498. //
  1499. //================================================================================
  1500. public void DisablePrinter()
  1501. {
  1502. m_IsPrinterEnabled = false;
  1503. }
  1504. //================================================================================
  1505. //
  1506. //================================================================================
  1507. public void TogglePrinter()
  1508. {
  1509. m_IsPrinterEnabled = !m_IsPrinterEnabled;
  1510. }
  1511. //================================================================================
  1512. // EdgeOfCloudNine
  1513. //================================================================================
  1514. public bool EOCN_IsSecondTime
  1515. {
  1516. get { return m_EOCN_IsSecondTime; }
  1517. set { m_EOCN_IsSecondTime = value; }
  1518. }
  1519. public bool EOCN_IsCloudVisible
  1520. {
  1521. get { return m_EOCN_IsCloudVisible; }
  1522. set { m_EOCN_IsCloudVisible = value; }
  1523. }
  1524. //================================================================================
  1525. // CloudSpellingChallenge
  1526. //================================================================================
  1527. public int CSC_WinsCount{
  1528. get { return m_CSC_WinsCount; }
  1529. set { m_CSC_WinsCount = value; }
  1530. }
  1531. //================================================================================
  1532. // CloudNineGateway
  1533. //================================================================================
  1534. public bool CNG_IsFirstClickWelcomeSign
  1535. {
  1536. get { return m_CNG_IsFirstClickWelcomeSign; }
  1537. set { m_CNG_IsFirstClickWelcomeSign = value; }
  1538. }
  1539. public bool CNG_IsFirstClickPaigeWithoutBell
  1540. {
  1541. get { return m_CNG_IsFirstClickPaigeWithoutBell; }
  1542. set { m_CNG_IsFirstClickPaigeWithoutBell = value; }
  1543. }
  1544. public bool CNG_IsFirstClickPaigeWithBell
  1545. {
  1546. get { return m_CNG_IsFirstClickPaigeWithBell; }
  1547. set { m_CNG_IsFirstClickPaigeWithBell = value; }
  1548. }
  1549. public bool CNG_IsFirstClickPaigeAfterOpeningGate
  1550. {
  1551. get { return m_CNG_IsFirstClickPaigeAfterOpeningGate; }
  1552. set { m_CNG_IsFirstClickPaigeAfterOpeningGate = value; }
  1553. }
  1554. public bool CNG_IsFirstClickReaderWithoutBell
  1555. {
  1556. get { return m_CNG_IsFirstClickReaderWithoutBell; }
  1557. set { m_CNG_IsFirstClickReaderWithoutBell = value; }
  1558. }
  1559. public bool CNG_IsFirstClickReaderWithBell
  1560. {
  1561. get { return m_CNG_IsFirstClickReaderWithBell; }
  1562. set { m_CNG_IsFirstClickReaderWithBell = value; }
  1563. }
  1564. public bool CNG_IsFirstClickReaderAfterOpeningGate
  1565. {
  1566. get { return m_CNG_IsFirstClickReaderAfterOpeningGate; }
  1567. set { m_CNG_IsFirstClickReaderAfterOpeningGate = value; }
  1568. }
  1569. //================================================================================
  1570. // DowntownCloudNine
  1571. //================================================================================
  1572. public DCN_BackTypeEnum DCN_BackType
  1573. {
  1574. get { return m_DCN_BackType; }
  1575. set { m_DCN_BackType = value; }
  1576. }
  1577. public int DCN_BackAfterIrvinsHouseQueenSpeech
  1578. {
  1579. get { return m_DCN_BackAfterIrvinsHouseQueenSpeech; }
  1580. set { m_DCN_BackAfterIrvinsHouseQueenSpeech = value; }
  1581. }
  1582. public int DCN_EnteredFromCatapult
  1583. {
  1584. get { return m_DCN_EnteredFromCatapultCount; }
  1585. set { m_DCN_EnteredFromCatapultCount = value; }
  1586. }
  1587. public bool DCN_IsFirstClickCloudNineArtGallery
  1588. {
  1589. get { return m_DCN_IsFirstClickCloudNineArtGallery; }
  1590. set { m_DCN_IsFirstClickCloudNineArtGallery = value; }
  1591. }
  1592. public bool DCN_BackAfterOneItem
  1593. {
  1594. get { return m_DCN_BackAfterOneItem; }
  1595. set { m_DCN_BackAfterOneItem = value; }
  1596. }
  1597. public bool DCN_BackAfterTwoItems
  1598. {
  1599. get { return m_DCN_BackAfterTwoItems; }
  1600. set { m_DCN_BackAfterTwoItems = value; }
  1601. }
  1602. public bool DCN_BackAfterThreeItems
  1603. {
  1604. get { return m_DCN_BackAfterThreeItems; }
  1605. set { m_DCN_BackAfterThreeItems = value; }
  1606. }
  1607. public void DCN_VisitedRaingearIsland()
  1608. {
  1609. if (m_DCN_BackType == DCN_BackTypeEnum.DidNotVisitIslandFirstTimeOnly || m_DCN_BackType == DCN_BackTypeEnum.DidNotVisitIsland)
  1610. m_DCN_BackType = DCN_BackTypeEnum.AfterVisitingIslandFirstTimeOnly;
  1611. }
  1612. public void DCN_VisitedIrvinsHouse()
  1613. {
  1614. if (m_DCN_BackType != DCN_BackTypeEnum.AfterVisitingIrvinsHouseFirstTimeOnly && m_DCN_BackType != DCN_BackTypeEnum.AfterVisitingIrvinsHouse)
  1615. m_DCN_BackType = DCN_BackTypeEnum.AfterVisitingIrvinsHouseFirstTimeOnly;
  1616. }
  1617. //================================================================================
  1618. // CloudSheepCrossing
  1619. //================================================================================
  1620. public bool CSC_IsFirstWhistle
  1621. {
  1622. get { return m_CSC_IsFirstWhistle; }
  1623. set { m_CSC_IsFirstWhistle = value; }
  1624. }
  1625. public bool CSC_IsFirstSheepClick
  1626. {
  1627. get { return m_CSC_IsFirstSheepClick; }
  1628. set { m_CSC_IsFirstSheepClick = value; }
  1629. }
  1630. //================================================================================
  1631. // RaingearIsland
  1632. //================================================================================
  1633. public int RGIR_Direction
  1634. {
  1635. get { return m_RGIR_Direction; }
  1636. set { m_RGIR_Direction = value; }
  1637. }
  1638. //================================================================================
  1639. // NewspaperCarrierScene
  1640. //================================================================================
  1641. public bool NCS_IsSecondTime
  1642. {
  1643. get { return m_NCS_IsSecondTime; }
  1644. set { m_NCS_IsSecondTime = value; }
  1645. }
  1646. public bool NCS_IsCarryInScene
  1647. {
  1648. get { return m_NCS_IsCarryInScene; }
  1649. set { m_NCS_IsCarryInScene = value; }
  1650. }
  1651. public bool NCS_IsFirstClickRainbow
  1652. {
  1653. get { return m_NCS_IsFirstClickRainbow; }
  1654. set { m_NCS_IsFirstClickRainbow = value; }
  1655. }
  1656. public bool NCS_IsFirstClickCarry
  1657. {
  1658. get { return m_NCS_IsFirstClickCarry; }
  1659. set { m_NCS_IsFirstClickCarry = value; }
  1660. }
  1661. public bool NCS_IsFirstTimeWithWagon
  1662. {
  1663. get { return m_NCS_IsFirstTimeWithWagon; }
  1664. set { m_NCS_IsFirstTimeWithWagon = value; }
  1665. }
  1666. //================================================================================
  1667. // IrvinsHouse
  1668. //================================================================================
  1669. public int IH_GameState
  1670. {
  1671. get { return m_IH_GameState; }
  1672. set { m_IH_GameState = value; }
  1673. }
  1674. public int IH_ReEntryCount
  1675. {
  1676. get { return m_IH_ReEntryCount; }
  1677. set { m_IH_ReEntryCount = value; }
  1678. }
  1679. public bool IH_IsFirstFromRaingearThrowingMachine
  1680. {
  1681. get { return m_IH_IsFirstFromRaingearThrowingMachine; }
  1682. set { m_IH_IsFirstFromRaingearThrowingMachine = value; }
  1683. }
  1684. //================================================================================
  1685. // RaingearThrowingMachine
  1686. //================================================================================
  1687. public int RTM_VisitCount
  1688. {
  1689. get { return m_RTM_VisitCount; }
  1690. set { m_RTM_VisitCount = value; }
  1691. }
  1692. public int RTM_UsedCatapultCount
  1693. {
  1694. get { return m_RTM_UsedCatapultCount; }
  1695. set { m_RTM_UsedCatapultCount = value; }
  1696. }
  1697. public bool RTM_IsFluffySleeping
  1698. {
  1699. get { return m_RTM_IsFluffySleeping; }
  1700. set { m_RTM_IsFluffySleeping = value; }
  1701. }
  1702. public bool RTM_IsCatapultReady
  1703. {
  1704. get { return m_RTM_IsCatapultReady; }
  1705. set { m_RTM_IsCatapultReady = value; }
  1706. }
  1707. public bool RTM_IsFirstSandwich
  1708. {
  1709. get { return m_RTM_IsFirstSandwich; }
  1710. set { m_RTM_IsFirstSandwich = value; }
  1711. }
  1712. //================================================================================
  1713. // RockHead
  1714. //================================================================================
  1715. public int RH_GameState
  1716. {
  1717. get { return m_RH_GameState; }
  1718. set { m_RH_GameState = value; }
  1719. }
  1720. public bool RH_IsFirstTimeFromRainbow
  1721. {
  1722. get { return m_RH_IsFirstTimeFromRainbow; }
  1723. set { m_RH_IsFirstTimeFromRainbow = value; }
  1724. }
  1725. public bool RH_DidTalkToRockHead
  1726. {
  1727. get { return m_RH_DidTalkToRockHead; }
  1728. set { m_RH_DidTalkToRockHead = value; }
  1729. }
  1730. public int RH_RockClickCount
  1731. {
  1732. get { return m_RH_RockClickCount; }
  1733. set { m_RH_RockClickCount = value; }
  1734. }
  1735. //================================================================================
  1736. // CloudNineArtGallery
  1737. //================================================================================
  1738. public int CNAG_GameState
  1739. {
  1740. get { return m_CNAG_GameState; }
  1741. set { m_CNAG_GameState = value; }
  1742. }
  1743. public bool CNAG_DidSaySS4Speech
  1744. {
  1745. get { return m_CNAG_DidSaySS4Speech; }
  1746. set { m_CNAG_DidSaySS4Speech = value; }
  1747. }
  1748. public bool CNAG_DidSayAct4Speech
  1749. {
  1750. get { return m_CNAG_DidSayAct4Speech; }
  1751. set { m_CNAG_DidSayAct4Speech = value; }
  1752. }
  1753. public bool CNAG_IsFirstEditSpeech
  1754. {
  1755. get { return m_CNAG_IsFirstEditSpeech; }
  1756. set { m_CNAG_IsFirstEditSpeech = value; }
  1757. }
  1758. public bool CNAG_IsFromSample
  1759. {
  1760. get { return m_CNAG_IsFromSample; }
  1761. set { m_CNAG_IsFromSample = value; }
  1762. }
  1763. public int CNAG_VisitCount
  1764. {
  1765. get { return m_CNAG_VisitCount; }
  1766. set { m_CNAG_VisitCount = value; }
  1767. }
  1768. //================================================================================
  1769. // AmazingArtGallery
  1770. //================================================================================
  1771. public int AAG_NextClickCount
  1772. {
  1773. get { return m_AAG_NextClickCount; }
  1774. set { m_AAG_NextClickCount = value; }
  1775. }
  1776. public bool AAG_PaigeClicked
  1777. {
  1778. get { return m_AAG_PaigeClicked; }
  1779. set { m_AAG_PaigeClicked = value; }
  1780. }
  1781. public int AAG_Enter1Count
  1782. {
  1783. get { return m_AAG_Enter1Count; }
  1784. set { m_AAG_Enter1Count = value; }
  1785. }
  1786. public int AAG_Enter2Count
  1787. {
  1788. get { return m_AAG_Enter2Count; }
  1789. set { m_AAG_Enter2Count = value; }
  1790. }
  1791. public int AAG_Enter3Count
  1792. {
  1793. get { return m_AAG_Enter3Count; }
  1794. set { m_AAG_Enter3Count = value; }
  1795. }
  1796. public bool AAG_PaintUsed
  1797. {
  1798. get { return m_AAG_PaintUsed; }
  1799. set { m_AAG_PaintUsed = value; }
  1800. }
  1801. public bool AAG_EraseUsed
  1802. {
  1803. get { return m_AAG_EraseUsed; }
  1804. set { m_AAG_EraseUsed = value; }
  1805. }
  1806. public bool AAG_StampUsed
  1807. {
  1808. get { return m_AAG_StampUsed; }
  1809. set { m_AAG_StampUsed = value; }
  1810. }
  1811. public bool AAG_FillUsed
  1812. {
  1813. get { return m_AAG_FillUsed; }
  1814. set { m_AAG_FillUsed = value; }
  1815. }
  1816. public string AAG_framePath //mycode --rafael
  1817. {
  1818. get { return m_AAG_framePath;}
  1819. set { m_AAG_framePath = value;}
  1820. }
  1821. public bool AAG_BombUsed
  1822. {
  1823. get { return m_AAG_BombUsed; }
  1824. set { m_AAG_BombUsed = value; }
  1825. }
  1826. public bool AAG_TwoPagesUsed
  1827. {
  1828. get { return m_AAG_TwoPagesUsed; }
  1829. set { m_AAG_TwoPagesUsed = value; }
  1830. }
  1831. public bool AAG_PlayUsed
  1832. {
  1833. get { return m_AAG_PlayUsed; }
  1834. set { m_AAG_PlayUsed = value; }
  1835. }
  1836. //================================================================================
  1837. // RaingearForestMath
  1838. //================================================================================
  1839. public int RFM_RoundsCompleted
  1840. {
  1841. get { return m_RFM_RoundsCompleted; }
  1842. set { m_RFM_RoundsCompleted = value; }
  1843. }
  1844. //================================================================================
  1845. // FlowerpotPhonics
  1846. //================================================================================
  1847. public int FP_GameState
  1848. {
  1849. get { return m_FP_GameState; }
  1850. set { m_FP_GameState = value; }
  1851. }
  1852. public bool FP_WagonHere
  1853. {
  1854. get { return m_FP_WagonHere; }
  1855. set { m_FP_WagonHere = value; }
  1856. }
  1857. //================================================================================
  1858. //
  1859. //================================================================================
  1860. public Map.MapOpenedType CurrentMapOpenedType
  1861. {
  1862. get { return m_MapOpenedType; }
  1863. set { m_MapOpenedType = value; }
  1864. }
  1865. //================================================================================
  1866. //
  1867. //================================================================================
  1868. public bool LoadData()
  1869. {
  1870. KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling PlayerData.LoadData()...");
  1871. KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Persistent data path: " + Application.persistentDataPath);
  1872. KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Player name is " + m_PlayerName);
  1873. string playerName = m_IsPracticeMode ? PRACTICE_MODE_FILENAME : m_PlayerName;
  1874. if (ES2.Exists(playerName + ".dat"))
  1875. {
  1876. // Loading data sequentially (without tags) for faster save/load data - loading must be in the same sequence.
  1877. using(ES2Reader reader = ES2Reader.Create(playerName + ".dat"))
  1878. {
  1879. reader.Read<string>(); // We don't need to save player name, since we already got that in sign-in screen.
  1880. for (int i = 0; i < (int)ItemEnum.Quantity; ++i)
  1881. m_Items[i] = (ItemState)reader.Read<int>();
  1882. m_SandwichCount = reader.Read<int>();
  1883. m_RedMarbleCount = reader.Read<int>();
  1884. m_OrangeMarbleCount = reader.Read<int>();
  1885. m_YellowMarbleCount = reader.Read<int>();
  1886. m_GreenMarbleCount = reader.Read<int>();
  1887. m_BlueMarbleCount = reader.Read<int>();
  1888. m_UsedRedMarbleCount = reader.Read<int>();
  1889. m_UsedOrangeMarbleCount = reader.Read<int>();
  1890. m_UsedYellowMarbleCount = reader.Read<int>();
  1891. m_UsedGreenMarbleCount = reader.Read<int>();
  1892. m_UsedBlueMarbleCount = reader.Read<int>();
  1893. m_Visited = reader.ReadArray<bool>();
  1894. m_CurrentLocation = (Location)reader.Read<int>();
  1895. m_PreviousLocation = (Location)reader.Read<int>();
  1896. m_BlockedLocation = reader.ReadArray<bool>();
  1897. m_ActivityLevel = reader.ReadArray<int>();
  1898. m_IsActivityLocked = reader.ReadArray<bool>();
  1899. m_IsActivityAutoLevel = reader.ReadArray<bool>();
  1900. for (int i = 0; i < (int)Activity.Quantity - 2; ++i)
  1901. {
  1902. m_ProgressLevel1[i] = (ProgressType)reader.Read<int>();
  1903. m_ProgressLevel2[i] = (ProgressType)reader.Read<int>();
  1904. m_ProgressLevel3[i] = (ProgressType)reader.Read<int>();
  1905. }
  1906. m_RaingearRescueProgressLevels = reader.ReadArray<int>();
  1907. m_AmazingArtGalleryPagesCreated = reader.Read<int>();
  1908. m_IsVideoLocked = reader.ReadArray<bool>();
  1909. m_IsBackgroundMusicEnabled = reader.Read<bool>();
  1910. m_IsPrinterEnabled = reader.Read<bool>();
  1911. m_EOCN_IsSecondTime = reader.Read<bool>();
  1912. m_EOCN_IsCloudVisible = reader.Read<bool>();
  1913. m_CSC_WinsCount = reader.Read<int>();
  1914. m_CNG_IsFirstClickWelcomeSign = reader.Read<bool>();
  1915. m_CNG_IsFirstClickPaigeWithoutBell = reader.Read<bool>();
  1916. m_CNG_IsFirstClickPaigeWithBell = reader.Read<bool>();
  1917. m_CNG_IsFirstClickPaigeAfterOpeningGate = reader.Read<bool>();
  1918. m_CNG_IsFirstClickReaderWithoutBell = reader.Read<bool>();
  1919. m_CNG_IsFirstClickReaderWithBell = reader.Read<bool>();
  1920. m_CNG_IsFirstClickReaderAfterOpeningGate = reader.Read<bool>();
  1921. m_DCN_BackType = (DCN_BackTypeEnum)reader.Read<int>();
  1922. m_DCN_BackAfterIrvinsHouseQueenSpeech = reader.Read<int>();
  1923. m_DCN_EnteredFromCatapultCount = reader.Read<int>();
  1924. m_DCN_IsFirstClickCloudNineArtGallery = reader.Read<bool>();
  1925. m_DCN_BackAfterOneItem = reader.Read<bool>();
  1926. m_DCN_BackAfterTwoItems = reader.Read<bool>();
  1927. m_DCN_BackAfterThreeItems = reader.Read<bool>();
  1928. m_CSC_IsFirstWhistle = reader.Read<bool>();
  1929. m_CSC_IsFirstSheepClick = reader.Read<bool>();
  1930. m_RGIR_Direction = reader.Read<int>();
  1931. m_NCS_IsSecondTime = reader.Read<bool>();
  1932. m_NCS_IsCarryInScene = reader.Read<bool>();
  1933. m_NCS_IsFirstClickRainbow = reader.Read<bool>();
  1934. m_NCS_IsFirstClickCarry = reader.Read<bool>();
  1935. m_NCS_IsFirstTimeWithWagon = reader.Read<bool>();
  1936. m_IH_GameState = reader.Read<int>();
  1937. m_IH_ReEntryCount = reader.Read<int>();
  1938. m_IH_IsFirstFromRaingearThrowingMachine = reader.Read<bool>();
  1939. m_RTM_VisitCount = reader.Read<int>();
  1940. m_RTM_UsedCatapultCount = reader.Read<int>();
  1941. m_RTM_IsFluffySleeping = reader.Read<bool>();
  1942. m_RTM_IsCatapultReady = reader.Read<bool>();
  1943. m_RTM_IsFirstSandwich = reader.Read<bool>();
  1944. m_RH_GameState = reader.Read<int>();
  1945. m_RH_IsFirstTimeFromRainbow = reader.Read<bool>();
  1946. m_RH_DidTalkToRockHead = reader.Read<bool>();
  1947. m_RH_RockClickCount = reader.Read<int>();
  1948. m_CNAG_GameState = reader.Read<int>();
  1949. m_CNAG_DidSaySS4Speech = reader.Read<bool>();
  1950. m_CNAG_DidSayAct4Speech = reader.Read<bool>();
  1951. m_CNAG_IsFirstEditSpeech = reader.Read<bool>();
  1952. m_CNAG_IsFromSample = reader.Read<bool>();
  1953. m_CNAG_VisitCount = reader.Read<int>();
  1954. m_AAG_NextClickCount = reader.Read<int>();
  1955. m_AAG_PaigeClicked = reader.Read<bool>();
  1956. m_AAG_Enter1Count = reader.Read<int>();
  1957. m_AAG_Enter2Count = reader.Read<int>();
  1958. m_AAG_Enter3Count = reader.Read<int>();
  1959. m_AAG_PaintUsed = reader.Read<bool>();
  1960. m_AAG_EraseUsed = reader.Read<bool>();
  1961. m_AAG_StampUsed = reader.Read<bool>();
  1962. m_AAG_FillUsed = reader.Read<bool>();
  1963. m_AAG_framePath = reader.Read<string>(); //mycode --rafael
  1964. m_AAG_BombUsed = reader.Read<bool>();
  1965. m_AAG_TwoPagesUsed = reader.Read<bool>();
  1966. m_AAG_PlayUsed = reader.Read<bool>();
  1967. m_RFM_RoundsCompleted = reader.Read<int>();
  1968. m_FP_GameState = reader.Read<int>();
  1969. m_FP_WagonHere = reader.Read<bool>();
  1970. m_MapOpenedType = (Map.MapOpenedType)reader.Read<int>();
  1971. }
  1972. return true;
  1973. }
  1974. KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("There is no save data for \'" + m_PlayerName + "\'!");
  1975. return false;
  1976. /*
  1977. for (int i = 0; i < (int)ItemEnum.Quantity; ++i)
  1978. m_Items[i] = (ItemState)ES2.Load<int>(m_PlayerName + ".dat?tag=it" + i);
  1979. m_SandwichCount = ES2.Load<int>(m_PlayerName + ".dat?tag=sa");
  1980. m_RedMarbleCount = ES2.Load<int>(m_PlayerName + ".dat?tag=re");
  1981. m_OrangeMarbleCount = ES2.Load<int>(m_PlayerName + ".dat?tag=or");
  1982. m_YellowMarbleCount = ES2.Load<int>(m_PlayerName + ".dat?tag=ye");
  1983. m_GreenMarbleCount = ES2.Load<int>(m_PlayerName + ".dat?tag=gr");
  1984. m_BlueMarbleCount = ES2.Load<int>(m_PlayerName + ".dat?tag=bl");
  1985. for (int i = 0; i < (int)Location.Quantity; ++i)
  1986. m_Visited[i] = ES2.Load<bool>(m_PlayerName + ".dat?tag=vi" + i);
  1987. m_CurrentLocation = (Location)ES2.Load<int>(m_PlayerName + ".dat?tag=cu");
  1988. m_IsCloudVisible = ES2.Load<bool>(m_PlayerName + ".dat?tag=is");
  1989. for (int i = 0; i < (int)Location.Quantity; ++i)
  1990. m_Blocked[i] = ES2.Load<bool>(m_PlayerName + ".dat?tag=bl" + i);
  1991. */
  1992. }
  1993. //================================================================================
  1994. //
  1995. //================================================================================
  1996. public void SaveData()
  1997. {
  1998. KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling PlayerData.SaveData()...");
  1999. KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Persistent data path: " + Application.persistentDataPath);
  2000. KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Player name is " + m_PlayerName);
  2001. string playerName = m_IsPracticeMode ? PRACTICE_MODE_FILENAME : m_PlayerName;
  2002. // Saving data sequentially (without tags) for faster save/load data - loading must be in the same sequence.
  2003. using(ES2Writer writer = ES2Writer.Create(playerName + ".dat"))
  2004. {
  2005. writer.Write(m_PlayerName);
  2006. for (int i = 0; i < (int)ItemEnum.Quantity; ++i)
  2007. writer.Write((int)m_Items[i]);
  2008. writer.Write(m_SandwichCount);
  2009. writer.Write(m_RedMarbleCount);
  2010. writer.Write(m_OrangeMarbleCount);
  2011. writer.Write(m_YellowMarbleCount);
  2012. writer.Write(m_GreenMarbleCount);
  2013. writer.Write(m_BlueMarbleCount);
  2014. writer.Write(m_UsedRedMarbleCount);
  2015. writer.Write(m_UsedOrangeMarbleCount);
  2016. writer.Write(m_UsedYellowMarbleCount);
  2017. writer.Write(m_UsedGreenMarbleCount);
  2018. writer.Write(m_UsedBlueMarbleCount);
  2019. writer.Write(m_Visited);
  2020. writer.Write((int)m_CurrentLocation);
  2021. writer.Write((int)m_PreviousLocation);
  2022. writer.Write(m_BlockedLocation);
  2023. writer.Write(m_ActivityLevel);
  2024. writer.Write(m_IsActivityLocked);
  2025. writer.Write(m_IsActivityAutoLevel);
  2026. for (int i = 0; i < (int)Activity.Quantity - 2; ++i)
  2027. {
  2028. writer.Write((int)m_ProgressLevel1[i]);
  2029. writer.Write((int)m_ProgressLevel2[i]);
  2030. writer.Write((int)m_ProgressLevel3[i]);
  2031. }
  2032. writer.Write(m_RaingearRescueProgressLevels);
  2033. writer.Write(m_AmazingArtGalleryPagesCreated);
  2034. writer.Write(m_IsVideoLocked);
  2035. writer.Write(m_IsBackgroundMusicEnabled);
  2036. writer.Write(m_IsPrinterEnabled);
  2037. writer.Write(m_EOCN_IsSecondTime);
  2038. writer.Write(m_EOCN_IsCloudVisible);
  2039. writer.Write(m_CSC_WinsCount);
  2040. writer.Write(m_CNG_IsFirstClickWelcomeSign);
  2041. writer.Write(m_CNG_IsFirstClickPaigeWithoutBell);
  2042. writer.Write(m_CNG_IsFirstClickPaigeWithBell);
  2043. writer.Write(m_CNG_IsFirstClickPaigeAfterOpeningGate);
  2044. writer.Write(m_CNG_IsFirstClickReaderWithoutBell);
  2045. writer.Write(m_CNG_IsFirstClickReaderWithBell);
  2046. writer.Write(m_CNG_IsFirstClickReaderAfterOpeningGate);
  2047. writer.Write((int)m_DCN_BackType);
  2048. writer.Write(m_DCN_BackAfterIrvinsHouseQueenSpeech);
  2049. writer.Write(m_DCN_EnteredFromCatapultCount);
  2050. writer.Write(m_DCN_IsFirstClickCloudNineArtGallery);
  2051. writer.Write(m_DCN_BackAfterOneItem);
  2052. writer.Write(m_DCN_BackAfterTwoItems);
  2053. writer.Write(m_DCN_BackAfterThreeItems);
  2054. writer.Write(m_CSC_IsFirstWhistle);
  2055. writer.Write(m_CSC_IsFirstSheepClick);
  2056. writer.Write(m_RGIR_Direction);
  2057. writer.Write(m_NCS_IsSecondTime);
  2058. writer.Write(m_NCS_IsCarryInScene);
  2059. writer.Write(m_NCS_IsFirstClickRainbow);
  2060. writer.Write(m_NCS_IsFirstClickCarry);
  2061. writer.Write(m_NCS_IsFirstTimeWithWagon);
  2062. writer.Write(m_IH_GameState);
  2063. writer.Write(m_IH_ReEntryCount);
  2064. writer.Write(m_IH_IsFirstFromRaingearThrowingMachine);
  2065. writer.Write(m_RTM_VisitCount);
  2066. writer.Write(m_RTM_UsedCatapultCount);
  2067. writer.Write(m_RTM_IsFluffySleeping);
  2068. writer.Write(m_RTM_IsCatapultReady);
  2069. writer.Write(m_RTM_IsFirstSandwich);
  2070. writer.Write(m_RH_GameState);
  2071. writer.Write(m_RH_IsFirstTimeFromRainbow);
  2072. writer.Write(m_RH_DidTalkToRockHead);
  2073. writer.Write(m_RH_RockClickCount);
  2074. writer.Write(m_CNAG_GameState);
  2075. writer.Write(m_CNAG_DidSaySS4Speech);
  2076. writer.Write(m_CNAG_DidSayAct4Speech);
  2077. writer.Write(m_CNAG_IsFirstEditSpeech);
  2078. writer.Write(m_CNAG_IsFromSample);
  2079. writer.Write(m_CNAG_VisitCount);
  2080. writer.Write(m_AAG_NextClickCount);
  2081. writer.Write(m_AAG_PaigeClicked);
  2082. writer.Write(m_AAG_Enter1Count);
  2083. writer.Write(m_AAG_Enter2Count);
  2084. writer.Write(m_AAG_Enter3Count);
  2085. writer.Write(m_AAG_PaintUsed);
  2086. writer.Write(m_AAG_EraseUsed);
  2087. writer.Write(m_AAG_StampUsed);
  2088. writer.Write(m_AAG_FillUsed);
  2089. writer.Write(m_AAG_framePath); //mycode --rafael
  2090. writer.Write(m_AAG_BombUsed);
  2091. writer.Write(m_AAG_TwoPagesUsed);
  2092. writer.Write(m_AAG_PlayUsed);
  2093. writer.Write(m_RFM_RoundsCompleted);
  2094. writer.Write(m_FP_GameState);
  2095. writer.Write(m_FP_WagonHere);
  2096. writer.Write((int)m_MapOpenedType);
  2097. writer.Save(false); // false means we are not using tags, since we are saving data sequentially.
  2098. }
  2099. /*
  2100. ES2.Save(m_PlayerName, m_PlayerName + ".dat?tag=pl");
  2101. for (int i = 0; i < (int)ItemEnum.Quantity; ++i)
  2102. ES2.Save((int)m_Items[i], m_PlayerName + ".dat?tag=it" + i);
  2103. ES2.Save(m_SandwichCount, m_PlayerName + ".dat?tag=sa");
  2104. ES2.Save(m_RedMarbleCount, m_PlayerName + ".dat?tag=re");
  2105. ES2.Save(m_OrangeMarbleCount, m_PlayerName + ".dat?tag=or");
  2106. ES2.Save(m_YellowMarbleCount, m_PlayerName + ".dat?tag=ye");
  2107. ES2.Save(m_GreenMarbleCount, m_PlayerName + ".dat?tag=gr");
  2108. ES2.Save(m_BlueMarbleCount, m_PlayerName + ".dat?tag=bl");
  2109. for (int i = 0; i < (int)Location.Quantity; ++i)
  2110. ES2.Save(m_Visited[i], m_PlayerName + ".dat?tag=vi" + i);
  2111. ES2.Save((int)m_CurrentLocation, m_PlayerName + ".dat?tag=cu");
  2112. ES2.Save(m_IsCloudVisible, m_PlayerName + ".dat?tag=is");
  2113. for (int i = 0; i < (int)Location.Quantity; ++i)
  2114. ES2.Save(m_Blocked[i], m_PlayerName + ".dat?tag=bl" + i);
  2115. */
  2116. }
  2117. //================================================================================
  2118. //
  2119. //================================================================================
  2120. public void SaveImage(Texture2D image, string name)
  2121. {
  2122. if (m_IsPracticeMode || image == null)
  2123. {
  2124. return;
  2125. }
  2126. string path = Application.persistentDataPath + "/" + m_PlayerName + "/" + name + ".png";
  2127. using(ES2Writer writer = ES2Writer.Create(path))
  2128. {
  2129. writer.WriteRaw(image.EncodeToPNG());
  2130. writer.Save(false);
  2131. }
  2132. }
  2133. //================================================================================
  2134. //
  2135. //================================================================================
  2136. public Texture2D LoadImage(string name, Vector2 size)
  2137. {
  2138. if (m_IsPracticeMode)
  2139. {
  2140. return null;
  2141. }
  2142. string path = Application.persistentDataPath + "/" + m_PlayerName + "/" + name + ".png";
  2143. try
  2144. {
  2145. using(ES2Reader reader = ES2Reader.Create(path))
  2146. {
  2147. byte[] bytes = reader.ReadRaw();
  2148. if (bytes.Length > 0)
  2149. {
  2150. Texture2D newTexture = new Texture2D((int)size.x, (int)size.y);
  2151. newTexture.LoadImage(bytes);
  2152. return newTexture;
  2153. }
  2154. }
  2155. }
  2156. catch(System.Exception e)
  2157. {
  2158. KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log(e.Message);
  2159. }
  2160. return null;
  2161. }
  2162. //================================================================================
  2163. //
  2164. //================================================================================
  2165. public int GetUsedRedMarbleCount()
  2166. {
  2167. return m_UsedRedMarbleCount;
  2168. }
  2169. //================================================================================
  2170. //
  2171. //================================================================================
  2172. public void IncUsedRedMarbleCount()
  2173. {
  2174. ++m_UsedRedMarbleCount;
  2175. }
  2176. //================================================================================
  2177. //
  2178. //================================================================================
  2179. public void DecUsedRedMarbleCount()
  2180. {
  2181. --m_UsedRedMarbleCount;
  2182. }
  2183. //================================================================================
  2184. //
  2185. //================================================================================
  2186. public int GetUsedYellowMarbleCount()
  2187. {
  2188. return m_UsedYellowMarbleCount;
  2189. }
  2190. //================================================================================
  2191. //
  2192. //================================================================================
  2193. public void IncUsedYellowMarbleCount()
  2194. {
  2195. ++m_UsedYellowMarbleCount;
  2196. }
  2197. //================================================================================
  2198. //
  2199. //================================================================================
  2200. public void DecUsedYellowMarbleCount()
  2201. {
  2202. --m_UsedYellowMarbleCount;
  2203. }
  2204. //================================================================================
  2205. //
  2206. //================================================================================
  2207. public int GetUsedBlueMarbleCount()
  2208. {
  2209. return m_UsedBlueMarbleCount;
  2210. }
  2211. //================================================================================
  2212. //
  2213. //================================================================================
  2214. public void IncUsedBlueMarbleCount()
  2215. {
  2216. ++m_UsedBlueMarbleCount;
  2217. }
  2218. //================================================================================
  2219. //
  2220. //================================================================================
  2221. public void DecUsedBlueMarbleCount()
  2222. {
  2223. --m_UsedBlueMarbleCount;
  2224. }
  2225. //================================================================================
  2226. //
  2227. //================================================================================
  2228. public int GetUsedGreenMarbleCount()
  2229. {
  2230. return m_UsedGreenMarbleCount;
  2231. }
  2232. //================================================================================
  2233. //
  2234. //================================================================================
  2235. public void IncUsedGreenMarbleCount()
  2236. {
  2237. ++m_UsedGreenMarbleCount;
  2238. }
  2239. //================================================================================
  2240. //
  2241. //================================================================================
  2242. public void DecUsedGreenMarbleCount()
  2243. {
  2244. --m_UsedGreenMarbleCount;
  2245. }
  2246. //================================================================================
  2247. //
  2248. //================================================================================
  2249. public int GetUsedOrangeMarbleCount()
  2250. {
  2251. return m_UsedOrangeMarbleCount;
  2252. }
  2253. //================================================================================
  2254. //
  2255. //================================================================================
  2256. public void IncUsedOrangeMarbleCount()
  2257. {
  2258. ++m_UsedOrangeMarbleCount;
  2259. }
  2260. //================================================================================
  2261. //
  2262. //================================================================================
  2263. public void DecUsedOrangeMarbleCount()
  2264. {
  2265. --m_UsedOrangeMarbleCount;
  2266. }
  2267. //================================================================================
  2268. //
  2269. //================================================================================
  2270. public void CheatAllItemsInInventory()
  2271. {
  2272. for (int i = 0; i < (int)ItemEnum.Quantity; ++i)
  2273. m_Items[i] = ItemState.Inventory;
  2274. }
  2275. } // public class PlayerData
  2276. } // namespace ReaderRabbit