Commit 39292dd9 authored by 张世斌's avatar 张世斌

1.修复bug

parent 8c276589
...@@ -88,9 +88,10 @@ export default class LayerMgr extends Manager { ...@@ -88,9 +88,10 @@ export default class LayerMgr extends Manager {
// cc.view.setFrameSize(screen.width*0.5,screen.height*0.5) // cc.view.setFrameSize(screen.width*0.5,screen.height*0.5)
//手机设备和pc返回的不一样【神经病,pc返回width/height,应该是height/widg】 //手机设备和pc返回的不一样【神经病,pc返回width/height,应该是height/widg】
//let cRatio=cc.view.getDevicePixelRatio() //let cRatio=cc.view.getDevicePixelRatio()
let policy = this.isFitWidth() && cc.ResolutionPolicy.FIXED_WIDTH || cc.ResolutionPolicy.FIXED_HEIGHT // let policy = this.isFitWidth() && cc.ResolutionPolicy.FIXED_WIDTH || cc.ResolutionPolicy.FIXED_HEIGHT
// cc.view.setDesignResolutionSize(720, 1280, policy) // // cc.view.setDesignResolutionSize(720, 1280, policy)
cc.view.setDesignResolutionSize(AppConst.Width, AppConst.Height, policy) // cc.view.setDesignResolutionSize(AppConst.Width, AppConst.Height, policy)
this.initSize();
this.layers = new Array() this.layers = new Array()
this.createLayers() this.createLayers()
...@@ -98,6 +99,37 @@ export default class LayerMgr extends Manager { ...@@ -98,6 +99,37 @@ export default class LayerMgr extends Manager {
this.uiViews = [this.flybllodLayer, this.uiLayer, this.windowLayer, this.windowTopLayer, this.tipViewLayer, this.guideLayer, this.topLayer] this.uiViews = [this.flybllodLayer, this.uiLayer, this.windowLayer, this.windowTopLayer, this.tipViewLayer, this.guideLayer, this.topLayer]
console.log("LayerMgr onStart") console.log("LayerMgr onStart")
} }
_designSize = null; // 设计分辨率
_frameSize = null; // 屏幕分辨率
_mapScaleMin = null; // 场景中常用缩放(取大值)
_mapScaleMax = null; // 场景中常用缩放(取小值)
_cocosScale = null; // cocos 自缩放 (较少用到)
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;
cc.director['_scene'].width = frameSize.width;
cc.director['_scene'].height = frameSize.height;
}
public release() { public release() {
console.log("LayerMgr onRelease") console.log("LayerMgr onRelease")
......
...@@ -124,6 +124,9 @@ export default class MenuController extends Controller{ ...@@ -124,6 +124,9 @@ export default class MenuController extends Controller{
} }
private onClickColor(node:cc.Node){ private onClickColor(node:cc.Node){
if(!this.isCanTap){
return;
}
let choice=this.view.choiceColor; let choice=this.view.choiceColor;
choice.active=true; choice.active=true;
choice.x=node.x; choice.x=node.x;
...@@ -154,6 +157,7 @@ export default class MenuController extends Controller{ ...@@ -154,6 +157,7 @@ export default class MenuController extends Controller{
this.playDragonBoneAnimation(this.catAni,"finish",1,()=>{ this.playDragonBoneAnimation(this.catAni,"finish",1,()=>{
this.playDragonBoneAnimation(this.catAni,"normal",-1); this.playDragonBoneAnimation(this.catAni,"normal",-1);
}); });
this.isCanTap=false;
// this.view.resultPaint.active=true; // this.view.resultPaint.active=true;
// this.view.paint.active=false; // this.view.paint.active=false;
......
...@@ -14,7 +14,8 @@ export default class MenuModel extends Model{ ...@@ -14,7 +14,8 @@ export default class MenuModel extends Model{
await new Promise<void>(resolve=>{ await new Promise<void>(resolve=>{
getData((data) => { getData((data) => {
resolve(); resolve();
cc.log('get data:' + data); // cc.log('get data:' + data);
cc.log(data);
this.data = data || this.getDefaultData(); this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data)) this.data = JSON.parse(JSON.stringify(this.data))
}) })
......
...@@ -56,6 +56,9 @@ let creatorBasePath = 'C:\\CocosDashboard_1.0.6\\resources\\.editors\\Creator\\2 ...@@ -56,6 +56,9 @@ let creatorBasePath = 'C:\\CocosDashboard_1.0.6\\resources\\.editors\\Creator\\2
if (process.platform !== 'win32') { if (process.platform !== 'win32') {
creatorBasePath = "/Applications/CocosCreator/Creator/2.4.5/CocosCreator.app/Contents/MacOS/CocosCreator"; creatorBasePath = "/Applications/CocosCreator/Creator/2.4.5/CocosCreator.app/Contents/MacOS/CocosCreator";
} }
else{
creatorBasePath = "C:\\Tools\\CocosDashboard_1.0.20\\resources\\.editors\\Creator\\2.4.5\\CocosCreator.exe";
}
const buildCocos = function (args) { const buildCocos = function (args) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const buffer = spawn( const buffer = spawn(
......
This diff is collapsed.
This diff is collapsed.
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