Commit cb954d20 authored by liujiaxin's avatar liujiaxin

ui

parent 2993b91f
...@@ -53,12 +53,41 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -53,12 +53,41 @@ export default class SceneComponent extends MyCocosSceneComponent {
FullPageNode: cc.Node[] = []; FullPageNode: cc.Node[] = [];
tw: cc.Tween = null; tws: any[] = [];
gameMachineService: any = null; gameMachineService: any = null;
LoadingCount: number = 0; LoadingCount: number = 1;
_mapScaleMin: number = 1;
_mapScaleMax: number = 1;
_cocosScale: number = 1;
onLoad(){
this.tws = [];
this.LoadingCount = 0;
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() {
this.LoadingCount = 0;
this.showWaitingLetters(); this.showWaitingLetters();
this.initBg(); this.initBg();
this.initSubmarineView(); this.initSubmarineView();
...@@ -134,6 +163,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -134,6 +163,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initSubmarineView() { initSubmarineView() {
this.submarineView.node.on('scrolling', this.moveSubmarineBackground, this); this.submarineView.node.on('scrolling', this.moveSubmarineBackground, this);
this.SubmarineView.active = false;
} }
moveSubmarineBackground() { moveSubmarineBackground() {
...@@ -511,7 +541,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -511,7 +541,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (this.LoadingCount <= 0) { if (this.LoadingCount <= 0) {
this.LoadingCount = 0; this.LoadingCount = 0;
setTimeout(() => { setTimeout(() => {
this.tw && this.tw.stop(); if (this.tws){
for (const tw of this.tws) {
tw.node.y = 0;
tw.tw.stop();
}
}
this.loading.active = false; this.loading.active = false;
}); });
} }
...@@ -525,14 +560,18 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -525,14 +560,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
const text = this.loading.getChildByName('text') const text = this.loading.getChildByName('text')
text.children.forEach((node, idx) => { text.children.forEach((node, idx) => {
node.color = colorList[idx]; node.color = colorList[idx];
this.tw = cc.tween(node) const tw = cc.tween(node)
.delay(idx / 4) .delay(idx / 4)
.by(0.3, { y: 50 }, { easing: 'sineOut' }) .to(0.3, { y: 50 }, { easing: 'sineOut' })
.by(0.3, { y: -50 }, { easing: 'sineIn' }) .to(0.3, { y: -50 }, { easing: 'sineIn' })
.delay((text.children.length - idx) / 4) .delay((text.children.length - idx) / 4)
.union() .union()
.repeatForever() .repeatForever()
.start(); .start();
this.tws.push({
tw,
node
});
}); });
this.loading.active = true; this.loading.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