Commit fd82aa6b authored by haiyoucuv's avatar haiyoucuv

panels

parent 74afba80
This diff is collapsed.
......@@ -6,6 +6,10 @@ import Tween = FYGE.Tween;
import ScrollList = FYGE.ScrollList;
import Container = FYGE.Container;
import IScrollListItem = FYGE.IScrollListItem;
import Texture = FYGE.Texture;
import Graphics = FYGE.Graphics;
import TextField = FYGE.TextField;
import { Ease } from "fyge";
export default class ExRecordPanel extends Panel {
get groupNames() {
......@@ -29,7 +33,32 @@ export default class ExRecordPanel extends Panel {
this.scroll.position.set((this.width - this.scroll.width) / 2, 210);
this.scroll.updateData([
1, 2, 3, 4, 5, 6
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰10元抵扣卷',
prizeDate: '1010.01.01',
},
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰20元抵扣卷',
prizeDate: '2020.02.02',
},
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰30元抵扣卷',
prizeDate: '3030.03.03',
},
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰40元抵扣卷',
prizeDate: '4040.04.04',
},
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰50元抵扣卷',
prizeDate: '5050.05.05',
},
]);
......@@ -39,9 +68,9 @@ export default class ExRecordPanel extends Panel {
if (this.isShowing) return;
this.isShowing = true;
this.y = this.height;
const _y = layers.height - this.height + 30;
const _y = 1624 - this.height - layers.stageOffsetY + 50 + 50;
Tween.get(this)
.to({y: _y}, 500, FYGE.Ease.quartOut)
.to({y: _y}, 500, Ease.quartOut)
.call(() => {
this.isShowing = false;
});
......@@ -65,8 +94,15 @@ class RecordItem extends Container implements IScrollListItem {
public data: number;
public id: number;
private prizeImg: Sprite;
private prizeName: TextField;
private prizeDate: TextField;
public initData(id: number, data: any): void {
if (!data) return;
this.prizeImg.texture = Texture.fromUrl(data.prizeImg);
this.prizeName.text = data.prizeName;
this.prizeDate.text = `${data.prizeDate}兑换`;
}
constructor() {
......@@ -74,6 +110,20 @@ class RecordItem extends Container implements IScrollListItem {
this.addChild(Tool.getSprite('record_item_bg.png'));
this.prizeImg = this.addChild(new Sprite());
this.prizeImg.position.set(34, 25);
const mask = this.addChild(new Graphics());
mask.drawCircle(92, 83, 58);
this.prizeImg.mask = mask;
this.prizeName = this.addChild(Tool.getText('', 26, '#4a4a4a'));
this.prizeName.position.set(176, 50);
this.prizeDate = this.addChild(Tool.getText('', 22, '#999999'));
this.prizeDate.position.set(176, 91);
}
}
......@@ -2,7 +2,7 @@ import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
export class ExahangePanel extends Panel {
export class ExchangePanel extends Panel {
get groupNames() {
return ["exchangePanel"];
}
......
......@@ -9,6 +9,7 @@ import ScrollList = FYGE.ScrollList;
import Texture = FYGE.Texture;
import Graphics = FYGE.Graphics;
import TextField = FYGE.TextField;
import { Ease } from "fyge";
export default class ShopPanel extends Panel {
get groupNames() {
......@@ -40,9 +41,9 @@ export default class ShopPanel extends Panel {
if (this.isShowing) return;
this.isShowing = true;
this.y = this.height;
const _y = layers.height - this.height + 30;
const _y = 1624 - this.height - layers.stageOffsetY + 50 + 50;
Tween.get(this)
.to({y: _y}, 500, FYGE.Ease.quartOut)
.to({y: _y}, 500, Ease.quartOut)
.call(() => {
this.isShowing = false;
});
......@@ -82,7 +83,7 @@ class ShopItem extends Container implements IScrollListItem {
this.itemImg = this.addChild(new Sprite());
this.itemImg.position.set(35, 26);
this.itemImg.texture = Texture.fromUrl('https://source.unsplash.com/collection/collectionid/116x116');
this.itemImg.texture = Texture.fromUrl('https://source.unsplash.com/user/erondu/116x116');
const mask = this.addChild(new Graphics());
mask.drawCircle(92, 83, 58);
......
......@@ -9,6 +9,7 @@ import Tween = FYGE.Tween;
import TextField = FYGE.TextField;
import { RES } from "../../module/RES";
import MouseEvent = FYGE.MouseEvent;
import { Ease } from "fyge";
export default class TaskPanel extends Panel {
get groupNames() {
......@@ -81,9 +82,9 @@ export default class TaskPanel extends Panel {
if (this.isShowing) return;
this.isShowing = true;
this.y = this.height;
const _y = layers.height - this.height + 30;
const _y = 1624 - this.height - layers.stageOffsetY + 50 + 50;
Tween.get(this)
.to({y: _y}, 500, FYGE.Ease.quartOut)
.to({y: _y}, 500, Ease.quartOut)
.call(() => {
this.isShowing = false;
});
......
......@@ -27,7 +27,7 @@ export default class WareHousePanel extends Panel {
if (this.isShowing) return;
this.isShowing = true;
this.y = this.height;
const _y = layers.height - this.height + 30;
const _y = 1624 - this.height - layers.stageOffsetY + 50 + 50;
Tween.get(this)
.to({y: _y}, 500, Ease.quartOut)
.call(() => {
......
......@@ -148,15 +148,17 @@ export class Land extends Container {
/**
* 浇水
*/
public water() {
public water(e) {
console.log("浇水");
e.stopPropagation();
}
/**
* 收获
*/
public get() {
public get(e:MouseEvent) {
console.log("收获");
e.stopPropagation();
}
/**
......@@ -187,7 +189,7 @@ export class Land extends Container {
}
}
private clickThis() {
private clickThis(e) {
console.log(`点到了土地: ${this.id}, state: ${this.state}`);
if (this.state == LAND_STATE.PLANT) {
this.progressBar.show();
......@@ -202,12 +204,12 @@ export class Land extends Container {
*/
private addEvent() {
// 加个监听
this.addEventListener(MouseEvent.CLICK, this.clickThis, this);
this.addEventListener(MouseEvent.CLICK, this.clickThis, this, false);
this.progressBar.addEventListener('endTime', this.endTime, this);
}
private removeEvent() {
this.removeEventListener(MouseEvent.CLICK, this.clickThis, this);
this.removeEventListener(MouseEvent.CLICK, this.clickThis, this, false);
this.progressBar.removeEventListener('endTime', this.endTime, this);
}
......@@ -244,9 +246,9 @@ export class Land extends Container {
this.removeOption();
this.option = this.addChild(OptionPool.ins.takeOut(type));
if (type == OPTION_TYPE.WATER) {
this.option.addEventListener(MouseEvent.CLICK, this.water, this);
this.option.addEventListener(MouseEvent.CLICK, this.water, this, false);
} else if (type == OPTION_TYPE.GET) {
this.option.addEventListener(MouseEvent.CLICK, this.get, this);
this.option.addEventListener(MouseEvent.CLICK, this.get, this, false);
}
this.option.x = 160;
this.option.y = -50;
......
......@@ -94,7 +94,7 @@ export class UILayer extends Container {
// 顶部
let topGroup = this.addChild(new Container());
this.userInfoGroup = topGroup.addChild(new UserInfoGroup({
avatar: 'https://source.unsplash.com/collection/collectionid/100x100',
avatar: 'https://source.unsplash.com/user/erondu/100x100',
nickName: '哈哈哈哈',
waterNum: '666'
}));
......
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