|
@@ -3,13 +3,13 @@ import ui_base from '../../../core/ui/ui_base';
|
|
import { ModuleDef } from '../../../scripts/ModuleDef';
|
|
import { ModuleDef } from '../../../scripts/ModuleDef';
|
|
import { GameUILayers, gui } from '../../../core/ui/ui';
|
|
import { GameUILayers, gui } from '../../../core/ui/ui';
|
|
import { Layout_HomePage } from './Layout_HomePage';
|
|
import { Layout_HomePage } from './Layout_HomePage';
|
|
-import { UI_Main } from '../UI_Main/UI_Main';
|
|
|
|
import { UIManager } from '../UI/UIManager';
|
|
import { UIManager } from '../UI/UIManager';
|
|
import { toggleBreath, toggleSlideOutAndBack_Nodes } from '../../../module_extra/Customize/Customize_Ani';
|
|
import { toggleBreath, toggleSlideOutAndBack_Nodes } from '../../../module_extra/Customize/Customize_Ani';
|
|
import { Root } from '../../game/process/Root';
|
|
import { Root } from '../../game/process/Root';
|
|
-import { UI_PiggyBank } from '../UI_PiggyBank/UI_PiggyBank';
|
|
|
|
import { button_Sound, SoundName } from '../../../module_extra/Customize/Customize_Sound';
|
|
import { button_Sound, SoundName } from '../../../module_extra/Customize/Customize_Sound';
|
|
-import { UI_LuckyGift } from '../UI_LuckyGift/UI_LuckyGift';
|
|
|
|
|
|
+import { Customize_RedPointMgr, NodeName } from '../../../module_extra/Customize/Customize_RedPointMgr';
|
|
|
|
+import { RedPointPersistType, RedPointState, RedPointType } from '../../../module_extra/Customize/Customize_RedPoint';
|
|
|
|
+import { UIName } from '../UI/UI_ClassManager';
|
|
|
|
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@@ -23,21 +23,34 @@ export class UI_HomePage extends ui_base {
|
|
|
|
|
|
];
|
|
];
|
|
private duration: number = 0.3;
|
|
private duration: number = 0.3;
|
|
|
|
+
|
|
|
|
+ luckyGift: string = "LuckyGift";
|
|
|
|
+ subscriptionGift: string = "SubscriptionGift";
|
|
|
|
+ piggyBank: string = "PiggyBank";
|
|
|
|
+
|
|
|
|
+ count = 1;
|
|
constructor() {
|
|
constructor() {
|
|
super(ModuleDef.GAME, "ui/UI_HomePage/HomePage", GameUILayers.HUD, Layout_HomePage);
|
|
super(ModuleDef.GAME, "ui/UI_HomePage/HomePage", GameUILayers.HUD, Layout_HomePage);
|
|
}
|
|
}
|
|
|
|
|
|
protected onCreated(): void {
|
|
protected onCreated(): void {
|
|
Root.getInstance().cancelBlurBg();
|
|
Root.getInstance().cancelBlurBg();
|
|
|
|
+
|
|
|
|
+ const layout = this.getLayout<Layout_HomePage>();
|
|
|
|
+ this.initRedPointTree();
|
|
|
|
+
|
|
|
|
+ this.showPanel();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public showPanel(): void {
|
|
|
|
+ super.showPanel();
|
|
let flag: boolean = false;//是否需要做动画
|
|
let flag: boolean = false;//是否需要做动画
|
|
if (!UIManager.getInstance().Show_Ani) {
|
|
if (!UIManager.getInstance().Show_Ani) {
|
|
UIManager.getInstance().Show_Ani = true;
|
|
UIManager.getInstance().Show_Ani = true;
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
flag = true;
|
|
flag = true;
|
|
}
|
|
}
|
|
-
|
|
|
|
const layout = this.getLayout<Layout_HomePage>();
|
|
const layout = this.getLayout<Layout_HomePage>();
|
|
-
|
|
|
|
let count = 3;
|
|
let count = 3;
|
|
const onOneFinish = () => {
|
|
const onOneFinish = () => {
|
|
count--;
|
|
count--;
|
|
@@ -45,23 +58,29 @@ export class UI_HomePage extends ui_base {
|
|
this.onButtonEvent(layout.Start_Btn, () => {
|
|
this.onButtonEvent(layout.Start_Btn, () => {
|
|
button_Sound(SoundName.clickUI);
|
|
button_Sound(SoundName.clickUI);
|
|
Root.getInstance().Mode = 1;
|
|
Root.getInstance().Mode = 1;
|
|
- UIManager.getInstance().closeAllUI();
|
|
|
|
- UIManager.getInstance().pushUI(UI_Main);
|
|
|
|
|
|
+ UIManager.getInstance().DestoryAllUI();
|
|
|
|
+ UIManager.getInstance().pushUI(UIName.MAIN);
|
|
})
|
|
})
|
|
|
|
|
|
this.onButtonEvent(layout.LuckyGift_Btn, () => {
|
|
this.onButtonEvent(layout.LuckyGift_Btn, () => {
|
|
button_Sound(SoundName.clickUI);
|
|
button_Sound(SoundName.clickUI);
|
|
- UIManager.getInstance().pushUI(UI_LuckyGift,true);
|
|
|
|
|
|
+ UIManager.getInstance().pushUI(UIName.LUCKYGIFT, true);
|
|
|
|
+ Customize_RedPointMgr.instance.SetState(NodeName.homePage, this.luckyGift, RedPointState.Hide);
|
|
|
|
+ Customize_RedPointMgr.instance.SaveToLocal();
|
|
});
|
|
});
|
|
|
|
|
|
this.onButtonEvent(layout.SubscriptionGift_Btn, () => {
|
|
this.onButtonEvent(layout.SubscriptionGift_Btn, () => {
|
|
button_Sound(SoundName.clickUI);
|
|
button_Sound(SoundName.clickUI);
|
|
// UIManager.getInstance().pushUI();
|
|
// UIManager.getInstance().pushUI();
|
|
|
|
+ Customize_RedPointMgr.instance.SetState(NodeName.homePage, this.subscriptionGift, RedPointState.Hide);
|
|
|
|
+ Customize_RedPointMgr.instance.SaveToLocal();
|
|
});
|
|
});
|
|
|
|
|
|
this.onButtonEvent(layout.PiggyBank_Btn, () => {
|
|
this.onButtonEvent(layout.PiggyBank_Btn, () => {
|
|
button_Sound(SoundName.clickUI);
|
|
button_Sound(SoundName.clickUI);
|
|
- UIManager.getInstance().pushUI(UI_PiggyBank,true);
|
|
|
|
|
|
+ UIManager.getInstance().pushUI(UIName.PIGGYBANK, true);
|
|
|
|
+ Customize_RedPointMgr.instance.SetState(NodeName.homePage, this.piggyBank, RedPointState.Hide);
|
|
|
|
+ Customize_RedPointMgr.instance.SaveToLocal();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -72,7 +91,6 @@ export class UI_HomePage extends ui_base {
|
|
toggleSlideOutAndBack_Nodes(layout.Down_Groups, this.offset[3], this.duration, onOneFinish);
|
|
toggleSlideOutAndBack_Nodes(layout.Down_Groups, this.offset[3], this.duration, onOneFinish);
|
|
|
|
|
|
toggleBreath(layout.Start_Btn.node, 0.8);
|
|
toggleBreath(layout.Start_Btn.node, 0.8);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public new_close() {
|
|
public new_close() {
|
|
@@ -89,7 +107,43 @@ export class UI_HomePage extends ui_base {
|
|
toggleSlideOutAndBack_Nodes(layout.Left_Groups, this.offset[0], 0.3, onOneFinish);
|
|
toggleSlideOutAndBack_Nodes(layout.Left_Groups, this.offset[0], 0.3, onOneFinish);
|
|
toggleSlideOutAndBack_Nodes(layout.Right_Groups, this.offset[1], 0.3, onOneFinish);
|
|
toggleSlideOutAndBack_Nodes(layout.Right_Groups, this.offset[1], 0.3, onOneFinish);
|
|
toggleSlideOutAndBack_Nodes(layout.Down_Groups, this.offset[3], 0.3, onOneFinish);
|
|
toggleSlideOutAndBack_Nodes(layout.Down_Groups, this.offset[3], 0.3, onOneFinish);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private initRedPointTree() {
|
|
|
|
+ if (!Customize_RedPointMgr.instance.GetState(NodeName.homePage, this.luckyGift)) {
|
|
|
|
+ console.log("添加");
|
|
|
|
+ Customize_RedPointMgr.instance.Add(NodeName.homePage, this.luckyGift, NodeName.homePage, RedPointType.Enternal, RedPointPersistType.Temporary);
|
|
|
|
+ Customize_RedPointMgr.instance.SetState(NodeName.homePage, this.luckyGift, this.count == 0 ? RedPointState.Hide : RedPointState.Show, this.count);
|
|
|
|
+ }
|
|
|
|
+ if (!Customize_RedPointMgr.instance.GetState(NodeName.homePage, this.subscriptionGift)) {
|
|
|
|
+ console.log("添加");
|
|
|
|
+ Customize_RedPointMgr.instance.Add(NodeName.homePage, this.subscriptionGift, NodeName.homePage, RedPointType.Enternal, RedPointPersistType.Temporary);
|
|
|
|
+ Customize_RedPointMgr.instance.SetState(NodeName.homePage, this.subscriptionGift, this.count == 0 ? RedPointState.Hide : RedPointState.Show, this.count);
|
|
|
|
+ }
|
|
|
|
+ if (!Customize_RedPointMgr.instance.GetState(NodeName.homePage, this.piggyBank)) {
|
|
|
|
+ console.log("添加");
|
|
|
|
+ Customize_RedPointMgr.instance.Add(NodeName.homePage, this.piggyBank, NodeName.homePage, RedPointType.Enternal, RedPointPersistType.Temporary);
|
|
|
|
+ Customize_RedPointMgr.instance.SetState(NodeName.homePage, this.piggyBank, this.count == 0 ? RedPointState.Hide : RedPointState.Show, this.count);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Customize_RedPointMgr.instance.Init(NodeName.homePage, this.luckyGift, this.OnLuckyGiftShow.bind(this));
|
|
|
|
+ Customize_RedPointMgr.instance.Init(NodeName.homePage, this.subscriptionGift, this.OnSubscriptionGiftShow.bind(this));
|
|
|
|
+ Customize_RedPointMgr.instance.Init(NodeName.homePage, this.piggyBank, this.OnPiggyBankShow.bind(this));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private OnLuckyGiftShow(state: RedPointState, data: number = 1) {
|
|
|
|
+ const layout = this.getLayout<Layout_HomePage>();
|
|
|
|
+ layout.LuckyGift_Btn.node.getChildByName('hint_point').active = state === RedPointState.Show;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private OnSubscriptionGiftShow(state: RedPointState, data: number = 1) {
|
|
|
|
+ const layout = this.getLayout<Layout_HomePage>();
|
|
|
|
+ layout.SubscriptionGift_Btn.node.getChildByName('hint_point').active = state === RedPointState.Show;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private OnPiggyBankShow(state: RedPointState, data: number = 1) {
|
|
|
|
+ const layout = this.getLayout<Layout_HomePage>();
|
|
|
|
+ layout.PiggyBank_Btn.node.getChildByName('hint_point').active = state === RedPointState.Show;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|