加载预制
This commit is contained in:
23381
assets/Scene.ls
23381
assets/Scene.ls
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,15 @@
|
|||||||
{
|
{
|
||||||
"perFolder": true,
|
"perFolder": true,
|
||||||
"includeSubFolders": true,
|
"includeSubFolders": true,
|
||||||
"maxWidth": 2048,
|
"maxWidth": 1024,
|
||||||
"maxHeight": 2048,
|
"maxHeight": 1024,
|
||||||
"eachMaxWidth": 512,
|
"eachMaxWidth": 512,
|
||||||
"eachMaxHeight": 512,
|
"eachMaxHeight": 512,
|
||||||
"format": 0,
|
|
||||||
"scale": 1,
|
"scale": 1,
|
||||||
"pot": false,
|
"pot": true,
|
||||||
"trimImage": true
|
"trimImage": true,
|
||||||
|
"platformDefault": {
|
||||||
|
"format": 0,
|
||||||
|
"quality": 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
76
assets/resources/Home.lh
Normal file
76
assets/resources/Home.lh
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"_$ver": 1,
|
||||||
|
"_$id": "gvlq012i",
|
||||||
|
"_$type": "Box",
|
||||||
|
"name": "Home",
|
||||||
|
"width": 1080,
|
||||||
|
"height": 1920,
|
||||||
|
"_mouseState": 2,
|
||||||
|
"left": 0,
|
||||||
|
"right": 0,
|
||||||
|
"top": 0,
|
||||||
|
"bottom": 0,
|
||||||
|
"_$comp": [
|
||||||
|
{
|
||||||
|
"_$type": "f2970e4d-7a09-4a9b-aef3-45d330c86f4f",
|
||||||
|
"scriptPath": "../src/views/Home.ts",
|
||||||
|
"btn_start": {
|
||||||
|
"_$ref": "098pc00r"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "0dr4l4hi",
|
||||||
|
"_$type": "Image",
|
||||||
|
"name": "Mask",
|
||||||
|
"width": 1080,
|
||||||
|
"height": 1920,
|
||||||
|
"left": 0,
|
||||||
|
"right": 0,
|
||||||
|
"top": 0,
|
||||||
|
"bottom": 0,
|
||||||
|
"skin": "res://63e88ec0-8898-4190-9f70-a4df67200ce3",
|
||||||
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "098pc00r",
|
||||||
|
"_$type": "Button",
|
||||||
|
"name": "btn_start",
|
||||||
|
"x": 440,
|
||||||
|
"y": 910,
|
||||||
|
"width": 200,
|
||||||
|
"height": 100,
|
||||||
|
"_mouseState": 2,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": 0,
|
||||||
|
"skin": "res://7eeb7e11-21ca-41ca-b7c2-dd2afa0c3ba7",
|
||||||
|
"label": "开始",
|
||||||
|
"labelFont": "res://55f943ef-58d2-4b30-8498-271c4213cce4",
|
||||||
|
"labelSize": 60,
|
||||||
|
"labelColors": "#ffffff,#32cc6b,#ff0000",
|
||||||
|
"labelAlign": "center",
|
||||||
|
"labelVAlign": "middle",
|
||||||
|
"labelStrokeColor": "rgba(216, 208, 208, 1)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "xi28zcch",
|
||||||
|
"_$type": "Button",
|
||||||
|
"name": "btn_continue",
|
||||||
|
"x": 440,
|
||||||
|
"y": 737,
|
||||||
|
"width": 200,
|
||||||
|
"height": 100,
|
||||||
|
"_mouseState": 2,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": -173,
|
||||||
|
"skin": "res://7eeb7e11-21ca-41ca-b7c2-dd2afa0c3ba7",
|
||||||
|
"label": "继续",
|
||||||
|
"labelFont": "res://55f943ef-58d2-4b30-8498-271c4213cce4",
|
||||||
|
"labelSize": 60,
|
||||||
|
"labelColors": "#ffffff,#32cc6b,#ff0000",
|
||||||
|
"labelAlign": "center",
|
||||||
|
"labelVAlign": "middle"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
3
assets/resources/Home.lh.meta
Normal file
3
assets/resources/Home.lh.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"uuid": "9d706cf1-ff30-4183-b441-c24d9b329c53"
|
||||||
|
}
|
||||||
23286
assets/resources/Stage.lh
Normal file
23286
assets/resources/Stage.lh
Normal file
File diff suppressed because it is too large
Load Diff
3
assets/resources/Stage.lh.meta
Normal file
3
assets/resources/Stage.lh.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"uuid": "bae98974-374e-4392-be0f-9ac62ea2fec7"
|
||||||
|
}
|
||||||
7
src/constants/respath.ts
Normal file
7
src/constants/respath.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
export const respath = {
|
||||||
|
home_ui_res: "resources/Home.lh",
|
||||||
|
stage_ui_res: "resources/Stage.lh",
|
||||||
|
}
|
||||||
|
|
||||||
3
src/constants/respath.ts.meta
Normal file
3
src/constants/respath.ts.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"uuid": "1efa1426-84f2-4cc2-9061-6e7508539831"
|
||||||
|
}
|
||||||
@@ -1,26 +1,36 @@
|
|||||||
|
import { respath } from "../constants/respath"
|
||||||
|
import { Home } from "../views/Home"
|
||||||
import { Stage } from "../views/Stage"
|
import { Stage } from "../views/Stage"
|
||||||
|
|
||||||
const { regClass, property } = Laya
|
const { regClass, property } = Laya
|
||||||
|
|
||||||
@regClass()
|
@regClass()
|
||||||
export class UIManager extends Laya.Script {
|
export class UIManager extends Laya.Script {
|
||||||
|
declare owner: Laya.Scene
|
||||||
@property(Stage)
|
|
||||||
public stage: Stage
|
|
||||||
|
|
||||||
private static _instance: UIManager
|
private static _instance: UIManager
|
||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
UIManager._instance = this
|
UIManager._instance = this
|
||||||
this.stage.owner.visible = false
|
this.loadHome()
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getInstance(): UIManager {
|
public static getInstance(): UIManager {
|
||||||
return UIManager._instance
|
return UIManager._instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public loadHome(): void {
|
||||||
|
Laya.loader.load(respath.home_ui_res).then((go)=>{
|
||||||
|
var prefab = go.create()
|
||||||
|
this.owner.addChild(prefab)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public loadStage(): void {
|
public loadStage(): void {
|
||||||
this.stage.owner.visible = true
|
Laya.loader.load(respath.stage_ui_res).then((go)=>{
|
||||||
this.stage.onLoadStage("aBCeIGFhdEDFcAHBGIhigBdfecAgHDiFBCaeBEAGHCIdffcIdEAHbgcABfGEdiHIFHaCDGEBDGEHbiaFC");
|
var prefab = go.create()
|
||||||
|
var stage = this.owner.addChild(prefab).getComponent(Stage)
|
||||||
|
stage.onLoadStage("aBCeIGFhdEDFcAHBGIhigBdfecAgHDiFBCaeBEAGHCIdffcIdEAHbgcABfGEdiHIFHaCDGEBDGEHbiaFC");
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export class Home extends Laya.Script {
|
|||||||
console.log("btn_start=", evt);
|
console.log("btn_start=", evt);
|
||||||
this.owner.visible = false;
|
this.owner.visible = false;
|
||||||
UIManager.getInstance().loadStage();
|
UIManager.getInstance().loadStage();
|
||||||
|
this.owner.destroy()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user