d0717199-79c5-4be6-9ded-35c5e993dad8.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. "use strict";
  2. cc._RF.push(module, 'd0717GZecVL5p3tNcXpk9rY', 'YzUserPrivacyPanel');
  3. // common-plugin/Scripts/YzUserPrivacyPanel.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var CompatibleTool_1 = require("./CompatibleTool");
  26. var PlatUtils_1 = require("./PlatUtils");
  27. var Utils_1 = require("./Utils");
  28. var YZ_Constant_1 = require("./YZ_Constant");
  29. var YZ_LocalStorage_1 = require("./YZ_LocalStorage");
  30. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  31. var YzUserPrivacyPanel = /** @class */ (function (_super) {
  32. __extends(YzUserPrivacyPanel, _super);
  33. function YzUserPrivacyPanel() {
  34. var _this = _super !== null && _super.apply(this, arguments) || this;
  35. _this._userPrivacyInfo = null;
  36. _this._checkExit = null;
  37. _this._mainPanel = null;
  38. _this._userPrivacyDesc = null;
  39. _this.showDesc = false; //直接显示详情页面
  40. _this.ratio = 1;
  41. _this.imgCount = 7; //图片数量 横屏:5 竖屏:7
  42. _this.scale = 1.5;
  43. _this.imgPath = "http://xcx.youletd.com/xcx/h5/privacyImg/";
  44. _this.companyInfoNode = null;
  45. _this.is_btn_jump_desc = false;
  46. return _this;
  47. // update (dt) {}
  48. }
  49. YzUserPrivacyPanel.prototype.onLoad = function () {
  50. if (PlatUtils_1.default.IsWechat || PlatUtils_1.default.IsQQ || PlatUtils_1.default.IsDouyin || PlatUtils_1.default.IsBaidu) {
  51. this.imgPath = "https://xcx.youletd.com/xcx/h5/privacyImg/";
  52. }
  53. this._userPrivacyInfo = cc.find("PrivacyDesc", this.node);
  54. this._checkExit = cc.find("CheckPanel", this.node);
  55. this._mainPanel = cc.find("Panel", this.node);
  56. // this._userPrivacyDesc = this._userPrivacyInfo.getComponent(cc.ScrollView).content.getChildByName("item").getComponent(cc.Label);
  57. // if (utils.ServerConfig.user_privacy_info) {
  58. // this._userPrivacyDesc.string = utils.ServerConfig.user_privacy_info;
  59. // }
  60. if (this.showDesc) {
  61. this._mainPanel.active = false;
  62. this._checkExit.active = false;
  63. // this._userPrivacyInfo.active = true;
  64. this._userPrivacyInfo.getComponent(cc.ScrollView).content.getChildByName("choiseNode").active = false;
  65. this.showDescPanel();
  66. }
  67. if (cc.winSize.height < cc.winSize.width) {
  68. // 横屏游戏
  69. this.ratio = cc.winSize.width / 1920 * 0.75;
  70. this.imgCount = 5;
  71. this.imgPath += "h_";
  72. this.scale = 1.4;
  73. }
  74. else {
  75. this.ratio = cc.winSize.width / 1080;
  76. this.imgPath += "p_";
  77. }
  78. this._mainPanel.scale = this.ratio;
  79. this._checkExit.scale = this.ratio;
  80. this._userPrivacyInfo.getComponent(cc.ScrollView).content.getChildByName("choiseNode").scale = this.ratio;
  81. this._userPrivacyInfo.getChildByName("view").getChildByName("closeImg").scale = this.ratio;
  82. this._userPrivacyInfo.getChildByName("view").getChildByName("LaodingLabel").scale = this.ratio;
  83. this.companyInfoNode = this._userPrivacyInfo.getComponent(cc.ScrollView).content.getChildByName("ContactInfo");
  84. var subject = "深圳市优智信息技术有限公司";
  85. var contact = "联系邮箱:youzhixx@163.com";
  86. if (Utils_1.utils.ServerConfig.company) {
  87. subject = Utils_1.utils.ServerConfig.company.subject;
  88. contact = Utils_1.utils.ServerConfig.company.contact;
  89. }
  90. this.companyInfoNode.getChildByName("subject").getComponent(cc.Label).string = subject;
  91. this.companyInfoNode.getChildByName("contact").getComponent(cc.Label).string = contact;
  92. };
  93. // onDestroy() {
  94. // utils.emitPrivacyCloseEvent();
  95. // }
  96. YzUserPrivacyPanel.prototype.onOKClickListener = function () {
  97. YZ_LocalStorage_1.default.setItem(YZ_Constant_1.default.YZ_GAME_YSXY, "isOK");
  98. this.node.destroy();
  99. Utils_1.utils.emitPrivacyCloseEvent();
  100. };
  101. YzUserPrivacyPanel.prototype.onCloseClickListener = function () {
  102. if (PlatUtils_1.default.IsHuaWei) {
  103. Utils_1.utils.GameExit();
  104. return;
  105. }
  106. if (this._checkExit.active && (PlatUtils_1.default.IsQQ || PlatUtils_1.default.IsOPPO || PlatUtils_1.default.IsXiaoMi)) {
  107. Utils_1.utils.GameExit();
  108. return;
  109. }
  110. this._checkExit.active = !this._checkExit.active;
  111. this._mainPanel.active = !this._mainPanel.active;
  112. };
  113. YzUserPrivacyPanel.prototype.onClosePrivacyDesc = function () {
  114. if (this.showDesc) {
  115. this.node.destroy();
  116. }
  117. else {
  118. this._userPrivacyInfo.active = false;
  119. var childs = this._userPrivacyInfo.getComponent(cc.ScrollView).content.children;
  120. for (var i = 0; i < childs.length; i++) {
  121. childs[i].active = false;
  122. }
  123. }
  124. };
  125. YzUserPrivacyPanel.prototype.onJumpDescBtnClickListner = function () {
  126. this.is_btn_jump_desc = true;
  127. this.showDescPanel();
  128. };
  129. YzUserPrivacyPanel.prototype.showDescPanel = function () {
  130. var _this = this;
  131. this._userPrivacyInfo.active = true;
  132. this._userPrivacyInfo.getChildByName("view").getChildByName("LaodingLabel").active = true;
  133. this.scheduleOnce(function () {
  134. var p = new cc.Node();
  135. p.addComponent(cc.Sprite);
  136. var _loop_1 = function (i) {
  137. var p_1 = new cc.Node();
  138. p_1.addComponent(cc.Sprite);
  139. _this._userPrivacyInfo.getComponent(cc.ScrollView).content.addChild(p_1);
  140. // cc.loader.loadRes("img_font/h_" + i, (err, res) => {
  141. // if (!err && cc.isValid(this)) {
  142. // p.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(res);
  143. // console.log(p.width, "===", p.height);
  144. // p.height *= this.scale * this.ratio;
  145. // p.width *= this.scale * this.ratio;
  146. // if (i >= 1) {
  147. // this._userPrivacyInfo.getChildByName("view").getChildByName("LaodingLabel").active = false;
  148. // }
  149. // } else {
  150. // utils.showLog("yinsi");
  151. // }
  152. // })
  153. CompatibleTool_1.default.LoadRes(_this.imgPath + i + ".png", function (err, res) {
  154. if (!err && cc.isValid(_this)) {
  155. p_1.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(res);
  156. p_1.height *= _this.scale * _this.ratio;
  157. p_1.width *= _this.scale * _this.ratio;
  158. if (i >= 1) {
  159. _this._userPrivacyInfo.getChildByName("view").getChildByName("LaodingLabel").active = false;
  160. }
  161. if (i >= _this.imgCount) {
  162. _this.companyInfoNode.zIndex = _this.imgCount;
  163. _this.companyInfoNode.active = true;
  164. if (_this.is_btn_jump_desc) {
  165. _this._userPrivacyInfo.getComponent(cc.ScrollView).content.getChildByName("choiseNode").zIndex = _this.imgCount + 1;
  166. _this._userPrivacyInfo.getComponent(cc.ScrollView).content.getChildByName("choiseNode").active = true;
  167. }
  168. }
  169. }
  170. else {
  171. Utils_1.utils.showMsg("隐私协议加载失败,请关闭窗口重新打开");
  172. }
  173. });
  174. };
  175. for (var i = 1; i <= _this.imgCount; i++) {
  176. _loop_1(i);
  177. }
  178. // let childs = this._userPrivacyInfo.getComponent(cc.ScrollView).content.children;
  179. // for (let i = 0; i < childs.length; i++) {
  180. // childs[i].opacity = 0;
  181. // childs[i].active = true;
  182. // childs[i].runAction(cc.fadeIn(0.3));
  183. // }
  184. }, 0.5);
  185. };
  186. YzUserPrivacyPanel = __decorate([
  187. ccclass
  188. ], YzUserPrivacyPanel);
  189. return YzUserPrivacyPanel;
  190. }(cc.Component));
  191. exports.default = YzUserPrivacyPanel;
  192. cc._RF.pop();