123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- import "./js/weapp-adapter";
- import { TweenMax } from './js/TweenMax.min'
- import * as PIXI from './js/pixi';
- import GD from './js/human.min'
- import gc from './js/GC'
- // @TODO 引入sdk代码
- import DwSdk from "./duowansdk/DwSdk";
- const debug = false;
- const objSdk = GD.objSdk = new DwSdk("精灵大拯救", debug);
- /*이미지 서버*/
- var GAME_IMG_PATH = 'https://pub.dwstatic.com/wxgame/jumpgame';
- /*JS 서버*/
- var RES_DIR_IMG = GAME_IMG_PATH + '/jumpgame_stair/image/';//메달 이미지가 있는 경우
- var RES_DIR_JSON = RES_DIR_IMG + 'json/';
- var RES_DIR_SPINE = RES_DIR_IMG + 'spine/';
- // 소스버전
- function mobileCheck() {
- var mobileKeyWords = ['iphone', 'ipod', 'blackberry', 'android', 'windows ce', 'lg', 'mot', 'samsung', 'sonyericsson', 'meego', 'nokia', 'webos', 'opera mini', 'opera mobi', 'iemobile'];
- gc.IS_MOBILE = false;
- var browerAgent = navigator.userAgent.toLowerCase();
- for (var i = 0; i < mobileKeyWords.length; ++i) {
- if (browerAgent.indexOf(mobileKeyWords[i]) != -1) {
- gc.IS_MOBILE = true;
- break;
- }
- }
- }
- function checkIphone() {
- var mobileKeyWords = ['iphone', 'ipod'];
- gc.IS_IPHONE = false;
- var browerAgent = navigator.userAgent.toLowerCase();
- for (var i = 0; i < mobileKeyWords.length; i++) {
- if (browerAgent.indexOf(mobileKeyWords[i]) != -1) {
- gc.IS_IPHONE = true;
- break;
- }
- }
- };
- //오브젝트 지우기
- function removeObject(obj) {
- //어디에 붙어있던 부모를 찾아서 지우므로 어디에 붙어있는지 몰라도 됨.
- if (obj && obj.parent) obj.parent.removeChild(obj);
- };
- // 인트로
- function onIntro() {
- //사운드 팝업
- if (!gc.soundPopup) gc.soundPopup = new gc.PopupSound();
- //개별 인트로
- if (gc.game) {
- TweenMax.killAll();
- removeObject(gc.game);
- }
- gc.game = null;
- objSdk.showAdIcon(10, 880);
- removeObject(gc.intro);
- gc.intro = null;
- if (!gc.intro) gc.intro = new gc.Intro();
- gc.intro.init();
- GD.stage.addChild(gc.intro);
- }
- /**
- * Created by admin on 2018-04-05.
- */
- (function () {
- var { pixelRatio, windowWidth, windowHeight } = wx.getSystemInfoSync()
- var gWidth = windowWidth * 2
- var gHeight = windowHeight * 2
- // 언어설정
- GD.leng = 'cn';
- GD.isDebug = false;
- // Canvas 화면설정
- GD.init(gWidth, gHeight, 0, 0, 0xFFFFFF);
- //모바일 체크
- mobileCheck();
- checkIphone();
- //이미지 로드
- loadImage();
- })();
- //이미지 로드
- function loadImage() {
- //메달 업적이미지
- // GD.loader.add('game_medal_1', RES_DIR_IMG + "mission_0001.png");
- //PNG 이미지 로드
- // GD.loader.add('game_bg1', RES_DIR_PNG + "bg1.png");
- //JSON 이미지 로드
- GD.loader.add(RES_DIR_JSON + "naver/" + "naver_result.json");
- GD.loader.add(RES_DIR_JSON + "popup/" + "popup_sound.json");
- GD.loader.add(RES_DIR_JSON + "popup/" + 'popup_menu.json');
- GD.loader.add(RES_DIR_JSON + "intro/" + "intro.json");
- GD.loader.add(RES_DIR_JSON + "game/" + "bg_1.json");
- GD.loader.add(RES_DIR_JSON + "game/" + "bg_2.json");
- GD.loader.add(RES_DIR_JSON + "game/" + "game_ui.json");
- //튜토리얼
- if (GD.leng == 'ko') { GD.loader.add(RES_DIR_JSON + "tutorial/" + "tutorial1.json"); }
- else { GD.loader.add(RES_DIR_JSON + "tutorial/" + "tutorial1_" + GD.leng + ".json"); }
- //spine 이미지 로드
- GD.loader.add('cha1', RES_DIR_SPINE + "character/" + "lyto.json");
- GD.loader.add('somi', RES_DIR_SPINE + "character/" + "somi.json");
- GD.loader.add('bird1', RES_DIR_SPINE + "bird/" + "bird.json");
- GD.loader.add('bird2', RES_DIR_SPINE + "bird/" + "bird2.json");
- GD.loader.add('bird3', RES_DIR_SPINE + "bird/" + "bird3.json");
- GD.loader.add('foothold1', RES_DIR_SPINE + "foothold/" + "foothold_1.json");
- GD.loader.add('foothold2', RES_DIR_SPINE + "foothold/" + "foothold_2.json");
- GD.loader.add('foothold_ice', RES_DIR_SPINE + "foothold/" + "foothold_ice.json");
- GD.loader.add('foothold_rail', RES_DIR_SPINE + "foothold/" + "foothold_rail.json");
- GD.loader.add('foothold_jump', RES_DIR_SPINE + "foothold/" + "foothold_jump.json");
- GD.loader.add('cha_hit', RES_DIR_SPINE + "effect/" + "cha_hit.json");
- GD.loader.add('ef1', RES_DIR_SPINE + "effect/" + "ef1.json");
- GD.loader.add('ef2', RES_DIR_SPINE + "effect/" + "ef2.json");
- GD.loader.add('target', RES_DIR_SPINE + "effect/" + "target.json");
- GD.loader.add('scoreEf50', RES_DIR_SPINE + "effect/" + "text2.json");
- GD.loader.add('scoreEf100', RES_DIR_SPINE + "effect/" + "text3.json");
- GD.loader.add('scoreEf1000', RES_DIR_SPINE + "effect/" + "firework.json");
- GD.loader.add('portal1', RES_DIR_SPINE + "portal/" + "portal1.json");
- //사운드 로드
- GD.loader.load(loadSound);
- GD.showProgress();
- }
- //사운드 로드
- function loadSound() {
- //bgm
- var soundList = [
- 'sound_bgm_mini'
- // 'sound_50'
- ];
- //effect
- var effectList = [
- 'sound_50',
- 'sound_100',
- 'sound_1000',
- 'sound_gauge',
- 'sound_jump',
- 'sound_newblock',
- 'sound_newtheme',
- 'sound_start',
- 'sound_wallhit',
- 'sound_birdhit',
- 'sound_dangling',
- 'sound_falling',
- 'sound_clear',
- 'sound_gameover'
- ];
- if (GD.soundType == 1) soundList = soundList.concat(effectList);//bgm과 이펙트 사운드가 분리되어 관리될 경우 하나의 배열로 합침
- if (soundList.length == 0) {
- onAssetsLoaded();
- return;
- }
- GD.loadSound(soundList, onAssetsLoaded);
- }
- //로드 완료
- function onAssetsLoaded() {
- console.log('assets loaded')
- // 로딩화면 삭제
- GD.hideProgress();
- onIntro();
- GD.app.ticker.add(objSdk.update, null, PIXI.UPDATE_PRIORITY.UTILITY);
- }
- wx.onShareAppMessage(function () {
- return {
- title: "聪明人都在玩的游戏,快来挑战一下!",
- imageUrl: "https://pub.dwstatic.com/wxgame/jumpgame/jumpgame_stair/image/json/intro/shareImage.jpg",
- query: ""
- }
- })
- wx.showShareMenu({
- withShareTicket: false
- })
|