human.js 152 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832
  1. import * as PIXI from "./pixi.min"
  2. import { TimelineLite, Sine, TweenMax , Back } from "./TweenMax.min"
  3. import {Howl, Howler} from './howler.min'
  4. var gamen = require("./gamen");
  5. (function () {
  6. var XORcipher = function () {
  7. return new XORcipher.fn.init();
  8. };
  9. XORcipher.fn = XORcipher.prototype =
  10. {
  11. constructor: XORcipher,
  12. init:function()
  13. {
  14. return this;
  15. },
  16. //암호화
  17. xorEncoder:function($str, $key)
  18. {
  19. var bytes = [];
  20. for (var i = 0; i < $str.length; ++i)
  21. {
  22. bytes.push($str.charCodeAt(i));
  23. }
  24. var result = [];
  25. for(var i = 0; i < bytes.length; i++)
  26. {
  27. result.push(bytes[i] ^ $key);
  28. }
  29. return result;
  30. },
  31. //복호화
  32. xorDecoder:function($byte, $key)
  33. {
  34. var bytes = [];
  35. for(var i = 0; i < $byte.length; i++)
  36. {
  37. bytes.push($byte[i] ^ $key);
  38. }
  39. var str = String.fromCharCode.apply(String, bytes);
  40. return str;
  41. }
  42. };
  43. window.XORcipher = XORcipher;
  44. }());
  45. XORcipher.fn.init.prototype = XORcipher.fn;
  46. var GD = {};
  47. var DataManager = {};
  48. var GamePadManager = {};
  49. /*Image server*/
  50. var IMG_SERVER = '';
  51. var GAME_IMG_PATH = 'https://pub.dwstatic.com/wxgame/momobakery/';
  52. var COMMON_IMG_PATH = 'https://pub.dwstatic.com/wxgame/momobakery/';
  53. /*JS Server*/
  54. var JS_SERVER = '';
  55. var GAME_JS_PATH = '';
  56. var COMMON_JS_PATH = 'js/common/';
  57. var JS_PATH = '';
  58. var CACHE_VER = 0.2;
  59. var RES_DIR_IMG = GAME_IMG_PATH + 'image/';
  60. var RES_DIR_JSON = RES_DIR_IMG + 'json/';
  61. var RES_DIR_PNG = RES_DIR_IMG + 'png/';
  62. var RES_DIR_SPINE = RES_DIR_IMG + 'spine/';
  63. var RES_DIR_SOUND = GAME_IMG_PATH + 'sound/';
  64. // source code version
  65. var IMG_VERSION = CACHE_VER;
  66. var SOUND_VERSION = CACHE_VER;
  67. !function(t) {
  68. function e(n) {
  69. if (i[n])
  70. return i[n].exports;
  71. var o = i[n] = {
  72. exports: {},
  73. id: n,
  74. loaded: !1
  75. };
  76. return t[n].call(o.exports, o, o.exports, e),
  77. o.loaded = !0,
  78. o.exports
  79. }
  80. var i = {};
  81. return e.m = t,
  82. e.c = i,
  83. e.p = "",
  84. e(0)
  85. }([function(t, e, i) {
  86. i(1),
  87. i(5),
  88. i(10),
  89. i(6),
  90. i(7),
  91. i(9),
  92. i(8),
  93. i(11),
  94. i(12),
  95. i(13),
  96. i(14),
  97. i(15),
  98. i(2),
  99. i(3),
  100. i(4)
  101. }
  102. , function(t, e) {}
  103. , function(t, e) {
  104. PIXI.Container.prototype.setTouchStartAction = function(t, e, i) {
  105. t.mousedown = t.touchstart = function(n) {
  106. n.stopPropagation(),
  107. GD.fullScreen(),
  108. GD.buttonAction(t),
  109. e && e.call(i, n)
  110. }
  111. .bind(i)
  112. }
  113. ,
  114. PIXI.Container.prototype.setTouchStart = function(t, e, i) {
  115. t.mousedown = t.touchstart = function(t) {
  116. t.stopPropagation(),
  117. GD.fullScreen(),
  118. e && e.call(i, t)
  119. }
  120. .bind(i)
  121. }
  122. ,
  123. PIXI.Container.prototype.setTouchEnd = function(t, e, i) {
  124. t.tap = function(t) {
  125. t.stopPropagation(),
  126. GD.fullScreen(),
  127. e && e.call(i, t)
  128. }
  129. .bind(i),
  130. GD.isMobile || (t.click = function(t) {
  131. t.stopPropagation(),
  132. e && e.call(i, t)
  133. }
  134. .bind(i))
  135. }
  136. ,
  137. PIXI.Container.prototype.setTouchMove = function(t, e, i) {
  138. t.mousemove = t.touchmove = function(t) {
  139. t.stopPropagation(),
  140. e && e.call(i, t)
  141. }
  142. .bind(i)
  143. }
  144. ,
  145. PIXI.Container.prototype.addGamePadEvent = function() {
  146. this.removeGamePadEvent()
  147. // $(GamePadManager).on("padButton", this.onGamePadEvent.bind(this)),
  148. // $(GamePadManager).on("padStickX", this.onGamePadStickXEvent.bind(this)),
  149. // $(GamePadManager).on("padStickY", this.onGamePadStickYEvent.bind(this))
  150. }
  151. ,
  152. PIXI.Container.prototype.removeGamePadEvent = function() {
  153. // $(GamePadManager).off()
  154. }
  155. ,
  156. PIXI.Container.prototype.onGamePadEvent = function(t, e) {}
  157. ,
  158. PIXI.Container.prototype.onGamePadStickXEvent = function(t, e) {}
  159. ,
  160. PIXI.Container.prototype.onGamePadStickYEvent = function(t, e) {}
  161. ,
  162. PIXI.Container.prototype.showLoading = function() {
  163. GD.loading = GD.LoadingView.getInstance(),
  164. GD.loading.init(),
  165. this.addChild(GD.loading)
  166. }
  167. ,
  168. PIXI.Container.prototype.hideLoading = function() {
  169. this.removeChild(GD.loading)
  170. }
  171. }
  172. , function(t, e) {
  173. GD.CommonIntro = function(t, e) {
  174. PIXI.Container.call(this),
  175. this.helpBtn = null,
  176. this.soundpBtn = null,
  177. this.startBtn = null,
  178. this.callBackFunc = null,
  179. this.callBackTarget = null,
  180. this.bg = this.setSpriteTexture(this.bg, "texture", e),
  181. this.addChild(this.bg),
  182. // this.copyText = this.setSpriteTexture(this.copyText, "texture", "copybar_" + t),
  183. // this.copyText.anchor.set(.5),
  184. // this.copyText.x = GD.width / 2,
  185. // this.copyText.y = GD.height - 20,
  186. // this.addChild(this.copyText),
  187. this.gamePadGuide = null,
  188. this.soundPopup = new GD.OptionPopup,
  189. this.soundPopup.on("SOUND_POPUP_CLOSE_EVENT", this.closeSoundPopup.bind(this)),
  190. gamen.loadend()
  191. }
  192. ,
  193. GD.CommonIntro.constructor = GD.CommonIntro,
  194. GD.CommonIntro.prototype = Object.create(PIXI.Container.prototype),
  195. GD.CommonIntro.prototype.init = function() {
  196. GamePadManager.isConnected && GD.isShowPadGuide && (this.gamePadGuide || (this.gamePadGuide = new GD.GamePadGuide),
  197. this.showGamePadGuide(),
  198. this.addGamePadEvent()),
  199. GD.isShowPadGuide = !1,
  200. this.setInteractive(!0)
  201. }
  202. ,
  203. GD.CommonIntro.prototype.showGamePadGuide = function() {
  204. this.gamePadGuide.init(),
  205. this.addChild(this.gamePadGuide)
  206. }
  207. ,
  208. GD.CommonIntro.prototype.hideGamePadGuide = function() {
  209. this.removeChild(this.gamePadGuide)
  210. }
  211. ,
  212. GD.CommonIntro.prototype.initHelp = function(t, e, i) {
  213. this.helpBtn = this.setSpriteTexture(this.helpBtn, "texture", t),
  214. this.helpBtn.anchor.set(.5),
  215. this.helpBtn.x = e,
  216. this.helpBtn.y = i,
  217. this.helpBtn.scale.set(1),
  218. this.addChild(this.helpBtn),
  219. this.setTouchStartAction(this.helpBtn),
  220. this.setTouchEnd(this.helpBtn, this.showHelp, this)
  221. }
  222. ,
  223. GD.CommonIntro.prototype.initSound = function(t, e, i) {
  224. this.soundpBtn = this.setSpriteTexture(this.soundpBtn, "texture", t),
  225. this.soundpBtn.anchor.set(.5),
  226. this.soundpBtn.x = e,
  227. this.soundpBtn.y = i,
  228. this.soundpBtn.scale.set(1),
  229. this.addChild(this.soundpBtn),
  230. this.setTouchStartAction(this.soundpBtn),
  231. this.setTouchEnd(this.soundpBtn, this.showSoundPopup, this)
  232. }
  233. ,
  234. GD.CommonIntro.prototype.initStart = function(t, e, i, n, o) {
  235. this.startBtn = this.setSpriteTexture(this.startBtn, "texture", t),
  236. this.startBtn.anchor.set(.5),
  237. this.startBtn.x = e,
  238. this.startBtn.y = i,
  239. this.callBackFunc = n,
  240. this.callBackTarget = o,
  241. this.startBtn.scale.set(1),
  242. this.addChild(this.startBtn),
  243. this.setTouchStartAction(this.startBtn),
  244. this.setTouchEnd(this.startBtn, this.sendStartData, this)
  245. }
  246. ,
  247. GD.CommonIntro.prototype.onGamePadEvent = function(t, e) {
  248. switch (e) {
  249. case "button-1":
  250. this.hideGamePadGuide(),
  251. this.sendStartData();
  252. break;
  253. case "button-2":
  254. this.hideGamePadGuide(),
  255. this.showHelp();
  256. break;
  257. case "button-3":
  258. this.hideGamePadGuide(),
  259. this.showSoundPopup();
  260. break;
  261. case "button-4":
  262. this.hideGamePadGuide()
  263. }
  264. }
  265. ,
  266. GD.CommonIntro.prototype.showHelp = function() {
  267. this.setInteractive(!1),
  268. GD.tutorial.initPage(0, "help_start"),
  269. GD.tutorial.once("TUTORIAL_CLOSE_EVENT", this.hideHelp.bind(this)),
  270. this.addChild(GD.tutorial)
  271. }
  272. ,
  273. GD.CommonIntro.prototype.hideHelp = function() {
  274. this.sendStartData()
  275. }
  276. ,
  277. GD.CommonIntro.prototype.showSoundPopup = function() {
  278. this.setInteractive(!1),
  279. this.soundPopup.show(0),
  280. this.addChild(this.soundPopup)
  281. }
  282. ,
  283. GD.CommonIntro.prototype.closeSoundPopup = function() {
  284. this.removeChild(this.soundPopup),
  285. this.setInteractive(!0)
  286. }
  287. ,
  288. GD.CommonIntro.prototype.sendStartData = function() {
  289. this.showLoading(),
  290. DataManager.start(this.startDataComplete, this)
  291. }
  292. ,
  293. GD.CommonIntro.prototype.startDataComplete = function() {
  294. this.hideLoading(),
  295. GD.tutorial && this.removeChild(GD.tutorial),
  296. this.callBackFunc.call(this.callBackTarget)
  297. }
  298. ,
  299. GD.CommonIntro.prototype.setInteractive = function(t) {
  300. this.helpBtn.interactive = t,
  301. this.soundpBtn.interactive = t,
  302. this.startBtn.interactive = t,
  303. GamePadManager.isConnected && (t ? this.addGamePadEvent() : this.removeGamePadEvent())
  304. }
  305. ,
  306. GD.CommonIntro.getInstance = function(t, e) {
  307. return GD.commonIntro || (GD.commonIntro = new GD.CommonIntro(t,e)),
  308. GD.commonIntro
  309. }
  310. }
  311. , function(t, e) {
  312. GD.CommonOption = function(t) {
  313. PIXI.Container.call(this),
  314. this.scorePopup = new GD.ScorePopup,
  315. this.scorePopup.on("SCORE_POPUP_CLOSE_EVENT", this.closeScorePopup.bind(this)),
  316. this.optionPopup = new GD.OptionPopup,
  317. this.optionPopup.on("SOUND_POPUP_CLOSE_EVENT", this.closeOptionPopup.bind(this)),
  318. this.optionPopup.on("TUTORIAL_OPEN_EVENT", this.showTutorial.bind(this)),
  319. this.optBtn = this.setSpriteTexture(this.optBtn, "texture", "btn_option_" + t),
  320. this.optBtn.anchor.set(.5),
  321. this.optBtn.x = GD.width - 40,
  322. this.optBtn.y = 110,
  323. this.setTouchStartAction(this.optBtn),
  324. this.setTouchEnd(this.optBtn, function() {
  325. this.setInteractive(!1),
  326. this.optionPopup.show(1),
  327. this.addChild(this.optionPopup),
  328. this.emit("OPTION_OPEN_EVENT")
  329. }
  330. .bind(this)),
  331. this.achievement = new GD.Achievement
  332. }
  333. ,
  334. GD.CommonOption.constructor = GD.CommonOption,
  335. GD.CommonOption.prototype = Object.create(PIXI.Container.prototype),
  336. GD.CommonOption.prototype.init = function() {
  337. this.removeAll(),
  338. this.addChild(this.optBtn),
  339. this.addChild(this.achievement),
  340. this.setInteractive(!0)
  341. }
  342. ,
  343. GD.CommonOption.prototype.setAchievement = function(t) {
  344. this.achievement.show(t)
  345. }
  346. ,
  347. GD.CommonOption.prototype.setInteractive = function(t) {
  348. this.optBtn.interactive = t
  349. }
  350. ,
  351. GD.CommonOption.prototype.closeOptionPopup = function() {
  352. this.removeChild(this.optionPopup),
  353. this.setInteractive(!0),
  354. this.emit("OPTION_CLOSE_EVENT")
  355. }
  356. ,
  357. GD.CommonOption.prototype.showTutorial = function() {
  358. GD.tutorial.initPage(0, "help_close"),
  359. GD.tutorial.on("TUTORIAL_CLOSE_EVENT", this.hideHelp.bind(this)),
  360. this.addChild(GD.tutorial)
  361. }
  362. ,
  363. GD.CommonOption.prototype.hideHelp = function() {
  364. this.removeChild(GD.tutorial),
  365. this.optionPopup.setInteractive(!0)
  366. }
  367. ,
  368. GD.CommonOption.prototype.closeScorePopup = function() {
  369. this.gameRestart()
  370. }
  371. ,
  372. GD.CommonOption.prototype.finish = function(t) {
  373. gamen.score_view_status ? (this.scorePopup.show(t),
  374. this.addChild(this.scorePopup)) : (GD.exitFullScreen(),
  375. DataManager.finish(t))
  376. }
  377. ,
  378. GD.CommonOption.prototype.gameRestart = function() {
  379. this.emit("GAME_RESTART")
  380. }
  381. ,
  382. GD.CommonOption.prototype.removeAll = function() {
  383. this.removeChildren()
  384. }
  385. ,
  386. GD.CommonOption.getInstance = function(t) {
  387. return GD.commonOption || (GD.commonOption = new GD.CommonOption(t)),
  388. GD.commonOption
  389. }
  390. }
  391. , function(t, e) {
  392. GD = {
  393. loader: null,
  394. stats: null,
  395. width: 504,
  396. height: 861,
  397. leng: "ko",
  398. isMobile: !1,
  399. isDebug: !1,
  400. isShowLog: !1,
  401. isLogin: !1,
  402. unique: null,
  403. pk: null,
  404. sKey: null,
  405. oKey: null,
  406. startTime: null,
  407. medal: [],
  408. soundType: 1,
  409. isAllSound: !0,
  410. isBgmSound: !0,
  411. isEffectSound: !0,
  412. isShowPadGuide: !0,
  413. orientationType: null,
  414. orientationGuide: null,
  415. sound: {},
  416. darkBg: null,
  417. stage: null,
  418. commonIntro: null,
  419. commonOption: null,
  420. tutorial: null,
  421. loading: null
  422. },
  423. GD.init = function(t, e, i, n, backgroundColor) {
  424. var {pixelRatio, windowWidth, windowHeight} = wx.getSystemInfoSync()
  425. // var gWidth = windowWidth * pixelRatio
  426. // var gHeight = windowHeight * pixelRatio
  427. var gWidth = 720;
  428. var gHeight = 1232;
  429. GD.width = gWidth
  430. GD.height = gHeight
  431. GD.leng = gamen.game_language
  432. var app = GD.app = new PIXI.Application({
  433. width: gWidth,
  434. height: gHeight,
  435. forceCanvas:true,
  436. backgroundColor: backgroundColor,
  437. clearBeforeRender: false,
  438. resolution: 2,
  439. view: canvas
  440. })
  441. var xRatio = windowWidth * pixelRatio / gWidth;
  442. var yRatio = windowHeight * pixelRatio / gHeight;
  443. console.log(xRatio, yRatio);
  444. app.renderer.plugins.interaction.mapPositionToPoint = (point, x, y) => {
  445. point.x = x * pixelRatio / xRatio
  446. point.y = y * pixelRatio / yRatio
  447. }
  448. // requestAnimationFrame(this.update)
  449. this.renderer = app.renderer
  450. this.stage = app.stage
  451. // this.resize()
  452. this.setSpriteTexture()
  453. this.resourceLoad()
  454. // if (GD.width = t,
  455. // GD.height = e,
  456. // GD.leng = gamen.game_language,
  457. // this.renderer = PIXI.autoDetectRenderer(t, e, {
  458. // backgroundColor: backgroundColor,
  459. // resolution: 2,
  460. // clearBeforeRender: !1
  461. // }),
  462. // // $("#gamecontainer")[0] ? ($("#gameCanvas") && $("#gameCanvas").remove(),
  463. // // $("#gamecontainer").append(this.renderer.view)) : document.body.appendChild(this.renderer.view),
  464. // GD.Util.mobileCheck() && (GD.isMobile = !0),
  465. // GD.Util.mobileCheck()) {
  466. // var s = navigator.userAgent.toLowerCase();
  467. // -1 != s.indexOf("android 4.") ? -1 == s.indexOf("chrome") && -1 == s.indexOf("mobile safari") || (GD.soundType = 1) : GD.soundType = 1
  468. // } else
  469. // GD.soundType = 1;
  470. // requestAnimationFrame(this.update),
  471. // this.root = new PIXI.Container,
  472. // this.stage = new PIXI.Container,
  473. // this.root.addChild(this.stage),
  474. // GD.isDebug && (GD.stats = new Stats,
  475. // document.body.appendChild(GD.stats.domElement),
  476. // GD.stats.domElement.style.position = "absolute",
  477. // GD.stats.domElement.style.top = "0px"),
  478. // this.resize(),
  479. // this.setSpriteTexture(),
  480. // this.resourceLoad()
  481. }
  482. ,
  483. GD.resourceLoad = function() {
  484. var t = COMMON_IMG_PATH + "image/json/";
  485. GD.loader = PIXI.loader,
  486. GD.loader.add(t + "human_common.json"),
  487. GD.loader.add(t + "human_popup_" + this.leng + ".json")
  488. }
  489. ,
  490. GD.showProgress = function() {
  491. GD.progress = new GD.Progress,
  492. GD.progress.show(),
  493. this.stage.addChild(GD.progress)
  494. }
  495. ,
  496. GD.hideProgress = function() {
  497. GD.progress.hide(),
  498. this.stage.removeChild(GD.progress)
  499. }
  500. ,
  501. GD.resize = function() {
  502. if (GD.renderer) {
  503. var t = GD.width / GD.height
  504. , e = window.innerWidth
  505. , i = window.innerHeight
  506. , n = e / i;
  507. // if ($("#gamecontainer")[0]) {
  508. if(0) {
  509. var o = document.getElementById("gamecontainer");
  510. o.style.color = "#FF0000",
  511. n > t ? (e = i * t,
  512. o.style.width = e + "px",
  513. o.style.height = i + "px",
  514. GD.renderer.view.style.width = e + "px",
  515. GD.renderer.view.style.height = i + "px") : (i = e / t,
  516. o.style.width = e + "px",
  517. o.style.height = i + "px",
  518. GD.renderer.view.style.width = e + "px",
  519. GD.renderer.view.style.height = i + "px")
  520. } else
  521. n > t ? e = i * t : i = e / t,
  522. this.renderer.view.style.width = e + "px",
  523. this.renderer.view.style.height = i + "px"
  524. }
  525. gamen.score_view_status || this.setOrientationGuide()
  526. }
  527. ,
  528. GD.render = function() {
  529. GD.renderer.render(GD.root)
  530. }
  531. ,
  532. GD.update = function() {
  533. GD.isDebug && GD.stats.begin(),
  534. requestAnimationFrame(GD.update),
  535. GD.render(),
  536. GD.isDebug && GD.stats.end()
  537. }
  538. ,
  539. GD.buttonAction = function(t, e, i) {
  540. e || (e = 1.2),
  541. i || (i = 1),
  542. t.scale.set(e),
  543. TweenMax.to(t.scale, .2, {
  544. x: i,
  545. y: i
  546. })
  547. }
  548. ,
  549. GD.setSpriteTexture = function() {
  550. PIXI.Container.prototype.setSpriteTexture = function(t, e, i) {
  551. return "sprite" == e ? t ? t.texture = GD.loader.resources[i].texture : t = new PIXI.Sprite(GD.loader.resources[i].texture) : t ? t.texture = PIXI.Texture.fromFrame(i + ".png") : t = new PIXI.Sprite.fromFrame(i + ".png"),
  552. t
  553. }
  554. }
  555. ,
  556. GD.getDarkBg = function() {
  557. return GD.darkBg || (GD.darkBg = new PIXI.Graphics,
  558. GD.darkBg.beginFill(0, .8),
  559. GD.darkBg.drawRect(0, 0, GD.width, GD.height),
  560. GD.darkBg.endFill()),
  561. GD.darkBg
  562. }
  563. ,
  564. GD.log = function(t) {
  565. GD.isShowLog ? (GD.logStr = t + "\n" + GD.logStr,
  566. GD.logText || (GD.logText = new PIXI.Text("",{
  567. font: "14px Arial",
  568. fill: "#F7EDCA",
  569. stroke: "#000",
  570. strokeThickness: 4,
  571. wordWrapWidth: GD.width - 60,
  572. wordWrap: !0
  573. }),
  574. GD.logText.x = 30,
  575. GD.logText.y = 30),
  576. GD.logText.parent || GD.root.addChild(GD.logText),
  577. GD.logText.text = GD.logStr) : console.log(t)
  578. }
  579. ,
  580. GD.fullScreen = function() {
  581. if (GD.isMobile) {
  582. var t = navigator.platform.match(/iPhone|iPod|iPad/);
  583. if (!t) {
  584. var e = GD.renderer.view;
  585. e.requestFullscreen ? e.requestFullscreen() : e.webkitRequestFullScreen ? e.webkitRequestFullScreen() : e.mozRequestFullScreen()
  586. }
  587. }
  588. }
  589. ,
  590. GD.exitFullScreen = function() {
  591. if (GD.isMobile) {
  592. var t = navigator.platform.match(/iPhone|iPod|iPad/);
  593. if (!t) {
  594. var e = GD.renderer.view;
  595. e.exitFullscreen ? e.exitFullscreen() : e.mozCancelFullScreen ? e.mozCancelFullScreen() : e.webkitExitFullscreen && e.webkitExitFullscreen()
  596. }
  597. }
  598. }
  599. ,
  600. GD.setOrientationGuide = function() {
  601. var t = document.getElementById("rank_layout");
  602. if (t && "none" != t.style.display && com)
  603. return GD.renderer.view.style.display = "none",
  604. void GD.showOrientation(!1);
  605. var e = window.innerWidth / window.innerHeight
  606. , i = GD.width / GD.height;
  607. i > 1 ? GD.orientationType = "phone rotate_x" : GD.orientationType = "phone rotate_y",
  608. e > 1 && 1 > i || 1 > e && i > 1 ? GD.showOrientation(!0) : GD.showOrientation(!1)
  609. }
  610. ,
  611. GD.showOrientation = function(t) {
  612. // for (var e = ["Z300C", "TF701T", "TF700T", "TF103C", "TF101-1B251A", "TA2506 10BK", "SM-T805", "SM-T800", "SM-T677", "SM-T670", "SM-P900", "SMP-605", "SMP-600", "SMART-TV", "SmartTV", "SM-905", "SHW-M480W", "SHW-M380", "SHV-E230", "SGP771", "SGP311", "QM0101", "Q109", "MZ68", "MZ601", "MX1080", "MID 1065-8", "MID 1042-8", "ME102A", "LGV940", "LGV700N", "GT-P5110", "FZ-A1", "AT105", "A10-70", "10QS", "10ES"], i = e.length; i--; )
  613. // if (navigator.userAgent.match(e[i]))
  614. // return;
  615. // var n, o, s, r, a, h;
  616. // if (GD.isMobile) {
  617. // var l = document.getElementsByClassName("xy_wrap").length;
  618. // if (t) {
  619. // if (n = GD.orientationGuide,
  620. // null == n) {
  621. // if (n = document.createElement("div"),
  622. // n.style.backgroundColor = "#ff7e17",
  623. // n.style.position = "absolute",
  624. // n.style.left = 0,
  625. // n.style.top = 0,
  626. // n.style.right = 0,
  627. // n.style.bottom = 0,
  628. // n.style.margin = "auto",
  629. // n.setAttribute("class", "xy_wrap"),
  630. // GD.orientationGuide = n,
  631. // o = document.createElement("div"),
  632. // o.setAttribute("class", "xy_info"),
  633. // s = document.createElement("div"),
  634. // s.setAttribute("class", GD.orientationType),
  635. // r = document.createElement("span"),
  636. // r.setAttribute("class", "yes"),
  637. // a = document.createElement("span"),
  638. // a.setAttribute("class", "no"),
  639. // n.appendChild(o),
  640. // o.appendChild(s),
  641. // o.appendChild(r),
  642. // o.appendChild(a),
  643. // h = document.createElement("p"),
  644. // h.style.left = "0px",
  645. // h.style.right = "0px",
  646. // h.style.padding = "15px",
  647. // h.style.lineHeight = "130%",
  648. // h.style.color = "#FFFFFF",
  649. // h.style.position = "absolute",
  650. // "en" == GD.lang)
  651. // h.style.fontSize = "18px",
  652. // h.innerHTML = "Please rotate your device.";
  653. // else {
  654. // var u;
  655. // switch (GD.lang) {
  656. // case "jp":
  657. // u = "お使いの 携?電話を 回?させて 下ください。";
  658. // break;
  659. // case "en":
  660. // u = "ROTATE YOUR PHONE";
  661. // break;
  662. // case "cn":
  663. // u = "如果?幕不能旋?,?打?自?旋?功能。";
  664. // break;
  665. // default:
  666. // u = window.innerWidth > 480 ? "화면 전환이 되지 않는다면, 자동회전 기능을 켜 주세요." : "화면 전환이 되지 않는다면,<br>자동회전 기능을 켜 주세요."
  667. // }
  668. // h.innerHTML = u
  669. // }
  670. // o.appendChild(h)
  671. // }
  672. // 0 == l && (document.body.appendChild(n),
  673. // GD.orientationChange(!0),
  674. // GD.renderer.view.style.visibility = "hidden")
  675. // } else
  676. // l > 0 && (document.body.removeChild(GD.orientationGuide),
  677. // GD.orientationChange(!1),
  678. // GD.renderer.view.style.visibility = "visible")
  679. // }
  680. }
  681. ,
  682. GD.orientationChange = function(t) {
  683. t ? GD.soundMute() : GD.isAllSound && GD.soundUnMute()
  684. }
  685. ,
  686. GD.loadSound = function(t, e) {
  687. var index = 0,
  688. options = [],
  689. n = t.length;
  690. for (let o = 0, s = n; s--;) {
  691. let i = t[s];
  692. options[s] = {
  693. key: i,
  694. value: {
  695. src: [RES_DIR_SOUND + i + ".mp3?ver=" + SOUND_VERSION, RES_DIR_SOUND + i + ".ogg?ver=" + SOUND_VERSION, RES_DIR_SOUND + i + ".wav?ver=" + SOUND_VERSION],
  696. onload: function () {
  697. o++;
  698. if (index < n) {
  699. index++;
  700. let option = options[index - 1]
  701. GD.sound[option.key] = new Howl(option.value)
  702. index == n && e();
  703. }
  704. },
  705. onloaderror: function (msg) {
  706. console.error("error:", msg);
  707. o++;
  708. if (index < n) {
  709. index++;
  710. let option = options[index - 1]
  711. GD.sound[option.key] = new Howl(option.value)
  712. index == n && e();
  713. }
  714. }
  715. }
  716. }
  717. }
  718. while (index <= 4) {
  719. let option = options[index]
  720. GD.sound[option.key] = new Howl(option.value);
  721. index++;
  722. }
  723. }
  724. ,
  725. GD.bgmPlay = function(t) {
  726. var e = GD.sound.sound_bgm;
  727. e._loop = !0,
  728. t ? e._volume = t : e._volume = .3,
  729. GD.isBgmSound && e.play()
  730. }
  731. ,
  732. GD.bgmStop = function() {
  733. GD.sound.sound_bgm.stop()
  734. }
  735. ,
  736. GD.soundPlay = function(t, e, i) {
  737. var n = GD.sound[t];
  738. e || (e = 1),
  739. e ? n._volume = e : n._volume = 1,
  740. i ? n._loop = i : n._loop = !1,
  741. GD.isEffectSound && n.play()
  742. }
  743. ,
  744. GD.soundStop = function(t) {
  745. GD.isEffectSound && GD.sound[t].stop()
  746. }
  747. ,
  748. GD.soundAllStop = function() {
  749. for (var t in GD.sound)
  750. GD.sound[t].stop()
  751. }
  752. ,
  753. GD.soundMute = function() {
  754. Howler.mute(!0)
  755. }
  756. ,
  757. GD.soundUnMute = function() {
  758. GD.isAllSound && Howler.mute(!1)
  759. }
  760. ,
  761. window.onresize = function(t) {
  762. GD.resize()
  763. }
  764. }
  765. , function(t, e) {
  766. DataManager = {},
  767. DataManager.unique = null,
  768. DataManager.pk = null,
  769. DataManager.Skey = null,
  770. DataManager.Okey = null,
  771. DataManager.callFunc = null,
  772. DataManager.target = null,
  773. DataManager.playInterval = null,
  774. DataManager.start = function(t, e) {
  775. DataManager.callFunc = t,
  776. DataManager.target = e,
  777. gamen.start(DataManager.startDataComplete)
  778. }
  779. ,
  780. DataManager.startDataComplete = function(t, e, i, n, o) {
  781. if (GD.isLogin = t,
  782. GD.isLogin && (GD.sKey = gamen.spkey(n),
  783. GD.oKey = gamen.opkey(o),
  784. GD.unique = XORcipher().xorDecoder(e, GD.sKey),
  785. GD.pk = i,
  786. GD.startTime = Date.now(),
  787. GD.medal = [],
  788. null != gamen.achievement))
  789. for (var s = gamen.achievement.length, r = 0; s > r; ++r) {
  790. var a = XORcipher().xorDecoder(gamen.achievement[r], GD.sKey)
  791. , h = [];
  792. h = a.split("_gamen_"),
  793. GD.medal[r] = [parseInt(h[0]), !1, parseInt(h[1]), h[2], h[3], parseInt(h[5]), h[4]]
  794. }
  795. DataManager.callFunc.call(DataManager.target),
  796. DataManager.playInterval = setInterval(DataManager.promisePlay, .1)
  797. }
  798. ,
  799. DataManager.point = function(t, e) {
  800. if (GD.log(t + " : " + e),
  801. DataManager.otherPoint(t, e),
  802. GD.isLogin) {
  803. t = XORcipher().xorEncoder(t, GD.sKey),
  804. e = XORcipher().xorEncoder(e.toString(), GD.sKey);
  805. var i = Date.now() - GD.startTime
  806. , n = XORcipher().xorEncoder(i.toString(), GD.sKey);
  807. gamen.point(t, e, n)
  808. }
  809. }
  810. ,
  811. DataManager.otherPoint = function(t, e) {
  812. if (GD.isLogin) {
  813. t = XORcipher().xorEncoder(t, GD.oKey),
  814. e = XORcipher().xorEncoder(e.toString(), GD.oKey);
  815. var i = Date.now() - GD.startTime
  816. , n = XORcipher().xorEncoder(i.toString(), GD.oKey);
  817. gamen.otherpoint(t, e, n)
  818. }
  819. }
  820. ,
  821. DataManager.promisePlay = function() {
  822. var t = Date.now() - GD.startTime
  823. , e = XORcipher().xorEncoder(t.toString(), GD.oKey);
  824. gamen.promiseplay(e)
  825. }
  826. ,
  827. DataManager.finish = function(t) {
  828. if (DataManager.playInterval && clearInterval(DataManager.playInterval),
  829. GD.isLogin) {
  830. if (GD.medal.length > 0) {
  831. var e = []
  832. , i = GD.medal.length;
  833. gamen.new_achievement = [];
  834. for (var n = 0; i > n; ++n)
  835. e[n] = GD.medal[n][0] + "_gamen_" + GD.medal[n][2] + "_gamen_" + GD.medal[n][3] + "_gamen_" + GD.medal[n][4] + "_gamen_" + parseInt(GD.medal[n][5]),
  836. gamen.new_achievement[n] = XORcipher().xorEncoder(e[n], GD.sKey)
  837. }
  838. GD.log("finish : " + t);
  839. var o = XORcipher().xorEncoder(t.toString(), GD.sKey)
  840. , s = GD.commonOption.gameRestart.bind(GD.commonOption)
  841. , r = XORcipher().xorEncoder(GD.unique, GD.sKey)
  842. , a = XORcipher().xorEncoder(GD.startTime.toString(), GD.sKey)
  843. , h = Date.now()
  844. , l = XORcipher().xorEncoder(h.toString(), this.sKey);
  845. gamen.finish(GD.pk, o, s, r, a, l)
  846. } else
  847. gamen.finish(t, GD.commonOption.gameRestart.bind(GD.commonOption))
  848. }
  849. ,
  850. DataManager.addMedal = function(t, e) {
  851. if (GD.isLogin && GD.medal.length > 0)
  852. for (var i = null, n = 0; n < GD.medal.length; ++n)
  853. if (t == GD.medal[n][0]) {
  854. i = n,
  855. 0 == GD.medal[i][1] && (null == e && (e = 1),
  856. GD.medal[i][5] += e,
  857. GD.medal[i][2] <= GD.medal[i][5] && (GD.medal[i][1] = !0,
  858. GD.commonOption.setAchievement(i + 1)));
  859. break
  860. }
  861. }
  862. }
  863. , function(t, e) {
  864. GamePadManager = {
  865. isConnected: !1,
  866. init: function() {
  867. gamepadSupport.init()
  868. },
  869. showNotSupported: function() {},
  870. updateGamePads: function(t) {
  871. if (this.isConnected = !1,
  872. t)
  873. for (var e in t) {
  874. var i = t[e];
  875. i && (this.isConnected = !0)
  876. }
  877. },
  878. updateButton: function(t, e, i) {
  879. // t.pressed && $(this).trigger("padButton", i)
  880. },
  881. updateAxis: function(t, e, i, n, o) {
  882. // "stick-1" == n && ("stick-1-axis-x" == i ? $(this).trigger("padStickX", t) : "stick-1-axis-y" == i && $(this).trigger("padStickY", t))
  883. }
  884. }
  885. }
  886. , function(t, e) {
  887. GD.OptionPopup = function() {
  888. PIXI.Container.call(this),
  889. this.darkBg = GD.getDarkBg(),
  890. this.bg = null,
  891. this.type = null,
  892. this.allBtn = this.setSpriteTexture(this.allBtn, "texture", "option_on_0"),
  893. this.allBtn.anchor.set(.5),
  894. this.allBtn.x = 110,
  895. this.setTouchEnd(this.allBtn, function() {
  896. GD.isAllSound = !GD.isAllSound,
  897. this.setAllSoundBtn(),
  898. this.setBgmBtn(!1),
  899. this.setEffectBtn()
  900. }, this),
  901. this.bgmBtn = this.setSpriteTexture(this.bgmBtn, "texture", "option_on_0"),
  902. this.bgmBtn.anchor.set(.5),
  903. this.bgmBtn.x = this.allBtn.x,
  904. this.setTouchEnd(this.bgmBtn, function() {
  905. GD.isAllSound && (GD.isBgmSound = !GD.isBgmSound,
  906. this.setBgmBtn(!0))
  907. }, this),
  908. this.effectBtn = this.setSpriteTexture(this.effectBtn, "texture", "option_on_0"),
  909. this.effectBtn.anchor.set(.5),
  910. this.effectBtn.x = this.allBtn.x,
  911. this.setTouchEnd(this.effectBtn, function() {
  912. GD.isAllSound && (GD.isEffectSound = !GD.isEffectSound,
  913. this.setEffectBtn())
  914. }, this),
  915. this.closeBtn = this.setSpriteTexture(this.closeBtn, "texture", "option_close_btn"),
  916. this.closeBtn.anchor.set(.5),
  917. this.closeBtn.x = 200,
  918. this.setTouchStartAction(this.closeBtn, function() {
  919. this.emit("SOUND_POPUP_CLOSE_EVENT")
  920. }, this),
  921. this.tutorialBtn = this.setSpriteTexture(this.tutorialBtn, "texture", "option_help_btn"),
  922. this.tutorialBtn.anchor.set(.5),
  923. this.setTouchStartAction(this.tutorialBtn),
  924. this.setTouchEnd(this.tutorialBtn, function() {
  925. this.setInteractive(!1),
  926. this.emit("TUTORIAL_OPEN_EVENT")
  927. }, this)
  928. }
  929. ,
  930. GD.OptionPopup.constructor = GD.OptionPopup,
  931. GD.OptionPopup.prototype = Object.create(PIXI.Container.prototype),
  932. GD.OptionPopup.prototype.show = function(t) {
  933. this.removeChild(),
  934. this.type = t;
  935. var e = "option_box_0";
  936. 0 == this.type ? (1 == GD.soundType ? (this.closeBtn.y = -185,
  937. this.allBtn.y = -62) : (e = "option_box1_0",
  938. this.closeBtn.y = -92,
  939. this.allBtn.y = 25,
  940. this.allBtn.y = 30),
  941. this.bgmBtn.y = 70,
  942. this.effectBtn.y = 165) : (e = "option_box_1",
  943. 1 == GD.soundType ? (this.closeBtn.y = -247,
  944. this.allBtn.y = -124,
  945. this.tutorialBtn.y = 230) : (e = "option_box1_1",
  946. this.closeBtn.y = -148,
  947. this.allBtn.y = -27,
  948. this.tutorialBtn.y = 130),
  949. this.bgmBtn.y = 20,
  950. this.effectBtn.y = 115),
  951. this.addChild(this.darkBg),
  952. this.bg = this.setSpriteTexture(this.bg, "texture", e),
  953. this.bg.anchor.set(.5),
  954. this.bg.x = GD.width / 2,
  955. this.bg.y = GD.height / 2,
  956. this.addChild(this.bg),
  957. this.bg.addChild(this.closeBtn),
  958. this.bg.addChild(this.allBtn),
  959. 1 == GD.soundType && (this.bg.addChild(this.bgmBtn),
  960. this.bg.addChild(this.effectBtn)),
  961. 1 == this.type && this.bg.addChild(this.tutorialBtn),
  962. this.setAllSoundBtn(),
  963. this.setBgmBtn(!1),
  964. this.setEffectBtn(),
  965. this.bg.scale.set(.1),
  966. TweenMax.to(this.bg.scale, .15, {
  967. x: 1,
  968. y: 1,
  969. ease: Back.easeOut,
  970. onComplete: this.showComplete.bind(this)
  971. })
  972. }
  973. ,
  974. GD.OptionPopup.prototype.showComplete = function() {
  975. this.setInteractive(!0)
  976. }
  977. ,
  978. GD.OptionPopup.prototype.hide = function() {
  979. this.removeChild()
  980. }
  981. ,
  982. GD.OptionPopup.prototype.setAllSoundBtn = function() {
  983. GD.isAllSound ? (this.allBtn = this.setSpriteTexture(this.allBtn, "texture", "option_on_0"),
  984. GD.soundUnMute()) : (this.allBtn = this.setSpriteTexture(this.allBtn, "texture", "option_off_0"),
  985. GD.soundMute())
  986. }
  987. ,
  988. GD.OptionPopup.prototype.setBgmBtn = function(t) {
  989. GD.isAllSound ? (GD.isBgmSound ? this.bgmBtn = this.setSpriteTexture(this.bgmBtn, "texture", "option_on_0") : this.bgmBtn = this.setSpriteTexture(this.bgmBtn, "texture", "option_off_0"),
  990. t && 1 == this.type && (GD.isBgmSound ? GD.bgmPlay() : GD.bgmStop())) : GD.isBgmSound ? this.bgmBtn = this.setSpriteTexture(this.bgmBtn, "texture", "option_on_1") : this.bgmBtn = this.setSpriteTexture(this.bgmBtn, "texture", "option_off_1")
  991. }
  992. ,
  993. GD.OptionPopup.prototype.setEffectBtn = function() {
  994. GD.isAllSound ? GD.isEffectSound ? this.effectBtn = this.setSpriteTexture(this.effectBtn, "texture", "option_on_0") : this.effectBtn = this.setSpriteTexture(this.effectBtn, "texture", "option_off_0") : GD.isEffectSound ? this.effectBtn = this.setSpriteTexture(this.effectBtn, "texture", "option_on_1") : this.effectBtn = this.setSpriteTexture(this.effectBtn, "texture", "option_off_1")
  995. }
  996. ,
  997. GD.OptionPopup.prototype.setInteractive = function(t) {
  998. this.allBtn.interactive = t,
  999. this.bgmBtn.interactive = t,
  1000. this.effectBtn.interactive = t,
  1001. this.tutorialBtn.interactive = t,
  1002. this.closeBtn.interactive = t
  1003. }
  1004. ,
  1005. GD.OptionPopup.prototype.removeChild = function() {
  1006. this.removeChildren(),
  1007. this.bg && this.bg.removeChildren(),
  1008. this.setInteractive(!1)
  1009. }
  1010. }
  1011. , function(t, e) {
  1012. GD.ScorePopup = function() {
  1013. PIXI.Container.call(this),
  1014. this.darkBg = GD.getDarkBg(),
  1015. this.bg = this.setSpriteTexture(this.allBtn, "texture", "gameOver_box"),
  1016. this.bg.anchor.set(.5),
  1017. this.bg.x = GD.width / 2,
  1018. this.bg.y = GD.height / 2,
  1019. this.closeBtn = this.setSpriteTexture(this.closeBtn, "texture", "option_close_btn"),
  1020. this.closeBtn.anchor.set(.5),
  1021. this.closeBtn.x = 267,
  1022. this.closeBtn.y = -88,
  1023. this.setTouchStartAction(this.closeBtn, function() {
  1024. this.emit("SCORE_POPUP_CLOSE_EVENT")
  1025. }, this),
  1026. this.bg.addChild(this.closeBtn),
  1027. this.pointTxt = new gc.NumberText("gameOver_num_","center",-12),
  1028. this.pointTxt.y = 8,
  1029. this.bg.addChild(this.pointTxt)
  1030. }
  1031. ,
  1032. GD.ScorePopup.constructor = GD.ScorePopup,
  1033. GD.ScorePopup.prototype = Object.create(PIXI.Container.prototype),
  1034. GD.ScorePopup.prototype.show = function(t) {
  1035. this.removeChild(),
  1036. this.pointTxt.setValue(t),
  1037. this.addChild(this.darkBg),
  1038. this.addChild(this.bg),
  1039. this.bg.scale.set(.1),
  1040. TweenMax.to(this.bg.scale, .15, {
  1041. x: 1,
  1042. y: 1,
  1043. ease: Back.easeOut,
  1044. onComplete: this.showComplete.bind(this)
  1045. })
  1046. }
  1047. ,
  1048. GD.ScorePopup.prototype.showComplete = function() {
  1049. this.setInteractive(!0)
  1050. }
  1051. ,
  1052. GD.ScorePopup.prototype.setInteractive = function(t) {
  1053. this.closeBtn.interactive = t
  1054. }
  1055. ,
  1056. GD.ScorePopup.prototype.removeChild = function() {
  1057. this.setInteractive(!1),
  1058. this.removeChildren()
  1059. }
  1060. }
  1061. , function(t, e) {
  1062. GD.Util = {
  1063. zeroStr: function(t, e) {
  1064. for (var i = t.toString(), n = e - i.length; n--; )
  1065. i = "0" + i;
  1066. return i
  1067. },
  1068. randomNumber: function(t, e) {
  1069. var i = 10 * e || 1;
  1070. return Math.floor(Math.random() * t * i / i)
  1071. },
  1072. hitTest: function(t, e) {
  1073. return e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height
  1074. },
  1075. uniqueArray: function(t) {
  1076. for (var e = [], i = 0, n = t.length; n > i; i++)
  1077. -1 === e.indexOf(t[i]) && "" !== t[i] && e.push(t[i]);
  1078. return e
  1079. },
  1080. comma: function(t) {
  1081. return t = String(t),
  1082. t.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, "$1,")
  1083. },
  1084. shuffle: function(t) {
  1085. var e, i, n;
  1086. for (n = t.length; n; n--)
  1087. e = Math.floor(Math.random() * n),
  1088. i = t[n - 1],
  1089. t[n - 1] = t[e],
  1090. t[e] = i
  1091. },
  1092. grep: function(t, e) {
  1093. return jQuery.grep(t, function(t) {
  1094. return t != e
  1095. })
  1096. },
  1097. getParam: function(t) {
  1098. var e = window.location.search.match(new RegExp("(?:[?&]" + t + "=)([^&]+)"));
  1099. return e ? e[1] : null
  1100. },
  1101. mobileCheck: function() {
  1102. return !!(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i))
  1103. },
  1104. radiansToDegrees: function(t) {
  1105. return t * Math.PI / 180
  1106. },
  1107. degreesToradians: function(t) {
  1108. return 180 * t / Math.PI
  1109. }
  1110. }
  1111. }
  1112. , function(t, e) {
  1113. GD.Achievement = function() {
  1114. PIXI.Container.call(this),
  1115. this.icons = [],
  1116. this.idx = 0
  1117. }
  1118. ,
  1119. GD.Achievement.constructor = GD.Achievement,
  1120. GD.Achievement.prototype = Object.create(PIXI.Container.prototype),
  1121. GD.Achievement.prototype.show = function(t, e) {
  1122. var i = this.setSpriteTexture(null, "texture", "medal_box");
  1123. i.anchor.set(.5),
  1124. i.scale.set(.3),
  1125. i.idx = this.idx,
  1126. i.x = GD.width + 50,
  1127. e ? i.y = e : i.y = 140,
  1128. this.icons.length > 0 && (i.y += 100 * this.icons.length),
  1129. GD.log("game_medal_" + t);
  1130. var n = this.setSpriteTexture(null, "sprite", "game_medal_" + t);
  1131. n.anchor.set(.5),
  1132. n.y = -30,
  1133. i.addChild(n),
  1134. this.addChild(i),
  1135. this.icons.push(i),
  1136. setTimeout(function() {
  1137. TweenMax.to(i, .5, {
  1138. x: GD.width - 50,
  1139. ease: Back.easeOut,
  1140. onComplete: this.iconHide.bind(this),
  1141. onCompleteParams: [i]
  1142. })
  1143. }
  1144. .bind(this), 3),
  1145. this.idx++
  1146. }
  1147. ,
  1148. GD.Achievement.prototype.iconHide = function(t) {
  1149. TweenMax.to(t, .5, {
  1150. x: GD.width + 50,
  1151. delay: 2,
  1152. ease: Back.easeIn,
  1153. onComplete: function() {
  1154. for (var e, i = this.icons.length; i--; )
  1155. if (e = this.icons[i],
  1156. e.idx == t.idx) {
  1157. this.icons.splice(i, 1),
  1158. this.removeChild(e);
  1159. break
  1160. }
  1161. }
  1162. .bind(this)
  1163. })
  1164. }
  1165. ,
  1166. GD.Achievement.prototype.removeAll = function() {
  1167. this.removeChildren()
  1168. }
  1169. }
  1170. , function(t, e) {
  1171. GD.GamePadGuide = function() {
  1172. PIXI.Container.call(this),
  1173. this.guide = this.setSpriteTexture(this.guide, "sprite", "gamePadGuide"),
  1174. this.setTouchEnd(this.guide, function() {
  1175. this.setInteractive(!1),
  1176. this.removeChild(this.guide),
  1177. this.emit("GAME_PAD_GUIDE_CLOSE_EVENT")
  1178. }
  1179. .bind(this))
  1180. }
  1181. ,
  1182. GD.GamePadGuide.constructor = GD.GamePadGuide,
  1183. GD.GamePadGuide.prototype = Object.create(PIXI.Container.prototype),
  1184. GD.GamePadGuide.prototype.init = function() {
  1185. this.removeChild(),
  1186. this.addChild(this.guide),
  1187. this.setInteractive(!0)
  1188. }
  1189. ,
  1190. GD.GamePadGuide.prototype.setInteractive = function(t) {
  1191. this.guide.interactive = t
  1192. }
  1193. ,
  1194. GD.GamePadGuide.prototype.removeChild = function() {
  1195. this.removeChildren()
  1196. }
  1197. }
  1198. , function(t, e) {
  1199. GD.LoadingView = function() {
  1200. PIXI.Container.call(this),
  1201. this.darkBg = GD.getDarkBg(),
  1202. this.img = this.setSpriteTexture(null, "texture", "loadingCircle"),
  1203. this.img.scale.set(.8),
  1204. this.img.anchor.set(.5),
  1205. this.img.x = GD.width / 2,
  1206. this.img.y = GD.height / 2,
  1207. this.addChild(this.img)
  1208. }
  1209. ,
  1210. GD.LoadingView.constructor = GD.LoadingView,
  1211. GD.LoadingView.prototype = Object.create(PIXI.Container.prototype),
  1212. GD.LoadingView.prototype.init = function() {
  1213. this.removeAll(),
  1214. this.addChild(this.darkBg),
  1215. this.addChild(this.img)
  1216. }
  1217. ,
  1218. GD.LoadingView.prototype.removeAll = function() {
  1219. this.removeChildren()
  1220. }
  1221. ,
  1222. GD.LoadingView.prototype.updateTransform = function() {
  1223. PIXI.Container.prototype.updateTransform.call(this),
  1224. this.img.rotation += .1
  1225. }
  1226. ,
  1227. GD.LoadingView.getInstance = function() {
  1228. return GD.loading || (GD.loading = new GD.LoadingView),
  1229. GD.loading
  1230. }
  1231. }
  1232. , function(t, e) {
  1233. GD.Progress = function() {
  1234. this.bg = null,
  1235. this.logo = null,
  1236. this.logoTxt = null,
  1237. // this.tween = null,
  1238. PIXI.Container.call(this)
  1239. }
  1240. ,
  1241. GD.Progress.constructor = GD.Progress,
  1242. GD.Progress.prototype = Object.create(PIXI.Container.prototype),
  1243. GD.Progress.prototype.show = function() {
  1244. if (this.bg || (this.bg = new PIXI.Graphics,
  1245. this.bg.beginFill(16777215, 1),
  1246. this.bg.drawRect(0, 0, GD.width, GD.height),
  1247. this.bg.endFill()),
  1248. this.addChild(this.bg),
  1249. !this.logo) {
  1250. var logo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABoCAYAAAAU9xXbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuN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AzJKzZus4WNBGviDgWdUz5Ve7C/XJqxt0EMKSpIriLm41MizNDbEwVvUzDbt4rK3nT1QwYhqHjmNusQMt5H5E7iK6pJHdVO2BImLfCFuHn+7ZQXi+yMde5Xbg7vlU+VTtgrhdHqPdl7sVKREcJxnWS3MO+wNixYEolFY1gqhPdJ2EPQswS432Ux1BH7y8cBxogpj7qfQDsd5DDB2a48eLSV6gM8vIe4e0zv4HS/wUYAJEhl2U0gO8nAAAAAElFTkSuQmCC"
  1251. this.logo = new PIXI.Sprite.fromImage(logo)
  1252. }
  1253. this.logo.x = GD.width / 2,
  1254. this.logo.y = GD.height / 2,
  1255. this.logo.anchor.set(.5),
  1256. this.logo.scale.set(.1),
  1257. this.logo.rotation = 20,
  1258. this.addChild(this.logo),
  1259. this.tween ? this.tween.kill() : this.tween = new TimelineLite,
  1260. this.tween.to(this.logo, 1, {
  1261. rotation: 0,
  1262. ease: Sine.easeOut
  1263. }),
  1264. this.tween.call(this.showLocoText.bind(this)),
  1265. TweenMax.to(this.logo.scale, 1, {
  1266. x: 1,
  1267. y: 1
  1268. })
  1269. }
  1270. ,
  1271. GD.Progress.prototype.showLocoText = function() {
  1272. if (!this.logoTxt) {
  1273. var logoTxt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO8AAABgCAYAAAD1liW0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy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+bCWmz5LSAElgLeZagRbOXW9BayG68OIu8fNWr9cwFkN5mGiusuo9zF275pgWmR8lg4euku7AOYoHzTYWS3KL/UgA/mVDLz7O7nutWP9LOUPuB6O43MJlKsZsJPT2MmqTGsfHTh1qYv21B1ubIhU2eyeoIW6XjKXYB+Dx28WiLIGTWM730ce/92sArzB1ZX/KlxV1P1WDKevcjCuXMtZ3wHSd3ayGr5PFa1t8TMtxGKCqz7bqho8rAUxoNfsngePM/D2cZux43pLu4xXuB8q1QIewFfcyI3zJWKb8C3/WSP+yIym2eNiSbyCqyZFD5VVq0juzm/TDsXPGcwk9n3wG9nzWMJE3FFjDI8met4HylPMS/+Q64jT7Dv53ODe2HutBxR5K+KeRWEUyl35GEqRU8SIuaNX5ffDSOvinoF9LLVNcygfJ+xl2rODoZ1KDhkTm1AoepL5vL03wIMANN/MUNK60tEAAAAAElFTkSuQmCC"
  1274. this.logoTxt = new PIXI.Sprite.fromImage(logoTxt),
  1275. this.logoTxt.anchor.set(.5),
  1276. this.logoTxt.scale.set(1),
  1277. this.logoTxt.y = GD.height / 2
  1278. }
  1279. this.logoTxt.x = GD.width / 2 + 65,
  1280. this.logoTxt.alpha = 0,
  1281. this.addChild(this.logoTxt),
  1282. TweenMax.to(this.logo, .4, {
  1283. x: GD.width / 2 - 110,
  1284. ease: Sine.easeOut
  1285. }),
  1286. TweenMax.to(this.logoTxt, .4, {
  1287. x: GD.width / 2 + 90,
  1288. alpha: 1,
  1289. ease: Sine.easeOut
  1290. }),
  1291. TweenMax.delayedCall(2, this.replay.bind(this))
  1292. }
  1293. ,
  1294. GD.Progress.prototype.replay = function() {
  1295. this.hide(),
  1296. this.show()
  1297. }
  1298. ,
  1299. GD.Progress.prototype.hide = function() {
  1300. TweenMax.killAll(),
  1301. // this.tween.clear(),
  1302. this.removeChildren()
  1303. }
  1304. ,
  1305. GD.Progress.prototype.updateTransform = function() {
  1306. PIXI.Container.prototype.updateTransform.call(this)
  1307. }
  1308. }
  1309. , function(t, e) {
  1310. GD.Tutorial = function() {
  1311. PIXI.Container.call(this),
  1312. this.type = 1,
  1313. this.tutorialImg = null,
  1314. this.nowPage = 0,
  1315. this.totalPage = 0,
  1316. this.contents = [],
  1317. this.container = new PIXI.Container,
  1318. this.img = this.setSpriteTexture(this.img, "texture", "temp"),
  1319. this.prevBtn = this.setSpriteTexture(this.prevBtn, "texture", "temp"),
  1320. this.prevBtn.anchor.set(.5),
  1321. this.prevBtn.x = 30,
  1322. this.prevBtn.y = GD.height / 2,
  1323. this.setTouchStartAction(this.prevBtn, function() {
  1324. this.nowPage > 0 && this.initPage(this.nowPage - 1)
  1325. }, this),
  1326. this.addChild(this.prevBtn),
  1327. this.nextBtn = this.setSpriteTexture(this.nextBtn, "texture", "temp"),
  1328. this.nextBtn.anchor.set(.5),
  1329. this.nextBtn.x = GD.width - 30,
  1330. this.nextBtn.y = GD.height / 2,
  1331. this.setTouchStartAction(this.nextBtn, function() {
  1332. this.nowPage + 1 < this.totalPage && this.initPage(this.nowPage + 1)
  1333. }, this),
  1334. this.addChild(this.nextBtn),
  1335. this.closeBtn = this.setSpriteTexture(this.closeBtn, "texture", "temp"),
  1336. this.closeBtn.anchor.set(.5),
  1337. this.closeBtn.x = GD.width / 2,
  1338. this.closeBtn.y = GD.height - 105,
  1339. this.setTouchStartAction(this.closeBtn),
  1340. this.setTouchEnd(this.closeBtn, function() {
  1341. this.emit("TUTORIAL_CLOSE_EVENT")
  1342. }, this),
  1343. this.addChild(this.closeBtn)
  1344. }
  1345. ,
  1346. GD.Tutorial.constructor = GD.Tutorial,
  1347. GD.Tutorial.prototype = Object.create(PIXI.Container.prototype),
  1348. GD.Tutorial.prototype.init = function(t, e) {
  1349. this.removeChild(),
  1350. this.type = 1,
  1351. this.tutorialImg = e,
  1352. this.nowPage = 0,
  1353. this.totalPage = t,
  1354. this.addChild(this.img),
  1355. this.addChild(this.closeBtn),
  1356. this.initPageButton(),
  1357. this.setTutorialImg(),
  1358. this.setInteractive(!0),
  1359. this.setButtons()
  1360. }
  1361. ,
  1362. GD.Tutorial.prototype.initContent = function(t, e) {
  1363. this.removeChild(),
  1364. this.type = 2,
  1365. this.nowPage = 0,
  1366. this.totalPage = t,
  1367. this.contents = e,
  1368. this.addChild(this.container),
  1369. this.addChild(this.closeBtn),
  1370. this.container.addChild(this.contents[0]),
  1371. this.setContent(),
  1372. this.initPageButton(),
  1373. this.setInteractive(!0),
  1374. this.setButtons()
  1375. }
  1376. ,
  1377. GD.Tutorial.prototype.initPage = function(t, e) {
  1378. this.nowPage = t,
  1379. e && (this.closeBtn = this.setSpriteTexture(this.closeBtn, "texture", e)),
  1380. 1 == this.type ? this.setTutorialImg() : this.setContent(),
  1381. this.setButtons()
  1382. }
  1383. ,
  1384. GD.Tutorial.prototype.initPageButton = function() {
  1385. this.totalPage > 0 && (this.prevBtn = this.setSpriteTexture(this.prevBtn, "texture", "help_prev"),
  1386. this.nextBtn = this.setSpriteTexture(this.nextBtn, "texture", "help_next"),
  1387. this.prevBtn.scale.set(1),
  1388. this.nextBtn.scale.set(1),
  1389. this.addChild(this.prevBtn),
  1390. this.addChild(this.nextBtn))
  1391. }
  1392. ,
  1393. GD.Tutorial.prototype.setPrevButtonPos = function(t, e) {
  1394. this.prevBtn.x = t,
  1395. this.prevBtn.y = e
  1396. }
  1397. ,
  1398. GD.Tutorial.prototype.setNextButtonPos = function(t, e) {
  1399. this.nextBtn.x = t,
  1400. this.nextBtn.y = e
  1401. }
  1402. ,
  1403. GD.Tutorial.prototype.setCloseButtonPos = function(t, e) {
  1404. this.closeBtn.x = t,
  1405. this.closeBtn.y = e
  1406. }
  1407. ,
  1408. GD.Tutorial.prototype.setTutorialImg = function() {
  1409. this.img = this.setSpriteTexture(this.img, "texture", this.tutorialImg + (this.nowPage + 1))
  1410. }
  1411. ,
  1412. GD.Tutorial.prototype.setContent = function() {
  1413. this.container.removeChildren();
  1414. var t = this.contents[this.nowPage];
  1415. t.init && t.init(),
  1416. this.container.addChild(t)
  1417. }
  1418. ,
  1419. GD.Tutorial.prototype.setButtons = function() {
  1420. this.totalPage > 0 && (0 == this.nowPage ? (this.prevBtn.alpha = .3,
  1421. this.nextBtn.alpha = 1,
  1422. this.prevBtn.interactive = !1,
  1423. this.nextBtn.interactive = !0) : this.nowPage + 1 == this.totalPage ? (this.prevBtn.alpha = 1,
  1424. this.nextBtn.alpha = .3,
  1425. this.prevBtn.interactive = !0,
  1426. this.nextBtn.interactive = !1) : (this.prevBtn.alpha = 1,
  1427. this.nextBtn.alpha = 1,
  1428. this.prevBtn.interactive = !0,
  1429. this.nextBtn.interactive = !0))
  1430. }
  1431. ,
  1432. GD.Tutorial.prototype.setInteractive = function(t) {
  1433. this.prevBtn.interactive = t,
  1434. this.nextBtn.interactive = t,
  1435. this.closeBtn.interactive = t
  1436. }
  1437. ,
  1438. GD.Tutorial.prototype.removeChild = function() {
  1439. this.setInteractive(!1),
  1440. this.container.removeChildren(),
  1441. this.removeChildren()
  1442. }
  1443. ,
  1444. GD.Tutorial.getInstance = function() {
  1445. return GD.tutorial || (GD.tutorial = new GD.Tutorial),
  1446. GD.tutorial
  1447. }
  1448. }
  1449. ]);
  1450. module.exports.GD = GD;
  1451. var {pixelRatio, windowWidth, windowHeight} = wx.getSystemInfoSync()
  1452. var gWidth = windowWidth * pixelRatio
  1453. var gHeight = windowHeight * pixelRatio
  1454. var gc = {
  1455. loader:null,
  1456. stats:null,
  1457. width:gWidth,
  1458. height:gHeight,
  1459. stage:null,
  1460. intro:null,
  1461. tutorial:null,
  1462. game:null
  1463. };
  1464. gc.MovieClip = function(fileName, start, end, speed, repeat) {
  1465. PIXI.extras.AnimatedSprite.call(this, this.getRepeatTexture(fileName, start, end, repeat));
  1466. this.animationSpeed = speed;
  1467. this.play();
  1468. };
  1469. gc.MovieClip.constructor = gc.MovieClip;
  1470. gc.MovieClip.prototype = Object.create(PIXI.extras.AnimatedSprite.prototype);
  1471. gc.MovieClip.prototype.setAnimation = function(fileName, start, end, speed, repeat){
  1472. this.textures = this.getRepeatTexture(fileName, start, end, repeat);
  1473. this.animationSpeed = speed;
  1474. };
  1475. gc.MovieClip.prototype.getRepeatTexture = function(fileName, start, end, repeat){
  1476. var textures = [];
  1477. var i = repeat || 1;
  1478. while(i--){
  1479. textures = textures.concat(this.getTexture(fileName, start, end));
  1480. }
  1481. return textures;
  1482. };
  1483. gc.MovieClip.prototype.getTexture = function(fileName, start, end){
  1484. start = start || 1;
  1485. var textures = [],
  1486. i = end - start + 1,
  1487. j = start;
  1488. while(i--) {
  1489. if(j < 10){textures.push(PIXI.Texture.fromFrame(fileName + '0' + j + '.png'));}
  1490. else {textures.push(PIXI.Texture.fromFrame(fileName + j + '.png'));}
  1491. j++;
  1492. }
  1493. return textures;
  1494. };
  1495. gc.MovieClip.prototype.updateTransform = function() {
  1496. PIXI.extras.AnimatedSprite.prototype.updateTransform.call(this);
  1497. };
  1498. gc.NumberText = function(fileName, align, space, iconName, iconAlign, strLen) {
  1499. this.CENTER = 'center';
  1500. this.RIGHT = 'right';
  1501. this.value = 0;
  1502. this.isChange = false;
  1503. this.list = [];
  1504. this.tmpList = [];
  1505. this.fileName = fileName;
  1506. this.align = align;
  1507. this.space = space;
  1508. this.iconName = iconName;
  1509. this.iconAlign = iconAlign;
  1510. this.strLen = strLen;
  1511. this.icon = null;
  1512. PIXI.Container.call(this);
  1513. this.container = new PIXI.Container();
  1514. this.addChild(this.container);
  1515. this.setValue(0);
  1516. };
  1517. gc.NumberText.constructor = gc.NumberText;
  1518. gc.NumberText.prototype = Object.create(PIXI.Container.prototype);
  1519. gc.NumberText.prototype.setValue = function(value){
  1520. this.value = value;
  1521. this.isChange = true;
  1522. };
  1523. gc.NumberText.prototype.getNumberSprite = function(num){
  1524. var sprite, name = this.fileName + num + '.png';
  1525. if(this.tmpList.length > 0){
  1526. sprite = this.tmpList.shift();
  1527. sprite.texture = PIXI.Texture.fromFrame(name);
  1528. }else{
  1529. sprite = PIXI.Sprite.fromFrame(name);
  1530. }
  1531. return sprite;
  1532. };
  1533. gc.NumberText.prototype.removeAll = function(){
  1534. var txt, i = this.list.length;
  1535. while(i--){
  1536. txt = this.list.shift();
  1537. this.tmpList.push(txt);
  1538. }
  1539. if(this.container) this.container.removeChildren();
  1540. };
  1541. gc.NumberText.prototype.updateTransform = function() {
  1542. if(this.isChange){
  1543. this.removeAll();
  1544. var numStr = this.value.toString();
  1545. if(this.strLen) numStr = Util.zeroStr(this.value, this.strLen);
  1546. var index = 0, txt,
  1547. space = 0,
  1548. i = numStr.length;
  1549. if(this.iconName){
  1550. if(!this.icon) this.icon = PIXI.Sprite.fromFrame(this.iconName + '.png');
  1551. this.container.addChild(this.icon);
  1552. if(this.iconAlign == 'left'){
  1553. space += this.icon.width + this.space;
  1554. }
  1555. }
  1556. while(i--){
  1557. txt = this.getNumberSprite(parseInt(numStr.substr(index, 1))+1);
  1558. txt.x = space;
  1559. space += txt.width + this.space;
  1560. index++;
  1561. this.container.addChild(txt);
  1562. this.list[i] = txt;
  1563. }
  1564. if(this.iconAlign == 'right'){
  1565. this.icon.x = space;
  1566. space += this.icon.width + this.space;
  1567. }
  1568. if(this.align == this.CENTER){
  1569. this.container.x = -space/2;
  1570. }else if(this.align == this.RIGHT){
  1571. this.container.x = -space;
  1572. }
  1573. this.isChange = false;
  1574. }
  1575. PIXI.Container.prototype.updateTransform.call(this);
  1576. };
  1577. gc.GameScene = function(){
  1578. PIXI.Container.call(this);
  1579. this.lastEventTime = undefined; //Time the click occurred
  1580. //120
  1581. this.cookieMatrixPos = [[75,550], [170,550], [265,550], [360,550], [455,550], [550,550], [645,550],
  1582. [75,645], [170,645], [265,645], [360,645], [455,645], [550,645], [645,645],
  1583. [75,740], [170,740], [265,740], [360,740], [455,740], [550,740], [645,740],
  1584. [75,835], [170,835], [265,835], [360,835], [455,835], [550,835], [645,835],
  1585. [75,935], [170,935], [265,935], [360,935], [455,935], [550,935], [645,935],
  1586. [75,1030], [170,1030], [265,1030], [360,1030], [455,1030], [550,1030], [645,1030],
  1587. [75,1125], [170,1125], [265,1125], [360,1125], [455,1125], [550,1125], [645,1125]];
  1588. this.cookieNumMatrix = [];
  1589. this.cookieMatrix = [];
  1590. this.itemEffectMc = [];
  1591. this.bombAnerge = 0;
  1592. this.bombfull = 50;
  1593. this.fixArr1 = [];
  1594. this.fixArr2 = [];
  1595. this.readytxt = true;
  1596. this.starttxt = false;
  1597. this.playGame = false;
  1598. this.addPoint = 0;
  1599. this.itemIndex = undefined;
  1600. this.itemIndex1 = undefined;
  1601. this.itemIndex2 = undefined;
  1602. this.itemIndexes = [];
  1603. this.canClick = false;
  1604. this.hint = [];
  1605. this.giveHint = false;
  1606. this.bundle = [];
  1607. this.prestageMode = 'normal';
  1608. this.stageMode = 'normal';
  1609. this.chance = 60;
  1610. this.useItem = false;
  1611. this.remembers = [];//Store cookies like items
  1612. this.combo = 0;
  1613. this.restComboTime = 0;
  1614. this.lastTime = undefined;
  1615. this.totalCombo = 0; //Combo 3 times or more .. Medal 1, Combo 100 times or more .. Medal 4
  1616. this.champagneCombo = 0; //Champagne 10 times .. Medals 2
  1617. this.bombCombo = 0; //Bomb item 10 times .. Medals 3
  1618. this.getMedal1 = false;
  1619. this.getMedal2 = false;
  1620. this.getMedal3 = false;
  1621. this.getMedal4 = false;
  1622. this.callfevercnt = 0;
  1623. this.lastEnd = false; //To prevent timeup if last fang
  1624. this.bumpscale = 0.01;
  1625. this.pauseMode = false;
  1626. this.pauseTime = 0;
  1627. this.exceptSound = false; //During mode change = To inform the fiver sound only once when using the item
  1628. };
  1629. gc.GameScene.constructor = gc.GameScene;
  1630. gc.GameScene.prototype = Object.create(PIXI.Container.prototype);
  1631. gc.GameScene.prototype.init = function() {
  1632. this.readytxt = true;
  1633. this.starttxt = false;
  1634. this.declareObjects();
  1635. this.setBG();
  1636. this.readyGame();
  1637. this.fever = setInterval(this.setFever.bind(this), 33.333);
  1638. this.test = true;
  1639. this.explode();
  1640. this.stageMode = 'fever';
  1641. this.actFever(); //Make a one-time call to resolve the bug in the first peer
  1642. //Return to default mode
  1643. this.stageMode = 'normal';
  1644. this.normalMode();
  1645. };
  1646. //Create Object
  1647. gc.GameScene.prototype.declareObjects = function () {
  1648. this.bomb = new PIXI.Sprite.fromFrame('bomb_0001.png');
  1649. this.bombgauge = new PIXI.Sprite.fromFrame('bomb_gauge_bar_0001.png');
  1650. this.chanceImg= new gc.NumberText('score_num_', 'center', -4);
  1651. this.readyBG = new PIXI.Sprite(GD.loader.resources['ready_bg'].texture);
  1652. this.readyImg = new PIXI.Sprite.fromFrame('ready_0001.png');
  1653. this.startImg = new PIXI.Sprite.fromFrame('start_0001.png');
  1654. this.gameoverImg = new PIXI.Sprite.fromFrame('gameover.png');
  1655. for(var i=0; i<this.cookieMatrixPos.length; i++) {
  1656. this.cookieMatrix[i] = new PIXI.Sprite.fromFrame('cookie_0001.png');
  1657. this.itemEffectMc[i] = new gc.MovieClip('item_effect_00', 1, 14, 0.2);
  1658. }
  1659. this.gameBG = new PIXI.Sprite(GD.loader.resources['game_bg'].texture);
  1660. this.gameTable = new PIXI.Sprite(GD.loader.resources['game_table'].texture);
  1661. this.shadow = new PIXI.Sprite(GD.loader.resources['shadow_bg'].texture);
  1662. this.fevereffect1 = new gc.MovieClip('fever_effect_1_00', 1, 23, 0.3, true);
  1663. this.fevereffect2 = new gc.MovieClip('fever_effect_2_00', 1, 29, 0.3, true);
  1664. this.normalmomo = new gc.MovieClip('momo_normal_00', 1, 50, 0.3);
  1665. this.fevermomo = new gc.MovieClip('momo_fever_00', 1, 43, 0.3);
  1666. this.normalshushu = new gc.MovieClip('shushu_normal_00', 1, 12, 0.3);
  1667. this.fevershushu = new gc.MovieClip('shushu_fever_00', 1, 17, 0.3);
  1668. this.timeup = new PIXI.Sprite.fromFrame('momotime_0001.png');
  1669. this.scoreTxt= new gc.NumberText('score_num_', 'center', -4);
  1670. this.crossEffect1 = new PIXI.Sprite.fromFrame('line_clear_effect.png');
  1671. this.crossEffect2 = new PIXI.Sprite.fromFrame('line_clear_effect.png');
  1672. this.superfeverText = new PIXI.Sprite.fromFrame('super_fever_0001.png');
  1673. this.feverText = new PIXI.Sprite.fromFrame('fever_0001.png');
  1674. };
  1675. //Game settings
  1676. gc.GameScene.prototype.readyGame = function() {
  1677. if(this.readytxt) {
  1678. GD.soundPlay('sound_ready');
  1679. this.readyBG.anchor.set(0.5);
  1680. this.readyBG.position.x = GD.width / 2;
  1681. this.readyBG.position.y = GD.height / 2;
  1682. this.addChild(this.readyBG);
  1683. this.readyImg.anchor.set(0.5);
  1684. this.readyImg.position = this.readyBG.position;
  1685. this.readyImg.scale.x = 0;
  1686. this.readyImg.scale.y = 0;
  1687. TweenMax.to(this.readyImg.scale, 0.8, {x:1, y:1});
  1688. this.addChild(this.readyImg);
  1689. this.readytxt = false;
  1690. this.starttxt = true;
  1691. setTimeout(this.startGame.bind(this), 1000);
  1692. }
  1693. };
  1694. gc.GameScene.prototype.startGame = function() {
  1695. if(this.starttxt){
  1696. GD.soundPlay('sound_start');
  1697. this.readyImg.visible = false;
  1698. this.startImg.anchor.set(0.5);
  1699. this.startImg.position = this.readyImg.position;
  1700. this.startImg.scale.x = 0;
  1701. this.startImg.scale.y = 0;
  1702. TweenMax.to(this.startImg.scale, 0.5, {x:1.2, y:1.2});
  1703. this.addChild(this.startImg);
  1704. setTimeout(this.playStart.bind(this),600);
  1705. }
  1706. };
  1707. gc.GameScene.prototype.setItemEffect = function () {
  1708. for(var i=0; i<this.cookieMatrix.length; i++) this.cookieMatrix[i].removeChild(this.itemEffectMc[i]);
  1709. for(var i=0; i<this.cookieMatrixPos.length; i++){
  1710. this.itemEffectMc[i].anchor.set(0.5);
  1711. this.itemEffectMc[i].stop();
  1712. this.itemEffectMc[i].alpha = 0;
  1713. this.cookieMatrix[i].addChild(this.itemEffectMc[i]);
  1714. }
  1715. };
  1716. gc.GameScene.prototype.playStart = function(){
  1717. this.removeChild(this.readyImg);
  1718. this.removeChild(this.startImg);
  1719. this.readyBG.visible = false;
  1720. this.setCookies();
  1721. };
  1722. gc.GameScene.prototype.setBG = function() {
  1723. this.gameTable.position.y = 470;
  1724. this.addChild(this.gameBG);
  1725. this.setFeverEffect2();
  1726. this.setMomo();
  1727. this.setShushu();
  1728. this.gameBG.addChild(this.gameTable);
  1729. this.setBomb();
  1730. this.setChance();
  1731. this.makeShadow();
  1732. this.setScore();
  1733. this.setFeverEffect1();
  1734. };
  1735. gc.GameScene.prototype.makeShadow = function () {
  1736. this.shadowContainer.addChild(this.shadow);
  1737. this.shadow.alpha = 0;
  1738. };
  1739. gc.GameScene.prototype.setFeverEffect1 = function() {
  1740. this.fevereffect1.anchor.set(0.5);
  1741. this.fevereffect1.position.x = gc.width/2;
  1742. this.fevereffect1.position.y = 600;
  1743. this.addChild(this.fevereffect1);
  1744. this.fevereffect1.alpha = 0;
  1745. };
  1746. gc.GameScene.prototype.setFeverEffect2 = function() {
  1747. this.fevereffect2.anchor.set(0.5);
  1748. this.fevereffect2.position.x = gc.width/2;
  1749. this.fevereffect2.position.y = 288.5;
  1750. this.gameBG.addChild(this.fevereffect2);
  1751. this.fevereffect2.alpha = 0;
  1752. };
  1753. gc.GameScene.prototype.setMomo = function() {
  1754. this.normalmomo.position.x = gc.width / 2;
  1755. this.normalmomo.position.y = 220;
  1756. this.gameBG.addChild(this.normalmomo);
  1757. this.fevermomo.position.x = this.normalmomo.x;
  1758. this.fevermomo.position.y = this.normalmomo.y;
  1759. this.fevermomo.alpha = 0;
  1760. this.fevermomo.stop();
  1761. this.gameBG.addChild(this.fevermomo);
  1762. };
  1763. gc.GameScene.prototype.setShushu = function() {
  1764. this.normalshushu.position.x = gc.width / 4;
  1765. this.normalshushu.position.y = 300;
  1766. this.gameBG.addChild(this.normalshushu);
  1767. this.fevershushu.position.x = this.normalshushu.x;
  1768. this.fevershushu.position.y = this.normalshushu.y;
  1769. this.fevershushu.alpha = 0;
  1770. this.fevershushu.stop();
  1771. this.gameBG.addChild(this.fevershushu);
  1772. };
  1773. gc.GameScene.prototype.normalMode = function () {
  1774. console.log('normal');
  1775. this.fevermomo.alpha = 0;
  1776. this.fevermomo.stop();
  1777. this.normalmomo.alpha = 1;
  1778. this.normalmomo.play();
  1779. this.fevershushu.alpha = 0;
  1780. this.fevershushu.stop();
  1781. this.normalshushu.alpha = 1;
  1782. this.normalshushu.play();
  1783. };
  1784. gc.GameScene.prototype.otherMode = function () {
  1785. console.log('other');
  1786. this.normalmomo.alpha = 0;
  1787. this.normalmomo.stop();
  1788. this.fevermomo.alpha = 1;
  1789. this.fevermomo.play();
  1790. this.normalshushu.alpha = 0;
  1791. this.normalshushu.stop();
  1792. this.fevershushu.alpha = 1;
  1793. this.fevershushu.play();
  1794. };
  1795. gc.GameScene.prototype.setChance = function () {
  1796. if(this.explodeContainer == undefined) {
  1797. this.explodeContainer = new PIXI.Container();
  1798. this.explodeContainer.position = this.gameBG.position;
  1799. this.explodeContainer.width = this.gameBG.width;
  1800. this.explodeContainer.height = this.gameBG.height;
  1801. this.addChild(this.explodeContainer);
  1802. }
  1803. this.shadowContainer = new PIXI.Container();
  1804. this.addChild(this.shadowContainer);
  1805. if(this.explodeContainer2 == undefined) {
  1806. this.explodeContainer2 = new PIXI.Container();
  1807. this.explodeContainer2.position = this.gameBG.position;
  1808. this.explodeContainer2.width = this.gameBG.width;
  1809. this.explodeContainer2.height = this.gameBG.height;
  1810. this.addChild(this.explodeContainer2);
  1811. }
  1812. this.chanceImg.x = 55;
  1813. this.chanceImg.y = 45;
  1814. this.chanceImg.scale.x = 0.8;
  1815. this.chanceImg.scale.y = 0.8;
  1816. this.rangeChance();
  1817. };
  1818. //남은 기회 표시
  1819. gc.GameScene.prototype.rangeChance = function () {
  1820. this.chanceImg.setValue(this.chance);
  1821. };
  1822. //라스트팡(남은 아이템 클리어)=======================================================================================
  1823. gc.GameScene.prototype.lastPang = function () {
  1824. this.lastEnd = true;
  1825. this.itemOver = false;
  1826. this.scanIndex = undefined;
  1827. this.useItem = false;
  1828. var count = 0;
  1829. for(var i=0; i<this.cookieNumMatrix.length; i++){
  1830. if(this.cookieNumMatrix[i] > 6){
  1831. this.scanIndex = i;
  1832. this.useItem = true;
  1833. if (this.cookieNumMatrix[i] == 10) {this.actBomb(i);}
  1834. else if (this.cookieNumMatrix[i] == 9) {this.actEqual(i);}
  1835. else if (this.cookieNumMatrix[i] == 8) {
  1836. this.crossIndex = i;
  1837. this.actCross(i);
  1838. }
  1839. break;
  1840. } else {count++;}
  1841. }
  1842. if(count == this.cookieNumMatrix.length) {
  1843. this.itemOver = true;
  1844. this.checkMatching3();
  1845. }
  1846. };
  1847. //게임오버===========================================================================================================
  1848. gc.GameScene.prototype.setGameOver = function(){
  1849. this.canClick = false;
  1850. this.playGame = false;
  1851. this.checkLeftItem();
  1852. if(this.lastEnd) {
  1853. this.timeup.anchor.set(0.5);
  1854. this.timeup.position.x = this.gameBG.width / 2;
  1855. this.timeup.position.y = GD.height/2+50;
  1856. this.timeup.scale.x = 0;
  1857. this.timeup.scale.y = 0;
  1858. this.addChild(this.timeup);
  1859. GD.soundPlay('sound_momotime');
  1860. this.canClick = false;
  1861. this.removeChild(this.hintMc1);
  1862. this.removeChild(this.hintMc2);
  1863. if (this.real1 != undefined) {this.real1.alpha = 1;}
  1864. if (this.real2 != undefined) {this.real2.alpha = 1;}
  1865. this.reachmax = false;
  1866. this.incdgree = 0.15;
  1867. this.stageMode = 'momotime';
  1868. this.playGame = false;
  1869. this.otherMode();
  1870. this.actfeverEffect();
  1871. this.momotime = setInterval(this.showMomoTime.bind(this), 33.333);
  1872. }
  1873. else {//아이템이 없으면 모모타임 이미지, 소리 없이 끝내기
  1874. this.lastPang();
  1875. }
  1876. };
  1877. gc.GameScene.prototype.checkLeftItem = function () {
  1878. this.lastEnd = false;
  1879. for(var i=0; i<this.cookieNumMatrix.length; i++){
  1880. if(this.cookieNumMatrix[i]>7) {
  1881. this.lastEnd = true;
  1882. }
  1883. }
  1884. };
  1885. gc.GameScene.prototype.showMomoTime = function () {
  1886. if(this.reachmax && this.timeup.scale.x <= 1) {
  1887. this.incdgree = 0;
  1888. setTimeout(this.delay.bind(this), 1000);
  1889. clearInterval(this.momotime);
  1890. }
  1891. if(this.timeup.scale.x >= 1.3){
  1892. this.incdgree *= -1;
  1893. this.reachmax = true;
  1894. }
  1895. this.timeup.scale.x += this.incdgree;
  1896. this.timeup.scale.y += this.incdgree;
  1897. };
  1898. gc.GameScene.prototype.delay = function () {
  1899. this.dropmomotime = setInterval(this.dropMomoTime.bind(this),33.333);
  1900. };
  1901. gc.GameScene.prototype.dropMomoTime = function () {
  1902. this.timeup.scale.y = 1.2;
  1903. this.timeup.position.y += 70;
  1904. if(this.timeup.position.y >= gc.height+this.timeup.height){
  1905. this.removeChild(this.timeup);
  1906. //모모타임이 되고 나서 제일 첫 lastpang
  1907. this.lastPang();
  1908. clearInterval(this.dropmomotime);
  1909. }
  1910. };
  1911. gc.GameScene.prototype.setScore = function(){
  1912. this.scoreTxt.x = 355;
  1913. this.scoreTxt.y = 45;
  1914. this.scoreTxt.scale.x = 0.8;
  1915. this.scoreTxt.scale.y = 0.8;
  1916. this.score = 0;
  1917. this.scoreTxt.setValue(this.score);
  1918. this.shadowContainer.addChild(this.chanceImg);
  1919. this.shadowContainer.addChild(this.scoreTxt);
  1920. };
  1921. gc.GameScene.prototype.setBomb = function() {
  1922. this.bomb.anchor.set(0.5);
  1923. this.bomb.x = 69;
  1924. this.bomb.y = 211;
  1925. //this.bomb.alpha = 0;
  1926. this.bombgauge.anchor.x = 0.5;
  1927. this.bombgauge.anchor.y = 1;
  1928. this.bombgauge.position.x = 69;
  1929. this.bombgauge.position.y = 448;
  1930. this.addChild(this.bombgauge);
  1931. this.addChild(this.bomb);
  1932. };
  1933. gc.GameScene.prototype.setCookies = function() {
  1934. for(var i=0; i<this.cookieMatrixPos.length; i++){
  1935. if(this.cookieNumMatrix[i] < 7 || this.cookieNumMatrix[i] == undefined) {
  1936. this.cookieNumMatrix[i] = parseInt(Math.random() * 6 + 1);
  1937. }
  1938. }
  1939. if(this.checkMatching1()){
  1940. this.setCookies();
  1941. }else{ //맞는게 없을 때
  1942. for(var i=0; i<this.cookieNumMatrix.length; i++) {
  1943. this.drawCookie(this.cookieNumMatrix[i], i);
  1944. }
  1945. this.giveHint = false;
  1946. if(this.playGame) this.findHint();
  1947. }
  1948. };
  1949. gc.GameScene.prototype.drawCookie = function (cookieNum, index) {
  1950. switch (cookieNum) {
  1951. case 1:
  1952. this.cookieMatrix[index].texture = PIXI.Texture.fromFrame('cookie_0001.png');
  1953. break;
  1954. case 2:
  1955. this.cookieMatrix[index].texture = PIXI.Texture.fromFrame('cookie_0002.png');
  1956. break;
  1957. case 3:
  1958. this.cookieMatrix[index].texture = PIXI.Texture.fromFrame('cookie_0003.png');
  1959. break;
  1960. case 4:
  1961. this.cookieMatrix[index].texture = PIXI.Texture.fromFrame('cookie_0004.png');
  1962. break;
  1963. case 5:
  1964. this.cookieMatrix[index].texture = PIXI.Texture.fromFrame('cookie_0005.png');
  1965. break;
  1966. case 6:
  1967. this.cookieMatrix[index].texture = PIXI.Texture.fromFrame('cookie_0006.png');
  1968. break;
  1969. default :
  1970. this.cookieMatrix[index].texture = this.cookieMatrix[index].texture;
  1971. }
  1972. this.cookieMatrix[index].anchor.set(0.5);
  1973. this.cookieMatrix[index].scale.x = 0.85;
  1974. this.cookieMatrix[index].scale.y = 0.85;
  1975. this.cookieMatrix[index].position.x = this.cookieMatrixPos[index][0];
  1976. this.cookieMatrix[index].position.y = this.cookieMatrixPos[index][1];
  1977. if(this.cookieNumMatrix[index] < 7) TweenMax.from(this.cookieMatrix[index], 0.1, {y:this.cookieMatrixPos[index][1]-30});
  1978. this.cookieMatrix[index].flag = 1;
  1979. if(this.cookieNumMatrix[index] != 9) this.cookieMatrix[index].remember = 0; //Equal아이템이 나왔을 때 없앨 번호 기억을 위함
  1980. this.cookieMatrix[index].buttonMode = true;
  1981. this.cookieMatrix[index].interactive = true;
  1982. if(!gc.IS_MOBILE)
  1983. {
  1984. this.cookieMatrix[index].mousedown = this.cookieMatrix[index].touchstart = (function(e){
  1985. e.stopPropagation();
  1986. this.getTouchStartPosition(index);
  1987. }).bind(this);
  1988. this.cookieMatrix[index].mouseupoutside = this.cookieMatrix[index].touchendoutside = (function(e){
  1989. e.stopPropagation();
  1990. this.getTouchEndPosition(index);
  1991. }).bind(this);
  1992. }
  1993. else
  1994. {
  1995. this.cookieMatrix[index].touchstart = (function(e){
  1996. e.stopPropagation();
  1997. if(gc.IS_MOBILE) {
  1998. this.previousX = e.data.getLocalPosition(this.parent).x;
  1999. this.previousY = e.data.getLocalPosition(this.parent).y;
  2000. }
  2001. this.getTouchStartPosition(index);
  2002. }).bind(this);
  2003. this.cookieMatrix[index].touchendoutside = (function(e){
  2004. e.stopPropagation();
  2005. if(gc.IS_MOBILE) {
  2006. this.currentX = e.data.getLocalPosition(this.parent).x;
  2007. this.currentY = e.data.getLocalPosition(this.parent).y;
  2008. }
  2009. this.getTouchEndPosition(index);
  2010. }).bind(this);
  2011. }
  2012. this.gameBG.addChild(this.cookieMatrix[index]);
  2013. if(index == 48){
  2014. this.playGame = true;
  2015. this.canClick = true;
  2016. if(this.lastEventTime == undefined) this.lastEventTime = Date.now();
  2017. if(this.sethint == undefined) this.sethint = setInterval(this.setHint.bind(this), 33.333);
  2018. if(this.bum == undefined) this.bum = setInterval(this.bump.bind(this), 33.333);
  2019. this.setItemEffect();
  2020. this.setFeverText();
  2021. //맞출 블럭이 없어 새로 그려졌을 때 아이템 강조 이펙트 작동을 위함
  2022. this.stopItemAccentEffect();
  2023. this.playItemAccentEffect();
  2024. }
  2025. };
  2026. //힌트==========================================================================================
  2027. gc.GameScene.prototype.setHint = function () {
  2028. var now = Date.now();
  2029. if(!this.pauseMode) {
  2030. if(this.pauseTime != 0){
  2031. this.lastEventTime += Math.abs(now - this.pauseTime);
  2032. this.pauseTime = 0;
  2033. }
  2034. if (Math.abs(this.lastEventTime - now) / 1000 >= 5) {
  2035. if (!this.giveHint && this.playGame) this.showHint();
  2036. }
  2037. }else{
  2038. if(this.pauseTime == 0) this.pauseTime = now;
  2039. }
  2040. };
  2041. gc.GameScene.prototype.findHint = function () {
  2042. var temp = undefined;
  2043. var index = undefined;
  2044. var check1 = undefined;
  2045. var check2 = undefined;
  2046. this.hint = [];
  2047. //오른쪽 맨 끝 열은 체크안해도 됨
  2048. for(var i=0; i<6; i++){
  2049. for(var j=0; j<7; j++){
  2050. index = i + j*7;
  2051. temp = this.cookieNumMatrix[index];
  2052. this.cookieNumMatrix[index] = this.cookieNumMatrix[index+1];
  2053. this.cookieNumMatrix[index+1] = temp;
  2054. check1 = this.checkMatching1();
  2055. this.cookieNumMatrix[index+1] = this.cookieNumMatrix[index];
  2056. this.cookieNumMatrix[index] = temp;
  2057. if(check1) this.hint.push([index, index+1]);
  2058. }
  2059. }
  2060. //맨 아래 행은 체크 안해도 됨
  2061. for(var i=0; i<7; i++){
  2062. for(var j=0; j<6; j++){
  2063. index = i+ j*7;
  2064. temp = this.cookieNumMatrix[index];
  2065. this.cookieNumMatrix[index] = this.cookieNumMatrix[index+7];
  2066. this.cookieNumMatrix[index+7] = temp;
  2067. check2 = this.checkMatching1();
  2068. this.cookieNumMatrix[index+7] = this.cookieNumMatrix[index];
  2069. this.cookieNumMatrix[index] = temp;
  2070. if(check2) this.hint.push([index, index+7]);
  2071. }
  2072. }
  2073. //맞춰지는 블럭 없을 때 다시 그리기
  2074. if(this.hint.length == 0){
  2075. for(var i=0; i<this.cookieMatrix.length; i++){
  2076. if(this.cookieNumMatrix[i]<7) this.gameBG.removeChild(this.cookieMatrix[i]);
  2077. }
  2078. this.setCookies();
  2079. }
  2080. };
  2081. gc.GameScene.prototype.showHint = function(){
  2082. this.giveHint = true;
  2083. var texturename1, texturename2;
  2084. var randHint = parseInt(Math.random() * this.hint.length);
  2085. var texturenum1 = this.cookieNumMatrix[this.hint[randHint][0]];
  2086. var texturenum2 = this.cookieNumMatrix[this.hint[randHint][1]];
  2087. if(this.cookieNumMatrix[this.hint[randHint][0]] < 7) texturename1 = 'cookie_' + texturenum1 + '_00';
  2088. if(this.cookieNumMatrix[this.hint[randHint][1]] < 7) texturename2 = 'cookie_' + texturenum2 + '_00';
  2089. this.removeChild(this.hintMc1);
  2090. this.removeChild(this.hintMc2);
  2091. if(this.real1 != undefined) this.real1.alpha = 1;
  2092. if(this.real2 != undefined) this.real2.alpha = 1;
  2093. if(this.cookieNumMatrix[this.hint[randHint][0]] < 7) {
  2094. this.hintMc1 = new gc.MovieClip(texturename1, 1, 8, 0.2);
  2095. this.hintMc1.anchor.set(0.5);
  2096. this.hintMc1.scale.x = 0.85;
  2097. this.hintMc1.scale.y = 0.85;
  2098. this.hintMc1.position.x = this.cookieMatrixPos[this.hint[randHint][0]][0];
  2099. this.hintMc1.position.y = this.cookieMatrixPos[this.hint[randHint][0]][1]-12;
  2100. this.addChild(this.hintMc1);
  2101. this.real1 = this.cookieMatrix[this.hint[randHint][0]];
  2102. this.real1.alpha = 0;
  2103. }
  2104. if(this.cookieNumMatrix[this.hint[randHint][1]] < 7) {
  2105. this.hintMc2 = new gc.MovieClip(texturename2, 1, 8, 0.2);
  2106. this.hintMc2.anchor.set(0.5);
  2107. this.hintMc2.scale.x = 0.85;
  2108. this.hintMc2.scale.y = 0.85;
  2109. this.hintMc2.position.x = this.cookieMatrixPos[this.hint[randHint][1]][0];
  2110. this.hintMc2.position.y = this.cookieMatrixPos[this.hint[randHint][1]][1]-12;
  2111. this.addChild(this.hintMc2);
  2112. this.real2 = this.cookieMatrix[this.hint[randHint][1]];
  2113. this.real2.alpha = 0;
  2114. }
  2115. };
  2116. //선택한 마우스 포인트 저장
  2117. gc.GameScene.prototype.getTouchStartPosition = function(index) {
  2118. if(!gc.IS_MOBILE){
  2119. var e = window.event;
  2120. this.previousX = e.clientX;
  2121. this.previousY = e.clientY;
  2122. }
  2123. if(this.canClick && this.playGame) this.scanCookieNum(index);
  2124. };
  2125. //끝난 마우스 포인트 저장, 스와핑 방향 검사
  2126. gc.GameScene.prototype.getTouchEndPosition = function(index) {
  2127. if(!gc.IS_MOBILE){
  2128. var e = window.event;
  2129. this.currentX = e.clientX;
  2130. this.currentY = e.clientY;
  2131. }
  2132. if(this.canClick && this.playGame) this.swap(index);
  2133. };
  2134. //클릭한 쿠키의 인덱스가 아이템인 겨우 아이템 작동
  2135. gc.GameScene.prototype.scanCookieNum = function (index) {
  2136. if(this.cookieNumMatrix[index]>6) {
  2137. this.scanIndex = index;
  2138. if(this.chance>0) {
  2139. this.chance--;
  2140. this.rangeChance();
  2141. }
  2142. this.useItem = true;
  2143. this.lastEventTime = Date.now();
  2144. this.giveHint = false;
  2145. this.removeChild(this.hintMc1);
  2146. this.removeChild(this.hintMc2);
  2147. if(this.real1 != undefined) this.real1.alpha = 1;
  2148. if(this.real2 != undefined) this.real2.alpha = 1;
  2149. if (this.cookieNumMatrix[index] == 10) {
  2150. if (this.canClick) this.actBomb(index);
  2151. } else if (this.cookieNumMatrix[index] == 9) {
  2152. if (this.canClick) this.actEqual(index);
  2153. } else if (this.cookieNumMatrix[index] == 8) {
  2154. this.crossIndex = index;
  2155. if (this.canClick) this.actCross(index);
  2156. }
  2157. this.combo++;
  2158. this.totalCombo++;
  2159. if(this.combo>=15) {this.stageMode = 'superfever';}
  2160. else if(this.combo>=5){
  2161. this.stageMode = 'fever';
  2162. this.callfevercnt = 0;
  2163. } else{this.stageMode = 'normal';}
  2164. this.lastTime = Date.now();
  2165. this.restComboTime = 3;
  2166. this.canClick = false;
  2167. }else this.useItem = false;
  2168. };
  2169. //스와핑==================================================================================
  2170. gc.GameScene.prototype.swap = function(clickIndex){
  2171. var gapX = this.currentX - this.previousX;
  2172. var gapY = this.currentY - this.previousY;
  2173. //힌트 movieclip삭제
  2174. this.removeChild(this.hintMc1);
  2175. this.removeChild(this.hintMc2);
  2176. //힌트애니메이션동안 안보였던 원래 텍스쳐 보이게 하기
  2177. if(this.real1 != undefined) this.real1.alpha = 1;
  2178. if(this.real2 != undefined) this.real2.alpha = 1;
  2179. //왼쪽 쿠키랑 바꾸기
  2180. if((gapX<0) && (Math.abs(gapX)>Math.abs(gapY))){
  2181. if(clickIndex%7 != 0){
  2182. this.lastEventTime = Date.now();
  2183. this.canClick = false;
  2184. this.swapLeft(clickIndex);
  2185. return;
  2186. }
  2187. }
  2188. //오른쪽
  2189. if((gapX>0) && (Math.abs(gapX)>Math.abs(gapY))){
  2190. if((clickIndex%7) != 6 || (clickIndex==0)){
  2191. this.lastEventTime = Date.now();
  2192. this.canClick = false;
  2193. this.swapRight(clickIndex);
  2194. return;
  2195. }
  2196. }
  2197. //위쪽
  2198. if((gapY<0) && (Math.abs(gapX)<Math.abs(gapY))){
  2199. if(clickIndex > 6){
  2200. this.lastEventTime = Date.now();
  2201. this.canClick = false;
  2202. this.swapUp(clickIndex);
  2203. return;
  2204. }
  2205. }
  2206. //아래쪽
  2207. if((gapY>0) && (Math.abs(gapX)<Math.abs(gapY))){
  2208. if(clickIndex < 42){
  2209. this.lastEventTime = Date.now();
  2210. this.canClick = false;
  2211. this.swapDown(clickIndex);
  2212. }
  2213. }
  2214. };
  2215. gc.GameScene.prototype.swapLeft = function (selectIndex) {
  2216. var tempTexture1, tempTexture2;
  2217. var tempRemember;
  2218. //텍스쳐 저장
  2219. tempTexture1 = this.cookieMatrix[selectIndex].texture;
  2220. tempTexture2 = this.cookieMatrix[selectIndex-1].texture;
  2221. //매칭 확인을 위해 쿠키 번호 바꾸기
  2222. var tempNum = this.cookieNumMatrix[selectIndex];
  2223. this.cookieNumMatrix[selectIndex] = this.cookieNumMatrix[selectIndex-1];
  2224. this.cookieNumMatrix[selectIndex-1] = tempNum;
  2225. //매칭 확인
  2226. this.checkMatching2(selectIndex);
  2227. this.fixArr1 = this.memories;
  2228. this.itemIndex1 = this.itemIndex;
  2229. this.checkMatching2(selectIndex-1);
  2230. this.fixArr2 = this.memories;
  2231. this.itemIndex2 = this.itemIndex;
  2232. //맞는게 없을 때
  2233. if((this.fixArr1.length == 0) && (this.fixArr2.length == 0)){
  2234. //쿠키 번호 복구
  2235. tempNum = this.cookieNumMatrix[selectIndex];
  2236. this.cookieNumMatrix[selectIndex] = this.cookieNumMatrix[selectIndex-1];
  2237. this.cookieNumMatrix[selectIndex-1] = tempNum;
  2238. this.cookieMatrix[selectIndex].texture = tempTexture2;
  2239. this.cookieMatrix[selectIndex-1].texture = tempTexture1;
  2240. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {x:this.cookieMatrixPos[selectIndex-1][0], onComplete: (function () {
  2241. this.cookieMatrix[selectIndex].texture = tempTexture1;
  2242. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {x:this.cookieMatrixPos[selectIndex-1][0]});
  2243. }.bind(this))});
  2244. TweenMax.from(this.cookieMatrix[selectIndex-1], 0.1, {x:this.cookieMatrixPos[selectIndex][0], onComplete:(function () {
  2245. this.cookieMatrix[selectIndex-1].texture = tempTexture2;
  2246. TweenMax.from(this.cookieMatrix[selectIndex-1], 0.1, {x:this.cookieMatrixPos[selectIndex][0], onComplete:(function(){
  2247. this.canClick = true;
  2248. }.bind(this))});
  2249. }.bind(this))});
  2250. this.lastEventTime = Date.now();
  2251. this.giveHint = false;
  2252. } else {//맞춰졌을 때
  2253. this.chance--;
  2254. if(this.fixArr1.length != 0) {
  2255. this.combo++;
  2256. this.totalCombo++;
  2257. }
  2258. if(this.fixArr2.length != 0) {
  2259. this.combo++;
  2260. this.totalCombo++;
  2261. }
  2262. if(this.combo>=15) {this.stageMode = 'superfever';}
  2263. else if(this.combo>=5){
  2264. this.stageMode = 'fever';
  2265. this.callfevercnt = 0;
  2266. } else{this.stageMode = 'normal';}
  2267. this.lastTime = Date.now();
  2268. this.restComboTime = 3;
  2269. this.rangeChance();
  2270. //스와핑 효과 보이기
  2271. this.cookieMatrix[selectIndex].texture = tempTexture2;
  2272. this.cookieMatrix[selectIndex - 1].texture = tempTexture1;
  2273. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {x: this.cookieMatrixPos[selectIndex - 1][0], onComplete:(function () {
  2274. for(var i=0; i<this.fixArr1.length; i++) this.cookieMatrix[this.fixArr1[i]].alpha = 0;
  2275. }.bind(this))});
  2276. TweenMax.from(this.cookieMatrix[selectIndex - 1], 0.1, {x: this.cookieMatrixPos[selectIndex][0], onComplete:(function () {
  2277. for(var i=0; i<this.fixArr2.length; i++) this.cookieMatrix[this.fixArr2[i]].alpha = 0;
  2278. }.bind(this))});
  2279. //remember값 교환
  2280. tempRemember = this.cookieMatrix[selectIndex].remember;
  2281. this.cookieMatrix[selectIndex].remember = this.cookieMatrix[selectIndex-1].remember;
  2282. this.cookieMatrix[selectIndex-1].remember = tempRemember;
  2283. //경우에 상관없이 explode() 실행.. 객체 의미 없음
  2284. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {onComplete:(function () {
  2285. this.explode();
  2286. }.bind(this))});
  2287. }
  2288. };
  2289. gc.GameScene.prototype.swapRight = function (selectIndex) {
  2290. var tempTexture1, tempTexture2;
  2291. var tempRemember;
  2292. //텍스쳐 저장
  2293. tempTexture1 = this.cookieMatrix[selectIndex].texture;
  2294. tempTexture2 = this.cookieMatrix[selectIndex+1].texture;
  2295. //매칭 확인을 위해 쿠키 번호 바꾸기
  2296. var tempNum = this.cookieNumMatrix[selectIndex];
  2297. this.cookieNumMatrix[selectIndex] = this.cookieNumMatrix[selectIndex+1];
  2298. this.cookieNumMatrix[selectIndex+1] = tempNum;
  2299. //매칭 확인
  2300. this.checkMatching2(selectIndex);
  2301. this.fixArr1 = this.memories;
  2302. this.itemIndex1 = this.itemIndex;
  2303. this.checkMatching2(selectIndex+1);
  2304. this.fixArr2 = this.memories;
  2305. this.itemIndex2 = this.itemIndex;
  2306. //맞는게 없을 때
  2307. if((this.fixArr1.length == 0) && (this.fixArr2.length == 0)) {
  2308. //쿠키 번호 복구
  2309. tempNum = this.cookieNumMatrix[selectIndex];
  2310. this.cookieNumMatrix[selectIndex] = this.cookieNumMatrix[selectIndex + 1];
  2311. this.cookieNumMatrix[selectIndex + 1] = tempNum;
  2312. this.cookieMatrix[selectIndex].texture = tempTexture2;
  2313. this.cookieMatrix[selectIndex+1].texture = tempTexture1;
  2314. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {x:this.cookieMatrixPos[selectIndex+1][0], onComplete: (function () {
  2315. this.cookieMatrix[selectIndex].texture = tempTexture1;
  2316. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {x:this.cookieMatrixPos[selectIndex+1][0]});
  2317. }.bind(this))});
  2318. TweenMax.from(this.cookieMatrix[selectIndex+1], 0.1, {x:this.cookieMatrixPos[selectIndex][0], onComplete:(function () {
  2319. this.cookieMatrix[selectIndex+1].texture = tempTexture2;
  2320. TweenMax.from(this.cookieMatrix[selectIndex+1], 0.1, {x:this.cookieMatrixPos[selectIndex][0], onComplete:(function(){
  2321. this.canClick = true;
  2322. }.bind(this))});
  2323. }.bind(this))});
  2324. this.lastEventTime = Date.now();
  2325. this.giveHint = false;
  2326. } else{//맞춰졌을 때
  2327. this.chance--;
  2328. if(this.fixArr1.length != 0) {
  2329. this.combo++;
  2330. this.totalCombo++;
  2331. }
  2332. if(this.fixArr2.length != 0) {
  2333. this.combo++;
  2334. this.totalCombo++;
  2335. }
  2336. if(this.combo>=15) {this.stageMode = 'superfever';}
  2337. else if(this.combo>=5){
  2338. this.stageMode = 'fever';
  2339. this.callfevercnt = 0;
  2340. } else{this.stageMode = 'normal';}
  2341. this.lastTime = Date.now();
  2342. this.restComboTime = 3;
  2343. this.rangeChance();
  2344. this.cookieMatrix[selectIndex].texture = tempTexture2;
  2345. this.cookieMatrix[selectIndex + 1].texture = tempTexture1;
  2346. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {x: this.cookieMatrixPos[selectIndex + 1][0], onComplete:(function () {
  2347. for(var i=0; i<this.fixArr1.length; i++) this.cookieMatrix[this.fixArr1[i]].alpha = 0;
  2348. }.bind(this))});
  2349. TweenMax.from(this.cookieMatrix[selectIndex + 1], 0.1, {x: this.cookieMatrixPos[selectIndex][0], onComplete:(function () {
  2350. for(var i=0; i<this.fixArr2.length; i++) this.cookieMatrix[this.fixArr2[i]].alpha = 0;
  2351. }.bind(this))});
  2352. //remember값 교환
  2353. tempRemember = this.cookieMatrix[selectIndex].remember;
  2354. this.cookieMatrix[selectIndex].remember = this.cookieMatrix[selectIndex+1].remember;
  2355. this.cookieMatrix[selectIndex+1].remember = tempRemember;
  2356. //경우에 상관없이 explode() 실행.. 객체 의미 없음
  2357. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {onComplete:(function () {
  2358. this.explode();
  2359. }.bind(this))});
  2360. }
  2361. };
  2362. gc.GameScene.prototype.swapUp = function (selectIndex) {
  2363. var tempTexture1, tempTexture2;
  2364. var tempRemember;
  2365. //텍스쳐 저장
  2366. tempTexture1 = this.cookieMatrix[selectIndex].texture;
  2367. tempTexture2 = this.cookieMatrix[selectIndex-7].texture;
  2368. //매칭 확인을 위해 쿠키 번호 바꾸기
  2369. var tempNum = this.cookieNumMatrix[selectIndex];
  2370. this.cookieNumMatrix[selectIndex] = this.cookieNumMatrix[selectIndex-7];
  2371. this.cookieNumMatrix[selectIndex-7] = tempNum;
  2372. //매칭 확인
  2373. this.checkMatching2(selectIndex);
  2374. this.fixArr1 = this.memories;
  2375. this.itemIndex1 = this.itemIndex;
  2376. this.checkMatching2(selectIndex-7);
  2377. this.fixArr2 = this.memories;
  2378. this.itemIndex2 = this.itemIndex;
  2379. //맞는게 없을 때
  2380. if((this.fixArr1.length == 0) && (this.fixArr2.length == 0)) {
  2381. //쿠키 번호 복구
  2382. tempNum = this.cookieNumMatrix[selectIndex];
  2383. this.cookieNumMatrix[selectIndex] = this.cookieNumMatrix[selectIndex - 7];
  2384. this.cookieNumMatrix[selectIndex - 7] = tempNum;
  2385. this.cookieMatrix[selectIndex].texture = tempTexture2;
  2386. this.cookieMatrix[selectIndex-7].texture = tempTexture1;
  2387. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {y:this.cookieMatrixPos[selectIndex-7][1], onComplete: (function () {
  2388. this.cookieMatrix[selectIndex].texture = tempTexture1;
  2389. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {y:this.cookieMatrixPos[selectIndex-7][1]});
  2390. }.bind(this))});
  2391. TweenMax.from(this.cookieMatrix[selectIndex-7], 0.1, {y:this.cookieMatrixPos[selectIndex][1], onComplete:(function () {
  2392. this.cookieMatrix[selectIndex-7].texture = tempTexture2;
  2393. TweenMax.from(this.cookieMatrix[selectIndex-7], 0.1, {y:this.cookieMatrixPos[selectIndex][1], onComplete:(function(){
  2394. this.canClick = true;
  2395. }.bind(this))});
  2396. }.bind(this))});
  2397. this.lastEventTime = Date.now();
  2398. this.giveHint = false;
  2399. } else{//맞춰졌을 때
  2400. this.chance--;
  2401. if(this.fixArr1.length != 0) {
  2402. this.combo++;
  2403. this.totalCombo++;
  2404. }
  2405. if(this.fixArr2.length != 0) {
  2406. this.combo++;
  2407. this.totalCombo++;
  2408. }
  2409. if(this.combo>=15) {this.stageMode = 'superfever';}
  2410. else if(this.combo>=5){
  2411. this.stageMode = 'fever';
  2412. this.callfevercnt = 0;
  2413. } else{this.stageMode = 'normal';}
  2414. this.lastTime = Date.now();
  2415. this.restComboTime = 3;
  2416. this.rangeChance();
  2417. this.cookieMatrix[selectIndex].texture = tempTexture2;
  2418. this.cookieMatrix[selectIndex-7].texture = tempTexture1;
  2419. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {y:this.cookieMatrixPos[selectIndex-7][1], onComplete:(function () {
  2420. for(var i=0; i<this.fixArr1.length; i++) this.cookieMatrix[this.fixArr1[i]].alpha = 0;
  2421. }.bind(this))});
  2422. TweenMax.from(this.cookieMatrix[selectIndex-7], 0.1, {y:this.cookieMatrixPos[selectIndex][1], onComplete:(function () {
  2423. for(var i=0; i<this.fixArr2.length; i++) this.cookieMatrix[this.fixArr2[i]].alpha = 0;
  2424. }.bind(this))});
  2425. //remember값 교환
  2426. tempRemember = this.cookieMatrix[selectIndex].remember;
  2427. this.cookieMatrix[selectIndex].remember = this.cookieMatrix[selectIndex-7].remember;
  2428. this.cookieMatrix[selectIndex-7].remember = tempRemember;
  2429. //경우에 상관없이 explode() 실행.. 객체 의미 없음
  2430. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {onComplete:(function () {
  2431. this.explode();
  2432. }.bind(this))});
  2433. }
  2434. };
  2435. gc.GameScene.prototype.swapDown = function (selectIndex) {
  2436. var tempTexture1, tempTexture2;
  2437. var tempRemember;
  2438. //텍스쳐 저장
  2439. tempTexture1 = this.cookieMatrix[selectIndex].texture;
  2440. tempTexture2 = this.cookieMatrix[selectIndex+7].texture;
  2441. //매칭 확인을 위해 쿠키 번호 바꾸기
  2442. var tempNum = this.cookieNumMatrix[selectIndex];
  2443. this.cookieNumMatrix[selectIndex] = this.cookieNumMatrix[selectIndex+7];
  2444. this.cookieNumMatrix[selectIndex+7] = tempNum;
  2445. //매칭 확인
  2446. this.checkMatching2(selectIndex);
  2447. this.fixArr1 = this.memories;
  2448. this.itemIndex1 = this.itemIndex;
  2449. this.checkMatching2(selectIndex+7);
  2450. this.fixArr2 = this.memories;
  2451. this.itemIndex2 = this.itemIndex;
  2452. //맞는게 없을 때
  2453. if((this.fixArr1.length == 0) && (this.fixArr2.length == 0)) {
  2454. //쿠키 번호 복구
  2455. tempNum = this.cookieNumMatrix[selectIndex];
  2456. this.cookieNumMatrix[selectIndex] = this.cookieNumMatrix[selectIndex + 7];
  2457. this.cookieNumMatrix[selectIndex + 7] = tempNum;
  2458. this.cookieMatrix[selectIndex].texture = tempTexture2;
  2459. this.cookieMatrix[selectIndex+7].texture = tempTexture1;
  2460. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {y:this.cookieMatrixPos[selectIndex+7][1], onComplete: (function () {
  2461. this.cookieMatrix[selectIndex].texture = tempTexture1;
  2462. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {y:this.cookieMatrixPos[selectIndex+7][1]});
  2463. }.bind(this))});
  2464. TweenMax.from(this.cookieMatrix[selectIndex+7], 0.1, {y:this.cookieMatrixPos[selectIndex][1], onComplete:(function () {
  2465. this.cookieMatrix[selectIndex+7].texture = tempTexture2;
  2466. TweenMax.from(this.cookieMatrix[selectIndex+7], 0.1, {y:this.cookieMatrixPos[selectIndex][1], onComplete:(function(){
  2467. this.canClick = true;
  2468. }.bind(this))});
  2469. }.bind(this))});
  2470. this.lastEventTime = Date.now();
  2471. this.giveHint = false;
  2472. } else{//맞춰졌을 때
  2473. this.chance--;
  2474. if(this.fixArr1.length != 0) {
  2475. this.combo++;
  2476. this.totalCombo++;
  2477. }
  2478. if(this.fixArr2.length != 0) {
  2479. this.combo++;
  2480. this.totalCombo++;
  2481. }
  2482. if(this.combo>=15) {this.stageMode = 'superfever';}
  2483. else if(this.combo>=5){
  2484. this.stageMode = 'fever';
  2485. this.callfevercnt = 0;
  2486. } else{this.stageMode = 'normal';}
  2487. this.lastTime = Date.now();
  2488. this.restComboTime = 3;
  2489. this.rangeChance();
  2490. this.cookieMatrix[selectIndex].texture = tempTexture2;
  2491. this.cookieMatrix[selectIndex + 7].texture = tempTexture1;
  2492. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {y: this.cookieMatrixPos[selectIndex + 7][1], onComplete:(function () {
  2493. for(var i=0; i<this.fixArr1.length; i++) this.cookieMatrix[this.fixArr1[i]].alpha = 0;
  2494. }.bind(this))});
  2495. TweenMax.from(this.cookieMatrix[selectIndex + 7], 0.1, {y: this.cookieMatrixPos[selectIndex][1], onComplete:(function () {
  2496. for(var i=0; i<this.fixArr2.length; i++) this.cookieMatrix[this.fixArr2[i]].alpha = 0;
  2497. }.bind(this))});
  2498. //remember값 교환
  2499. tempRemember = this.cookieMatrix[selectIndex].remember;
  2500. this.cookieMatrix[selectIndex].remember = this.cookieMatrix[selectIndex+7].remember;
  2501. this.cookieMatrix[selectIndex+7].remember = tempRemember;
  2502. //경우에 상관없이 explode() 실행.. 객체 의미 없음
  2503. TweenMax.from(this.cookieMatrix[selectIndex], 0.1, {onComplete:(function () {
  2504. this.explode();
  2505. }.bind(this))});
  2506. }
  2507. };
  2508. //폭발==============================================================================================
  2509. //더이상 터질게 없을 때
  2510. gc.GameScene.prototype.explode = function () {
  2511. var makeBomb = false;
  2512. var explodeEqual = false;
  2513. var explodeBomb = false;
  2514. this.explodetime = 0.3;
  2515. //= 아이템 체크
  2516. if(this.scanIndex != undefined) {
  2517. if (this.cookieNumMatrix[this.scanIndex] == 9) {explodeEqual = true;}
  2518. if (this.cookieNumMatrix[this.scanIndex] == 10) {explodeBomb = true;}
  2519. }
  2520. //크로스 아이템 이펙트
  2521. if(this.crossIndex != undefined){
  2522. this.crossEffect1.anchor.set(0.5);
  2523. this.crossEffect1.position.x = this.cookieMatrixPos[this.crossIndex][0];
  2524. this.crossEffect1.position.y = this.cookieMatrixPos[21][1];
  2525. this.crossEffect1.height = 720;
  2526. this.crossEffect2.anchor.set(0.5);
  2527. this.crossEffect2.position.x = this.cookieMatrixPos[3][0];
  2528. this.crossEffect2.position.y = this.cookieMatrixPos[this.crossIndex][1];
  2529. this.crossEffect2.height = 720;
  2530. this.crossEffect2.transform.rotation = Math.PI/2;
  2531. var crossMc = new gc.MovieClip('eraser_effect_00', 1, 7, 0.3);
  2532. crossMc.anchor.set(0.5);
  2533. crossMc.position.x = this.cookieMatrixPos[this.crossIndex][0];
  2534. crossMc.position.y = this.cookieMatrixPos[this.crossIndex][1];
  2535. crossMc.loop = false;
  2536. this.explodeContainer.addChild(this.crossEffect1);
  2537. this.explodeContainer.addChild(this.crossEffect2);
  2538. this.explodeContainer.addChild(crossMc);
  2539. crossMc.onComplete = function () {
  2540. gc.game.explodeContainer.removeChild(crossMc);
  2541. };
  2542. TweenMax.to(this.crossEffect1.scale, this.explodetime, {x:1, y:0.6, alpha:1});
  2543. TweenMax.to(this.crossEffect2.scale, this.explodetime, {x:1, y:0.6, alpha:1});
  2544. }
  2545. if(explodeBomb){
  2546. var bombMc = new gc.MovieClip('bomb_effect_00', 1, 9, 0.3);
  2547. bombMc.anchor.set(0.5);
  2548. bombMc.position.x = this.cookieMatrixPos[this.scanIndex][0];
  2549. bombMc.position.y = this.cookieMatrixPos[this.scanIndex][1];
  2550. bombMc.loop = false;
  2551. this.explodeContainer.addChild(bombMc);
  2552. }
  2553. //기본 폭발 이미지.. 모든 폭발에 적용
  2554. for(var i=0; i<this.cookieMatrix.length; i++){
  2555. if(this.cookieMatrix[i].flag == 0){
  2556. //폭탄아이템 생성 조건
  2557. this.bombAnerge++;
  2558. if(this.bombAnerge >= this.bombfull) {
  2559. makeBomb = true;
  2560. this.setBombItem();
  2561. this.bombAnerge -= this.bombfull;
  2562. }
  2563. var explodeMc = new gc.MovieClip('clear_effect_00', 1, 9, 0.4);
  2564. explodeMc.anchor.set(0.5);
  2565. explodeMc.position.x = this.cookieMatrixPos[i][0];
  2566. explodeMc.position.y = this.cookieMatrixPos[i][1];
  2567. explodeMc.alpha = 1;
  2568. explodeMc.loop = false;
  2569. if(!explodeEqual) {this.explodeContainer.addChild(explodeMc);
  2570. }else{this.explodeContainer2.addChild(explodeMc);}
  2571. }
  2572. }
  2573. this.scanIndex = undefined;
  2574. //mask 폭탄 게이지 보이는 화면
  2575. var gap = this.bombgauge.height/this.bombfull;
  2576. if(this.thing == undefined) {
  2577. this.thing = new PIXI.Graphics();
  2578. this.thing.position.x = 0;
  2579. this.thing.position.y = 0;
  2580. this.bombgauge.addChild(this.thing);
  2581. this.bombgauge.mask = this.thing;
  2582. this.thing.lineStyle(0);
  2583. this.thing.clear();
  2584. this.thing.beginFill(0xffffff, 1);
  2585. this.maskRect = this.thing.drawRect(-14, -this.bombgauge.height+gap*(this.bombfull-this.bombAnerge), this.bombgauge.width, this.bombgauge.height, 10);
  2586. this.thing.endFill();
  2587. }
  2588. //점수 부여
  2589. for(var i=0; i<this.cookieMatrix.length; i++){
  2590. if(this.cookieMatrix[i].flag == 0) {this.addScore(i)}
  2591. }
  2592. //폭발 사운드 처리
  2593. if(!explodeEqual && !this.test)this.manageSound();
  2594. this.settingItem();
  2595. //점수 합산
  2596. if(!this.test) DataManager.point('point', this.addPoint, Date.now().toString()); // 획득 점수 저장
  2597. this.score += this.addPoint;
  2598. this.addPoint = 0;
  2599. this.scoreTxt.setValue(this.score);
  2600. //터지는 이미지 시간 작용
  2601. this.explodetime = 0.3;
  2602. if(this.crossIndex != undefined) {this.crossIndex = undefined;}
  2603. if(explodeEqual) {this.explodetime = 0.15*(this.remembers.length+2);}
  2604. if(makeBomb) {
  2605. //폭탄 생성 이펙트
  2606. this.cookieMatrix[this.randBombIndex].alpha = 0;
  2607. var fakebomb = new PIXI.Sprite.fromFrame('bomb_0002.png');
  2608. fakebomb.anchor.set(0.5);
  2609. fakebomb.x = this.bomb.x;
  2610. fakebomb.y = this.bomb.y;
  2611. this.addChild(fakebomb);
  2612. this.restComboTime = 3;
  2613. TweenMax.to(fakebomb.scale, 0.3, {x:1.3, y:1.3, onComplete:(function () {
  2614. TweenMax.to(fakebomb.scale, 0.2, {x:1, y:1, onComplete:(function () {
  2615. TweenMax.to(fakebomb, 1, {rotation:90, x:this.cookieMatrixPos[this.randBombIndex][0], y:this.cookieMatrixPos[this.randBombIndex][1], onComplete:(function () {
  2616. this.removeChild(fakebomb);
  2617. this.cookieMatrix[this.randBombIndex].alpha = 1;
  2618. this.explodeOver();
  2619. }).bind(this)},0);
  2620. }).bind(this)});
  2621. }).bind(this)});
  2622. //TweenMax.to(fakebomb, 1.2, {rotation:90, x:this.cookieMatrixPos[this.randBombIndex][0], y:this.cookieMatrixPos[this.randBombIndex][1], onComplete:(function () {
  2623. // this.removeChild(fakebomb);
  2624. // this.cookieMatrix[this.randBombIndex].alpha = 1;
  2625. // this.explodeOver();
  2626. //}).bind(this)},0);
  2627. this.bomb.texture = PIXI.Texture.fromFrame('bomb_0002.png');
  2628. TweenMax.to(this.maskRect, 0.1, {y:-this.bombgauge.height, onComplete:(function () {
  2629. TweenMax.to(this.maskRect, 0.1, {y:-this.bombgauge.height+gap*this.bombfull, onComplete:(function () {
  2630. TweenMax.to(this.maskRect, 0.1, {y:-this.bombgauge.height+gap*(this.bombfull-this.bombAnerge), onComplete:(function () {
  2631. this.bomb.texture = PIXI.Texture.fromFrame('bomb_0001.png');
  2632. }).bind(this)});
  2633. }).bind(this)});
  2634. }).bind(this)});
  2635. } else {
  2636. TweenMax.to(this.maskRect, 0.1, {y:-this.bombgauge.height+gap*(this.bombfull-this.bombAnerge)});
  2637. this.explodeOver();
  2638. }
  2639. //폭발 이미지 제거
  2640. TweenMax.to(this.cookieMatrix[0], this.explodetime, {onComplete: (function() {
  2641. this.explodeContainer.removeChildren();
  2642. if(this.explodeContainer2 != undefined)this.explodeContainer2.removeChildren();
  2643. }.bind(this))});
  2644. //메달 획득 확인
  2645. this.manageMedal();
  2646. };
  2647. //폭발 후 쿠키 떨어뜨리는 역할
  2648. gc.GameScene.prototype.explodeOver = function () {
  2649. //터질때 발생하는 작업 전체 종료 후 쿠키 떨구기
  2650. TweenMax.to(this.cookieMatrix[0], this.explodetime, {onComplete: (function() {
  2651. this.dropCookie();
  2652. }.bind(this))});
  2653. };
  2654. //소리===================================================================================================
  2655. gc.GameScene.prototype.manageSound = function () {
  2656. if(this.prestageMode == this.stageMode){
  2657. this.exceptSound = false;
  2658. this.basicSound();
  2659. }else{
  2660. //모드 변화 시
  2661. if(this.stageMode == 'superfever' || this.stageMode == 'fever') {
  2662. if(!this.exceptSound) {this.exceptSound = true;}
  2663. else{GD.soundPlay('sound_match_fever');}
  2664. } else{
  2665. //모모타임일 때
  2666. if(this.stageMode == 'momotime') {this.momoSound();}
  2667. else{this.basicSound();}//피버모드가 풀렸을 때
  2668. }
  2669. }
  2670. };
  2671. gc.GameScene.prototype.basicSound = function () {
  2672. //기본 블럭 사운드
  2673. if(!this.useItem){
  2674. if (this.stageMode == 'normal') {
  2675. if (this.combo == 1) GD.soundPlay('sound_match_1');
  2676. else if (this.combo == 3)GD.soundPlay('sound_match_2');
  2677. else GD.soundPlay('sound_match_3');
  2678. } else {GD.soundPlay('sound_match_fever');}
  2679. return;
  2680. }else{
  2681. //아이템 사운드
  2682. GD.soundPlay('sound_use');
  2683. this.useItem = false;
  2684. return;
  2685. }
  2686. };
  2687. gc.GameScene.prototype.momoSound = function () {
  2688. //기본 블럭 사운드
  2689. if(!this.useItem){
  2690. if (this.prestageMode == 'normal') {
  2691. if (this.combo == 1) GD.soundPlay('sound_match_1');
  2692. else if (this.combo == 3) GD.soundPlay('sound_match_2');
  2693. else GD.soundPlay('sound_match_3');
  2694. } else {GD.soundPlay('sound_match_fever')};
  2695. return;
  2696. }else{
  2697. //아이템 사운드
  2698. GD.soundPlay('sound_use');
  2699. this.useItem = false;
  2700. return;
  2701. }
  2702. };
  2703. //점수===================================================================================================
  2704. gc.GameScene.prototype.addScore = function (i) {
  2705. if(this.stageMode == 'normal') {this.normalPoint(i);}
  2706. else if(this.stageMode == 'fever'){this.feverPoint(i);}
  2707. else if(this.stageMode == 'superfever'){this.superfeverPoint(i);}
  2708. else { //모모타임 점수
  2709. if(this.prestageMode == 'normal'){this.normalPoint(i);}
  2710. else if(this.prestageMode == 'fever'){this.feverPoint(i);}
  2711. else if(this.prestageMode == 'superfever'){this.superfeverPoint(i);}
  2712. }
  2713. };
  2714. gc.GameScene.prototype.normalPoint = function (i) {
  2715. if(this.cookieNumMatrix[i]<7) {this.addPoint += 100;}
  2716. else {
  2717. if(this.cookieNumMatrix[i] == 10) {this.addPoint += 450;}
  2718. if(this.cookieNumMatrix[i] == 9) {this.addPoint += 350;}
  2719. if(this.cookieNumMatrix[i] == 8) {this.addPoint += 250;}
  2720. }
  2721. };
  2722. gc.GameScene.prototype.feverPoint = function (i) {
  2723. if(this.cookieNumMatrix[i]<7) {this.addPoint += 200;}
  2724. else {
  2725. if(this.cookieNumMatrix[i] == 10) {this.addPoint += 600;}
  2726. if(this.cookieNumMatrix[i] == 9) {this.addPoint += 550;}
  2727. if(this.cookieNumMatrix[i] == 8) {this.addPoint += 350;}
  2728. }
  2729. }
  2730. gc.GameScene.prototype.superfeverPoint = function (i) {
  2731. if(this.cookieNumMatrix[i]<7) {
  2732. this.addPoint += 300;}
  2733. else {
  2734. if(this.cookieNumMatrix[i] == 10) {this.addPoint += 900;}
  2735. if(this.cookieNumMatrix[i] == 9) {this.addPoint += 700;}
  2736. if(this.cookieNumMatrix[i] == 8) {this.addPoint += 500;}
  2737. }
  2738. };
  2739. //아이템====================================================================================
  2740. gc.GameScene.prototype.settingItem = function(){
  2741. if(this.itemIndex1 != undefined){
  2742. if(this.fixArr1.length >=5){
  2743. this.setEqualItem('origin');
  2744. } else if(this.fixArr1.length >=4){
  2745. this.setCrossItem('origin');
  2746. }
  2747. this.cookieMatrix[this.itemIndex1].alpha = 1;
  2748. this.cookieMatrix[this.itemIndex1].flag = 1;
  2749. this.itemIndex1 = undefined;
  2750. }
  2751. if(this.itemIndex2 != undefined){
  2752. if(this.fixArr2.length >=5){
  2753. this.setEqualItem('other');
  2754. } else if(this.fixArr2.length >=4){
  2755. this.setCrossItem('other');
  2756. }
  2757. this.cookieMatrix[this.itemIndex2].alpha = 1;
  2758. this.cookieMatrix[this.itemIndex2].flag = 1;
  2759. this.itemIndex2 = undefined;
  2760. }
  2761. };
  2762. gc.GameScene.prototype.setBombItem = function(){
  2763. this.randBombIndex = parseInt(Math.random()*14);
  2764. if(this.cookieMatrix[this.randBombIndex].flag != 0 && this.cookieNumMatrix[this.randBombIndex] <7) {
  2765. this.cookieMatrix[this.randBombIndex].texture = PIXI.Texture.fromFrame('bomb_item_0001.png');
  2766. this.cookieNumMatrix[this.randBombIndex] = 10;
  2767. this.matchItemSize(this.randBombIndex);
  2768. }else this.setBombItem();
  2769. };
  2770. gc.GameScene.prototype.setEqualItem = function(thing){
  2771. var itemName = 'cookie2_000';
  2772. var fullItemName;
  2773. switch (thing) {
  2774. case 'origin':
  2775. this.cookieMatrix[this.itemIndex1].remember = this.cookieNumMatrix[this.itemIndex1];
  2776. fullItemName = itemName+this.cookieMatrix[this.itemIndex1].remember+'.png';
  2777. this.cookieMatrix[this.itemIndex1].texture = PIXI.Texture.fromFrame(fullItemName);
  2778. this.cookieNumMatrix[this.itemIndex1] = 9;
  2779. this.matchItemSize(this.itemIndex1);
  2780. break;
  2781. case 'other':
  2782. this.cookieMatrix[this.itemIndex2].remember = this.cookieNumMatrix[this.itemIndex2];
  2783. fullItemName = itemName+this.cookieMatrix[this.itemIndex2].remember+'.png';
  2784. this.cookieMatrix[this.itemIndex2].texture = PIXI.Texture.fromFrame(fullItemName);
  2785. this.cookieNumMatrix[this.itemIndex2] = 9;
  2786. this.matchItemSize(this.itemIndex2);
  2787. break;
  2788. }
  2789. };
  2790. gc.GameScene.prototype.setCrossItem = function(thing){
  2791. switch (thing) {
  2792. case 'origin':
  2793. this.cookieMatrix[this.itemIndex1].texture = PIXI.Texture.fromFrame('eraser_0001.png');
  2794. this.cookieNumMatrix[this.itemIndex1] = 8;
  2795. this.matchItemSize(this.itemIndex1);
  2796. break;
  2797. case 'other':
  2798. this.cookieMatrix[this.itemIndex2].texture = PIXI.Texture.fromFrame('eraser_0001.png');
  2799. this.cookieNumMatrix[this.itemIndex2] = 8;
  2800. this.matchItemSize(this.itemIndex2);
  2801. break;
  2802. }
  2803. };
  2804. gc.GameScene.prototype.matchItemSize = function (index) {
  2805. var min = 2;
  2806. var max = 0;
  2807. for(var i=0; i<this.cookieMatrix.length; i++){
  2808. if(this.cookieMatrix[i].scale.x < min){min = this.cookieMatrix[i].scale.x}
  2809. }
  2810. if(min == 0.85){
  2811. for(var i=0; i<this.cookieMatrix.length; i++){
  2812. if(this.cookieMatrix[i].scale.x > max){max = this.cookieMatrix[i].scale.x}
  2813. }
  2814. }
  2815. if(min != 0.85) {
  2816. this.cookieMatrix[index].scale.x = min;
  2817. this.cookieMatrix[index].scale.y = min;
  2818. }else {
  2819. this.cookieMatrix[index].scale.x = max;
  2820. this.cookieMatrix[index].scale.y = max;
  2821. }
  2822. this.getItemIndex();
  2823. };
  2824. gc.GameScene.prototype.bump = function () {
  2825. if(this.itemIndexes.length > 0) {
  2826. if(this.cookieMatrix[this.itemIndexes[0]].scale.x >= 1 || this.cookieMatrix[this.itemIndexes[0]].scale.x <= 0.85){
  2827. if(this.cookieMatrix[this.itemIndexes[0]].scale.x > 1) this.cookieMatrix[this.itemIndexes[0]].scale.x = 1;
  2828. if(this.cookieMatrix[this.itemIndexes[0]].scale.x < 0.85) this.cookieMatrix[this.itemIndexes[0]].scale.x = 0.85;
  2829. this.bumpscale *= -1;
  2830. }
  2831. this.cookieMatrix[this.itemIndexes[0]].scale.x += this.bumpscale;
  2832. this.cookieMatrix[this.itemIndexes[0]].scale.y += this.bumpscale;
  2833. }
  2834. for(var i=0; i<this.itemIndexes.length; i++){
  2835. this.cookieMatrix[this.itemIndexes[i]].scale.x = this.cookieMatrix[this.itemIndexes[0]].scale.x
  2836. this.cookieMatrix[this.itemIndexes[i]].scale.y = this.cookieMatrix[this.itemIndexes[0]].scale.x;
  2837. }
  2838. };
  2839. gc.GameScene.prototype.getItemIndex = function () {
  2840. this.itemIndexes = [];
  2841. for(var i=0; i<this.cookieNumMatrix.length; i++){
  2842. if(this.cookieNumMatrix[i]>6){
  2843. this.itemIndexes.push(i);
  2844. }
  2845. }
  2846. };
  2847. gc.GameScene.prototype.actBomb = function(actIndex){
  2848. this.bombCombo++;
  2849. //본인
  2850. this.cookieMatrix[actIndex].flag = 0;
  2851. this.cookieMatrix[actIndex].remember = 0;
  2852. this.cookieMatrix[actIndex].alpha = 0;
  2853. //첫번째 열이 아님
  2854. if(actIndex%7 != 0) {
  2855. //왼쪽 위
  2856. if(actIndex-7-1 >= 0) {
  2857. //대상이 아이템 블럭이 아님
  2858. if(this.cookieNumMatrix[actIndex - 7 - 1] < 7) {
  2859. this.cookieMatrix[actIndex - 7 - 1].flag = 0;
  2860. this.cookieMatrix[actIndex - 7 - 1].alpha = 0;
  2861. this.cookieMatrix[actIndex - 7 - 1].remember = 0;
  2862. }
  2863. }
  2864. //왼쪽 아래
  2865. if(actIndex+7-1 <= 48) {
  2866. //대상이 아이템 블럭이 아님
  2867. if(this.cookieNumMatrix[actIndex + 7 - 1] < 7) {
  2868. this.cookieMatrix[actIndex + 7 - 1].flag = 0;
  2869. this.cookieMatrix[actIndex + 7 - 1].alpha = 0;
  2870. this.cookieMatrix[actIndex + 7 - 1].remember = 0;
  2871. }
  2872. }
  2873. //왼쪽
  2874. if(actIndex-1 >= 0) {
  2875. //대상이 아이템 블럭이 아님
  2876. if(this.cookieNumMatrix[actIndex - 1] < 7) {
  2877. this.cookieMatrix[actIndex - 1].flag = 0;
  2878. this.cookieMatrix[actIndex - 1].alpha = 0;
  2879. this.cookieMatrix[actIndex - 1].remember = 0;
  2880. }
  2881. }
  2882. }
  2883. //위
  2884. if(actIndex-7 >= 0){
  2885. if(this.cookieNumMatrix[actIndex - 7] < 7) {
  2886. this.cookieMatrix[actIndex - 7].flag = 0;
  2887. this.cookieMatrix[actIndex - 7].alpha = 0;
  2888. this.cookieMatrix[actIndex - 7].remember = 0;
  2889. }
  2890. }
  2891. //아래
  2892. if(actIndex+7 <= 48){
  2893. if(this.cookieNumMatrix[actIndex + 7] < 7) {
  2894. this.cookieMatrix[actIndex + 7].flag = 0;
  2895. this.cookieMatrix[actIndex + 7].alpha = 0;
  2896. this.cookieMatrix[actIndex + 7].remember = 0;
  2897. }
  2898. }
  2899. //오른쪽 끝 열이 아님
  2900. if(actIndex%7 != 6) {
  2901. //오른쪽 위
  2902. if (actIndex - 7 + 1 >= 0) {
  2903. //대상이 아이템 블럭이 아님
  2904. if (this.cookieNumMatrix[actIndex - 7 + 1] < 7) {
  2905. this.cookieMatrix[actIndex - 7 + 1].flag = 0;
  2906. this.cookieMatrix[actIndex - 7 + 1].alpha = 0;
  2907. this.cookieMatrix[actIndex - 7 + 1].remember = 0;
  2908. }
  2909. }
  2910. //오른쪽 아래
  2911. if (actIndex + 7 + 1 <= 48) {
  2912. //대상이 아이템 블럭이 아님
  2913. if (this.cookieNumMatrix[actIndex + 7 + 1] < 7) {
  2914. this.cookieMatrix[actIndex + 7 + 1].flag = 0;
  2915. this.cookieMatrix[actIndex + 7 + 1].alpha = 0;
  2916. this.cookieMatrix[actIndex + 7 + 1].remember = 0;
  2917. }
  2918. }
  2919. //오른쪽
  2920. if (actIndex + 1 <= 48) {
  2921. //대상이 아이템 블럭이 아님
  2922. if (this.cookieNumMatrix[actIndex + 1] < 7) {
  2923. this.cookieMatrix[actIndex + 1].flag = 0;
  2924. this.cookieMatrix[actIndex + 1].alpha = 0;
  2925. this.cookieMatrix[actIndex + 1].remember = 0;
  2926. }
  2927. }
  2928. }
  2929. //아이템 사용시 강조 이펙트 제거를 위함
  2930. this.stopItemAccentEffect();
  2931. this.playItemAccentEffect();
  2932. this.explode();
  2933. };
  2934. gc.GameScene.prototype.explodeEqual = function () {
  2935. var explodeMc = new gc.MovieClip('clear_effect_00', 1, 9, 0.4);
  2936. explodeMc.onComplete = function() {gc.game.explodeContainer2.removeChild(explodeMc);};
  2937. explodeMc.anchor.set(0.5);
  2938. explodeMc.position.x = this.cookieMatrixPos[this.remembers[0]][0];
  2939. explodeMc.position.y = this.cookieMatrixPos[this.remembers[0]][1];
  2940. explodeMc.alpha = 1;
  2941. explodeMc.scale.x = 1.3;
  2942. explodeMc.scale.y = 1.3;
  2943. explodeMc.loop = false;
  2944. this.explodeContainer2.addChild(explodeMc);
  2945. };
  2946. gc.GameScene.prototype.rise = function () {
  2947. var fakeCookie = new PIXI.Sprite.fromFrame('cookie_1_0001.png');
  2948. fakeCookie.texture = this.cookieMatrix[this.remembers[0]].texture;
  2949. fakeCookie.anchor.set(0.5);
  2950. fakeCookie.position.x = this.cookieMatrixPos[this.remembers[0]][0];
  2951. fakeCookie.position.y = this.cookieMatrixPos[this.remembers[0]][1];
  2952. this.explodeContainer2.addChild(fakeCookie);
  2953. this.manageSound();
  2954. this.cookieMatrix[this.remembers[0]].alpha = 0;
  2955. this.cookieMatrix[this.remembers[0]].flag = 0;
  2956. this.cookieMatrix[this.remembers[0]].remember = 0;
  2957. TweenMax.to(fakeCookie.scale, 0.1,{x:1.15, y:1.15, onComplete:(function () {
  2958. this.explodeEqual();
  2959. this.remembers.splice(0, 1);
  2960. if(this.remembers.length>0) setTimeout(this.rise.bind(this),100);
  2961. else{
  2962. this.explodeContainer2.removeChildren();
  2963. this.explode();
  2964. this.shadow.alpha = 0;
  2965. }
  2966. }).bind(this)});
  2967. };
  2968. gc.GameScene.prototype.actEqual = function(actIndex){
  2969. this.remembers = [];
  2970. this.tempRemembers = []; // 쿠키가 커진 후 크기 돌려놓기 위함
  2971. //본인
  2972. this.cookieMatrix[actIndex].flag = 0;
  2973. this.remembers.push(actIndex);
  2974. for (var i = 0; i < this.cookieNumMatrix.length; i++) {
  2975. if (this.cookieNumMatrix[i] == this.cookieMatrix[actIndex].remember) {
  2976. this.cookieMatrix[i].flag = 0;
  2977. this.remembers.push(i);
  2978. this.tempRemembers.push(i);
  2979. }
  2980. }
  2981. this.shadow.alpha = 1;
  2982. //아이템 사용시 강조 이펙트 제거를 위함
  2983. this.stopItemAccentEffect();
  2984. this.playItemAccentEffect();
  2985. //순서대로 커지게 만들기
  2986. this.rise();
  2987. };
  2988. gc.GameScene.prototype.actCross = function(actIndex){
  2989. this.champagneCombo++;
  2990. //본인
  2991. this.cookieMatrix[actIndex].flag = 0;
  2992. this.cookieMatrix[actIndex].remember = 0;
  2993. this.cookieMatrix[actIndex].alpha = 0;
  2994. var colIndex = actIndex%7; //몇번째 열인지 체크
  2995. for(var i=0; i<7; i++){
  2996. if(this.cookieMatrix[i * 7 + colIndex].flag != 0) {
  2997. if (this.cookieNumMatrix[i * 7 + colIndex] < 7) {
  2998. this.cookieMatrix[i * 7 + colIndex].flag = 0;
  2999. this.cookieMatrix[i * 7 + colIndex].alpha = 0;
  3000. this.cookieMatrix[i * 7 + colIndex].remember = 0;
  3001. }
  3002. }
  3003. }
  3004. var rowIndex = Math.floor(actIndex/7); //몇번째 열인지 체크
  3005. for(var i=0; i<7; i++){
  3006. if(this.cookieMatrix[rowIndex * 7 + i].flag != 0) {
  3007. if (this.cookieNumMatrix[rowIndex * 7 + i] < 7) {
  3008. this.cookieMatrix[rowIndex * 7 + i].flag = 0;
  3009. this.cookieMatrix[rowIndex * 7 + i].alpha = 0;
  3010. this.cookieMatrix[rowIndex * 7 + i].remember = 0;
  3011. }
  3012. }
  3013. }
  3014. //아이템 사용시 강조 이펙트 제거를 위함
  3015. this.stopItemAccentEffect();
  3016. this.playItemAccentEffect();
  3017. this.explode();
  3018. };
  3019. //쿠키 메우기==================================================================
  3020. gc.GameScene.prototype.dropCookie = function(){
  3021. var index;
  3022. var lineCount = 0; //한 열의 빈 블럭 수 카운트
  3023. var dropCount = 0; //한 열의 내려온 블럭 수 카운트(완전히 내려온 후 카운트)
  3024. var fullCount = 0; //떨어질 블럭 전체 수 카운트(빈 공간 + 새로 떨어질 블럭 수)
  3025. var dropIndexes = []; //떨어질 블럭 인덱스
  3026. for(var i=0; i<7; i++){
  3027. lineCount = 0;
  3028. //기존 블럭 내리기
  3029. for(var j=6; j>=0; j--){
  3030. index = j*7+i;
  3031. if(this.cookieMatrix[index].flag == 0){
  3032. lineCount++;
  3033. this.cookieMatrix[index].alpha = 1;
  3034. this.cookieMatrix[index].flag = 1;
  3035. }else{
  3036. if(lineCount > 0) {
  3037. fullCount++;
  3038. dropIndexes.push(index + lineCount * 7);
  3039. //내려올 블럭: (index + lineCount * 7), 복사해올 블럭: (index)
  3040. this.cookieMatrix[index + lineCount * 7].texture = this.cookieMatrix[index].texture;
  3041. this.cookieMatrix[index + lineCount * 7].remember = this.cookieMatrix[index].remember;
  3042. this.cookieMatrix[index].remember = 0;
  3043. this.cookieNumMatrix[index + lineCount * 7] = this.cookieNumMatrix[index];
  3044. this.cookieNumMatrix[index] = 0;
  3045. //아이템이 내려올 때 크기 복사
  3046. if(this.cookieNumMatrix[index + lineCount * 7] > 7) this.matchItemSize(index + lineCount * 7);
  3047. else{
  3048. this.cookieMatrix[index + lineCount * 7].scale.x = 0.85;
  3049. this.cookieMatrix[index + lineCount * 7].scale.y = 0.85;
  3050. }
  3051. TweenMax.from(this.cookieMatrix[index + lineCount * 7], 0.3, {
  3052. y: this.cookieMatrixPos[index][1], onComplete: (function () {
  3053. dropCount++;
  3054. if(dropCount == fullCount && !this.canClick) {
  3055. //이전 스테이지모드 저장
  3056. if(this.stageMode != 'momotime') this.prestageMode = this.stageMode;
  3057. this.checkAgain();
  3058. }
  3059. else {
  3060. this.lastEventTime = Date.now();
  3061. }
  3062. }.bind(this))
  3063. });
  3064. }
  3065. }
  3066. }
  3067. //새로운 쿠키 내리기
  3068. for(var j= lineCount-1; j>=0; j--){
  3069. index = j*7+i;
  3070. fullCount++;
  3071. this.cookieNumMatrix[index] = parseInt(Math.random()*6+1);
  3072. this.cookieMatrix[index].texture = PIXI.Texture.fromFrame('cookie_000'+ this.cookieNumMatrix[index] + '.png');
  3073. this.cookieMatrix[index].scale.x = 0.85;
  3074. this.cookieMatrix[index].scale.y = 0.85;
  3075. this.cookieMatrix[index].remember = 0;
  3076. this.cookieMatrix[index].alpha = 1;
  3077. this.cookieMatrix[index].flag = 1;
  3078. TweenMax.from(this.cookieMatrix[index], 0.3, {y:this.gameTable.position.y+this.cookieMatrix[index].height/2, onComplete: (function (){
  3079. dropCount++;
  3080. if(dropCount == fullCount && !this.canClick) {
  3081. //이전 스테이지모드 저장
  3082. if(this.stageMode != 'momotime') this.prestageMode = this.stageMode;
  3083. this.checkAgain();
  3084. }
  3085. else {
  3086. this.lastEventTime = Date.now();
  3087. }
  3088. }.bind(this))});
  3089. }
  3090. }
  3091. //내려올 블럭이 아이템일 경우 아이템 강조 이펙트도 같이 움직이기 위함
  3092. this.stopItemAccentEffect();
  3093. this.playItemAccentEffect();
  3094. this.getItemIndex();
  3095. //객체 의미 없음
  3096. TweenMax.from(this.cookieMatrix[0], 0.3, {onComplete: (function (){
  3097. this.restComboTime = 3; //=아이템 블럭이 많으면 다음 콤보까지 시간 부족.. 블럭 다 떨어지고 초기화
  3098. //힌트 저장을 위함
  3099. this.giveHint = false;
  3100. if(!this.checkMatching1() && this.playGame) {
  3101. this.checkAgain();
  3102. this.findHint();
  3103. }
  3104. ////게임 종료
  3105. //if(this.chance<=0 && !this.haveEmpty) this.setGameOver();
  3106. }.bind(this))});
  3107. };
  3108. gc.GameScene.prototype.checkAgain = function(){
  3109. for(var i=0; i<this.cookieMatrixPos.length; i++) {
  3110. this.cookieMatrix[i].position.x = this.cookieMatrixPos[i][0];
  3111. this.cookieMatrix[i].position.y = this.cookieMatrixPos[i][1];
  3112. }
  3113. this.checkMatching3();
  3114. };
  3115. //아이템 강조 이펙트 설정======================================================================
  3116. gc.GameScene.prototype.playItemAccentEffect = function () {
  3117. for(var i=0; i<this.cookieNumMatrix.length; i++){
  3118. if(this.cookieNumMatrix[i] > 7 && this.cookieMatrix[i].flag == 1){
  3119. this.itemEffectMc[i].alpha = 1;
  3120. this.itemEffectMc[i].play();
  3121. }
  3122. }
  3123. };
  3124. gc.GameScene.prototype.stopItemAccentEffect = function () {
  3125. for(var i=0; i<this.itemEffectMc.length; i++) {
  3126. this.itemEffectMc[i].stop();
  3127. this.itemEffectMc[i].alpha = 0;
  3128. }
  3129. };
  3130. //매칭확인=============================================================================
  3131. //처음 그릴때 매칭 되는 거 없게 하기 위함
  3132. gc.GameScene.prototype.checkMatching1= function(){
  3133. //가로 체크
  3134. var num1 = undefined;
  3135. var num2 = undefined;
  3136. var countRow = 0;
  3137. var countCol = 0;
  3138. var index1 = undefined;
  3139. var index2 = undefined;
  3140. //가로(행) 매칭 체크
  3141. for(var i=0; i<7; i++){
  3142. num1 = this.cookieNumMatrix[i*7];
  3143. countRow = 0;
  3144. for(var j=0; j<7; j++){
  3145. index1 = j+i*7;
  3146. if (num1 <7 && this.cookieNumMatrix[index1] == num1) {
  3147. countRow++;
  3148. } else {
  3149. num1 = this.cookieNumMatrix[index1];
  3150. countRow = 1;
  3151. }
  3152. if (countRow >= 3) {
  3153. return true;
  3154. }
  3155. }
  3156. }
  3157. //세로(열) 매칭 체크
  3158. for(var i=0; i<7; i++){
  3159. countCol = 0;
  3160. num2 = this.cookieNumMatrix[i];
  3161. for(var j=0; j<7; j++){
  3162. index2 = j*7+i;
  3163. if (num2<7 && this.cookieNumMatrix[index2] == num2) {
  3164. countCol++;
  3165. } else {
  3166. num2 = this.cookieNumMatrix[index2];
  3167. countCol = 1;
  3168. }
  3169. if (countCol >= 3) {
  3170. return true;
  3171. }
  3172. }
  3173. }
  3174. return false;
  3175. };
  3176. //스와핑 후 매칭 확인
  3177. gc.GameScene.prototype.checkMatching2 = function (checkingIndex){
  3178. this.l_c = 0;
  3179. this.r_c = 0;
  3180. this.u_c = 0;
  3181. this.d_c = 0;
  3182. this.itemIndex = undefined;
  3183. this.memories = [];
  3184. if(this.cookieNumMatrix[checkingIndex] < 7) {
  3185. //왼쪽 파트
  3186. for (var i = checkingIndex; i >= Math.floor(checkingIndex / 7) * 7; i--) {
  3187. if (this.cookieNumMatrix[i] == this.cookieNumMatrix[checkingIndex]) {
  3188. this.l_c++;
  3189. } else {
  3190. break;
  3191. }
  3192. }
  3193. //오른쪽 파트
  3194. for (var i = checkingIndex; i <= Math.floor(checkingIndex / 7 + 1) * 7 - 1; i++) {
  3195. if (this.cookieNumMatrix[i] == this.cookieNumMatrix[checkingIndex]) {
  3196. this.r_c++;
  3197. } else {
  3198. break;
  3199. }
  3200. }
  3201. //위쪽 파트
  3202. for (var i = checkingIndex; i >= 0; i -= 7) {
  3203. if (this.cookieNumMatrix[i] == this.cookieNumMatrix[checkingIndex]) {
  3204. this.u_c++;
  3205. } else {
  3206. break;
  3207. }
  3208. }
  3209. //아래쪽 파트
  3210. for (var i = checkingIndex; i < this.cookieMatrix.length; i += 7) {
  3211. if (this.cookieNumMatrix[i] == this.cookieNumMatrix[checkingIndex]) {
  3212. this.d_c++;
  3213. } else {
  3214. break;
  3215. }
  3216. }
  3217. }
  3218. //매칭 쿠키 확인
  3219. if(this.l_c+this.r_c -1 >= 3){ //맞춰진 가로 수가 3개 이상이면
  3220. //가로 4개 이상
  3221. if(this.l_c+this.r_c -1 >= 4) this.itemIndex = checkingIndex;
  3222. for(var i=checkingIndex-this.l_c+1; i <= checkingIndex + this.r_c-1; i++){
  3223. this.cookieMatrix[i].flag = 0;
  3224. this.memories.push(i);
  3225. }
  3226. if(this.u_c+this.d_c-1 >= 3){ //맞춰진 세로 수가 3개 이상이면
  3227. for(var i=checkingIndex-(this.u_c-1)*7; i <= checkingIndex+(this.d_c-1)*7; i+=7){
  3228. if(i != checkingIndex) {
  3229. this.cookieMatrix[i].flag = 0;
  3230. this.memories.push(i);
  3231. }
  3232. }
  3233. //십자 모양
  3234. this.itemIndex = checkingIndex;
  3235. }
  3236. return true;
  3237. }else if(this.l_c+this.r_c -1 < 3 && this.u_c+this.d_c-1 >= 3) { //가로 개수가 3개 미만이고, 세로 개수가 3개 이상
  3238. for(var i=checkingIndex-(this.u_c-1)*7; i <= checkingIndex+(this.d_c-1)*7; i+=7){
  3239. this.cookieMatrix[i].flag = 0;
  3240. this.memories.push(i);
  3241. }
  3242. //세로 4개 이상
  3243. if(this.memories.length>=4) this.itemIndex = checkingIndex;
  3244. return true;
  3245. }else{ //맞는게 없을 때
  3246. return false;
  3247. }
  3248. };
  3249. //모든 쿠키 내리고 나서 다시 매칭 확인
  3250. gc.GameScene.prototype.checkMatching3 = function(){
  3251. this.bundle = []; //매칭되는 모든 배열을 저장하기 위한 배열
  3252. for (var j = 0; j < this.cookieMatrix.length; j++) {
  3253. this.l_c = 0;
  3254. this.r_c = 0;
  3255. this.u_c = 0;
  3256. this.d_c = 0;
  3257. this.itemIndex = undefined;
  3258. this.memories = [];
  3259. if (this.cookieMatrix[j].flag != 0 && this.cookieNumMatrix[j]<7) {
  3260. //왼쪽 파트
  3261. for (var i = j; i >= Math.floor(j / 7) * 7; i--) {
  3262. if (this.cookieNumMatrix[i] == this.cookieNumMatrix[j]) {
  3263. this.l_c++;
  3264. } else {
  3265. break;
  3266. }
  3267. }
  3268. //오른쪽 파트
  3269. for (var i = j; i <= Math.floor(j / 7 + 1) * 7 - 1; i++) {
  3270. if (this.cookieNumMatrix[i] == this.cookieNumMatrix[j]) {
  3271. this.r_c++;
  3272. } else {
  3273. break;
  3274. }
  3275. }
  3276. //위쪽 파트
  3277. for (var i = j; i >= 0; i -= 7) {
  3278. if (this.cookieNumMatrix[i] == this.cookieNumMatrix[j]) {
  3279. this.u_c++;
  3280. } else {
  3281. break;
  3282. }
  3283. }
  3284. //아래쪽 파트
  3285. for (var i = j; i < this.cookieMatrix.length; i += 7) {
  3286. if (this.cookieNumMatrix[i] == this.cookieNumMatrix[j]) {
  3287. this.d_c++;
  3288. } else {
  3289. break;
  3290. }
  3291. }
  3292. //매칭 쿠키 확인
  3293. if (this.l_c + this.r_c - 1 >= 3) { //맞춰진 가로 수가 3개 이상이면
  3294. for (var i = j - this.l_c + 1; i <= j + this.r_c - 1; i++) {
  3295. this.memories.push(i);
  3296. }
  3297. if (this.u_c + this.d_c - 1 >= 3) { //맞춰진 세로 수가 3개 이상이면
  3298. for (var i = j - (this.u_c - 1) * 7; i <= j + (this.d_c - 1) * 7; i += 7) {
  3299. if (i != j) {
  3300. this.memories.push(i);
  3301. }
  3302. }
  3303. }
  3304. } else if (this.l_c + this.r_c - 1 < 3 && this.u_c + this.d_c - 1 >= 3) { //가로 개수가 3개 미만이고, 세로 개수가 3개 이상
  3305. for (var i = j - (this.u_c - 1) * 7; i <= j + (this.d_c - 1) * 7; i += 7) {
  3306. this.memories.push(i);
  3307. }
  3308. }
  3309. }
  3310. this.bundle[j] = this.memories;
  3311. }
  3312. var bundleCount = 0;
  3313. for (var i = 0; i < this.bundle.length; i++) {
  3314. if (this.bundle[i].length == 0) {
  3315. bundleCount++;
  3316. }
  3317. }
  3318. //맞춰진 블럭이 있을때
  3319. if (bundleCount != this.bundle.length) this.searchingMaxLength();
  3320. else {
  3321. this.haveEmpty = false;
  3322. for (var i = 0; i < this.cookieMatrix.length; i++) {
  3323. if (this.cookieMatrix[i].flag == 0) this.haveEmpty = true;
  3324. }
  3325. if (this.haveEmpty) this.explode();
  3326. else {
  3327. if (this.playGame) {
  3328. this.canClick = true;
  3329. }
  3330. else {
  3331. if (this.itemOver) {
  3332. this.PlayOver();//게임이 완전히 끝났을 때
  3333. } else {
  3334. this.lastPang();//횟수는 끝났으나 아이템이 남아있으면 터뜨리기}
  3335. }
  3336. }
  3337. //게임 종료
  3338. if (this.playGame && this.chance <= 0 && !this.haveEmpty) this.setGameOver();
  3339. }
  3340. }
  3341. };
  3342. gc.GameScene.prototype.PlayOver = function () {
  3343. this.gameoverImg.anchor.set(0.5);
  3344. this.gameoverImg.x = GD.width/2;
  3345. this.gameoverImg.y = GD.height/2;
  3346. this.addChild(this.gameoverImg);
  3347. TweenMax.to(this.gameoverImg.scale, 0.5, {x:1, y:1, onComplete:(function () {
  3348. TweenMax.to(this.gameoverImg.scale, 0.3, {x:1.2, y:1.2});
  3349. }).bind(this)});
  3350. TweenMax.from(this.gameoverImg, 0.5, {y:GD.height+this.gameoverImg.height});
  3351. this.giveHint = true;
  3352. this.canClick = false;
  3353. this.normalmomo.stop();
  3354. this.fevermomo.stop();
  3355. this.normalshushu.stop();
  3356. this.fevershushu.stop();
  3357. this.fevereffect1.stop();
  3358. this.fevereffect2.stop();
  3359. GD.soundPlay('sound_gameover');
  3360. setTimeout(this.onResult.bind(this),1000);
  3361. };
  3362. //타임업 사운드가 끝나고 결과창으로 이동
  3363. gc.GameScene.prototype.onResult = function () {
  3364. GD.bgmStop();
  3365. gc.game = null;
  3366. GD.commonOption.finish(this.score);
  3367. };
  3368. //맞춰진 배열에서 가장 긴 배열에 아이템을 넣기 위한 함수
  3369. gc.GameScene.prototype.searchingMaxLength = function(){
  3370. var maxLength = 0;
  3371. var maxLengthIndex = undefined;
  3372. for(var i=0; i<this.bundle.length; i++){
  3373. if(this.bundle[i].length > maxLength) {
  3374. maxLength = this.bundle[i].length;
  3375. maxLengthIndex = i;
  3376. }
  3377. }
  3378. for (var i = 0; i < this.bundle[maxLengthIndex].length; i++) {
  3379. this.cookieMatrix[this.bundle[maxLengthIndex][i]].flag = 0;
  3380. this.cookieMatrix[this.bundle[maxLengthIndex][i]].alpha = 0;
  3381. this.cookieMatrix[this.bundle[maxLengthIndex][i]].remember = 0;
  3382. }
  3383. if(this.bundle[maxLengthIndex].length >= 4) {
  3384. if (this.bundle[maxLengthIndex].length >= 5) {
  3385. this.cookieMatrix[maxLengthIndex].remember = this.cookieNumMatrix[maxLengthIndex];
  3386. var itemName = 'cookie2_000';
  3387. var fullItemName = itemName+this.cookieMatrix[maxLengthIndex].remember+'.png';
  3388. this.cookieMatrix[maxLengthIndex].texture = PIXI.Texture.fromFrame(fullItemName);
  3389. this.cookieNumMatrix[maxLengthIndex] = 9;
  3390. }else if (this.bundle[maxLengthIndex].length >= 4) {
  3391. this.cookieMatrix[maxLengthIndex].texture = PIXI.Texture.fromFrame('eraser_0001.png');
  3392. this.cookieNumMatrix[maxLengthIndex] = 8;
  3393. }
  3394. this.cookieMatrix[maxLengthIndex].flag = 1;
  3395. this.cookieMatrix[maxLengthIndex].alpha = 1;
  3396. }
  3397. this.combo++;
  3398. this.totalCombo++;
  3399. if(this.stageMode != 'momotime') {
  3400. if(this.combo>=15) {this.stageMode = 'superfever';}
  3401. else if(this.combo>=5){
  3402. this.stageMode = 'fever';
  3403. this.callfevercnt = 0;
  3404. } else{this.stageMode = 'normal';}
  3405. }
  3406. this.lastTime = Date.now();
  3407. this.restComboTime = 3;
  3408. this.checkMatching3();
  3409. };
  3410. //피버모드=======================================================================================================
  3411. gc.GameScene.prototype.setFeverText = function () {
  3412. this.superfeverText.anchor.set(0.5);
  3413. this.superfeverText.position.x = gc.width / 2;
  3414. this.superfeverText.position.y = this.gameTable.position.y;
  3415. this.superfeverText.scale.x = 0;
  3416. this.superfeverText.scale.y = 0;
  3417. this.addChild(this.superfeverText);
  3418. this.feverText.anchor.set(0.5);
  3419. this.feverText.position.x = gc.width / 2;
  3420. this.feverText.position.y = this.gameTable.position.y;
  3421. this.feverText.scale.x = 0;
  3422. this.feverText.scale.y = 0;
  3423. this.addChild(this.feverText);
  3424. };
  3425. gc.GameScene.prototype.setFever = function () {
  3426. if(!this.pauseMode) {
  3427. var now = Date.now();
  3428. if (this.lastTime == undefined) this.lastTime = now;
  3429. if (this.playGame) {
  3430. if (this.restComboTime > 0) {this.restComboTime -= (now - this.lastTime) / 1000;}
  3431. else {
  3432. this.combo = 0;
  3433. this.restComboTime = 0;
  3434. this.lastTime = undefined;
  3435. if(this.stageMode != 'normal') this.prestageMode = this.stageMode;
  3436. this.stageMode = 'normal';
  3437. this.callfevercnt = 0;
  3438. }
  3439. if (this.prestageMode != this.stageMode && this.callfevercnt == 0) {this.actFever();}
  3440. this.lastTime = now;
  3441. }
  3442. }else this.lastTime = Date.now();
  3443. };
  3444. gc.GameScene.prototype.actFever = function () {
  3445. this.callfevercnt++;
  3446. if(this.stageMode == 'normal'){
  3447. this.normalMode();
  3448. this.gameBG.texture = GD.loader.resources['game_bg'].texture;
  3449. this.fevereffect1.alpha = 0;
  3450. this.fevereffect2.alpha = 0;
  3451. } else{
  3452. this.otherMode();
  3453. this.actfeverEffect();
  3454. }
  3455. };
  3456. gc.GameScene.prototype.actfeverEffect = function(){
  3457. if(this.test){
  3458. this.fevereffect1.y = -200;
  3459. this.fevereffect2.y = -200;
  3460. }else {
  3461. this.gameBG.texture = GD.loader.resources['game_bg_fever'].texture;
  3462. this.fevereffect1.y = 465;
  3463. this.fevereffect2.y = 345;
  3464. }
  3465. this.fevereffect1.alpha = 1;
  3466. this.fevereffect2.alpha = 1;
  3467. this.fevereffect2.scale.y = 1.5;
  3468. if(!this.test)if (this.stageMode != 'momotime') GD.soundPlay('sound_fever');
  3469. if (this.stageMode == 'superfever') {
  3470. this.superfeverText.alpha = 1;
  3471. TweenMax.to(this.superfeverText.scale, 0.5, {
  3472. x: 1, y: 1, alpha: 1, onComplete: (function () {
  3473. TweenMax.to(this.superfeverText, 0.7, {
  3474. onComplete: (function () {
  3475. this.superfeverText.scale.x = 0;
  3476. this.superfeverText.scale.y = 0;
  3477. this.superfeverText.alpha = 0;
  3478. }).bind(this)
  3479. });
  3480. }).bind(this)
  3481. });
  3482. } else if (this.stageMode == 'fever') {
  3483. this.feverText.alpha = 1;
  3484. TweenMax.to(this.feverText.scale, 0.5, {
  3485. x: 1, y: 1, alpha: 1, onComplete: (function () {
  3486. TweenMax.to(this.feverText, 0.7, {
  3487. onComplete: (function () {
  3488. this.feverText.scale.x = 0;
  3489. this.feverText.scale.y = 0;
  3490. this.feverText.alpha = 0;
  3491. if(this.test) {
  3492. this.test = false;
  3493. this.stageMode = 'normal';
  3494. }
  3495. }).bind(this)
  3496. });
  3497. }).bind(this)
  3498. });
  3499. }
  3500. };
  3501. // 일시정지
  3502. gc.GameScene.prototype.pause = function(){
  3503. this.pauseMode = true;
  3504. this.setInteractive(false);
  3505. };
  3506. // 게임진행
  3507. gc.GameScene.prototype.resume = function(){
  3508. this.pauseMode = false;
  3509. this.setInteractive(true);
  3510. };
  3511. // 버튼 이벤트 설정
  3512. gc.GameScene.prototype.setInteractive = function(bool){
  3513. for(var i=0; i<this.cookieMatrix.length; i++){ this.cookieMatrix[i].interactive = bool;}
  3514. if(this.pauseMode){
  3515. this.fevereffect1.stop();
  3516. this.fevereffect2.stop();
  3517. this.normalmomo.stop();
  3518. this.fevermomo.stop();
  3519. this.normalshushu.stop();
  3520. this.fevershushu.stop();
  3521. if(this.giveHint){
  3522. this.hintMc1.stop();
  3523. this.hintMc2.stop();
  3524. }
  3525. }else{
  3526. this.fevereffect1.play();
  3527. this.fevereffect2.play();
  3528. if(this.stageMode == 'normal') {this.normalMode();}
  3529. else{this.otherMode();}
  3530. if(this.giveHint){
  3531. this.hintMc1.play();
  3532. this.hintMc2.play();
  3533. }
  3534. }
  3535. };
  3536. //메달(업적) 관리==================================================================================================
  3537. gc.GameScene.prototype.manageMedal = function () {
  3538. if(this.totalCombo >= 100 && !this.getMedal4) {
  3539. DataManager.addMedal(4);
  3540. this.getMedal4 = true;
  3541. } else if(this.totalCombo >= 3 && !this.getMedal1) {
  3542. DataManager.addMedal(1);
  3543. this.getMedal1 = true;
  3544. }else if(this.champagneCombo >= 10 && !this.getMedal2) {
  3545. DataManager.addMedal(2);
  3546. this.getMedal2 = true;
  3547. }else if(this.bombCombo >= 10 && !this.getMedal3) {
  3548. DataManager.addMedal(3);
  3549. this.getMedal3 = true;
  3550. }
  3551. };
  3552. gc.GameScene.getInstance = function(){
  3553. if(!gc.game) gc.game = new gc.GameScene();
  3554. return gc.game;
  3555. };
  3556. module.exports.gc = gc;