场景类添加全局方法 获取当前场景
This commit is contained in:
parent
b5282c9c32
commit
7709aaf54b
|
|
@ -4,6 +4,7 @@
|
||||||
创建日期:2024-05-05 00:22
|
创建日期:2024-05-05 00:22
|
||||||
文件用途:舞台类
|
文件用途:舞台类
|
||||||
*/
|
*/
|
||||||
|
if (!getroottable().rawin("GlobalCurrentStage")) GlobalCurrentStage <- null;
|
||||||
class CL_StageObject extends CL_BaseObject {
|
class CL_StageObject extends CL_BaseObject {
|
||||||
|
|
||||||
constructor(...) {
|
constructor(...) {
|
||||||
|
|
@ -28,9 +29,8 @@ class CL_StageObject extends CL_BaseObject {
|
||||||
//如果进入场景要绑定Update
|
//如果进入场景要绑定Update
|
||||||
BindenvUpdate();
|
BindenvUpdate();
|
||||||
|
|
||||||
//并且绑定摄像机 先移除父对象在绑定
|
//添加到全局
|
||||||
// if (CameraObject.ParentId) CameraObject.RemoveSelf();
|
GlobalCurrentStage = this;
|
||||||
// Addchild(CameraObject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnUpdate(Dt) {
|
function OnUpdate(Dt) {
|
||||||
|
|
@ -39,4 +39,9 @@ class CL_StageObject extends CL_BaseObject {
|
||||||
_Yosin_Sound_Logic_(Dt, this);
|
_Yosin_Sound_Logic_(Dt, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前场景
|
||||||
|
function sq_GetCurrentStage() {
|
||||||
|
return GlobalCurrentStage;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue