This commit is contained in:
dgflash
2025-04-24 09:26:55 +08:00
5 changed files with 26 additions and 10 deletions

View File

@@ -24,7 +24,7 @@ import { GameManager } from "./game/GameManager";
import { LayerManager } from "./gui/layer/LayerManager";
/** 框架版本号 */
export var version: string = "2.0.0.20250404";
export var version: string = "2.0.0.20250423";
/** 框架核心模块访问入口 */
export class oops {

View File

@@ -100,11 +100,12 @@ export class DelegateComponent extends Component {
else {
this.node.removeFromParent();
}
// 触发窗口组件上窗口移除之后的事件
this.applyComponentsFunction(this.node, EventOnRemoved, this.vp.params);
}
onDestroy() {
// 触发窗口组件上窗口移除之后的事件
this.applyComponentsFunction(this.node, EventOnRemoved, this.vp.params);
this.vp = null!;
}

View File

@@ -52,7 +52,10 @@ export class MoveTo extends Component {
update(dt: number) {
let end: Vec3;
console.assert(this.speed > 0, "移动速度必须要大于零");
if (this.speed <= 0) {
console.error("移动速度必须要大于零");
return;
}
if (this.target instanceof Node) {
end = this.ns == Node.NodeSpace.WORLD ? this.target.worldPosition : this.target.position;

View File

@@ -41,9 +41,16 @@ export class LanguageData {
*
* 3、config/game/Language配置表使用oops-plugin-excel-to-json插件生成点击项目根目录下载update-oops-plugin-framework.bat或update-oops-plugin-framework.sh脚本下载插件
*/
public static getLangByID(labId: string): string {
static getLangByID(labId: string): string {
let content: string = null!;
for (const [key, value] of this.language) {
const content = value[labId];
if (key == LanguageDataType.Excel) {
let lang = value[labId];
if (lang) content = lang[this.current];
}
else {
content = value[labId];
}
if (content) return content;
}
return labId;

View File

@@ -4,7 +4,7 @@
* @LastEditors: dgflash
* @LastEditTime: 2022-12-13 11:36:00
*/
import { Asset, Button, Component, EventHandler, EventKeyboard, EventTouch, Input, Node, Sprite, SpriteFrame, __private, _decorator, input, isValid } from "cc";
import { Asset, Button, Component, EventHandler, EventKeyboard, EventTouch, Input, Node, Prefab, Sprite, SpriteFrame, __private, _decorator, input, isValid } from "cc";
import { oops } from "../../core/Oops";
import { EventDispatcher } from "../../core/common/event/EventDispatcher";
import { EventMessage, ListenerFunc } from "../../core/common/event/EventMessage";
@@ -76,7 +76,7 @@ export class GameComponent extends Component {
//#region 预制节点管理
/** 摊平的节点集合(所有节点不能重名) */
protected nodes: Map<string, Node> = null!;
nodes: Map<string, Node> = null!;
/** 通过节点名获取预制上的节点,整个预制不能有重名节点 */
getNode(name: string): Node | undefined {
@@ -106,7 +106,11 @@ export class GameComponent extends Component {
* @param bundleName 资源包名
*/
createPrefabNodeAsync(path: string, bundleName: string = oops.res.defaultBundleName): Promise<Node> {
return ViewUtil.createPrefabNodeAsync(path, bundleName);
return new Promise(async (resolve, reject) => {
await this.loadAsync(bundleName, path, Prefab);
let node = ViewUtil.createPrefabNode(path, bundleName);
resolve(node);
});
}
//#endregion
@@ -343,6 +347,8 @@ export class GameComponent extends Component {
async playEffect(url: string, bundleName?: string) {
if (bundleName == null) bundleName = oops.res.defaultBundleName;
await oops.audio.playEffect(url, bundleName, () => {
if (!this.isValid) return;
const rps = this.resPaths.get(ResType.Audio);
if (rps) {
const key = this.getResKey(bundleName, url);
@@ -485,7 +491,6 @@ export class GameComponent extends Component {
/** 游戏旋转屏幕事件回调 */
protected onGameOrientation(): void { }
//#endregion
protected onDestroy() {
// 释放消息对象
if (this._event) {