Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1696 : 添加v3版本的moonwarriors测试例 #1697

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions samples/js-moonwarriors-runtime/.cocos-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"has_native": true,
"project_type": "js"
}
19 changes: 19 additions & 0 deletions samples/js-moonwarriors-runtime/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"game_name": "月亮战士v3",
"package_name": "org.cocos2dx.moonwarriors.v3",
"version_name": "3.0.0",
"version_code": 3,
"runtime_version": "3.3.0.4",
"description": "这是灰常好玩的打飞机游戏!",
"orientation": "portrait",
"entry_file": "main.js",
"game_type":"offline",
"design_resolution": {
"width": 480,
"height": 720,
"policy": "SHOW_ALL"
},
"security": {
"password":"moonwarriors"
}
}
96 changes: 96 additions & 0 deletions samples/js-moonwarriors-runtime/group.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"boot": {
"priority": 0,
"files": [
"res_engine/dialog_bg.png",
"res_engine/dialog_cancel_normal.png",
"res_engine/dialog_cancel_press.png",
"res_engine/dialog_confirm_normal.png",
"res_engine/dialog_confirm_press.png",
"res_engine/preload_bg.jpg",
"res_engine/preload_logo.png",
"res_engine/preload_title.png",
"res_engine/progress_bar.png",
"res_engine/progress_bg.png",
"res_engine/progress_light.png",
"res_engine/progress_shadow.png",
"res/dialog_bg.png",
"res/dialog_cancel_normal.png",
"res/dialog_cancel_press.png",
"res/dialog_confirm_normal.png",
"res/dialog_confirm_press.png",
"res/flare.jpg",
"res/loading.png",
"res/logoBack.png",
"res/logo.png",
"res/menu.png",
"res/Music/buttonEffet.mp3",
"res/Music/buttonEffet.ogg",
"res/Music/mainMainMusic.mp3",
"res/Music/mainMainMusic.ogg",
"res/textureTransparentPack.plist",
"res/textureTransparentPack.png",
"src/AboutLayer.js",
"src/Background.js",
"src/Bullet.js",
"src/config/EnemyType.js",
"src/config/GameConfig.js",
"src/config/Level.js",
"src/Effect.js",
"src/Enemy.js",
"src/Explosion.js",
"src/GameController.js",
"src/GameControlMenu.js",
"src/GameLayer.js",
"src/GameOver.js",
"src/HitEffect.js",
"src/LevelManager.js",
"src/Resource.js",
"src/SettingsLayer.js",
"src/Ship.js",
"src/SparkEffect.js",
"src/SysMenu.js"
]
},

"common": {
"priority": 1,
"files": [
"res/menuTitle.png"
]
},

"gamelayer": {
"priority": 2,
"files": [
"res/arial-14.fnt",
"res/arial-14.GlyphProject",
"res/arial-14.png",
"res/b01.plist",
"res/b01.png",
"res/explode.plist",
"res/explosion.plist",
"res/explosion.png",
"res/level01.tmx",
"res/Music/bgMusic.mp3",
"res/Music/bgMusic.ogg",
"res/Music/explodeEffect.mp3",
"res/Music/explodeEffect.ogg",
"res/Music/fireEffect.mp3",
"res/Music/fireEffect.ogg",
"res/Music/shipDestroyEffect.mp3",
"res/Music/shipDestroyEffect.ogg",
"res/textureOpaquePack.plist",
"res/textureOpaquePack.png"
]
},

"gameover": {
"priority": 3,
"files": [
"res/cocos2d-html5.png",
"res/gameOver.png",
"res/gameoverBack.png"
]
}
}
36 changes: 36 additions & 0 deletions samples/js-moonwarriors-runtime/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Cocos2d-html5 Show Case - MoonWarriors</title>
<meta name="viewport" content="user-scalable=no"/>
<meta charset="utf-8"/>
<meta name="author" content="html5china"/>
</head>
<body>
<canvas id="gameCanvas" width="320" height="480"></canvas>
<script>
if(window.CocosRuntime){
var configObj = {
"orientation": "portrait",
"version_code":3,
"game_url": "http://115.28.72.132/test/v0.9.6-1st/org.cocos2dx.moonwarriors.v3/3"
};

CocosRuntime.start(JSON.stringify(configObj));
}else{

var sources = [
"../../frameworks/cocos2d-html5/CCBoot.js",
"main.js"
];

for (var i = 0; i < sources.length; ++i) {
var script = document.createElement("script");
script.src = sources[i];
script.async = false;
document.body.appendChild(script);
}
}
</script>
</body>
</html>
143 changes: 143 additions & 0 deletions samples/js-moonwarriors-runtime/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.

http://www.cocos2d-x.org


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/

/**
* A brief explanation for "project.json":
* Here is the content of project.json file, this is the global configuration for your game, you can modify it to customize some behavior.
* The detail of each field is under it.
{
"debugMode" : 1,
// "debugMode" possible values :
// 0 - No message will be printed.
// 1 - cc.error, cc.assert, cc.warn, cc.log will print in console.
// 2 - cc.error, cc.assert, cc.warn will print in console.
// 3 - cc.error, cc.assert will print in console.
// 4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.
// 5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web.
// 6 - cc.error, cc.assert will print on canvas, available only on web.

"showFPS" : true,
// Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.

"frameRate" : 60,
// "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.

"id" : "gameCanvas",
// "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.

"renderMode" : 0,
// "renderMode" sets the renderer type, only useful on web :
// 0 - Automatically chosen by engine
// 1 - Forced to use canvas renderer
// 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers

"engineDir" : "../../frameworks/cocos2d-html5/",
// In debug mode, if you use the whole engine to develop your game, you should specify its relative path with "engineDir",
// but if you are using a single engine file, you can ignore it.

"modules" : ["cocos2d"],
// "modules" defines which modules you will need in your game, it's useful only on web,
// using this can greatly reduce your game's resource size, and the cocos console tool can package your game with only the modules you set.
// For details about modules definitions, you can refer to "../../frameworks/cocos2d-html5/modulesConfig.json".

"jsList" : [
]
// "jsList" sets the list of js files in your game.
}
*
*/

cc.log("==> main.js loaded!");

cc.game.onStart = function () {
cc.log("==> cc.game.onStart ...");
cc.view.adjustViewPort(true);
cc.view.setDesignResolutionSize(480, 720, cc.ResolutionPolicy.SHOW_ALL);
cc.view.resizeWithBrowserSize(true);
cc.director.setProjection(cc.Director.PROJECTION_2D);
cc.LoaderLayer.setConfig({
background: {
res: "res/loading.png"
},
logo: {
res: "res/logo.png",
action: null
},
title: {
res: "res/logoBack.png"
},
onEnter: function (layer) {
cc.log("moonwarriors onEnter");
var label = new cc.LabelTTF("this is moonwarriors","Arial",22);
label.setColor(cc.color(255,0,0));
label.setPosition(cc.p(cc.winSize.width/2,200));
layer.addChild(label);
},
onExit: function (layer) {
cc.log("moonwarriors onExit");
},
tips: {
color: cc.color(255, 0, 0),
tipsProgress: function (status, loaderlayer) {
var statusStr = "runtime正在";
if (status.stage == cc.network.preloadstatus.DOWNLOAD) {
statusStr += "下载";
} else if (status.stage == cc.network.preloadstatus.UNZIP) {
statusStr += "解压";
}
if (status.groupName) {
statusStr += status.groupName;
}
statusStr += " 进度:" + status.percent.toFixed(2) + "%";
loaderlayer.getTipsLabel().setString(statusStr);
}
}
});
if (cc.sys.isNative) {
//get netowrk status
var networkStatus = cc.network.getNetworkType();
if (networkStatus == cc.network.type.WIFI) {
cc.log("current network is WIFI");
} else if (networkStatus == cc.network.type.MOBILE) {
cc.log("current network is MOBILE");
} else if (networkStatus == cc.network.type.NO_NETWORK) {
cc.log("current network is UNKNOWN");
}
cc.director.runScene(SysMenu.scene());
} else {
cc.LoaderScene.preload(window["boot"], function () {
cc.LoaderLayer.preload(["gamelayer"], function () {
cc.director.runScene(SysMenu.scene());
});
});
}

var self = this;
//load resources
};

cc.game.run();
32 changes: 32 additions & 0 deletions samples/js-moonwarriors-runtime/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"debugMode" : 1,
"showFPS" : false,
"frameRate" : 60,
"id" : "gameCanvas",
"renderMode" : 0,
"engineDir":"../../frameworks/cocos2d-html5",

"modules" : ["cocos2d","extensions","runtime"],
"jsList" : [
"src/Resource.js",
"src/config/GameConfig.js",
"src/config/EnemyType.js",
"src/config/Level.js",
"src/Effect.js",
"src/Bullet.js",
"src/Enemy.js",
"src/Explosion.js",
"src/Ship.js",
"src/LevelManager.js",
"src/GameController.js",
"src/GameControlMenu.js",
"src/GameLayer.js",
"src/GameOver.js",
"src/AboutLayer.js",
"src/SettingsLayer.js",
"src/SysMenu.js",
"src/HitEffect.js",
"src/SparkEffect.js",
"src/Background.js"
]
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading