Commit 813ca7dc authored by wjf's avatar wjf

Merge branch 'master' of gitlab2.dui88.com:MrKwon/babycare_xiaoxiao

parents 65f4a959 79e9e765
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<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="111">
<change afterPath="$PROJECT_DIR$/resource/map/map_avatar_bg.png" afterDir="false" /> <change afterPath="$PROJECT_DIR$/mock/miniTb/babycare.getIndex.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_bg1.jpg" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_bg2.jpg" afterDir="false" /> <change beforePath="$PROJECT_DIR$/module/views/layers.ts" beforeDir="false" afterPath="$PROJECT_DIR$/module/views/layers.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_bg3.jpg" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TaoBaoNet.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/TaoBaoNet.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_check_disable.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/scene/map/CheckBtn.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/CheckBtn.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_check_disable_prize.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/scene/map/MapBottom.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapBottom.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_check_enable.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/scene/map/MapMid.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapMid.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_check_enable_cur.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/scene/map/MapPart.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapPart.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_prizeBtn.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/scene/map/MapScene.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapScene.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_ruleBtn.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/scene/map/MapTop.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapTop.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_star_disable.png" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/scene/map/MapUI.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/scene/map/MapUI.ts" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/map/map_star_enable.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/scene/MapScene.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.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" />
</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" />
...@@ -29,6 +23,7 @@ ...@@ -29,6 +23,7 @@
<option name="RECENT_TEMPLATES"> <option name="RECENT_TEMPLATES">
<list> <list>
<option value="TypeScript File" /> <option value="TypeScript File" />
<option value="JsonFile" />
</list> </list>
</option> </option>
</component> </component>
...@@ -36,6 +31,9 @@ ...@@ -36,6 +31,9 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="ProjectId" id="1eLguwUxaFZQKdDU4ke9UiiRNrt" /> <component name="ProjectId" id="1eLguwUxaFZQKdDU4ke9UiiRNrt" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
...@@ -44,22 +42,27 @@ ...@@ -44,22 +42,27 @@
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/resource" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/resource/map" />
<property name="node.js.detected.package.tslint" value="true" /> <property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.path.for.package.tslint" value="project" /> <property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.tslint" value="(autodetect)" /> <property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" /> <property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" /> <property name="nodejs_package_manager_path" value="npm" />
<property name="run.code.analysis.last.selected.profile" value="pProject Default" />
<property name="settings.editor.selected.configurable" value="editor.preferences.fonts.default" /> <property name="settings.editor.selected.configurable" value="editor.preferences.fonts.default" />
<property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" /> <property name="ts.external.directory.path" value="$PROJECT_DIR$/node_modules/typescript/lib" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/resource/map" />
<recent name="$PROJECT_DIR$/resource" /> <recent name="$PROJECT_DIR$/resource" />
</key> </key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/scene/map" />
</key>
</component> </component>
<component name="RunManager" selected="npm.flushRes"> <component name="RunManager" selected="npm.dev">
<configuration name="dev" type="js.build_tools.npm" temporary="true" nameIsGenerated="true"> <configuration name="dev" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" /> <package-json value="$PROJECT_DIR$/package.json" />
<command value="run" /> <command value="run" />
...@@ -82,8 +85,8 @@ ...@@ -82,8 +85,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>
...@@ -97,37 +100,86 @@ ...@@ -97,37 +100,86 @@
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1594106513515</updated> <updated>1594106513515</updated>
<workItem from="1594106517562" duration="2416000" /> <workItem from="1594106517562" duration="5224000" />
<workItem from="1594111755267" duration="29551000" />
<workItem from="1594260676967" duration="14401000" />
</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 id="LOCAL-00002" summary="111">
<created>1594213388301</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1594213388301</updated>
</task> </task>
<option name="localTasksCounter" value="3" />
<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" />
</state> </state>
<state x="440" y="273" key="#com.intellij.execution.impl.EditConfigurationsDialog/31.23.1889.1177@31.23.1889.1177" timestamp="1594106579644" /> <state x="440" y="273" key="#com.intellij.execution.impl.EditConfigurationsDialog/31.23.1889.1177@31.23.1889.1177" timestamp="1594106579644" />
<state width="896" height="330" key="GridCell.Tab.0.bottom" timestamp="1594107808454"> <state x="251" y="471" key="ANALYSIS_DLG_com.intellij.analysis.BaseAnalysisAction$1" timestamp="1594113080922">
<screen x="31" y="23" width="1889" height="1177" />
</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="58" y="183" key="CommitChangelistDialog2" timestamp="1594277421161">
<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="1594277421161" />
<state width="879" height="329" key="GridCell.Tab.0.bottom" timestamp="1594261592327">
<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="1594261592327" />
<state width="879" height="329" key="GridCell.Tab.0.center" timestamp="1594261592326">
<screen x="31" y="23" width="1889" height="1177" />
</state>
<state width="879" height="329" key="GridCell.Tab.0.center/31.23.1889.1177@31.23.1889.1177" timestamp="1594261592326" />
<state width="879" height="329" key="GridCell.Tab.0.left" timestamp="1594261592326">
<screen x="31" y="23" width="1889" height="1177" />
</state>
<state width="879" height="329" key="GridCell.Tab.0.left/31.23.1889.1177@31.23.1889.1177" timestamp="1594261592326" />
<state width="879" height="329" key="GridCell.Tab.0.right" timestamp="1594261592326">
<screen x="31" y="23" width="1889" height="1177" />
</state>
<state width="879" height="329" key="GridCell.Tab.0.right/31.23.1889.1177@31.23.1889.1177" timestamp="1594261592326" />
<state x="210" y="320" key="RollbackChangesDialog" timestamp="1594173186663">
<screen x="31" y="23" width="1889" height="1177" />
</state>
<state x="210" y="320" key="RollbackChangesDialog/31.23.1889.1177@31.23.1889.1177" timestamp="1594173186663" />
<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="330" key="GridCell.Tab.0.bottom/31.23.1889.1177@31.23.1889.1177" timestamp="1594107808454" /> <state x="31" y="250" key="SettingsEditor/31.23.1889.1177@31.23.1889.1177" timestamp="1594195630991" />
<state width="896" height="330" key="GridCell.Tab.0.center" timestamp="1594107808453"> <state x="92" y="351" key="Vcs.Push.Dialog.v2" timestamp="1594213389525">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state width="896" height="330" key="GridCell.Tab.0.center/31.23.1889.1177@31.23.1889.1177" timestamp="1594107808453" /> <state x="92" y="351" key="Vcs.Push.Dialog.v2/31.23.1889.1177@31.23.1889.1177" timestamp="1594213389525" />
<state width="896" height="330" key="GridCell.Tab.0.left" timestamp="1594107808453"> <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 width="896" height="330" key="GridCell.Tab.0.left/31.23.1889.1177@31.23.1889.1177" timestamp="1594107808453" /> <state x="87" y="216" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/31.23.1889.1177@31.23.1889.1177" timestamp="1594111906161" />
<state width="896" height="330" key="GridCell.Tab.0.right" timestamp="1594107808454"> <state x="157" y="286" key="run.anything.popup" timestamp="1594188122355">
<screen x="31" y="23" width="1889" height="1177" /> <screen x="31" y="23" width="1889" height="1177" />
</state> </state>
<state width="896" height="330" key="GridCell.Tab.0.right/31.23.1889.1177@31.23.1889.1177" timestamp="1594107808454" /> <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="1594107828315"> <state x="640" y="288" width="670" height="676" key="search.everywhere.popup" timestamp="1594279600705">
<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="1594279600705" />
</component> </component>
</project> </project>
\ No newline at end of file
{
"success": true,
"code": "1111",
"message": "OK",
"data": {
"power": 100,
"currentLevel": 4,
"tools": {
"STEPS": 1,
"BOOMS": 2,
"HAMMERS": 3
},
"prizes": [
{
"level": 12
}
],
"visitors": [
{
"level": 1,
"scores": 11111,
"stars": 1,
"isPrizeLevel": false,
"isVisitSuccess": true
},
{
"level": 2,
"scores": 22222,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true
},
{
"level": 3,
"scores": 3333,
"stars": 3,
"isPrizeLevel": false,
"isVisitSuccess": true
},
{
"level": 4,
"scores": 44444,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": false
}
],
"isFristLogin": false
}
}
...@@ -33,9 +33,9 @@ class Layers extends FYGE.Container { ...@@ -33,9 +33,9 @@ class Layers extends FYGE.Container {
this.addChild(this[arr[i]]); this.addChild(this[arr[i]]);
} }
//都以底部适配 //都以底部适配
this.sceneLayer.y = -this.stageOffsetY; this.sceneLayer.y = this.stageOffsetY;
// this.popupLayer.y = -this.stageOffsetY; // this.popupLayer.y = -this.stageOffsetY;
this.popupLayer.y -= 420 / 2; // this.popupLayer.y -= 420 / 2;
this.shareLayer.y = -this.stageOffsetY; this.shareLayer.y = -this.stageOffsetY;
//初始化场景层级 //初始化场景层级
...@@ -117,4 +117,4 @@ export function destroyLayers() { ...@@ -117,4 +117,4 @@ export function destroyLayers() {
layers.removeChildren(); layers.removeChildren();
//从父级stage移除自己,init会重新加 //从父级stage移除自己,init会重新加
if (layers.parent) layers.parent.removeChild(layers) if (layers.parent) layers.parent.removeChild(layers)
} }
\ No newline at end of file
resource/map/map_bg2.jpg

776 KB | W: | H:

resource/map/map_bg2.jpg

723 KB | W: | H:

resource/map/map_bg2.jpg
resource/map/map_bg2.jpg
resource/map/map_bg2.jpg
resource/map/map_bg2.jpg
  • 2-up
  • Swipe
  • Onion skin
...@@ -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_prizeBtn.png,map_ruleBtn.png,map_star_disable.png,map_star_enable.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"
} }
], ],
......
...@@ -8,7 +8,7 @@ import { ResJson } from "./ResJson"; ...@@ -8,7 +8,7 @@ import { ResJson } from "./ResJson";
import { destroyNetData, sendTbNet, TbNetName } from "./TaoBaoNet"; import { destroyNetData, sendTbNet, TbNetName } from "./TaoBaoNet";
import { SkinJson } from "./SkinJson"; import { SkinJson } from "./SkinJson";
import { G_EVENT } from "./common/G_EVENT"; import { G_EVENT } from "./common/G_EVENT";
import { MapScene } from "./scene/MapScene"; import { MapScene } from "./scene/map/MapScene";
/** /**
* 全局事件,为了和小程序交互 * 全局事件,为了和小程序交互
......
...@@ -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_prizeBtn.png,map_ruleBtn.png,map_star_disable.png,map_star_enable.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"
} }
], ],
......
...@@ -3,13 +3,15 @@ import { GDispatcher } from "./Main"; ...@@ -3,13 +3,15 @@ import { GDispatcher } from "./Main";
//接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分 //接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分
export enum TbNetName { export enum TbNetName {
/** /**
* 埋点统计 到时改名字 * 埋点统计 到时改名字
* activityId params elemType * activityId params elemType
*/ */
trackingReport = "squirrelsAdoptRest2c.trackingReport", trackingReport = "squirrelsAdoptRest2c.trackingReport",
getIndex = "babycare.getIndex",
///////////////////前端调用接口都加个mine ///////////////////前端调用接口都加个mine
......
import { Scene } from "../../module/views/Scene";
import ScrollPage = FYGE.ScrollPage;
import Container = FYGE.Container;
import { Tool } from "../Tools";
export class MapScene extends Scene {
private mapContainer: Container = null;
private scrollPage: ScrollPage = null;
public get groupNames(): string[] {
return ['map'];
}
protected initUi() {
super.initUi();
this.scrollPage = this.addChild(new ScrollPage(750, 1624, 888, true, true));
this.mapContainer = this.scrollPage.view.addChild(new Container());
let bg3 = this.mapContainer.addChild(Tool.getSprite('map_bg3.jpg'));
let bg2 = this.mapContainer.addChild(Tool.getSprite('map_bg2.jpg', 0, bg3.height));
let bg1 = this.mapContainer.addChild(Tool.getSprite('map_bg1.jpg', 0, bg3.height + bg2.height));
this.scrollPage.maxDistance = this.mapContainer.height;
this.scrollPage.scrollTo(this.mapContainer.height, 0);
}
public start(data?: any) {
super.start(data);
}
public initEvents() {
super.initEvents();
}
public removeEvents() {
super.removeEvents();
}
}
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;
import Point = FYGE.Point;
export enum CHECK_TYPE {
COM, // 普通
PRI, // 奖励
CUR, // 当前
}
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 (count > 3) {
count = 3;
} else if (count < 1) {
count = 1;
}
if (this._starCount == count) return;
this._starCount = count;
this.star.forEach((value, index) => {
value.enabled = (index < count);
});
}
private _enabled: boolean = true;
public set enabled(enabled: boolean) {
if (this._enabled == enabled) return;
this._enabled = enabled;
this.btn.enabled = enabled;
this.star.forEach(v => v.visible = enabled);
this.checkLabel.visible = false;
}
private _type: CHECK_TYPE = CHECK_TYPE.COM;
public set type(type: CHECK_TYPE) {
if (this._type == type) return;
this._type = type;
switch (type) {
case CHECK_TYPE.COM:
// @ts-ignore
this.btn.changeTexture(
RES.getRes('map_check_enable.png'),
RES.getRes('map_check_enable.png'),
RES.getRes('map_check_disable.png'));
this.checkLabel.strokeColor = '#316ec6';
break;
case CHECK_TYPE.PRI:
// @ts-ignore
this.btn.changeTexture(
RES.getRes('map_check_enable.png'),
RES.getRes('map_check_enable.png'),
RES.getRes('map_check_disable_prize.png'));
this.checkLabel.strokeColor = '#316ec6';
break;
case CHECK_TYPE.CUR:
// @ts-ignore
this.btn.changeTexture(
RES.getRes('map_check_enable_cur.png'),
RES.getRes('map_check_enable_cur.png'),
RES.getRes('map_check_disable.png'));
this.checkLabel.strokeColor = '#a55507';
break;
}
}
public update() {
super.update();
let up = this.localToGlobal(new Point(), new Point());
let bp = this.localToGlobal(new Point(0, 120), new Point());
this.alpha = this.stage.viewRect.isPointIn(up) || this.stage.viewRect.isPointIn(bp);
}
constructor(data) {
super();
this.initUi(data);
}
protected 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 MapPart from "./MapPart";
import { RES } from "../../../module/RES";
import Point = FYGE.Point;
export default class MapBottom extends MapPart {
public static HEIGHT = 1093;
protected totalCount = 8;
protected btnPos = [
[370, 930],
[437, 761],
[313, 669],
[408, 522],
[455, 375],
[364, 216],
[326, 62],
[491, 3],
];
constructor(data) {
super(data);
this.data = data;
this.bg.texture = RES.getRes('map_bg1.jpg');
this.initIcon();
}
public update() {
super.update();
let up = this.localToGlobal(new Point(0, -10), new Point());
let bp = this.localToGlobal(new Point(0, MapBottom.HEIGHT + 10), new Point());
let ucp = this.localToGlobal(new Point(0, MapBottom.HEIGHT / 4), new Point());
let bcp = this.localToGlobal(new Point(0, MapBottom.HEIGHT / 4 * 3), new Point());
this.alpha = this.stage.viewRect.isPointIn(up)
|| this.stage.viewRect.isPointIn(bp)
|| this.stage.viewRect.isPointIn(ucp)
|| this.stage.viewRect.isPointIn(bcp);
}
public destroy() {
super.destroy();
}
}
import MapPart from "./MapPart";
import { RES } from "../../../module/RES";
import Point = FYGE.Point;
export default class MapMid extends MapPart {
public static HEIGHT = 1635;
protected totalCount = 10;
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(data);
this.data = data;
this.bg.texture = RES.getRes('map_bg2.jpg');
this.initIcon();
}
public update() {
super.update();
let up = this.localToGlobal(new Point(0, -10), new Point());
let bp = this.localToGlobal(new Point(0, MapMid.HEIGHT + 10), new Point());
let ucp = this.localToGlobal(new Point(0, MapMid.HEIGHT / 4), new Point());
let bcp = this.localToGlobal(new Point(0, MapMid.HEIGHT / 4 * 3), new Point());
this.alpha = this.stage.viewRect.isPointIn(up)
|| this.stage.viewRect.isPointIn(bp)
|| this.stage.viewRect.isPointIn(ucp)
|| this.stage.viewRect.isPointIn(bcp);
}
public destroy() {
super.destroy();
}
}
import Sprite = FYGE.Sprite;
import CheckBtn from "./CheckBtn";
import { MapScene } from "./MapScene";
import Container = FYGE.Container;
export default class MapPart extends Container {
protected data: any = null;
protected totalCount: number = 0;
protected btnPos: number[][] = [];
protected bg: Sprite = null;
constructor(data) {
super();
this.bg = this.addChild(new Sprite());
this.data = data;
}
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 MapBottom from "./MapBottom";
import MapTop from "./MapTop";
import MapUI from "./MapUI";
import MapMid from "./MapMid";
import CheckBtn, { CHECK_TYPE } from "./CheckBtn";
import { layers } from "../../../module/views/layers";
import ScrollPage = FYGE.ScrollPage;
import Container = FYGE.Container;
import { sendTbNet, TbNetName } from "../../TaoBaoNet";
export class MapScene extends Scene {
private mapContainer: Container = null;
private scrollPage: ScrollPage = null;
public static checkArr: CheckBtn[] = []; // 关卡按钮容器
public destroy() {
super.destroy();
MapScene.checkArr = [];
}
private uiLayer: Container = null;
public get groupNames(): string[] {
return ['map'];
}
protected initUi() {
super.initUi();
sendTbNet(TbNetName.getIndex, {},
(success, res) => {
}
);
this.scrollPage = this.addChild(new ScrollPage(
750, layers.stageHeight,
888, true, true
));
this.mapContainer = this.scrollPage.view.addChild(new Container());
this.uiLayer = this.addChild(new MapUI());
this.initMap();
}
public initMap() {
const arr = new Array(120);
for (let i = 0; i < 120; i++) {
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);
// MapScene.checkArr.forEach(v => {
// v.type = CHECK_TYPE.PRI;
// v.enabled = false;
// });
this.scrollToCheck(113);
MapScene.checkArr[113].type = CHECK_TYPE.CUR;
}
private scrollToCheck(checkNum: number, time = 0) {
if (checkNum < 1) {
checkNum = 1;
} else if (checkNum > 120) {
checkNum = 120;
}
const check = MapScene.checkArr[checkNum];
const checkY = check.y + check.parent.y - 1624 / 2;
this.scrollPage.scrollTo(checkY, time);
}
public update() {
super.update();
}
public start(data?: any) {
super.start(data);
}
public initEvents() {
super.initEvents();
}
public removeEvents() {
super.removeEvents();
}
}
import MapPart from "./MapPart";
import { RES } from "../../../module/RES";
import Point = FYGE.Point;
export default class MapTop extends MapPart {
public static HEIGHT = 521;
protected totalCount = 2;
public btnPos = [
[207, 418],
[149, 282],
];
constructor(data) {
super(data);
this.data = data;
this.bg.texture = RES.getRes('map_bg3.jpg');
this.initIcon();
}
public update() {
super.update();
let up = this.localToGlobal(new Point(0, -10), new Point());
let bp = this.localToGlobal(new Point(0, MapTop.HEIGHT + 10), new Point());
let ucp = this.localToGlobal(new Point(0, MapTop.HEIGHT / 4), new Point());
let bcp = this.localToGlobal(new Point(0, MapTop.HEIGHT / 4 * 3), new Point());
this.alpha = this.stage.viewRect.isPointIn(up)
|| this.stage.viewRect.isPointIn(bp)
|| this.stage.viewRect.isPointIn(ucp)
|| this.stage.viewRect.isPointIn(bcp);
}
public destroy() {
super.destroy();
}
}
import Container = FYGE.Container;
import Button = FYGE.Button;
import TextField = FYGE.TextField;
import Sprite = FYGE.Sprite;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import { RES } from "../../../module/RES";
import { Tool } from "../../Tools";
import MouseEvent = FYGE.MouseEvent;
export default class MapUI extends Container {
private myPrizeBtn: Button = null;
private ruleBtn: Button = null;
private taskBtn: Button = null;
private energyBox: EnergyBox = null;
private creditsBox: CreditsBox = null;
private prizeBox: PrizeBox = null;
constructor() {
super();
this.initUi();
this.initEvent();
}
private initEvent() {
this.ruleBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.myPrizeBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.prizeBox.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
private removeEvent() {
this.ruleBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.myPrizeBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.prizeBox.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
private clickBtn(e) {
switch (e.target) {
case this.ruleBtn:
/// TODO 规则
console.log('规则');
break;
case this.myPrizeBtn:
/// TODO 我的奖品
console.log('我的奖品');
break;
case this.prizeBox:
/// TODO 奖励盒子
console.log('奖励盒子');
break;
}
}
public destroy() {
super.destroy();
this.removeEvent();
}
private initUi() {
// 我的奖品
this.myPrizeBtn = this.addChild(new Button(RES.getRes('map_prizeBtn.png')));
this.myPrizeBtn.position.set(0, 185);
this.myPrizeBtn.anchorX = 0;
// 规则按钮
this.ruleBtn = this.addChild(new Button(RES.getRes('map_ruleBtn.png')));
this.ruleBtn.position.set(0, 104);
this.ruleBtn.anchorX = 0;
// 任务按钮
this.taskBtn = this.addChild(new Button(RES.getRes('map_taskBtn.png')));
this.taskBtn.position.set(19, 280);
this.energyBox = this.addChild(new EnergyBox({}));
this.creditsBox = this.addChild(new CreditsBox({}));
this.prizeBox = this.addChild(new PrizeBox({}));
}
}
/**
* 能量
*/
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);
this.addBtn.addEventListener(MouseEvent.CLICK, this.clickAdd, this);
}
private clickAdd() {
/// TODO 增加按钮
console.log('增加按钮');
}
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
));
}
public destroy() {
super.destroy();
this.addBtn.removeEventListener(MouseEvent.CLICK, this.clickAdd, this);
}
}
/**
* 积分
*/
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 tip: TextField = null;
private prizeImg: Sprite = null;
constructor(data) {
super(RES.getRes('map_prizeBox.png'));
this.initUi(data);
this.initEvent();
}
private initUi(data) {
this.position.set(558, 269);
this.checkTip = this.addChild(Tool.getText(
'再闯XXX关', 22,
'#ffffff', TEXT_ALIGN.CENTER,
158, 0, 64
));
this.tip = this.addChild(Tool.getText(
'参与红包抽奖\n赢XXX优惠券', 17,
'#ec5a5a', TEXT_ALIGN.CENTER,
158, 0, 112
));
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