From fd5f31fd66a670817e56b726a18a27341f2455e3 Mon Sep 17 00:00:00 2001 From: JianMiau Date: Tue, 30 Aug 2022 11:37:02 +0800 Subject: [PATCH] =?UTF-8?q?[add]=20=E6=B2=92=E6=9C=89FCMToken=E5=B0=B1?= =?UTF-8?q?=E5=9C=A8=E8=A6=81=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/Manager.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/assets/Script/Manager.ts b/assets/Script/Manager.ts index ab93178..90f278d 100644 --- a/assets/Script/Manager.ts +++ b/assets/Script/Manager.ts @@ -1,3 +1,4 @@ +import { CoroutineV2 } from "./Engine/CatanEngine/CoroutineV2/CoroutineV2"; import { System_Eevent } from "./Engine/CatanEngine/CSharp/System/System_Eevent"; import NativeClass from "./NativeClass"; @@ -109,7 +110,16 @@ export default class Manager extends cc.Component { } public onLoadOK(): void { + CoroutineV2.Single(this.GetFCMToken()).Start(); + } + + public *GetFCMToken(): IterableIterator { const FCMToken: string = NativeClass.Instance.GetFCMToken(); + if (!FCMToken) { + yield CoroutineV2.WaitTime(1); + yield this.GetFCMToken(); + return; + } console.log(`FCMToken ${FCMToken}`); NativeClass.Instance.CocosBridge(System_Eevent.SetFCMToken, `"${FCMToken}"`); }