From 0047c5433e359cf64ce2fed4967f76817df37154 Mon Sep 17 00:00:00 2001 From: dgflash Date: Thu, 3 Aug 2023 21:03:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Doops.gui.toast=E7=BB=84?= =?UTF-8?q?=E4=B8=AA=E4=B8=8D=E4=BD=BF=E7=94=A8=E5=A4=9A=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=97=B6=EF=BC=8C=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=96=87=E6=9C=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/core/common/loader/ResLoader.ts | 8 ++++---- assets/core/gui/prompt/Notify.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/assets/core/common/loader/ResLoader.ts b/assets/core/common/loader/ResLoader.ts index 6854f8d..8c313bb 100644 --- a/assets/core/common/loader/ResLoader.ts +++ b/assets/core/common/loader/ResLoader.ts @@ -1,8 +1,8 @@ import { Asset, AssetManager, Constructor, __private, assetManager, error, js, resources } from "cc"; -type ProgressCallback = __private._cocos_asset_asset_manager_shared__ProgressCallback; -type CompleteCallback = __private._cocos_asset_asset_manager_shared__CompleteCallbackWithData; -type IRemoteOptions = __private._cocos_asset_asset_manager_shared__IRemoteOptions; +type ProgressCallback = __private._cocos_asset_asset_manager_deprecated__LoadProgressCallback; +type CompleteCallback = any; // (error: Error | null, asset: T) => void; (error: Error | null, asset: T[], urls: string[]) => void; +type IRemoteOptions = { [k: string]: any; ext?: string; } | null; type AssetType = Constructor; interface ILoadResArgs { @@ -249,7 +249,7 @@ oops.res.loadDir("game", onProgressCallback, onCompleteCallback); * @param type 资源类型 * @param bundleName 远程资源包名 */ - get(path: string, type?: __private._cocos_asset_asset_manager_shared__AssetType | null, bundleName?: string): T | null { + get(path: string, type?: __private._types_globals__Constructor | null, bundleName?: string): T | null { if (bundleName == null) bundleName = this.defaultBundleName; var bundle: AssetManager.Bundle = assetManager.getBundle(bundleName)!; diff --git a/assets/core/gui/prompt/Notify.ts b/assets/core/gui/prompt/Notify.ts index 3d289fc..17058ef 100644 --- a/assets/core/gui/prompt/Notify.ts +++ b/assets/core/gui/prompt/Notify.ts @@ -13,10 +13,10 @@ const { ccclass, property } = _decorator; @ccclass('Notify') export class Notify extends Component { @property(Label) - private lab_content: Label | null = null; + private lab_content: Label = null!; @property(Animation) - private animation: Animation | null = null; + private animation: Animation = null!; onLoad() { if (this.animation) @@ -33,14 +33,14 @@ export class Notify extends Component { * @param useI18n 设置为 true 时,使用多语言功能 msg 参数为多语言 key */ toast(msg: string, useI18n: boolean) { - let label = this.lab_content?.getComponent(LanguageLabel)!; + let label = this.lab_content.getComponent(LanguageLabel)!; if (useI18n) { + label.enabled = true; label.dataID = msg; } else { - if (label) - label.dataID = ""; - this.lab_content!.string = msg; + label.enabled = false; + this.lab_content.string = msg; } } } \ No newline at end of file