123456789101112131415161718192021222324252627282930313233343536 |
- import { _decorator, Component, instantiate, Node, Prefab, Widget } from 'cc';
- import { ui_base } from '../../run/ui/ui_base';
- import { interact_scene_data, scene_item_data } from '../../../data/data';
- import { tools } from '../../tools';
- import { scene_page } from '../../run/scene_page';
- import { taskServce } from '../TaskSchedule/taskServce';
- const { ccclass, property } = _decorator;
- @ccclass('interact_scene')
- export class interact_scene extends ui_base {
- @property(Prefab) scenePagePrefab:Prefab = null;
- @property(Node) content:Node = null;
- private mInteractScene:interact_scene_data;
- private mCurChildScene:scene_page = null;
- protected init(): void {
- this.mInteractScene = this.mTopData._interact_scene_data;
- if(this.mInteractScene===null||this.mInteractScene.scene.page_list.length<=0){
- return tools.showToast("错误的配置子场景")
- }
- // this.loadChildScene()
- }
- loadChildScene(){
- if(this.content.children.length<=0){
- const item_data:scene_item_data = this.mInteractScene.scene.page_list[0];
- let item:Node = instantiate(this.scenePagePrefab);
- item.parent = this.content;
- item.getComponent(Widget).target = this.content;
- item.getComponent(scene_page).initView(item_data)
- this.mCurChildScene = item.getComponent(scene_page)
- taskServce.StartChildSceneTask(item_data._task_data)
- }
- }
- }
|