Fix code hints and add comments when using the google play interface. (#18625)

This commit is contained in:
qiuguohua
2025-04-22 16:44:28 +08:00
committed by GitHub
parent fbd13d3777
commit c533f1379b
5 changed files with 2268 additions and 1196 deletions
+304 -1070
View File
File diff suppressed because it is too large Load Diff
+11 -1
View File
@@ -198,7 +198,10 @@
"dependentModules": ["2d"]
},
"vendor-google": {
"modules": ["vendor-google"]
"modules": ["vendor-google"],
"intrinsicFlags": {
"USE_VENDOR_GOOGLE": true
}
},
"spine-3.8": {
"modules": ["spine"],
@@ -466,6 +469,13 @@
"cocos/spine/lib/spine-version.ts": "cocos/spine/lib/spine-version-4.2.ts",
"cocos/spine/lib/spine-instantiate.ts": "cocos/spine/lib/spine-instantiate-4.2.ts"
}
},
{
"test": "context.buildTimeConstants.USE_VENDOR_GOOGLE",
"isVirtualModule": false,
"overrides": {
"vendor/google/index.ts": "vendor/google/impl.ts"
}
}
],
"includes": [
+61
View File
@@ -0,0 +1,61 @@
/* eslint-disable @typescript-eslint/no-namespace */
/*
Copyright (c) 2025 Xiamen Yaji Software Co., Ltd.
https://www.cocos.com/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
import { JSB } from 'internal:constants';
import './billing/billing-enum';
import './play/play-enum';
import { AchievementsClientHelper, GamesSignInClientHelper, RecallClientHelper, PlayGamesHelper } from './play/games';
const ns: any = globalThis.jsb ?? {};
export namespace google {
export namespace billing {
export const BillingClient = ns.BillingClient;
export const BillingResult = ns.BillingResult;
export const InAppMessageResult = ns.InAppMessageResult;
export const ProductDetails = ns.ProductDetails;
export const Purchase = ns.Purchase;
export const PendingPurchasesParams = ns.PendingPurchasesParams;
export const QueryProductDetailsParams = ns.QueryProductDetailsParams;
export const BillingFlowParams = ns.BillingFlowParams;
export const ConsumeParams = ns.ConsumeParams;
export const AcknowledgePurchaseParams = ns.AcknowledgePurchaseParams;
export const QueryPurchasesParams = ns.QueryPurchasesParams;
export const GetBillingConfigParams = ns.GetBillingConfigParams;
export const InAppMessageParams = ns.InAppMessageParams;
}
export namespace play {
export const PlayGamesSdk = ns.PlayGamesSdk;
export const PlayGames = PlayGamesHelper;
export const GamesSignInClient = GamesSignInClientHelper;
export const AchievementsClient = AchievementsClientHelper;
export const RecallClient = RecallClientHelper;
export const AuthenticationResult = ns.AuthenticationResult;
export const RecallAccess = ns.RecallAccess;
export const PlayException = ns.PlayException;
export const AnnotatedData = ns.AnnotatedData;
export const AchievementBuffer = ns.AchievementBuffer;
export const Achievement = ns.Achievement;
}
}
+1886 -119
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -182,7 +182,7 @@ export class GamesSignInClientHelper {
}
}
export class AchievementsClient {
export class AchievementsClientHelper {
showAchievements (): void {
jsb.PlayGames.getAchievementsClient().showAchievements();
}
@@ -229,7 +229,7 @@ export class AchievementsClient {
}
}
export class RecallClient {
export class RecallClientHelper {
requestRecallAccess (): TaskHelper<jsb.RecallAccess> {
const newTask = new GooglePlayTask<jsb.RecallAccess>(jsb.PlayGames.getRecallClient().requestRecallAccess());
GooglePlayTask.taskMgr.addTask(newTask);
@@ -238,16 +238,16 @@ export class RecallClient {
}
export class PlayGamesHelper {
private static achievementsClient: AchievementsClient = new AchievementsClient();
private static achievementsClient: AchievementsClientHelper = new AchievementsClientHelper();
private static gamesSignInClient: GamesSignInClientHelper = new GamesSignInClientHelper();
private static recallClient: RecallClient = new RecallClient();
public static getAchievementsClient (): AchievementsClient {
private static recallClient: RecallClientHelper = new RecallClientHelper();
public static getAchievementsClient (): AchievementsClientHelper {
return this.achievementsClient;
}
public static getGamesSignInClient (): GamesSignInClientHelper {
return this.gamesSignInClient;
}
public static getRecallClient (): RecallClient {
public static getRecallClient (): RecallClientHelper {
return this.recallClient;
}
}