ec9439bfa5961cda966c13223bd4a5d7f1966ea2.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, sys, oops, StringUtil, GameQueryConfig, _crd;
  4. function _reportPossibleCrUseOfoops(extras) {
  5. _reporterNs.report("oops", "../../core/Oops", _context.meta, extras);
  6. }
  7. function _reportPossibleCrUseOfStringUtil(extras) {
  8. _reporterNs.report("StringUtil", "../../core/utils/StringUtil", _context.meta, extras);
  9. }
  10. _export("GameQueryConfig", void 0);
  11. return {
  12. setters: [function (_unresolved_) {
  13. _reporterNs = _unresolved_;
  14. }, function (_cc) {
  15. _cclegacy = _cc.cclegacy;
  16. __checkObsolete__ = _cc.__checkObsolete__;
  17. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  18. sys = _cc.sys;
  19. }, function (_unresolved_2) {
  20. oops = _unresolved_2.oops;
  21. }, function (_unresolved_3) {
  22. StringUtil = _unresolved_3.StringUtil;
  23. }],
  24. execute: function () {
  25. _crd = true;
  26. _cclegacy._RF.push({}, "d09acUxcU5Hg4kUjKxVEWLy", "GameQueryConfig", undefined);
  27. /*
  28. * @Author: dgflash
  29. * @Date: 2022-04-14 17:08:01
  30. * @LastEditors: dgflash
  31. * @LastEditTime: 2022-09-06 17:29:45
  32. */
  33. __checkObsolete__(['sys']);
  34. /**
  35. * 获取和处理浏览器地址栏参数
  36. * @example
  37. * config.query.data.username
  38. */
  39. _export("GameQueryConfig", GameQueryConfig = class GameQueryConfig {
  40. /** 调试模式开关 */
  41. get debug() {
  42. return this._data["debug"];
  43. }
  44. /** 玩家帐号名 */
  45. get username() {
  46. return this._data["username"];
  47. }
  48. /** 语言 */
  49. get lang() {
  50. return this._data["lang"] || "zh";
  51. }
  52. /** 浏览器地址栏原始参数 */
  53. get data() {
  54. return this._data;
  55. }
  56. /** 构造函数 */
  57. constructor() {
  58. this._data = null;
  59. if (!sys.isBrowser) {
  60. this._data = {};
  61. return;
  62. }
  63. this._data = this.parseUrl();
  64. if (!this._data["username"]) {
  65. this._data["username"] = (_crd && StringUtil === void 0 ? (_reportPossibleCrUseOfStringUtil({
  66. error: Error()
  67. }), StringUtil) : StringUtil).guid();
  68. }
  69. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  70. error: Error()
  71. }), oops) : oops).log.logConfig(this._data, "查询参数");
  72. }
  73. parseUrl() {
  74. if (typeof window !== "object") return {};
  75. if (!window.document) return {};
  76. var url = window.document.location.href.toString();
  77. var u = url.split("?");
  78. if (typeof u[1] == "string") {
  79. u = u[1].split("&");
  80. var get = {};
  81. for (var i = 0, l = u.length; i < l; ++i) {
  82. var j = u[i];
  83. var x = j.indexOf("=");
  84. if (x < 0) {
  85. continue;
  86. }
  87. var key = j.substring(0, x);
  88. var value = j.substring(x + 1);
  89. get[decodeURIComponent(key)] = value && decodeURIComponent(value);
  90. }
  91. return get;
  92. } else {
  93. return {};
  94. }
  95. }
  96. });
  97. _cclegacy._RF.pop();
  98. _crd = false;
  99. }
  100. };
  101. });
  102. //# sourceMappingURL=ec9439bfa5961cda966c13223bd4a5d7f1966ea2.js.map