Merge branch 'main' of 47.107.44.202:xionglijia/18xchat
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { sys, native } from "cc";
|
import { sys, native } from "cc";
|
||||||
import { EDITOR, PREVIEW } from "cc/env";
|
import { EDITOR, PREVIEW } from "cc/env";
|
||||||
|
import { PlatformHelper } from "../../../Main/Channel/PlatformHelper";
|
||||||
|
|
||||||
function isWeChatMiniGame(): boolean {
|
function isWeChatMiniGame(): boolean {
|
||||||
const g: any = globalThis as any;
|
const g: any = globalThis as any;
|
||||||
@@ -30,7 +31,7 @@ function tryMiniGameModel(): string | null {
|
|||||||
function tryNativeModel(): string | null {
|
function tryNativeModel(): string | null {
|
||||||
// if (!sys.isNative) return null;
|
// if (!sys.isNative) return null;
|
||||||
// try {
|
// try {
|
||||||
// if (sys.platform === sys.Platform.ANDROID) {
|
// if (PlatformHelper.isAndroid()) {
|
||||||
// const s = native.reflection.callStaticMethod(
|
// const s = native.reflection.callStaticMethod(
|
||||||
// "org/cocos2dx/javascript/AppActivity",
|
// "org/cocos2dx/javascript/AppActivity",
|
||||||
// "getDeviceModel",
|
// "getDeviceModel",
|
||||||
@@ -38,7 +39,7 @@ function tryNativeModel(): string | null {
|
|||||||
// );
|
// );
|
||||||
// return (s && String(s).trim()) || null;
|
// return (s && String(s).trim()) || null;
|
||||||
// }
|
// }
|
||||||
// if (sys.platform === sys.Platform.IOS) {
|
// if (PlatformHelper.isIOS()) {
|
||||||
// const s = native.reflection.callStaticMethod("AppController", "getHardwareModel");
|
// const s = native.reflection.callStaticMethod("AppController", "getHardwareModel");
|
||||||
// return (s && String(s).trim()) || null;
|
// return (s && String(s).trim()) || null;
|
||||||
// }
|
// }
|
||||||
@@ -67,8 +68,8 @@ export class MachineInfoService {
|
|||||||
public runtimeTag(): string {
|
public runtimeTag(): string {
|
||||||
if (EDITOR) return PREVIEW ? "editor-preview" : "editor";
|
if (EDITOR) return PREVIEW ? "editor-preview" : "editor";
|
||||||
if (sys.isNative) {
|
if (sys.isNative) {
|
||||||
if (sys.platform === sys.Platform.ANDROID) return "native-android";
|
if (PlatformHelper.isAndroid()) return "native-android";
|
||||||
if (sys.platform === sys.Platform.IOS) return "native-ios";
|
if (PlatformHelper.isIOS()) return "native-ios";
|
||||||
return "native";
|
return "native";
|
||||||
}
|
}
|
||||||
if (isWeChatMiniGame()) return "minigame-wechat";
|
if (isWeChatMiniGame()) return "minigame-wechat";
|
||||||
@@ -115,13 +116,13 @@ export class MachineInfoService {
|
|||||||
return 3; // 在 Cocos Creator 编辑器里运行
|
return 3; // 在 Cocos Creator 编辑器里运行
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sys.platform === sys.Platform.ANDROID) {
|
if (PlatformHelper.isAndroid()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (sys.platform === sys.Platform.IOS) {
|
if (PlatformHelper.isIOS()) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (sys.platform === sys.Platform.WIN32) {
|
if (PlatformHelper.isWinDesktop()) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
return 3;
|
return 3;
|
||||||
|
|||||||
Reference in New Issue
Block a user