Commit 730dd9a3 authored by haiyoucuv's avatar haiyoucuv

fk

parent b1fd0154
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="DuplicatedCode" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlRequiredAltAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
"name": "main_scene" "name": "main_scene"
}, },
{ {
"keys": "兑换记录_png,浇水_png,流水装饰_png,默认头像_png,任务_png,商店_png,饲料_png,头像背景_png,勋章_png,头像面板_png,加速卡_png,仓库_btn_png", "keys": "兑换记录_png,浇水_png,流水装饰_png,默认头像_png,任务_png,商店_png,饲料_png,头像背景_png,勋章_png,头像面板_png,加速卡_png,仓库_btn_png,main_rule_png",
"name": "main_ui" "name": "main_ui"
}, },
{ {
"keys": "篱笆_png,plant_land_active_png,plant_land_animal_png,plant_land_none_png,plant_land_plant_png,食槽_png,_DS_Store,feed_png,hand_png,option_chicken_png,option_panel_png,option_wheat_png,water_png,麦粉_png,鸡蛋_png,option_cattle_png,light_png,玉米_png,牛奶_png,option_corn_png", "keys": "篱笆_png,plant_land_active_png,plant_land_animal_png,plant_land_none_png,plant_land_plant_png,食槽_png,_DS_Store,feed_png,hand_png,option_chicken_png,option_panel_png,option_wheat_png,water_png,麦粉_png,鸡蛋_png,option_cattle_png,light_png,玉米_png,牛奶_png,option_corn_png,土豆_png,核桃_png,免费邮寄到家_png,option_walnut_png,option_potato_png",
"name": "index_plant" "name": "index_plant"
}, },
{ {
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"name": "selled_panel" "name": "selled_panel"
}, },
{ {
"keys": "bar_bg_png,规则_png,路径 2_png", "keys": "bar_bg_png,规则_png,路径 2_png,分享_png",
"name": "bar" "name": "bar"
}, },
{ {
...@@ -75,6 +75,18 @@ ...@@ -75,6 +75,18 @@
{ {
"keys": "medal_btn_png,medal_sp_achv_1_png,medal_sp_achv_2_png,medal_light_bg_png,medal_light_png", "keys": "medal_btn_png,medal_sp_achv_1_png,medal_sp_achv_2_png,medal_light_bg_png,medal_light_png",
"name": "medal_panel" "name": "medal_panel"
},
{
"keys": "oldUserBg_png,oldUserBtn_png",
"name": "oldUser_panel"
},
{
"keys": "newUserBtn_png,newUserBg_png",
"name": "newUser_panel"
},
{
"keys": "introduce_wheat_png,introduce_walnut_png,introduce_potato_png,introduce_corn_png,introduce_chicken_png,introduce_cattle_png,introduce_bg_png,introduce_btn_png",
"name": "introduce_panel"
} }
], ],
"resources": [ "resources": [
...@@ -757,6 +769,101 @@ ...@@ -757,6 +769,101 @@
"url": "assets/exchange_panel/ex_titleImg.png", "url": "assets/exchange_panel/ex_titleImg.png",
"type": "image", "type": "image",
"name": "ex_titleImg_png" "name": "ex_titleImg_png"
},
{
"url": "assets/oldUser_panel/oldUserBg.png",
"type": "image",
"name": "oldUserBg_png"
},
{
"url": "assets/oldUser_panel/oldUserBtn.png",
"type": "image",
"name": "oldUserBtn_png"
},
{
"url": "assets/newUser_panel/newUserBtn.png",
"type": "image",
"name": "newUserBtn_png"
},
{
"url": "assets/newUser_panel/newUserBg.png",
"type": "image",
"name": "newUserBg_png"
},
{
"url": "assets/index_scene/ui/main_rule.png",
"type": "image",
"name": "main_rule_png"
},
{
"url": "assets/bar/分享.png",
"type": "image",
"name": "分享_png"
},
{
"url": "assets/introduce_panel/introduce_bg.png",
"type": "image",
"name": "introduce_bg_png"
},
{
"url": "assets/introduce_panel/introduce_cattle.png",
"type": "image",
"name": "introduce_cattle_png"
},
{
"url": "assets/introduce_panel/introduce_chicken.png",
"type": "image",
"name": "introduce_chicken_png"
},
{
"url": "assets/introduce_panel/introduce_corn.png",
"type": "image",
"name": "introduce_corn_png"
},
{
"url": "assets/introduce_panel/introduce_potato.png",
"type": "image",
"name": "introduce_potato_png"
},
{
"url": "assets/introduce_panel/introduce_wheat.png",
"type": "image",
"name": "introduce_wheat_png"
},
{
"url": "assets/introduce_panel/introduce_walnut.png",
"type": "image",
"name": "introduce_walnut_png"
},
{
"url": "assets/introduce_panel/introduce_btn.png",
"type": "image",
"name": "introduce_btn_png"
},
{
"url": "assets/index_scene/planting/土豆.png",
"type": "image",
"name": "土豆_png"
},
{
"url": "assets/index_scene/planting/核桃.png",
"type": "image",
"name": "核桃_png"
},
{
"url": "assets/index_scene/planting/option/免费邮寄到家.png",
"type": "image",
"name": "免费邮寄到家_png"
},
{
"url": "assets/index_scene/planting/option/option_walnut.png",
"type": "image",
"name": "option_walnut_png"
},
{
"url": "assets/index_scene/planting/option/option_potato.png",
"type": "image",
"name": "option_potato_png"
} }
] ]
} }
\ No newline at end of file
{ {
"skins": {}, "skins": {},
"autoGenerateExmlsList": true, "autoGenerateExmlsList": true,
"exmls": [ "exmls": [
"resource/skins/ExchangePanelSkin.exml", "resource/skins/ExchangePanelSkin.exml",
"resource/skins/ExchangedPanelSkin.exml", "resource/skins/ExchangedPanelSkin.exml",
"resource/skins/LoadingSceneSkin.exml", "resource/skins/LoadingSceneSkin.exml",
"resource/skins/LoadingSkin.exml", "resource/skins/OldUserPanelSkin.exml",
"resource/skins/MainSceneSkin.exml", "resource/skins/NewUserPanelSkin.exml",
"resource/skins/MainUISkin.exml", "resource/skins/IntroducePanelSkin.exml",
"resource/skins/MedalPanelSkin.exml", "resource/skins/LoadingSkin.exml",
"resource/skins/MedalsPanelSkin.exml", "resource/skins/MainSceneSkin.exml",
"resource/skins/RoomSceneSkin.exml", "resource/skins/MainUISkin.exml",
"resource/skins/RulePanelSkin.exml", "resource/skins/MedalPanelSkin.exml",
"resource/skins/SellPanelSkin.exml", "resource/skins/MedalsPanelSkin.exml",
"resource/skins/SellRecordItemSkin.exml", "resource/skins/RoomSceneSkin.exml",
"resource/skins/SellRecordSkin.exml", "resource/skins/RulePanelSkin.exml",
"resource/skins/SelledPanelSkin.exml", "resource/skins/SellPanelSkin.exml",
"resource/skins/ShopBuyPanelSkin.exml", "resource/skins/SellRecordItemSkin.exml",
"resource/skins/ShopItemSkin.exml", "resource/skins/SellRecordSkin.exml",
"resource/skins/ShopSceneSkin.exml", "resource/skins/SelledPanelSkin.exml",
"resource/skins/TaskItemSkin.exml", "resource/skins/ShopBuyPanelSkin.exml",
"resource/skins/TaskPanelSkin.exml", "resource/skins/ShopItemSkin.exml",
"resource/skins/TaskToastSkin.exml", "resource/skins/ShopSceneSkin.exml",
"resource/skins/ToastPanelSkin.exml", "resource/skins/TaskItemSkin.exml",
"resource/skins/WareHouseSkin.exml", "resource/skins/TaskPanelSkin.exml",
"resource/skins/Component/BarSkin.exml", "resource/skins/TaskToastSkin.exml",
"resource/skins/Component/ProgressNumSkin.exml", "resource/skins/ToastPanelSkin.exml",
"resource/skins/Component/TimeProgressBarSkin.exml", "resource/skins/WareHouseSkin.exml",
"resource/skins/Objs/CropSkin.exml", "resource/skins/Component/BarSkin.exml",
"resource/skins/Objs/LandSkin.exml", "resource/skins/Component/ProgressNumSkin.exml",
"resource/skins/Objs/MedalSkin.exml", "resource/skins/Component/TimeProgressBarSkin.exml",
"resource/skins/Objs/OptionPanelSkin.exml", "resource/skins/Objs/CropSkin.exml",
"resource/skins/ui/IconButtonSkin.exml", "resource/skins/Objs/LandSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml" "resource/skins/Objs/MedalSkin.exml",
], "resource/skins/Objs/OptionPanelSkin.exml",
"path": "resource/default.thm.json" "resource/skins/ui/IconButtonSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml"
],
"path": "resource/default.thm.json"
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="Bar" width="750" height="91" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="Bar" width="750" height="91" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="bar_bg_png" horizontalCenter="0" verticalCenter="0"/> <e:Image source="bar_bg_png" horizontalCenter="0" verticalCenter="0"/>
<e:Group id="rule" width="63" height="69" anchorOffsetX="0" anchorOffsetY="0" verticalCenter="0" right="30"> <e:Group id="share" width="63" height="69" anchorOffsetX="0" anchorOffsetY="0" verticalCenter="0" right="30">
<e:Image source="规则_png" scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0" touchEnabled="false"/> <e:Image scaleX="0.5" scaleY="0.5" horizontalCenter="0" verticalCenter="0" touchEnabled="false" source="分享_png"/>
</e:Group> </e:Group>
<e:Label id="title" text="工行卡中心" y="31.5" textColor="0x333333" horizontalCenter="0"/> <e:Label id="title" text="工行卡中心" y="31.5" textColor="0x333333" horizontalCenter="0"/>
<e:Group id="back" width="63" height="69" anchorOffsetX="0" anchorOffsetY="0" verticalCenter="0" left="30"> <e:Group id="back" width="63" height="69" anchorOffsetX="0" anchorOffsetY="0" verticalCenter="0" left="30">
......
...@@ -66,4 +66,5 @@ ...@@ -66,4 +66,5 @@
</e:skinName> </e:skinName>
</e:Button> </e:Button>
</e:Group> </e:Group>
<e:Image source="main_rule_png" x="569" y="602" id="rule"/>
</e:Skin> </e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="OptionPanel" width="589" height="160" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="OptionPanel" width="596" height="400" 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 source="option_panel_png" horizontalCenter="0" verticalCenter="0" alpha="0.8"/>
<e:Image id="wheatBtn" source="option_wheat_png" y="74" anchorOffsetX="43" anchorOffsetY="59" x="80"/> <e:Image id="chickBtn" source="option_chicken_png" x="112" anchorOffsetX="41" anchorOffsetY="56" bottom="235"/>
<e:Image id="chickBtn" source="option_chicken_png" y="72" x="369" anchorOffsetX="41" anchorOffsetY="56"/> <e:Image id="cattleBtn" source="option_cattle_png" anchorOffsetX="48.5" anchorOffsetY="58.5" x="298" bottom="235"/>
<e:Image id="cornBtn" source="option_corn_png" x="221" y="67" anchorOffsetX="47.5" anchorOffsetY="65"/> <e:Image id="cornBtn" source="option_corn_png" x="460" anchorOffsetX="47.5" anchorOffsetY="65" bottom="235"/>
<e:Image id="cattleBtn" source="option_cattle_png" y="71" anchorOffsetX="48.5" anchorOffsetY="58.5" x="509"/> <e:Image id="wheatBtn" source="option_wheat_png" anchorOffsetX="43" anchorOffsetY="59" x="114" bottom="55"/>
<e:Image id="potatoBtn" anchorOffsetX="43" anchorOffsetY="59" x="292.5" source="option_potato_png" bottom="55"/>
<e:Image id="walnutBtn0" anchorOffsetX="43" anchorOffsetY="59" x="456.5" source="option_walnut_png" bottom="55"/>
<e:Image source="免费邮寄到家_png" x="241.5" y="190"/>
<e:Image source="免费邮寄到家_png" x="405.5" y="190"/>
</e:Skin> </e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="CreditsTip" width="750" height="1335" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="CreditsTip" width="750" height="1335" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Button id="closeBtn" label="" y="996.52" horizontalCenter="0.5"> <e:Button id="closeBtn" label="" horizontalCenter="0.5" bottom="100">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeBtn_png" source.down="closeBtn_png" source.disabled="closeBtn_png"/> <e:Image width="100%" height="100%" source="closeBtn_png" source.down="closeBtn_png" source.disabled="closeBtn_png"/>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Label text="活动说明" y="140" bold="true" horizontalCenter="0"/> <e:Label text="活动说明" y="140" bold="true" horizontalCenter="0"/>
<e:Scroller y="205.97" anchorOffsetX="0" anchorOffsetY="0" height="750" width="628" horizontalCenter="0"> <e:Scroller anchorOffsetX="0" anchorOffsetY="0" width="628" horizontalCenter="0" top="200" bottom="230">
<e:Group anchorOffsetX="0" anchorOffsetY="0"> <e:Group anchorOffsetX="0" anchorOffsetY="0">
<e:Label id="ruleLabel" text="" anchorOffsetX="0" anchorOffsetY="0" scaleX="1" scaleY="1" width="628" y="0" lineSpacing="25" horizontalCenter="0" verticalAlign="justify"/> <e:Label id="ruleLabel" text="" anchorOffsetX="0" anchorOffsetY="0" scaleX="1" scaleY="1" width="628" y="0" lineSpacing="25" horizontalCenter="0" verticalAlign="justify"/>
</e:Group> </e:Group>
......
import Panel from "../views/Panel";
import TouchEvent = egret.TouchEvent;
import { petData } from "../Scenes/MainScene/Const";
import { M_HideOption, M_ShowOption } from "../Scenes/MainScene/Objs/OptionPanel";
export default class IntroducePanel extends Panel {
public closeBtn: eui.Button;
public btn: eui.Button;
public img: eui.Image;
public txt: eui.Label;
public get skinKey() {
return 'IntroducePanel'
}
public get groupName() {
return 'introduce_panel'
}
constructor(data?) {
super(data);
}
public initEvents() {
super.initEvents();
this.btn.addEventListener(TouchEvent.TOUCH_TAP, this.tapBtn, this);
}
public removeEvents() {
super.removeEvents();
this.btn.removeEventListener(TouchEvent.TOUCH_TAP, this.tapBtn, this);
}
private tapBtn(){
this.data.call && this.data.call();
super.hidePanel();
}
public hidePanel() {
super.hidePanel();
// M_ShowOption(this.data.landId);
}
protected start() {
super.start();
this.initUI();
}
private initUI(): void {
this.img.source = `introduce_${petData[this.data.petId || 0].key}_png`;
}
}
import Panel from "../views/Panel";
import TouchEvent = egret.TouchEvent;
export default class NewUserPanel extends Panel {
public closeBtn: eui.Button;
public btn: eui.Button;
public get skinKey() {
return 'NewUserPanel'
}
public get groupName() {
return 'newUser_panel'
}
constructor(data?) {
super(data);
}
protected start() {
super.start();
}
public initEvents() {
super.initEvents();
this.btn.addEventListener(TouchEvent.TOUCH_TAP, this.hidePanel, this);
}
public removeEvents() {
super.removeEvents();
this.btn.removeEventListener(TouchEvent.TOUCH_TAP, this.hidePanel, this);
}
}
import Panel from "../views/Panel";
import TouchEvent = egret.TouchEvent;
export default class OldUserPanel extends Panel {
public closeBtn: eui.Button;
public btn: eui.Button;
public get skinKey() {
return 'OldUserPanel'
}
public get groupName() {
return 'oldUser_panel'
}
constructor(data?) {
super(data);
}
protected start() {
super.start();
}
public initEvents() {
super.initEvents();
this.btn.addEventListener(TouchEvent.TOUCH_TAP, this.hidePanel, this);
}
public removeEvents() {
super.removeEvents();
this.btn.removeEventListener(TouchEvent.TOUCH_TAP, this.hidePanel, this);
}
}
import Panel from "../views/Panel"; import Panel from "../views/Panel";
import { HtmlTextParser } from "../../libs/tc/util/HtmlTextParser"; import { HtmlTextParser } from "../../libs/tc/util/HtmlTextParser";
import { DataManager } from "../../libs/tw/manager/DataManager";
import { NetName } from "../../libs/tw/enum/NetName";
import TopLayerCtrl from "../ctrls/topLayerCtrl"; import TopLayerCtrl from "../ctrls/topLayerCtrl";
export default class RulePanel extends Panel { export default class RulePanel extends Panel {
...@@ -30,4 +28,4 @@ export default class RulePanel extends Panel { ...@@ -30,4 +28,4 @@ export default class RulePanel extends Panel {
let rule = window['rule']; let rule = window['rule'];
this.ruleLabel.textFlow = new HtmlTextParser().parser(rule); this.ruleLabel.textFlow = new HtmlTextParser().parser(rule);
} }
} }
\ No newline at end of file
export enum CROP_TYPE {
NONE = 0, // 啥也没有
CHICKEN = 1, // 鸡
WHEAT = 2, // 牛
CORN = 3, // 玉米
CATTLE = 4, // 牛
}
export let petData = {
0: { // 啥也没有
key: '',
name: '',
type: '',
pos: [],
propId: '',
optionSvga: '',
option: '',
catherImg: ''
},
1: { // 鸡
key: 'chicken',
name: '鸡',
type: 'animal',
pos: [-65, -162],
propId: 'sp_food_1',
optionSvga: 'ready_feed',
option: 'feed',
catherImg: '鸡蛋'
},
2: { // 小麦
key: 'wheat',
name: '小麦',
type: 'plant',
pos: [-65, -140],
propId: 'sp_food_2',
optionSvga: 'ready_water',
option: 'water',
catherImg: '麦粉'
},
3: { // 玉米
key: 'corn',
name: '玉米',
type: 'plant',
pos: [-65, -140],
catherPos: [-65, -180],
propId: 'sp_food_2',
optionSvga: 'ready_water',
option: 'water',
catherImg: '玉米',
},
4: { // 牛
key: 'cattle',
name: '牛',
type: 'animal',
pos: [-70, -145],
prop: 'food',
propId: 'sp_food_1',
optionSvga: 'ready_feed',
option: 'feed',
catherImg: '牛奶',
},
};
...@@ -4,6 +4,10 @@ import LandMgr from "./LandMgr"; ...@@ -4,6 +4,10 @@ import LandMgr from "./LandMgr";
import OptionPanel, { M_HideOption } from "./Objs/OptionPanel"; import OptionPanel, { M_HideOption } from "./Objs/OptionPanel";
import Dispatcher from "../../comm/Dispatcher"; import Dispatcher from "../../comm/Dispatcher";
import ProgressMgr from "./ProgressMgr"; import ProgressMgr from "./ProgressMgr";
import PanelCtrl from "../../ctrls/panelCtrl";
import { ModuleTypes } from "../../types/sceneTypes";
import RulePanel from "../../Panels/RulePanel";
import IntroducePanel from "../../Panels/IntroducePanel";
////////////////// Instance ////////////////// ////////////////// Instance //////////////////
let instance: MainScene = null; let instance: MainScene = null;
...@@ -58,6 +62,7 @@ export default class MainScene extends Scene { ...@@ -58,6 +62,7 @@ export default class MainScene extends Scene {
public group: eui.Group; public group: eui.Group;
public bg: eui.Image; public bg: eui.Image;
public gameLayer: eui.Group; public gameLayer: eui.Group;
public rule: eui.Image;
public mainUI: MainUI; public mainUI: MainUI;
public optionPanel: OptionPanel; public optionPanel: OptionPanel;
...@@ -118,10 +123,11 @@ export default class MainScene extends Scene { ...@@ -118,10 +123,11 @@ export default class MainScene extends Scene {
} }
private onTouchTap(e: egret.TouchEvent) { private onTouchTap(e: egret.TouchEvent) {
switch(e.target) { switch (e.target) {
case this.bg: case this.bg:
M_HideOption(); M_HideOption();
break; break;
default: default:
break; break;
} }
...@@ -139,4 +145,4 @@ export default class MainScene extends Scene { ...@@ -139,4 +145,4 @@ export default class MainScene extends Scene {
return 'main_scene' return 'main_scene'
} }
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ import { getSvga } from "../../utils"; ...@@ -11,6 +11,7 @@ import { getSvga } from "../../utils";
import { getlogItem } from "../../comm/getlogItem"; import { getlogItem } from "../../comm/getlogItem";
import SceneCtrl from "../../ctrls/sceneCtrl"; import SceneCtrl from "../../ctrls/sceneCtrl";
import { G_GetHomeDataByKey, G_SetHomeDataByKey, G_UpdateHomeData, HOME } from "../Home"; import { G_GetHomeDataByKey, G_SetHomeDataByKey, G_UpdateHomeData, HOME } from "../Home";
import RulePanel from "../../Panels/RulePanel";
export let propData = { export let propData = {
sp_food_1: {name: 'food',}, sp_food_1: {name: 'food',},
...@@ -42,6 +43,8 @@ export default class MainUI extends ComponentBase { ...@@ -42,6 +43,8 @@ export default class MainUI extends ComponentBase {
public tipLabelMask: eui.Rect; public tipLabelMask: eui.Rect;
public recordBtn: eui.Button; public recordBtn: eui.Button;
public shopBtn: eui.Button; public shopBtn: eui.Button;
public rule:eui.Image;
private tip1; private tip1;
private tip2; private tip2;
...@@ -59,6 +62,7 @@ export default class MainUI extends ComponentBase { ...@@ -59,6 +62,7 @@ export default class MainUI extends ComponentBase {
[this.shopBtn, this.onTap, this], [this.shopBtn, this.onTap, this],
[this.avatarImg, this.onTap, this], [this.avatarImg, this.onTap, this],
[this.houseBtn, this.onTap, this], [this.houseBtn, this.onTap, this],
[this.rule, this.onTap, this],
]).concat([ // OptionPanel ]).concat([ // OptionPanel
[this.foodGroup, this.onTapOption, this], [this.foodGroup, this.onTapOption, this],
[this.waterGroup, this.onTapOption, this], [this.waterGroup, this.onTapOption, this],
...@@ -121,6 +125,10 @@ export default class MainUI extends ComponentBase { ...@@ -121,6 +125,10 @@ export default class MainUI extends ComponentBase {
case this.houseBtn: case this.houseBtn:
SceneCtrl.instance.change(ModuleTypes.ROOM_SCENE); SceneCtrl.instance.change(ModuleTypes.ROOM_SCENE);
break; break;
case this.rule:
PanelCtrl.instance.show(RulePanel);
break;
default: default:
break; break;
} }
...@@ -139,6 +147,7 @@ export default class MainUI extends ComponentBase { ...@@ -139,6 +147,7 @@ export default class MainUI extends ComponentBase {
this.warehouseBtn.anchorOffsetY = 60.5; this.warehouseBtn.anchorOffsetY = 60.5;
this.houseBtn.y = (this.houseBtn.y - (MainIns().gameLayer.height - MainIns().group.height) / 2); this.houseBtn.y = (this.houseBtn.y - (MainIns().gameLayer.height - MainIns().group.height) / 2);
this.rule.y = (this.rule.y - (MainIns().gameLayer.height - MainIns().group.height) / 2);
this.avatarImg.mask = this.avatarMask; this.avatarImg.mask = this.avatarMask;
...@@ -284,4 +293,4 @@ export default class MainUI extends ComponentBase { ...@@ -284,4 +293,4 @@ export default class MainUI extends ComponentBase {
public get groupName() { public get groupName() {
return 'main_ui'; return 'main_ui';
} }
} }
\ No newline at end of file
This diff is collapsed.
...@@ -5,6 +5,14 @@ import { btnDelay } from "../../../comm/UtilsConst"; ...@@ -5,6 +5,14 @@ import { btnDelay } from "../../../comm/UtilsConst";
import { M_Plant } from "../LandMgr"; import { M_Plant } from "../LandMgr";
import M_EVENT from "../MSceneEnum"; import M_EVENT from "../MSceneEnum";
import { G_JudgeMedalPanel } from "../../Home"; import { G_JudgeMedalPanel } from "../../Home";
import PanelCtrl from "../../../ctrls/panelCtrl";
import IntroducePanel from "../../../Panels/IntroducePanel";
import Tween = egret.Tween;
import Ease = egret.Ease;
import { CROP_TYPE } from "../Const";
import TouchEvent = egret.TouchEvent;
import Image = eui.Image;
import Component = eui.Component;
// 触发Option隐藏 // 触发Option隐藏
const M_HideOption = function() { const M_HideOption = function() {
...@@ -20,11 +28,14 @@ export { M_HideOption, M_ShowOption }; ...@@ -20,11 +28,14 @@ export { M_HideOption, M_ShowOption };
/** /**
* 操作面板 * 操作面板
*/ */
export default class OptionPanel extends eui.Component { export default class OptionPanel extends Component {
public chickBtn: eui.Image; public chickBtn: Image;
public wheatBtn: eui.Image; public cattleBtn: Image;
public cattleBtn: eui.Image; public cornBtn: Image;
public cornBtn: eui.Image; public wheatBtn: Image;
public potatoBtn: Image;
public walnutBtn0: Image;
private data = null; private data = null;
...@@ -53,7 +64,7 @@ export default class OptionPanel extends eui.Component { ...@@ -53,7 +64,7 @@ export default class OptionPanel extends eui.Component {
private initEvents() { private initEvents() {
[this.wheatBtn, this.chickBtn, this.cattleBtn, this.cornBtn].forEach((v) => { [this.wheatBtn, this.chickBtn, this.cattleBtn, this.cornBtn].forEach((v) => {
v.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap, this); v.addEventListener(TouchEvent.TOUCH_TAP, this.onTap, this);
}); });
MainDispatcher.addEvent(M_EVENT.SHOW_OPTION, this.showOption, this); MainDispatcher.addEvent(M_EVENT.SHOW_OPTION, this.showOption, this);
MainDispatcher.addEvent(M_EVENT.HIDE_OPTION, this.hideOption, this); MainDispatcher.addEvent(M_EVENT.HIDE_OPTION, this.hideOption, this);
...@@ -61,7 +72,7 @@ export default class OptionPanel extends eui.Component { ...@@ -61,7 +72,7 @@ export default class OptionPanel extends eui.Component {
private removeEvents() { private removeEvents() {
[this.wheatBtn, this.chickBtn, this.cattleBtn, this.cornBtn].forEach((v) => { [this.wheatBtn, this.chickBtn, this.cattleBtn, this.cornBtn].forEach((v) => {
v.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap, this); v.removeEventListener(TouchEvent.TOUCH_TAP, this.onTap, this);
}); });
MainDispatcher.removeEvent(M_EVENT.SHOW_OPTION, this.showOption, this); MainDispatcher.removeEvent(M_EVENT.SHOW_OPTION, this.showOption, this);
MainDispatcher.removeEvent(M_EVENT.HIDE_OPTION, this.hideOption, this); MainDispatcher.removeEvent(M_EVENT.HIDE_OPTION, this.hideOption, this);
...@@ -71,79 +82,80 @@ export default class OptionPanel extends eui.Component { ...@@ -71,79 +82,80 @@ export default class OptionPanel extends eui.Component {
console.log(data); console.log(data);
this.data = data; this.data = data;
M_HideOption(); // 先触发隐藏,保证地块正常显示 M_HideOption(); // 先触发隐藏,保证地块正常显示
egret.Tween.removeTweens(this); Tween.removeTweens(this);
// if(this.visible){
// return;
// }
this.touchEnabled = true; this.touchEnabled = true;
this.touchChildren = true; this.touchChildren = true;
// this.x = data.pos.x + 190;
// this.y = data.pos.y + 90 - (MainIns().gameLayer.height - MainIns().group.height) / 2;
// egret.Tween.removeTweens(this);
this.alpha = 1; this.alpha = 1;
if(this.visible) { if (this.visible) {
return; return;
} }
this.visible = true; this.visible = true;
egret.Tween.get(this).set({alpha: 0}).to({alpha: 1}, 170); 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() { private hideOption() {
if(!this.visible) { if (!this.visible) {
return; return;
} }
this.touchEnabled = false; this.touchEnabled = false;
this.touchChildren = false; this.touchChildren = false;
egret.Tween.removeTweens(this); Tween.removeTweens(this);
egret.Tween.get(this).to({alpha: 0}, 170).call(() => { Tween.get(this).to({alpha: 0}, 170).call(() => {
this.visible = false; this.visible = false;
}); });
// egret.Tween.get(this).to({scaleX: 0, scaleY: 0}, 500, egret.Ease.quartInOut).call(() => {
// this.visible = false;
// })
} }
/// TODO 定义详细的操作 /// TODO 定义详细的操作
private onTap(e: egret.TouchEvent) { private onTap(e: TouchEvent) {
const target = e.target; const target = e.target;
btnDelay(target); btnDelay(target);
let petId; let petId;
switch(target) { switch (target) {
case this.chickBtn: // 鸡 case this.chickBtn: // 鸡
petId = 1; petId = CROP_TYPE.CHICKEN;
break; break;
case this.wheatBtn: // 小麦 case this.wheatBtn: // 小麦
petId = 2; petId = CROP_TYPE.WHEAT;
break; break;
case this.cornBtn: // 玉米 case this.cornBtn: // 玉米
petId = 3; petId = CROP_TYPE.CORN;
break; break;
case this.cattleBtn: // 牛 case this.cattleBtn: // 牛
petId = 4; petId = CROP_TYPE.CATTLE;
break; break;
default: default:
break; 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) const call = () => {
.to({scaleX: 1, scaleY: 1}, 100, egret.Ease.quadOut).call(() => { // 0s(100%,100%)-0.1s(120%,120%)-0.2s(100%,100%)
M_HideOption(); Tween.get(target).to({scaleX: 1.2, scaleY: 1.2}, 100, Ease.quadIn)
console.log(this.data.index, petId); .to({scaleX: 1, scaleY: 1}, 100, Ease.quadOut).call(() => {
M_SetGameLayerUpdate(false); M_HideOption();
NetManager.ins.doPlant((success) => { console.log(this.data.index, petId);
if(!success) { M_SetGameLayerUpdate(false);
M_SetGameLayerUpdate(true); NetManager.ins.doPlant((success) => {
return; if (!success) {
} M_SetGameLayerUpdate(true);
M_Plant({landId: this.data.index, petId: petId}); return;
G_JudgeMedalPanel(); }
}, this.data.index, petId); M_Plant({landId: this.data.index, petId: petId});
G_JudgeMedalPanel();
}, this.data.index, petId);
});
}
// M_HideOption();
PanelCtrl.instance.show(IntroducePanel, {
call: call,
petId: petId,
landId: this.data.index
}); });
} }
private initUI() { private initUI() {
...@@ -153,4 +165,4 @@ export default class OptionPanel extends eui.Component { ...@@ -153,4 +165,4 @@ export default class OptionPanel extends eui.Component {
this.anchorOffsetX = this.width / 2; this.anchorOffsetX = this.width / 2;
this.anchorOffsetY = this.height; this.anchorOffsetY = this.height;
} }
} }
\ No newline at end of file
import { getSkinPath } from "../utils"; import { getSkinPath } from "../utils";
import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import { btnDelay } from "../comm/UtilsConst"; import { btnDelay } from "../comm/UtilsConst";
export default class Bar extends eui.Component { export default class Bar extends eui.Component {
public rule:eui.Group; public share:eui.Group;
public title:eui.Label; public title:eui.Label;
public back:eui.Group; public back:eui.Group;
...@@ -21,15 +19,15 @@ export default class Bar extends eui.Component { ...@@ -21,15 +19,15 @@ export default class Bar extends eui.Component {
private initEvents() { private initEvents() {
this.back.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap, this); this.back.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap, this);
this.rule.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap, this); this.share.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap, this);
} }
/// TODO 定义详细的操作 /// TODO 定义详细的操作
private onTap(e: egret.TouchEvent) { private onTap(e: egret.TouchEvent) {
btnDelay(e.target); btnDelay(e.target);
switch(e.target) { switch(e.target) {
case this.rule: // 规则 case this.share: // 分享
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL); window['share']();
break; break;
case this.back: // 返回 case this.back: // 返回
...@@ -39,4 +37,4 @@ export default class Bar extends eui.Component { ...@@ -39,4 +37,4 @@ export default class Bar extends eui.Component {
break; break;
} }
} }
} }
\ No newline at end of file
import { ModuleTypes } from "../types/sceneTypes"; import { ModuleTypes } from "../types/sceneTypes";
import Panel from "../views/Panel"; import Panel, { IPanel } from "../views/Panel";
import Loading from "../loading/Loading"; import Loading from "../loading/Loading";
export default class PanelCtrl { export default class PanelCtrl {
...@@ -22,6 +22,7 @@ export default class PanelCtrl { ...@@ -22,6 +22,7 @@ export default class PanelCtrl {
} }
private _panelClassMap: any; private _panelClassMap: any;
public registerPanelClass(name, definition) { public registerPanelClass(name, definition) {
this._panelClassMap = this._panelClassMap || {}; this._panelClassMap = this._panelClassMap || {};
this._panelClassMap[name] = definition; this._panelClassMap[name] = definition;
...@@ -48,7 +49,7 @@ export default class PanelCtrl { ...@@ -48,7 +49,7 @@ export default class PanelCtrl {
* @param type 类型 * @param type 类型
* @param data 数据 * @param data 数据
*/ */
public show(type: ModuleTypes, data?) { public show(type: ModuleTypes | IPanel, data?) {
if (this._current) { if (this._current) {
this._current.destroy(); /// TODO 不知道谁干的,没写这句导致事件清除不完善!自定义事件起冲突 this._current.destroy(); /// TODO 不知道谁干的,没写这句导致事件清除不完善!自定义事件起冲突
this.remove(this._current, true); this.remove(this._current, true);
...@@ -56,8 +57,17 @@ export default class PanelCtrl { ...@@ -56,8 +57,17 @@ export default class PanelCtrl {
} }
this._parent.visible = true; this._parent.visible = true;
this.addMask(); this.addMask();
const cls = this._panelClassMap[type];
const panel: Panel = new cls(data); let panel = null;
// @ts-ignore
if (ModuleTypes[type]) {
// @ts-ignore
panel = new this._panelClassMap[type](data);
} else {
// @ts-ignore
panel = new type(data);
}
Loading.instace.show(); Loading.instace.show();
...@@ -72,7 +82,7 @@ export default class PanelCtrl { ...@@ -72,7 +82,7 @@ export default class PanelCtrl {
* 加入黑色蒙层 * 加入黑色蒙层
*/ */
private addMask() { private addMask() {
if(!this._mask) { if (!this._mask) {
this._mask = new egret.Sprite(); this._mask = new egret.Sprite();
this._mask.touchEnabled = true; this._mask.touchEnabled = true;
this._mask.graphics.beginFill(0, .4); this._mask.graphics.beginFill(0, .4);
...@@ -109,7 +119,7 @@ export default class PanelCtrl { ...@@ -109,7 +119,7 @@ export default class PanelCtrl {
return; return;
} }
panel.onHide().call(()=>{ panel.onHide().call(() => {
this._parent.removeChild(panel); this._parent.removeChild(panel);
this.removeMask(); this.removeMask();
}); });
...@@ -122,7 +132,7 @@ export default class PanelCtrl { ...@@ -122,7 +132,7 @@ export default class PanelCtrl {
// }, this); // }, this);
} }
public removeCurrent(){ public removeCurrent() {
this._current && this._parent.removeChild(this._current) && (this._current = null); this._current && this._parent.removeChild(this._current) && (this._current = null);
this._mask && this.removeMask(true); this._mask && this.removeMask(true);
} }
...@@ -135,6 +145,6 @@ export default class PanelCtrl { ...@@ -135,6 +145,6 @@ export default class PanelCtrl {
const panel = e.target as Panel; const panel = e.target as Panel;
panel.removeEventListener('onDestroy', this.onPanelHide, this); panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel); this.remove(panel);
this._current=null; this._current = null;
} }
} }
\ No newline at end of file
...@@ -16,6 +16,8 @@ import MedalsPanel from "../Panels/MedalsPanel"; ...@@ -16,6 +16,8 @@ import MedalsPanel from "../Panels/MedalsPanel";
import ExchangePanel from "../Panels/ExchangePanel"; import ExchangePanel from "../Panels/ExchangePanel";
import ExchangedPanel from "../Panels/ExchangedPanel"; import ExchangedPanel from "../Panels/ExchangedPanel";
import MedalPanel from "../Panels/MedalPanel"; import MedalPanel from "../Panels/MedalPanel";
import NewUserPanel from "../Panels/NewUserPanel";
import OldUserPanel from "../Panels/OldUserPanel";
let Scenes = [ let Scenes = [
[ModuleTypes.LOADING_SCENE, LoadingScene], [ModuleTypes.LOADING_SCENE, LoadingScene],
...@@ -33,6 +35,8 @@ let Panels = [ ...@@ -33,6 +35,8 @@ let Panels = [
[ModuleTypes.MEDAL_PANEL, MedalPanel], [ModuleTypes.MEDAL_PANEL, MedalPanel],
[ModuleTypes.EXCHANGE_PANEL, ExchangePanel], [ModuleTypes.EXCHANGE_PANEL, ExchangePanel],
[ModuleTypes.EXCHANGED_PANEL, ExchangedPanel], [ModuleTypes.EXCHANGED_PANEL, ExchangedPanel],
[ModuleTypes.NEW_USER_PANEL, NewUserPanel],
[ModuleTypes.OLD_USER_PANEL, OldUserPanel],
]; ];
let Tops = [ let Tops = [
...@@ -43,4 +47,4 @@ let Tops = [ ...@@ -43,4 +47,4 @@ let Tops = [
[ModuleTypes.SELLED_PANEL, SelledPanel], [ModuleTypes.SELLED_PANEL, SelledPanel],
]; ];
export { Scenes, Panels, Tops } export { Scenes, Panels, Tops }
\ No newline at end of file
...@@ -20,4 +20,7 @@ export enum ModuleTypes { ...@@ -20,4 +20,7 @@ export enum ModuleTypes {
EXCHANGE_PANEL, EXCHANGE_PANEL,
EXCHANGED_PANEL, EXCHANGED_PANEL,
MEDAL_PANEL, MEDAL_PANEL,
}
\ No newline at end of file NEW_USER_PANEL,
OLD_USER_PANEL,
}
import Loading from "../loading/Loading"; import Loading from "../loading/Loading";
import ComponentBase from "../components/ComponentBase"; import ComponentBase from "../components/ComponentBase";
export default class Panel extends ComponentBase { export interface IPanel {
}
export default class Panel extends ComponentBase implements IPanel{
constructor(data?) { constructor(data?) {
super(data); super(data);
} }
...@@ -40,9 +44,9 @@ export default class Panel extends ComponentBase { ...@@ -40,9 +44,9 @@ export default class Panel extends ComponentBase {
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
if(this.closeBtns && this.closeBtns.length > 0) { if (this.closeBtns && this.closeBtns.length > 0) {
this.closeBtns.forEach((btn) => { this.closeBtns.forEach((btn) => {
if(btn) btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchClose, this) if (btn) btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchClose, this)
} }
) )
} }
...@@ -50,9 +54,9 @@ export default class Panel extends ComponentBase { ...@@ -50,9 +54,9 @@ export default class Panel extends ComponentBase {
removeEvents() { removeEvents() {
super.removeEvents(); super.removeEvents();
if(this.closeBtns && this.closeBtns.length > 0) { if (this.closeBtns && this.closeBtns.length > 0) {
this.closeBtns.forEach((btn) => { this.closeBtns.forEach((btn) => {
if(btn) btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchClose, this) if (btn) btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchClose, this)
} }
) )
} }
...@@ -75,4 +79,4 @@ export default class Panel extends ComponentBase { ...@@ -75,4 +79,4 @@ export default class Panel extends ComponentBase {
this.destroy(); this.destroy();
this.dispatchEvent(new egret.Event('onDestroy')); this.dispatchEvent(new egret.Event('onDestroy'));
} }
} }
\ No newline at end of file
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
"code": null, "code": null,
"data": [ "data": [
{ {
"canFeed": true, "canFeed": false,
"canGather": false, "canGather": false,
"feedLeftSeconds": 3333, "feedLeftSeconds": 1111,
"feedNum": 20, "feedNum": 20,
"id": 1, "id": 1,
"level": 1, "level": 1,
...@@ -26,18 +26,18 @@ ...@@ -26,18 +26,18 @@
"feedNum": 30, "feedNum": 30,
"id": 3, "id": 3,
"level": 3, "level": 3,
"petId": 3 "petId": 0
}, },
{ {
"canFeed": false, "canFeed": false,
"canGather": true, "canGather": false,
"feedLeftSeconds": 10000, "feedLeftSeconds": 10000,
"feedNum": 20, "feedNum": 20,
"id": 4, "id": 4,
"level": 4, "level": 2,
"petId": 4 "petId": 4
} }
], ],
"message": null, "message": null,
"success": true "success": true
} }
\ 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