Layabox 1 layabox project documents and project configuration

I am using layabox ide 2.1 version.
First, create an empty project will generate some find that the left side of the default folders and files.
Here Insert Picture Description

Store some development projects to publish the required files and folders .laya some configuration information file.

For example compile.js in the folder is set in the main inlet line 33 project files.

bin folder is a file output of the project, running on the editor, the file is actually running the bin folder under html file.

laya folder is stored in the resource file for the project
laya folder under the assets folder within the project comes with a set of ui pictures
after creating the scenario, laya folder will be generated pages folder, used to store using the editor scenes and pages created.

libs folder and storing a file editor, code hinting.

src put the project logic memory file, create an empty project internal default generates two files: Main.js and GameConfig.js
main.js import documents are used to initialize some scenes content
GameConfig.js a configuration file, which is configured with the to initialize the scene for Main.js

jsconfig.json configured to compile the entire project for compiling ts, ts with developing source code looks like. ,

test1.laya file entry for the project, you can identify whether this file is a laya project, test1 is the name of the project.

src file

We can look at the contents of Main.js file, in fact, officials have commented very clear, I posted a bit here and detailed out

import GameConfig from "./GameConfig";
class Main {
	constructor() {
		//根据IDE设置初始化引擎	当前如果支持webgl则通过webgl来创建项目	
		if (window["Laya3D"]) Laya3D.init(GameConfig.width, GameConfig.height);
		else Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
		Laya["Physics"] && Laya["Physics"].enable(); //是否开启物理
		Laya["DebugPanel"] && Laya["DebugPanel"].enable(); //是否开启调试框
		Laya.stage.scaleMode = GameConfig.scaleMode; //场景适配模式
		Laya.stage.screenMode = GameConfig.screenMode; //场景横竖屏
		Laya.stage.alignV = GameConfig.alignV; //垂直对齐方式
		Laya.stage.alignH = GameConfig.alignH; //水平对齐方式
		//兼容微信不支持加载scene后缀场景
		Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;

		//打开调试面板(通过IDE设置调试模式,或者url地址增加debug=true参数,均可打开调试面板)
		if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true") Laya.enableDebugPanel();
		if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"]) Laya["PhysicsDebugDraw"].enable();
		if (GameConfig.stat) Laya.Stat.show();
		Laya.alertGlobalError = true;

		//激活资源版本控制,version.json由IDE发布功能自动生成,如果没有也不影响后续流程
		Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
	}

	onVersionLoaded() {
		//激活大小图映射,加载小图的时候,如果发现小图在大图合集里面,则优先加载大图合集,而不是小图
		Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
	}

	onConfigLoaded() {
		//加载IDE指定的场景
		GameConfig.startScene && Laya.Scene.open(GameConfig.startScene);
	}
}
//激活启动类
new Main();

As can be seen, the first document introduced GameConfig.js Main.js file and add data to the scene is initialized by the configuration file in GameConfig.js introduced.
GameConfig.js we can not directly modify files need to be modified in the editor, we can enter the 'edit mode' and click F9 to open the edit box for editing.
Here Insert Picture Description
Open the project settings, we'll find some of the current settings are set in the content of the scene, such as the initial scene, which corresponds to Main.js of GameConfig.startScene && Laya.Scene.open(GameConfig.startScene);that, if set up here, editing GameConfig.js when the property will be startScene on the Build target scene name.
Next, look at the main column configuration settings

Wide design height, width and height of the design for the current scene.

Scene mode adaptation

Range:
"noScale": not scaled;
"exactFit": Zoom ratio ranging from full screen;
"showAll": the minimum scaling;
"NoBorder": the maximum scaling;
"Full": not scale, stage higher in the wide-screen width and height;
"fixedWidth": constant width, scaled according to height ratio of the screen;
"FixedHeight": constant height, the width of the screen according to the scaling ratio;
"fixedauto": The aspect ratio, or automatically selects fixedWidth FixedHeight;

Horizontal and vertical screen scene

Value range:
"none": Do not change the screen
"horizontal": Automatic horizontal screen
"vertical": automatic vertical screen

Vertical alignment

Range:
"Top": Align top ranking;
"Middle": center aligned;
"bottom": bottom aligned ranks;

Horizontal alignment

Value range:
"left": Left-aligned;
"Center": center aligned;
"right": the right of abode aligned;

Published 402 original articles · won praise 544 · Views 2.12 million +

Guess you like

Origin blog.csdn.net/qq_30100043/article/details/99339942