Commit 77be4b04 authored by tttal's avatar tttal

#

parent f0d07c0d
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
"__id__": 14 "__id__": 14
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 68 "__id__": 68
......
...@@ -25,6 +25,7 @@ cc.Class({ ...@@ -25,6 +25,7 @@ cc.Class({
// LIFE-CYCLE CALLBACKS: // LIFE-CYCLE CALLBACKS:
onLoad() { onLoad() {
console.log('index');
this.light_action(); this.light_action();
this.lamp_action(); this.lamp_action();
this.audio_button_update(); this.audio_button_update();
...@@ -32,8 +33,31 @@ cc.Class({ ...@@ -32,8 +33,31 @@ cc.Class({
//文字数据加载部分 //文字数据加载部分
this.load_title(local.getTempData('text0')); this.load_title(local.getTempData('text0'));
this.load_text(local.getTempData('text1'), local.getTempData('text2')); this.load_text(local.getTempData('text1'), local.getTempData('text2'));
this.initSize();
}, },
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
let f = screen_size >= design_size
cc.Canvas.instance.fitHeight = f
cc.Canvas.instance.fitWidth = !f
const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize;
this._designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
this._cocosScale = Math.min(sx, sy);
sx = frameSize.width / this._designSize.width;
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
},
start() { start() {
au.play('audio4'); au.play('audio4');
}, },
......
...@@ -17,7 +17,7 @@ cc.Class({ ...@@ -17,7 +17,7 @@ cc.Class({
local_name: '拳击机模板', local_name: '拳击机模板',
}, },
onLoad() { onLoad() {
console.log('local');
cc.game.addPersistRootNode(this.node); cc.game.addPersistRootNode(this.node);
window.local = this; window.local = this;
this[this.local_name] = { this[this.local_name] = {
...@@ -27,8 +27,8 @@ cc.Class({ ...@@ -27,8 +27,8 @@ cc.Class({
this.init_data(); this.init_data();
}, },
init_data() { init_data() {
console.log('init_data');
try { try {
// cc.find('Canvas').active = false;
window.courseware.getData(function (res) { window.courseware.getData(function (res) {
this.data = res; this.data = res;
cc.find('Canvas').active = true; cc.find('Canvas').active = true;
......
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