Commit 76c07268 authored by haiyoucuv's avatar haiyoucuv

1

parent ef6224d3
No preview for this file type
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/JoyousManor.iml" filepath="$PROJECT_DIR$/.idea/JoyousManor.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
No preview for this file type
......@@ -27,7 +27,7 @@
<body>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player" data-entry-class="Main"
data-orientation="auto" data-scale-mode="showAll" data-frame-rate="60" data-content-width="750"
data-content-height="1624" data-multi-fingered="2" data-show-fps="false" data-show-log="false"
data-content-height="1624" data-multi-fingered="2" data-show-fps="true" data-show-log="false"
data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
</div>
<img id="shareImg" />
......
No preview for this file type
......@@ -5,7 +5,7 @@
"name": "loading"
},
{
"keys": "closeBtn_png",
"keys": "closeBtn_png,light1_png,light_png",
"name": "common"
},
{
......@@ -23,6 +23,26 @@
{
"keys": "篱笆_png,plant_cattle_1_png,plant_cattle_2_png,plant_chicken_0_png,plant_chicken_1_png,plant_chicken_2_png,plant_corn_0_png,plant_corn_1_png,plant_corn_2_png,plant_land_active_png,plant_land_animal_png,plant_land_none_png,plant_land_plant_png,plant_wheat_0_png,plant_wheat_1_png,plant_wheat_2_png,plant_cattle_0_png,食槽_png,_DS_Store,feed_png,feeding_png,hand_png,option_chicken_png,option_panel_png,option_wheat_png,water_png,watering_png",
"name": "index_plant"
},
{
"keys": "task_bg_png,task_item_bg_png,浇水2_png,饲料 拷贝_png,task_brn_bg_png,task_toast_png",
"name": "task_panel"
},
{
"keys": "corn_bg_png,egg_bg_png,milk_bg_png,仓库2_png,兑换_png,出售_png,出售记录_png,warehouse_none_png,wheat_bg_png",
"name": "warehouse"
},
{
"keys": "sellTitle_wheat_png,sellTitle_egg_png,sell_btn_en_png,sell_btn_dis_png,sell_bg_png,out_line_png,+_en_png,+_dis_png,-_en_png,-_dis_png",
"name": "sell_panel"
},
{
"keys": "sellRecord_outline_png,sellRecord_bg_png",
"name": "sellRecord"
},
{
"keys": "selled_btn_png,selled_bg_png",
"name": "selled_panel"
}
],
"resources": [
......@@ -235,6 +255,161 @@
"url": "assets/index_scene/planting/option/watering.png",
"type": "image",
"name": "watering_png"
},
{
"url": "assets/task_panel/task_bg.png",
"type": "image",
"name": "task_bg_png"
},
{
"url": "assets/task_panel/task_item_bg.png",
"type": "image",
"name": "task_item_bg_png"
},
{
"url": "assets/task_panel/浇水.png",
"type": "image",
"name": "浇水2_png"
},
{
"url": "assets/task_panel/饲料 拷贝.png",
"type": "image",
"name": "饲料 拷贝_png"
},
{
"url": "assets/task_panel/task_brn_bg.png",
"type": "image",
"name": "task_brn_bg_png"
},
{
"url": "assets/task_panel/task_toast.png",
"type": "image",
"name": "task_toast_png"
},
{
"url": "assets/warehouse_panel/corn_bg.png",
"type": "image",
"name": "corn_bg_png"
},
{
"url": "assets/warehouse_panel/egg_bg.png",
"type": "image",
"name": "egg_bg_png"
},
{
"url": "assets/warehouse_panel/milk_bg.png",
"type": "image",
"name": "milk_bg_png"
},
{
"url": "assets/warehouse_panel/sellRecord/sellRecord_bg.png",
"type": "image",
"name": "sellRecord_bg_png"
},
{
"url": "assets/warehouse_panel/sellRecord/sellRecord_outline.png",
"type": "image",
"name": "sellRecord_outline_png"
},
{
"url": "assets/warehouse_panel/sell_panel/+_dis.png",
"type": "image",
"name": "+_dis_png"
},
{
"url": "assets/warehouse_panel/sell_panel/+_en.png",
"type": "image",
"name": "+_en_png"
},
{
"url": "assets/warehouse_panel/sell_panel/-_dis.png",
"type": "image",
"name": "-_dis_png"
},
{
"url": "assets/warehouse_panel/sell_panel/-_en.png",
"type": "image",
"name": "-_en_png"
},
{
"url": "assets/warehouse_panel/sell_panel/out_line.png",
"type": "image",
"name": "out_line_png"
},
{
"url": "assets/warehouse_panel/sell_panel/sellTitle_egg.png",
"type": "image",
"name": "sellTitle_egg_png"
},
{
"url": "assets/warehouse_panel/sell_panel/sellTitle_wheat.png",
"type": "image",
"name": "sellTitle_wheat_png"
},
{
"url": "assets/warehouse_panel/sell_panel/sell_bg.png",
"type": "image",
"name": "sell_bg_png"
},
{
"url": "assets/warehouse_panel/sell_panel/sell_btn_dis.png",
"type": "image",
"name": "sell_btn_dis_png"
},
{
"url": "assets/warehouse_panel/sell_panel/sell_btn_en.png",
"type": "image",
"name": "sell_btn_en_png"
},
{
"url": "assets/warehouse_panel/selled/selled_bg.png",
"type": "image",
"name": "selled_bg_png"
},
{
"url": "assets/warehouse_panel/selled/selled_btn.png",
"type": "image",
"name": "selled_btn_png"
},
{
"url": "assets/warehouse_panel/warehouse_none.png",
"type": "image",
"name": "warehouse_none_png"
},
{
"url": "assets/warehouse_panel/wheat_bg.png",
"type": "image",
"name": "wheat_bg_png"
},
{
"url": "assets/warehouse_panel/仓库.png",
"type": "image",
"name": "仓库2_png"
},
{
"url": "assets/warehouse_panel/兑换.png",
"type": "image",
"name": "兑换_png"
},
{
"url": "assets/warehouse_panel/出售.png",
"type": "image",
"name": "出售_png"
},
{
"url": "assets/warehouse_panel/出售记录.png",
"type": "image",
"name": "出售记录_png"
},
{
"url": "assets/common/light1.png",
"type": "image",
"name": "light1_png"
},
{
"url": "assets/common/light.png",
"type": "image",
"name": "light_png"
}
]
}
\ No newline at end of file
......@@ -7,6 +7,9 @@
"resource/skins/LoadingSceneSkin.exml",
"resource/skins/LoadingSkin.exml",
"resource/skins/RulePanelSkin.exml",
"resource/skins/TaskToastSkin.exml",
"resource/skins/TaskPanelSkin.exml",
"resource/skins/TaskItemSkin.exml",
"resource/skins/ToastPanelSkin.exml",
"resource/skins/Objs/OptionPanelSkin.exml",
"resource/skins/Objs/CropSkin.exml",
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="TimeProgressBarSkin" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" width="186" height="31">
<e:Skin class="TimeProgressBar" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" width="186" height="31">
<e:Rect id="bg" fillColor="0xffffff" left="0" top="0" bottom="0" right="0" ellipseWidth="13" ellipseHeight="13"/>
<e:Label id="corpName" text="鸡" size="16" textColor="0x000000" horizontalCenter="-70" verticalCenter="0"/>
<e:Group width="139" height="29" verticalCenter="0" left="46">
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="LoadingSceneSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" xmlns:ns1="*">
<w:Config id="16e64c53e86"/>
<e:Group verticalCenter="0" horizontalCenter="0" height="1624" width="750">
<e:Image id="bg" source="index_bg_png" horizontalCenter="-1" verticalCenter="0" x="0" y="0" scaleX="1" scaleY="1"/>
<e:Group id="gameLayer" left="0" top="0" bottom="0" right="0" horizontalCenter="0" verticalCenter="0">
<e:Component y="636" x="156" skinName="Land" visible="false"/>
<e:Component y="739" x="368" skinName="Land" visible="false"/>
<e:Component y="842" x="68" skinName="Land" visible="false"/>
<e:Component y="958" x="302" skinName="Land" visible="false"/>
<e:Group id="group" horizontalCenter="0" width="750" top="0" height="1624">
<e:Image id="bg" source="index_bg_png" scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0"/>
<e:Group id="gameLayer" left="0" right="0" horizontalCenter="0" verticalCenter="0" height="1624">
<e:Component y="664" x="190" skinName="Land" visible="false"/>
<e:Component y="768" x="406" skinName="Land" visible="false"/>
<e:Component y="846" x="58" skinName="Land" visible="false"/>
<e:Component y="962" x="298" skinName="Land" visible="false"/>
</e:Group>
</e:Group>
</e:Skin>
\ No newline at end of file
......@@ -2,8 +2,8 @@
<e:Skin class="LoadingSceneSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" xmlns:ns1="*">
<w:Config id="16e64c53e86"/>
<e:Image source="index_bg_png" horizontalCenter="0" verticalCenter="0" x="0" y="0" scaleX="1" scaleY="1" visible="false"/>
<e:Group id="uiLayer" left="0" top="0" bottom="0" right="0" horizontalCenter="0" verticalCenter="0" touchChildren="true" touchEnabled="false">
<e:Group id="btnGroup" y="1242" left="0" right="182" anchorOffsetX="0">
<e:Group id="uiLayer" left="0" right="0" horizontalCenter="0" touchChildren="true" touchEnabled="false" top="0" height="1624">
<e:Group id="btnGroup" left="0" right="182" anchorOffsetX="0" verticalCenter="490.5">
<e:Button id="taskBtn" label="" x="143" y="0">
<e:skinName>
<e:Skin states="up,down,disabled">
......@@ -21,21 +21,21 @@
</e:skinName>
</e:Button>
</e:Group>
<e:Group id="propPanel" y="1165" width="182" height="198" right="0">
<e:Group x="11" y="0" width="171" height="62">
<e:Group id="propPanel" width="182" height="198" right="0" verticalCenter="452" touchChildren="true" touchEnabled="false">
<e:Group id="speedGroup" x="11" y="0" width="171" height="62" visible="false">
<e:Image source="加速卡_png" x="0" y="0"/>
<e:Label id="speedNum" text="× 2" size="28" scaleX="1" scaleY="1" right="0" anchorOffsetX="0" width="108" anchorOffsetY="0" height="50" verticalAlign="middle" verticalCenter="4"/>
</e:Group>
<e:Group x="12" y="71" width="170" height="63">
<e:Group id="foodGroup" x="12" y="71" width="170" height="63" touchEnabled="true" touchChildren="false">
<e:Image source="饲料_png" x="0" y="0"/>
<e:Label id="foodNum" text="× 2" size="28" scaleX="1" scaleY="1" right="0" anchorOffsetX="0" width="108" anchorOffsetY="0" height="50" verticalAlign="middle" verticalCenter="3"/>
</e:Group>
<e:Group x="0" y="144">
<e:Group id="waterGroup" x="0" y="144" touchEnabled="true" touchChildren="false">
<e:Image source="浇水_png" x="0" y="0"/>
<e:Label id="waterNum" text="× 2" size="28" scaleX="1" scaleY="1" anchorOffsetX="0" right="0" width="108" anchorOffsetY="0" height="50" verticalAlign="middle" verticalCenter="0"/>
</e:Group>
</e:Group>
<e:Group id="avatarPanel" x="26" y="236" width="252" height="88">
<e:Group id="avatarPanel" x="26" width="252" height="88" verticalCenter="-532">
<e:Image source="头像面板_png" x="0" y="0"/>
<e:Image source="头像背景_png" x="6" y="5"/>
<e:Image id="avatarImg" source="默认头像_png" x="8" y="8" width="58" height="58"/>
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="Crop" width="276" height="240" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="cropImg" horizontalCenter="0" verticalCenter="0" source=""/>
<e:Image id="cropImg" horizontalCenter="0" bottom="0" source=""/>
<e:Image id="optionImg" y="0" source="" left="93"/>
</e:Skin>
\ No newline at end of file
......@@ -3,5 +3,4 @@
<e:Image id="land" source="plant_land_none_png" touchEnabled="true" y="71" x="15"/>
<e:Image id="fence" source="篱笆_png" top="0" horizontalCenter="0" width="362" touchEnabled="false"/>
<e:Image id="trough" source="食槽_png" left="0" bottom="0" touchEnabled="false"/>
<ns1:TimeProgressBar y="190" skinName="TimeProgressBarSkin" horizontalCenter="0"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="OptionPanel" width="271" height="171" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="option_panel_png" horizontalCenter="0" verticalCenter="0"/>
<e:Image id="chickBtn" source="option_chicken_png" y="15" x="158"/>
<e:Image id="wheatBtn" source="option_wheat_png" y="15" left="25"/>
<e:Image id="chickBtn" source="option_chicken_png" y="71" x="199" anchorOffsetX="41" anchorOffsetY="56"/>
<e:Image id="wheatBtn" source="option_wheat_png" y="74" left="25" anchorOffsetX="43" anchorOffsetY="59"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="CreditsTip" width="750" height="1010" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image y="114" source="sell_bg_png" horizontalCenter="0"/>
<e:Image id="closeBtn" source="closeBtn_png" x="604.5" y="80.5"/>
<e:Image id="titleImg" source="sellTitle_egg_png" y="43" horizontalCenter="0"/>
<e:Label id="nameLabel" text="鸡蛋" y="206" size="26" horizontalCenter="0"/>
<e:Label id="infoLabel" text="一个鸡蛋=50个欢趣豆" y="279" size="26" horizontalCenter="0"/>
<e:Label id="totalLabel" text="共50个鸡蛋" y="315" size="26" horizontalCenter="0.5"/>
<e:Button id="sellBtn" label="" y="498" horizontalCenter="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="sell_btn_en_png" source.down="sell_btn_en_png" source.disabled="sell_btn_dis_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="CreditsTip" width="501" height="50" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="sellRecord_outline_png" horizontalCenter="0" bottom="0"/>
<e:Label id="dateLabel" text="2019.12.3" textColor="0x855933" size="20" verticalCenter="0" left="0"/>
<e:Label id="cropLabel" text="2019.12.3" textColor="0x855933" size="20" verticalCenter="0" horizontalCenter="0"/>
<e:Label id="numLabel" text="2019.12.3" textColor="0x855933" size="20" verticalCenter="0" right="0"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="CreditsTip" width="750" height="1010" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image horizontalCenter="0" y="114" source="sellRecord_bg_png"/>
<e:Scroller y="280" anchorOffsetX="0" anchorOffsetY="0" height="502" width="521" horizontalCenter="0.5">
<e:Group anchorOffsetX="0" anchorOffsetY="0" height="776" width="654">
<e:List id="list" horizontalCenter="0" top="0" left="0" right="0">
<e:layout>
<e:VerticalLayout gap="20"/>
</e:layout>
</e:List>
</e:Group>
</e:Scroller>
<e:Image id="closeBtn" source="closeBtn_png" x="611" y="0"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="CreditsTip" width="654" height="180" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="task_item_bg_png" horizontalCenter="0" verticalCenter="0"/>
<e:Image id="icon" width="137" height="137" x="27.67" verticalCenter="-0.5"/>
<e:Label id="title" text="Label" textColor="0x624a33" size="30" left="178" top="38"/>
<e:Label id="textKHD" text="可获得:" textColor="0x9a9a9a" size="24" top="110" left="178"/>
<e:Group id="prizeGroup" x="265" y="101">
<e:Group id="foodGroup" y="0" x="0">
<e:Image source="饲料 拷贝_png" y="0" left="0"/>
<e:Label id="textFood" text="×500" textColor="0x9A9A9A" size="30" y="6" left="37"/>
</e:Group>
<e:Group id="waterGroup" x="108" y="2">
<e:Image source="浇水2_png" y="0" left="0"/>
<e:Label id="textWater" text="×500" textColor="0x9A9A9A" size="30" y="4.5" left="52"/>
</e:Group>
</e:Group>
<e:Group id="btn" x="508.5" y="57">
<e:Image id="btn_bg" source="task_brn_bg_png" x="0" y="0"/>
<e:Label id="btn_label" text="去完成" horizontalCenter="0" verticalCenter="0" size="28"/>
</e:Group>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="CreditsTip" width="750" height="1010" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="task_bg_png" horizontalCenter="0" y="114"/>
<e:Scroller y="200" anchorOffsetX="0" anchorOffsetY="0" height="778" width="654" horizontalCenter="0">
<e:Group anchorOffsetX="0" anchorOffsetY="0" height="776" width="654">
<e:List id="list" horizontalCenter="0" top="0" left="0" right="0">
<e:layout>
<e:VerticalLayout gap="20"/>
</e:layout>
</e:List>
</e:Group>
</e:Scroller>
<e:Image id="closeBtn" source="closeBtn_png" x="642" y="0"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ToastPanel" width="388" height="238" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="task_toast_png" horizontalCenter="0" verticalCenter="0"/>
<e:Label id="title" text="签到成功" y="10" size="26" horizontalCenter="0"/>
<e:Group id="foodGroup" x="119.5" y="119">
<e:Image source="饲料 拷贝_png" x="1.7" y="0" scaleX="1.3" scaleY="1.3"/>
<e:Label id="foodLabel" text="×30" y="64" size="26" x="0"/>
</e:Group>
<e:Group id="waterGroup" x="214.15" y="122.9">
<e:Image source="浇水2_png" x="0" y="0" scaleX="1.3" scaleY="1.3"/>
<e:Label id="waterLabel" text="×40" y="60.1" size="26" x="9.85"/>
</e:Group>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ToastPanel" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Skin class="ToastPanel" width="540" height="125" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" xmlns:ns1="*">
<e:Rect width="100%" height="100%" fillAlpha="0" strokeAlpha="0" locked="true"/>
<e:Rect id="bgRect" width="565.91" height="150" anchorOffsetX="0" anchorOffsetY="0" strokeAlpha="0" ellipseWidth="35" ellipseHeight="35" horizontalCenter="0" verticalCenter="0" fillAlpha="0.8"/>
<e:Label id="msgLb" text="" height="125" width="539.37" textAlign="center" verticalCenter="-0.5" verticalAlign="middle" anchorOffsetX="0" anchorOffsetY="0" x="105"/>
<e:Label id="msgLb" text="" height="125" width="540" textAlign="center" verticalAlign="middle" anchorOffsetX="0" anchorOffsetY="0" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="CreditsTip" width="750" height="715" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image horizontalCenter="0" y="114" source="仓库2_png"/>
<e:Image id="closeBtn" source="closeBtn_png" x="642" y="0"/>
<e:Image id="record_btn" source="出售记录_png" x="318" y="197"/>
<e:Image id="noneImg" source="warehouse_none_png" x="138" y="253" visible="false"/>
<e:Group id="cropGroup" x="43" y="274">
<e:Group id="egg_group" x="0" y="0">
<e:Image id="egg_bg" source="egg_bg_png" x="0" y="0"/>
<e:Image id="egg_btn" source="出售_png" x="89.5" y="240"/>
<e:Label id="egg_label" text="数量:0" x="113" y="195" size="24" textColor="0x9a9a9a"/>
</e:Group>
<e:Group id="wheat_group" x="354" y="0">
<e:Image id="wheat_bg" source="wheat_bg_png" x="0" y="0"/>
<e:Image id="wheat_btn" source="出售_png" x="89.5" y="240"/>
<e:Label id="wheat_label" text="数量:0" x="113" y="195" size="24" textColor="0x9A9A9A"/>
</e:Group>
</e:Group>
</e:Skin>
\ No newline at end of file
No preview for this file type
......@@ -14,7 +14,8 @@ import ToastPanel from './Panels/toastPanel/ToastPanel';
import { initstatistics } from "./comm/statistics";
import { docEvent } from "./comm/DocumentEvent";
import { NetManager } from "../libs/tw/manager/NetManager";
import { Panels, Scenes } from "./types/Scenes";
import { Panels, Scenes, Tops } from "./types/Scenes";
import TaskToast from "./Panels/TaskToast";
class Main extends eui.UILayer {
protected createChildren(): void {
......@@ -39,13 +40,12 @@ class Main extends eui.UILayer {
SceneCtrl.instance.init(layers.sceneLayer);
TopLayerCtrl.instance.init(layers.topLayer);
// this.stage.scaleMode = egret.StageScaleMode.FIXED_WIDTH;
this.stage.scaleMode = egret.StageScaleMode.NO_BORDER;
this.stage.scaleMode = egret.StageScaleMode.FIXED_WIDTH;
// this.stage.scaleMode = egret.StageScaleMode.NO_BORDER;
SceneCtrl.instance.registerScenes(Scenes); // 注册Scene
PanelCtrl.instance.registerPanels(Panels); // 注册Panel
TopLayerCtrl.instance.registerPanelClass(ModuleTypes.TOAST_PANEL, ToastPanel);
TopLayerCtrl.instance.registerPanels(Tops); // 注册TopPanel
this.runGame().catch(e => {
console.log(e);
......
import Panel from "../views/Panel";
import { getSkinPath } from "../utils";
export default class SellPanel extends Panel {
public closeBtn:eui.Image;
public titleImg:eui.Image;
public nameLabel:eui.Label;
public infoLabel:eui.Label;
public totalLabel:eui.Label;
public sellBtn:eui.Button;
public get skinKey() {
return 'SellPanel'
}
public get groupName() {
return 'sell_panel'
}
constructor(data?) {
super(data);
}
onShowAnim() {
// const canvasH = 750 / window.innerWidth * window.innerHeight;
egret.Tween.get(this).set({alpha: 0}).to({alpha: 1}, 233, egret.Ease.quadInOut);
}
protected start() {
super.start();
this.initUI();
}
private initUI(): void {
this.y = 750 / window.innerWidth * window.innerHeight * 0.2;
this.getTaskInfo();
}
private getTaskInfo() {
/// TODO 调用接口根据返回数据设置UI
}
}
import Panel from "../views/Panel";
import { getSkinPath } from "../utils";
export default class SellRecord extends Panel {
public list: eui.List;
public get skinKey() {
return 'SellRecord'
}
public get groupName() {
return 'sellRecord'
}
constructor(data?) {
super(data);
}
onShowAnim() {
// const canvasH = 750 / window.innerWidth * window.innerHeight;
egret.Tween.get(this).set({alpha: 0}).to({alpha: 1}, 233, egret.Ease.quadInOut);
}
protected start() {
super.start();
this.initUI();
}
private initUI(): void {
this.y = 750 / window.innerWidth * window.innerHeight * 0.1;
this.getTaskInfo();
}
private getTaskInfo() {
/// TODO 调用接口根据返回数据设置添加显示列表
this.list.useVirtualLayout = false;
this.list.itemRenderer = SellRecordItem;
this.list.dataProvider = new eui.ArrayCollection([1, 2, 3, 4, 5]);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
/**
* 任务中心列表
*/
class SellRecordItem extends eui.ItemRenderer {
public dateLabel: eui.Label;
public cropLabel: eui.Label;
public numLabel: eui.Label;
constructor() {
super();
this.skinName = getSkinPath('SellRecordItem');
}
dataChanged() {
console.log(this.data);
/**
* TODO 根据数据改变样式
* TODO 如果没有食物奖励则将foodGroup隐藏,并将waterGroup靠前
* TODO 如果没有奖励则隐藏prizeGroup
*/
}
}
import Panel from "../views/Panel";
import { getSkinPath } from "../utils";
import TopLayerCtrl from "../ctrls/topLayerCtrl";
import { ModuleTypes } from "../types/sceneTypes";
export default class TaskPanel extends Panel {
public list: eui.List;
public get skinKey() {
return 'TaskPanel'
}
public get groupName() {
return 'task_panel'
}
constructor(data?) {
super(data);
}
onShowAnim() {
const canvasH = 750 / window.innerWidth * window.innerHeight;
egret.Tween.get(this).set({y: canvasH}).to({y: canvasH - 1010}, 300, egret.Ease.quadInOut);
}
protected start() {
super.start();
this.initUI();
}
private initUI(): void {
this.getTaskInfo();
}
private getTaskInfo() {
/// TODO 调用接口根据返回数据设置添加显示列表
this.list.useVirtualLayout = false;
this.list.itemRenderer = TaskItem;
this.list.dataProvider = new eui.ArrayCollection([1, 2, 3, 4, 5]);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
/**
* 任务中心列表
*/
class TaskItem extends eui.ItemRenderer {
public icon: eui.Image;
public title: eui.Label;
public textKHD: eui.Label;
public prizeGroup: eui.Group;
public foodGroup: eui.Group;
public textFood: eui.Label;
public waterGroup: eui.Group;
public textWater: eui.Label;
public btn: eui.Group;
public btn_bg: eui.Image;
public btn_label: eui.Label;
constructor() {
super();
this.skinName = getSkinPath('TaskItem');
}
dataChanged() {
console.log(this.data);
/**
* TODO 根据数据改变样式
* TODO 如果没有食物奖励则将foodGroup隐藏,并将waterGroup靠前
* TODO 如果没有奖励则隐藏prizeGroup
*/
this.setBtn();
}
// 9a9a9a
// ffffff
private setBtn() {
/// TODO 根据数据设置按钮
/// TODO 如 已完成则btn_label.text = '已领取', 且btn_label.color = 0x9a9a9a,btn_bg.visible = false
/// TODO 如 未完成则根据数据设置btn_label.text, 且btn_label.color = 0xffffff,btn_bg.visible = true
/// TODO 根据需要设置btn监听事件
this.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
TopLayerCtrl.instance.show(ModuleTypes.TASK_TOAST, {
title: "签到成功",
water: 10,
food: 30,
});
}, this);
}
}
import Panel from "../views/Panel";
export default class TaskToast extends Panel {
public title:eui.Label;
public foodGroup:eui.Group;
public foodLabel:eui.Label;
public waterGroup:eui.Group;
public waterLabel:eui.Label;
public get skinKey() {
return 'TaskToast'
}
constructor(data) {
super(data);
// this.data = data;
}
onShowAnim() {
}
onSkinComplete() {
super.onSkinComplete();
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if(this.stage) {
this.onLoad();
}
}
initEvents() {
super.initEvents();
// this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap_this, this);
}
removeEvents() {
super.removeEvents();
// this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap_this, this);
}
private onLoad(): void {
this.title.text = this.data.title;
this.foodLabel.text = "×" + this.data.food;
this.waterLabel.text = "×" + this.data.water;
const canvasW = 750 / window.innerWidth * window.innerWidth;
const canvasH = 750 / window.innerWidth * window.innerHeight;
this.anchorOffsetX = this.width / 2;
this.anchorOffsetY = this.height / 2;
this.x = canvasW / 2;
this.y = canvasH / 2;
egret.Tween.removeTweens(this);
egret.Tween.get(this).set({scaleX: 0, scaleY: 0}).to({
scaleX: 1,
scaleY: 1
}, 330, egret.Ease.backOut).call(() => {
setTimeout(() => {
egret.Tween.get(this).to({alpha: 0}, 500, egret.Ease.quadInOut).call(() => {
this.onTouchClose();
});
}, 1200);
})
}
}
\ No newline at end of file
import Panel from "../views/Panel";
import TopLayerCtrl from "../ctrls/topLayerCtrl";
import { ModuleTypes } from "../types/sceneTypes";
export default class WareHousePanel extends Panel {
public record_btn: eui.Image;
public noneImg: eui.Image;
public cropGroup: eui.Group;
public egg_group: eui.Group;
public egg_bg: eui.Image;
public egg_btn: eui.Image;
public egg_label: eui.Label;
public wheat_group: eui.Group;
public wheat_bg: eui.Image;
public wheat_btn: eui.Image;
public wheat_label: eui.Label;
public get skinKey() {
return 'WareHouse'
}
public get groupName() {
return 'warehouse'
}
constructor(data?) {
super(data);
}
onShowAnim() {
const canvasH = 750 / window.innerWidth * window.innerHeight;
egret.Tween.get(this).set({y: canvasH}).to({y: canvasH - 715}, 300, egret.Ease.quadInOut);
}
protected getTapEvts(): any[] {
return super.getTapEvts().concat([
[this.record_btn, this.onTap, this],
]).concat([
[this.egg_btn, this.goSell, this],
[this.wheat_btn, this.goSell, this],
]);
}
private goSell(e:egret.TouchEvent){
let key = '';
switch(e.target) {
case this.egg_btn: // 鸡蛋售卖
key = 'egg';
break;
case this.wheat_btn: // 小麦售卖
key = 'wheat';
break;
default:break;
}
TopLayerCtrl.instance.show(ModuleTypes.SELL_PANEL, key, .4);
}
private onTap(e: egret.TouchEvent) {
switch(e.target) {
case this.record_btn: // 兑换记录
TopLayerCtrl.instance.show(ModuleTypes.SELL_RECORD, {}, .3);
break;
default:
break
}
}
protected start() {
super.start();
this.initUI();
}
private initUI(): void {
this.getWareHouseInfo();
}
private getWareHouseInfo() {
/// TODO 调用接口根据返回数据设置添加显示列表
}
}
import Panel from "../../views/Panel";
export default class ToastPanel extends Panel {
public msgLb:eui.Label;
public bgRect:eui.Rect;
public msgLb: eui.Label;
public bgRect: eui.Rect;
private mdata: any;
private mdata:any;
public get skinKey() { return 'ToastPanel' }
public get skinKey() {
return 'ToastPanel'
}
constructor(data){
constructor(data) {
super(data);
this.mdata = data;
this.percentHeight = 100;
}
onShowAnim() {
}
onSkinComplete() {
super.onSkinComplete();
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
if(this.stage) {
this.onLoad();
}
}
......@@ -32,12 +39,12 @@ export default class ToastPanel extends Panel {
// this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap_this, this);
}
private ontap_this():void{
private ontap_this(): void {
}
private onLoad():void{
if(this.mdata){
private onLoad(): void {
if(this.mdata) {
// if(this.mdata.line > 2){
// this.bgRect.height = 150 + (this.mdata.line - 2) * 30;
// }
......@@ -51,13 +58,36 @@ export default class ToastPanel extends Panel {
// this.bgRect.height = this.mdata.height;
// }
}
setTimeout(function(){
egret.Tween.get(this).to({alpha:0}, 500, egret.Ease.quintOut).call(function(){
this.onTouchClose();
}.bind(this));
}.bind(this), 1500);
}
const canvasW = 750 / window.innerWidth * window.innerWidth;
const canvasH = 750 / window.innerWidth * window.innerHeight;
this.anchorOffsetX = this.width / 2;
this.anchorOffsetY = this.height / 2;
this.x = canvasW / 2;
this.y = canvasH / 2;
egret.Tween.removeTweens(this);
egret.Tween.get(this).set({scaleX: 0, scaleY: 0}).to({
scaleX: 1,
scaleY: 1
}, 330, egret.Ease.backOut).call(() => {
setTimeout(() => {
egret.Tween.get(this).to({alpha: 0}, 500, egret.Ease.quadInOut).call(() => {
this.onTouchClose();
});
}, 800);
})
// egret.Tween.get(this).set({scaleX: 0, scaleY: 0}).to({
// scaleX: 1.1,
// scaleY: 1.1
// }, 230, egret.Ease.quadInOut).call(() => {
// egret.Tween.get(this).to({scaleX: 1, scaleY: 1}, 100, egret.Ease.quadInOut).call(() => {
// setTimeout(() => {
// egret.Tween.get(this).to({alpha: 0}, 500, egret.Ease.quintOut).call(() => {
// this.onTouchClose();
// });
// }, 800);
//
// })
// })
}
}
\ No newline at end of file
import { loadSvga } from "../../comm/loadSvga";
export default class EffectMgr {
private static _instance:EffectMgr;
public static get ins(){
return this._instance || (this._instance = new EffectMgr());
}
constructor() {
}
// public addSvga(url: string, parent?: egret.DisplayObjectContainer){
// loadSvga(url, parent).then(
//
// )
// }
}
\ No newline at end of file
......@@ -3,20 +3,21 @@ import IndexUI from "./IndexUI";
import LandMgr from "./LandMgr";
import OptionPanel, { GDispatchHideOption } from "./Objs/OptionPanel";
import Dispatcher from "../../comm/Dispatcher";
import ProgressMgr from "./ProgressMgr";
////////////////// Instance //////////////////
let instance = null;
const IndexInstance = function() {
const IndexIns = function():IndexScene {
return instance;
};
const SetIndexInstance = function(ins) {
const SetIndexInstance = function(ins:IndexScene) {
instance = ins;
};
const DestroyIndexInstance = function() {
instance = null;
};
export { IndexInstance };
export { IndexIns };
////////////////// Instance //////////////////
// Index场景的事件收发器
......@@ -34,11 +35,13 @@ const DestroyDispatcher = function() {
* 主场景
*/
export default class IndexScene extends Scene {
public bg: eui.Image;
public gameLayer: eui.Group;
public group:eui.Group;
public bg:eui.Image;
public gameLayer:eui.Group;
private indexUI: IndexUI;
private optionPanel: OptionPanel;
public optionPanel: OptionPanel;
public progressMgr: ProgressMgr;
constructor(data?) {
super(data);
......@@ -54,22 +57,28 @@ export default class IndexScene extends Scene {
}
private initUI(): void {
this.group.height = 750 / window.innerWidth * window.innerHeight;
// 创建UI层
this.indexUI = new IndexUI();
this.addChild(this.indexUI);
// 创建进度条管理器
this.progressMgr = new ProgressMgr();
// 创建土地管理器
this.gameLayer.touchEnabled = false;
this.landMgr = new LandMgr(this, this.gameLayer);
this.landMgr = new LandMgr(this);
// 创建操作Panel(初始为隐藏状态)
this.optionPanel = OptionPanel.getInstance();
this.addChild(this.optionPanel);
this.gameLayer.addChildAt(this.optionPanel, 100);
}
destroy() {
super.destroy();
/// TODO 可能的需要清除的东西
DestroyIndexInstance(); // 清除单例
DestroyDispatcher(); // 删除局部收发器
OptionPanel.destroy();
......
import ComponentBase from "../../components/ComponentBase";
import { GDispatchHideOption } from "./Objs/OptionPanel";
import PanelCtrl from "../../ctrls/panelCtrl";
import { ModuleTypes } from "../../types/sceneTypes";
import { showToast } from "../../comm/UtilsConst";
export default class IndexUI extends ComponentBase {
public uiLayer:eui.Group;
......@@ -7,8 +10,11 @@ export default class IndexUI extends ComponentBase {
public taskBtn:eui.Button;
public warehouseBtn:eui.Button;
public propPanel:eui.Group;
public speedGroup:eui.Group;
public speedNum:eui.Label;
public foodGroup:eui.Group;
public foodNum:eui.Label;
public waterGroup:eui.Group;
public waterNum:eui.Label;
public avatarPanel:eui.Group;
public avatarImg:eui.Image;
......@@ -17,9 +23,9 @@ export default class IndexUI extends ComponentBase {
public userGold:eui.Label;
public medal:eui.Image;
constructor() {
super();
this.initUI();
}
protected getTapEvts(): any[] {
......@@ -27,17 +33,38 @@ export default class IndexUI extends ComponentBase {
[this, GDispatchHideOption, this],
[this.taskBtn, this.onTap, this],
[this.warehouseBtn, this.onTap, this],
]).concat([ // OptionPanel
[this.foodGroup, this.onTapOption, this],
[this['waterGroup'], this.onTapOption, this],
[this['speedGroup'], this.onTapOption, this],
])
}
onTap(e:egret.TouchEvent){
private onTapOption(e: egret.TouchEvent) {
switch(e.target) {
case this.foodGroup:
showToast('点击饿了的动物才能进行喂食哦');
break;
case this['waterGroup']:
showToast('点击渴了的植物才能浇水哦');
break;
case this['speedGroup']:
break;
default:
break;
}
}
/// TODO 定义详细操作
private onTap(e: egret.TouchEvent) {
switch(e.target) {
case this.taskBtn: // 任务按钮
console.log('任务');
PanelCtrl.instance.show(ModuleTypes.TASK_PANEL);
break;
case this.warehouseBtn: // 仓库按钮
console.log('仓库');
PanelCtrl.instance.show(ModuleTypes.WAREHOUSE_PANEL);
break;
default:
......@@ -47,12 +74,17 @@ export default class IndexUI extends ComponentBase {
protected start() {
super.start();
this.initUI();
}
private initUI(): void {
// this.touchChildren = true; // 保证空白处不可点击,且UI可点击
this.uiLayer.height = 750 / window.innerWidth * window.innerHeight;
this.touchEnabled = true;
/////////////// 根据数据初始化道具Panel ///////////////
/// TODO 根据数据初始化道具Panel
this.foodNum.text = "×" + 30;
this.waterNum.text = "×" + 30;
/// TODO 根据数据初始化头像Panel
}
......
import Land from "./Objs/Land";
import { IndexDispatcher } from "./IndexScene";
import { IndexDispatcher, IndexIns } from "./IndexScene";
const landPos = [ // 地块位置(注意顺序,影响层级)
{x: 156, y: 636},
{x: 368, y: 739},
{x: 68, y: 842},
{x: 302, y: 958},
{x: 190, y: 664},
{x: 406, y: 768},
{x: 58, y: 846},
{x: 298, y: 962},
];
export default class LandMgr {
......@@ -14,13 +14,10 @@ export default class LandMgr {
return this._parent;
}
private landLayer;
private lands: Land[] = [];
constructor(parent: egret.DisplayObject, landLayer) {
constructor(parent: egret.DisplayObject) {
this._parent = parent;
this.landLayer = landLayer;
this.initEvents();
......@@ -40,10 +37,8 @@ export default class LandMgr {
*/
private addLand() {
for(let i = 0; i < landPos.length; i++) {
let newLand = new Land({index: i});
newLand.x = landPos[i].x;
newLand.y = landPos[i].y;
this.landLayer.addChild(newLand);
let newLand = new Land({index: i+1, x:landPos[i].x, y:landPos[i].y});
IndexIns().gameLayer.addChildAt(newLand, 1+i);
this.lands.push(newLand); // 加入数组方便管理
}
}
......
......@@ -22,7 +22,8 @@ const CROP_Y = -18;
* 作物类
*/
export default class Crop extends eui.Component {
public cropImg: eui.Image;
public cropImg:eui.Image;
public optionImg:eui.Image;
private data = null;
......@@ -43,7 +44,7 @@ export default class Crop extends eui.Component {
}
private initUI() {
/////////////// 根据数据添加Crop 初始化状态 ///////////////
/// TODO 根据数据添加Crop 初始化状态
this.changeType(CROP_TYPE.NONE);
this.changeState(CROP_STATE.NONE);
}
......@@ -58,6 +59,9 @@ export default class Crop extends eui.Component {
this.state = state; // 设置状态
this._type != -1 && this.state != -1 && (this.cropImg.source = `plant_${this._type}_${this.state}_png`);
this.optionImg.visible = (this.state==CROP_STATE.DONE);
/// TODO 定义详细的状态积
switch(this.state) {
case CROP_STATE.NONE: // 啥也没有
......@@ -85,6 +89,8 @@ export default class Crop extends eui.Component {
this._type = type; // 设置状态
this._type != -1 && this.state != -1 && (this.cropImg.source = `plant_${this._type}_${this.state}_png`);
/// TODO 定义详细类型积
switch(this._type) {
case CROP_TYPE.NONE: // 啥也没有
......
/// TODO 可能需要的Data
let GameData = {
};
\ No newline at end of file
import { getSkinPath } from "../../../utils";
import Crop from "./Crop";
import { IndexDispatcher } from "../IndexScene";
import { IndexDispatcher, IndexIns } from "../IndexScene";
import TimeProgressBar from "../TimeProgressBar";
enum LAND_STATE {
......@@ -20,9 +20,9 @@ export default class Land extends eui.Component {
private data = null;
private index;
public index;
private state: LAND_STATE;
public state: LAND_STATE;
private crop: Crop;
private progressBar: TimeProgressBar;
......@@ -32,10 +32,18 @@ export default class Land extends eui.Component {
this.data = data || null;
this.index = data.index;
this.x = data.x;
this.y = data.y;
this.setTouchOption(); // 设置点击参数
this.initEvents(); // 注册事件
/// TODO 根据数据改变状态
if(this.index == 0 || this.index == 3) {
this.changeState(LAND_STATE.ANIMAL);
} else {
this.changeState(LAND_STATE.NONE);
}
this.initUI(); // 设置显示
}
......@@ -62,27 +70,33 @@ export default class Land extends eui.Component {
}
private onTap() {
console.log(`点击了第${this.index}块土地`);
console.log(`点击了第${this.index}块土地, 当前状态是${this.state}`);
if(this.state != LAND_STATE.NONE) {
IndexDispatcher.dispatchEvent('hideOption');
return;
}
// 显示操作
// 显示Option
IndexDispatcher.dispatchEvent('showOption', {index: this.index, pos: {x: this.x, y: this.y}});
this.changeState(LAND_STATE.ACTIVE);
}
private initUI() {
/////////////// 根据数据添加Crop 初始化状态 ///////////////
this.changeState(LAND_STATE.NONE);
/// TODO 根据数据添加Crop 初始化状态
this.crop = new Crop();
this.addChildAt(this.crop, 2);
}
private addProgress() {
/////////////// 根据数据添加进度条 ///////////////
this.progressBar && this.progressBar.stop();
this.progressBar = new TimeProgressBar('鸡', 1574684000000, 1574684500000, 1574685000000, this.state);
this.addChild(this.progressBar);
/// TODO 根据数据添加进度条
IndexIns().progressMgr.addProgress({
index: this.index,
x: this.x + 88,
y: this.y + 193,
text: '鸡',
sTime: 1574684000000,
nTime: 1574684500000,
eTime: 1574685000000
})
}
......@@ -98,6 +112,7 @@ export default class Land extends eui.Component {
this.fence.visible = (this.state == LAND_STATE.ANIMAL); // 显示栅栏
this.trough.visible = (this.state == LAND_STATE.ANIMAL); // 显示食槽
/// TODO 定义状态积详情
switch(this.state) {
case LAND_STATE.NONE: // 啥也没有
......
import { getSkinPath } from "../../../utils";
import { IndexDispatcher } from "../IndexScene";
import { GDispatcher } from "../../../../libs/tc/util/GDispatcher";
// 触发Option隐藏
const GDispatchHideOption = function(){
const GDispatchHideOption = function() {
IndexDispatcher.dispatchEvent('hideOption');
};
export {GDispatchHideOption};
export { GDispatchHideOption };
/**
......@@ -19,13 +20,16 @@ export default class OptionPanel extends eui.Component {
private data = null;
////////////////////// 单例 //////////////////////
private static _instance:OptionPanel = null;
public static getInstance(data?){
private static _instance: OptionPanel = null;
public static getInstance(data?) {
return OptionPanel._instance || (OptionPanel._instance = new OptionPanel(data))
}
public static destroy(){
public static destroy() {
this._instance = null;
}
////////////////////// 单例 //////////////////////
constructor(data?) {
......@@ -44,26 +48,36 @@ export default class OptionPanel extends eui.Component {
IndexDispatcher.addEvent('hideOption', this.hideOption, this);
}
private showOption(data?){
IndexDispatcher.dispatchEvent("hideOption"); // 先触发隐藏,保证地块
private showOption(data?) {
console.log(data);
IndexDispatcher.dispatchEvent("hideOption"); // 先触发隐藏,保证地块正常显示
this.visible = true;
this.touchEnabled = true;
this.touchChildren = true;
this.x = data.pos.x + 52;
this.y = data.pos.y - 70;
this.x = data.pos.x + 190;
this.y = data.pos.y + 90;
egret.Tween.removeTweens(this);
egret.Tween.get(this).set({alpha: 0}).to({alpha: 1}, 170);
egret.Tween.get(this).set({scaleX: 0, scaleY: 0}).to({scaleX: 1, scaleY: 1}, 500, egret.Ease.backOut);
}
private hideOption(){
if(!this.visible){
private hideOption() {
if(!this.visible) {
return;
}
this.visible = false;
this.touchEnabled = false;
this.touchChildren = false;
egret.Tween.removeTweens(this);
egret.Tween.get(this).to({alpha: 0}, 170);
egret.Tween.get(this).to({scaleX: 0, scaleY: 0}, 500, egret.Ease.quartInOut).call(() => {
this.visible = false;
})
}
/// TODO 定义详细的操作
private onTap(e: egret.TouchEvent) {
switch(e.target) {
const target = e.target;
switch(target) {
case this.wheatBtn:
console.log('点击了小麦');
break;
......@@ -75,11 +89,19 @@ export default class OptionPanel extends eui.Component {
default:
break;
}
// 0s(100%,100%)-0.1s(120%,120%)-0.2s(100%,100%)
egret.Tween.get(target).to({scaleX: 1.2, scaleY: 1.2}, 100, egret.Ease.quadIn).call(() => {
egret.Tween.get(target).to({scaleX: 1, scaleY: 1}, 100, egret.Ease.quadOut).call(() => {
IndexDispatcher.dispatchEvent('hideOption');
})
})
}
private initUI() {
this.hideOption();
this.x = 100;
this.y = 200;
this.anchorOffsetX = this.width / 2;
this.anchorOffsetY = this.height;
}
}
\ No newline at end of file
import TimeProgressBar from "./TimeProgressBar";
import { IndexIns } from "./IndexScene";
export default class ProgressMgr {
private progressBars = {};
constructor() {
}
public addProgress(data) {
/// TODO 根据数据添加进度条
// this.progressBar && this.progressBar.stop();
let {x, y, index, text, sTime, nTime, eTime, state} = data;
let progressBar = new TimeProgressBar(index, text, sTime, nTime, eTime, state);
progressBar.x = x;
progressBar.y = y;
IndexIns().gameLayer.addChildAt(progressBar, 100);
this.progressBars[index] = progressBar;
}
public removeProgress(index){
this.progressBars[index].stop();
}
}
\ No newline at end of file
import { getSkinPath } from "../../utils";
const PROGRESS_X = 88;
const PROGRESS_Y = 190;
import { IndexDispatcher } from "./IndexScene";
export default class TimeProgressBar extends eui.Component {
public bg: eui.Rect;
......@@ -16,12 +14,12 @@ export default class TimeProgressBar extends eui.Component {
private nowTime: number;
private endTime: number;
private cTime:number;
private cTime: number;
private progressText = '';
private _timer: egret.Timer = null;
constructor(labelText, startTime, nowTime, endTime, type) {
constructor(index, labelText, startTime, nowTime, endTime, type) {
super();
this.skinName = getSkinPath('Component/TimeProgressBar');
......@@ -37,8 +35,10 @@ export default class TimeProgressBar extends eui.Component {
}
this.initUI();
this.x = PROGRESS_X;
this.y = PROGRESS_Y;
this.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
IndexDispatcher.dispatchEvent('hideOption');
}, this)
}
private initUI() {
......@@ -69,7 +69,7 @@ export default class TimeProgressBar extends eui.Component {
this.setProgress();
}
public stop(){
public stop() {
this._timer && this._timer.stop();
}
......
......@@ -10,6 +10,9 @@ export default class PanelCtrl {
private _current: Panel;
private canvasH = 750 / window.innerWidth * window.innerHeight;
private canvasW = 750 / window.innerWidth * window.innerWidth;
static get instance() {
return PanelCtrl._instance || (PanelCtrl._instance = new PanelCtrl())
}
......@@ -46,7 +49,7 @@ export default class PanelCtrl {
* @param data 数据
* @param afterAni
*/
public show(type: ModuleTypes, data?, afterAni?: Function) {
public show(type: ModuleTypes, data?) {
if (this._current) {
this.remove(this._current, true);
this._current = null;
......@@ -60,7 +63,7 @@ export default class PanelCtrl {
this._current = panel;
this.add(panel);
panel.visible = false;
// panel.visible = false; /// TODO 不知道谁干的,有什么用?
panel.onShowAnim(); // 自定义显示动画
return panel;
}
......@@ -72,8 +75,8 @@ export default class PanelCtrl {
if(!this._mask) {
this._mask = new egret.Sprite();
this._mask.touchEnabled = true;
this._mask.graphics.beginFill(0, .7);
this._mask.graphics.drawRect(0, 0, 750, 1624);
this._mask.graphics.beginFill(0, .4);
this._mask.graphics.drawRect(0, 0, this.canvasW, this.canvasH);
this._mask.graphics.endFill();
}
this._mask.alpha = 1;
......
import { ModuleTypes } from "../types/sceneTypes";
import Panel from "../views/Panel";
import Loading from "../loading/Loading";
export default class TopLayerCtrl {
private _parent: eui.UILayer;
private _mask: egret.Shape;
private _mask: egret.Sprite;
static _instance: TopLayerCtrl;
static get instance() {
return TopLayerCtrl._instance || (TopLayerCtrl._instance = new TopLayerCtrl())
}
private canvasH = 750 / window.innerWidth * window.innerHeight;
private canvasW = 750 / window.innerWidth * window.innerWidth;
init(parent: eui.UILayer) {
this._parent = parent;
}
show(type: ModuleTypes, data?, hasMask: boolean = true, time: number = 2500) {
show(type: ModuleTypes, data?, maskAlpha: number = 0) {
const cls = this._panelClassMap[type];
Loading.instace.show();
const panel: Panel = new cls(data, hasMask, time);
const panel: Panel = new cls(data);
this._current = panel;
this.addMask(maskAlpha);
this.add(panel);
this._parent.visible = true;
}
/**
* 加入黑色蒙层
*/
private addMask(maskAlpha: number) {
if(!this._mask) {
this._mask = new egret.Sprite();
this._mask.touchEnabled = true;
this._mask.graphics.beginFill(0, maskAlpha);
this._mask.graphics.drawRect(0, 0, this.canvasW, this.canvasH);
this._mask.graphics.endFill();
}
this._mask.alpha = 1;
this._parent.addChild(this._mask);
}
// if(isToast){
// setTimeout(() => {
// this.panelHide(panel);
// }, time);
// }
/**
* 移除蒙层
*/
removeMask(rightNow = false) {
if(this._mask) {
if(rightNow) {
this._parent.removeChild(this._mask);
} else
egret.Tween.get(this._mask).to({alpha: 0}, 300, egret.Ease.quartIn).call(
() => this._parent.removeChild(this._mask), this);
}
this._parent.visible = false;
}
/**
......@@ -48,6 +74,7 @@ export default class TopLayerCtrl {
private add(panel: Panel) {
this._parent.addChild(panel);
panel.onShowAnim();
panel.addEventListener('onDestroy', this.onPanelHide, this);
}
......@@ -59,32 +86,38 @@ export default class TopLayerCtrl {
const panel = e.target as Panel;
panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel);
this.removeMask();
if (this._parent.numChildren == 0) {
if(this._parent.numChildren == 0) {
this._parent.visible = false;
}
}
private panelHide(panel:Panel):void{
private panelHide(panel: Panel): void {
panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel);
if (this._parent.numChildren == 0) {
if(this._parent.numChildren == 0) {
this._parent.visible = false;
}
}
private _panelClassMap: any;
registerPanelClass(name, definition) {
this._panelClassMap = this._panelClassMap || {};
this._panelClassMap[name] = definition;
}
public registerPanels(panels) {
panels.forEach(v => this.registerPanelClass(v[0], v[1]))
}
private _current: Panel;
closeCurrent() {
if (this._current)
if(this._current)
this.remove(this._current);
}
}
\ No newline at end of file
......@@ -2,6 +2,12 @@ import { ModuleTypes } from "./sceneTypes";
import IndexScene from "../Scenes/IndexScene/IndexScene";
import LoadingScene from "../Scenes/loadingScene/LoadingScene";
import RulePanel from "../Panels/RulePanel/RulePanel";
import TaskPanel from "../Panels/TaskPanel";
import WareHousePanel from "../Panels/WareHousePanel";
import ToastPanel from "../Panels/toastPanel/ToastPanel";
import TaskToast from "../Panels/TaskToast";
import SellRecord from "../Panels/SellRecord";
import SellPanel from "../Panels/SellPanel";
let Scenes = [
[ModuleTypes.LOADING_SCENE, LoadingScene],
......@@ -10,6 +16,15 @@ let Scenes = [
let Panels = [
[ModuleTypes.RULE_PANEL, RulePanel],
[ModuleTypes.TASK_PANEL, TaskPanel],
[ModuleTypes.WAREHOUSE_PANEL, WareHousePanel],
];
export {Scenes, Panels}
\ No newline at end of file
let Tops = [
[ModuleTypes.TOAST_PANEL, ToastPanel],
[ModuleTypes.TASK_TOAST, TaskToast],
[ModuleTypes.SELL_RECORD, SellRecord],
[ModuleTypes.SELL_PANEL, SellPanel],
];
export {Scenes, Panels, Tops}
\ No newline at end of file
......@@ -5,15 +5,11 @@ export enum ModuleTypes {
///
INDEX_SCENE,
CREDITS_TIP_PANEL,
NO_MORE_PANEL,
NO_TIMES_PANEL,
NO_PRIZE_PANEL,
HBGAME_SCENE,
HBPRIZE_PANEL,
HBNOPRIZE_PANEL,
RULE_PANEL,
NO_NETWORK_PANEL,
TASK_PANEL,
TASK_TOAST,
WAREHOUSE_PANEL,
SELL_RECORD,
SELL_PANEL,
}
\ No newline at end of file
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