Commit e8d8f1d2 by william

feat: prettier

parent cc39b235
{ {
"ver": "1.0.1", "ver": "1.0.1",
"uuid": "a185ebc5-5836-4de5-9fc5-dad679c7d751", "uuid": "d908cd19-3adf-4674-b964-c93331ca93d9",
"downloadMode": 0, "downloadMode": 0,
"subMetas": {} "subMetas": {}
} }
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "a6a7c1ba-95ff-44b0-a20c-f8dab80485a2",
"downloadMode": 0,
"subMetas": {}
}
\ No newline at end of file
...@@ -3903,7 +3903,7 @@ ...@@ -3903,7 +3903,7 @@
}, },
"_volume": 1, "_volume": 1,
"_mute": false, "_mute": false,
"_loop": false, "_loop": true,
"playOnLoad": false, "playOnLoad": false,
"preload": false "preload": false
}, },
......
...@@ -2,10 +2,8 @@ ...@@ -2,10 +2,8 @@
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
/** 游戏的全局变量 */
properties: { properties: {
/** 游戏节点的注册 */ /** 游戏节点的引用 */
// logo节点 // logo节点
logo: { logo: {
...@@ -19,6 +17,7 @@ cc.Class({ ...@@ -19,6 +17,7 @@ cc.Class({
type: cc.Node, type: cc.Node,
}, },
// teacher节点
teacher: { teacher: {
default: null, default: null,
type: cc.Node, type: cc.Node,
...@@ -44,7 +43,7 @@ cc.Class({ ...@@ -44,7 +43,7 @@ cc.Class({
type: cc.Node, type: cc.Node,
}, },
// store number节点 // store_number节点
score_number: { score_number: {
default: null, default: null,
type: cc.Label, type: cc.Label,
...@@ -118,10 +117,12 @@ cc.Class({ ...@@ -118,10 +117,12 @@ cc.Class({
default: null, default: null,
type: cc.Node, type: cc.Node,
}, },
slider2: { slider2: {
default: null, default: null,
type: cc.Node, type: cc.Node,
}, },
slider3: { slider3: {
default: null, default: null,
type: cc.Node, type: cc.Node,
...@@ -140,6 +141,7 @@ cc.Class({ ...@@ -140,6 +141,7 @@ cc.Class({
}, },
}, },
// 初始化节点
initNode: function() { initNode: function() {
var self = this var self = this
self.hand.active = true self.hand.active = true
...@@ -147,12 +149,10 @@ cc.Class({ ...@@ -147,12 +149,10 @@ cc.Class({
self.success.active = false self.success.active = false
}, },
initData: function() {
// 初始化游戏数据 // 初始化游戏数据
initData: function() {
this.score = 0; // 分数 this.score = 0; // 分数
this.timer = 30; // 每一盘游戏的总时间 this.timer = 30; // 每一盘游戏的总时间
this.leftLife = 3; // 剩余的命条数
this.swivelAnimationTime = 0.5; //转头动画时间 (单向) this.swivelAnimationTime = 0.5; //转头动画时间 (单向)
this.flirtAnimationTime = 0.5; //摸的动画时间(单向) this.flirtAnimationTime = 0.5; //摸的动画时间(单向)
this.gameState = 'waiting'; // 游戏的状态 waiting(待开始) action(游戏中) stop(被抓) over(分数总结) this.gameState = 'waiting'; // 游戏的状态 waiting(待开始) action(游戏中) stop(被抓) over(分数总结)
...@@ -189,11 +189,11 @@ cc.Class({ ...@@ -189,11 +189,11 @@ cc.Class({
var failureShare = cc.find('failure/share', this.node) var failureShare = cc.find('failure/share', this.node)
failureShare.getComponent('Share').game = this failureShare.getComponent('Share').game = this
// 将Game组件的实例传入成功的 Rank // 将Game组件的实例传入游戏成功的 Rank
var successRank = cc.find('success/rank', this.node) var successRank = cc.find('success/rank', this.node)
successRank.getComponent('Rank').game = this successRank.getComponent('Rank').game = this
// 将Game组件的实例传入失败的Rank // 将Game组件的实例传入游戏失败的Rank
var failureRank = cc.find('failure/rank', this.node) var failureRank = cc.find('failure/rank', this.node)
failureRank.getComponent('Rank').game = this failureRank.getComponent('Rank').game = this
...@@ -216,7 +216,6 @@ cc.Class({ ...@@ -216,7 +216,6 @@ cc.Class({
} else { } else {
this.gameOver() this.gameOver()
} }
if(this.level.progress < 0.8 && this.level.progress > 0.2) { if(this.level.progress < 0.8 && this.level.progress > 0.2) {
this.level.barSprite.node.color = { this.level.barSprite.node.color = {
a: 1, a: 1,
...@@ -248,9 +247,6 @@ cc.Class({ ...@@ -248,9 +247,6 @@ cc.Class({
var isFlirting = this.hand.getComponent('Hand').isFlirting var isFlirting = this.hand.getComponent('Hand').isFlirting
var isSwiveling = this.teacher.getComponent('Teacher').isSwiveling var isSwiveling = this.teacher.getComponent('Teacher').isSwiveling
if (isFlirting) {
this.heartMusic.play()
}
return isSwiveling && isFlirting return isSwiveling && isFlirting
}, },
......
// Learn cc.Class:
// - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
// Learn Attribute:
// - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
properties: { properties: {
// isFlirting: false,
// timer: 0,
}, },
flirtingAction: function() { flirtingAction: function() {
...@@ -43,6 +31,7 @@ cc.Class({ ...@@ -43,6 +31,7 @@ cc.Class({
// 当触碰到屏幕时,设置抚摸开关打开,并执行抚摸方法 // 当触碰到屏幕时,设置抚摸开关打开,并执行抚摸方法
self.node.on(cc.Node.EventType.TOUCH_START, (event) => { self.node.on(cc.Node.EventType.TOUCH_START, (event) => {
// self.node.on(cc.Node.EventType.MOUSE_DOWN, (event) => { // self.node.on(cc.Node.EventType.MOUSE_DOWN, (event) => {
self.game.heartMusic.play()
self.isFlirting = true self.isFlirting = true
self.node.runAction(self.flirtingAction) self.node.runAction(self.flirtingAction)
}) })
...@@ -50,6 +39,7 @@ cc.Class({ ...@@ -50,6 +39,7 @@ cc.Class({
// 停止触摸屏幕时,设置抚摸开关关闭,停止抚摸 // 停止触摸屏幕时,设置抚摸开关关闭,停止抚摸
self.node.on(cc.Node.EventType.TOUCH_END, (event) => { self.node.on(cc.Node.EventType.TOUCH_END, (event) => {
// self.node.on(cc.Node.EventType.MOUSE_UP, (event) => { // self.node.on(cc.Node.EventType.MOUSE_UP, (event) => {
self.game.heartMusic.pause()
self.isFlirting = false self.isFlirting = false
self.node.runAction(self.endFlirtingAction) self.node.runAction(self.endFlirtingAction)
}) })
...@@ -61,7 +51,6 @@ cc.Class({ ...@@ -61,7 +51,6 @@ cc.Class({
}) })
}, },
// LIFE-CYCLE CALLBACKS:
onLoad () { onLoad () {
// 初始化抚摸的动作 // 初始化抚摸的动作
this.flirtingAction = this.flirtingAction() this.flirtingAction = this.flirtingAction()
...@@ -72,16 +61,11 @@ cc.Class({ ...@@ -72,16 +61,11 @@ cc.Class({
this.isFlirting = false this.isFlirting = false
// 抚摸停留时常 // 抚摸停留时常
this.timer = 0 this.timer = 0
// 初始化屏幕点击监听 // 初始化屏幕点击监听
this.setTouchScreenControl() this.setTouchScreenControl()
}, },
start () {
},
update (dt) { update (dt) {
if (this.isFlirting) { if (this.isFlirting) {
this.game.gainScore() this.game.gainScore()
......
...@@ -2,12 +2,10 @@ cc.Class({ ...@@ -2,12 +2,10 @@ cc.Class({
extends: cc.Component, extends: cc.Component,
properties: { properties: {
}, },
navigateToRankPage: function () { navigateToRankPage: function () {
var self = this var self = this
console.info('跳转 rank page')
self.game.clickSound() self.game.clickSound()
self.game.classroom.active = false self.game.classroom.active = false
self.game.index.active = false self.game.index.active = false
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
properties: { properties: {
}, },
......
...@@ -2,7 +2,6 @@ cc.Class({ ...@@ -2,7 +2,6 @@ cc.Class({
extends: cc.Component, extends: cc.Component,
properties: { properties: {
}, },
shareGame: function () { shareGame: function () {
......
// Learn cc.Class:
// - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
// Learn Attribute:
// - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment