Commit dc4363db authored by haiyoucuv's avatar haiyoucuv

111

parent fa582933
...@@ -2,20 +2,19 @@ ...@@ -2,20 +2,19 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="9cef0552-af3c-4a1c-be1f-dc41ebe5b6db" name="Default Changelist" comment=""> <list default="true" id="9cef0552-af3c-4a1c-be1f-dc41ebe5b6db" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/resource/map/map_prizeBox.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/resource/map/map_creditsBg.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_taskBtn.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/resource/map/map_energyAdd.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_推车.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/resource/map/map_energyBg.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_狐狸气球.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/src/scene/map/CheckBtn.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/scene/map/MapBottom.ts" afterDir="false" /> <change afterPath="$PROJECT_DIR$/src/scene/map/MapPart.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/scene/map/MapMid.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/scene/map/MapTop.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/scene/map/MapUI.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resource/map/map_bg2.jpg" beforeDir="false" afterPath="$PROJECT_DIR$/resource/map/map_bg2.jpg" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resource/res.json" beforeDir="false" afterPath="$PROJECT_DIR$/resource/res.json" afterDir="false" /> <change beforePath="$PROJECT_DIR$/resource/res.json" beforeDir="false" afterPath="$PROJECT_DIR$/resource/res.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Main.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/Main.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ResJson.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/ResJson.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/ResJson.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/ResJson.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scene/MapScene.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapScene.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/scene/map/MapBottom.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapBottom.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scene/map/MapMid.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapMid.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scene/map/MapScene.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapScene.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scene/map/MapTop.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapTop.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/scene/map/MapUI.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapUI.ts" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -87,8 +86,8 @@ ...@@ -87,8 +86,8 @@
</configuration> </configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="npm.flushRes" />
<item itemvalue="npm.dev" /> <item itemvalue="npm.dev" />
<item itemvalue="npm.flushRes" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
...@@ -103,13 +102,25 @@ ...@@ -103,13 +102,25 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1594106513515</updated> <updated>1594106513515</updated>
<workItem from="1594106517562" duration="5224000" /> <workItem from="1594106517562" duration="5224000" />
<workItem from="1594111755267" duration="4329000" /> <workItem from="1594111755267" duration="29535000" />
</task>
<task id="LOCAL-00001" summary="111">
<created>1594122339119</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1594122339119</updated>
</task> </task>
<option name="localTasksCounter" value="2" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="2" /> <option name="version" value="2" />
</component> </component>
<component name="VcsManagerConfiguration">
<MESSAGE value="111" />
<option name="LAST_COMMIT_MESSAGE" value="111" />
</component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state x="440" y="273" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1594106579644"> <state x="440" y="273" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1594106579644">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
...@@ -119,37 +130,49 @@ ...@@ -119,37 +130,49 @@
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state x="251" y="471" key="ANALYSIS_DLG_com.intellij.analysis.BaseAnalysisAction$1/31.23.1889.1177@31.23.1889.1177" timestamp="1594113080922" /> <state x="251" y="471" key="ANALYSIS_DLG_com.intellij.analysis.BaseAnalysisAction$1/31.23.1889.1177@31.23.1889.1177" timestamp="1594113080922" />
<state x="58" y="183" key="CommitChangelistDialog2" timestamp="1594111761557"> <state x="58" y="183" key="CommitChangelistDialog2" timestamp="1594122338916">
<screen x="31" y="23" width="1889" height="1177" />
</state>
<state x="58" y="183" key="CommitChangelistDialog2/31.23.1889.1177@31.23.1889.1177" timestamp="1594122338916" />
<state width="879" height="329" key="GridCell.Tab.0.bottom" timestamp="1594200117132">
<screen x="31" y="23" width="1889" height="1177" />
</state>
<state width="879" height="329" key="GridCell.Tab.0.bottom/31.23.1889.1177@31.23.1889.1177" timestamp="1594200117132" />
<state width="879" height="329" key="GridCell.Tab.0.center" timestamp="1594200117131">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state x="58" y="183" key="CommitChangelistDialog2/31.23.1889.1177@31.23.1889.1177" timestamp="1594111761557" /> <state width="879" height="329" key="GridCell.Tab.0.center/31.23.1889.1177@31.23.1889.1177" timestamp="1594200117131" />
<state width="896" height="329" key="GridCell.Tab.0.bottom" timestamp="1594114672377"> <state width="879" height="329" key="GridCell.Tab.0.left" timestamp="1594200117130">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state width="896" height="329" key="GridCell.Tab.0.bottom/31.23.1889.1177@31.23.1889.1177" timestamp="1594114672377" /> <state width="879" height="329" key="GridCell.Tab.0.left/31.23.1889.1177@31.23.1889.1177" timestamp="1594200117130" />
<state width="896" height="329" key="GridCell.Tab.0.center" timestamp="1594114672377"> <state width="879" height="329" key="GridCell.Tab.0.right" timestamp="1594200117131">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state width="896" height="329" key="GridCell.Tab.0.center/31.23.1889.1177@31.23.1889.1177" timestamp="1594114672377" /> <state width="879" height="329" key="GridCell.Tab.0.right/31.23.1889.1177@31.23.1889.1177" timestamp="1594200117131" />
<state width="896" height="329" key="GridCell.Tab.0.left" timestamp="1594114672376"> <state x="210" y="320" key="RollbackChangesDialog" timestamp="1594173186663">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state width="896" height="329" key="GridCell.Tab.0.left/31.23.1889.1177@31.23.1889.1177" timestamp="1594114672376" /> <state x="210" y="320" key="RollbackChangesDialog/31.23.1889.1177@31.23.1889.1177" timestamp="1594173186663" />
<state width="896" height="329" key="GridCell.Tab.0.right" timestamp="1594114672377"> <state x="31" y="250" key="SettingsEditor" timestamp="1594195630991">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state width="896" height="329" key="GridCell.Tab.0.right/31.23.1889.1177@31.23.1889.1177" timestamp="1594114672377" /> <state x="31" y="250" key="SettingsEditor/31.23.1889.1177@31.23.1889.1177" timestamp="1594195630991" />
<state x="210" y="320" key="RollbackChangesDialog" timestamp="1594111737150"> <state x="92" y="351" key="Vcs.Push.Dialog.v2" timestamp="1594122340319">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state x="210" y="320" key="RollbackChangesDialog/31.23.1889.1177@31.23.1889.1177" timestamp="1594111737150" /> <state x="92" y="351" key="Vcs.Push.Dialog.v2/31.23.1889.1177@31.23.1889.1177" timestamp="1594122340319" />
<state x="87" y="216" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1594111906161"> <state x="87" y="216" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1594111906161">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state x="87" y="216" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/31.23.1889.1177@31.23.1889.1177" timestamp="1594111906161" /> <state x="87" y="216" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/31.23.1889.1177@31.23.1889.1177" timestamp="1594111906161" />
<state x="640" y="288" width="670" height="676" key="search.everywhere.popup" timestamp="1594107828315"> <state x="157" y="286" key="run.anything.popup" timestamp="1594188122355">
<screen x="31" y="23" width="1889" height="1177" />
</state>
<state x="157" y="286" key="run.anything.popup/31.23.1889.1177@31.23.1889.1177" timestamp="1594188122355" />
<state x="640" y="288" width="670" height="676" key="search.everywhere.popup" timestamp="1594194483179">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state x="640" y="288" width="670" height="676" key="search.everywhere.popup/31.23.1889.1177@31.23.1889.1177" timestamp="1594107828315" /> <state x="640" y="288" width="670" height="676" key="search.everywhere.popup/31.23.1889.1177@31.23.1889.1177" timestamp="1594194483179" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
"name": "common" "name": "common"
}, },
{ {
"keys": "map_avatar_bg.png,map_bg1.jpg,map_bg2.jpg,map_bg3.jpg,map_check_disable.png,map_check_disable_prize.png,map_check_enable.png,map_check_enable_cur.png,map_prizeBox.png,map_prizeBtn.png,map_ruleBtn.png,map_star_disable.png,map_star_enable.png,map_taskBtn.png,map_推车.png,map_狐狸气球.png", "keys": "map_avatar_bg.png,map_bg1.jpg,map_bg2.jpg,map_bg3.jpg,map_check_disable.png,map_check_disable_prize.png,map_check_enable.png,map_check_enable_cur.png,map_creditsBg.png,map_energyAdd.png,map_energyBg.png,map_prizeBox.png,map_prizeBtn.png,map_ruleBtn.png,map_star_disable.png,map_star_enable.png,map_taskBtn.png,map_推车.png,map_狐狸气球.png",
"name": "map" "name": "map"
} }
], ],
......
...@@ -65,7 +65,7 @@ export const ResJson = { ...@@ -65,7 +65,7 @@ export const ResJson = {
"name": "common" "name": "common"
}, },
{ {
"keys": "map_avatar_bg.png,map_bg1.jpg,map_bg2.jpg,map_bg3.jpg,map_check_disable.png,map_check_disable_prize.png,map_check_enable.png,map_check_enable_cur.png,map_prizeBox.png,map_prizeBtn.png,map_ruleBtn.png,map_star_disable.png,map_star_enable.png,map_taskBtn.png,map_推车.png,map_狐狸气球.png", "keys": "map_avatar_bg.png,map_bg1.jpg,map_bg2.jpg,map_bg3.jpg,map_check_disable.png,map_check_disable_prize.png,map_check_enable.png,map_check_enable_cur.png,map_creditsBg.png,map_energyAdd.png,map_energyBg.png,map_prizeBox.png,map_prizeBtn.png,map_ruleBtn.png,map_star_disable.png,map_star_enable.png,map_taskBtn.png,map_推车.png,map_狐狸气球.png",
"name": "map" "name": "map"
} }
], ],
......
import Button = FYGE.Button;
import { RES } from "../../../module/RES";
import Container = FYGE.Container;
import Sprite = FYGE.Sprite;
import Texture = FYGE.Texture;
import TextField = FYGE.TextField;
import { Tool } from "../../Tools";
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import MouseEvent = FYGE.MouseEvent;
export default class CheckBtn extends Container {
private btn: Button = null;
private checkLabel: TextField = null;
private star: CheckStar[] = null;
private checkNum: number = null;
private _starCount = 0;
public set starCount(count: number) {
if (this._starCount == count) return;
this._starCount = count;
this.star.forEach((value, index) => {
value.enabled = (index < count);
});
}
constructor(data) {
super();
this.initUi(data);
}
private initUi(data) {
this.btn = this.addChild(new Button(
RES.getRes('map_check_enable.png'),
RES.getRes('map_check_enable.png'),
RES.getRes('map_check_disable.png')
));
const star1 = this.addChild(new CheckStar());
star1.position.set(16.5, 83);
const star2 = this.addChild(new CheckStar());
star2.position.set(42.5, 90);
const star3 = this.addChild(new CheckStar());
star3.position.set(67.5, 83);
this.star = [star1, star2, star3];
this.checkNum = data.check;
this.checkLabel = this.btn.addChild(Tool.getText(
data.check, 30, '#ffffff',
TEXT_ALIGN.CENTER, 90, 8, 33
));
this.checkLabel.stroke = 2;
this.checkLabel.strokeColor = '#316ec6';
this.addEventListener(MouseEvent.CLICK, () => {
console.log(`关卡:${this.checkNum}`);
}, this);
}
}
class CheckStar extends Sprite {
private static starEnableTexture: Texture = null;
private static starDisableTexture: Texture = null;
private _enabled: boolean = false;
public set enabled(enabled: boolean) {
this._enabled = enabled;
this.texture = enabled ? CheckStar.starEnableTexture : CheckStar.starDisableTexture;
}
constructor() {
super(RES.getRes('map_star_disable.png'));
CheckStar.starDisableTexture = RES.getRes('map_star_disable.png');
CheckStar.starEnableTexture = RES.getRes('map_star_enable.png');
}
}
import { Module } from "../../../module/views/Module"; import MapPart from "./MapPart";
import { Tool } from "../../Tools"; import { RES } from "../../../module/RES";
import Sprite = FYGE.Sprite;
export class MapBottom extends Module { export default class MapBottom extends MapPart {
private bg: Sprite = null; public static HEIGHT = 1093;
public get width() { protected totalCount = 8;
return 750;
} protected btnPos = [
[370, 930],
[437, 761],
[313, 669],
[408, 522],
[455, 375],
[364, 216],
[326, 62],
[491, 3],
];
public get height() { constructor(data) {
return 1093; super();
this.data = data;
} }
protected initUi() { protected initUi() {
super.initUi(); super.initUi();
this.bg = this.addChild(Tool.getSprite('map_bg1.jpg')); this.bg.texture = RES.getRes('map_bg1.jpg');
} }
public start(data?: any) { public start(data?: any) {
......
import { Module } from "../../../module/views/Module"; import MapPart from "./MapPart";
import { Tool } from "../../Tools"; import { RES } from "../../../module/RES";
import Sprite = FYGE.Sprite; import Container = FYGE.Container;
export class MapMid extends Module { export default class MapMid extends MapPart {
private bg: Sprite = null; public static HEIGHT = 1635;
public get width() { protected totalCount = 10;
return 750;
} protected btnPos = [
[267, 1519],
[211, 1325],
[338, 1154],
[237, 911],
[145, 755],
[225, 591],
[349, 480],
[214, 342],
[193, 188],
[392, 8],
];
constructor(data) {
super();
public get height() { this.data = data;
return 1635;
} }
protected initUi() { protected initUi() {
super.initUi(); super.initUi();
this.bg = this.addChild(Tool.getSprite('map_bg2.jpg')); this.bg.texture = RES.getRes('map_bg2.jpg');
} }
......
import { Module } from "../../../module/views/Module";
import Sprite = FYGE.Sprite;
import CheckBtn from "./CheckBtn";
import { MapScene } from "./MapScene";
import MapBottom from "./MapBottom";
import { Scene } from "../../../module/views/Scene";
export default class MapPart extends Module {
protected totalCount: number = 0;
protected btnPos: number[][] = [];
protected bg: Sprite = null;
constructor() {
super();
}
protected initUi() {
super.initUi();
this.bg = this.addChild(new Sprite());
this.initIcon();
}
protected initIcon() {
this.data.forEach((value, index) => {
const nBtn = this.addChild(new CheckBtn(value));
nBtn.position.set(this.btnPos[index][0], this.btnPos[index][1]);
MapScene.checkArr[value.check] = nBtn;
});
}
}
import { Scene } from "../../../module/views/Scene"; import { Scene } from "../../../module/views/Scene";
import ScrollPage = FYGE.ScrollPage; import ScrollPage = FYGE.ScrollPage;
import Container = FYGE.Container; import Container = FYGE.Container;
import { Tool } from "../../Tools"; import MapBottom from "./MapBottom";
import { MapTop } from "./MapTop"; import MapTop from "./MapTop";
import { MapMid } from "./MapMid"; import MapUI from "./MapUI";
import { MapBottom } from "./MapBottom"; import MapMid from "./MapMid";
import { MapUI } from "./MapUI"; import CheckBtn from "./CheckBtn";
export class MapScene extends Scene { export class MapScene extends Scene {
private mapContainer: Container = null; private mapContainer: Container = null;
private scrollPage: ScrollPage = null; private scrollPage: ScrollPage = null;
public static checkArr: CheckBtn[] = []; // 关卡按钮容器
private uiLayer: Container = null; private uiLayer: Container = null;
public get groupNames(): string[] { public get groupNames(): string[] {
...@@ -23,23 +25,44 @@ export class MapScene extends Scene { ...@@ -23,23 +25,44 @@ export class MapScene extends Scene {
this.scrollPage = this.addChild(new ScrollPage(750, 1624, 888, true, true)); this.scrollPage = this.addChild(new ScrollPage(750, 1624, 888, true, true));
this.mapContainer = this.scrollPage.view.addChild(new Container()); this.mapContainer = this.scrollPage.view.addChild(new Container());
let mapHeight = 0; this.uiLayer = this.addChild(new MapUI());
let bg3 = this.mapContainer.addChild(new MapTop());
bg3.y = 0;
mapHeight += bg3.height;
let bg2 = this.mapContainer.addChild(new MapMid()); this.initMap();
bg2.y = bg3.height; }
mapHeight += bg2.height;
let bg1 = this.mapContainer.addChild(new MapBottom()); public initMap() {
bg1.y = bg2.height + bg3.height; const arr = new Array(120);
mapHeight += bg1.height;
this.scrollPage.maxDistance = mapHeight; for (let i = 0; i < 120; i++) {
this.scrollPage.scrollTo(mapHeight, 0); arr[i] = {
starCount: 2,
check: i + 1
};
}
const topData = arr.splice(118, 2); // 得到顶部的数据
const bottomData = arr.splice(0, 8); // 得到尾部的数据
const midData = arr; // 剩下的是中间的数据
let maxHeight = MapTop.HEIGHT;
for (let i = midData.length / 10 - 1; i >= 0; i--) {
const data = midData.splice(i * 10, 10);
const nMid = new MapMid(data);
this.mapContainer.addChild(nMid);
nMid.y = maxHeight;
maxHeight += MapMid.HEIGHT;
}
const bottom = new MapBottom(bottomData);
this.mapContainer.addChild(bottom);
bottom.y = maxHeight;
maxHeight += MapBottom.HEIGHT;
this.mapContainer.addChild(new MapTop(topData)); // 最后加,因为有个层级问题
this.scrollPage.maxDistance = maxHeight;
this.scrollPage.scrollTo(maxHeight, 0);
this.uiLayer = this.addChild(new MapUI());
} }
public start(data?: any) { public start(data?: any) {
......
import { Tool } from "../../Tools"; import MapPart from "./MapPart";
import { Module } from "../../../module/views/Module"; import { RES } from "../../../module/RES";
import Sprite = FYGE.Sprite;
export class MapTop extends Module { export default class MapTop extends MapPart {
private bg: Sprite = null; public static HEIGHT = 521;
public get width() { protected totalCount = 2;
return 750;
} public btnPos = [
[207, 418],
[149, 282],
];
constructor(data) {
super();
public get height() { this.data = data;
return 521;
} }
protected initUi() { protected initUi() {
super.initUi(); super.initUi();
this.bg = this.addChild(Tool.getSprite('map_bg3.jpg')); this.bg.texture = RES.getRes('map_bg3.jpg');
} }
......
import Container = FYGE.Container; import Container = FYGE.Container;
import Button = FYGE.Button; import Button = FYGE.Button;
import TextField = FYGE.TextField; import TextField = FYGE.TextField;
import Sprite = FYGE.Sprite;
import TEXT_ALIGN = FYGE.TEXT_ALIGN; import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import { RES } from "../../../module/RES"; import { RES } from "../../../module/RES";
import { Tool } from "../../Tools"; import { Tool } from "../../Tools";
export class MapUI extends Container { export default class MapUI extends Container {
private myPrizeBtn: Button = null; private myPrizeBtn: Button = null;
private ruleBtn: Button = null; private ruleBtn: Button = null;
private taskBtn: Button = null; private taskBtn: Button = null;
private prizeBox: Container = null; private energyBox: EnergyBox = null;
private creditsBox: CreditsBox = null;
private prizeBox: PrizeBox = null;
constructor() { constructor() {
super(); super();
...@@ -32,22 +35,98 @@ export class MapUI extends Container { ...@@ -32,22 +35,98 @@ export class MapUI extends Container {
this.taskBtn = this.addChild(new Button(RES.getRes('map_taskBtn.png'))); this.taskBtn = this.addChild(new Button(RES.getRes('map_taskBtn.png')));
this.taskBtn.position.set(19, 280); this.taskBtn.position.set(19, 280);
this.prizeBox = this.addChild(new PrizeBox()); this.energyBox = this.addChild(new EnergyBox({}));
this.creditsBox = this.addChild(new CreditsBox({}));
this.prizeBox = this.addChild(new PrizeBox({}));
} }
} }
class PrizeBox extends Container { /**
* 能量
*/
class EnergyBox extends Container {
private addBtn: Button = null;
private countLabel: TextField = null;
private _count = 0;
public set count(count: number) {
this._count = count;
this.countLabel.text = '' + count;
}
constructor(data) {
super();
this.initUi(data);
}
private initUi(data) {
this.position.set(544, 105);
this.addChild(Tool.getSprite('map_energyBg.png'));
this.addBtn = this.addChild(new Button(RES.getRes('map_energyAdd.png')));
this.addBtn.position.set(135, 14);
this.countLabel = this.addChild(Tool.getText(
'0', 20, '#ffffff',
TEXT_ALIGN.CENTER, 80, 54, 21
));
}
}
/**
* 积分
*/
class CreditsBox extends Container {
private countLabel: TextField = null;
private _count = 0;
public set count(count: number) {
this._count = count;
this.countLabel.text = `积分:${count}`;
}
constructor(data) {
super();
this.initUi(data);
}
private initUi(data) {
this.position.set(544, 184);
this.addChild(Tool.getSprite('map_creditsBg.png'));
this.countLabel = this.addChild(Tool.getText(
'积分:0', 20, '#ffffff',
TEXT_ALIGN.CENTER, 105, 58, 21
));
}
}
/**
* 连续闯关礼盒
*/
class PrizeBox extends Button {
private checkTip: TextField = null; private checkTip: TextField = null;
private tip: TextField = null; private tip: TextField = null;
constructor() { private prizeImg: Sprite = null;
super();
this.position.set(558, 269); constructor(data) {
super(RES.getRes('map_prizeBox.png'));
this.initUi(data);
this.initEvent();
}
this.addChild(Tool.getSprite('map_prizeBox.png')); private initUi(data) {
this.position.set(558, 269);
this.checkTip = this.addChild(Tool.getText( this.checkTip = this.addChild(Tool.getText(
'再闯XXX关', 22, '再闯XXX关', 22,
...@@ -62,6 +141,13 @@ class PrizeBox extends Container { ...@@ -62,6 +141,13 @@ class PrizeBox extends Container {
)); ));
this.tip.lineSpacing = 0; this.tip.lineSpacing = 0;
this.prizeImg = this.addChild(Tool.getSprite('map_star_enable.png', 39, 150));
this.prizeImg.width = 80;
this.prizeImg.height = 33;
}
initEvent() {
} }
} }
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