drgame-cc 1.0.16 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,70 @@
1
+ export const VIRTUAL_GAMEPAD_GAME_ID = "rexueqiangshou";
2
+ declare const global: any;
3
+ export const VIRTUAL_GAMEPAD_PLAYER_ID = "player1";
4
+ export const VIRTUAL_GAMEPAD_DEVELOPMENT_WS_URL = "ws://10.40.92.42:3000";
5
+ export const VIRTUAL_GAMEPAD_PRODUCTION_WS_URL = "wss://hyp.huyingpai.com/huyingpai/lewo/ws";
6
+ export const VIRTUAL_GAMEPAD_H5_URL = "https://docp.daoran.tv/vconsole/index.html";
7
+ export const VIRTUAL_GAMEPAD_DEVELOPMENT_WXACODE_URL = "https://hyp.huyingpai.com/API_USER_CS/wxacode/unlimited";
8
+ export const VIRTUAL_GAMEPAD_PRODUCTION_WXACODE_URL = "https://hyp.huyingpai.com/API_USER/wxacode/unlimited";
9
+ export const VIRTUAL_GAMEPAD_WXACODE_PAGE = "pages/gamepad/gamepad";
10
+ export const VIRTUAL_GAMEPAD_WXACODE_PROJECT_CODE = "lewo";
11
+ export const VIRTUAL_GAMEPAD_MAX_MEMBERS = 2;
12
+ export const VIRTUAL_GAMEPAD_STOP_TIMEOUT_MS = 500;
13
+ export type VirtualGamepadEnvironment = "development" | "production";
14
+ export const VIRTUAL_GAMEPAD_DEFAULT_ENVIRONMENT: VirtualGamepadEnvironment = "production";
15
+ export type VirtualGamepadQrMode = "h5" | "json";
16
+ export const VIRTUAL_GAMEPAD_QR_MODE: VirtualGamepadQrMode = "h5";
17
+
18
+ export default class VirtualGamepadConfig {
19
+ public static getWsUrl(): string {
20
+ return this.getRuntimeValue("RXQS_GAMEPAD_WS_URL") ||
21
+ (this.getEnvironment() == "production" ? VIRTUAL_GAMEPAD_PRODUCTION_WS_URL : VIRTUAL_GAMEPAD_DEVELOPMENT_WS_URL);
22
+ }
23
+
24
+ public static getWxacodeUrl(): string {
25
+ return this.getRuntimeValue("RXQS_GAMEPAD_WXACODE_URL") ||
26
+ (this.getEnvironment() == "production" ? VIRTUAL_GAMEPAD_PRODUCTION_WXACODE_URL : VIRTUAL_GAMEPAD_DEVELOPMENT_WXACODE_URL);
27
+ }
28
+
29
+ public static getEnvironment(): VirtualGamepadEnvironment {
30
+ let environment = this.getRuntimeValue("RXQS_GAMEPAD_ENVIRONMENT");
31
+ if (environment == "development" || environment == "production") {
32
+ return environment;
33
+ }
34
+ if (environment == "test") {
35
+ return "development";
36
+ }
37
+ return VIRTUAL_GAMEPAD_DEFAULT_ENVIRONMENT;
38
+ }
39
+
40
+ public static getH5Url(): string {
41
+ return this.getRuntimeValue("RXQS_GAMEPAD_H5_URL") || VIRTUAL_GAMEPAD_H5_URL;
42
+ }
43
+
44
+ public static getRoomId(): string {
45
+ return this.getRuntimeValue("RXQS_GAMEPAD_ROOM_ID");
46
+ }
47
+
48
+ public static getToken(): string {
49
+ return this.getRuntimeValue("RXQS_GAMEPAD_TOKEN");
50
+ }
51
+
52
+ public static getQrMode(): VirtualGamepadQrMode {
53
+ let mode = this.getRuntimeValue("RXQS_GAMEPAD_QR_MODE");
54
+ return mode == "json" ? "json" : VIRTUAL_GAMEPAD_QR_MODE;
55
+ }
56
+
57
+ private static getRuntimeValue(key: string): string {
58
+ let runtimeRoot: any = typeof window != "undefined" ? window : (typeof global != "undefined" ? global : null);
59
+ if (runtimeRoot && runtimeRoot[key]) {
60
+ return String(runtimeRoot[key]);
61
+ }
62
+ try {
63
+ if (cc && cc.sys && cc.sys.localStorage) {
64
+ return cc.sys.localStorage.getItem(key) || "";
65
+ }
66
+ } catch (e) {
67
+ }
68
+ return "";
69
+ }
70
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "ver": "1.1.0",
3
+ "uuid": "19522c5f-96b0-448d-bc57-07193079940d",
4
+ "importer": "typescript",
5
+ "isPlugin": false,
6
+ "loadPluginInWeb": true,
7
+ "loadPluginInNative": true,
8
+ "loadPluginInEditor": false,
9
+ "subMetas": {}
10
+ }