| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
- import SecretaryGuide from "../prefabs/SecretaryGuide";
- import GameM from "./GameM";
- import UiM from "./UiM";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class GuideManager {
- //单例模式---------------------------
- private static _instance: GuideManager = null;
- public static get Instance(): GuideManager {
- if (!GuideManager._instance) {
- GuideManager._instance = new GuideManager();
- }
- return GuideManager._instance;
- }
- public secretaryGuide = null
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {}
- public createFullGuide(parentNode: cc.Node, type: number, callback: Function) {
- return
- if (this.secretaryGuide) {
- this.secretaryGuide.getComponent(SecretaryGuide).initData(type, () => {
- callback()
- }, false)
- }
- else {
- cc.loader.loadRes("prefabs/SecretaryGuide", cc.Prefab, (err, prefab: cc.Prefab) => {
- if (err) {
- cc.error(err);
- return;
- }
- this.secretaryGuide = cc.instantiate(prefab)
- this.secretaryGuide.parent = parentNode
- this.secretaryGuide.getComponent(SecretaryGuide).initData(type, () => {
- callback()
- })
- })
- }
- }
- // update (dt) {}
- }
|