Commit ba8b8b04 authored by wildfirecode's avatar wildfirecode

1

parent df610163
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<script src="libs/downloadApp.js"></script> <script src="libs/downloadApp.js"></script>
<script> <script>
// localStorage.clear(); localStorage.clear();
var __t0__ = Date.now(); var __t0__ = Date.now();
var __debug__ = 1; var __debug__ = 1;
var __mode__ = 2; var __mode__ = 2;
......
...@@ -13,8 +13,12 @@ ...@@ -13,8 +13,12 @@
"name": "Start" "name": "Start"
}, },
{ {
"keys": "bg2_jpg,音乐开启_png,音乐关闭_png,轮子1_png,火箭_png,火_png,发弹雾气_png,大炮的头_png,大炮板子_png", "keys": "bg2_jpg,发弹雾气_png,大炮板子_png,大炮的头_png,火_png,火箭_png,轮子1_png,音乐关闭_png,音乐开启_png",
"name": "Play" "name": "Play"
},
{
"name": "preload",
"keys": "guide1_png,guide2_png"
} }
], ],
"resources": [ "resources": [
...@@ -74,14 +78,44 @@ ...@@ -74,14 +78,44 @@
"name": "start_btn_gray_png" "name": "start_btn_gray_png"
}, },
{ {
"url": "assets/playscene/音乐关闭.png", "url": "assets/startScene/ruleBtn.png",
"type": "image", "type": "image",
"name": "音乐关闭_png" "name": "ruleBtn_png"
}, },
{ {
"url": "assets/playscene/音乐开启.png", "url": "assets/startScene/addtimesbtn.png",
"type": "image", "type": "image",
"name": "音乐开启_png" "name": "addtimesbtn2_png"
},
{
"url": "assets/startScene/bg1.jpg",
"type": "image",
"name": "bg12_jpg"
},
{
"url": "assets/startScene/recordbtn.png",
"type": "image",
"name": "recordbtn2_png"
},
{
"url": "assets/startScene/start_btn.png",
"type": "image",
"name": "start_btn2_png"
},
{
"url": "assets/startScene/start_btn_gray.png",
"type": "image",
"name": "start_btn_gray2_png"
},
{
"url": "assets/playscene/bg2.jpg",
"type": "image",
"name": "bg2_jpg"
},
{
"url": "assets/playscene/发弹雾气.png",
"type": "image",
"name": "发弹雾气_png"
}, },
{ {
"url": "assets/playscene/大炮板子.png", "url": "assets/playscene/大炮板子.png",
...@@ -94,9 +128,9 @@ ...@@ -94,9 +128,9 @@
"name": "大炮的头_png" "name": "大炮的头_png"
}, },
{ {
"url": "assets/playscene/发弹雾气.png", "url": "assets/playscene/.png",
"type": "image", "type": "image",
"name": "发弹雾气_png" "name": "_png"
}, },
{ {
"url": "assets/playscene/火箭.png", "url": "assets/playscene/火箭.png",
...@@ -109,14 +143,24 @@ ...@@ -109,14 +143,24 @@
"name": "轮子1_png" "name": "轮子1_png"
}, },
{ {
"url": "assets/playscene/.png", "url": "assets/playscene/音乐关闭.png",
"type": "image", "type": "image",
"name": "_png" "name": "音乐关闭_png"
}, },
{ {
"url": "assets/playscene/bg2.jpg", "url": "assets/playscene/音乐开启.png",
"type": "image", "type": "image",
"name": "bg2_jpg" "name": "音乐开启_png"
},
{
"name": "guide1_png",
"type": "image",
"url": "assets/playscene/guide1.png"
},
{
"name": "guide2_png",
"type": "image",
"url": "assets/playscene/guide2.png"
} }
] ]
} }
\ No newline at end of file
{ {
"skins": {}, "skins": {},
"autoGenerateExmlsList": true, "autoGenerateExmlsList": true,
"exmls": [ "exmls": [
"resource/skins/PlaySkin.exml", "resource/skins/PlaySkin.exml",
"resource/skins/PrizeSkin.exml", "resource/skins/PrizeSkin.exml",
"resource/skins/RuleSkin.exml", "resource/skins/RuleSkin.exml",
"resource/skins/StartSkin.exml" "resource/skins/StartSkin.exml"
], ],
"path": "resource/default.thm.json" "path": "resource/default.thm.json"
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="PlaySkin" width="750" height="1670" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="PlaySkin" width="750" height="1663" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="bg2_png" horizontalCenter="0" verticalCenter="0"/> <e:Image horizontalCenter="0" verticalCenter="0" source="bg2_jpg"/>
<e:Group x="0" top="20" width="100%"> <e:Group x="0" top="20" width="100%">
<e:Group y="0" right="20"> <e:Group y="0" right="20">
<e:Button id="musicon" label="" x="0" y="0"> <e:Button id="musicon" label="" x="0" y="0">
...@@ -30,11 +30,13 @@ ...@@ -30,11 +30,13 @@
</e:Group> </e:Group>
<e:Label id="score" text="123456789" y="63" verticalAlign="middle" textAlign="center" width="100%" size="65" bold="true" fontFamily="Helvetica"/> <e:Label id="score" text="123456789" y="63" verticalAlign="middle" textAlign="center" width="100%" size="65" bold="true" fontFamily="Helvetica"/>
</e:Group> </e:Group>
<e:Group id="car" x="299" width="93" verticalCenter="418"> <e:Group id="car" x="329" width="93" verticalCenter="418">
<e:Image source="大炮板子_png" y="125" anchorOffsetX="46.5" x="46.5"/> <e:Image source="大炮板子_png" y="125" anchorOffsetX="46.5" x="46.5"/>
<e:Image source="大炮的头_png" y="51" anchorOffsetX="35" width="70" horizontalCenter="0"/> <e:Image source="大炮的头_png" y="51" anchorOffsetX="35" width="70" horizontalCenter="0"/>
<e:Image id="lunzi1" source="轮子1_png" anchorOffsetX="22.5" anchorOffsetY="22.5" x="10" y="142.5"/> <e:Image id="lunzi1" source="轮子1_png" anchorOffsetX="22.5" anchorOffsetY="22.5" x="10" y="142.5"/>
<e:Image id="lunzi2" source="轮子1_png" anchorOffsetX="22.5" anchorOffsetY="22.5" x="82" y="142.5"/> <e:Image id="lunzi2" source="轮子1_png" anchorOffsetX="22.5" anchorOffsetY="22.5" x="82" y="142.5"/>
<e:Image id="fireEffect" source="发弹雾气_png" y="29" horizontalCenter="0"/> <e:Image id="fireEffect" source="发弹雾气_png" y="29" horizontalCenter="0"/>
</e:Group> </e:Group>
<e:Image id="guide1" source="guide1_png" horizontalCenter="0" verticalCenter="91" visible="false"/>
<e:Image id="guide2" source="guide2_png" x="0" y="0" visible="false"/>
</e:Skin> </e:Skin>
\ No newline at end of file
...@@ -17,9 +17,11 @@ export default class PanelCtrl { ...@@ -17,9 +17,11 @@ export default class PanelCtrl {
const cls = this._panelClassMap[type]; const cls = this._panelClassMap[type];
const panel: Panel = new cls(data); const panel: Panel = new cls(data);
this._current = panel; this._current = panel;
panel.start(data); panel.once(egret.Event.ADDED_TO_STAGE, () => {
panel.start(data);
egret.Tween.get(panel).set({ y: -200 }).to({ y: 0 }, 500, egret.Ease.getBackOut(2));
}, this);
this.add(panel); this.add(panel);
egret.Tween.get(panel).set({ y: -200 }).to({ y: 0 }, 500, egret.Ease.getBackOut(2));
return panel; return panel;
} }
...@@ -31,7 +33,7 @@ export default class PanelCtrl { ...@@ -31,7 +33,7 @@ export default class PanelCtrl {
this._mask.graphics.drawRect(0, 0, 750, 1624); this._mask.graphics.drawRect(0, 0, 750, 1624);
this._mask.graphics.endFill(); this._mask.graphics.endFill();
} }
this._mask.alpha=1; this._mask.alpha = 1;
this._parent.addChild(this._mask); this._parent.addChild(this._mask);
} }
removeMask() { removeMask() {
......
This diff is collapsed.
export default class Body extends egret.Sprite {
anY = 0;
anX = 0;
private _rect: egret.Rectangle;
private _view: egret.DisplayObject;
private _counter = 0;
set rect(val: egret.Rectangle) {
this._rect = val;
this.anX = -this._rect.width / 2;
this.anY = -this._rect.height / 2;
}
get rect() { return this._rect }
private _gravityY = 0;
private _gravityX = 0;
/**
* 每帧移动的px数
*/
private _velocityY = 0;
private _velocityX = 0;
private _bounceY = 0;
private _bounceX = 0;
updateFunc(): any {
this._counter++;
this._velocityY += this._gravityY;
this._velocityX += this._gravityX;
this.y += this._velocityY;
this.x += this._velocityX;
if (this._view) this._view.rotation = this._counter * .7 * this._rotationSpeed;
}
private _rotationSpeed = 0;
set rotationSpeed(val: number) {
this._rotationSpeed = val;
}
set gravity(val: number) {
this._gravityX = val;
this._gravityY = val;
}
set gravityY(val: number) {
this._gravityY = val;
}
set velocityY(val: number) {
this._velocityY = val;
}
set velocity(val: number) {
this._velocityY = val;
this._velocityX = val;
}
set velocityX(val: number) {
this._velocityX = val;
}
get velocityX() {
return this._velocityX;
}
get velocityY() {
return this._velocityY;
}
set bounceY(val: number) {
this._bounceY = val;
}
set bounceX(val: number) {
this._bounceX = val;
}
set bounce(val: number) {
this._bounceX = val;
this._bounceY = val;
}
get bounceY() {
return this._bounceY;
}
get bounceX() {
return this._bounceX;
}
set view(val) {
this._view = val;
}
private _collideWorldBounds: boolean;
set collideWorldBounds(val: boolean) { this._collideWorldBounds = val; }
get collideWorldBounds() { return this._collideWorldBounds }
handleCollide(eventName, data?: Body) {
}
}
\ No newline at end of file
import Body from "./Body";
export default class Bullet extends Body {
strength: number
handleCollideWorldTop(): any {
Bullet.recover(this)
}
handleCollide(eventName, data: Body) {
if (eventName == 'collide') {
Bullet.recover(this)
}
}
static _frees: Bullet[] = [];
static createBullet(strength) {
let bullet: Bullet;
if (Bullet._frees.length > 0) {
bullet = Bullet._frees.pop();
} else {
const cls = window['gamePlaySkin']['Bullet1'];
const obj = new cls();
const container = new egret.Sprite();
container.addChild(obj);
bullet = new Bullet();
bullet.addChild(container);
bullet.view = container;
const scale = 1.2;
obj.scaleX = obj.scaleY = scale;
bullet.rect = new egret.Rectangle(0, 0, obj.width * scale, obj.height * scale);
}
bullet.strength = strength;
return bullet;
}
static recover(item: Bullet) { Bullet._frees.push(item) }
private _events: any[];
addPosEvent(name: string, val: number, props, dir) {
this._events = this._events || [];
this._events.push({ key: `${name}-${val}`, props: props, dir: dir });
}
updateFunc() {
super.updateFunc();
if (!this._events) return;
for (let i = 0; i < this._events.length; i++) {
const event = this._events[i];
const key = event.key;
const props = event.props;
const dir = event.dir;
const name = key.split('-')[0];
const val = parseInt(key.split('-')[1]);
const c1 = this[name] > val && dir == 1;
const c2 = this[name] < val && dir == -1;
if (c1 || c2) {
this._events.splice(i, 1);
i--;
if (props.hasOwnProperty('gravityY'))
this.gravityY = props.gravityY;
if (props.hasOwnProperty('collideWorldBounds'))
this.collideWorldBounds = props.collideWorldBounds;
if (props.hasOwnProperty('velocityX'))
this.velocityX = props.velocityX;
if (props.hasOwnProperty('velocityY'))
this.velocityY = props.velocityY;
}
}
}
}
\ No newline at end of file
export default class CarView {
stage: egret.Stage;
car: eui.Group
constructor(stage: egret.Stage, car: eui.Group) {
this.stage = stage;
this.car = car;
}
startDrag() {
this.stage.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.onMove, this)
}
stopDrag() {
this.stage.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.onMove, this)
}
onMove(e: egret.TouchEvent) {
let x0 = e.stageX;
if (x0 < 0)
x0 = 0;
if (x0 > (750 - 93))
x0 = 750 - 93;
console.log(x0);
this.car.x = x0;
}
}
\ No newline at end of file
// import Ball from "./Ball";
// import Body from "./Body";
// import { dropsCls, getProp, getIndex } from "./datas/drops";
// import { getPropItem } from "../utils";
// import { playcollectSound } from "../muisc";
// export default class Drop extends Body {
// _t1 = 0;
// _t2 = 0;
// txt: any;
// killBlink(): any {
// this.alpha = 1;
// annie.Tween.kill(this._tween);
// clearTimeout(this._t1)
// clearTimeout(this._t2)
// }
// type;
// onDisappear: () => void;
// _tween = 0;
// constructor(type, txt) {
// super();
// this.type = type;
// this.txt = txt;
// this.txt.visible = false;
// this._t1 = setTimeout(() => {
// annie.Tween.kill(this._tween);
// this.onDisappear && this.onDisappear();
// }, 5000);
// this._t2 = setTimeout(() => {
// this._tween = annie.Tween.to(this, 2, { useFrame: true, alpha: 0, yoyo: true })
// }, 3000);
// }
// handleCollide(eventName, data: Body) {
// if (eventName == 'collideCar') {
// this.killBlink();
// playcollectSound();
// this.txt.visible = true;
// this.blink();
// }
// }
// blink() {
// const times = 5, time = 1000;
// const color = this.txt.color;
// let counter = 0;
// const func = () => {
// if (counter == times) {
// this.txt.color = color;
// return;
// }
// counter++;
// this.txt.color = counter % 2 == 0 ? color : '#ffffff';
// setTimeout(func, time / times);
// }
// func();
// }
// static createDrop({ typeIndex, x, y, vx }) {
// if (typeIndex == -1) return null;
// const cls = window['gamePlaySkin'][dropsCls[typeIndex]];
// const obj = new cls();
// obj.scaleX = obj.scaleY = 1.5
// const drop = new Drop(typeIndex, obj.txt);
// drop.addChild(obj);
// drop.rect = new annie.Rectangle(0, 0, 26 * 1.5, 26 * 1.5);
// drop.bounce = 0.4;
// drop.collideWorldBounds = true;
// drop.rotationSpeed = 0.5;
// drop.gravityY = .5;
// drop.velocityY = -Math.abs(vx) * 3 * 2;
// drop.velocityX = vx * 3;
// drop.x = x;
// drop.y = y;
// return drop;
// }
// static createDrops(ball: Ball, carbullet) {
// const dropinfo = getProp(carbullet);
// const dropsData = getPropItem(dropsCls, dropinfo.p, dropinfo.n);
// const p = 30;
// let dir = 1;
// if (ball.x > 750 / 2)
// dir = -1;
// const baseVx = dir * 1;
// const drop = Drop.createDrop({ typeIndex: getIndex(dropsData[0]), x: ball.x, y: ball.y, vx: baseVx - dir });
// const drop1 = Drop.createDrop({ typeIndex: getIndex(dropsData[1]), x: ball.x + dir * p, y: ball.y - p, vx: baseVx });
// const drop2 = Drop.createDrop({ typeIndex: getIndex(dropsData[2]), x: ball.x + p * 2 * dir, y: ball.y - p * 2, vx: baseVx + dir });
// if (dropsData.length == 3)
// return [drop, drop1, drop2];
// if (dropsData.length == 2) {
// const drop20 = Drop.createDrop({ typeIndex: getIndex(dropsData[0]), x: ball.x, y: ball.y, vx: baseVx });
// const drop21 = Drop.createDrop({ typeIndex: getIndex(dropsData[1]), x: ball.x + dir * p, y: ball.y - p, vx: baseVx + dir });
// return [drop20, drop21];
// }
// const drop30 = Drop.createDrop({ typeIndex: getIndex(dropsData[0]), x: ball.x, y: ball.y, vx: baseVx + dir });
// return [drop30];
// }
// }
export default class Drop{}
\ No newline at end of file
import { addBall } from "./datas/addBall";
import PlayScene from "./PlayScene";
export default class Guide {
constructor(that: PlayScene) {
if (localStorage.getItem('guide1')) {
that.guide1.parent.removeChild(that.guide1);
that.guide2.parent.removeChild(that.guide2);
that.guide1 = null;
that.guide2 = null;
addBall(that, false, true);
that.resume();
} else {
that.guide1.touchEnabled = false;
that.guide2.touchEnabled = false;
that.guide2.visible = false;
that.guide1.visible = true;
that.pause();
that.addDrag();
const func = () => {
that.guide1.parent.removeChild(that.guide1);
that.guide1 = null;
addBall(that, true, true);
that.resume();
}
that.once(egret.TouchEvent.TOUCH_BEGIN, func, this);
}
this.showGuide2 = (x, y) => {
that.guide2.visible = true;
that.guide2.x = x;
that.guide2.y = y;
// that.guide2.parent.addChild(that.guide2.tips);
// that.guide2.tips.y = y + 230;
// if (x > 750 / 2) {
// that.guide2.tips.x = 750 - 473 - 50;
// } else {
// that.guide2.tips.x = 50;
// }
const func = () => {
localStorage.setItem('guide1', '1');
that.guide2.parent.removeChild(that.guide2);
// that.guide2.tips.parent.removeChild(view.guide2.tips);
that.guide2 = null;
that.resume();
}
that.once(egret.TouchEvent.TOUCH_BEGIN, func, this);
}
}
showGuide2;
}
\ No newline at end of file
This diff is collapsed.
import Body from "./Body";
import PlayScene from "./PlayScene";
export default class World extends egret.Sprite {
view:PlayScene;
constructor(view) {
super();
this.touchEnabled = false;
this.view = view;
this.physicsList = [];
}
timer;
updateFunc() {
if (this.timer === 0) return;
this.physicsList.forEach(body => {
body.updateFunc();
this.collideWorld(body);
});
requestAnimationFrame(this.updateFunc.bind(this));
}
pause() {
this.clearTimer();
}
resume() {
this.timer = 1;
this.updateFunc();
}
clearTimer() {
this.timer = 0;
}
physicsList: Body[];
addPhysics(item: Body) {
this.physicsList.push(item);
this.addChildAt(item, 0);
}
removePhysics(item: Body, removeChild = true) {
const i = this.physicsList.indexOf(item);
if (i != -1) this.physicsList.splice(i, 1);
removeChild && this.removeChild(item);
}
collideCar(body: Body) {
let xDistance0 = body.rect.width / 2 + 25 / 2;//this.view.car.width=55 炮筒
let yDistance0 = body.rect.height / 2 + 72 / 2;
const xDistance = Math.abs(body.x - this.view.car.x);
const yDistance = Math.abs(body.y - (this.view.car.y + 122 / 2));
const collide = xDistance < xDistance0 && yDistance < yDistance0;
if (collide) {
body.handleCollide('collideCar', body);
}
return collide;
}
/**
* @param body1
* @param body2
*/
collide(body1: Body, body2: Body) {
let xDistance0 = body1.rect.width / 2 + body2.rect.width / 2;
let yDistance0 = body1.rect.height / 2 + body2.rect.height / 2;
const xDistance = Math.abs(body1.x - body2.x);
const yDistance = Math.abs(body1.y - body2.y);
const collide = xDistance < xDistance0 && yDistance < yDistance0;
if (collide) {
body1.handleCollide('collide', body2);
body2.handleCollide('collide', body1);
}
return collide;
}
static h = 1206 - 110;
/**
* 刚体和世界的边缘碰撞
* @param body
*/
private collideWorld(body: Body) {
if (!body.collideWorldBounds) return;
if (body.x + body.anX <= 0) { //left 碰撞
body.velocityX = -body.velocityX * body.bounceX;
body.x = -body.anX;
}
if (body.x - body.anX >= 750) {
body.x = 750 + body.anX;
body.velocityX = -body.velocityX * body.bounceX;
}
if (this.collideWorldTop(body)) {
body.y = -body.anY;
body.velocityY = -body.velocityY * body.bounceY;
}
if (this.collideWorldBottom(body)) {
body.y = World.h + body.anY;
body.velocityY = -body.velocityY * body.bounceY;
body.handleCollide('collideWorldBottom');
}
}
collideWorldTop(body: Body) {
return body.y + body.anY <= 0;
}
collideWorldBottom(body: Body) {
return body.y - body.anY >= World.h;
}
}
\ No newline at end of file
export default class CarCtrl {
}
\ No newline at end of file
import PlayScene from "../PlayScene";
// import Ball from "../Ball";
// import { ExGamePlayModule } from "../ExGamePlayModule";
// import { getBallScore, getBallScoreRange } from "./ballScore";
// import { randomColorIndex } from "./colors";
// import sizelist from "./sizelist";
// let timer;
// const interval = 1000 / 60;
// /**
// * 检查是否要加球
// */
// export const resumeCheckAddBall = (that: ExGamePlayModule) => {
// timer = setInterval(() => {
// if (that.balls.length <= 0)
// checkAddBall(that);
// }, interval);
// }
// export const pauseCheckAddBall = () => {
// clearInterval(timer);
// }
// const addBallInterval = 1;
// let lastAddTimer = 0;
// export const checkAddBall = (that: ExGamePlayModule) => {
// if (that.ballIDs.length < getN(that)) {
// const t0 = Date.now();
// if (t0 - lastAddTimer > addBallInterval) {
// addBall(that, false, true);
// lastAddTimer = t0;
// }
// }
// }
// const getN = (that: ExGamePlayModule) => {
// if (that.carBullet <= 20) return 1;
// if (that.carBullet <= 60) return 2;
// if (that.carBullet <= 100) return 3
// if (Math.random() < 0.3) return 4;
// return 3;
// }
// export const addBall = (that: ExGamePlayModule, isfirst = false, isParent = false) => {
// let size = Math.floor(Math.random() * 4);
// if (isfirst) size = 0;
// // size=3;
// let colorIndex = randomColorIndex(size);
// if (isfirst) colorIndex = 0;
// let scorerange = getBallScoreRange(that.carBullet, that.carFire)
// scorerange = scorerange.map(val => Math.ceil(val * (window['ballscore-p'] || 1)));
// const score = getBallScore(scorerange, colorIndex);// [1, 100];
// // console.log(score)
// let dir = Math.random() > 0.5 ? -1 : 1;
// // dir = -1;
// // size = 3;
// if (isfirst) dir = 1;
// const startX = dir == 1 ? -sizelist[size] / 2 : 750 + sizelist[size] / 2;
// let targetX = dir == 1 ? sizelist[size] * 0.5 : 750 - sizelist[size] * 0.5;
// const ball = that.addBall(colorIndex, size, score,
// startX, 1206 * (window['_ballYRatio_'] || 0.25),
// 2 * dir, 0, 0, false, isParent);
// ball.addPosEvent('x', targetX, {
// gravityY: Ball.gravityY, collideWorldBounds: true, velocityX: 2 * dir
// }, dir)
// ball['isfirst'] = isfirst;
// }
export const addBall = (that: PlayScene, isfirst = false, isParent = false) => {
}
\ No newline at end of file
const bulletNumsMax = 20;//一秒20发
export const getBulletData = (X) => {
if (X <= 20) return { nums: getBulletData20(X), line: 1 };
if (X <= 40) return getBulletData40(X);
if (X <= 60) return getBulletData60(X);
if (X <= 80) return getBulletData80(X);
if (X <= 100) return getBulletData100(X);
if (X <= 120) return getBulletData120(X);
if (X <= 140) return getBulletData140(X);
return getBulletData140(X);
}
const getBulletData20 = (X) => { //X 0 - 20
const bulletNumsMin = 10;
let result = (bulletNumsMax - bulletNumsMin) + (bulletNumsMax - bulletNumsMin) * X / bulletNumsMax;
return Math.floor(result)
}
const getBulletData40 = (X) => { //X 20-40
if (X <= 30) {
return [{ nums: bulletNumsMax, line: 1 }, { nums: bulletNumsMax, line: 2 }]
}
return { nums: bulletNumsMax, line: 2 };
}
const getBulletData60 = (X) => { //X 40-60
if (X <= 50) {
return [{ nums: bulletNumsMax, line: 2 }, { nums: bulletNumsMax, line: 3 }]
}
return { nums: bulletNumsMax, line: 3 };
}
const getBulletData80 = (X) => { //X 60-80
if (X <= 70) {
return [{ nums: bulletNumsMax, line: 3 }, { nums: bulletNumsMax, line: 4 }]
}
return { nums: bulletNumsMax, line: 4 };
}
const getBulletData100 = (X) => { //X 80-100
if (X <= 90) {
return [{ nums: bulletNumsMax, line: 4 }, { nums: bulletNumsMax, line: 5 }]
}
return { nums: bulletNumsMax, line: 5 };
}
const getBulletData120 = (X) => {
if (X <= 110) {
return [{ nums: bulletNumsMax, line: 5 }, { nums: bulletNumsMax, line: 6 }]
}
return { nums: bulletNumsMax, line: 6 };
}
const getBulletData140 = (X) => {
if (X <= 130) {
return [{ nums: bulletNumsMax, line: 6 }, { nums: bulletNumsMax, line: 7 }]
}
return { nums: bulletNumsMax, line: 7 };
}
\ No newline at end of file
...@@ -5,16 +5,29 @@ export default class RulePanel extends Panel { ...@@ -5,16 +5,29 @@ export default class RulePanel extends Panel {
public labContent: eui.Label; public labContent: eui.Label;
public scroller: eui.Scroller; public scroller: eui.Scroller;
start() { start() {
this.labContent.text = '';
if (!DataManager.ins.getRuleData) if (!DataManager.ins.getRuleData)
NetManager.ins.getRule(() => { NetManager.ins.getRule(() => {
this.addRule(); this.addRule();
}); });
else else {
this.addRule(); this.addRule();
}
}
removeEvents() {
} }
group:eui.Group; static scrollerCache: eui.Scroller;
static scroller: eui.Scroller;
group: eui.Group;
private addRule() { private addRule() {
if(RulePanel.scrollerCache)
{
this.addChild(RulePanel.scrollerCache)
return;
}
let text: string = DataManager.ins.getRuleData.ruleText; let text: string = DataManager.ins.getRuleData.ruleText;
text = text.replace('/<div>/g', ''); text = text.replace('/<div>/g', '');
...@@ -23,18 +36,17 @@ export default class RulePanel extends Panel { ...@@ -23,18 +36,17 @@ export default class RulePanel extends Panel {
const textlist = text.split('<br>'); const textlist = text.split('<br>');
console.log(text);
this.labContent.text='';
for (let i = 0; i < textlist.length; i++) { for (let i = 0; i < textlist.length; i++) {
const l = new eui.Label(); const l = new eui.Label();
l.textColor=this.labContent.textColor; l.textColor = this.labContent.textColor;
l.size=this.labContent.size; l.size = this.labContent.size;
l.width=this.labContent.width; l.width = this.labContent.width;
l.minHeight=20; l.minHeight = 20;
l.textFlow = (new egret.HtmlTextParser).parser(textlist[i]+''); l.textFlow = (new egret.HtmlTextParser).parser(textlist[i] + '');
this.group.addChild(l) this.group.addChild(l)
} }
RulePanel.scrollerCache = this.scroller
} }
protected get skinKey() { return 'Rule' } protected get skinKey() { return 'Rule' }
......
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