Commit 0b3b634a authored by limingzhe's avatar limingzhe

增加标题 序号

parent 9a5a2c48
......@@ -2217,7 +2217,7 @@ export class ScrollView extends MySprite {
const box = children[i].getBoundingBox();
// console.log('box: ', box);
const boxEdgeX = box.x + box.width;
const boxEdgeY = box.y + box.height;
const boxEdgeY = this.y + box.y + box.height;
// console.log('boxEdgeY: ', boxEdgeY);
if (boxEdgeX > maxW) {
......@@ -2259,7 +2259,7 @@ export class ScrollView extends MySprite {
} else {
this._scrollBar.visible = true;
}
const h = rate * this.height
const h = rate * (this.height - this.y)
const r = w / 2;
this._scrollBar.setSize(w, h, r);
......
......@@ -6,7 +6,7 @@ import {
moveItem,
rotateItem,
removeItemFromArr,
ShapeRect, scaleItem, tweenChange, showPopParticle, hideItem, showItem, LineRect, shake, RichText, ShapeRectNew, showShapeParticle, delayCall, randomSortByArr, ScrollView, InputView,
ShapeRect, scaleItem, tweenChange, showPopParticle, hideItem, showItem, LineRect, shake, RichText, ShapeRectNew, showShapeParticle, delayCall, randomSortByArr, ScrollView, InputView, ShapeCircle,
} from './Unit';
import { res, resAudio } from './resources';
......@@ -608,8 +608,9 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.initMaskPic();
this.relink();
// this.isTeacher = false;
// this.gameStart();
// this.relink();
// // this.gameStart();
// // this.testInput()
......@@ -1434,13 +1435,30 @@ export class PlayComponent implements OnInit, OnDestroy {
bgW.fillColor = '#ffffff';
this.renderArr.push(bgW);
const title = new Label();
title.fontSize = 76 * this.mapScale;
title.fontName = 'Aileron-Bold';
title.textAlign = 'left';
// title.setMaxSize(this.canvasWidth * 0.9);
title.x = 50 * this.mapScale;
title.y = 100 * this.mapScale;
title.fontColor = '#3e9b31';
title.text = this.data.contentObj.title || "";
title.refreshSize();
this.renderArr.push(title);
console.log('this.data: ', this.data);
const sv = new ScrollView();
sv.setShowSize(this.canvasWidth, this.canvasHeight);
// sv.x = -this.canvasWidth / 2;
// sv.y = 0;
sv.setBgColor('#faf7ee')
sv.y = 150 * this.mapScale;
sv.setBgColor('#ffffff')
sv.setScrollBarSize(20 * this.mapScale, 5)
......@@ -1482,47 +1500,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// bg.scaleY = this.canvasHeight / bg.height;
return;
const bgItem = new MySprite();
bgItem.init(this.images.get("bg_item"));
bgItem.x = this.canvasWidth / 2;
bgItem.y = this.canvasHeight / 2;
bgItem.setScaleXY(this.mapScale);
this.renderArr.push(bgItem);
const panel = new MySprite();
panel.init(this.images.get("panel"));
panel.x = this.canvasWidth / 2;
panel.y = this.canvasHeight / 2;
panel.setScaleXY(this.mapScale);
this.renderArr.push(panel);
// const panelItem = new MySprite();
// panelItem.init(this.images.get("panel_item"));
// panelItem.anchorY = 1;
// // panelItem.x = this.canvasWidth / 2;
// panelItem.y = 550;
// panel.addChild(panelItem);
const title = new Label();
title.fontSize = 72;
title.fontName = 'Aileron-Bold';
title.textAlign = 'center';
// title.setMaxSize(this.canvasWidth * 0.9);
// title.x = this.canvasWidth / 2;
title.y = -panel.height / 2 + 130;
title.fontColor = '#3c9e32';
title.text = this.data.contentObj.title || "";
panel.addChild(title);
title.refreshSize();
this.panel = panel;
}
......@@ -1562,6 +1543,8 @@ export class PlayComponent implements OnInit, OnDestroy {
if (this.isTeacher) {
if (this.sendBtn && this.sendBtn.visible) {
if (this.checkClickTargetSv(this.sendBtn)) {
this.sendServerEvent('game_start', {});
......@@ -1571,6 +1554,10 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
if (this.checkClickTarget(this.scrollView)) {
this.scrollView.onTouchStart(this.mx, this.my);
}
return;
}
......@@ -2577,7 +2564,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const hotZone = this.getHotZoneItem(data);
const hotZone = this.getHotZoneItem(data, i);
// hotZone.alpha = 0.5;
......@@ -2592,13 +2579,13 @@ export class PlayComponent implements OnInit, OnDestroy {
openBtn;
getHotZoneItem(data) {
getHotZoneItem(data, index) {
// console.log(' item data: ', data);
switch(data.gIdx) {
case "0":
return this.setOneRect(data);
return this.setOneRect(data, index);
case "1":
return //this.setOneBtn(data);
......@@ -2696,7 +2683,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
setOneRect(data) {
setOneRect(data, index) {
const saveRect = data.rect;
const item = new ShapeRect(this.ctx);
......@@ -2718,6 +2705,22 @@ export class PlayComponent implements OnInit, OnDestroy {
this.scrollView.addItem(item);
const circle = new ShapeCircle();
circle.setRadius(20 * this.bg.scaleX);
circle.x = item.x + item.width;
circle.y = item.y;
circle.fillColor = '#dcc077'
this.scrollView.addItem(circle);
const label = new Label();
label.text = index + 1;
label.fontColor = '#ffffff';
label.textAlign = 'center';
label.fontSize = 28
label.fontName = 'Aileron-Bold';
label.y = 2;
circle.addChild(label);
// this.renderArr.push(item);
return item;
......
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