import { _decorator, Component, Node } from "cc"; import BaseUI from "../../scripts/base/BaseUI"; import { Hall } from "../hall/Hall"; import { Sprite } from "cc"; import AB from "../../scripts/base/AB"; const { ccclass, property } = _decorator; export enum HelpType { Rank = 1, ItemBox = 2, PogBox = 3, FamilyBox = 4, } @ccclass("HelpImage") export class HelpImage extends BaseUI { public static async show(type: HelpType) { let layer = await Hall.ins.showLayer("prefab/layer/HelpImage"); await layer.getComponent(HelpImage).init(type); } private image: Sprite; protected onLoad(): void { super.onLoad(); this.image = this.FindAs("image", Sprite); } async init(type: HelpType) { let path = null; switch (type) { case HelpType.Rank: path = "texture/rank/page_help_rank"; break; case HelpType.ItemBox: path = "texture/shop/page_help_item_box"; break; case HelpType.PogBox: path = "texture/shop/page_help_pog_box"; break; case HelpType.FamilyBox: path = "texture/family/page_help_family_box"; break; } let sp = await AB.ins.loadSpriteFrame(path); this.image.spriteFrame = sp; } }