| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import { _decorator, Component, Node } from 'cc';
- import { Http } from '../../core/net/Http';
- import { Window } from '../../core/ui/window/Window';
- import { WindowManager } from '../../core/ui/window/WindowManager';
- import { WindowOpenMode } from '../../core/ui/window/WindowOpenMode';
- import { g } from '../../Data/g';
- import { platform } from '../../Data/platform';
- import { FarmManager } from '../../Main/FarmManager';
- const { ccclass, property } = _decorator;
- @ccclass('NoviceWindow')
- export class NoviceWindow extends Component {
- @property({ type: [Node], tooltip: "新手引导节点集合" }) novices: Array<Node> = [];
- @property({ type: Window, tooltip: "获取窗口" }) getWindow: Window;
- @property({ type: Http, tooltip: "http组件" }) http: Http;
- public static isNovicing = false;
- start() {
- NoviceWindow.isNovicing = true;
- for (let i = 0; i < this.novices.length; i++) {
- this.novices[i].active = i == 0;
- }
- }
- public next(e: TouchType, id: string): void {
- let index = parseInt(id);
- this.novices[index].active = false;
- if (this.novices[index + 1]) {
- this.novices[index + 1].active = true;
- if (index + 1 == 2 || index + 1 == 4) {
- FarmManager.novice_selectFristFarm();
- }
- } else {
- FarmManager.plantWindowIsOpening = false;
- this.node.active = false;
- this.node.destroy();
- }
- }
- public plant(e: TouchType, id: string): void {
- platform.reportThinking("login", JSON.stringify({ guide: "first_plant" }));
- g.gameData.getProductingList(31000).push({ productID: 10001, ripeDate: Date.now() + 1000 });
- FarmManager.novice_plant();
- this.next(e, id);
- }
- public async closeWindow(e: TouchType, id: string) {
- platform.reportThinking("login", JSON.stringify({ guide: "first_harvest" }));
- let result = await this.http.send("/api/user/getNoviceBonus");
- g.gameData.getProductingList(31000).length = 0;
- FarmManager.novice_clean();
- this.getWindow.close();
- this.next(e, id);
- }
- public goTowithDraw(e: TouchType, id: string): void {
- platform.reportThinking("login", JSON.stringify({ guide: "first_withdraw" }));
- WindowManager.open("Prefabs/Withdraw/Withdraw", WindowOpenMode.CloseAndCover);
- this.next(e, id);
- }
- }
|