Anonymous 3D Imageboard http://cyberia.digital/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5369 lines
288KB

  1. (window["webpackJsonp"] = window["webpackJsonp"] || []).push([["main"],{
  2. /***/ "./src/$$_lazy_route_resource lazy recursive":
  3. /*!**********************************************************!*\
  4. !*** ./src/$$_lazy_route_resource lazy namespace object ***!
  5. \**********************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports) {
  8. function webpackEmptyAsyncContext(req) {
  9. // Here Promise.resolve().then() is used instead of new Promise() to prevent
  10. // uncaught exception popping up in devtools
  11. return Promise.resolve().then(function() {
  12. var e = new Error("Cannot find module '" + req + "'");
  13. e.code = 'MODULE_NOT_FOUND';
  14. throw e;
  15. });
  16. }
  17. webpackEmptyAsyncContext.keys = function() { return []; };
  18. webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;
  19. module.exports = webpackEmptyAsyncContext;
  20. webpackEmptyAsyncContext.id = "./src/$$_lazy_route_resource lazy recursive";
  21. /***/ }),
  22. /***/ "./src/app/app.component.css":
  23. /*!***********************************!*\
  24. !*** ./src/app/app.component.css ***!
  25. \***********************************/
  26. /*! no static exports found */
  27. /***/ (function(module, exports) {
  28. module.exports = ""
  29. /***/ }),
  30. /***/ "./src/app/app.component.html":
  31. /*!************************************!*\
  32. !*** ./src/app/app.component.html ***!
  33. \************************************/
  34. /*! no static exports found */
  35. /***/ (function(module, exports) {
  36. module.exports = "<router-outlet></router-outlet>\n\n\n"
  37. /***/ }),
  38. /***/ "./src/app/app.component.ts":
  39. /*!**********************************!*\
  40. !*** ./src/app/app.component.ts ***!
  41. \**********************************/
  42. /*! exports provided: AppComponent */
  43. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44. "use strict";
  45. __webpack_require__.r(__webpack_exports__);
  46. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppComponent", function() { return AppComponent; });
  47. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  48. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  49. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  50. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  51. 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;
  52. return c > 3 && r && Object.defineProperty(target, key, r), r;
  53. };
  54. var AppComponent = /** @class */ (function () {
  55. function AppComponent() {
  56. this.title = 'prota-angular';
  57. }
  58. AppComponent = __decorate([
  59. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  60. selector: 'app-root',
  61. template: __webpack_require__(/*! ./app.component.html */ "./src/app/app.component.html"),
  62. styles: [__webpack_require__(/*! ./app.component.css */ "./src/app/app.component.css")]
  63. })
  64. ], AppComponent);
  65. return AppComponent;
  66. }());
  67. /***/ }),
  68. /***/ "./src/app/app.module.ts":
  69. /*!*******************************!*\
  70. !*** ./src/app/app.module.ts ***!
  71. \*******************************/
  72. /*! exports provided: AppModule */
  73. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74. "use strict";
  75. __webpack_require__.r(__webpack_exports__);
  76. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppModule", function() { return AppModule; });
  77. /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js");
  78. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  79. /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  80. /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js");
  81. /* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm5/http.js");
  82. /* harmony import */ var _app_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./app.component */ "./src/app/app.component.ts");
  83. /* harmony import */ var _components_home_home_component__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/home/home.component */ "./src/app/components/home/home.component.ts");
  84. /* harmony import */ var _components_gl_view_gl_view_component__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/gl-view/gl-view.component */ "./src/app/components/gl-view/gl-view.component.ts");
  85. /* harmony import */ var _components_posting_ui_posting_ui_component__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/posting-ui/posting-ui.component */ "./src/app/components/posting-ui/posting-ui.component.ts");
  86. /* harmony import */ var _components_post_viewer_ui_post_viewer_ui_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/post-viewer-ui/post-viewer-ui.component */ "./src/app/components/post-viewer-ui/post-viewer-ui.component.ts");
  87. /* harmony import */ var _components_media_display_media_display_component__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/media-display/media-display.component */ "./src/app/components/media-display/media-display.component.ts");
  88. /* harmony import */ var _components_pin_post_ui_pin_post_ui_component__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/pin-post-ui/pin-post-ui.component */ "./src/app/components/pin-post-ui/pin-post-ui.component.ts");
  89. /* harmony import */ var _components_painting_ui_painting_ui_component__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/painting-ui/painting-ui.component */ "./src/app/components/painting-ui/painting-ui.component.ts");
  90. /* harmony import */ var _components_cmd_ui_cmd_ui_component__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./components/cmd-ui/cmd-ui.component */ "./src/app/components/cmd-ui/cmd-ui.component.ts");
  91. /* harmony import */ var _components_login_login_component__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./components/login/login.component */ "./src/app/components/login/login.component.ts");
  92. /* harmony import */ var _interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./interfaces/player-interface/player-interface.component */ "./src/app/interfaces/player-interface/player-interface.component.ts");
  93. /* harmony import */ var _components_admin_post_admin_post_component__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./components/admin-post/admin-post.component */ "./src/app/components/admin-post/admin-post.component.ts");
  94. /* harmony import */ var _components_admin_map_admin_map_component__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./components/admin-map/admin-map.component */ "./src/app/components/admin-map/admin-map.component.ts");
  95. /* harmony import */ var _components_tile_edit_tile_edit_component__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./components/tile-edit/tile-edit.component */ "./src/app/components/tile-edit/tile-edit.component.ts");
  96. /* harmony import */ var ngx_twitter_timeline__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ngx-twitter-timeline */ "./node_modules/ngx-twitter-timeline/fesm5/ngx-twitter-timeline.js");
  97. /* harmony import */ var _components_phone_poster_phone_poster_component__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./components/phone-poster/phone-poster.component */ "./src/app/components/phone-poster/phone-poster.component.ts");
  98. /* harmony import */ var angularx_qrcode__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! angularx-qrcode */ "./node_modules/angularx-qrcode/dist/index.js");
  99. /* harmony import */ var _components_chat_view_chat_view_component__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./components/chat-view/chat-view.component */ "./src/app/components/chat-view/chat-view.component.ts");
  100. /* harmony import */ var _components_info_view_info_view_component__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./components/info-view/info-view.component */ "./src/app/components/info-view/info-view.component.ts");
  101. /* harmony import */ var ngx_pagination__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ngx-pagination */ "./node_modules/ngx-pagination/dist/ngx-pagination.js");
  102. /* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ngx-device-detector */ "./node_modules/ngx-device-detector/ngx-device-detector.umd.js");
  103. /* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(ngx_device_detector__WEBPACK_IMPORTED_MODULE_25__);
  104. /* harmony import */ var _components_player_ui_player_ui_component__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./components/player-ui/player-ui.component */ "./src/app/components/player-ui/player-ui.component.ts");
  105. /* harmony import */ var _components_ad_post_ui_ad_post_ui_component__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./components/ad-post-ui/ad-post-ui.component */ "./src/app/components/ad-post-ui/ad-post-ui.component.ts");
  106. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  107. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  108. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  109. 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;
  110. return c > 3 && r && Object.defineProperty(target, key, r), r;
  111. };
  112. var appRoutes = [
  113. { path: '',
  114. pathMatch: 'full',
  115. component: _components_home_home_component__WEBPACK_IMPORTED_MODULE_6__["HomeComponent"]
  116. },
  117. { path: 'admin-post', component: _components_admin_post_admin_post_component__WEBPACK_IMPORTED_MODULE_16__["AdminPostComponent"] },
  118. { path: 'admin-map', component: _components_admin_map_admin_map_component__WEBPACK_IMPORTED_MODULE_17__["AdminMapComponent"] },
  119. //{ path: 'home', component: HomeComponent },
  120. { path: 'admin', component: _components_login_login_component__WEBPACK_IMPORTED_MODULE_14__["LoginComponent"] },
  121. { path: 'gl-view', component: _components_gl_view_gl_view_component__WEBPACK_IMPORTED_MODULE_7__["GlViewComponent"] },
  122. { path: 'ch/:map', component: _components_gl_view_gl_view_component__WEBPACK_IMPORTED_MODULE_7__["GlViewComponent"], },
  123. { path: 'painting', component: _components_painting_ui_painting_ui_component__WEBPACK_IMPORTED_MODULE_12__["PaintingUiComponent"] },
  124. { path: 'phone-poster/:id/:key/:canvas', component: _components_phone_poster_phone_poster_component__WEBPACK_IMPORTED_MODULE_20__["PhonePosterComponent"] },
  125. ];
  126. var AppModule = /** @class */ (function () {
  127. function AppModule() {
  128. }
  129. AppModule = __decorate([
  130. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
  131. declarations: [
  132. _app_component__WEBPACK_IMPORTED_MODULE_5__["AppComponent"],
  133. _components_home_home_component__WEBPACK_IMPORTED_MODULE_6__["HomeComponent"],
  134. _components_gl_view_gl_view_component__WEBPACK_IMPORTED_MODULE_7__["GlViewComponent"],
  135. _components_posting_ui_posting_ui_component__WEBPACK_IMPORTED_MODULE_8__["PostingUIComponent"],
  136. _components_post_viewer_ui_post_viewer_ui_component__WEBPACK_IMPORTED_MODULE_9__["PostViewerUiComponent"],
  137. _components_media_display_media_display_component__WEBPACK_IMPORTED_MODULE_10__["MediaDisplayComponent"],
  138. _components_pin_post_ui_pin_post_ui_component__WEBPACK_IMPORTED_MODULE_11__["PinPostUiComponent"],
  139. _components_painting_ui_painting_ui_component__WEBPACK_IMPORTED_MODULE_12__["PaintingUiComponent"],
  140. _components_cmd_ui_cmd_ui_component__WEBPACK_IMPORTED_MODULE_13__["CmdUiComponent"],
  141. _components_login_login_component__WEBPACK_IMPORTED_MODULE_14__["LoginComponent"],
  142. _interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_15__["PlayerInterfaceComponent"],
  143. _components_admin_post_admin_post_component__WEBPACK_IMPORTED_MODULE_16__["AdminPostComponent"],
  144. _components_admin_map_admin_map_component__WEBPACK_IMPORTED_MODULE_17__["AdminMapComponent"],
  145. _components_tile_edit_tile_edit_component__WEBPACK_IMPORTED_MODULE_18__["TileEditComponent"],
  146. _components_phone_poster_phone_poster_component__WEBPACK_IMPORTED_MODULE_20__["PhonePosterComponent"],
  147. _components_chat_view_chat_view_component__WEBPACK_IMPORTED_MODULE_22__["ChatViewComponent"],
  148. _components_info_view_info_view_component__WEBPACK_IMPORTED_MODULE_23__["InfoViewComponent"],
  149. _components_player_ui_player_ui_component__WEBPACK_IMPORTED_MODULE_26__["PlayerUiComponent"],
  150. _components_ad_post_ui_ad_post_ui_component__WEBPACK_IMPORTED_MODULE_27__["AdPostUiComponent"]
  151. ],
  152. imports: [
  153. angularx_qrcode__WEBPACK_IMPORTED_MODULE_21__["QRCodeModule"],
  154. _angular_platform_browser__WEBPACK_IMPORTED_MODULE_0__["BrowserModule"],
  155. ngx_pagination__WEBPACK_IMPORTED_MODULE_24__["NgxPaginationModule"],
  156. ngx_device_detector__WEBPACK_IMPORTED_MODULE_25__["DeviceDetectorModule"].forRoot(),
  157. _angular_forms__WEBPACK_IMPORTED_MODULE_3__["FormsModule"],
  158. _angular_common_http__WEBPACK_IMPORTED_MODULE_4__["HttpClientModule"],
  159. ngx_twitter_timeline__WEBPACK_IMPORTED_MODULE_19__["NgxTwitterTimelineModule"],
  160. _angular_router__WEBPACK_IMPORTED_MODULE_2__["RouterModule"].forRoot(appRoutes)
  161. ],
  162. providers: [],
  163. bootstrap: [_app_component__WEBPACK_IMPORTED_MODULE_5__["AppComponent"]]
  164. })
  165. ], AppModule);
  166. return AppModule;
  167. }());
  168. /***/ }),
  169. /***/ "./src/app/components/ad-post-ui/ad-post-ui.component.css":
  170. /*!****************************************************************!*\
  171. !*** ./src/app/components/ad-post-ui/ad-post-ui.component.css ***!
  172. \****************************************************************/
  173. /*! no static exports found */
  174. /***/ (function(module, exports) {
  175. module.exports = "#container{\n border-style : solid;\n border-width : 2px;\n border-color : rgb(60, 68, 61);\n border-radius : 3px;\n margin: 8px\n}\n\n#close-btn{\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n}\n\n#desc{\n \n background-image: url(\"/assets/img/tool_bar_bg.png\");\n background-repeat: repeat-x;\n background-position: bottom;\n position: absolute;\n bottom: 0px;\n text-align: center;\n margin: 8px;\n right: 0px;\n color: aliceblue;\n padding-top: 20px;\n padding-right: 8px;\n padding-left: px;\n}\n\ndiv {\n max-width: 250px;\n max-height: 250px;\n overflow: hidden;\n}\n\nimg{\n max-width: 250px;\n max-height: 350px;\n}"
  176. /***/ }),
  177. /***/ "./src/app/components/ad-post-ui/ad-post-ui.component.html":
  178. /*!*****************************************************************!*\
  179. !*** ./src/app/components/ad-post-ui/ad-post-ui.component.html ***!
  180. \*****************************************************************/
  181. /*! no static exports found */
  182. /***/ (function(module, exports) {
  183. module.exports = "<div id=\"container\" *ngIf=\"currentURL != null\">\n<div id=\"close-btn\" (click)=\"closeAd()\">❎</div>\n<a href=\"{{currentURL}}\" (click)=\"clickAd()\" target=\"blank_\">\n <div><img src=\"{{currentImg}}\"/>\n <div id=\"desc\">\n <b>{{currentDesc}}</b> 📦🔥\n </div>\n </div>\n</a>\n</div>\n"
  184. /***/ }),
  185. /***/ "./src/app/components/ad-post-ui/ad-post-ui.component.ts":
  186. /*!***************************************************************!*\
  187. !*** ./src/app/components/ad-post-ui/ad-post-ui.component.ts ***!
  188. \***************************************************************/
  189. /*! exports provided: AdPostUiComponent */
  190. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  191. "use strict";
  192. __webpack_require__.r(__webpack_exports__);
  193. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AdPostUiComponent", function() { return AdPostUiComponent; });
  194. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  195. /* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  196. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  197. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  198. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  199. 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;
  200. return c > 3 && r && Object.defineProperty(target, key, r), r;
  201. };
  202. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  203. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  204. };
  205. var AdPostUiComponent = /** @class */ (function () {
  206. function AdPostUiComponent(chanWebService) {
  207. this.chanWebService = chanWebService;
  208. this.country = "us";
  209. this.adIndex = 0;
  210. this.close = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  211. }
  212. AdPostUiComponent.prototype.ngOnInit = function () {
  213. var _this = this;
  214. this.lang = navigator.language;
  215. /*
  216. if(this.lang.toLowerCase().indexOf("us")> -1){
  217. this.country = "us";
  218. } else if(this.lang.toLowerCase().indexOf("fr")> -1){
  219. this.country = "fr";
  220. }*/
  221. //Map made! We load the money maker
  222. this.chanWebService.getAds().subscribe(function (ads) {
  223. //console.log(ads);
  224. _this.adsFiltered = new Array();
  225. for (var a = 0; a < ads.length; a++) {
  226. if (ads[a].loc === _this.country) {
  227. _this.adsFiltered.push(ads[a]);
  228. }
  229. }
  230. console.log(_this.adsFiltered);
  231. _this.adIndex = Math.floor(Math.random() * Math.floor(_this.adsFiltered.length));
  232. _this.displayAd();
  233. /*this.myInterval = setInterval(()=>{
  234. this.updateAd();
  235. }, 15000);*/
  236. });
  237. };
  238. AdPostUiComponent.prototype.displayAd = function () {
  239. var ad = this.adsFiltered[this.adIndex];
  240. this.currentURL = ad.url;
  241. this.currentImg = ad.picture;
  242. this.currentDesc = ad.name;
  243. };
  244. AdPostUiComponent.prototype.updateAd = function () {
  245. this.adIndex++;
  246. console.log(this.adsFiltered);
  247. if (this.adIndex >= this.adsFiltered.length)
  248. this.adIndex = 0;
  249. if (this.adsFiltered.length > 0)
  250. this.displayAd();
  251. };
  252. AdPostUiComponent.prototype.gotTo = function (url_) {
  253. window.open(url_, '_blank');
  254. };
  255. __decorate([
  256. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(),
  257. __metadata("design:type", Object)
  258. ], AdPostUiComponent.prototype, "close", void 0);
  259. AdPostUiComponent = __decorate([
  260. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  261. selector: 'app-ad-post-ui',
  262. template: __webpack_require__(/*! ./ad-post-ui.component.html */ "./src/app/components/ad-post-ui/ad-post-ui.component.html"),
  263. styles: [__webpack_require__(/*! ./ad-post-ui.component.css */ "./src/app/components/ad-post-ui/ad-post-ui.component.css")]
  264. }),
  265. __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__["ChanWebService"]])
  266. ], AdPostUiComponent);
  267. return AdPostUiComponent;
  268. }());
  269. /***/ }),
  270. /***/ "./src/app/components/admin-map/admin-map.component.css":
  271. /*!**************************************************************!*\
  272. !*** ./src/app/components/admin-map/admin-map.component.css ***!
  273. \**************************************************************/
  274. /*! no static exports found */
  275. /***/ (function(module, exports) {
  276. module.exports = ".container{\n height: 100%;\n}\n\n.post-viewer-ui-message{\n\n position: relative;\n top:8px;\n bottom:18px;\n overflow : scroll;\n height: 85%;\n width: 100%;\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n background: rgb(247, 189, 203);\n border-style: solid;\n border-width: 1px;\n border-color: rgb(181, 134, 145);\n border-radius: 5px;\n}\n\n.ascii-art {\n font-family: monospace;\n font-family: \"Lucida Console\", monospace;\n letter-spacing: 0.2em;\n line-height: 0.8em;\n}"
  277. /***/ }),
  278. /***/ "./src/app/components/admin-map/admin-map.component.html":
  279. /*!***************************************************************!*\
  280. !*** ./src/app/components/admin-map/admin-map.component.html ***!
  281. \***************************************************************/
  282. /*! no static exports found */
  283. /***/ (function(module, exports) {
  284. module.exports = "<div class=\"container\">\n <a routerLink=\"/admin-post\">Posts</a> - <a routerLink=\"/admin-map\">Maps</a> - <a routerLink=\"/gl-view\">Go Game!</a>\n <div class=\"post-viewer-ui-message\">\n <select id=\"map-select\" [(ngModel)]=\"selectedMapKey\" (change)=\"onChangeMap($event.target.value)\">\n <option *ngFor=\"let map of maps\" value=\"{{map.key}}\">{{map.name}}</option>\n </select>\n <br/>\n <button (click)=\"moveMap(3)\">Go West</button>\n <button (click)=\"moveMap(0)\">Go North</button>\n <button (click)=\"moveMap(2)\">Go South</button>\n <button (click)=\"moveMap(1)\">Go East</button> <br/>\n ----------------------------------<br/>\n <div *ngIf=\"selectedMap != null\">\n Map name: {{selectedMap.name}} ({{selectedMap.x}}, {{selectedMap.y}})<br/>\n Map key: <b>{{selectedMap.key}}</b><br/>\n Map width: {{selectedMap.width}}<br/>\n Map height: {{selectedMap.height}}<br/>\n ----------------------------------<br/>\n Door North <input [(ngModel)]=\"selectedMap.door_key_n\" /><br/>\n Door East <input [(ngModel)]=\"selectedMap.door_key_e\" /><br/>\n Door South <input [(ngModel)]=\"selectedMap.door_key_s\" /><br/>\n Door West <input [(ngModel)]=\"selectedMap.door_key_w\" /><br/>\n ----------------------------------<br/>\n <div *ngFor=\"let line of mapDataLines; index as y\" class=\"ascii-art\">\n <span *ngFor=\"let tile of line; index as x \">\n <app-tile-edit [tileValue] =\"tile\"\n [allTiles]=\"allTiles\"\n [x]=\"x\" [y]=\"y\" (valueChange)=\"onChangeTileAt($event.x,$event.y)\">\n </app-tile-edit>\n </span>\n </div>\n\n \n <select id=\"tile-select\" [(ngModel)]=\"selectedTileVal\" (change)=\"onChangeTileBrush($event.target.value)\">\n <option *ngFor=\"let tile of allTiles\" value=\"{{tile.value}}\">{{tile.name}} {{tile.display}} ({{tile.value}})</option>\n </select>\n <button (click)=\"saveMap()\">Save the new map</button>\n </div>\n\n <div *ngIf=\"selectedMap == null\">\n There's NOTHING here! ({{currentX}}, {{currentY}})\n </div>\n </div>\n</div>"
  285. /***/ }),
  286. /***/ "./src/app/components/admin-map/admin-map.component.ts":
  287. /*!*************************************************************!*\
  288. !*** ./src/app/components/admin-map/admin-map.component.ts ***!
  289. \*************************************************************/
  290. /*! exports provided: AdminMapComponent */
  291. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  292. "use strict";
  293. __webpack_require__.r(__webpack_exports__);
  294. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AdminMapComponent", function() { return AdminMapComponent; });
  295. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  296. /* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  297. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  298. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  299. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  300. 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;
  301. return c > 3 && r && Object.defineProperty(target, key, r), r;
  302. };
  303. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  304. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  305. };
  306. var AdminMapComponent = /** @class */ (function () {
  307. function AdminMapComponent(chanWebService) {
  308. this.chanWebService = chanWebService;
  309. this.selectedTileVal = 0;
  310. this.mapData = [];
  311. this.mapDataLines = [];
  312. }
  313. AdminMapComponent.prototype.ngOnInit = function () {
  314. var _this = this;
  315. this.chanWebService.getAllMaps().subscribe(function (data_) {
  316. _this.maps = data_.result;
  317. if (_this.maps.length > 0) {
  318. //We looking for the alpha map
  319. _this.maps.forEach(function (map) {
  320. if (map.name === "alpha") {
  321. _this.selectedMapKey = map.key;
  322. _this.onChangeMap(_this.selectedMapKey);
  323. }
  324. });
  325. }
  326. });
  327. this.chanWebService.getAllTiles().subscribe(function (data_) {
  328. _this.allTiles = data_.result;
  329. _this.selectedTileVal = _this.allTiles[0].value;
  330. });
  331. };
  332. AdminMapComponent.prototype.onChangeMap = function (key_) {
  333. var _this = this;
  334. this.selectedMapKey = key_;
  335. this.maps.forEach(function (map) {
  336. if (map.key == key_) {
  337. _this.selectedMap = map;
  338. _this.currentX = _this.selectedMap.x;
  339. _this.currentY = _this.selectedMap.y;
  340. //Parsing the map datas
  341. _this.mapData = _this.selectedMap.level_data.split(",");
  342. _this.mapDataLines = [];
  343. var n = 0;
  344. for (var h = 0; h < _this.selectedMap.height; h++) {
  345. var mapDataWidth = [];
  346. for (var w = 0; w < _this.selectedMap.width; w++) {
  347. mapDataWidth.push(_this.mapData[n]);
  348. n++;
  349. }
  350. _this.mapDataLines.push(mapDataWidth);
  351. }
  352. }
  353. });
  354. };
  355. AdminMapComponent.prototype.onChangeTileBrush = function (val_) {
  356. this.selectedTileVal = val_;
  357. };
  358. AdminMapComponent.prototype.onChangeTileAt = function (x_, y_) {
  359. console.log(this.selectedTileVal + "," + x_ + "," + y_);
  360. var lineTemp = this.mapDataLines[y_];
  361. lineTemp[x_] = this.selectedTileVal.toString();
  362. this.mapDataLines[y_] = lineTemp;
  363. console.log(this.mapDataLines);
  364. };
  365. AdminMapComponent.prototype.saveMap = function () {
  366. var tempNewData = "";
  367. for (var y = 0; y < this.mapDataLines.length; y++) {
  368. var line = this.mapDataLines[y];
  369. for (var x = 0; x < line.length; x++) {
  370. tempNewData = tempNewData + line[x] + ",";
  371. }
  372. }
  373. this.selectedMap.level_data = tempNewData;
  374. console.log(this.selectedMap);
  375. this.chanWebService.saveMapModel(this.selectedMap).subscribe(function (data_) {
  376. alert(JSON.stringify(data_));
  377. });
  378. };
  379. AdminMapComponent.prototype.moveMap = function (dir_) {
  380. var _this = this;
  381. switch (dir_) {
  382. //North
  383. case 0:
  384. this.currentY--;
  385. break;
  386. //East
  387. case 1:
  388. this.currentX++;
  389. break;
  390. //South
  391. case 2:
  392. this.currentY++;
  393. break;
  394. //West
  395. case 3:
  396. this.currentX--;
  397. break;
  398. }
  399. this.selectedMap = null;
  400. this.maps.forEach(function (map) {
  401. if (map.x == _this.currentX && map.y == _this.currentY) {
  402. _this.onChangeMap(map.key);
  403. }
  404. });
  405. };
  406. AdminMapComponent = __decorate([
  407. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  408. selector: 'app-admin-map',
  409. template: __webpack_require__(/*! ./admin-map.component.html */ "./src/app/components/admin-map/admin-map.component.html"),
  410. styles: [__webpack_require__(/*! ./admin-map.component.css */ "./src/app/components/admin-map/admin-map.component.css")]
  411. }),
  412. __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__["ChanWebService"]])
  413. ], AdminMapComponent);
  414. return AdminMapComponent;
  415. }());
  416. /***/ }),
  417. /***/ "./src/app/components/admin-post/admin-post.component.css":
  418. /*!****************************************************************!*\
  419. !*** ./src/app/components/admin-post/admin-post.component.css ***!
  420. \****************************************************************/
  421. /*! no static exports found */
  422. /***/ (function(module, exports) {
  423. module.exports = ".container{\n height: 100%;\n}\n\n.post-viewer-ui-message{\n\n position: relative;\n top:8px;\n bottom:18px;\n overflow : scroll;\n height: 85%;\n /*max-width: 450px;*/\n width: 100%;\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n background: rgb(247, 189, 203);\n border-style: solid;\n border-width: 1px;\n border-color: rgb(181, 134, 145);\n border-radius: 5px;\n}\n\nimg{\n max-width:150px;\n max-height:150px;\n}\n\n/*\ndiv {\n margin-bottom: 8px;\n}*/\n\n::ng-deep .img-preview img, .img-preview video, .img-preview iframe, .img-preview audio {\n max-width: 600px;\n max-height: 400px;\n}"
  424. /***/ }),
  425. /***/ "./src/app/components/admin-post/admin-post.component.html":
  426. /*!*****************************************************************!*\
  427. !*** ./src/app/components/admin-post/admin-post.component.html ***!
  428. \*****************************************************************/
  429. /*! no static exports found */
  430. /***/ (function(module, exports) {
  431. module.exports = "<div class=\"container\">\n <a routerLink=\"/admin-post\">Posts</a> - <a routerLink=\"/admin-map\">Maps</a> - <a routerLink=\"/ch/alpha\">Go Game!</a>\n<div class=\"post-viewer-ui-message\">\n\n <input [(ngModel)]=\"valToDelete\"> <button (click)=\"deleteVal()\">Delete</button> --------- <button type=\"button\" class=\"btn btn-primary\" (click)=\"updatePost()\">update</button>\n <div *ngFor=\"let post of posts| paginate: { itemsPerPage: 20, currentPage: p }\">\n N° {{post.id}} <span *ngIf=\"post.is_canon\">👌</span><br/>\n Player: {{post.player_id}}<br/>\n IP: {{post.player_ip}}<br/>\n CHAN: <span class=\"badge badge-light\">{{post.map_key}}</span><br/>\n\n <img src=\"{{post.url}}\"/>\n Url: <a href=\"{{post.url}}\">{{post.url}}</a><br/>\n Message: {{post.message}}<br/>\n \n <div *ngIf=\"post.was_deleted\"> \n <div class=\"alert alert-danger\" role=\"alert\">\n Thanks, post has been succesfuly DELETED!\n </div>\n </div>\n\n <div *ngIf=\"!post.was_deleted\">\n\n <button type=\"button\" class=\"btn btn-success\" (click) = \"canonPost(post.id,post.map_key)\" >Active or Disactive canon status 👌</button><br/>\n <button type=\"button\" class=\"btn btn-warning\" (click) = \"deletePost(post)\" >Delete the post 🗑️</button><br/>\n <button type=\"button\" class=\"btn btn-danger\" (click) = \"setBan(post.id)\" >Ban user 🔨</button><br/>\n </div>\n -----------------------------------------<br/>\n </div>\n <pagination-controls (pageChange)=\"p = $event\"></pagination-controls>\n </div>\n</div>\n"
  432. /***/ }),
  433. /***/ "./src/app/components/admin-post/admin-post.component.ts":
  434. /*!***************************************************************!*\
  435. !*** ./src/app/components/admin-post/admin-post.component.ts ***!
  436. \***************************************************************/
  437. /*! exports provided: AdminPostComponent */
  438. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  439. "use strict";
  440. __webpack_require__.r(__webpack_exports__);
  441. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AdminPostComponent", function() { return AdminPostComponent; });
  442. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  443. /* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  444. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  445. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  446. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  447. 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;
  448. return c > 3 && r && Object.defineProperty(target, key, r), r;
  449. };
  450. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  451. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  452. };
  453. var AdminPostComponent = /** @class */ (function () {
  454. function AdminPostComponent(chanWebService) {
  455. this.chanWebService = chanWebService;
  456. this.posts = [];
  457. this.valToDelete = "";
  458. this.p = 1;
  459. }
  460. AdminPostComponent.prototype.ngOnInit = function () {
  461. this.updatePost();
  462. };
  463. AdminPostComponent.prototype.updatePost = function () {
  464. var _this = this;
  465. this.chanWebService.getAllPost().subscribe(function (data_) {
  466. _this.posts = data_.result.reverse();
  467. });
  468. };
  469. AdminPostComponent.prototype.deletePost = function (postModel_) {
  470. var _this = this;
  471. this.postToDelete = postModel_;
  472. console.log("this.postToDelete:" + this.postToDelete);
  473. this.chanWebService.deletePost(postModel_.id, postModel_.map_key).subscribe(
  474. //Data success
  475. function (data) {
  476. //alert(JSON.stringify(data));
  477. //this.updatePost();
  478. _this.posts.find(function (post_) {
  479. return (post_.id == _this.postToDelete.id);
  480. }).was_deleted = true;
  481. });
  482. };
  483. AdminPostComponent.prototype.deleteVal = function () {
  484. var _this = this;
  485. this.chanWebService.deletePostForVal(this.valToDelete).subscribe(
  486. //Data success
  487. function (data) {
  488. alert(JSON.stringify(data));
  489. _this.updatePost();
  490. });
  491. };
  492. AdminPostComponent.prototype.setBan = function (id_) {
  493. var _this = this;
  494. this.chanWebService.setBan(id_).subscribe(
  495. //Data success
  496. function (data) {
  497. alert(JSON.stringify(data));
  498. _this.updatePost();
  499. });
  500. };
  501. AdminPostComponent.prototype.canonPost = function (id_, thread_) {
  502. var _this = this;
  503. this.chanWebService.canonPost(id_, thread_).subscribe(
  504. //Data success
  505. function (data) {
  506. alert(JSON.stringify(data));
  507. _this.updatePost();
  508. });
  509. };
  510. AdminPostComponent.prototype.banPost = function () {
  511. };
  512. AdminPostComponent = __decorate([
  513. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  514. selector: 'app-admin-post',
  515. template: __webpack_require__(/*! ./admin-post.component.html */ "./src/app/components/admin-post/admin-post.component.html"),
  516. styles: [__webpack_require__(/*! ./admin-post.component.css */ "./src/app/components/admin-post/admin-post.component.css")]
  517. }),
  518. __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_1__["ChanWebService"]])
  519. ], AdminPostComponent);
  520. return AdminPostComponent;
  521. }());
  522. /***/ }),
  523. /***/ "./src/app/components/chat-view/chat-view.component.css":
  524. /*!**************************************************************!*\
  525. !*** ./src/app/components/chat-view/chat-view.component.css ***!
  526. \**************************************************************/
  527. /*! no static exports found */
  528. /***/ (function(module, exports) {
  529. module.exports = "#container{\n display:block;\n /*height: 255px;*/\n width: 340px;\n color:white;\n padding: 8px;\n}\n\n.bgChatUI{\n margin: 4px; \n bottom: 60px;\n /*height: 200px;\n overflow-y: scroll;*/\n font-size: 12px;\n }\n\n.yourPlayer{\n color:rgb(155, 155, 155);\n }\n\n.inputChat{\n /*position: absolute;\n bottom: 0px;\n height: 50px;*/\n width: 100%;\n text-align: center;\n }\n\n.bgLineUI{\n border-radius: 5px;\n background: rgba(46, 46, 46, 0.9);\n font-size: 12px;\n padding: 5px;\n}"
  530. /***/ }),
  531. /***/ "./src/app/components/chat-view/chat-view.component.html":
  532. /*!***************************************************************!*\
  533. !*** ./src/app/components/chat-view/chat-view.component.html ***!
  534. \***************************************************************/
  535. /*! no static exports found */
  536. /***/ (function(module, exports) {
  537. module.exports = "<div id=\"container\">\n <div class=\"bgChatUI\">\n <div *ngIf=\"gameDataModel.actions != undefined && gameDataModel.actions.length\">\n <div *ngFor=\"let action of gameDataModel.actions, let index = index;\">\n <br/>\n <span\n class=\"bgLineUI\"\n *ngIf=\"index > gameDataModel.actions.length-6\"\n [ngStyle]=\"{'color': (action.player_id == gameDataModel.player.id) ? 'rgb(239, 147, 162)' : 'white' }\">\n <b>#{{action.player_id}} <span *ngIf=\"action.player_id == gameDataModel.player.id\">(you)</span></b>{{action.value}}<br/></span>\n </div>\n </div>\n</div>\n<div class=\"inputChat input-group\">\n <input class=\"form-control mr-sm-2\" [(ngModel)]=\"messageToPost\" type=\"text\" placeholder=\"Talk here.\">\n <button class=\"btn btn-secondary my-2 my-sm-0\" (click)=\"postMessage()\">send</button>\n</div>\n</div>\n"
  538. /***/ }),
  539. /***/ "./src/app/components/chat-view/chat-view.component.ts":
  540. /*!*************************************************************!*\
  541. !*** ./src/app/components/chat-view/chat-view.component.ts ***!
  542. \*************************************************************/
  543. /*! exports provided: ChatViewComponent */
  544. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  545. "use strict";
  546. __webpack_require__.r(__webpack_exports__);
  547. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChatViewComponent", function() { return ChatViewComponent; });
  548. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  549. /* harmony import */ var _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/game-data.model */ "./src/app/models/game-data.model.ts");
  550. /* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  551. /* harmony import */ var src_app_models_action_model__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/models/action.model */ "./src/app/models/action.model.ts");
  552. /* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  553. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  554. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  555. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  556. 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;
  557. return c > 3 && r && Object.defineProperty(target, key, r), r;
  558. };
  559. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  560. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  561. };
  562. var ChatViewComponent = /** @class */ (function () {
  563. function ChatViewComponent(chanWS, gameUIServiceService) {
  564. this.chanWS = chanWS;
  565. this.gameUIServiceService = gameUIServiceService;
  566. this.gameDataModel = new _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__["GameDataModel"]();
  567. this.messageToPost = "";
  568. }
  569. ChatViewComponent.prototype.ngOnInit = function () {
  570. };
  571. ChatViewComponent.prototype.postMessage = function () {
  572. var _this = this;
  573. var action = new src_app_models_action_model__WEBPACK_IMPORTED_MODULE_3__["ActionModel"]();
  574. action.value = this.messageToPost;
  575. action.action = "talk";
  576. this.messageToPost = "";
  577. this.chanWS.createLog(action).subscribe(
  578. //Data success
  579. function (data) {
  580. console.log(data);
  581. _this.gameUIServiceService.forceWS();
  582. });
  583. };
  584. __decorate([
  585. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  586. __metadata("design:type", _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__["GameDataModel"])
  587. ], ChatViewComponent.prototype, "gameDataModel", void 0);
  588. ChatViewComponent = __decorate([
  589. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  590. selector: 'app-chat-view',
  591. template: __webpack_require__(/*! ./chat-view.component.html */ "./src/app/components/chat-view/chat-view.component.html"),
  592. styles: [__webpack_require__(/*! ./chat-view.component.css */ "./src/app/components/chat-view/chat-view.component.css")]
  593. }),
  594. __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__["ChanWebService"],
  595. _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_4__["GameUIServiceService"]])
  596. ], ChatViewComponent);
  597. return ChatViewComponent;
  598. }());
  599. /***/ }),
  600. /***/ "./src/app/components/cmd-ui/cmd-ui.component.css":
  601. /*!********************************************************!*\
  602. !*** ./src/app/components/cmd-ui/cmd-ui.component.css ***!
  603. \********************************************************/
  604. /*! no static exports found */
  605. /***/ (function(module, exports) {
  606. module.exports = "#commandPrompt{\n background-color: black;\n color: green;\n font-family: 'Courier New', Courier, monospace;\n text-align: left;\n height: 100%;\n padding: 2px;\n}\n\n#commandInput{\n color: black;\n background-color: green;\n width:100%;\n border: none;\n}\n\n::-webkit-input-placeholder { /* Firefox, Chrome, Opera */ \n color: white; \n}\n\n::-ms-input-placeholder { /* Firefox, Chrome, Opera */ \n color: white; \n}\n\n::placeholder { /* Firefox, Chrome, Opera */ \n color: white; \n} "
  607. /***/ }),
  608. /***/ "./src/app/components/cmd-ui/cmd-ui.component.html":
  609. /*!*********************************************************!*\
  610. !*** ./src/app/components/cmd-ui/cmd-ui.component.html ***!
  611. \*********************************************************/
  612. /*! no static exports found */
  613. /***/ (function(module, exports) {
  614. module.exports = "<button (click)=\"close()\" >Close</button>\n<div id=\"commandPrompt\">\n /dungeon/users/anon$<br/>\n <input id=\"commandInput\" type=\"text\" placeholder=\"\" [(ngModel)]=\"commandTyped\" placeholder=\">type command here_\">\n <button (click)=\"sendCMD()\">send</button>\n <br/>\n <div>\n <div *ngFor=\"let reply of commandReplies\">{{reply}}</div>\n </div>\n</div>"
  615. /***/ }),
  616. /***/ "./src/app/components/cmd-ui/cmd-ui.component.ts":
  617. /*!*******************************************************!*\
  618. !*** ./src/app/components/cmd-ui/cmd-ui.component.ts ***!
  619. \*******************************************************/
  620. /*! exports provided: CmdUiComponent */
  621. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  622. "use strict";
  623. __webpack_require__.r(__webpack_exports__);
  624. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CmdUiComponent", function() { return CmdUiComponent; });
  625. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  626. /* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  627. /* harmony import */ var _services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  628. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  629. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  630. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  631. 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;
  632. return c > 3 && r && Object.defineProperty(target, key, r), r;
  633. };
  634. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  635. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  636. };
  637. var CmdUiComponent = /** @class */ (function () {
  638. function CmdUiComponent(gameUIServiceService, chanWebService) {
  639. this.gameUIServiceService = gameUIServiceService;
  640. this.chanWebService = chanWebService;
  641. this.commandReplies = [];
  642. }
  643. CmdUiComponent.prototype.ngOnInit = function () {
  644. };
  645. CmdUiComponent.prototype.close = function () {
  646. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING);
  647. };
  648. CmdUiComponent.prototype.sendCMD = function () {
  649. if (this.commandTyped) {
  650. this.commandReplies.unshift(">" + this.commandTyped);
  651. this.analysisCMD(this.commandTyped);
  652. this.commandTyped = "";
  653. }
  654. };
  655. /********************
  656. * COMMAND ANALYSIS
  657. * ******************/
  658. CmdUiComponent.prototype.analysisCMD = function (cmd_) {
  659. var cmdData = cmd_.split(" ");
  660. if (cmdData[0] == "adminconnect" && cmdData[1]) {
  661. this.commandReplies.unshift("#### TRY TO CONNECT ADMIN #####");
  662. this.connectAdmin(cmdData[1]);
  663. }
  664. else if (cmdData[0] == "admininit" && cmdData[1]) {
  665. this.commandReplies.unshift("#### TRY TO INIT ADMIN #####");
  666. this.setAdminPassword(cmdData[1]);
  667. }
  668. else if (cmdData[0] == "logout" && cmdData[1]) {
  669. this.commandReplies.unshift("#### LOGOUT #####");
  670. this.logout();
  671. }
  672. else if (cmdData[0] == "admintest") {
  673. this.commandReplies.unshift("#### TEST ADMIN CONNECTION #####");
  674. this.isAdminConnected();
  675. }
  676. else {
  677. this.commandReplies.unshift("!command not recognized!");
  678. }
  679. };
  680. CmdUiComponent.prototype.isAdminConnected = function () {
  681. var _this = this;
  682. this.chanWebService.isAdminConnected().subscribe(function (data_) {
  683. if (data_.ok) {
  684. if (data_.result === "true") {
  685. _this.commandReplies.unshift("***** Admin is connected *****");
  686. }
  687. else {
  688. _this.commandReplies.unshift("***** Admin is not connected *****");
  689. }
  690. _this.commandReplies.unshift(data_.result);
  691. }
  692. else {
  693. _this.commandReplies.unshift("!error!");
  694. }
  695. });
  696. };
  697. CmdUiComponent.prototype.connectAdmin = function (password_) {
  698. var _this = this;
  699. this.chanWebService.connectAdmin(password_).subscribe(function (data_) {
  700. if (data_.ok) {
  701. _this.commandReplies.unshift("***** Admin connected *****");
  702. _this.commandReplies.unshift(data_.result);
  703. }
  704. else {
  705. _this.commandReplies.unshift("!error!");
  706. }
  707. });
  708. };
  709. CmdUiComponent.prototype.setAdminPassword = function (password_) {
  710. var _this = this;
  711. this.chanWebService.setAdminPassword(password_).subscribe(function (data_) {
  712. if (data_.ok) {
  713. _this.commandReplies.unshift("***** Set password successful *****");
  714. _this.commandReplies.unshift(data_.result);
  715. }
  716. else {
  717. _this.commandReplies.unshift("!error!");
  718. }
  719. });
  720. };
  721. CmdUiComponent.prototype.logout = function () {
  722. var _this = this;
  723. this.chanWebService.logout().subscribe(function (data_) {
  724. if (data_.ok) {
  725. _this.commandReplies.unshift("***** Logout successful *****");
  726. _this.commandReplies.unshift(data_.result);
  727. }
  728. else {
  729. _this.commandReplies.unshift("!error!");
  730. }
  731. });
  732. };
  733. CmdUiComponent = __decorate([
  734. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  735. selector: 'app-cmd-ui',
  736. template: __webpack_require__(/*! ./cmd-ui.component.html */ "./src/app/components/cmd-ui/cmd-ui.component.html"),
  737. styles: [__webpack_require__(/*! ./cmd-ui.component.css */ "./src/app/components/cmd-ui/cmd-ui.component.css")]
  738. }),
  739. __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"], _services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__["ChanWebService"]])
  740. ], CmdUiComponent);
  741. return CmdUiComponent;
  742. }());
  743. /***/ }),
  744. /***/ "./src/app/components/gl-view/gl-view.component.css":
  745. /*!**********************************************************!*\
  746. !*** ./src/app/components/gl-view/gl-view.component.css ***!
  747. \**********************************************************/
  748. /*! no static exports found */
  749. /***/ (function(module, exports) {
  750. module.exports = "#renderCanvas{\n width: 100%;\n height: 100%;\n}\n\n/*\nGAME UI\n*/\n\n.ui-game-container{\n z-index : 10;\n height: 100%;\n }\n\n.ui-game{\n z-index : 10;\n}\n\n.ui-game-frame{\n z-index : 11;\n height: 95%;\n width: 95%;\n }\n\n#mainUI{\n position:absolute;\n top:8px;\n left:8px;\n color: white;\n}\n\n#titleLabel{\n text-align: center;\n font-size: 1em;\n}\n\n#pointerDesc{\n\n position:absolute;\n top:20px;\n max-width : 200px;\n color: white;\n text-align: center;\n left: 0;\n right: 0;\n margin: auto;\n}\n\n#chanDisplay{\n position:absolute;\n top:10px;\n max-width :480px;\n text-align: center;\n left: 0;\n right: 0;\n margin: auto;\n color: white;\n}\n\n#pointerInteract{\n position:absolute;\n bottom:10px;\n max-width : 380px;\n color: white;\n text-align: center;\n left: 0;\n right: 0;\n margin: auto;\n}\n\n#postingUI{\n position:absolute;\n top:20px;\n /*max-width: 650px;*/\n left: 0;\n right: 0;\n margin: auto;\n text-align: left;\n}\n\n#player-bar{\n /*\n background-image: url(\"/assets/img/tool_bar_bg.png\");\n background-repeat: repeat-x;\n background-position: bottom;*/\n\n background-size: 100% 100%;\n color: rgb(206, 206, 206);\n height: 175px;\n width: 100%;\n position:absolute;\n bottom: 0px;\n right: 0px;\n left: 0px;\n margin:8px;\n}\n\n#player-bar-right{\n position:absolute;\n bottom: 0px;\n right: 0;\n padding: 11px;\n text-align: right;\n margin-right:16px;\n}\n\n#player-bar-left{\n position:absolute;\n bottom: 0px;\n left: 0;\n padding: 11px;\n text-align: left;\n}\n\n#pin-ui{\n position:absolute;\n top:0px;\n right: 0;\n max-width: 300px;\n max-height: 300px;\n text-align: right;\n}\n\n#ad-ui{\n position:absolute;\n top:0px;\n right: 0;\n max-width: 250px;\n max-height: 300px;\n text-align: right;\n}\n\n.spoil{\n width: 100%;\n background-color: rgb(71, 71, 71);\n color: rgb(71, 71, 71);\n}\n\n.pointer{\n cursor: pointer;\n}\n\n.circle:before {\n /*Put the element at the middle of the screen*/\n text-align: center;\n width: 4px;\n height: 4px;\n top:0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n content: '\\25CF';\n font-size: 10px;\n color: white;\n position:absolute;\n top:50px;\n left : 50;\n\n }\n\n.circle-hover:before {\n /*Put the element at the middle of the screen*/\n text-align: center;\n width: 4px;\n height: 4px;\n top:0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n content: '\\25CF';\n font-size: 20px;\n color: white;\n position:absolute;\n top:50px;\n left : 50;\n\n }\n\n.bgGameUI{\n border-radius: 5px;\n background: rgba(46, 46, 46, 0.9);\n font-size: 12px;\n padding: 5px;\n}\n\n.chat-ui{\n position:absolute;\n border-radius: 5px;\n background: rgba(46, 46, 46, 0.9);\n bottom:10px;\n left: 20px;\n width: 300px;\n height: 255px;\n padding: 10px; \n}\n\n.info-button-ui{\n position:absolute;\n bottom:10px;\n left: 10px;\n color: white;\n}\n\n.fullHeightInterface{\n \n height: 90%;\n /* overflow-y: auto;*/\n }\n\nbutton{\n margin: 1px 1px 4px 1px;\n }\n\n/* Trash */\n\n#gamepadCanvas{\n position:absolute;\n bottom:20px;\n right :20px;\n width: 200px;\n height: 200px;\n color: white;\n background-color: rgb(41, 41, 41);\n}\n\n.reply-underline{\n color: rgb(0, 110, 255);\n text-decoration: underline;\n}"
  751. /***/ }),
  752. /***/ "./src/app/components/gl-view/gl-view.component.html":
  753. /*!***********************************************************!*\
  754. !*** ./src/app/components/gl-view/gl-view.component.html ***!
  755. \***********************************************************/
  756. /*! no static exports found */
  757. /***/ (function(module, exports) {
  758. module.exports = "<div id=\"view-game\">\n<canvas #renderCanvas id=\"renderCanvas\" touch-action=\"none\" tabindex=\"1\" style=\"touch-action: none;\"></canvas>\n\n<div id=\"ui-game-container\">\n <div *ngIf=\"!isMobile\" id=\"mainUI\" class=\"ui-game bgGameUI\">\n <div>\n <div *ngIf=\"config\" >use <b>⌨️ {{config.key_mapping}}</b> to move <button button class=\"btn btn-secondary btn-sm\" (click)=\"changeMapping()\">change</button></div>\n </div>\n\n </div>\n\n <span *ngIf=\"!currentinteraction || currentinteraction.type === 0\" class=\"circle\" id=\"pointerTarget\"></span>\n <span *ngIf=\"currentinteraction && currentinteraction.type !== 0\" class=\"circle-hover\" id=\"pointerTarget\"></span>\n \n <!--MAP INTERACTION UI-->\n <div id=\"chanDisplay\" *ngIf=\"gameDataModel.player != null && gameDataModel.map != null && gameDataModel.map.length\" class=\"ui-game\" >\n <div >\n <span class=\"bgGameUI\">\n [ <span *ngFor=\"let chan of chanList\"><a href=\"{{clientURL}}ch/{{chan}}\">/{{chan}}</a> ~ </span>]\n </span>\n </div>\n <h2>~/{{gameDataModel.map[0].name}}/</h2>\n </div>\n <div id=\"pointerInteract\" class=\"ui-game\">\n\n <div *ngIf=\"currentinteraction != null\">\n <button type=\"button\" class=\"btn btn-dark\" *ngIf=\"currentinteraction.type === 3 \" id=\"openPostBtn\" type=\"button\" class=\"btn btn-secondary\" (click)=\"climbLadder()\">🐸 Climb</button>\n <button type=\"button\" class=\"btn btn-dark\" *ngIf=\"currentinteraction.type === 4 \" id=\"openPostBtn\" (click)=\"openDoor()\">🚪</button>\n <button type=\"button\" class=\"btn btn-dark\" *ngIf=\"currentinteraction.type === 1 || currentinteraction.type === 8\" id=\"openPostBtn\" (click)=\"openUrl()\">🔎</button>\n\n <button type=\"button\" class=\"btn btn-dark\" *ngIf=\"gameDataModel.postsLeft > 0 && (currentinteraction.type === 1 || currentinteraction.type === 8)\" id=\"openPostBtn\" (click)=\"addReply(currentinteraction.value.id)\">💬 Reply to <b class=\"reply-underline\">>>{{currentinteraction.value.id}}</b> </button>\n <button type=\"button\" class=\"btn btn-dark\" *ngIf=\"gameDataModel.postsLeft > 0 && currentinteraction.type === 2 \" id=\"openPostingBtn\"(click)=\" openPostingUI()\">✍️</button>\n <button type=\"button\" class=\"btn btn-dark\" *ngIf=\"gameDataModel.postsLeft > 0 && (currentinteraction.type === 2 || currentinteraction.type === 8)\" id=\"openPostingBtn\" (click)=\" openPaintingUI()\">🎨</button>\n\n <button type=\"button\" class=\"btn btn-dark\" *ngIf=\"currentinteraction.type === 5 \" id=\"openPostingBtn\" (click)=\" getItem(currentinteraction.value.key)\">🤚 Get item {{currentinteraction.value.name}} </button>\n <button type=\"button\" class=\"btn btn-dark\" *ngIf=\"currentinteraction.type === 6 \" id=\"openPostingBtn\"(click)=\" passGate(currentinteraction.value)\">⛩️ Go to <b>/{{currentinteraction.value}}</b></button>\n <button type=\"button\" class=\"btn btn-dark\" *ngIf=\"currentinteraction.type === 7 \" id=\"openPostingBtn\" (click)=\" gotTo(currentinteraction.value)\">More info <b>/{{currentinteraction.value}}</b></button>\n \n </div>\n\n <div *ngIf=\"reply > -1\">\n Plan to reply to <b class=\"reply-underline\">>>{{reply}}</b> <span (click)=\" destroyReply(-1)\"> 🗑️</span>\n </div>\n\n <div *ngFor=\"let item of gameDataModel.itemsPlayer\">\n +<b>{{item.name}}</b><br/>\n </div>\n </div>\n\n <div id=\"pin-ui\" >\n <app-pin-post-ui [postModel]=\"pinnedPostModel\"(close)=\"unPin($event)\" class=\"ui-game\">\n </app-pin-post-ui>\n\n <app-pin-post-ui *ngIf=\"currentinteraction != null && currentinteraction.value != null && currentinteraction.value.url != null\" [postModel]=\"currentinteraction.value\" (close)=\"unPin($event)\" class=\"ui-game\">\n </app-pin-post-ui>\n\n \n <!--app-ad-post-ui *ngIf=\"adDisplay && !pinnedPostModel\" id=\"ad-ui\" class=\"ui-game\" (close)=\"closeAd($event)\">\n </app-ad-post-ui-->\n </div>\n\n <div *ngIf=\"gameDataModel != null\">\n <app-posting-ui class=\"fullHeightInterface\" id=\"postingUI\" *ngIf=\"gameState === 1\" [isPhonePosting] = \"false\" [canvasKey]=\"currentinteraction.value.canvas_key\" [gameDataModel]=\"gameDataModel\" [reply]=\"reply\" class=\"ui-game-frame\" (onDestroyReply)=\"destroyReply($event)\"></app-posting-ui>\n <app-painting-ui class=\"fullHeightInterface\" id=\"postingUI\" *ngIf=\"gameState === 4\" [canvasKey]=\"currentinteraction.value.canvas_key\" [urlBgPicture]=\"currentinteraction.value.url\" [reply]=\"reply\" class=\"ui-game-frame\" (onDestroyReply)=\"destroyReply($event)\">></app-painting-ui>\n <app-post-viewer-ui class=\"fullHeightInterface\" id=\"postingUI\" *ngIf=\"gameState === 2\" [postModel]=\"currentinteraction.value\" (pin)=\"onPin($event)\" [gameDataModel]=\"gameDataModel\" class=\"ui-game-frame\" (onReply)=\"addReply($event)\" ></app-post-viewer-ui >\n <app-info-view class=\"fullHeightInterface\" id=\"postingUI\" *ngIf=\"gameState === 6\" class=\"ui-game-frame\"></app-info-view>\n <app-player-ui class=\"fullHeightInterface\" id=\"postingUI\" *ngIf=\"gameState === 9\" class=\"ui-game-frame\" [gameDataModel]=\"gameDataModel\"></app-player-ui>\n </div>\n\n <div id=\"player-bar\" *ngIf=\"!isMobile && gameDataModel.player != null\" >\n \n <div id=\"player-bar-left\" class=\"bgGameUI\">\n <div>#{{gameDataModel.player.id}} <span *ngIf=\"gameDataModel.player.is_admin\"> <a href=\"/admin-post\" target=\"blank_\">🧠</a></span>\n </div>\n <!--div>Talk 💬<br/>\n <textarea id=\"message-text\" placeholder=\"talk here\" [ngModel]=\"gameDataModel.player.talk\"\n (ngModelChange)=\"changeTalk($event)\"></textarea>\n </div-->\n </div>\n \n <div id=\"player-bar-right\">\n <!--app-chat-view *ngIf=\"!isMobile && gameDataModel.player != null\" [gameDataModel]=\"gameDataModel\"></app-chat-view-->\n <div>\n <span class=\"bgGameUI\">\n <div>Due moderation issues post is currently limited. {{gameDataModel.postsLeft}} post(s) left.</div>\n <a href=\"https://twitter.com/alexkrunch\" target=\"blank_\">🐦 Twitter</a> - <a href=\"http://snuffchan.com/blog/donations/\" target=\"blank_\">💰 Donations </a>\n </span>\n </div>\n </div>\n \n </div>\n \n\n</div>"
  759. /***/ }),
  760. /***/ "./src/app/components/gl-view/gl-view.component.ts":
  761. /*!*********************************************************!*\
  762. !*** ./src/app/components/gl-view/gl-view.component.ts ***!
  763. \*********************************************************/
  764. /*! exports provided: GlViewComponent */
  765. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  766. "use strict";
  767. __webpack_require__.r(__webpack_exports__);
  768. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GlViewComponent", function() { return GlViewComponent; });
  769. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  770. /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  771. /* harmony import */ var _motor_game__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../motor/game */ "./src/app/motor/game.ts");
  772. /* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  773. /* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  774. /* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts");
  775. /* harmony import */ var src_app_models_player_model__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! src/app/models/player.model */ "./src/app/models/player.model.ts");
  776. /* harmony import */ var src_app_models_config_model__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! src/app/models/config.model */ "./src/app/models/config.model.ts");
  777. /* harmony import */ var src_app_models_game_data_model__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! src/app/models/game-data.model */ "./src/app/models/game-data.model.ts");
  778. /* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ngx-device-detector */ "./node_modules/ngx-device-detector/ngx-device-detector.umd.js");
  779. /* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(ngx_device_detector__WEBPACK_IMPORTED_MODULE_9__);
  780. /* harmony import */ var src_environments_environment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! src/environments/environment */ "./src/environments/environment.ts");
  781. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  782. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  783. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  784. 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;
  785. return c > 3 && r && Object.defineProperty(target, key, r), r;
  786. };
  787. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  788. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  789. };
  790. var GlViewComponent = /** @class */ (function () {
  791. function GlViewComponent(gameUIServiceService, chanWebService, offlineService, router, route, deviceService) {
  792. var _this = this;
  793. this.gameUIServiceService = gameUIServiceService;
  794. this.chanWebService = chanWebService;
  795. this.offlineService = offlineService;
  796. this.router = router;
  797. this.route = route;
  798. this.deviceService = deviceService;
  799. this.playerData = new src_app_models_player_model__WEBPACK_IMPORTED_MODULE_6__["PlayerModel"]();
  800. this.gameDataModel = new src_app_models_game_data_model__WEBPACK_IMPORTED_MODULE_8__["GameDataModel"]();
  801. this.config = new src_app_models_config_model__WEBPACK_IMPORTED_MODULE_7__["ConfigModel"]();
  802. this.isMobile = false;
  803. this.adDisplay = true;
  804. this.currentMapKey = "alpha";
  805. this.clientURL = "";
  806. this.reply = -1;
  807. this.router.routeReuseStrategy.shouldReuseRoute = function () { return false; };
  808. this.route.params.subscribe(function (params) {
  809. _this.currentMapKey = params['map'];
  810. console.log(_this.currentMapKey);
  811. });
  812. this.clientURL = src_environments_environment__WEBPACK_IMPORTED_MODULE_10__["environment"].clientUrl;
  813. }
  814. GlViewComponent.prototype.ngOnInit = function () {
  815. var _this = this;
  816. this.clientURL = src_environments_environment__WEBPACK_IMPORTED_MODULE_10__["environment"].clientUrl;
  817. this.chanList = this.offlineService.getChanData();
  818. console.log(this.chanList);
  819. this.gameUIServiceService.changeStateEmitter.subscribe(function (state_) {
  820. _this.changeGameState(state_);
  821. if (state_ === _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_NO_PLAYER)
  822. _this.router.navigate(['/']);
  823. });
  824. this.gameUIServiceService.sendInteractionsEmitter.subscribe(function (inter_) {
  825. _this.receiveInteraction(inter_);
  826. });
  827. this.gameUIServiceService.changeGameDataEmitter.subscribe(function (gameData_) {
  828. _this.gameDataModel = gameData_;
  829. if (_this.currentMapKey !== _this.gameDataModel.player.map_key) {
  830. _this.currentMapKey = _this.gameDataModel.player.map_key;
  831. _this.adDisplay = true;
  832. }
  833. });
  834. this.gameUIServiceService.changeConfigEmitter.subscribe(function (config_) {
  835. _this.config = config_;
  836. });
  837. this.isMobile = this.deviceService.isMobile();
  838. // Create our game class using the render canvas element
  839. this.game = new _motor_game__WEBPACK_IMPORTED_MODULE_2__["Game"]('renderCanvas');
  840. //alert("desktop: "+this.deviceService.isDesktop()+" mobile:"+this.deviceService.isMobile()+" tablet: "+this.deviceService.isTablet());
  841. if (!this.deviceService.isDesktop()) {
  842. this.game.activeJoystick();
  843. /*alert("desktop: "+this.deviceService.isDesktop+" mobile:"+this.deviceService.isDesktop+" tablet: "+
  844. this.deviceService.isTablet);*/
  845. }
  846. this.game.setUIService(this.gameUIServiceService);
  847. this.game.setWebService(this.chanWebService);
  848. this.game.setOfflineService(this.offlineService);
  849. this.game.setClientUrl(this.clientURL);
  850. this.game.setMapKey(this.currentMapKey);
  851. this.game.setRouter(this.router);
  852. this.game.initGame();
  853. };
  854. GlViewComponent.prototype.ngAfterViewInit = function () {
  855. var _this = this;
  856. //console.log(window.screen);
  857. this.renderCanvas.nativeElement.width = (window.screen.width);
  858. this.renderCanvas.nativeElement.height = (window.screen.availHeight);
  859. //console.log(JSON.stringify(window.screen));
  860. window.onresize = function () {
  861. _this.renderCanvas.nativeElement.height = (window.screen.availHeight);
  862. _this.renderCanvas.nativeElement.width = (window.screen.width);
  863. };
  864. };
  865. GlViewComponent.prototype.changeGameState = function (state_) {
  866. this.gameState = state_;
  867. //console.log("this.gameState ="+this.gameState );
  868. };
  869. GlViewComponent.prototype.receiveInteraction = function (inter_) {
  870. this.currentinteraction = inter_;
  871. };
  872. /***** INTERACTION! ******/
  873. GlViewComponent.prototype.openUrl = function () {
  874. //window.open(this.currentinteraction.value, "_blank");
  875. this.gameState = 2;
  876. };
  877. GlViewComponent.prototype.openCMD = function () {
  878. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_CMD_UI);
  879. };
  880. GlViewComponent.prototype.climbLadder = function () {
  881. this.game.climbObject();
  882. };
  883. GlViewComponent.prototype.openDoor = function () {
  884. this.game.openDoor();
  885. };
  886. GlViewComponent.prototype.openPostingUI = function () {
  887. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_POSTING_UI);
  888. };
  889. GlViewComponent.prototype.openPaintingUI = function () {
  890. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_PAINTING_UI);
  891. };
  892. GlViewComponent.prototype.openInfoUI = function () {
  893. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_INFO_UI);
  894. };
  895. GlViewComponent.prototype.openPlayerUI = function () {
  896. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_PLAYER_UI);
  897. };
  898. GlViewComponent.prototype.onPin = function (event_) {
  899. if (this.pinnedPostModel != null)
  900. this.pinnedPostModel = null;
  901. this.pinnedPostModel = event_;
  902. console.log(this.pinnedPostModel);
  903. };
  904. GlViewComponent.prototype.unPin = function (event_) {
  905. //console.log( "unpin");
  906. this.pinnedPostModel = null;
  907. };
  908. GlViewComponent.prototype.closeAd = function (event_) {
  909. this.adDisplay = false;
  910. };
  911. GlViewComponent.prototype.changeMapping = function () {
  912. this.game.switchKeyMapping();
  913. };
  914. GlViewComponent.prototype.passGate = function (val_) {
  915. this.game.passGet(val_);
  916. };
  917. GlViewComponent.prototype.getItem = function (key_) {
  918. //console.log("get item");
  919. this.game.getItem(key_);
  920. };
  921. GlViewComponent.prototype.addReply = function (id_) {
  922. this.reply = id_;
  923. };
  924. GlViewComponent.prototype.destroyReply = function () {
  925. this.reply = -1;
  926. };
  927. GlViewComponent.prototype.savePhoto = function () {
  928. alert("try to write picture");
  929. var canvas = document.getElementById("renderCanvas");
  930. console.log(canvas);
  931. //let photoUrl = canvas.getContext('2d').getImageData(0,0,600,600)
  932. var data = canvas.toDataURL('image/png');
  933. //document.location.href = photoUrl;
  934. console.log(data);
  935. var w = window.open('about:blank', 'Screen Capture');
  936. w.document.write("<img src='" + data + "' alt='from canvas'/>");
  937. };
  938. GlViewComponent.prototype.gotTo = function (url_) {
  939. window.open(url_, '_blank');
  940. };
  941. GlViewComponent.prototype.changeTalk = function (e_) {
  942. console.log(e_);
  943. this.game.changeTalk(e_);
  944. };
  945. GlViewComponent.prototype.ngOnDestroy = function () {
  946. /*
  947. this.gameUIServiceService.changeStateEmitter.unsubscribe();
  948. this.gameUIServiceService.sendInteractionsEmitter.unsubscribe();
  949. this.gameUIServiceService.changeGameDataEmitter.unsubscribe();
  950. this.gameUIServiceService.changeConfigEmitter.unsubscribe();*/
  951. delete this.game;
  952. };
  953. __decorate([
  954. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"])('renderCanvas'),
  955. __metadata("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"])
  956. ], GlViewComponent.prototype, "renderCanvas", void 0);
  957. __decorate([
  958. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"])('renderCanvas'),
  959. __metadata("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"])
  960. ], GlViewComponent.prototype, "elementCanvas", void 0);
  961. GlViewComponent = __decorate([
  962. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  963. selector: 'app-gl-view',
  964. template: __webpack_require__(/*! ./gl-view.component.html */ "./src/app/components/gl-view/gl-view.component.html"),
  965. styles: [__webpack_require__(/*! ./gl-view.component.css */ "./src/app/components/gl-view/gl-view.component.css")]
  966. }),
  967. __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"],
  968. src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_4__["ChanWebService"],
  969. src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_5__["OfflineService"],
  970. _angular_router__WEBPACK_IMPORTED_MODULE_1__["Router"],
  971. _angular_router__WEBPACK_IMPORTED_MODULE_1__["ActivatedRoute"],
  972. ngx_device_detector__WEBPACK_IMPORTED_MODULE_9__["DeviceDetectorService"]])
  973. ], GlViewComponent);
  974. return GlViewComponent;
  975. }());
  976. /***/ }),
  977. /***/ "./src/app/components/home/home.component.css":
  978. /*!****************************************************!*\
  979. !*** ./src/app/components/home/home.component.css ***!
  980. \****************************************************/
  981. /*! no static exports found */
  982. /***/ (function(module, exports) {
  983. module.exports = ".container{\n /*background-image: \n linear-gradient( rgba(0,0,0,.5), rgba(0, 0, 0, 0.6) ),\n url(\"/assets/img/home_bg.jpeg\");*/\n padding: 25px;\n /*overflow: scroll;*/\n -webkit-overflow-scrolling: touch;\n color: white;\n text-align: center;\n}\n\ndiv {\n margin-bottom: 8px;\n}\n\n.overlay {\n z-index: 1;\n height: 100%;\n width: 100%;\n position: fixed;\n overflow: auto;\n top: 0px;\n left: 0px;\n background: rgba(0, 0, 0, 0.7); /*can be anything, of course*/\n}\n\n#pres-screen {\n\n width : 100%;\n text-align: center;\n}\n\n#header {\n color: white;\n}\n\n#twitter {\n width:550px;\n margin: 20px auto;\n}"
  984. /***/ }),
  985. /***/ "./src/app/components/home/home.component.html":
  986. /*!*****************************************************!*\
  987. !*** ./src/app/components/home/home.component.html ***!
  988. \*****************************************************/
  989. /*! no static exports found */
  990. /***/ (function(module, exports) {
  991. module.exports = "<div class=\"container\">\n <div>\n <h1>AnonIB💀3D</h1>\n 超暴力的なファイル共有3 Dゲーム<br/>\n by Ælx Krunch<br/>\n [ <a href=\"https://twitter.com/alexkrunch\" target=\"blank_\">🐦 Twitter</a> ] [ <a href=\"http://snuffchan.com/blog/donations/\" target=\"blank_\">💴 Donations </a>]\n </div>\n\n <div>\n <button type=\"button\" class=\"btn btn-primary btn-lg\" (click)=\"launchGame()\">Press Start 🎮</button>\n </div>\n\n <!--app-login></app-login-->\n</div>\n"
  992. /***/ }),
  993. /***/ "./src/app/components/home/home.component.ts":
  994. /*!***************************************************!*\
  995. !*** ./src/app/components/home/home.component.ts ***!
  996. \***************************************************/
  997. /*! exports provided: HomeComponent */
  998. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  999. "use strict";
  1000. __webpack_require__.r(__webpack_exports__);
  1001. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HomeComponent", function() { return HomeComponent; });
  1002. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1003. /* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ngx-device-detector */ "./node_modules/ngx-device-detector/ngx-device-detector.umd.js");
  1004. /* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(ngx_device_detector__WEBPACK_IMPORTED_MODULE_1__);
  1005. /* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../environments/environment */ "./src/environments/environment.ts");
  1006. /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  1007. /* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts");
  1008. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1009. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1010. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1011. 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;
  1012. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1013. };
  1014. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1015. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1016. };
  1017. var HomeComponent = /** @class */ (function () {
  1018. function HomeComponent(deviceService, router, offlineService) {
  1019. this.deviceService = deviceService;
  1020. this.router = router;
  1021. this.offlineService = offlineService;
  1022. this.isMobile = false;
  1023. this.isTOSAccepted = false;
  1024. }
  1025. HomeComponent.prototype.ngOnInit = function () {
  1026. this.isMobile = this.deviceService.isMobile();
  1027. var url = location.href;
  1028. if (url.indexOf(_environments_environment__WEBPACK_IMPORTED_MODULE_2__["environment"].clientUrl) < 0) {
  1029. window.location.href = _environments_environment__WEBPACK_IMPORTED_MODULE_2__["environment"].clientUrl;
  1030. }
  1031. var playerData_ = this.offlineService.getPlayerData();
  1032. if (playerData_ != null) {
  1033. this.isTOSAccepted = true;
  1034. }
  1035. };
  1036. HomeComponent.prototype.launchGame = function () {
  1037. this.router.navigateByUrl('/ch/alpha');
  1038. };
  1039. HomeComponent = __decorate([
  1040. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  1041. selector: 'app-home',
  1042. template: __webpack_require__(/*! ./home.component.html */ "./src/app/components/home/home.component.html"),
  1043. styles: [__webpack_require__(/*! ./home.component.css */ "./src/app/components/home/home.component.css")]
  1044. }),
  1045. __metadata("design:paramtypes", [ngx_device_detector__WEBPACK_IMPORTED_MODULE_1__["DeviceDetectorService"], _angular_router__WEBPACK_IMPORTED_MODULE_3__["Router"],
  1046. src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_4__["OfflineService"]])
  1047. ], HomeComponent);
  1048. return HomeComponent;
  1049. }());
  1050. /***/ }),
  1051. /***/ "./src/app/components/info-view/info-view.component.css":
  1052. /*!**************************************************************!*\
  1053. !*** ./src/app/components/info-view/info-view.component.css ***!
  1054. \**************************************************************/
  1055. /*! no static exports found */
  1056. /***/ (function(module, exports) {
  1057. module.exports = ".post-ui-message{\n position:relative;\n max-width: 650px;\n left: 0;\n right: 0;\n margin: auto;\n\n padding : 10px;\n margin-bottom : 18px;\n background-color: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n\n height: 100%;\n overflow-y: auto;\n}\n\n#container{\n position:relative;\n max-width: 650px;\n left: 0;\n right: 0;\n margin: auto;\n\n padding : 10px;\n margin-bottom : 18px;\n background-color: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n\n height: 100%;\n overflow-y: auto;\n}\n\ndiv {\n margin-bottom: 8px;\n}\n"
  1058. /***/ }),
  1059. /***/ "./src/app/components/info-view/info-view.component.html":
  1060. /*!***************************************************************!*\
  1061. !*** ./src/app/components/info-view/info-view.component.html ***!
  1062. \***************************************************************/
  1063. /*! no static exports found */
  1064. /***/ (function(module, exports) {
  1065. module.exports = "<div id= \"container\">\n\n <div >\n <h2>About Protaguro$</h2>\n <div>\n I am Alex Krunch, Imageboard lover since now ten years and I've created Protaguro$ (the project name will change soon)\n In response to the growing and industrialized censorship on social medias. This whole 3D world is set to work as\n an abstraction, protecting our LULZ from the outside. Soon I will make a blog explaining the whole ideology of the Project,\n and also cool technical feature I will implement, like secrets board, items management and <i>torrenting files in game</i>.\n\n Keep in mind it's a prototype and than bug and database reset will be a frequent thing.\n\n You can keep news of THE PROJECT here:\n <a href=\"https://twitter.com/alexkrunch\" target=\"blank_\">https://twitter.com/alexkrunch</a>\n\n You can also contact by mail at <b>monsieur.krunch@gmail.com</b>\n </div>\n\n <div>\n If you want to make a 💴 DONATION 💴 to the cause, here are the crypto address:<br/>\n\n <div class=\"card\">\n <div class=\"card-body\">\n Bitcoin address:<br/>\n <b>bc1qwc7zaa4tfeertxwk46jv9meyup9ep9cre8l8p7</b><br/>\n \n Etherum:<br/>\n <b>0xEE914adbb0A83e0FD8B90E292CAc6280D26b6b66</b><br/>\n </div>\n </div>\n \n </div>\n <button (click)=\"closeCanvas()\">Close</button>\n\n</div>\n\n</div>\n"
  1066. /***/ }),
  1067. /***/ "./src/app/components/info-view/info-view.component.ts":
  1068. /*!*************************************************************!*\
  1069. !*** ./src/app/components/info-view/info-view.component.ts ***!
  1070. \*************************************************************/
  1071. /*! exports provided: InfoViewComponent */
  1072. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1073. "use strict";
  1074. __webpack_require__.r(__webpack_exports__);
  1075. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfoViewComponent", function() { return InfoViewComponent; });
  1076. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1077. /* harmony import */ var src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  1078. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1079. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1080. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1081. 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;
  1082. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1083. };
  1084. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1085. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1086. };
  1087. var InfoViewComponent = /** @class */ (function () {
  1088. function InfoViewComponent(gameUIServiceService) {
  1089. this.gameUIServiceService = gameUIServiceService;
  1090. }
  1091. InfoViewComponent.prototype.ngOnInit = function () {
  1092. };
  1093. InfoViewComponent.prototype.closeCanvas = function () {
  1094. this.gameUIServiceService.changeState(src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING);
  1095. };
  1096. InfoViewComponent = __decorate([
  1097. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  1098. selector: 'app-info-view',
  1099. template: __webpack_require__(/*! ./info-view.component.html */ "./src/app/components/info-view/info-view.component.html"),
  1100. styles: [__webpack_require__(/*! ./info-view.component.css */ "./src/app/components/info-view/info-view.component.css")]
  1101. }),
  1102. __metadata("design:paramtypes", [src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"]])
  1103. ], InfoViewComponent);
  1104. return InfoViewComponent;
  1105. }());
  1106. /***/ }),
  1107. /***/ "./src/app/components/login/login.component.css":
  1108. /*!******************************************************!*\
  1109. !*** ./src/app/components/login/login.component.css ***!
  1110. \******************************************************/
  1111. /*! no static exports found */
  1112. /***/ (function(module, exports) {
  1113. module.exports = "#contentLogin{\n text-align: center;\n}\n\ndiv {\n margin-bottom: 8px;\n}\n\nbutton{\n margin: 1px 1px 4px 1px;\n }\n"
  1114. /***/ }),
  1115. /***/ "./src/app/components/login/login.component.html":
  1116. /*!*******************************************************!*\
  1117. !*** ./src/app/components/login/login.component.html ***!
  1118. \*******************************************************/
  1119. /*! no static exports found */
  1120. /***/ (function(module, exports) {
  1121. module.exports = "<div id=\"contentLogin\" role=\"alert\">\n\n<div *ngIf=\"isLoading\">\n Try to get a player token...\n</div>\n\n <div class=\"alert alert-danger\" role=\"alert\" *ngIf=\"!isTOSAccepted\">\n <b>-We do not allow CP / Non-ironical hatespeech / porn / doxxing / pirated content.</b><br/>\n -You need to be +18 to access this game.<br/>\n -Don't trust anythings written on the game, it's all fake news.<br/>\n -Don't talk about the game.<br/>\n -Keep in mind t's an experimental project, it will be often broke. For more information contact monsieur.krunch@gmail.com,\n or check my twitter account, <a href=\"https://twitter.com/alexkrunch\" target=\"blank_\">@AlexKrunch</a>🚬<br/>\n <button (click)=\"acceptTOS()\" type=\"button\" class=\"btn btn-danger\">OK, I get it</button>\n </div>\n\n<div class=\"form-signin\" *ngIf=\"playerData == null && isTOSAccepted\" class=\"alert alert-primary\" >\n <div class=\"input-group\">\n <div class=\"input-group-prepend\">\n <span class=\"input-group-text\">ID</span>\n </div>\n <input type=\"text\" class=\"form-control\" [(ngModel)]= \"anonId\" placeholder=\"ID\">\n </div>\n <div class=\"input-group\">\n <div class=\"input-group-prepend\">\n <span class=\"input-group-text\">Token</span>\n </div>\n <input type=\"text\" class=\"form-control\" [(ngModel)]= \"anonToken\" placeholder=\"token\">\n </div>\n <div>\n <button (click)=\"createUser()\" type=\"button\" class=\"btn btn-primary\">Existing User</button> or <button (click)=\"createNewUser()\" type=\"button\" class=\"btn btn-primary\">New User</button><br/>\n </div>\n <div class=\"form-label-group\">\n <input type=\"password\" [(ngModel)]= \"password\" id=\"inputPassword\" class=\"form-control\" placeholder=\"Password (optional)\">\n </div>\n</div>\n\n<div *ngIf=\"playerData != null\" class=\"alert alert-primary\" >\n What you get.. <br/>\n Player ID #{{playerData.id}} <span *ngIf=\"playerData.is_admin\">🧠</span><br/>\n Player token <b>{{playerData.player_key}}</b>\n <br/>\n <button (click) = \"validAndLaunchGame()\" class=\"btn btn-primary\">Launch game 🎮</button>\n <button *ngIf=\"playerData.is_admin\" (click) = \"validAndLaunchAdmin()\" class=\"btn btn-primary\">Launch admin</button>\n <button (click)=\"playerData = null\" class=\"btn btn-secondary\">Cancel</button>\n</div>\n\n</div>"
  1122. /***/ }),
  1123. /***/ "./src/app/components/login/login.component.ts":
  1124. /*!*****************************************************!*\
  1125. !*** ./src/app/components/login/login.component.ts ***!
  1126. \*****************************************************/
  1127. /*! exports provided: LoginComponent */
  1128. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1129. "use strict";
  1130. __webpack_require__.r(__webpack_exports__);
  1131. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LoginComponent", function() { return LoginComponent; });
  1132. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1133. /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  1134. /* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  1135. /* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts");
  1136. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1137. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1138. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1139. 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;
  1140. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1141. };
  1142. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1143. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1144. };
  1145. var LoginComponent = /** @class */ (function () {
  1146. function LoginComponent(chanWebService, offlineService, router) {
  1147. this.chanWebService = chanWebService;
  1148. this.offlineService = offlineService;
  1149. this.router = router;
  1150. this.isLoading = false;
  1151. this.isTOSAccepted = false;
  1152. }
  1153. LoginComponent.prototype.ngOnInit = function () {
  1154. var playerData_ = this.offlineService.getPlayerData();
  1155. if (playerData_ != null) {
  1156. this.anonId = playerData_.id;
  1157. this.anonToken = playerData_.player_key;
  1158. this.isTOSAccepted = true;
  1159. }
  1160. };
  1161. //Call the WS
  1162. LoginComponent.prototype.createUser = function () {
  1163. var _this = this;
  1164. console.log("createUser");
  1165. this.isLoading = true;
  1166. this.chanWebService.createUser(this.anonId, this.anonToken, this.password, "").subscribe(
  1167. //Data success
  1168. function (data) {
  1169. _this.isLoading = false;
  1170. if (data.ok) {
  1171. _this.playerData = data.result.player;
  1172. _this.offlineService.savePlayer(_this.playerData);
  1173. }
  1174. else {
  1175. _this.errorWs = data.error;
  1176. }
  1177. });
  1178. };
  1179. //Call the WS
  1180. LoginComponent.prototype.createNewUser = function () {
  1181. this.anonId = 0;
  1182. this.anonToken = "";
  1183. this.createUser();
  1184. };
  1185. LoginComponent.prototype.validAndLaunchGame = function () {
  1186. this.router.navigateByUrl('/ch/alpha');
  1187. };
  1188. LoginComponent.prototype.validAndLaunchAdmin = function () {
  1189. this.router.navigateByUrl('/admin-post');
  1190. };
  1191. LoginComponent.prototype.acceptTOS = function () {
  1192. this.isTOSAccepted = true;
  1193. };
  1194. LoginComponent = __decorate([
  1195. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  1196. selector: 'app-login',
  1197. template: __webpack_require__(/*! ./login.component.html */ "./src/app/components/login/login.component.html"),
  1198. styles: [__webpack_require__(/*! ./login.component.css */ "./src/app/components/login/login.component.css")]
  1199. }),
  1200. __metadata("design:paramtypes", [src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_2__["ChanWebService"], src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_3__["OfflineService"],
  1201. _angular_router__WEBPACK_IMPORTED_MODULE_1__["Router"]])
  1202. ], LoginComponent);
  1203. return LoginComponent;
  1204. }());
  1205. /***/ }),
  1206. /***/ "./src/app/components/media-display/media-display.component.css":
  1207. /*!**********************************************************************!*\
  1208. !*** ./src/app/components/media-display/media-display.component.css ***!
  1209. \**********************************************************************/
  1210. /*! no static exports found */
  1211. /***/ (function(module, exports) {
  1212. module.exports = ""
  1213. /***/ }),
  1214. /***/ "./src/app/components/media-display/media-display.component.html":
  1215. /*!***********************************************************************!*\
  1216. !*** ./src/app/components/media-display/media-display.component.html ***!
  1217. \***********************************************************************/
  1218. /*! no static exports found */
  1219. /***/ (function(module, exports) {
  1220. module.exports = "<div *ngIf=\"url != null && url != ''\">\n<img *ngIf=\"urlParse.getUrlType() === 1 || urlParse.getUrlType() === 2\" [src]=\"url\"/>\n\n<audio *ngIf=\"urlParse.getUrlType() === 5\" controls=\"controls\">\n <source [src]=\"url\" type=\"audio/mp3\" />\n</audio>\n\n<video *ngIf=\"urlParse.getUrlType() === 3\" controls=\"controls\">\n <source [src]=\"url\" type=\"video/mp4\" />\n</video>\n\n<iframe *ngIf=\"urlParse.getUrlType() === 4\" [src]=\"safeTubeURL\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n</div>\n"
  1221. /***/ }),
  1222. /***/ "./src/app/components/media-display/media-display.component.ts":
  1223. /*!*********************************************************************!*\
  1224. !*** ./src/app/components/media-display/media-display.component.ts ***!
  1225. \*********************************************************************/
  1226. /*! exports provided: MediaDisplayComponent */
  1227. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1228. "use strict";
  1229. __webpack_require__.r(__webpack_exports__);
  1230. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MediaDisplayComponent", function() { return MediaDisplayComponent; });
  1231. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1232. /* harmony import */ var src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/utils/urlParser */ "./src/app/utils/urlParser.ts");
  1233. /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js");
  1234. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1235. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1236. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1237. 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;
  1238. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1239. };
  1240. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1241. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1242. };
  1243. var MediaDisplayComponent = /** @class */ (function () {
  1244. function MediaDisplayComponent(sanitizer) {
  1245. this.sanitizer = sanitizer;
  1246. }
  1247. MediaDisplayComponent.prototype.ngOnInit = function () {
  1248. if (this.url != null) {
  1249. this.urlParse = new src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_1__["UrlParser"](this.url);
  1250. this.safeTubeURL = this.urlParse.getSafeTubeURL(this.sanitizer);
  1251. }
  1252. };
  1253. __decorate([
  1254. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  1255. __metadata("design:type", String)
  1256. ], MediaDisplayComponent.prototype, "url", void 0);
  1257. MediaDisplayComponent = __decorate([
  1258. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  1259. selector: 'app-media-display',
  1260. template: __webpack_require__(/*! ./media-display.component.html */ "./src/app/components/media-display/media-display.component.html"),
  1261. styles: [__webpack_require__(/*! ./media-display.component.css */ "./src/app/components/media-display/media-display.component.css")]
  1262. }),
  1263. __metadata("design:paramtypes", [_angular_platform_browser__WEBPACK_IMPORTED_MODULE_2__["DomSanitizer"]])
  1264. ], MediaDisplayComponent);
  1265. return MediaDisplayComponent;
  1266. }());
  1267. /***/ }),
  1268. /***/ "./src/app/components/painting-ui/painting-ui.component.css":
  1269. /*!******************************************************************!*\
  1270. !*** ./src/app/components/painting-ui/painting-ui.component.css ***!
  1271. \******************************************************************/
  1272. /*! no static exports found */
  1273. /***/ (function(module, exports) {
  1274. module.exports = ".post-ui-message{\n position:relative;\n /*max-width: 480px;*/\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n margin-bottom : 18px;\n background: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n height: 95%;\n overflow-y: auto;\n}\n\n#canvas-right{\n width: 460px;\n position:absolute;\n}\n\n#tool-right{\n position:absolute;\n width: 480px;\n height: 100%;\n left: 480px;\n top: 0px;\n}\n\ntextarea\n{\n width: 220px;\n margin: 0;\n}\n\n#painting-board {\n width: 460px;\n height: 460px;\n /*background-color: whitesmoke;*/\n background-image:\n url(\"/assets/img/grid.png\");\n\n}\n\n#brush-size{\n position: relative;\n background-color: black;\n width: 10px;\n height: 10px;\n}\n\nbutton{\n margin: 1px 1px 4px 1px;\n}"
  1275. /***/ }),
  1276. /***/ "./src/app/components/painting-ui/painting-ui.component.html":
  1277. /*!*******************************************************************!*\
  1278. !*** ./src/app/components/painting-ui/painting-ui.component.html ***!
  1279. \*******************************************************************/
  1280. /*! no static exports found */
  1281. /***/ (function(module, exports) {
  1282. module.exports = "<div class=\"post-ui-message\">\n\n<div id=\"canvas-left\">\n<canvas #paintingCanvas id=\"painting-board\"\n height=\"460px\" width=\"460px\"\n touch-action=\"none\" tabindex=\"1\" style=\"touch-action: none;\">\n <!--(document:mousemove)=\"canvasMouseMove( $event )\"-->\n</canvas>\n</div>\n\n<div id=\"tool-right\">\n<button (click)=\"changeColor(colorRed)\">Red</button>\n<button (click)=\"changeColor(colorBlack)\">Black</button>\n<button (click)=\"changeColor(colorWhite)\">White</button>\n<button (click)=\"changeColor(colorPink)\">Pink</button><br/>\n<button (click)=\"changeColor(colorGreen)\">Green</button>\n<button (click)=\"changeColor(colorBrown)\">Brown</button>\n<button (click)=\"changeColor(colorPurple)\">Purple</button><br/>\n<button (click)=\"changeColor(colorYellow)\">Yellow</button>\n<button (click)=\"changeColor(colorBlue)\">Blue</button><br/>\nPick a color: <input type=\"color\" [(ngModel)]=\"curColor\"><br/>\n<input type=\"range\" name=\"points\" min=\"5\" max=\"100\" [(ngModel)]=\"strokeSize\">\n<div id=\"brush-size\"\n [style.width]=\"strokeSize+'px'\"\n [style.height]=\"strokeSize+'px'\"> </div>\n<br/>\n<button (click)=\"clear()\">Clear</button><br/>\n\n<div *ngIf=\"reply >= 0\" ><i>reply to >>{{ reply }}</i> <span (click)=\" destroyReply()\"> 🗑️</span></div>\nMessage: <br/>\n<textarea id=\"message-text\" placeholder=\"Your text\" [(ngModel)]=\"postModel.message\" ></textarea><br/>\n<button (click)=\"sendImg()\" class=\"btn btn-primary\">Paint the art!</button>\n<button (click)=\"closeCanvas()\" class=\"btn btn-danger\">Close</button>\n\n</div>\n\n</div>"
  1283. /***/ }),
  1284. /***/ "./src/app/components/painting-ui/painting-ui.component.ts":
  1285. /*!*****************************************************************!*\
  1286. !*** ./src/app/components/painting-ui/painting-ui.component.ts ***!
  1287. \*****************************************************************/
  1288. /*! exports provided: PaintingUiComponent */
  1289. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1290. "use strict";
  1291. __webpack_require__.r(__webpack_exports__);
  1292. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PaintingUiComponent", function() { return PaintingUiComponent; });
  1293. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1294. /* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  1295. /* harmony import */ var src_app_models_post_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/models/post.model */ "./src/app/models/post.model.ts");
  1296. /* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  1297. /* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ngx-device-detector */ "./node_modules/ngx-device-detector/ngx-device-detector.umd.js");
  1298. /* harmony import */ var ngx_device_detector__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(ngx_device_detector__WEBPACK_IMPORTED_MODULE_4__);
  1299. /* harmony import */ var pepjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! pepjs */ "./node_modules/pepjs/dist/pep.js");
  1300. /* harmony import */ var pepjs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(pepjs__WEBPACK_IMPORTED_MODULE_5__);
  1301. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1302. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1303. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1304. 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;
  1305. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1306. };
  1307. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1308. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1309. };
  1310. var PaintingUiComponent = /** @class */ (function () {
  1311. function PaintingUiComponent(gameUIServiceService, chanWebService, deviceService) {
  1312. this.gameUIServiceService = gameUIServiceService;
  1313. this.chanWebService = chanWebService;
  1314. this.deviceService = deviceService;
  1315. this.onDestroyReply = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  1316. this.isLoading = false;
  1317. this.canvasPercent = 0;
  1318. this.isFinalExport = false;
  1319. /*****************
  1320. * EVENT DEALING WITH PAINTING
  1321. *****************/
  1322. this.clickX = new Array();
  1323. this.clickY = new Array();
  1324. this.clickDrag = new Array();
  1325. this.clickDurationCurrent = 0;
  1326. this.clickDurationList = new Array();
  1327. //Colors
  1328. this.colorRed = "#df4b26";
  1329. this.colorPink = "#ff8cd4";
  1330. this.colorBlack = "#000000";
  1331. this.colorPurple = "#cb3594";
  1332. this.colorGreen = "#659b41";
  1333. this.colorYellow = "#ffcf33";
  1334. this.colorBrown = "#986928";
  1335. this.colorBlue = "#0066ff";
  1336. this.colorWhite = "#ffffff";
  1337. this.curColor = this.colorRed;
  1338. this.clickColor = new Array();
  1339. this.selectedColor = "#000000";
  1340. this.clickSize = new Array();
  1341. this.strokeSize = 10;
  1342. }
  1343. PaintingUiComponent.prototype.ngOnInit = function () {
  1344. var _this = this;
  1345. this.postModel = new src_app_models_post_model__WEBPACK_IMPORTED_MODULE_2__["PostModel"]();
  1346. this.postModel.map_key = "";
  1347. this.postModel.canvas_key = this.canvasKey;
  1348. this.postModel.message = "";
  1349. this.postModel.graffiti = true;
  1350. this.postModel.reply = this.reply;
  1351. if (this.urlBgPicture != null) {
  1352. this.imageBg = new Image();
  1353. this.imageBg.crossOrigin = "Anonymous";
  1354. this.imageBg.src = this.urlBgPicture;
  1355. console.log('this.urlBgPicture: ' + this.urlBgPicture);
  1356. this.imageBg.onload = function () {
  1357. _this.redraw();
  1358. };
  1359. }
  1360. //is Mobile? We need to make teh mouse move with pepjs
  1361. // if(!this.deviceService.isDesktop()){
  1362. this.elementCanvas.nativeElement.addEventListener("pointerdown", function (event_) {
  1363. _this.paint = true;
  1364. _this.canvasMouseDown(event_);
  1365. });
  1366. this.elementCanvas.nativeElement.addEventListener("pointermove", function (event_) {
  1367. _this.canvasMouseMove(event_);
  1368. });
  1369. this.elementCanvas.nativeElement.addEventListener("pointerup", function (event_) {
  1370. _this.canvasMouseUp(event_);
  1371. });
  1372. //}
  1373. };
  1374. PaintingUiComponent.prototype.ngAfterViewInit = function () {
  1375. this.context = this.elementCanvas.nativeElement.getContext('2d');
  1376. };
  1377. PaintingUiComponent.prototype.closeCanvas = function () {
  1378. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING);
  1379. };
  1380. PaintingUiComponent.prototype.getImg = function () {
  1381. var data = this.elementCanvas.nativeElement.toDataURL("image/png");
  1382. data += "snffch";
  1383. return data;
  1384. };
  1385. PaintingUiComponent.prototype.dataURItoBlob = function (dataURI) {
  1386. var byteString = window.atob(dataURI);
  1387. var arrayBuffer = new ArrayBuffer(byteString.length);
  1388. var int8Array = new Uint8Array(arrayBuffer);
  1389. for (var i = 0; i < byteString.length; i++) {
  1390. int8Array[i] = byteString.charCodeAt(i);
  1391. }
  1392. var blob = new Blob([int8Array], { type: 'image/jpeg' });
  1393. return blob;
  1394. };
  1395. PaintingUiComponent.prototype.sendImg = function () {
  1396. var _this = this;
  1397. if ((this.clickX.length + this.clickY.length) < 200) {
  1398. alert("It's doesn't looks like a big drawing :( ");
  1399. return;
  1400. }
  1401. this.isFinalExport = true;
  1402. this.redraw();
  1403. this.chanWebService.createAndUploadPaint(this.postModel, this.getImg()).subscribe(
  1404. //Data success
  1405. function (data) {
  1406. //console.log("data:"+data);
  1407. var postStuffResponse = data;
  1408. if (postStuffResponse.ok) {
  1409. //console.log("result "+JSON.stringify( postStuffResponse));
  1410. _this.destroyReply();
  1411. _this.closeCanvas();
  1412. _this.gameUIServiceService.forceWS();
  1413. _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING);
  1414. }
  1415. _this.isLoading = false;
  1416. _this.isFinalExport = false;
  1417. }, function (error) {
  1418. //console.log(JSON.stringify(error));
  1419. _this.isLoading = false;
  1420. _this.isFinalExport = false;
  1421. _this.redraw();
  1422. });
  1423. };
  1424. PaintingUiComponent.prototype.canvasMouseDown = function (event_) {
  1425. var mouseX = event_.offsetX + (event_.offsetX * this.canvasPercent);
  1426. var mouseY = event_.offsetY + (event_.offsetY * this.canvasPercent);
  1427. this.paint = true;
  1428. this.addClick(mouseX, mouseY, false);
  1429. this.redraw();
  1430. };
  1431. PaintingUiComponent.prototype.canvasMouseUp = function (event_) {
  1432. this.paint = false;
  1433. this.clickDurationList.push(this.clickDurationCurrent);
  1434. this.clickDurationCurrent = 0;
  1435. };
  1436. PaintingUiComponent.prototype.canvasMouseMove = function (event_) {
  1437. if (this.paint) {
  1438. var mouseX = event_.offsetX + (event_.offsetX * this.canvasPercent);
  1439. var mouseY = event_.offsetY + (event_.offsetY * this.canvasPercent);
  1440. this.addClick(mouseX, mouseY, true);
  1441. this.redraw();
  1442. this.clickDurationCurrent += 1;
  1443. }
  1444. };
  1445. PaintingUiComponent.prototype.addClick = function (x, y, dragging) {
  1446. this.clickX.push(x);
  1447. this.clickY.push(y);
  1448. this.clickDrag.push(dragging);
  1449. //console.log(this.selectedColor);
  1450. this.clickColor.push(this.curColor);
  1451. this.clickSize.push(this.strokeSize);
  1452. };
  1453. PaintingUiComponent.prototype.redraw = function () {
  1454. this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height); // Clears the canvas
  1455. this.context.lineJoin = "round";
  1456. this.context.lineWidth = 10;
  1457. //set bg image if it exist
  1458. if (this.imageBg && !this.isFinalExport) {
  1459. var ratio = void 0;
  1460. var newWidth = void 0;
  1461. var newHeight = void 0;
  1462. var newX = 0;
  1463. var newY = 0;
  1464. if (this.imageBg.height > this.imageBg.width) {
  1465. ratio = this.elementCanvas.nativeElement.height / this.imageBg.height;
  1466. newWidth = this.imageBg.width * ratio;
  1467. newHeight = this.imageBg.height * ratio;
  1468. newX = (newWidth - this.elementCanvas.nativeElement.width) * (-0.5);
  1469. }
  1470. else {
  1471. ratio = this.elementCanvas.nativeElement.width / this.imageBg.width;
  1472. newWidth = this.imageBg.width * ratio;
  1473. newHeight = this.imageBg.height * ratio;
  1474. newY = (newHeight - this.elementCanvas.nativeElement.height) * (-0.5);
  1475. }
  1476. this.context.drawImage(this.imageBg, newX, newY, newWidth, newHeight);
  1477. }
  1478. for (var i = 0; i < this.clickX.length; i++) {
  1479. this.context.beginPath();
  1480. if (this.clickDrag[i] && i > 0) {
  1481. this.context.moveTo(this.clickX[i - 1], this.clickY[i - 1]);
  1482. }
  1483. else {
  1484. this.context.moveTo(this.clickX[i], this.clickY[i]);
  1485. }
  1486. this.context.lineTo(this.clickX[i], this.clickY[i]);
  1487. this.context.closePath();
  1488. this.context.strokeStyle = this.clickColor[i];
  1489. this.context.lineWidth = this.clickSize[i];
  1490. this.context.stroke();
  1491. }
  1492. };
  1493. /*****************
  1494. * DEALING with painting style
  1495. *****************/
  1496. PaintingUiComponent.prototype.changeColor = function (color_) {
  1497. this.curColor = color_;
  1498. };
  1499. PaintingUiComponent.prototype.clear = function () {
  1500. if (this.clickDurationList.length > 0) {
  1501. var lastDuration = this.clickDurationList.pop();
  1502. this.clickColor = this.clickColor.slice(0, this.clickColor.length - lastDuration - 1);
  1503. this.clickX = this.clickX.slice(0, this.clickX.length - lastDuration - 1);
  1504. this.clickY = this.clickY.slice(0, this.clickY.length - lastDuration - 1);
  1505. this.clickDrag = this.clickDrag.slice(0, this.clickDrag.length - lastDuration - 1);
  1506. this.clickSize = this.clickSize.slice(0, this.clickSize.length - lastDuration - 1);
  1507. this.redraw();
  1508. }
  1509. };
  1510. PaintingUiComponent.prototype.destroyReply = function () {
  1511. this.reply = -1;
  1512. this.onDestroyReply.emit(-1);
  1513. };
  1514. __decorate([
  1515. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  1516. __metadata("design:type", String)
  1517. ], PaintingUiComponent.prototype, "canvasKey", void 0);
  1518. __decorate([
  1519. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  1520. __metadata("design:type", String)
  1521. ], PaintingUiComponent.prototype, "urlBgPicture", void 0);
  1522. __decorate([
  1523. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  1524. __metadata("design:type", Number)
  1525. ], PaintingUiComponent.prototype, "reply", void 0);
  1526. __decorate([
  1527. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(),
  1528. __metadata("design:type", Object)
  1529. ], PaintingUiComponent.prototype, "onDestroyReply", void 0);
  1530. __decorate([
  1531. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewChild"])('paintingCanvas'),
  1532. __metadata("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"])
  1533. ], PaintingUiComponent.prototype, "elementCanvas", void 0);
  1534. PaintingUiComponent = __decorate([
  1535. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  1536. selector: 'app-painting-ui',
  1537. template: __webpack_require__(/*! ./painting-ui.component.html */ "./src/app/components/painting-ui/painting-ui.component.html"),
  1538. styles: [__webpack_require__(/*! ./painting-ui.component.css */ "./src/app/components/painting-ui/painting-ui.component.css")]
  1539. }),
  1540. __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"], src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_3__["ChanWebService"],
  1541. ngx_device_detector__WEBPACK_IMPORTED_MODULE_4__["DeviceDetectorService"]])
  1542. ], PaintingUiComponent);
  1543. return PaintingUiComponent;
  1544. }());
  1545. /***/ }),
  1546. /***/ "./src/app/components/phone-poster/phone-poster.component.css":
  1547. /*!********************************************************************!*\
  1548. !*** ./src/app/components/phone-poster/phone-poster.component.css ***!
  1549. \********************************************************************/
  1550. /*! no static exports found */
  1551. /***/ (function(module, exports) {
  1552. module.exports = "#container{\n position: absolute;\n margin: auto;\n max-width: 650px;\n left: 0;\n right: 0;\n height: 100%;\n}"
  1553. /***/ }),
  1554. /***/ "./src/app/components/phone-poster/phone-poster.component.html":
  1555. /*!*********************************************************************!*\
  1556. !*** ./src/app/components/phone-poster/phone-poster.component.html ***!
  1557. \*********************************************************************/
  1558. /*! no static exports found */
  1559. /***/ (function(module, exports) {
  1560. module.exports = "<app-posting-ui id=\"container\" *ngIf=\"this.playerModel != null\" [isPhonePosting]=\"true\" [canvasKey]=\"canvasKey\" ></app-posting-ui>"
  1561. /***/ }),
  1562. /***/ "./src/app/components/phone-poster/phone-poster.component.ts":
  1563. /*!*******************************************************************!*\
  1564. !*** ./src/app/components/phone-poster/phone-poster.component.ts ***!
  1565. \*******************************************************************/
  1566. /*! exports provided: PhonePosterComponent */
  1567. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1568. "use strict";
  1569. __webpack_require__.r(__webpack_exports__);
  1570. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PhonePosterComponent", function() { return PhonePosterComponent; });
  1571. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1572. /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  1573. /* harmony import */ var src_app_models_player_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/models/player.model */ "./src/app/models/player.model.ts");
  1574. /* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts");
  1575. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1576. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1577. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1578. 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;
  1579. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1580. };
  1581. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1582. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1583. };
  1584. var PhonePosterComponent = /** @class */ (function () {
  1585. function PhonePosterComponent(offlineService, route) {
  1586. var _this = this;
  1587. this.offlineService = offlineService;
  1588. this.route = route;
  1589. this.route.params.subscribe(function (params) {
  1590. _this.playerId = params['id'];
  1591. _this.playerKey = params['key'];
  1592. _this.canvasKey = params['canvas'];
  1593. //set the player model, at it to offline
  1594. _this.playerModel = new src_app_models_player_model__WEBPACK_IMPORTED_MODULE_2__["PlayerModel"]();
  1595. _this.playerModel.id = Number(_this.playerId);
  1596. _this.playerModel.player_key = _this.playerKey;
  1597. _this.offlineService.savePlayer(_this.playerModel);
  1598. });
  1599. }
  1600. PhonePosterComponent.prototype.ngOnInit = function () {
  1601. };
  1602. PhonePosterComponent = __decorate([
  1603. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  1604. selector: 'app-phone-poster',
  1605. template: __webpack_require__(/*! ./phone-poster.component.html */ "./src/app/components/phone-poster/phone-poster.component.html"),
  1606. styles: [__webpack_require__(/*! ./phone-poster.component.css */ "./src/app/components/phone-poster/phone-poster.component.css")]
  1607. }),
  1608. __metadata("design:paramtypes", [src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_3__["OfflineService"], _angular_router__WEBPACK_IMPORTED_MODULE_1__["ActivatedRoute"]])
  1609. ], PhonePosterComponent);
  1610. return PhonePosterComponent;
  1611. }());
  1612. /***/ }),
  1613. /***/ "./src/app/components/pin-post-ui/pin-post-ui.component.css":
  1614. /*!******************************************************************!*\
  1615. !*** ./src/app/components/pin-post-ui/pin-post-ui.component.css ***!
  1616. \******************************************************************/
  1617. /*! no static exports found */
  1618. /***/ (function(module, exports) {
  1619. module.exports = "::ng-deep .img-pin img, .img-pin video, .img-pin iframe, .img-pin audio {\n max-width: 300px;\n max-height: 300px;\n}"
  1620. /***/ }),
  1621. /***/ "./src/app/components/pin-post-ui/pin-post-ui.component.html":
  1622. /*!*******************************************************************!*\
  1623. !*** ./src/app/components/pin-post-ui/pin-post-ui.component.html ***!
  1624. \*******************************************************************/
  1625. /*! no static exports found */
  1626. /***/ (function(module, exports) {
  1627. module.exports = "<div *ngIf=\"postModel && postModel.url != undefined\">\n<app-media-display class=\"img-pin\" [url]=\"postModel.url\" ></app-media-display>\n<!--button type=\"button\" class=\"btn btn-danger\" (click) = \"closePost()\" >Close</button-->\n</div>"
  1628. /***/ }),
  1629. /***/ "./src/app/components/pin-post-ui/pin-post-ui.component.ts":
  1630. /*!*****************************************************************!*\
  1631. !*** ./src/app/components/pin-post-ui/pin-post-ui.component.ts ***!
  1632. \*****************************************************************/
  1633. /*! exports provided: PinPostUiComponent */
  1634. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1635. "use strict";
  1636. __webpack_require__.r(__webpack_exports__);
  1637. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PinPostUiComponent", function() { return PinPostUiComponent; });
  1638. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1639. /* harmony import */ var _models_post_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/post.model */ "./src/app/models/post.model.ts");
  1640. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1641. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1642. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1643. 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;
  1644. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1645. };
  1646. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1647. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1648. };
  1649. var PinPostUiComponent = /** @class */ (function () {
  1650. function PinPostUiComponent() {
  1651. this.close = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  1652. }
  1653. PinPostUiComponent.prototype.ngOnInit = function () {
  1654. };
  1655. PinPostUiComponent.prototype.ngOnChanges = function (changes) {
  1656. if (changes != null && changes.postModel != null) {
  1657. this.postModel = changes.postModel.currentValue;
  1658. }
  1659. };
  1660. PinPostUiComponent.prototype.closePost = function () {
  1661. this.close.emit();
  1662. };
  1663. __decorate([
  1664. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  1665. __metadata("design:type", _models_post_model__WEBPACK_IMPORTED_MODULE_1__["PostModel"])
  1666. ], PinPostUiComponent.prototype, "postModel", void 0);
  1667. __decorate([
  1668. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(),
  1669. __metadata("design:type", Object)
  1670. ], PinPostUiComponent.prototype, "close", void 0);
  1671. PinPostUiComponent = __decorate([
  1672. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  1673. selector: 'app-pin-post-ui',
  1674. template: __webpack_require__(/*! ./pin-post-ui.component.html */ "./src/app/components/pin-post-ui/pin-post-ui.component.html"),
  1675. styles: [__webpack_require__(/*! ./pin-post-ui.component.css */ "./src/app/components/pin-post-ui/pin-post-ui.component.css")]
  1676. }),
  1677. __metadata("design:paramtypes", [])
  1678. ], PinPostUiComponent);
  1679. return PinPostUiComponent;
  1680. }());
  1681. /***/ }),
  1682. /***/ "./src/app/components/player-ui/player-ui.component.css":
  1683. /*!**************************************************************!*\
  1684. !*** ./src/app/components/player-ui/player-ui.component.css ***!
  1685. \**************************************************************/
  1686. /*! no static exports found */
  1687. /***/ (function(module, exports) {
  1688. module.exports = ".post-viewer-ui-message{\n position:relative;\n /*max-width: 650px;*/\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n margin-bottom : 18px;\n background: rgb(247, 189, 225);\n border-style: solid;\n border-width: 1px;\n border-color: #c79eb7;\n border-radius: 5px;\n height: 95%;\n width: 100%;\n overflow-y: auto;\n }\n\n.spoil{\n width: 100%;\n background-color: rgb(71, 71, 71);\n color: rgb(71, 71, 71);\n}"
  1689. /***/ }),
  1690. /***/ "./src/app/components/player-ui/player-ui.component.html":
  1691. /*!***************************************************************!*\
  1692. !*** ./src/app/components/player-ui/player-ui.component.html ***!
  1693. \***************************************************************/
  1694. /*! no static exports found */
  1695. /***/ (function(module, exports) {
  1696. module.exports = "<div class=\"post-viewer-ui-message\">\n \n <div><b> You are 👺 #{{gameDataModel.player.id}} <span *ngIf=\"gameDataModel.player.is_admin\">🧠</span>\n 💉 HP: {{gameDataModel.player.hp}}% </b></div>\n <div><b>token 🗝️ <span class=\"spoil\">{{gameDataModel.player.player_key}}</span></b></div>\n <i>If you want to play on the new machine, just copy and past this ID and Token and enter them when you reconnect.</i>\n <br/>\n <div>🎒 inventory, the items you own</div>\n ------------------------------------------<br/>\n <div *ngFor=\"let item of gameDataModel.itemsPlayer\">\n <b>💍 {{item.name}}</b>\n quantity: {{item.value}}<br/>\n action: {{item.action}}<br/>\n description: {{item.description}}<br/>\n </div>\n ------------------------------------------<br/>\n\n <button type=\"button\" class=\"btn btn-danger\" (click) = \"close()\" >Close</button>\n</div>"
  1697. /***/ }),
  1698. /***/ "./src/app/components/player-ui/player-ui.component.ts":
  1699. /*!*************************************************************!*\
  1700. !*** ./src/app/components/player-ui/player-ui.component.ts ***!
  1701. \*************************************************************/
  1702. /*! exports provided: PlayerUiComponent */
  1703. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1704. "use strict";
  1705. __webpack_require__.r(__webpack_exports__);
  1706. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerUiComponent", function() { return PlayerUiComponent; });
  1707. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1708. /* harmony import */ var _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/game-data.model */ "./src/app/models/game-data.model.ts");
  1709. /* harmony import */ var src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  1710. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1711. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1712. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1713. 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;
  1714. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1715. };
  1716. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1717. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1718. };
  1719. var PlayerUiComponent = /** @class */ (function () {
  1720. function PlayerUiComponent(gameUIServiceService) {
  1721. this.gameUIServiceService = gameUIServiceService;
  1722. }
  1723. PlayerUiComponent.prototype.ngOnInit = function () {
  1724. };
  1725. PlayerUiComponent.prototype.close = function () {
  1726. this.gameUIServiceService.changeState(src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING);
  1727. };
  1728. __decorate([
  1729. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  1730. __metadata("design:type", _models_game_data_model__WEBPACK_IMPORTED_MODULE_1__["GameDataModel"])
  1731. ], PlayerUiComponent.prototype, "gameDataModel", void 0);
  1732. PlayerUiComponent = __decorate([
  1733. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  1734. selector: 'app-player-ui',
  1735. template: __webpack_require__(/*! ./player-ui.component.html */ "./src/app/components/player-ui/player-ui.component.html"),
  1736. styles: [__webpack_require__(/*! ./player-ui.component.css */ "./src/app/components/player-ui/player-ui.component.css")]
  1737. }),
  1738. __metadata("design:paramtypes", [src_app_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"]])
  1739. ], PlayerUiComponent);
  1740. return PlayerUiComponent;
  1741. }());
  1742. /***/ }),
  1743. /***/ "./src/app/components/post-viewer-ui/post-viewer-ui.component.css":
  1744. /*!************************************************************************!*\
  1745. !*** ./src/app/components/post-viewer-ui/post-viewer-ui.component.css ***!
  1746. \************************************************************************/
  1747. /*! no static exports found */
  1748. /***/ (function(module, exports) {
  1749. module.exports = ".post-viewer-ui-message{\n position:relative;\n /*max-width: 650px;*/\n left: 0;\n right: 0;\n margin: auto;\n padding : 10px;\n margin-bottom : 18px;\n background: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n height: 95%;\n width: 100%;\n overflow-y: auto;\n }\n\ndiv {\n margin-bottom: 8px;\n}\n\n#message-ascii {\n max-width: 650px;\n font-family: monospace;\n white-space: pre;\n}\n\n::ng-deep .img-preview img, .img-preview video, .img-preview iframe, .img-preview audio {\n max-width: 600px;\n max-height: 400px;\n}\n\nbutton{\n margin: 1px 1px 4px 1px;\n }"
  1750. /***/ }),
  1751. /***/ "./src/app/components/post-viewer-ui/post-viewer-ui.component.html":
  1752. /*!*************************************************************************!*\
  1753. !*** ./src/app/components/post-viewer-ui/post-viewer-ui.component.html ***!
  1754. \*************************************************************************/
  1755. /*! no static exports found */
  1756. /***/ (function(module, exports) {
  1757. module.exports = "<div class= \"post-viewer-ui-message\" *ngIf=\"postModel && postModel.url != undefined\">\n\n <div *ngIf=\"(!postModelList.length || postModelList.length == 0) && postModel != null\">\n <a href=\"#\" onclick=\"return false;\" (click)=\"reply(postModel)\">>>{{postModel.id}}</a> <span *ngIf=\"postModel.is_canon\">Δ</span>, by <i>#{{postModel.player_id}}</i><br/>\n <div *ngIf=\"postModel.reply >= 0\" ><i>Reply to >>{{ postModel.reply }}</i></div>\n <div id=\"message-ascii \">{{postModel.message}}</div>\n <br/>\n <!--img id=\"img-preview\" [src]=\"imgValue\"/-->\n <app-media-display *ngIf=\"postModel != null\" class=\"img-preview\" [url]=\"postModel.url\" ></app-media-display>\n <br/>\n URL:<a placeholder=\"Your file url\" [href]=\"postModel.url\"> {{postModel.url}} </a><br/>\n <i>To report content, write to monsieur.krunch@gmail.com, mentionning the ID of the post.</i><br/>\n <button type=\"button\" class=\"btn btn-secondary\" (click) = \"pinPost(postModel)\" >Pin the post</button><button type=\"button\" class=\"btn btn-danger\" (click) = \"closePost()\" >Close</button><br/>\n -----------------------------------------------------<br/>\n <div>\n <button *ngIf=\"canDelete()\" type=\"button\" class=\"btn\" (click) = \"deletePost(postModel)\" >Delete the post 🗑️</button>\n <button *ngIf=\"isAdmin()\"type=\"button\" class=\"btn\" (click) = \"canonPost(postModel.id,postModel.map_key)\" >Active or Disactive canon status Δ</button>\n <button *ngIf=\"isAdmin()\"type=\"button\" class=\"btn\" (click) = \"setPostUrlToFile(postModel.id)\" >Transform URL to File 🧙</button>\n <!--button type=\"button\" class=\"btn\" (click) = \"banPost()\" >Ban user 🔨</button-->\n </div>\n </div>\n\n <div *ngFor=\"let post of postModelList\">\n <a href=\"#\" onclick=\"return false;\" (click)=\"reply(post)\">>>{{post.id}}</a> <span *ngIf=\"post.is_canon\">Δ</span> by <i>#{{post.player_id}}</i><br/>\n <div *ngIf=\"post.reply >= 0\" ><i>Reply to >>{{ post.reply }}</i></div>\n <div id=\"message-ascii \">{{post.message}}</div>\n <br/>\n <app-media-display *ngIf=\"post.url != null && post.url != '' \" class=\"img-preview\" [url]=\"post.url\" ></app-media-display>\n <br/>\n URL:<a placeholder=\"Your file url\" [href]=\"post.url\"> {{post.url}} </a><br/>\n <i>To report content, write to monsieur.krunch@gmail.com, mentionning the ID of the post.</i><br/>\n <button type=\"button\" class=\"btn btn-secondary\" (click) = \"pinPost(post)\" >Pin the post</button> <button type=\"button\" class=\"btn btn-danger\" (click) = \"closePost()\" >Close</button><br/>\n -----------------------------------------------------<br/>\n <div>\n <button *ngIf=\"canDelete()\" type=\"button\" class=\"btn\" (click) = \"deletePost(post)\" >Delete the post 🗑️</button>\n <button *ngIf=\"isAdmin()\"type=\"button\" class=\"btn\" (click) = \"canonPost(post.id,post.map_key)\" >Active or Disactive canon status Δ</button>\n <button *ngIf=\"isAdmin()\"type=\"button\" class=\"btn\" (click) = \"setPostUrlToFile(post.id)\" >Transform URL to File 🧙</button>\n <!--button type=\"button\" class=\"btn\" (click) = \"banPost()\" >Ban user 🔨</button-->\n </div>\n </div>\n\n</div>"
  1758. /***/ }),
  1759. /***/ "./src/app/components/post-viewer-ui/post-viewer-ui.component.ts":
  1760. /*!***********************************************************************!*\
  1761. !*** ./src/app/components/post-viewer-ui/post-viewer-ui.component.ts ***!
  1762. \***********************************************************************/
  1763. /*! exports provided: PostViewerUiComponent */
  1764. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1765. "use strict";
  1766. __webpack_require__.r(__webpack_exports__);
  1767. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PostViewerUiComponent", function() { return PostViewerUiComponent; });
  1768. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1769. /* harmony import */ var _models_post_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/post.model */ "./src/app/models/post.model.ts");
  1770. /* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  1771. /* harmony import */ var src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/utils/urlParser */ "./src/app/utils/urlParser.ts");
  1772. /* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  1773. /* harmony import */ var _models_game_data_model__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../models/game-data.model */ "./src/app/models/game-data.model.ts");
  1774. /* harmony import */ var _interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../interfaces/player-interface/player-interface.component */ "./src/app/interfaces/player-interface/player-interface.component.ts");
  1775. var __extends = (undefined && undefined.__extends) || (function () {
  1776. var extendStatics = Object.setPrototypeOf ||
  1777. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1778. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1779. return function (d, b) {
  1780. extendStatics(d, b);
  1781. function __() { this.constructor = d; }
  1782. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1783. };
  1784. })();
  1785. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1786. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1787. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1788. 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;
  1789. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1790. };
  1791. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1792. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1793. };
  1794. var PostViewerUiComponent = /** @class */ (function (_super) {
  1795. __extends(PostViewerUiComponent, _super);
  1796. function PostViewerUiComponent(gameUIServiceService, chanWebService) {
  1797. var _this = _super.call(this) || this;
  1798. _this.gameUIServiceService = gameUIServiceService;
  1799. _this.chanWebService = chanWebService;
  1800. _this.pin = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  1801. _this.onReply = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  1802. _this.postModelList = [];
  1803. return _this;
  1804. }
  1805. PostViewerUiComponent.prototype.ngOnInit = function () {
  1806. var _this = this;
  1807. if (this.postModel) {
  1808. this.imgValue = new src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_3__["UrlParser"](this.postModel.url).getImage();
  1809. this.chanWebService.getReplyPostList(this.postModel.id).subscribe(function (data_) {
  1810. console.log(data_);
  1811. if (data_.result) {
  1812. if (data_.result.length && data_.result.length > 0) {
  1813. if (data_.result[0].id != null)
  1814. _this.postModelList = data_.result;
  1815. }
  1816. }
  1817. });
  1818. }
  1819. };
  1820. PostViewerUiComponent.prototype.ngOnChanges = function (changes) {
  1821. if (changes != null && changes.postModel != null) {
  1822. this.postModel = changes.postModel.currentValue;
  1823. if (this.postModel != null || this.postModel != undefined)
  1824. this.imgValue = new src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_3__["UrlParser"](this.postModel.url).getImage();
  1825. }
  1826. };
  1827. PostViewerUiComponent.prototype.closePost = function () {
  1828. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING);
  1829. };
  1830. PostViewerUiComponent.prototype.pinPost = function (postModel_) {
  1831. this.pin.emit(postModel_);
  1832. };
  1833. PostViewerUiComponent.prototype.deletePost = function (postModel_) {
  1834. var _this = this;
  1835. this.postToDelete = postModel_;
  1836. console.log("this.postToDelete:" + this.postToDelete);
  1837. this.chanWebService.deletePost(postModel_.id, postModel_.map_key).subscribe(
  1838. //Data success
  1839. function (data) {
  1840. _this.gameUIServiceService.deletePost(_this.postToDelete);
  1841. _this.gameUIServiceService.forceWS();
  1842. _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING);
  1843. });
  1844. };
  1845. PostViewerUiComponent.prototype.canonPost = function (id_, thread_) {
  1846. var _this = this;
  1847. this.chanWebService.canonPost(id_, thread_).subscribe(
  1848. //Data success
  1849. function (data) {
  1850. _this.gameUIServiceService.forceWS();
  1851. _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING);
  1852. });
  1853. };
  1854. PostViewerUiComponent.prototype.banPost = function () {
  1855. };
  1856. PostViewerUiComponent.prototype.setPostUrlToFile = function (id_) {
  1857. this.chanWebService.setPostUrlToFile(id_).subscribe(
  1858. //Data success
  1859. function (data) {
  1860. alert(data);
  1861. });
  1862. };
  1863. PostViewerUiComponent.prototype.reply = function (postModel_) {
  1864. console.log(postModel_.id);
  1865. this.onReply.emit(postModel_.id);
  1866. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"].STATE_GAME_RUNNING);
  1867. };
  1868. __decorate([
  1869. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  1870. __metadata("design:type", _models_post_model__WEBPACK_IMPORTED_MODULE_1__["PostModel"])
  1871. ], PostViewerUiComponent.prototype, "postModel", void 0);
  1872. __decorate([
  1873. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  1874. __metadata("design:type", _models_game_data_model__WEBPACK_IMPORTED_MODULE_5__["GameDataModel"])
  1875. ], PostViewerUiComponent.prototype, "gameData", void 0);
  1876. __decorate([
  1877. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(),
  1878. __metadata("design:type", Object)
  1879. ], PostViewerUiComponent.prototype, "pin", void 0);
  1880. __decorate([
  1881. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(),
  1882. __metadata("design:type", Object)
  1883. ], PostViewerUiComponent.prototype, "onReply", void 0);
  1884. PostViewerUiComponent = __decorate([
  1885. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  1886. selector: 'app-post-viewer-ui',
  1887. template: __webpack_require__(/*! ./post-viewer-ui.component.html */ "./src/app/components/post-viewer-ui/post-viewer-ui.component.html"),
  1888. styles: [__webpack_require__(/*! ./post-viewer-ui.component.css */ "./src/app/components/post-viewer-ui/post-viewer-ui.component.css")]
  1889. }),
  1890. __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_2__["GameUIServiceService"], src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_4__["ChanWebService"]])
  1891. ], PostViewerUiComponent);
  1892. return PostViewerUiComponent;
  1893. }(_interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_6__["PlayerInterfaceComponent"]));
  1894. /***/ }),
  1895. /***/ "./src/app/components/posting-ui/posting-ui.component.css":
  1896. /*!****************************************************************!*\
  1897. !*** ./src/app/components/posting-ui/posting-ui.component.css ***!
  1898. \****************************************************************/
  1899. /*! no static exports found */
  1900. /***/ (function(module, exports) {
  1901. module.exports = ".post-ui-message{\n position:relative;\n max-width: 650px;\n left: 0;\n right: 0;\n margin: auto;\n\n padding : 10px;\n margin-bottom : 18px;\n background-color: rgb(189, 198, 247);\n border-style: solid;\n border-width: 1px;\n border-color: #a99ec7;\n border-radius: 5px;\n\n height: 100%;\n overflow-y: auto;\n }\n\ndiv {\n margin-bottom: 8px;\n}\n\ntextarea\n{\n width: 100%;\n margin: 0;\n}\n\n.post-message {\n padding : 10px;\n margin-bottom : 18px;\n background: rgb(228, 221, 221);\n border-style: solid;\n border-width: 1px;\n border-color: rgb(131, 123, 123);\n border-radius: 5px;\n}\n\n.img-preview{\n max-width: 200px;\n max-height: 200px;\n}\n\n.post-torrent-info{\n font-family: 'Courier New', Courier, monospace;\n font-size: small;\n padding : 8px;\n color: white;\n background:rgb(70, 61, 56);\n border-radius: 5px;\n}\n\n.post-message img {\n max-width: 650px;\n width: 100%;\n height: auto;\n}\n\n.post-message video {\n max-width: 650px;\n width: 100%;\n height: auto;\n}\n\n.post-message audio {\n max-width: 650px;\n width: 100%;\n}\n\nbutton{\n margin: 1px 1px 4px 1px;\n }"
  1902. /***/ }),
  1903. /***/ "./src/app/components/posting-ui/posting-ui.component.html":
  1904. /*!*****************************************************************!*\
  1905. !*** ./src/app/components/posting-ui/posting-ui.component.html ***!
  1906. \*****************************************************************/
  1907. /*! no static exports found */
  1908. /***/ (function(module, exports) {
  1909. module.exports = "<div class= \"post-ui-message\">\n\n <div *ngIf=\"!isLoading && !postingFinished\">\n <!-- {{canvasKey}}<br/>\n <Name: <br/>\n <input id=\"message-name\" placeholder=\"Anonymous\" [(ngModel)]=\"postModel.name\" ><br/>-->\n <div *ngIf=\"reply >= 0\" ><i>reply to >>{{ reply }}</i> <span (click)=\"destroyReply()\"> 🗑️</span></div>\n Message: <br/>\n <textarea id=\"message-text\" placeholder=\"Your text\" [(ngModel)]=\"postModel.message\" ></textarea>\n <br/>\n\n <div *ngIf=\"canUpload()\">\n <input #messageHost id=\"message-host\" type=\"checkbox\" [checked]=\"hostFile\" (change)=\"changeHost(messageHost.checked)\" >Host on chan<br/>\n </div>\n <img *ngIf=\"postModel.url != null && !hostFile\" class=\"img-preview\" [src]=\"urlParse.setUrl(postModel.url).getImage()\"><br/>\n <img *ngIf=\"fileBase64Url != null && hostFile\" class=\"img-preview\" [src]=\"fileBase64Url\"><br/>\n \n\n <div *ngIf=\"!hostFile && !isPhonePosting\">\n File URL: <br/>\n <input id=\"file-url\" type=\"url\" placeholder=\"Your file url\" [(ngModel)]=\"postModel.url\" ><br/>\n </div>\n \n <div *ngIf=\"hostFile || isPhonePosting\">\n File From the computer: <br/>\n <input #file id=\"file\" name=\"file\" type=\"file\" accept='image/*' (change)=\"preview(file.files)\" /><br/>\n\n <a href=\"{{getPhoneLink()}}\" target=\"blank_\">Open phone posting link!</a><br/>\n <qrcode [qrdata]=\"getPhoneLink()\" [size]=\"256\" [level]=\"'M'\"></qrcode><br/>\n\n </div>\n\n <!--Is the post NSFW: <input type=\"checkbox\" [(ngModel)]=\"postModel.nsfw\"><br/-->\n <button type=\"submit\" type=\"button\" class=\"btn btn-primary\" (click) = \"sendPost()\" >Post</button>\n <button type=\"button\" class=\"btn btn-danger\" (click) = \"cancelPost()\" >Cancel</button>\n\n </div>\n\n <div *ngIf=\"isLoading\">\n Posting in progress..\n <div class=\"progress\">\n <div class=\"progress-bar progress-bar-striped bg-primary\" role=\"progressbar\" style=\"width: 100%; height: 100%;\"\n aria-valuenow=\"100\" aria-valuemin=\"0\" aria-valuemax=\"100\"></div>\n </div>\n </div>\n\n <div *ngIf=\"!isLoading && postingFinished\">\n Your message has been posted! thanks for your contribution!\n </div>\n\n \n\n </div>\n"
  1910. /***/ }),
  1911. /***/ "./src/app/components/posting-ui/posting-ui.component.ts":
  1912. /*!***************************************************************!*\
  1913. !*** ./src/app/components/posting-ui/posting-ui.component.ts ***!
  1914. \***************************************************************/
  1915. /*! exports provided: PostingUIComponent */
  1916. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1917. "use strict";
  1918. __webpack_require__.r(__webpack_exports__);
  1919. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PostingUIComponent", function() { return PostingUIComponent; });
  1920. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  1921. /* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  1922. /* harmony import */ var _models_post_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../models/post.model */ "./src/app/models/post.model.ts");
  1923. /* harmony import */ var src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/chan-web.service */ "./src/app/services/chan-web.service.ts");
  1924. /* harmony import */ var src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/utils/urlParser */ "./src/app/utils/urlParser.ts");
  1925. /* harmony import */ var _interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../interfaces/player-interface/player-interface.component */ "./src/app/interfaces/player-interface/player-interface.component.ts");
  1926. /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  1927. /* harmony import */ var src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! src/app/services/offline.service */ "./src/app/services/offline.service.ts");
  1928. /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js");
  1929. /* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../environments/environment */ "./src/environments/environment.ts");
  1930. var __extends = (undefined && undefined.__extends) || (function () {
  1931. var extendStatics = Object.setPrototypeOf ||
  1932. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1933. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1934. return function (d, b) {
  1935. extendStatics(d, b);
  1936. function __() { this.constructor = d; }
  1937. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1938. };
  1939. })();
  1940. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  1941. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1942. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1943. 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;
  1944. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1945. };
  1946. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  1947. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1948. };
  1949. var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
  1950. return function (target, key) { decorator(target, key, paramIndex); }
  1951. };
  1952. var PostingUIComponent = /** @class */ (function (_super) {
  1953. __extends(PostingUIComponent, _super);
  1954. function PostingUIComponent(gameUIServiceService, chanWebService, router, offlineService, document) {
  1955. var _this = _super.call(this) || this;
  1956. _this.gameUIServiceService = gameUIServiceService;
  1957. _this.chanWebService = chanWebService;
  1958. _this.router = router;
  1959. _this.offlineService = offlineService;
  1960. _this.document = document;
  1961. _this.onDestroyReply = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  1962. _this.isLoading = false;
  1963. _this.postingFinished = false;
  1964. _this.hostFile = false;
  1965. return _this;
  1966. }
  1967. PostingUIComponent.prototype.ngOnInit = function () {
  1968. this.postModel = new _models_post_model__WEBPACK_IMPORTED_MODULE_2__["PostModel"]();
  1969. this.urlParse = new src_app_utils_urlParser__WEBPACK_IMPORTED_MODULE_4__["UrlParser"](this.postModel.url);
  1970. this.postModel.canvas_key = this.canvasKey;
  1971. this.postModel.reply = this.reply;
  1972. };
  1973. PostingUIComponent.prototype.ngOnChanges = function (changes) {
  1974. if (this.postModel != null && changes.canvasKey != null)
  1975. this.postModel.canvas_key = changes.canvasKey.currentValue;
  1976. if (this.isPhonePosting)
  1977. this.hostFile = true;
  1978. };
  1979. PostingUIComponent.prototype.changeHost = function (val_) {
  1980. this.hostFile = val_;
  1981. };
  1982. PostingUIComponent.prototype.preview = function (files) {
  1983. var _this = this;
  1984. if (files.length === 0)
  1985. return;
  1986. var mimeType = files[0].type;
  1987. if (mimeType.match(/image\/*/) == null) {
  1988. alert("Only images are supported.");
  1989. return;
  1990. }
  1991. var reader = new FileReader();
  1992. this.imagePath = files;
  1993. reader.readAsDataURL(files[0]);
  1994. reader.onload = function (_event) {
  1995. //console.log(reader.result.toString());
  1996. _this.fileBase64Url = reader.result.toString();
  1997. };
  1998. };
  1999. PostingUIComponent.prototype.sendPost = function () {
  2000. var _this = this;
  2001. //this.gameUIServiceService.sendPost(this.postModel);
  2002. console.log(this.file);
  2003. if (this.fileBase64Url == null && !this.postModel.url && !this.postModel.message) {
  2004. alert("It's doesn't looks like a big post :( ");
  2005. return;
  2006. }
  2007. this.isLoading = true;
  2008. //Use this.
  2009. if (this.hostFile) {
  2010. //To host
  2011. this.chanWebService.createAndUploadPaint(this.postModel, this.fileBase64Url).subscribe(
  2012. //Data success
  2013. function (data) {
  2014. var postStuffResponse = data;
  2015. if (postStuffResponse.ok) {
  2016. _this.destroyReply();
  2017. //console.log("result "+JSON.stringify( postStuffResponse));
  2018. _this.gameUIServiceService.forceWS();
  2019. _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING);
  2020. }
  2021. _this.isLoading = false;
  2022. _this.postingFinished = true;
  2023. }, function (error) {
  2024. console.log(JSON.stringify(error));
  2025. _this.isLoading = false;
  2026. });
  2027. }
  2028. else {
  2029. //Not hosting
  2030. this.chanWebService.createPost(this.postModel).subscribe(
  2031. //Data success
  2032. function (data) {
  2033. var postStuffResponse = data;
  2034. if (postStuffResponse.ok) {
  2035. //console.log("result "+JSON.stringify( postStuffResponse));
  2036. _this.destroyReply();
  2037. //We clean the fields
  2038. _this.postModel.url = "";
  2039. _this.postModel.message = "";
  2040. _this.gameUIServiceService.forceWS();
  2041. _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING);
  2042. }
  2043. _this.isLoading = false;
  2044. _this.postingFinished = true;
  2045. }, function (error) {
  2046. console.log(JSON.stringify(error));
  2047. _this.isLoading = false;
  2048. });
  2049. }
  2050. };
  2051. PostingUIComponent.prototype.cancelPost = function () {
  2052. this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"].STATE_GAME_RUNNING);
  2053. };
  2054. PostingUIComponent.prototype.getPhoneLink = function () {
  2055. var playerModel = this.offlineService.getPlayerData();
  2056. var phonePostingUrl = _environments_environment__WEBPACK_IMPORTED_MODULE_9__["environment"].clientUrl + "phone-poster/" + playerModel.id + "/" + playerModel.player_key + "/" + this.postModel.canvas_key;
  2057. return phonePostingUrl;
  2058. };
  2059. PostingUIComponent.prototype.destroyReply = function () {
  2060. console.log("destroyReply()");
  2061. this.reply = -1;
  2062. this.onDestroyReply.emit(-1);
  2063. };
  2064. __decorate([
  2065. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2066. __metadata("design:type", String)
  2067. ], PostingUIComponent.prototype, "canvasKey", void 0);
  2068. __decorate([
  2069. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2070. __metadata("design:type", Number)
  2071. ], PostingUIComponent.prototype, "reply", void 0);
  2072. __decorate([
  2073. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(),
  2074. __metadata("design:type", Object)
  2075. ], PostingUIComponent.prototype, "onDestroyReply", void 0);
  2076. PostingUIComponent = __decorate([
  2077. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  2078. selector: 'app-posting-ui',
  2079. template: __webpack_require__(/*! ./posting-ui.component.html */ "./src/app/components/posting-ui/posting-ui.component.html"),
  2080. styles: [__webpack_require__(/*! ./posting-ui.component.css */ "./src/app/components/posting-ui/posting-ui.component.css")]
  2081. }),
  2082. __param(4, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_platform_browser__WEBPACK_IMPORTED_MODULE_8__["DOCUMENT"])),
  2083. __metadata("design:paramtypes", [_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_1__["GameUIServiceService"],
  2084. src_app_services_chan_web_service__WEBPACK_IMPORTED_MODULE_3__["ChanWebService"],
  2085. _angular_router__WEBPACK_IMPORTED_MODULE_6__["Router"],
  2086. src_app_services_offline_service__WEBPACK_IMPORTED_MODULE_7__["OfflineService"],
  2087. Document])
  2088. ], PostingUIComponent);
  2089. return PostingUIComponent;
  2090. }(_interfaces_player_interface_player_interface_component__WEBPACK_IMPORTED_MODULE_5__["PlayerInterfaceComponent"]));
  2091. /***/ }),
  2092. /***/ "./src/app/components/tile-edit/tile-edit.component.css":
  2093. /*!**************************************************************!*\
  2094. !*** ./src/app/components/tile-edit/tile-edit.component.css ***!
  2095. \**************************************************************/
  2096. /*! no static exports found */
  2097. /***/ (function(module, exports) {
  2098. module.exports = ".disable-select {\n user-select: none; /* supported by Chrome and Opera */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n}"
  2099. /***/ }),
  2100. /***/ "./src/app/components/tile-edit/tile-edit.component.html":
  2101. /*!***************************************************************!*\
  2102. !*** ./src/app/components/tile-edit/tile-edit.component.html ***!
  2103. \***************************************************************/
  2104. /*! no static exports found */
  2105. /***/ (function(module, exports) {
  2106. module.exports = "<span class=\"disable-select\" (click)=\"paint()\">{{tileDisplay}}</span>\n"
  2107. /***/ }),
  2108. /***/ "./src/app/components/tile-edit/tile-edit.component.ts":
  2109. /*!*************************************************************!*\
  2110. !*** ./src/app/components/tile-edit/tile-edit.component.ts ***!
  2111. \*************************************************************/
  2112. /*! exports provided: TileEditComponent */
  2113. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2114. "use strict";
  2115. __webpack_require__.r(__webpack_exports__);
  2116. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TileEditComponent", function() { return TileEditComponent; });
  2117. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  2118. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  2119. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2120. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2121. 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;
  2122. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2123. };
  2124. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  2125. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2126. };
  2127. var TileEditComponent = /** @class */ (function () {
  2128. function TileEditComponent() {
  2129. this.valueChange = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  2130. this.allTiles = [];
  2131. this.tileDisplay = "";
  2132. }
  2133. TileEditComponent.prototype.ngOnInit = function () {
  2134. };
  2135. TileEditComponent.prototype.paint = function () {
  2136. //this.tileValue = this.tileBrush;
  2137. this.valueChange.emit({ x: this.x, y: this.y });
  2138. //this.updateDisplay();
  2139. };
  2140. TileEditComponent.prototype.ngOnChanges = function () {
  2141. this.updateDisplay();
  2142. };
  2143. TileEditComponent.prototype.updateDisplay = function () {
  2144. var _this = this;
  2145. if (this.allTiles != null) {
  2146. this.allTiles.forEach(function (tile) {
  2147. if (tile.value == _this.tileValue) {
  2148. _this.tileDisplay = tile.display;
  2149. return;
  2150. }
  2151. });
  2152. }
  2153. };
  2154. __decorate([
  2155. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2156. __metadata("design:type", Object)
  2157. ], TileEditComponent.prototype, "tileValue", void 0);
  2158. __decorate([
  2159. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2160. __metadata("design:type", Object)
  2161. ], TileEditComponent.prototype, "tileBrush", void 0);
  2162. __decorate([
  2163. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2164. __metadata("design:type", Object)
  2165. ], TileEditComponent.prototype, "x", void 0);
  2166. __decorate([
  2167. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2168. __metadata("design:type", Object)
  2169. ], TileEditComponent.prototype, "y", void 0);
  2170. __decorate([
  2171. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"])(),
  2172. __metadata("design:type", Object)
  2173. ], TileEditComponent.prototype, "valueChange", void 0);
  2174. __decorate([
  2175. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2176. __metadata("design:type", Array)
  2177. ], TileEditComponent.prototype, "allTiles", void 0);
  2178. TileEditComponent = __decorate([
  2179. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  2180. selector: 'app-tile-edit',
  2181. template: __webpack_require__(/*! ./tile-edit.component.html */ "./src/app/components/tile-edit/tile-edit.component.html"),
  2182. styles: [__webpack_require__(/*! ./tile-edit.component.css */ "./src/app/components/tile-edit/tile-edit.component.css")]
  2183. }),
  2184. __metadata("design:paramtypes", [])
  2185. ], TileEditComponent);
  2186. return TileEditComponent;
  2187. }());
  2188. /***/ }),
  2189. /***/ "./src/app/interfaces/player-interface/player-interface.component.css":
  2190. /*!****************************************************************************!*\
  2191. !*** ./src/app/interfaces/player-interface/player-interface.component.css ***!
  2192. \****************************************************************************/
  2193. /*! no static exports found */
  2194. /***/ (function(module, exports) {
  2195. module.exports = ""
  2196. /***/ }),
  2197. /***/ "./src/app/interfaces/player-interface/player-interface.component.html":
  2198. /*!*****************************************************************************!*\
  2199. !*** ./src/app/interfaces/player-interface/player-interface.component.html ***!
  2200. \*****************************************************************************/
  2201. /*! no static exports found */
  2202. /***/ (function(module, exports) {
  2203. module.exports = ""
  2204. /***/ }),
  2205. /***/ "./src/app/interfaces/player-interface/player-interface.component.ts":
  2206. /*!***************************************************************************!*\
  2207. !*** ./src/app/interfaces/player-interface/player-interface.component.ts ***!
  2208. \***************************************************************************/
  2209. /*! exports provided: PlayerInterfaceComponent */
  2210. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2211. "use strict";
  2212. __webpack_require__.r(__webpack_exports__);
  2213. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerInterfaceComponent", function() { return PlayerInterfaceComponent; });
  2214. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  2215. /* harmony import */ var src_app_utils_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/app/utils/constants */ "./src/app/utils/constants.ts");
  2216. /* harmony import */ var _models_game_data_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../models/game-data.model */ "./src/app/models/game-data.model.ts");
  2217. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  2218. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2219. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2220. 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;
  2221. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2222. };
  2223. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  2224. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2225. };
  2226. var PlayerInterfaceComponent = /** @class */ (function () {
  2227. function PlayerInterfaceComponent() {
  2228. this.gameDataModel = new _models_game_data_model__WEBPACK_IMPORTED_MODULE_2__["GameDataModel"]();
  2229. }
  2230. PlayerInterfaceComponent.prototype.ngOnInit = function () {
  2231. if (this.gameDataModel == null)
  2232. this.gameDataModel = new _models_game_data_model__WEBPACK_IMPORTED_MODULE_2__["GameDataModel"]();
  2233. };
  2234. //test
  2235. PlayerInterfaceComponent.prototype.canDelete = function () {
  2236. if (this.gameDataModel.player.is_admin)
  2237. return true;
  2238. for (var _i = 0, _a = this.gameDataModel.itemsPlayer; _i < _a.length; _i++) {
  2239. var item = _a[_i];
  2240. if (item.action.toLowerCase().indexOf(src_app_utils_constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ITEM_KEY_DELETE_SPONGE) >= 0)
  2241. return true;
  2242. }
  2243. return false;
  2244. };
  2245. PlayerInterfaceComponent.prototype.canFav = function () {
  2246. if (this.gameDataModel.player.is_admin)
  2247. return true;
  2248. for (var _i = 0, _a = this.gameDataModel.itemsPlayer; _i < _a.length; _i++) {
  2249. var item = _a[_i];
  2250. if (item.action.toLowerCase().indexOf(src_app_utils_constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ITEM_KEY_VARNISH) >= 0)
  2251. return true;
  2252. }
  2253. return false;
  2254. };
  2255. PlayerInterfaceComponent.prototype.canUpload = function () {
  2256. if (this.gameDataModel.player.is_admin || this.isPhonePosting)
  2257. return true;
  2258. for (var _i = 0, _a = this.gameDataModel.itemsPlayer; _i < _a.length; _i++) {
  2259. var item = _a[_i];
  2260. if (item.action.toLowerCase().indexOf(src_app_utils_constants__WEBPACK_IMPORTED_MODULE_1__["Constants"].ITEM_KEY_UPLOAD_RING) >= 0)
  2261. return true;
  2262. }
  2263. return false;
  2264. };
  2265. PlayerInterfaceComponent.prototype.isAdmin = function () {
  2266. if (this.gameDataModel.player.is_admin)
  2267. return true;
  2268. return false;
  2269. };
  2270. __decorate([
  2271. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2272. __metadata("design:type", _models_game_data_model__WEBPACK_IMPORTED_MODULE_2__["GameDataModel"])
  2273. ], PlayerInterfaceComponent.prototype, "gameDataModel", void 0);
  2274. __decorate([
  2275. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2276. __metadata("design:type", Boolean)
  2277. ], PlayerInterfaceComponent.prototype, "isPhonePosting", void 0);
  2278. PlayerInterfaceComponent = __decorate([
  2279. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"])({
  2280. selector: 'app-player-interface',
  2281. template: __webpack_require__(/*! ./player-interface.component.html */ "./src/app/interfaces/player-interface/player-interface.component.html"),
  2282. styles: [__webpack_require__(/*! ./player-interface.component.css */ "./src/app/interfaces/player-interface/player-interface.component.css")]
  2283. }),
  2284. __metadata("design:paramtypes", [])
  2285. ], PlayerInterfaceComponent);
  2286. return PlayerInterfaceComponent;
  2287. }());
  2288. /***/ }),
  2289. /***/ "./src/app/models/action.model.ts":
  2290. /*!****************************************!*\
  2291. !*** ./src/app/models/action.model.ts ***!
  2292. \****************************************/
  2293. /*! exports provided: ActionModel */
  2294. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2295. "use strict";
  2296. __webpack_require__.r(__webpack_exports__);
  2297. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActionModel", function() { return ActionModel; });
  2298. var ActionModel = /** @class */ (function () {
  2299. function ActionModel() {
  2300. }
  2301. return ActionModel;
  2302. }());
  2303. /***/ }),
  2304. /***/ "./src/app/models/config.model.ts":
  2305. /*!****************************************!*\
  2306. !*** ./src/app/models/config.model.ts ***!
  2307. \****************************************/
  2308. /*! exports provided: ConfigModel */
  2309. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2310. "use strict";
  2311. __webpack_require__.r(__webpack_exports__);
  2312. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConfigModel", function() { return ConfigModel; });
  2313. var ConfigModel = /** @class */ (function () {
  2314. function ConfigModel() {
  2315. }
  2316. return ConfigModel;
  2317. }());
  2318. /***/ }),
  2319. /***/ "./src/app/models/game-data.model.ts":
  2320. /*!*******************************************!*\
  2321. !*** ./src/app/models/game-data.model.ts ***!
  2322. \*******************************************/
  2323. /*! exports provided: GameDataModel */
  2324. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2325. "use strict";
  2326. __webpack_require__.r(__webpack_exports__);
  2327. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GameDataModel", function() { return GameDataModel; });
  2328. /* harmony import */ var _player_model__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./player.model */ "./src/app/models/player.model.ts");
  2329. var GameDataModel = /** @class */ (function () {
  2330. function GameDataModel() {
  2331. this.player = new _player_model__WEBPACK_IMPORTED_MODULE_0__["PlayerModel"]();
  2332. this.itemsPlayer = [];
  2333. }
  2334. return GameDataModel;
  2335. }());
  2336. /***/ }),
  2337. /***/ "./src/app/models/interaction-model.ts":
  2338. /*!*********************************************!*\
  2339. !*** ./src/app/models/interaction-model.ts ***!
  2340. \*********************************************/
  2341. /*! exports provided: InteractionModel */
  2342. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2343. "use strict";
  2344. __webpack_require__.r(__webpack_exports__);
  2345. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InteractionModel", function() { return InteractionModel; });
  2346. var InteractionModel = /** @class */ (function () {
  2347. function InteractionModel() {
  2348. }
  2349. Object.defineProperty(InteractionModel, "TYPE_NONE", {
  2350. get: function () { return 0; },
  2351. enumerable: true,
  2352. configurable: true
  2353. });
  2354. Object.defineProperty(InteractionModel, "TYPE_CANVAS_FULL", {
  2355. get: function () { return 1; },
  2356. enumerable: true,
  2357. configurable: true
  2358. });
  2359. Object.defineProperty(InteractionModel, "TYPE_CANVAS_VIRGIN", {
  2360. get: function () { return 2; },
  2361. enumerable: true,
  2362. configurable: true
  2363. });
  2364. Object.defineProperty(InteractionModel, "TYPE_CLIMB_LADDER", {
  2365. get: function () { return 3; },
  2366. enumerable: true,
  2367. configurable: true
  2368. });
  2369. Object.defineProperty(InteractionModel, "TYPE_OPEN_DOOR", {
  2370. get: function () { return 4; },
  2371. enumerable: true,
  2372. configurable: true
  2373. });
  2374. Object.defineProperty(InteractionModel, "TYPE_GET_ITEM", {
  2375. get: function () { return 5; },
  2376. enumerable: true,
  2377. configurable: true
  2378. });
  2379. Object.defineProperty(InteractionModel, "TYPE_PASS_GATE", {
  2380. get: function () { return 6; },
  2381. enumerable: true,
  2382. configurable: true
  2383. });
  2384. Object.defineProperty(InteractionModel, "TYPE_PANEL", {
  2385. get: function () { return 7; },
  2386. enumerable: true,
  2387. configurable: true
  2388. });
  2389. Object.defineProperty(InteractionModel, "TYPE_CANVAS_TO_GRAFF", {
  2390. get: function () { return 8; },
  2391. enumerable: true,
  2392. configurable: true
  2393. });
  2394. Object.defineProperty(InteractionModel, "TYPE_AD", {
  2395. get: function () { return 9; },
  2396. enumerable: true,
  2397. configurable: true
  2398. });
  2399. return InteractionModel;
  2400. }());
  2401. /***/ }),
  2402. /***/ "./src/app/models/player.model.ts":
  2403. /*!****************************************!*\
  2404. !*** ./src/app/models/player.model.ts ***!
  2405. \****************************************/
  2406. /*! exports provided: PlayerModel */
  2407. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2408. "use strict";
  2409. __webpack_require__.r(__webpack_exports__);
  2410. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerModel", function() { return PlayerModel; });
  2411. var PlayerModel = /** @class */ (function () {
  2412. function PlayerModel() {
  2413. }
  2414. return PlayerModel;
  2415. }());
  2416. /***/ }),
  2417. /***/ "./src/app/models/post.model.ts":
  2418. /*!**************************************!*\
  2419. !*** ./src/app/models/post.model.ts ***!
  2420. \**************************************/
  2421. /*! exports provided: PostModel */
  2422. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2423. "use strict";
  2424. __webpack_require__.r(__webpack_exports__);
  2425. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PostModel", function() { return PostModel; });
  2426. var PostModel = /** @class */ (function () {
  2427. function PostModel() {
  2428. this.map_key = "";
  2429. this.message = "";
  2430. this.url = "";
  2431. this.preview = "";
  2432. this.nsfw = false;
  2433. this.graffiti = false;
  2434. this.is_canon = false;
  2435. this.was_deleted = false;
  2436. }
  2437. return PostModel;
  2438. }());
  2439. /***/ }),
  2440. /***/ "./src/app/motor/canvasPlane.ts":
  2441. /*!**************************************!*\
  2442. !*** ./src/app/motor/canvasPlane.ts ***!
  2443. \**************************************/
  2444. /*! exports provided: CanvasPlane */
  2445. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2446. "use strict";
  2447. __webpack_require__.r(__webpack_exports__);
  2448. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CanvasPlane", function() { return CanvasPlane; });
  2449. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js");
  2450. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__);
  2451. /* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts");
  2452. /* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts");
  2453. /* harmony import */ var _models_post_model__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../models/post.model */ "./src/app/models/post.model.ts");
  2454. /* harmony import */ var _utils_urlParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/urlParser */ "./src/app/utils/urlParser.ts");
  2455. var CanvasPlane = /** @class */ (function () {
  2456. function CanvasPlane(objType_, dictKey, size, x, y, z, dir) {
  2457. this.objType = "canvas";
  2458. this.isVirgin = true;
  2459. this.font_size = 70;
  2460. this.font = "bold " + this.font_size + "px Arial";
  2461. this.canvasScale = 900;
  2462. //Manage diff percentage of size
  2463. this.objType = objType_;
  2464. this.sizeCanvas = size;
  2465. var scaling = (objType_ === "canvas") ? 0.9 : 1;
  2466. this.sizeCanvas = this.sizeCanvas * scaling;
  2467. this.dictKey = this.objType + "_" + dictKey + "_" + dir;
  2468. this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance();
  2469. this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance();
  2470. this.planeMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreatePlane(this.dictKey, { size: this.sizeCanvas }, this.gameInstance.scene);
  2471. this.planeMesh.position.y = (size * 0.5) + y;
  2472. if (this.objType == "canvas") {
  2473. this.mapInstance.registerNewCanvas(this.dictKey, this);
  2474. }
  2475. else {
  2476. this.mapInstance.registerNewAd(this.dictKey, this);
  2477. }
  2478. //Determine the orientation of the canvas
  2479. //let dir = this.mapInstance.getCanvasOrientation( this.tileCoordonates[0], this.tileCoordonates[1]);
  2480. //console.log("TILE DIR= "+dir);
  2481. var canvasX;
  2482. var canvasY;
  2483. var canvasZ;
  2484. var canvasAngle;
  2485. var gapToTheWall = 0.1;
  2486. /*
  2487. canvasX = x;
  2488. canvasY = (size * -0.5) - (size * 0.1) + y;*/
  2489. switch (dir) {
  2490. case this.mapInstance.DIR_N:
  2491. canvasX = x;
  2492. canvasZ = (size * -0.5) - gapToTheWall + z;
  2493. canvasAngle = 0;
  2494. break;
  2495. case this.mapInstance.DIR_E:
  2496. canvasX = (size * -0.5) - gapToTheWall + x;
  2497. canvasZ = z;
  2498. canvasAngle = (Math.PI / 180) * 90;
  2499. break;
  2500. case this.mapInstance.DIR_S:
  2501. canvasX = x;
  2502. canvasZ = (size * 0.5) + gapToTheWall + z;
  2503. canvasAngle = (Math.PI / 180) * 180;
  2504. break;
  2505. case this.mapInstance.DIR_W:
  2506. canvasX = (size * 0.5) + gapToTheWall + x;
  2507. canvasZ = z;
  2508. canvasAngle = (Math.PI / 180) * 270;
  2509. break;
  2510. }
  2511. this.planeMesh.position.x = canvasX;
  2512. this.planeMesh.position.z = canvasZ;
  2513. this.planeMesh.rotate(BABYLON.Axis.Y, canvasAngle, BABYLON.Space.WORLD);
  2514. var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matCanvas", this.gameInstance.scene);
  2515. mat.alpha = 0;
  2516. this.planeMesh.material = mat;
  2517. this.planeMesh.visibility = 0;
  2518. this.planeMesh.material.freeze();
  2519. this.planeMesh.freezeWorldMatrix();
  2520. this.postModel = new _models_post_model__WEBPACK_IMPORTED_MODULE_3__["PostModel"]();
  2521. this.postModel.canvas_key = this.dictKey;
  2522. }
  2523. /*
  2524. private displayUI: GUI.Rectangle;
  2525. private uiAdvancedTexture: GUI.AdvancedDynamicTexture;
  2526. private label : GUI.TextBlock;*/
  2527. CanvasPlane.prototype.setPostData = function (postModel_) {
  2528. var _this = this;
  2529. this.initTextureObject();
  2530. /* if(postModel_.graffiti) {
  2531. this.postModelGraffiti = postModel_;
  2532. } else {*/
  2533. this.postModel = postModel_;
  2534. //}
  2535. var postImageUrl = this.postModel.url;
  2536. if (this.postModel.preview == null || this.postModel.preview.length === 0) {
  2537. postImageUrl = new _utils_urlParser__WEBPACK_IMPORTED_MODULE_4__["UrlParser"](postModel_.url).getImage();
  2538. }
  2539. else {
  2540. postImageUrl = this.postModel.preview;
  2541. }
  2542. //Launch picture loading
  2543. if (postImageUrl.length > 0) {
  2544. if (postModel_.graffiti) {
  2545. this.postImageGraffiti = new Image();
  2546. this.postImageGraffiti.crossOrigin = "anonymous";
  2547. this.postImageGraffiti.src = postImageUrl;
  2548. this.postImageGraffiti.onload = function (event_) {
  2549. _this.imgLoaded();
  2550. };
  2551. this.postImageGraffiti.onerror = function (event_) {
  2552. _this.textureNonDynamic = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/404.png", _this.gameInstance.scene);
  2553. _this.mat.diffuseTexture = _this.textureNonDynamic;
  2554. _this.mat.diffuseTexture.hasAlpha = true;
  2555. _this.planeMesh.material = _this.mat;
  2556. _this.planeMesh.material.freeze();
  2557. };
  2558. }
  2559. else {
  2560. this.postImage = new Image();
  2561. this.postImage.crossOrigin = "anonymous";
  2562. this.postImage.src = postImageUrl;
  2563. this.postImage.onload = function (event_) {
  2564. _this.imgLoaded();
  2565. };
  2566. this.postImage.onerror = function (event_) {
  2567. _this.textureNonDynamic = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/404.png", _this.gameInstance.scene);
  2568. _this.mat.diffuseTexture = _this.textureNonDynamic;
  2569. _this.mat.diffuseTexture.hasAlpha = true;
  2570. _this.planeMesh.material = _this.mat;
  2571. _this.planeMesh.material.freeze();
  2572. };
  2573. }
  2574. }
  2575. else {
  2576. //this.texture.drawText(this.postModel.message, null, null, this.font, "#ffffff", "#00000000", true);
  2577. /*
  2578. this.texture.drawText(this.postModel.message, null, this.canvasScale *0.5, this.font, "#ffffff", "#00000000", true);
  2579. this.texture.drawText(this.postModel.message, null, (this.canvasScale *0.5) -4, this.font, "#000000", "#00000000", true);*/
  2580. }
  2581. this.planeMesh.visibility = 1;
  2582. this.isVirgin = false;
  2583. this.gameInstance.cleanLastMesh();
  2584. //Add text as UI?
  2585. if (this.postModel.message) {
  2586. this.texture.drawText(this.postModel.message, null, this.canvasScale * 0.5, this.font, "#7F7F7F", "#00000000", true);
  2587. this.texture.drawText(this.postModel.message, null, (this.canvasScale * 0.5) - 4, this.font, "#ffffff", "#00000000", true);
  2588. }
  2589. };
  2590. //Dealing with post img loaded
  2591. CanvasPlane.prototype.imgLoaded = function () {
  2592. var ratio;
  2593. var newWidth;
  2594. var newHeight;
  2595. var newX = 0;
  2596. var newY = 0;
  2597. if (this.postImage != null) {
  2598. if (this.postImage.height > this.postImage.width) {
  2599. ratio = (this.objType === "canvas") ? this.canvasScale / this.postImage.height : this.canvasScale / this.postImage.width;
  2600. newWidth = this.postImage.width * ratio;
  2601. newHeight = this.postImage.height * ratio;
  2602. newX = (newWidth - this.canvasScale) * (-0.5);
  2603. }
  2604. else {
  2605. ratio = (this.objType === "canvas") ? this.canvasScale / this.postImage.width : this.canvasScale / this.postImage.height;
  2606. newWidth = this.postImage.width * ratio;
  2607. newHeight = this.postImage.height * ratio;
  2608. newY = (newHeight - this.canvasScale) * (-0.5);
  2609. }
  2610. this.textureContext.drawImage(this.postImage, newX, newY, newWidth, newHeight);
  2611. }
  2612. //If graffiti
  2613. if (this.postImageGraffiti != null) {
  2614. ratio = this.canvasScale / this.postImageGraffiti.width;
  2615. console.log("ratio= " + ratio);
  2616. newWidth = this.postImageGraffiti.width * ratio;
  2617. newHeight = this.postImageGraffiti.height * ratio;
  2618. //newY = (newHeight - this.canvasScale) * (-0.5);
  2619. this.textureContext.drawImage(this.postImageGraffiti, 0, 0, newWidth, newHeight);
  2620. }
  2621. if (this.postModel.url.toLocaleLowerCase().indexOf(".gif") > 0) {
  2622. this.texture.drawText(".GIF", null, this.canvasScale * 0.5, this.font, "#000000", "#00000000", true);
  2623. this.texture.drawText(".GIF", null, (this.canvasScale * 0.5) - 4, this.font, "#ffffff", "#00000000", true);
  2624. }
  2625. else if (new _utils_urlParser__WEBPACK_IMPORTED_MODULE_4__["UrlParser"](this.postModel.url).getUrlType() === _utils_urlParser__WEBPACK_IMPORTED_MODULE_4__["UrlParser"].TYPE_YOUTUBE) {
  2626. this.texture.drawText(">VID", null, this.canvasScale * 0.5, this.font, "#000000", "#00000000", true);
  2627. this.texture.drawText(">VID", null, (this.canvasScale * 0.5) - 4, this.font, "#ffffff", "#00000000", true);
  2628. }
  2629. else if (this.postModel.message) {
  2630. this.texture.drawText(this.postModel.message, null, this.canvasScale * 0.5, this.font, "#7F7F7F", "#00000000", true);
  2631. this.texture.drawText(this.postModel.message, null, (this.canvasScale * 0.5) - 4, this.font, "#ffffff", "#00000000", true);
  2632. }
  2633. /* else if(this.postModelGraffiti && this.postModelGraffiti.message) {
  2634. this.texture.drawText(this.postModelGraffiti.message, null, this.canvasScale *0.5, this.font, "#7F7F7F", "#00000000", true);
  2635. this.texture.drawText(this.postModelGraffiti.message, null, (this.canvasScale *0.5) -4, this.font, "#ffffff", "#00000000", true);
  2636. }*/
  2637. if (this.postModel.is_canon) {
  2638. this.texture.drawText("Δ", (newX) + 8, (newY) + 80, this.font, "#000000", "#00000000", true);
  2639. //mat.emissiveColor = new BABYLON.Color3(1, 1, 1);
  2640. }
  2641. this.texture.update();
  2642. this.planeMesh.material = this.mat;
  2643. this.planeMesh.material.freeze();
  2644. };
  2645. CanvasPlane.prototype.initTextureObject = function () {
  2646. this.planeMesh.material.unfreeze();
  2647. if (this.mat == null) {
  2648. this.mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("mat", this.gameInstance.scene);
  2649. this.texture = new BABYLON.DynamicTexture("DynamicText", { width: this.canvasScale, height: this.canvasScale }, this.gameInstance.scene, false);
  2650. this.texture.hasAlpha = true;
  2651. this.textureContext = this.texture.getContext();
  2652. this.mat.diffuseTexture = this.texture;
  2653. this.planeMesh.material = this.mat;
  2654. }
  2655. };
  2656. CanvasPlane.prototype.deletePostData = function () {
  2657. //console.log("deletePostData= "+this.postModel.url+"; canvas_key: "+this.postModel.canvas_key);
  2658. this.postModel = new _models_post_model__WEBPACK_IMPORTED_MODULE_3__["PostModel"]();
  2659. this.postModel.canvas_key = this.dictKey;
  2660. this.isVirgin = true;
  2661. var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matCanvas", this.gameInstance.scene);
  2662. mat.alpha = 0;
  2663. this.planeMesh.material.unfreeze();
  2664. this.planeMesh.material = mat;
  2665. this.planeMesh.material.freeze();
  2666. };
  2667. CanvasPlane.prototype.setInterfaceVisible = function (val_) {
  2668. /*
  2669. //if(this.displayUI != null){
  2670. //this.displayUI.isVisible = val_;
  2671. if(this.postModel != null && this.postModel.message && this.uiAdvancedTexture != null){
  2672. if(val_){
  2673. //this.uiAdvancedTexture.addControl(this.displayUI);
  2674. //this.uiAdvancedTexture.addControl(this.label);
  2675. this.displayUI.isVisible = true;
  2676. } else {
  2677. //this.uiAdvancedTexture.removeControl(this.displayUI);
  2678. //this.uiAdvancedTexture.removeControl(this.label);
  2679. this.displayUI.isVisible = false;
  2680. }
  2681. }
  2682. //}
  2683. */
  2684. };
  2685. return CanvasPlane;
  2686. }());
  2687. /***/ }),
  2688. /***/ "./src/app/motor/door.ts":
  2689. /*!*******************************!*\
  2690. !*** ./src/app/motor/door.ts ***!
  2691. \*******************************/
  2692. /*! exports provided: Door */
  2693. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2694. "use strict";
  2695. __webpack_require__.r(__webpack_exports__);
  2696. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Door", function() { return Door; });
  2697. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js");
  2698. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__);
  2699. /* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts");
  2700. /* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts");
  2701. var Door = /** @class */ (function () {
  2702. function Door(dictKey, size, x, y, z, secret_) {
  2703. this.objType = "door";
  2704. this.doorOpen = false;
  2705. this.clooseDoorDelay = 600000;
  2706. this.isSecret = false;
  2707. this.sizeCanvas = size;
  2708. this.isSecret = secret_;
  2709. this.dictKey = this.objType + "_" + dictKey;
  2710. this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance();
  2711. this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance();
  2712. this.closedY = size * 0.5 + y;
  2713. this.openedY = -size * 0.5 + y;
  2714. this.doorMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox(this.dictKey, { size: this.sizeCanvas }, this.gameInstance.scene);
  2715. this.doorMesh.checkCollisions = true;
  2716. var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matBoxDoor", this.gameInstance.scene);
  2717. if (!this.isSecret) {
  2718. mat.diffuseColor = BABYLON.Color3.Green();
  2719. }
  2720. else {
  2721. var textureBox = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/concrete_text.jpg", this.gameInstance.scene);
  2722. mat.diffuseTexture = textureBox;
  2723. }
  2724. mat.freeze();
  2725. this.doorMesh.material = mat;
  2726. this.doorMesh.position.y = this.closedY + y;
  2727. this.doorMesh.position.x = x;
  2728. this.doorMesh.position.z = z;
  2729. this.mapInstance.registerNewDoor(this.dictKey, this);
  2730. }
  2731. Door.prototype.openDoor = function () {
  2732. this.doorOpen = true;
  2733. this.updateDoor();
  2734. /*
  2735. this.closeDoorInterval = setInterval(() => {
  2736. this.closeDoor();
  2737. clearInterval( this.closeDoorInterval);
  2738. }, this.clooseDoorDelay );*/
  2739. this.doorMesh.dispose();
  2740. };
  2741. Door.prototype.closeDoor = function () {
  2742. this.doorOpen = false;
  2743. this.updateDoor();
  2744. };
  2745. Door.prototype.updateDoor = function () {
  2746. console.log("open door this.doorMesh.position.y=" + this.doorMesh.position.y);
  2747. this.doorMesh.position.y = (this.doorOpen) ? this.openedY : this.closedY;
  2748. console.log("open door this.doorMesh.position.y=" + this.doorMesh.position.y);
  2749. };
  2750. return Door;
  2751. }());
  2752. /***/ }),
  2753. /***/ "./src/app/motor/game.ts":
  2754. /*!*******************************!*\
  2755. !*** ./src/app/motor/game.ts ***!
  2756. \*******************************/
  2757. /*! exports provided: Game */
  2758. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2759. "use strict";
  2760. __webpack_require__.r(__webpack_exports__);
  2761. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Game", function() { return Game; });
  2762. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js");
  2763. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__);
  2764. /* harmony import */ var babylonjs_gui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs-gui */ "./node_modules/babylonjs-gui/babylon.gui.min.js");
  2765. /* harmony import */ var babylonjs_gui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_gui__WEBPACK_IMPORTED_MODULE_1__);
  2766. /* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts");
  2767. /* harmony import */ var _playerMotor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./playerMotor */ "./src/app/motor/playerMotor.ts");
  2768. /* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  2769. /* harmony import */ var _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../models/interaction-model */ "./src/app/models/interaction-model.ts");
  2770. /* harmony import */ var _gameUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./gameUtils */ "./src/app/motor/gameUtils.ts");
  2771. /* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/helpers */ "./src/app/utils/helpers.ts");
  2772. var Game = /** @class */ (function () {
  2773. function Game(canvasElement) {
  2774. var _this = this;
  2775. this.postListRequestDelay = 10000;
  2776. //private postListRequestDelay : number = 60000;
  2777. this.mapChanging = false;
  2778. this.mapKey = "";
  2779. this.clientUrl = "";
  2780. this.mapKeyOld = "";
  2781. this.activateJoystick = false;
  2782. this.interactionDelay = 18;
  2783. this.interactionTimer = 0;
  2784. this.isError = false;
  2785. this.isPostLoaded = false;
  2786. this.isFirstLaunch = true; // test if player axist at first launch
  2787. this.playerName = "";
  2788. this.playerTalk = "";
  2789. //Set the instance
  2790. Game.instance = this;
  2791. this.canvas = document.getElementById(canvasElement);
  2792. this.engine = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Engine"](this.canvas, true, null, false);
  2793. // Listen for browser/canvas resize events
  2794. window.addEventListener("resize", function () {
  2795. _this.engine.resize();
  2796. });
  2797. }
  2798. Game.getInstance = function () {
  2799. return Game.instance;
  2800. };
  2801. Game.prototype.setUIService = function (service_) {
  2802. var _this = this;
  2803. this.gameUIServiceService = service_;
  2804. this.gameUIServiceService.postArtCanvasEmitter.subscribe(function (post_) {
  2805. _this.postArtCanvas(post_);
  2806. });
  2807. this.gameUIServiceService.forceWSEmitter.subscribe(function () {
  2808. _this.getPostList();
  2809. });
  2810. this.gameUIServiceService.deletePostEmitter.subscribe(function (post_) {
  2811. console.log("deletePostEmitter:" + post_);
  2812. _this.deletePost(post_);
  2813. });
  2814. };
  2815. Game.prototype.setOfflineService = function (service_) {
  2816. this.offlineService = service_;
  2817. };
  2818. Game.prototype.setWebService = function (service_) {
  2819. this.chanWebService = service_;
  2820. };
  2821. Game.prototype.setRouter = function (router_) {
  2822. this.router = router_;
  2823. };
  2824. Game.prototype.setMapKey = function (mapKey_) {
  2825. this.mapKey = mapKey_;
  2826. };
  2827. Game.prototype.setClientUrl = function (clientUrl_) {
  2828. this.clientUrl = clientUrl_;
  2829. };
  2830. Game.prototype.initGame = function () {
  2831. var _this = this;
  2832. console.log("initGame() ");
  2833. //we get the player profile
  2834. var playerMod = this.offlineService.getPlayerData();
  2835. this.playerModel = playerMod;
  2836. this.chanWebService.createUser(playerMod.id, playerMod.player_key, "", this.mapKey).subscribe(
  2837. //Data success
  2838. function (data) {
  2839. _this.gameResponse = data;
  2840. if (_this.gameResponse.ok) {
  2841. _this.playerModel = _this.gameResponse.result.player;
  2842. _this.offlineService.saveChan(_this.playerModel.map_key);
  2843. _this.setMapKey(_this.playerModel.map_key);
  2844. _this.offlineService.savePlayer(_this.playerModel);
  2845. //Launch the game
  2846. _this.createScene();
  2847. _this.run();
  2848. //Get the playerData
  2849. if (_this.postListRequestInterval == null) {
  2850. _this.postListRequestInterval = setInterval(function () {
  2851. _this.getPostList();
  2852. }, _this.postListRequestDelay);
  2853. }
  2854. _this.getPostList();
  2855. }
  2856. else {
  2857. alert("Profile not found!");
  2858. }
  2859. });
  2860. };
  2861. Game.prototype.createScene = function () {
  2862. console.log("createScene()");
  2863. if (this.scene != null)
  2864. this.scene.dispose();
  2865. // We need a scene to create all our geometry and babylonjs items in
  2866. this.scene = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Scene"](this.engine);
  2867. this.playerMotor = _playerMotor__WEBPACK_IMPORTED_MODULE_3__["PlayerMotor"].getInstance();
  2868. this.playerMotor.initMotor();
  2869. if (this.activateJoystick)
  2870. this.playerMotor.activeJoystick();
  2871. if (!this.mapMaker) {
  2872. this.mapMaker = new _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"]();
  2873. }
  2874. this.mapMaker.loadMapData(this.gameResponse.result.map[0]);
  2875. this.initAtmosphere();
  2876. this.initOptimisation();
  2877. };
  2878. /************************
  2879. * SCENE VISUAL STUFF
  2880. * ligth / optimization / ground / skybox
  2881. * and other shit
  2882. ***********************/
  2883. Game.prototype.initAtmosphere = function () {
  2884. //Scene atmoshpere
  2885. this.scene.clearColor = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Color4"](226 / 255, 244 / 255, 1);
  2886. this.scene.ambientColor = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Color3"](0.3, 0.3, 0.3);
  2887. this.scene.autoClear = false; // Color buffer
  2888. this.scene.autoClearDepthAndStencil = false;
  2889. // Hemispheric light to enlight the scene
  2890. this.hLight = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["HemisphericLight"]("hemi", new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Vector3"](0, 0.5, 0), this.scene);
  2891. this.hLight.intensity = 0.85;
  2892. this.pLight = new BABYLON.PointLight("pointLight", new BABYLON.Vector3(1, 450, 1), this.scene);
  2893. this.pLight.intensity = 1.5;
  2894. //texture
  2895. this.ground = babylonjs__WEBPACK_IMPORTED_MODULE_0__["Mesh"].CreateGround("ground", 1000, 1000, 2, this.scene);
  2896. this.ground.checkCollisions = true;
  2897. this.ground.position.y = -0.1;
  2898. var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matVolcano", this.scene);
  2899. var texture = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/volcanic_text.jpg", this.scene);
  2900. mat.diffuseTexture = texture;
  2901. this.ground.material = mat;
  2902. //Set UIManager
  2903. this.uiAdvancedTexture = babylonjs_gui__WEBPACK_IMPORTED_MODULE_1__["AdvancedDynamicTexture"].CreateFullscreenUI("UI");
  2904. var skybox = BABYLON.MeshBuilder.CreateBox("skyBox", { size: 1000.0 }, this.scene);
  2905. var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", this.scene);
  2906. skyboxMaterial.backFaceCulling = false;
  2907. skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("./assets/textures/skybox", this.scene);
  2908. skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
  2909. skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
  2910. skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
  2911. skybox.material = skyboxMaterial;
  2912. };
  2913. Game.prototype.setShadow = function (mesh_) {
  2914. /*
  2915. if(this.shadowGenerator == null){
  2916. this.shadowGenerator = new BABYLON.ShadowGenerator(256, this.pLight);
  2917. //this.shadowGenerator.useBlurExponentialShadowMap = true;
  2918. this.shadowGenerator.filteringQuality = BABYLON.ShadowGenerator.QUALITY_LOW;
  2919. }
  2920. this.shadowGenerator.getShadowMap().renderList.push(mesh_);
  2921. mesh_.receiveShadows = true;*/
  2922. };
  2923. Game.prototype.initOptimisation = function () {
  2924. //Optimization
  2925. this.scene.blockMaterialDirtyMechanism = true;
  2926. /*
  2927. BABYLON.SceneOptimizer.OptimizeAsync(this.scene, BABYLON.SceneOptimizerOptions.LowDegradationAllowed(),
  2928. ()=> {
  2929. // On success
  2930. }, ()=> {
  2931. // FPS target not reached
  2932. });*/
  2933. };
  2934. //Render process
  2935. Game.prototype.run = function () {
  2936. var _this = this;
  2937. this.engine.runRenderLoop(function () {
  2938. if (_this.scene != null) {
  2939. _this.scene.render();
  2940. _this.renderInteraction();
  2941. }
  2942. });
  2943. };
  2944. Game.prototype.cleanLastMesh = function () {
  2945. this.nameLastMesh = "";
  2946. if (this.lastCanvas != null)
  2947. this.lastCanvas.setInterfaceVisible(false);
  2948. };
  2949. Game.prototype.renderInteraction = function () {
  2950. if (this.interactionTimer <= 0) {
  2951. var width = this.scene.getEngine().getRenderWidth();
  2952. var height = this.scene.getEngine().getRenderHeight();
  2953. var pickInfo = this.scene.pick(width / 2, height / 2, null, false, this.camera);
  2954. //Get info on the pointed object
  2955. if (pickInfo.hit && this.nameLastMesh !== pickInfo.pickedMesh.name) {
  2956. var newInter = new _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"]();
  2957. newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_NONE;
  2958. this.meshToClimb = null;
  2959. this.doorToOpen = null;
  2960. this.mapMaker.cleanLines();
  2961. this.nameLastMesh = pickInfo.pickedMesh.name;
  2962. newInter.description = pickInfo.pickedMesh.name;
  2963. if (pickInfo.pickedMesh.name !== undefined) {
  2964. if (pickInfo.pickedMesh.name.indexOf("canvas") >= 0) {
  2965. var canvas = this.mapMaker.getCanvasByKey(pickInfo.pickedMesh.name);
  2966. if (canvas != null) {
  2967. if (canvas.isVirgin) {
  2968. newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_CANVAS_VIRGIN;
  2969. /*
  2970. } else if(canvas.postModelGraffiti == null){
  2971. newInter.type = InteractionModel.TYPE_CANVAS_TO_GRAFF;
  2972. this.mapMaker.drawlines(canvas.dictKey);*/
  2973. }
  2974. else {
  2975. newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_CANVAS_FULL;
  2976. this.mapMaker.drawlines(canvas.dictKey);
  2977. this.mapMaker.displayUI(canvas.dictKey);
  2978. }
  2979. //newInter.type = (canvas.isVirgin)? InteractionModel.TYPE_CANVAS_VIRGIN : InteractionModel.TYPE_CANVAS_FULL;
  2980. newInter.value = canvas.postModel;
  2981. this.cleanLastMesh();
  2982. canvas.setInterfaceVisible(true);
  2983. this.lastCanvas = canvas;
  2984. }
  2985. }
  2986. else if (pickInfo.pickedMesh.name.toLowerCase().indexOf("ladder") >= 0) {
  2987. newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_CLIMB_LADDER;
  2988. this.meshToClimb = pickInfo.pickedMesh;
  2989. /*
  2990. } else if(pickInfo.pickedMesh.name.toLowerCase().indexOf("advertisement") >= 0){
  2991. let canvas = this.mapMaker.getAdByKey(pickInfo.pickedMesh.name);
  2992. if(canvas != null){
  2993. newInter.type = InteractionModel.TYPE_AD;
  2994. newInter.value = canvas.postModel;
  2995. this.cleanLastMesh();
  2996. canvas.setInterfaceVisible(true);
  2997. this.lastCanvas = canvas;
  2998. }*/
  2999. }
  3000. else if (pickInfo.pickedMesh.name.toLowerCase().indexOf("door") >= 0) {
  3001. //console.log("pick gate"+pickInfo.pickedMesh.name);
  3002. var door = this.mapMaker.getDoorByKey(pickInfo.pickedMesh.name);
  3003. newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_OPEN_DOOR;
  3004. this.doorToOpen = door;
  3005. }
  3006. else if (pickInfo.pickedMesh.name.toLowerCase().indexOf("item") >= 0) {
  3007. //console.log(pickInfo.pickedMesh.name);
  3008. var item = this.mapMaker.getItemByKey(pickInfo.pickedMesh.name);
  3009. if (item != null && item.itemModel != null) {
  3010. newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_GET_ITEM;
  3011. newInter.value = item.itemModel;
  3012. this.itemToGet = item;
  3013. }
  3014. }
  3015. else if (pickInfo.pickedMesh.name.toLowerCase().indexOf("gate") >= 0) {
  3016. var gate = this.mapMaker.getGateByKey(pickInfo.pickedMesh.name);
  3017. newInter.type = _models_interaction_model__WEBPACK_IMPORTED_MODULE_5__["InteractionModel"].TYPE_PASS_GATE;
  3018. newInter.value = gate.gateKey;
  3019. this.gateTopass = gate;
  3020. }
  3021. /*else if(pickInfo.pickedMesh.name.toLowerCase().indexOf("panel") >= 0){
  3022. newInter.type = InteractionModel.TYPE_PANEL;
  3023. newInter.value = "http://snuffchan.com/blog/donations/";
  3024. //this.panel = gate;
  3025. }*/
  3026. }
  3027. this.nameLastMesh = pickInfo.pickedMesh.name;
  3028. this.gameUIServiceService.sendInteraction(newInter);
  3029. }
  3030. this.interactionTimer = this.interactionDelay;
  3031. }
  3032. else {
  3033. this.interactionTimer--;
  3034. }
  3035. };
  3036. //Climb obj
  3037. Game.prototype.climbObject = function () {
  3038. this.camera.position.x = this.meshToClimb.position.x;
  3039. this.camera.position.z = this.meshToClimb.position.z;
  3040. this.camera.position.y = this.meshToClimb.position.y + _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].TILE_SIZE;
  3041. };
  3042. //Climb obj
  3043. Game.prototype.openDoor = function () {
  3044. //console.log(this.doorToOpen);
  3045. //console.log(this.nameLastMesh );
  3046. this.nameLastMesh = "";
  3047. this.doorToOpen.openDoor();
  3048. };
  3049. //Post
  3050. Game.prototype.postArtCanvas = function (canvas_) {
  3051. console.log(canvas_);
  3052. this.mapMaker.setPictureOnCanvas(canvas_);
  3053. };
  3054. Game.prototype.switchKeyMapping = function () {
  3055. _gameUtils__WEBPACK_IMPORTED_MODULE_6__["GameUtils"].switchKeyMapping(this);
  3056. };
  3057. Game.prototype.activeJoystick = function () {
  3058. this.activateJoystick = true;
  3059. if (this.playerMotor != null)
  3060. this.playerMotor.activeJoystick();
  3061. };
  3062. Game.prototype.getPostList = function () {
  3063. var _this = this;
  3064. if (!this.mapChanging) {
  3065. var playerTempModel = this.playerMotor.getPlayerPos();
  3066. this.chanWebService.getMapPostList(playerTempModel.position_x, playerTempModel.position_y, this.playerModel.name, this.playerTalk).subscribe(
  3067. //Data success
  3068. function (data) {
  3069. var gameResponse = data;
  3070. if (gameResponse.ok) {
  3071. if (_utils_helpers__WEBPACK_IMPORTED_MODULE_7__["Helpers"].isPT()) {
  3072. var postsLeft = gameResponse.result.postsLeft - 18;
  3073. if (postsLeft < 0)
  3074. postsLeft = 0;
  3075. gameResponse.result.postsLeft = postsLeft;
  3076. }
  3077. _this.updateGameData(gameResponse.result);
  3078. _this.mapMaker.updateNonStaticData(gameResponse.result);
  3079. _this.isFirstLaunch = false;
  3080. }
  3081. else {
  3082. _this.isError = true;
  3083. _this.errorMessage = "Unknown error.";
  3084. }
  3085. }, function (error) {
  3086. //console.log(JSON.stringify(error));
  3087. _this.isError = true;
  3088. if (_this.isFirstLaunch) {
  3089. _this.gameUIServiceService.changeState(_services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_4__["GameUIServiceService"].STATE_NO_PLAYER);
  3090. }
  3091. _this.errorMessage = JSON.stringify(error);
  3092. });
  3093. }
  3094. };
  3095. Game.prototype.updateGameData = function (gameDataModel_) {
  3096. console.log("updateGameData()");
  3097. this.gameDataModel = gameDataModel_;
  3098. this.mapMaker.updateNonStaticData(this.gameDataModel);
  3099. this.gameUIServiceService.updateGameData(this.gameDataModel);
  3100. //Update the player
  3101. this.playerModel = this.gameDataModel.player;
  3102. /*
  3103. if(this.playerModel.map_key != this.mapKey){
  3104. this.generateMap(this.playerModel.map_key);
  3105. this.mapMaker.loadMapData(this.gameDataModel.map[0]);
  3106. this.mapKey = this.playerModel.map_key;
  3107. }*/
  3108. this.items = this.gameDataModel.itemsPlayer;
  3109. this.offlineService.savePlayer(this.playerModel);
  3110. this.isPostLoaded = true;
  3111. this.isError = false;
  3112. };
  3113. Game.prototype.passGet = function (getName_) {
  3114. var _this = this;
  3115. //this.playerMotor.savePlayerRotation();
  3116. this.mapChanging = true;
  3117. this.chanWebService.changeMapRandom((getName_ === "secret")).subscribe(function (data_) {
  3118. if (data_.ok) {
  3119. //this.createScene();
  3120. _this.scene.dispose();
  3121. _this.mapMaker = null;
  3122. delete _this.mapMaker;
  3123. _this.offlineService.saveChan(data_.result.player.map_key);
  3124. //this.router.navigateByUrl('/ch/'+data_.result.player.map_key);
  3125. window.location.href = _this.clientUrl + '/ch/' + data_.result.player.map_key;
  3126. //console.log("change to :"+data_.result.player.map_key);
  3127. //this.updateGameData(data_.result);
  3128. }
  3129. });
  3130. };
  3131. Game.prototype.getItem = function (key_) {
  3132. var _this = this;
  3133. this.chanWebService.getItem(key_).subscribe(function (data_) {
  3134. if (data_.ok) {
  3135. _this.updateGameData(data_.result);
  3136. }
  3137. });
  3138. };
  3139. Game.prototype.deletePost = function (post_) {
  3140. var canvas = this.mapMaker.getCanvasByKey(post_.canvas_key);
  3141. if (canvas != null) {
  3142. console.log("Post found and deleted= " + post_);
  3143. canvas.deletePostData();
  3144. }
  3145. };
  3146. Game.prototype.changeName = function (name_) {
  3147. this.playerName = name_;
  3148. };
  3149. Game.prototype.changeTalk = function (talk_) {
  3150. this.playerTalk = talk_;
  3151. };
  3152. return Game;
  3153. }());
  3154. /***/ }),
  3155. /***/ "./src/app/motor/gameUtils.ts":
  3156. /*!************************************!*\
  3157. !*** ./src/app/motor/gameUtils.ts ***!
  3158. \************************************/
  3159. /*! exports provided: GameUtils */
  3160. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3161. "use strict";
  3162. __webpack_require__.r(__webpack_exports__);
  3163. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GameUtils", function() { return GameUtils; });
  3164. var GameUtils = /** @class */ (function () {
  3165. function GameUtils() {
  3166. }
  3167. //Doc for https://en.wikipedia.org/wiki/QWERTY
  3168. //Key code list https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
  3169. GameUtils.setKeyBoardMapping = function (gameInstance_) {
  3170. var conf_ = gameInstance_.offlineService.getConfig();
  3171. if (conf_.key_mapping == null) {
  3172. var language = navigator.language;
  3173. GameUtils.setKeyMappingFromLang(gameInstance_, language);
  3174. }
  3175. else {
  3176. GameUtils.setKeyForMapping(gameInstance_, conf_.key_mapping);
  3177. }
  3178. };
  3179. GameUtils.setKeyMappingFromLang = function (gameInstance_, lang_) {
  3180. if (lang_.toLowerCase().indexOf("fr") >= 0) {
  3181. GameUtils.setKeyForMapping(gameInstance_, "ZSQD");
  3182. }
  3183. else {
  3184. GameUtils.setKeyForMapping(gameInstance_, "WSAD");
  3185. }
  3186. };
  3187. GameUtils.setKeyForMapping = function (gameInstance_, mapping_) {
  3188. console.log("setKeyMapping() lang_= " + mapping_);
  3189. var config = gameInstance_.offlineService.getConfig();
  3190. if (mapping_ === "ZSQD") {
  3191. //If Azerty
  3192. gameInstance_.camera.keysUp = [90]; // Z
  3193. gameInstance_.camera.keysDown = [83]; // S
  3194. gameInstance_.camera.keysLeft = [81]; // Q
  3195. gameInstance_.camera.keysRight = [68]; // D
  3196. }
  3197. else {
  3198. //If Qwerty
  3199. gameInstance_.camera.keysUp = [87]; // w
  3200. gameInstance_.camera.keysDown = [83]; // S
  3201. gameInstance_.camera.keysLeft = [65]; // A
  3202. gameInstance_.camera.keysRight = [68]; // D
  3203. }
  3204. config.key_mapping = mapping_;
  3205. gameInstance_.offlineService.saveConfig(config);
  3206. gameInstance_.gameUIServiceService.updateConfigData(config);
  3207. //gameInstance_.offlineService.saveKeyboard(lang_.toLowerCase());
  3208. };
  3209. GameUtils.switchKeyMapping = function (gameInstance_) {
  3210. var conf_ = gameInstance_.offlineService.getConfig();
  3211. if (conf_.key_mapping == null) {
  3212. var language = navigator.language;
  3213. GameUtils.setKeyMappingFromLang(gameInstance_, language);
  3214. }
  3215. else {
  3216. if (conf_.key_mapping === "ZSQD")
  3217. GameUtils.setKeyForMapping(gameInstance_, "WSAD");
  3218. if (conf_.key_mapping === "WSAD")
  3219. GameUtils.setKeyForMapping(gameInstance_, "ZSQD");
  3220. }
  3221. };
  3222. return GameUtils;
  3223. }());
  3224. /***/ }),
  3225. /***/ "./src/app/motor/gate.ts":
  3226. /*!*******************************!*\
  3227. !*** ./src/app/motor/gate.ts ***!
  3228. \*******************************/
  3229. /*! exports provided: Gate */
  3230. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3231. "use strict";
  3232. __webpack_require__.r(__webpack_exports__);
  3233. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Gate", function() { return Gate; });
  3234. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js");
  3235. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__);
  3236. /* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts");
  3237. /* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts");
  3238. var Gate = /** @class */ (function () {
  3239. function Gate(dictKey, size, x, y, z, key_) {
  3240. this.objType = "gate";
  3241. this.dictKey = this.objType + "_" + dictKey;
  3242. this.gateKey = key_;
  3243. this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance();
  3244. this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance();
  3245. this.doorMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox(this.dictKey, { size: size }, this.gameInstance.scene);
  3246. this.doorMesh.checkCollisions = true;
  3247. var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matGateDoor", this.gameInstance.scene);
  3248. mat.diffuseColor = BABYLON.Color3.Red();
  3249. mat.freeze();
  3250. this.doorMesh.material = mat;
  3251. this.doorMesh.position.y = y;
  3252. this.doorMesh.position.x = x;
  3253. this.doorMesh.position.z = z;
  3254. this.mapInstance.registerNewGate(this.dictKey, this);
  3255. }
  3256. return Gate;
  3257. }());
  3258. /***/ }),
  3259. /***/ "./src/app/motor/item.ts":
  3260. /*!*******************************!*\
  3261. !*** ./src/app/motor/item.ts ***!
  3262. \*******************************/
  3263. /*! exports provided: Item */
  3264. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3265. "use strict";
  3266. __webpack_require__.r(__webpack_exports__);
  3267. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Item", function() { return Item; });
  3268. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js");
  3269. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__);
  3270. /* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts");
  3271. /* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts");
  3272. var Item = /** @class */ (function () {
  3273. function Item(type_, itemModel_, size_, x, y) {
  3274. this.objType = "item";
  3275. this.itemModel = itemModel_;
  3276. this.objType = type_;
  3277. this.dictKey = this.objType + "_" + this.itemModel.name + "_" + itemModel_.key;
  3278. this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance();
  3279. this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance();
  3280. this.itemMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox(this.dictKey, { height: size_ * 3, width: size_, depth: size_ }, this.gameInstance.scene);
  3281. this.itemMesh.checkCollisions = false;
  3282. this.itemMesh.visibility = 0;
  3283. this.itemMesh.position.y = (size_) * 0.5;
  3284. this.itemMesh.position.x = x;
  3285. this.itemMesh.position.z = y;
  3286. this.itemMesh.visibility = 0;
  3287. /*let mat = new StandardMaterial("matBoxItem", this.gameInstance.scene);
  3288. mat.diffuseColor = BABYLON.Color3.Random();
  3289. mat.freeze();
  3290. this.itemMesh.material = mat;*/
  3291. //if(this.objType.toLowerCase().indexOf('gate') >= 0 ) this.itemMesh.visibility = 0.2;
  3292. //sprite
  3293. this.spriteManagerPlayer = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["SpriteManager"]("itemManager", "./assets/textures/cardboard_text.png", 1, { width: 288, height: 288 }, this.gameInstance.scene);
  3294. this.sprite = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Sprite"]("item" + itemModel_.id, this.spriteManagerPlayer);
  3295. this.sprite.width = 6;
  3296. this.sprite.height = 6;
  3297. this.sprite.position.x = x;
  3298. this.sprite.position.z = y;
  3299. this.sprite.position.y = 3;
  3300. this.mapInstance.registerNewItem(this.dictKey, this);
  3301. }
  3302. Item.prototype.clean = function () {
  3303. this.spriteManagerPlayer.dispose();
  3304. if (this.itemMesh != null)
  3305. this.itemMesh.dispose();
  3306. this.sprite.dispose();
  3307. this.spriteManagerPlayer = null;
  3308. this.itemMesh = null;
  3309. this.sprite = null;
  3310. };
  3311. return Item;
  3312. }());
  3313. /***/ }),
  3314. /***/ "./src/app/motor/mapMaker.ts":
  3315. /*!***********************************!*\
  3316. !*** ./src/app/motor/mapMaker.ts ***!
  3317. \***********************************/
  3318. /*! exports provided: MapMaker */
  3319. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3320. "use strict";
  3321. __webpack_require__.r(__webpack_exports__);
  3322. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MapMaker", function() { return MapMaker; });
  3323. /* harmony import */ var _tile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tile */ "./src/app/motor/tile.ts");
  3324. /* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts");
  3325. /* harmony import */ var _item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./item */ "./src/app/motor/item.ts");
  3326. /* harmony import */ var _playerMotor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./playerMotor */ "./src/app/motor/playerMotor.ts");
  3327. /* harmony import */ var _models_player_model__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../models/player.model */ "./src/app/models/player.model.ts");
  3328. /* harmony import */ var _playerMesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./playerMesh */ "./src/app/motor/playerMesh.ts");
  3329. var MapMaker = /** @class */ (function () {
  3330. function MapMaker() {
  3331. this.items = [];
  3332. this.anonList = [];
  3333. this.itemMesh = [];
  3334. this.TileGroundMeshes = [];
  3335. this.TileWallMeshes = [];
  3336. this.DIR_N = 0;
  3337. this.DIR_E = 1;
  3338. this.DIR_S = 2;
  3339. this.DIR_W = 3;
  3340. //Canvas PLane dictionnary
  3341. this.canvasDict = {};
  3342. this.advertisementDict = {};
  3343. this.doorDict = {};
  3344. this.gateDict = {};
  3345. this.itemDict = {};
  3346. this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance();
  3347. MapMaker._instance = this;
  3348. }
  3349. Object.defineProperty(MapMaker, "TILE_SIZE", {
  3350. get: function () { return 10; },
  3351. enumerable: true,
  3352. configurable: true
  3353. });
  3354. MapMaker.getInstance = function () {
  3355. return this._instance;
  3356. };
  3357. MapMaker.prototype.loadMapData = function (map_) {
  3358. _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].meshGrassInstance = null;
  3359. _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].meshGroundInstance = null;
  3360. _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].meshWallInstance = null;
  3361. this.mapModel = map_;
  3362. this.buildMap();
  3363. };
  3364. MapMaker.prototype.cleanMap = function () {
  3365. this.TileGroundMeshes = [];
  3366. this.TileWallMeshes = [];
  3367. this.canvasDict = {};
  3368. this.advertisementDict = {};
  3369. this.doorDict = {};
  3370. this.gateDict = {};
  3371. this.itemDict = {};
  3372. };
  3373. MapMaker.prototype.buildMap = function () {
  3374. this.cleanMap();
  3375. //console.log("buildMap="+ this.mapModel );
  3376. this.mapData = this.getMapData();
  3377. var x = 0;
  3378. var y = 0;
  3379. var l = 0; //layer
  3380. var playerPos = { x: -1, y: -1 };
  3381. //Generate a layer
  3382. for (var n = 0; n < this.mapData.length; n++) {
  3383. //console.log(this.mapData[n]);
  3384. if (parseInt(this.mapData[n]) != _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GATES && parseInt(this.mapData[n]) != _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GATES_SECRET) {
  3385. new _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"](this.mapData[n], MapMaker.TILE_SIZE, x, l, y, null);
  3386. if (parseInt(this.mapData[n]) === _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_START) {
  3387. playerPos.x = x;
  3388. playerPos.y = y;
  3389. }
  3390. }
  3391. else if (parseInt(this.mapData[n]) == _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GATES) {
  3392. console.log("x: " + x + "; y:" + y + "; width:" + this.mapModel.width + "; heihgt: " + this.mapModel.height);
  3393. /*
  3394. let key = "";
  3395. if(y == 0){
  3396. key = this.mapModel.door_key_n;
  3397. } else if(x == this.mapModel.width-1){
  3398. key = this.mapModel.door_key_e;
  3399. } else if(y == this.mapModel.height-1){
  3400. key = this.mapModel.door_key_s;
  3401. } else if(x == 0){
  3402. key = this.mapModel.door_key_w;
  3403. }*/
  3404. //console.log("GATE x: "+x+"; y:"+y+"; width:"+this.mapModel.width+"; heihgt: "+ this.mapModel.height+" key:"+key);
  3405. //Managing gates
  3406. new _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"](this.mapData[n], MapMaker.TILE_SIZE, x, l, y, "???");
  3407. }
  3408. else if (parseInt(this.mapData[n]) == _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GATES_SECRET) {
  3409. //Managing gates
  3410. new _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"](this.mapData[n], MapMaker.TILE_SIZE, x, l, y, "secret");
  3411. }
  3412. //console.log("new tile-> type:"+this.tileDict[n]+" x:"+x+"y:"+y);
  3413. x += 1;
  3414. if (x >= this.mapModel.width) {
  3415. x = 0;
  3416. y += 1;
  3417. }
  3418. }
  3419. var player = new _models_player_model__WEBPACK_IMPORTED_MODULE_4__["PlayerModel"]();
  3420. if (this.gameData != null)
  3421. player = this.gameData.player;
  3422. player.position_x = playerPos.x;
  3423. player.position_y = playerPos.y;
  3424. _playerMotor__WEBPACK_IMPORTED_MODULE_3__["PlayerMotor"].getInstance().setPlayerPos(player);
  3425. if (this.gameData != null)
  3426. this.updateNonStaticData(this.gameData);
  3427. };
  3428. /********************
  3429. * UPDATE NON STATIC DATA
  3430. * players, items and others
  3431. ********************/
  3432. MapMaker.prototype.updateNonStaticData = function (gameData_) {
  3433. this.itemDict = {};
  3434. this.gameData = gameData_;
  3435. //Post
  3436. //Update teh posts DATA
  3437. if (this.gameData.posts != undefined) {
  3438. this.posts = this.gameData.posts;
  3439. for (var _i = 0, _a = this.gameData.posts; _i < _a.length; _i++) {
  3440. var post = _a[_i];
  3441. if (post !== null && post.canvas_key !== null) {
  3442. var canvas = this.getCanvasByKey(post.canvas_key);
  3443. if (canvas != null && canvas.isVirgin) {
  3444. //if(post.graffiti && canvas.postModelGraffiti == null){
  3445. canvas.setPostData(post);
  3446. /*
  3447. } else if(!post.graffiti && canvas.postModel.id == null){
  3448. canvas.setPostData(post);
  3449. }*/
  3450. }
  3451. }
  3452. }
  3453. }
  3454. //items
  3455. this.itemMesh.forEach(function (item_) {
  3456. if (item_ != null && item_ != undefined) {
  3457. item_.clean();
  3458. item_ = null;
  3459. }
  3460. });
  3461. this.itemMesh = [];
  3462. this.items = this.gameData.itemsMap;
  3463. for (var i = 0; i < this.items.length; i++) {
  3464. var itemModel = this.items[i];
  3465. var itemMesh = new _item__WEBPACK_IMPORTED_MODULE_2__["Item"]("item", itemModel, MapMaker.TILE_SIZE * 0.2, itemModel.x * MapMaker.TILE_SIZE, itemModel.y * MapMaker.TILE_SIZE);
  3466. this.itemMesh.push(itemMesh);
  3467. }
  3468. //PLayers
  3469. /*
  3470. this.anonList.forEach((playerMesh: PlayerMesh) =>{
  3471. playerMesh.clean();
  3472. playerMesh = null;
  3473. });
  3474. let anonListNew = [];
  3475. let anonListOld = this.anonList;
  3476. let characters = this.gameData.players;
  3477. for(let c = 0; c < characters.length; c++){
  3478. let chara: PlayerModel = characters[c];
  3479. let anon: PlayerMesh = null;
  3480. //Is this anon exist?
  3481. for(let a= 0; a <anonListOld.length; a ++){
  3482. if(anonListOld[a].playerModel.id === chara.id){
  3483. //if yes we move it
  3484. anon = anonListOld[a];
  3485. anon.updatePlayerModel(chara);
  3486. //+ clean the array
  3487. anonListOld.splice(a,1);
  3488. break;
  3489. }
  3490. }
  3491. //If no we create if
  3492. if(anon === null){
  3493. anon = new PlayerMesh("player",chara, MapMaker.TILE_SIZE);
  3494. }
  3495. anonListNew.push(anon);
  3496. }
  3497. //after this we clean all the all anons.
  3498. anonListOld.forEach((playerMesh: PlayerMesh) =>{
  3499. //playerMesh.dispose();
  3500. playerMesh.clean();
  3501. playerMesh = null;
  3502. });
  3503. this.anonList = anonListNew;*/
  3504. this.anonList.forEach(function (playerMesh) {
  3505. //playerMesh.dispose();
  3506. playerMesh.clean();
  3507. playerMesh = null;
  3508. });
  3509. this.anonList = [];
  3510. var characters = this.gameData.players;
  3511. for (var c = 0; c < characters.length; c++) {
  3512. var chara = characters[c];
  3513. var anon = new _playerMesh__WEBPACK_IMPORTED_MODULE_5__["PlayerMesh"]("player", chara, MapMaker.TILE_SIZE);
  3514. this.anonList.push(anon);
  3515. }
  3516. };
  3517. MapMaker.prototype.drawlines = function (key_) {
  3518. var currentPost = this.canvasDict[key_].postModel;
  3519. if (this.linesReplyFrom != null)
  3520. this.linesReplyFrom.dispose();
  3521. if (this.linesReplyTo != null)
  3522. this.linesReplyTo.dispose();
  3523. //https://doc.babylonjs.com/babylon101/parametric_shapes
  3524. var pointsTo = [];
  3525. var pointsFrom = [];
  3526. pointsTo.push(this.canvasDict[key_].planeMesh.position);
  3527. pointsFrom.push(this.canvasDict[key_].planeMesh.position);
  3528. for (var keyDict in this.canvasDict) {
  3529. var canvas = this.canvasDict[keyDict];
  3530. if (!canvas.isVirgin) {
  3531. var found = false;
  3532. if (canvas.postModel.id === currentPost.reply) {
  3533. pointsTo.push(canvas.planeMesh.position);
  3534. found = true;
  3535. }
  3536. else if (canvas.postModel.reply === currentPost.id) {
  3537. pointsFrom.push(canvas.planeMesh.position);
  3538. found = true;
  3539. }
  3540. if (found) {
  3541. for (var keyDict2 in this.canvasDict) {
  3542. var canvas2 = this.canvasDict[keyDict2];
  3543. if (!canvas2.isVirgin) {
  3544. if (canvas2.postModel.id === canvas.postModel.reply) {
  3545. pointsTo.push(canvas2.planeMesh.position);
  3546. }
  3547. else if (canvas2.postModel.reply === canvas.postModel.id) {
  3548. pointsFrom.push(canvas2.planeMesh.position);
  3549. }
  3550. }
  3551. }
  3552. }
  3553. }
  3554. }
  3555. this.linesReplyTo = BABYLON.MeshBuilder.CreateLines("lines", { points: pointsTo }, this.gameInstance.scene);
  3556. this.linesReplyFrom = BABYLON.MeshBuilder.CreateLines("lines", { points: pointsFrom }, this.gameInstance.scene);
  3557. /*
  3558. this.linesReplyTo.Color4 = BABYLON.Color3.Blue;
  3559. this.linesReplyFrom.Color4 = BABYLON.Color3.Green;
  3560. */
  3561. };
  3562. MapMaker.prototype.cleanLines = function () {
  3563. if (this.linesReplyFrom != null)
  3564. this.linesReplyFrom.dispose();
  3565. if (this.linesReplyTo != null)
  3566. this.linesReplyTo.dispose();
  3567. };
  3568. MapMaker.prototype.displayUI = function (key_) {
  3569. /*
  3570. //To hard for memory
  3571. let canvas: CanvasPlane = this.canvasDict[key_];
  3572. if( this.cubeUI == null){
  3573. this.cubeUI = MeshBuilder.CreateBox("meshUI", {size: MapMaker.TILE_SIZE *0.5}, this.gameInstance.scene);
  3574. //this.cubeUI.visibility = 0;
  3575. }
  3576. this.cubeUI.position.y = MapMaker.TILE_SIZE *0.5;
  3577. this.cubeUI.position.x = canvas.planeMesh.position.x * MapMaker.TILE_SIZE;
  3578. this.cubeUI.position.z = canvas.planeMesh.position.z * MapMaker.TILE_SIZE;
  3579. if(this.uiAdvancedTexture == null){
  3580. this.uiAdvancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
  3581. this.rectUI = new BABYLON.GUI.Rectangle();
  3582. this.rectUI.fontFamily = "Courier New, Courier, monospace";
  3583. this.rectUI.cornerRadius = 10;
  3584. this.rectUI.color = "Grey";
  3585. this.rectUI.background = "#161616";
  3586. this.uiAdvancedTexture.addControl(this.rectUI);
  3587. this.label = new BABYLON.GUI.TextBlock();
  3588. this.rectUI.addControl(this.label);
  3589. this.rectUI.linkWithMesh(this.cubeUI);
  3590. this.rectUI.linkOffsetY = 0;
  3591. this.rectUI.linkOffsetX = 0;
  3592. this.rectUI.width = 0.2;
  3593. this.rectUI.height = 0.3;
  3594. }
  3595. this.label.text = canvas.postModel.message;
  3596. */
  3597. };
  3598. MapMaker.prototype.clearUI = function () {
  3599. };
  3600. /********************
  3601. * UTILS
  3602. ********************/
  3603. //Get potential Canvas orientation
  3604. MapMaker.prototype.getCanvasOrientation = function (x, z) {
  3605. var potentialDir = [];
  3606. if (this.getTileAt(x, z - 1) === '0')
  3607. potentialDir.push(this.DIR_N);
  3608. if (this.getTileAt(x + 1, z) === '0')
  3609. potentialDir.push(this.DIR_E);
  3610. if (this.getTileAt(x, z + 1) === '0')
  3611. potentialDir.push(this.DIR_S);
  3612. if (this.getTileAt(x - 1, z) === '0')
  3613. potentialDir.push(this.DIR_W);
  3614. if (potentialDir.length === 0) {
  3615. //console.log("NO ORIENTATION FOUND");
  3616. return -1;
  3617. }
  3618. //We choose a random direction
  3619. var indexChoosed = Math.floor(Math.random() * potentialDir.length);
  3620. return potentialDir[indexChoosed];
  3621. };
  3622. //Return the value of a tile
  3623. MapMaker.prototype.getTileAt = function (x, y) {
  3624. //Out of bounds
  3625. if (x < 0 || x > this.mapModel.width || y < 0 || y > this.mapModel.height)
  3626. return -1;
  3627. var indexTile = (y * this.mapModel.width) + x;
  3628. return this.mapData[indexTile];
  3629. };
  3630. MapMaker.prototype.registerNewCanvas = function (key_, canvas_) {
  3631. if (this.canvasDict[key_] === undefined)
  3632. this.canvasDict[key_] = canvas_;
  3633. };
  3634. MapMaker.prototype.registerNewAd = function (key_, canvas_) {
  3635. if (this.advertisementDict[key_] === undefined)
  3636. this.advertisementDict[key_] = canvas_;
  3637. };
  3638. MapMaker.prototype.registerNewDoor = function (key_, door_) {
  3639. if (this.doorDict[key_] === undefined)
  3640. this.doorDict[key_] = door_;
  3641. };
  3642. MapMaker.prototype.registerNewItem = function (key_, item_) {
  3643. if (this.itemDict[key_] === undefined)
  3644. this.itemDict[key_] = item_;
  3645. };
  3646. MapMaker.prototype.getCanvasByKey = function (key_) {
  3647. return this.canvasDict[key_];
  3648. };
  3649. MapMaker.prototype.registerNewGate = function (key_, gate_) {
  3650. this.gateDict[key_] = gate_;
  3651. };
  3652. MapMaker.prototype.getDoorByKey = function (key_) {
  3653. return this.doorDict[key_];
  3654. };
  3655. MapMaker.prototype.getAdByKey = function (key_) {
  3656. return this.advertisementDict[key_];
  3657. };
  3658. MapMaker.prototype.getGateByKey = function (key_) {
  3659. return this.gateDict[key_];
  3660. };
  3661. MapMaker.prototype.getItemByKey = function (key_) {
  3662. return this.itemDict[key_];
  3663. };
  3664. MapMaker.prototype.setPictureOnCanvas = function (post_) {
  3665. var canvas = this.canvasDict[post_.canvas_key];
  3666. console.log(this.canvasDict);
  3667. if (canvas !== undefined) {
  3668. console.log("canvas to change: " + post_.canvas_key + "; to post url: " + post_.url);
  3669. canvas.setPostData(post_);
  3670. }
  3671. else {
  3672. console.log("no canvas");
  3673. }
  3674. };
  3675. /********************
  3676. * PERF MAnAGEMENT
  3677. ********************/
  3678. MapMaker.prototype.addMeshToCluster = function (mesh_, type_) {
  3679. switch (type_) {
  3680. case _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_GROUND:
  3681. this.TileGroundMeshes.push(mesh_);
  3682. break;
  3683. case _tile__WEBPACK_IMPORTED_MODULE_0__["Tile"].TILE_WALL:
  3684. this.TileWallMeshes.push(type_);
  3685. break;
  3686. }
  3687. };
  3688. MapMaker.prototype.createClusters = function () {
  3689. BABYLON.Mesh.MergeMeshes(this.TileWallMeshes);
  3690. BABYLON.Mesh.MergeMeshes(this.TileGroundMeshes);
  3691. };
  3692. /********************
  3693. * PARSING MAP
  3694. ********************/
  3695. MapMaker.prototype.getMapData = function () {
  3696. return this.mapModel.level_data.split(",");
  3697. };
  3698. return MapMaker;
  3699. }());
  3700. /***/ }),
  3701. /***/ "./src/app/motor/playerMesh.ts":
  3702. /*!*************************************!*\
  3703. !*** ./src/app/motor/playerMesh.ts ***!
  3704. \*************************************/
  3705. /*! exports provided: PlayerMesh */
  3706. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3707. "use strict";
  3708. __webpack_require__.r(__webpack_exports__);
  3709. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerMesh", function() { return PlayerMesh; });
  3710. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js");
  3711. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__);
  3712. /* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts");
  3713. /* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts");
  3714. //import * as GUI from 'babylonjs-gui';
  3715. var PlayerMesh = /** @class */ (function () {
  3716. function PlayerMesh(type_, playerModel_, size_) {
  3717. this.objType = "player";
  3718. this.size = size_;
  3719. this.playerModel = playerModel_;
  3720. this.objType = type_;
  3721. this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance();
  3722. this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance();
  3723. if (this.playerModel.hp < 1) {
  3724. this.spriteManagerPlayer = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["SpriteManager"]("playerManager", "./assets/textures/anon_sprite_dead.png", 1, { width: 288, height: 288 }, this.gameInstance.scene);
  3725. this.sprite = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Sprite"]("player_" + playerModel_.id, this.spriteManagerPlayer);
  3726. }
  3727. else {
  3728. this.spriteManagerPlayer = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["SpriteManager"]("playerManager", "./assets/textures/anon_sprite.png", 1, { width: 290, height: 290 }, this.gameInstance.scene);
  3729. this.sprite = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Sprite"]("player_" + playerModel_.id, this.spriteManagerPlayer);
  3730. }
  3731. this.sprite.width = 6;
  3732. this.sprite.height = 6;
  3733. this.sprite.position.x = this.playerModel.position_x * size_;
  3734. this.sprite.position.z = this.playerModel.position_y * size_;
  3735. this.sprite.position.y = 3;
  3736. //Display player UI
  3737. this.playerMesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox(this.dictKey + "_" + playerModel_.id, { size: size_ * 0.5 }, this.gameInstance.scene);
  3738. this.playerMesh.position.y = size_ * 0.5;
  3739. this.playerMesh.position.x = this.playerModel.position_x * size_;
  3740. this.playerMesh.position.z = this.playerModel.position_y * size_;
  3741. this.playerMesh.visibility = 0;
  3742. /*
  3743. this.uiAdvancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
  3744. this.uiAdvancedTexture.is3D = false;
  3745. this.rectUI = new BABYLON.GUI.Rectangle();
  3746. this.rectUI.width = 0.1;
  3747. this.rectUI.height = 0.05;
  3748. this.rectUI.fontFamily = "Courier New, Courier, monospace";
  3749. this.rectUI.cornerRadius = 10;
  3750. this.rectUI.color = "Grey";
  3751. this.rectUI.background = "#161616";
  3752. this.uiAdvancedTexture.addControl(this.rectUI);
  3753. this.label = new BABYLON.GUI.TextBlock();
  3754. this.label.text = "#"+this.playerModel.id+"\n💬"+this.playerModel.talk;
  3755. this.rectUI.addControl(this.label);
  3756. this.rectUI.linkWithMesh( this.playerMesh);
  3757. this.rectUI.linkOffsetY = -60;
  3758. this.rectUI.linkOffsetX = 0;
  3759. this.uiAdvancedTexture.freeze = true;*/
  3760. return this;
  3761. }
  3762. PlayerMesh.prototype.updatePlayerModel = function (model_) {
  3763. this.playerModel = model_;
  3764. var y = this.size * 0.5;
  3765. var x = this.playerModel.position_x * this.size;
  3766. var z = this.playerModel.position_y * this.size;
  3767. //this.playerMesh.locallyTranslate(new BABYLON.Vector3(x, y, z));
  3768. var ySprite = 3;
  3769. if (this.sprite != null) {
  3770. this.sprite.position.x = x;
  3771. this.sprite.position.z = z;
  3772. this.sprite.position.y = ySprite;
  3773. }
  3774. if (this.playerMesh != null) {
  3775. this.playerMesh.position.x = x;
  3776. this.playerMesh.position.y = y;
  3777. this.playerMesh.position.z = z;
  3778. }
  3779. //this.label.text = "#"+this.playerModel.id+"\n💬"+this.playerModel.talk;
  3780. };
  3781. PlayerMesh.prototype.clean = function () {
  3782. this.spriteManagerPlayer.dispose();
  3783. if (this.playerMesh != null)
  3784. this.playerMesh.dispose();
  3785. this.sprite.dispose();
  3786. this.spriteManagerPlayer = null;
  3787. this.playerMesh = null;
  3788. this.sprite = null;
  3789. /*
  3790. this.rectUI.dispose();
  3791. this.label.dispose();
  3792. this.uiAdvancedTexture.dispose();*/
  3793. };
  3794. return PlayerMesh;
  3795. }());
  3796. /***/ }),
  3797. /***/ "./src/app/motor/playerMotor.ts":
  3798. /*!**************************************!*\
  3799. !*** ./src/app/motor/playerMotor.ts ***!
  3800. \**************************************/
  3801. /*! exports provided: PlayerMotor */
  3802. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3803. "use strict";
  3804. __webpack_require__.r(__webpack_exports__);
  3805. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayerMotor", function() { return PlayerMotor; });
  3806. /* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts");
  3807. /* harmony import */ var _gameUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gameUtils */ "./src/app/motor/gameUtils.ts");
  3808. /* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/helpers */ "./src/app/utils/helpers.ts");
  3809. /* harmony import */ var _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../services/game-uiservice.service */ "./src/app/services/game-uiservice.service.ts");
  3810. /* harmony import */ var _models_player_model__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../models/player.model */ "./src/app/models/player.model.ts");
  3811. /* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts");
  3812. var PlayerMotor = /** @class */ (function () {
  3813. function PlayerMotor() {
  3814. //Properties for cam
  3815. this.playerHeight = 4; // The player eyes height
  3816. this.speed = 1;
  3817. this.inertia = 0.9;
  3818. this.angularSensibility = 1000;
  3819. this.angularSensibilityMobile = 13000;
  3820. this.joystickMoveSpeedY = 18;
  3821. this.joystickMoveSpeedX = 0.9;
  3822. this.isJoystick = false;
  3823. }
  3824. PlayerMotor.getInstance = function () {
  3825. return this._instance || (this._instance = new this());
  3826. };
  3827. PlayerMotor.prototype.initMotor = function () {
  3828. var _this = this;
  3829. this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_0__["Game"].getInstance();
  3830. this.gameInstance.gameUIServiceService.changeStateEmitter.subscribe(function (state_) {
  3831. console.log(state_);
  3832. if (state_ === _services_game_uiservice_service__WEBPACK_IMPORTED_MODULE_3__["GameUIServiceService"].STATE_GAME_RUNNING) {
  3833. _this.activateMotion(true);
  3834. }
  3835. else {
  3836. _this.activateMotion(false);
  3837. }
  3838. });
  3839. this.gameInstance.camera = new BABYLON.FreeCamera('freeCamera', new BABYLON.Vector3(0, 5, -10), this.gameInstance.scene);
  3840. this.activateMotion(true);
  3841. };
  3842. PlayerMotor.prototype.activateMotion = function (val_) {
  3843. if (val_) {
  3844. //Free cam
  3845. this.gameInstance.camera.attachControl(this.gameInstance.scene.getEngine().getRenderingCanvas());
  3846. // Activate gravity !
  3847. //https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
  3848. this.gameInstance.scene.gravity = new BABYLON.Vector3(0, -0.7, 0);
  3849. this.gameInstance.camera.applyGravity = true;
  3850. this.gameInstance.camera.ellipsoid = new BABYLON.Vector3(2.5, this.playerHeight, 2.5);
  3851. this.gameInstance.camera.ellipsoidOffset = new BABYLON.Vector3(0, this.playerHeight, 0);
  3852. this.gameInstance.camera.checkCollisions = true;
  3853. _gameUtils__WEBPACK_IMPORTED_MODULE_1__["GameUtils"].setKeyBoardMapping(this.gameInstance);
  3854. this.gameInstance.camera.speed = this.speed;
  3855. this.gameInstance.camera.inertia = this.inertia;
  3856. this.gameInstance.camera.angularSensibility = (_utils_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isMobile()) ? this.angularSensibilityMobile : this.angularSensibility;
  3857. }
  3858. else {
  3859. this.gameInstance.camera.detachControl(this.gameInstance.scene.getEngine().getRenderingCanvas());
  3860. }
  3861. };
  3862. /*******************
  3863. * PLACE THE PLAYER
  3864. ******************/
  3865. PlayerMotor.prototype.setPlayerPos = function (playerData_) {
  3866. //console.log(this.playerRotation );
  3867. this.playerModel = playerData_;
  3868. //convert teh X + y in position
  3869. //console.log("playerPosY= "+this.playerModel.position_x+"; playerPosX= "+this.playerModel.position_y);
  3870. //Placing the player
  3871. this.gameInstance.camera.position.x = this.playerModel.position_x * _mapMaker__WEBPACK_IMPORTED_MODULE_5__["MapMaker"].TILE_SIZE;
  3872. this.gameInstance.camera.position.z = this.playerModel.position_y * _mapMaker__WEBPACK_IMPORTED_MODULE_5__["MapMaker"].TILE_SIZE;
  3873. if (this.playerRotation != null)
  3874. this.gameInstance.camera.rotation = this.playerRotation;
  3875. };
  3876. PlayerMotor.prototype.savePlayerRotation = function () {
  3877. //We memorize the player rotation
  3878. this.playerRotation = this.gameInstance.camera.rotation;
  3879. };
  3880. PlayerMotor.prototype.getPlayerPos = function () {
  3881. if (this.playerModel == null) {
  3882. this.playerModel = new _models_player_model__WEBPACK_IMPORTED_MODULE_4__["PlayerModel"]();
  3883. this.playerModel.position_x = -1;
  3884. this.playerModel.position_y = -1;
  3885. }
  3886. else {
  3887. this.playerModel.position_x = this.gameInstance.camera.position.x / _mapMaker__WEBPACK_IMPORTED_MODULE_5__["MapMaker"].TILE_SIZE;
  3888. this.playerModel.position_y = this.gameInstance.camera.position.z / _mapMaker__WEBPACK_IMPORTED_MODULE_5__["MapMaker"].TILE_SIZE;
  3889. }
  3890. return this.playerModel;
  3891. };
  3892. PlayerMotor.prototype.activeJoystick = function () {
  3893. var _this = this;
  3894. this.isJoystick = true;
  3895. var rightJoystick = new BABYLON.VirtualJoystick(false);
  3896. this.gameInstance.scene.onBeforeRenderObservable.add(function () {
  3897. if (rightJoystick.pressed) {
  3898. //OLD position
  3899. var moveY = rightJoystick.deltaPosition.y * (_this.gameInstance.engine.getDeltaTime() / 1000) * _this.joystickMoveSpeedY;
  3900. _this.gameInstance.camera.position.z += moveY * Math.cos(_this.gameInstance.camera.rotation.y);
  3901. _this.gameInstance.camera.position.x += moveY * Math.sin(_this.gameInstance.camera.rotation.y);
  3902. var moveX = rightJoystick.deltaPosition.x * (_this.gameInstance.engine.getDeltaTime() / 1000) * _this.joystickMoveSpeedX;
  3903. _this.gameInstance.camera.rotation.y += moveX;
  3904. }
  3905. });
  3906. };
  3907. return PlayerMotor;
  3908. }());
  3909. /***/ }),
  3910. /***/ "./src/app/motor/tile.ts":
  3911. /*!*******************************!*\
  3912. !*** ./src/app/motor/tile.ts ***!
  3913. \*******************************/
  3914. /*! exports provided: Tile */
  3915. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3916. "use strict";
  3917. __webpack_require__.r(__webpack_exports__);
  3918. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Tile", function() { return Tile; });
  3919. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js");
  3920. /* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs__WEBPACK_IMPORTED_MODULE_0__);
  3921. /* harmony import */ var _game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game */ "./src/app/motor/game.ts");
  3922. /* harmony import */ var _mapMaker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mapMaker */ "./src/app/motor/mapMaker.ts");
  3923. /* harmony import */ var _canvasPlane__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./canvasPlane */ "./src/app/motor/canvasPlane.ts");
  3924. /* harmony import */ var _door__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./door */ "./src/app/motor/door.ts");
  3925. /* harmony import */ var _gate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./gate */ "./src/app/motor/gate.ts");
  3926. var Tile = /** @class */ (function () {
  3927. function Tile(type_, size, x, y, z, val_) {
  3928. var type = parseInt(type_);
  3929. this.tileCoordonates = [x, y, z];
  3930. x = x * size;
  3931. y = y * size;
  3932. z = z * size;
  3933. this.gameInstance = _game__WEBPACK_IMPORTED_MODULE_1__["Game"].getInstance();
  3934. this.mapInstance = _mapMaker__WEBPACK_IMPORTED_MODULE_2__["MapMaker"].getInstance();
  3935. if (type === Tile.TILE_WALL) {
  3936. this.box = this.getMeshWall(size);
  3937. this.box.position.y = size * 0.5 + y;
  3938. this.box.position.x = x;
  3939. this.box.position.z = z;
  3940. new _canvasPlane__WEBPACK_IMPORTED_MODULE_3__["CanvasPlane"]("canvas", this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_N);
  3941. new _canvasPlane__WEBPACK_IMPORTED_MODULE_3__["CanvasPlane"]("canvas", this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_E);
  3942. new _canvasPlane__WEBPACK_IMPORTED_MODULE_3__["CanvasPlane"]("canvas", this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_S);
  3943. new _canvasPlane__WEBPACK_IMPORTED_MODULE_3__["CanvasPlane"]("canvas", this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size, x, y, z, this.mapInstance.DIR_W);
  3944. }
  3945. else if (type === Tile.TILE_GROUND || type === Tile.TILE_START) {
  3946. this.box = this.getMeshGround(size, "./assets/textures/floor_dalle_text.jpg");
  3947. this.box.position.y = -size * 0.5 + y;
  3948. this.box.position.x = x;
  3949. this.box.position.z = z;
  3950. this.mapInstance.addMeshToCluster(this.box, type);
  3951. }
  3952. else if (type === Tile.TILE_GRASS) {
  3953. this.box = this.getMeshGrass(size, "./assets/textures/grass_text.jpg");
  3954. this.box.position.y = -size * 0.5 + y;
  3955. this.box.position.x = x;
  3956. this.box.position.z = z;
  3957. this.mapInstance.addMeshToCluster(this.box, type);
  3958. }
  3959. else if (type === Tile.TILE_LADDER) {
  3960. console.log("GOT LADDER!");
  3961. this.box = this.getMeshLadder(size);
  3962. this.box.position.y = size * 0.5 + y;
  3963. this.box.position.x = x;
  3964. this.box.position.z = z;
  3965. this.mapInstance.addMeshToCluster(this.box, type);
  3966. }
  3967. else if (type === Tile.TILE_GATES || type === Tile.TILE_GATES_SECRET) {
  3968. console.log("GOT GATES!");
  3969. //Create the ground
  3970. this.box = this.getMeshGround(size, "./assets/textures/floor_dalle_text.jpg");
  3971. this.box.position.y = -size * 0.5 + y;
  3972. this.box.position.x = x;
  3973. this.box.position.z = z;
  3974. this.mapInstance.addMeshToCluster(this.box, Tile.TILE_GROUND);
  3975. this.door = this.getMeshGate(size, x, y, z, val_);
  3976. this.door.position.y = size * 0.5 + y;
  3977. this.door.position.x = x;
  3978. this.door.position.z = z;
  3979. }
  3980. else if (type === Tile.TILE_DOOR) {
  3981. console.log("GOT DOOR!");
  3982. //Create the ground
  3983. this.box = this.getMeshGround(size, "./assets/textures/floor_dalle_text.jpg");
  3984. this.box.position.y = -size * 0.5 + y;
  3985. this.box.position.x = x;
  3986. this.box.position.z = z;
  3987. this.mapInstance.addMeshToCluster(this.box, Tile.TILE_GROUND);
  3988. this.door = this.getMeshDoor(size, x, y, z, false);
  3989. this.door.position.y = size * 0.5 + y;
  3990. this.door.position.x = x;
  3991. this.door.position.z = z;
  3992. }
  3993. else if (type === Tile.TILE_DOOR_SECRET) {
  3994. console.log("GOT DOOR!");
  3995. //Create the ground
  3996. this.box = this.getMeshGround(size, "./assets/textures/floor_dalle_text.jpg");
  3997. this.box.position.y = -size * 0.5 + y;
  3998. this.box.position.x = x;
  3999. this.box.position.z = z;
  4000. this.mapInstance.addMeshToCluster(this.box, Tile.TILE_GROUND);
  4001. this.door = this.getMeshDoor(size, x, y, z, true);
  4002. this.door.position.y = size * 0.5 + y;
  4003. this.door.position.x = x;
  4004. this.door.position.z = z;
  4005. }
  4006. else {
  4007. console.log("type not found! type " + type);
  4008. }
  4009. /*
  4010. this.gameInstance.shadowGen.getShadowMap().renderList.push( this.box );
  4011. this.box.receiveShadows = true;*/
  4012. }
  4013. Object.defineProperty(Tile, "TILE_EMPTY", {
  4014. get: function () { return -1; },
  4015. enumerable: true,
  4016. configurable: true
  4017. });
  4018. Object.defineProperty(Tile, "TILE_GROUND", {
  4019. get: function () { return 0; },
  4020. enumerable: true,
  4021. configurable: true
  4022. });
  4023. Object.defineProperty(Tile, "TILE_WALL", {
  4024. get: function () { return 1; },
  4025. enumerable: true,
  4026. configurable: true
  4027. });
  4028. Object.defineProperty(Tile, "TILE_GATES", {
  4029. get: function () { return 3; },
  4030. enumerable: true,
  4031. configurable: true
  4032. });
  4033. Object.defineProperty(Tile, "TILE_DOOR", {
  4034. get: function () { return 4; },
  4035. enumerable: true,
  4036. configurable: true
  4037. });
  4038. Object.defineProperty(Tile, "TILE_DOOR_SECRET", {
  4039. get: function () { return 5; },
  4040. enumerable: true,
  4041. configurable: true
  4042. });
  4043. Object.defineProperty(Tile, "TILE_LADDER", {
  4044. get: function () { return 66; },
  4045. enumerable: true,
  4046. configurable: true
  4047. });
  4048. Object.defineProperty(Tile, "TILE_GRASS", {
  4049. get: function () { return 7; },
  4050. enumerable: true,
  4051. configurable: true
  4052. });
  4053. Object.defineProperty(Tile, "TILE_START", {
  4054. //public static get TILE_ADVERTISEMENT():number { return 12; }
  4055. get: function () { return 13; },
  4056. enumerable: true,
  4057. configurable: true
  4058. });
  4059. Object.defineProperty(Tile, "TILE_GATES_SECRET", {
  4060. get: function () { return 14; },
  4061. enumerable: true,
  4062. configurable: true
  4063. });
  4064. Tile.prototype.getMeshGround = function (size_, text_) {
  4065. if (!Tile.meshGroundInstance) {
  4066. var mesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox("groundTile", { size: size_ }, this.gameInstance.scene);
  4067. mesh.checkCollisions = true;
  4068. var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matGround", this.gameInstance.scene);
  4069. var textureBox = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"](text_, this.gameInstance.scene);
  4070. mat.diffuseTexture = textureBox;
  4071. mat.diffuseTexture.scale(1 / 4);
  4072. mesh.material = mat;
  4073. Tile.meshGroundInstance = mesh;
  4074. this.gameInstance.setShadow(mesh);
  4075. mat.freeze();
  4076. mesh.convertToUnIndexedMesh();
  4077. mesh.freezeWorldMatrix();
  4078. }
  4079. return Tile.meshGroundInstance.clone("Box Ground");
  4080. };
  4081. Tile.prototype.getMeshGrass = function (size_, text_) {
  4082. if (!Tile.meshGrassInstance) {
  4083. var mesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox("grassTile", { size: size_ }, this.gameInstance.scene);
  4084. mesh.checkCollisions = true;
  4085. var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matGrass", this.gameInstance.scene);
  4086. var textureBox = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"](text_, this.gameInstance.scene);
  4087. mat.diffuseTexture = textureBox;
  4088. mat.diffuseTexture.scale(1 / 4);
  4089. mesh.material = mat;
  4090. Tile.meshGrassInstance = mesh;
  4091. this.gameInstance.setShadow(mesh);
  4092. mat.freeze();
  4093. mesh.convertToUnIndexedMesh();
  4094. mesh.freezeWorldMatrix();
  4095. }
  4096. return Tile.meshGrassInstance.clone("Box Grass");
  4097. };
  4098. Tile.prototype.getMeshWall = function (size_) {
  4099. if (!Tile.meshWallInstance) {
  4100. var mesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox("myBox", { size: size_ }, this.gameInstance.scene);
  4101. mesh.checkCollisions = true;
  4102. var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matBox", this.gameInstance.scene);
  4103. var textureBox = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("./assets/textures/concrete_text.jpg", this.gameInstance.scene);
  4104. mat.diffuseTexture = textureBox;
  4105. mesh.material = mat;
  4106. Tile.meshWallInstance = mesh;
  4107. this.gameInstance.setShadow(mesh);
  4108. mat.freeze();
  4109. mesh.convertToUnIndexedMesh();
  4110. mesh.freezeWorldMatrix();
  4111. }
  4112. return Tile.meshWallInstance.clone("groundTile");
  4113. };
  4114. /*
  4115. getMeshAd(size_){
  4116. let mesh = MeshBuilder.CreateBox("myBox", {size: size_}, this.gameInstance.scene);
  4117. mesh.checkCollisions = true;
  4118. let mat = new StandardMaterial("matBoxLadder", this.gameInstance.scene);
  4119. mat.diffuseColor = BABYLON.Color3.Black();
  4120. mesh.material = mat;
  4121. mesh.convertToUnIndexedMesh();
  4122. mat.freeze();
  4123. return mesh;
  4124. }*/
  4125. Tile.prototype.getMeshLadder = function (size_) {
  4126. var mesh = babylonjs__WEBPACK_IMPORTED_MODULE_0__["MeshBuilder"].CreateBox("ladder", { size: size_ }, this.gameInstance.scene);
  4127. mesh.checkCollisions = true;
  4128. var mat = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["StandardMaterial"]("matBoxLadder", this.gameInstance.scene);
  4129. mat.diffuseColor = babylonjs__WEBPACK_IMPORTED_MODULE_0__["Color3"].Red();
  4130. mesh.material = mat;
  4131. mesh.convertToUnIndexedMesh();
  4132. mat.freeze();
  4133. return mesh;
  4134. };
  4135. Tile.prototype.getMeshDoor = function (size_, x_, y_, z_, secret_) {
  4136. var door = new _door__WEBPACK_IMPORTED_MODULE_4__["Door"](this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size_, x_, y_, z_, secret_);
  4137. return door.doorMesh;
  4138. };
  4139. Tile.prototype.getMeshGate = function (size_, x_, y_, z_, key_) {
  4140. var gate = new _gate__WEBPACK_IMPORTED_MODULE_5__["Gate"](this.tileCoordonates[0] + "_" + this.tileCoordonates[1] + "_" + this.tileCoordonates[2], size_, x_, y_, z_, key_);
  4141. return gate.doorMesh;
  4142. };
  4143. return Tile;
  4144. }());
  4145. /***/ }),
  4146. /***/ "./src/app/services/chan-web.service.ts":
  4147. /*!**********************************************!*\
  4148. !*** ./src/app/services/chan-web.service.ts ***!
  4149. \**********************************************/
  4150. /*! exports provided: ChanWebService */
  4151. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4152. "use strict";
  4153. __webpack_require__.r(__webpack_exports__);
  4154. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChanWebService", function() { return ChanWebService; });
  4155. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  4156. /* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../environments/environment */ "./src/environments/environment.ts");
  4157. /* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm5/http.js");
  4158. /* harmony import */ var _offline_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./offline.service */ "./src/app/services/offline.service.ts");
  4159. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  4160. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4161. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4162. 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;
  4163. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4164. };
  4165. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  4166. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  4167. };
  4168. var ChanWebService = /** @class */ (function () {
  4169. //playerData : PlayerModel;
  4170. function ChanWebService(http, offlineService) {
  4171. this.http = http;
  4172. this.offlineService = offlineService;
  4173. this.serverUrl = _environments_environment__WEBPACK_IMPORTED_MODULE_1__["environment"].apiUrl;
  4174. }
  4175. /***********************
  4176. * CHAN/POST WEBSERVICE
  4177. **********************/
  4178. //Init the server URL for the WS
  4179. ChanWebService.prototype.setServerUrl = function (url) {
  4180. this.serverUrl = url;
  4181. };
  4182. //Get thread posts list
  4183. ChanWebService.prototype.getMapPostList = function (playerX_, playerY_, name_, talk_) {
  4184. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4185. body = this.addPlayerParams(body);
  4186. body = body.append('action', 'getMapPosts');
  4187. body = body.append('position_x', playerX_);
  4188. body = body.append('position_y', playerY_);
  4189. body = body.append('name', name_);
  4190. body = body.append('talk', talk_);
  4191. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4192. };
  4193. //Get thread posts list
  4194. ChanWebService.prototype.getCanvasPostList = function (mapKey, canvasKey) {
  4195. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4196. body = this.addPlayerParams(body);
  4197. body = body.append('action', 'getPostsByCanvas');
  4198. body = body.append('map_key', mapKey);
  4199. body = body.append('canvas_key', canvasKey);
  4200. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4201. };
  4202. //Get thread posts list
  4203. ChanWebService.prototype.getReplyPostList = function (id_) {
  4204. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4205. body = this.addPlayerParams(body);
  4206. body = body.append('action', 'getReplies');
  4207. body = body.append('post_id', id_);
  4208. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4209. };
  4210. //Create post
  4211. ChanWebService.prototype.createPost = function (post_) {
  4212. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4213. body = this.addPlayerParams(body);
  4214. body = body.append('action', 'createPost');
  4215. body = body.append('url', post_.url);
  4216. body = body.append('message', post_.message);
  4217. body = body.append('canvas_key', post_.canvas_key);
  4218. body = body.append('map_key', post_.map_key);
  4219. body = body.append('reply', post_.reply.toString());
  4220. //body = body.set('action' , 'createThread');
  4221. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4222. };
  4223. ChanWebService.prototype.createLog = function (action_) {
  4224. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4225. body = this.addPlayerParams(body);
  4226. body = body.append('action', 'setAction');
  4227. body = body.append('player_action', action_.action);
  4228. body = body.append('value', action_.value);
  4229. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4230. };
  4231. ChanWebService.prototype.createAndUploadPaint = function (post_, imageData_) {
  4232. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4233. body = this.addPlayerParams(body);
  4234. body = body.append('action', 'createPost');
  4235. body = body.append('message', post_.message);
  4236. body = body.append('canvas_key', post_.canvas_key);
  4237. body = body.append('map_key', post_.map_key);
  4238. body = body.append('reply', post_.reply.toString());
  4239. body = body.append('image_data', imageData_);
  4240. body = body.append('graffiti', post_.graffiti.toString());
  4241. var headers = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpHeaders"]();
  4242. headers.append("Content-Type", "application/x-www-form-urlencoded");
  4243. //http://j-query.blogspot.com/2011/02/save-base64-encoded-canvas-image-to-png.html
  4244. //body = body.set('action' , 'createThread');
  4245. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4246. };
  4247. /***********************
  4248. * PLAYER WEBSERVICE
  4249. **********************/
  4250. //Get thread posts list
  4251. /*setMap(mapKey){
  4252. let body = new HttpParams();
  4253. body = this.addPlayerParams(body);
  4254. body = body.append('map_key', mapKey);
  4255. body = body.append('action', 'changeMapPlayer');
  4256. return this.http.post<PlayerResponseModel>(this.serverUrl+'ChanWebService.php',body);
  4257. }*/
  4258. ChanWebService.prototype.changeMapPlayerName = function (mapName) {
  4259. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4260. body = this.addPlayerParams(body);
  4261. body = body.append('map_name', mapName);
  4262. body = body.append('action', 'changeMapPlayerName');
  4263. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4264. };
  4265. ChanWebService.prototype.changeMapRandom = function (isSecret_) {
  4266. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4267. body = this.addPlayerParams(body);
  4268. body = body.append('secret', isSecret_);
  4269. body = body.append('action', 'changeMapRandom');
  4270. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4271. };
  4272. ChanWebService.prototype.getItem = function (itemKey) {
  4273. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4274. body = this.addPlayerParams(body);
  4275. body = body.append('item_key', itemKey);
  4276. body = body.append('action', 'setPlayerItem');
  4277. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4278. };
  4279. ChanWebService.prototype.addPlayerParams = function (body_) {
  4280. var playerData = this.offlineService.getPlayerData();
  4281. body_ = body_.append('player_id', playerData.id.toString());
  4282. body_ = body_.append('player_key', playerData.player_key);
  4283. return body_;
  4284. };
  4285. ChanWebService.prototype.createUser = function (anonId, anonToken, password, mapKey) {
  4286. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4287. body = body.append('action', 'initPlayer');
  4288. if (anonId)
  4289. body = body.append('player_id', anonId);
  4290. if (anonToken)
  4291. body = body.append('player_key', anonToken);
  4292. if (password)
  4293. body = body.append('player_password', password);
  4294. if (mapKey)
  4295. body = body.append('map_key', mapKey);
  4296. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4297. };
  4298. ChanWebService.prototype.getAds = function () {
  4299. return this.http.get('./assets/amaz/amaz.json');
  4300. };
  4301. /***********************
  4302. * ADMIN WEBSERVICE
  4303. **********************/
  4304. ChanWebService.prototype.deletePost = function (postId_, threadId_) {
  4305. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4306. body = this.addPlayerParams(body);
  4307. body = body.append('action', 'deletePost');
  4308. body = body.append('post_id', postId_.toString());
  4309. body = body.append('map_key', threadId_);
  4310. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4311. };
  4312. ChanWebService.prototype.setPostUrlToFile = function (postId_) {
  4313. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4314. body = this.addPlayerParams(body);
  4315. body = body.append('action', 'setPostUrlToFile');
  4316. body = body.append('post_id', postId_.toString());
  4317. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4318. };
  4319. ChanWebService.prototype.deletePostForVal = function (val_) {
  4320. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4321. body = this.addPlayerParams(body);
  4322. body = body.append('action', 'deletePostForVal');
  4323. body = body.append('val', val_);
  4324. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4325. };
  4326. ChanWebService.prototype.setBan = function (id_) {
  4327. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4328. body = this.addPlayerParams(body);
  4329. body = body.append('action', 'setBan');
  4330. body = body.append('post_id', id_);
  4331. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4332. };
  4333. ChanWebService.prototype.canonPost = function (postId_, threadId_) {
  4334. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4335. body = this.addPlayerParams(body);
  4336. body = body.append('action', 'setPostCanon');
  4337. body = body.append('post_id', postId_.toString());
  4338. body = body.append('map_key', threadId_);
  4339. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4340. };
  4341. ChanWebService.prototype.isAdminConnected = function () {
  4342. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4343. body = body.append('action', 'testAdminSession');
  4344. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4345. };
  4346. ChanWebService.prototype.connectAdmin = function (password_) {
  4347. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4348. body = body.append('action', 'validAdmin');
  4349. body = body.append('password', password_);
  4350. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4351. };
  4352. ChanWebService.prototype.setAdminPassword = function (password_) {
  4353. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4354. body = body.append('action', 'setAdminPassword');
  4355. body = body.append('password', password_);
  4356. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4357. };
  4358. ChanWebService.prototype.logout = function () {
  4359. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4360. body = body.append('action', 'unLog');
  4361. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4362. };
  4363. ChanWebService.prototype.getAllPost = function () {
  4364. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4365. body = this.addPlayerParams(body);
  4366. body = body.append('action', 'getAllPost');
  4367. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4368. };
  4369. ChanWebService.prototype.getAllMaps = function () {
  4370. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4371. body = this.addPlayerParams(body);
  4372. body = body.append('action', 'getAllMaps');
  4373. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4374. };
  4375. ChanWebService.prototype.getAllTiles = function () {
  4376. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4377. body = this.addPlayerParams(body);
  4378. body = body.append('action', 'getAllTiles');
  4379. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4380. };
  4381. ChanWebService.prototype.saveMapModel = function (map_) {
  4382. var body = new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpParams"]();
  4383. body = this.addPlayerParams(body);
  4384. body = body.append('action', 'saveMapModel');
  4385. body = body.append('id', map_.id.toString());
  4386. body = body.append('key', map_.key);
  4387. body = body.append('name', map_.name);
  4388. body = body.append('theme', map_.theme);
  4389. body = body.append('x', map_.x.toString());
  4390. body = body.append('y', map_.y.toString());
  4391. body = body.append('door_key_n', map_.door_key_n);
  4392. body = body.append('door_key_e', map_.door_key_e);
  4393. body = body.append('door_key_s', map_.door_key_s);
  4394. body = body.append('door_key_w', map_.door_key_w);
  4395. body = body.append('level_data', map_.level_data);
  4396. body = body.append('height', map_.height.toString());
  4397. body = body.append('width', map_.width.toString());
  4398. return this.http.post(this.serverUrl + 'ChanWebService.php', body);
  4399. };
  4400. ChanWebService = __decorate([
  4401. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])({
  4402. providedIn: 'root'
  4403. }),
  4404. __metadata("design:paramtypes", [_angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpClient"], _offline_service__WEBPACK_IMPORTED_MODULE_3__["OfflineService"]])
  4405. ], ChanWebService);
  4406. return ChanWebService;
  4407. }());
  4408. /***/ }),
  4409. /***/ "./src/app/services/game-uiservice.service.ts":
  4410. /*!****************************************************!*\
  4411. !*** ./src/app/services/game-uiservice.service.ts ***!
  4412. \****************************************************/
  4413. /*! exports provided: GameUIServiceService */
  4414. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4415. "use strict";
  4416. __webpack_require__.r(__webpack_exports__);
  4417. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GameUIServiceService", function() { return GameUIServiceService; });
  4418. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  4419. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  4420. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4421. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4422. 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;
  4423. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4424. };
  4425. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  4426. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  4427. };
  4428. var GameUIServiceService = /** @class */ (function () {
  4429. function GameUIServiceService() {
  4430. this.changeStateEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  4431. //public changePlayerDataEmitter = new EventEmitter<PlayerModel>();
  4432. //public changeItemsDataEmitter = new EventEmitter<any>();
  4433. this.changeGameDataEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  4434. this.changeConfigEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  4435. this.sendInteractionsEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  4436. this.postArtCanvasEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  4437. this.deletePostEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  4438. this.forceWSEmitter = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  4439. this.gameState = GameUIServiceService_1.STATE_GAME_RUNNING;
  4440. }
  4441. GameUIServiceService_1 = GameUIServiceService;
  4442. Object.defineProperty(GameUIServiceService, "STATE_GAME_RUNNING", {
  4443. get: function () { return 0; },
  4444. enumerable: true,
  4445. configurable: true
  4446. });
  4447. Object.defineProperty(GameUIServiceService, "STATE_POSTING_UI", {
  4448. get: function () { return 1; },
  4449. enumerable: true,
  4450. configurable: true
  4451. });
  4452. Object.defineProperty(GameUIServiceService, "STATE_POST_VIEWER_UI", {
  4453. get: function () { return 2; },
  4454. enumerable: true,
  4455. configurable: true
  4456. });
  4457. Object.defineProperty(GameUIServiceService, "STATE_POSTING_LOADING", {
  4458. get: function () { return 3; },
  4459. enumerable: true,
  4460. configurable: true
  4461. });
  4462. Object.defineProperty(GameUIServiceService, "STATE_PAINTING_UI", {
  4463. get: function () { return 4; },
  4464. enumerable: true,
  4465. configurable: true
  4466. });
  4467. Object.defineProperty(GameUIServiceService, "STATE_CMD_UI", {
  4468. get: function () { return 5; },
  4469. enumerable: true,
  4470. configurable: true
  4471. });
  4472. Object.defineProperty(GameUIServiceService, "STATE_INFO_UI", {
  4473. get: function () { return 6; },
  4474. enumerable: true,
  4475. configurable: true
  4476. });
  4477. Object.defineProperty(GameUIServiceService, "STATE_ITEMS_UI", {
  4478. get: function () { return 7; },
  4479. enumerable: true,
  4480. configurable: true
  4481. });
  4482. Object.defineProperty(GameUIServiceService, "STATE_NO_PLAYER", {
  4483. get: function () { return 8; },
  4484. enumerable: true,
  4485. configurable: true
  4486. });
  4487. Object.defineProperty(GameUIServiceService, "STATE_PLAYER_UI", {
  4488. get: function () { return 9; },
  4489. enumerable: true,
  4490. configurable: true
  4491. });
  4492. GameUIServiceService.prototype.changeState = function (state_) {
  4493. this.gameState = state_;
  4494. this.changeStateEmitter.emit(this.gameState);
  4495. };
  4496. GameUIServiceService.prototype.sendInteraction = function (interact_) {
  4497. this.sendInteractionsEmitter.emit(interact_);
  4498. };
  4499. GameUIServiceService.prototype.sendPost = function (post_) {
  4500. this.postArtCanvasEmitter.emit(post_);
  4501. };
  4502. GameUIServiceService.prototype.updateGameData = function (gameData_) {
  4503. this.changeGameDataEmitter.emit(gameData_);
  4504. };
  4505. /*
  4506. public updatePlayerData(playerData_ : PlayerModel){
  4507. this.changePlayerDataEmitter.emit( playerData_);
  4508. }
  4509. public updateItemsData(itemsData){
  4510. console.log(itemsData);
  4511. this.changeItemsDataEmitter.emit( {items: itemsData});
  4512. }*/
  4513. GameUIServiceService.prototype.updateConfigData = function (config_) {
  4514. this.changeConfigEmitter.emit(config_);
  4515. };
  4516. GameUIServiceService.prototype.forceWS = function () {
  4517. this.forceWSEmitter.emit();
  4518. };
  4519. GameUIServiceService.prototype.deletePost = function (post_) {
  4520. this.deletePostEmitter.emit(post_);
  4521. };
  4522. GameUIServiceService = GameUIServiceService_1 = __decorate([
  4523. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])({
  4524. providedIn: 'root'
  4525. }),
  4526. __metadata("design:paramtypes", [])
  4527. ], GameUIServiceService);
  4528. return GameUIServiceService;
  4529. var GameUIServiceService_1;
  4530. }());
  4531. /***/ }),
  4532. /***/ "./src/app/services/offline.service.ts":
  4533. /*!*********************************************!*\
  4534. !*** ./src/app/services/offline.service.ts ***!
  4535. \*********************************************/
  4536. /*! exports provided: OfflineService */
  4537. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4538. "use strict";
  4539. __webpack_require__.r(__webpack_exports__);
  4540. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OfflineService", function() { return OfflineService; });
  4541. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  4542. /* harmony import */ var _models_player_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../models/player.model */ "./src/app/models/player.model.ts");
  4543. /* harmony import */ var _models_config_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../models/config.model */ "./src/app/models/config.model.ts");
  4544. var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  4545. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4546. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4547. 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;
  4548. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4549. };
  4550. var __metadata = (undefined && undefined.__metadata) || function (k, v) {
  4551. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  4552. };
  4553. var OfflineService = /** @class */ (function () {
  4554. function OfflineService() {
  4555. this.PLAYER_KEY = "player_one_data2";
  4556. this.PLAYER_NAME_KEY = "player_name";
  4557. this.KEYBOARD_KEY = "keyboard";
  4558. this.CONFIG_KEY = "config_key";
  4559. this.CHAN_KEY = "CHAN_KEY3";
  4560. }
  4561. OfflineService.prototype.getPlayerData = function () {
  4562. var data = localStorage.getItem(this.PLAYER_KEY);
  4563. if (data != null)
  4564. return JSON.parse(data);
  4565. return new _models_player_model__WEBPACK_IMPORTED_MODULE_1__["PlayerModel"]();
  4566. };
  4567. OfflineService.prototype.savePlayer = function (player_) {
  4568. return localStorage.setItem(this.PLAYER_KEY, JSON.stringify(player_));
  4569. };
  4570. OfflineService.prototype.getPlayerName = function () {
  4571. var data = localStorage.getItem(this.PLAYER_NAME_KEY);
  4572. if (data != null)
  4573. return data;
  4574. var name = Math.random().toString(36).substr(2, 9);
  4575. this.savePlayerName(name);
  4576. return name;
  4577. };
  4578. OfflineService.prototype.savePlayerName = function (playerName_) {
  4579. return localStorage.setItem(this.PLAYER_NAME_KEY, JSON.stringify(playerName_));
  4580. };
  4581. OfflineService.prototype.getConfig = function () {
  4582. var data = localStorage.getItem(this.CONFIG_KEY);
  4583. console.log("getConfig" + data);
  4584. if (data != null)
  4585. return JSON.parse(data);
  4586. return new _models_config_model__WEBPACK_IMPORTED_MODULE_2__["ConfigModel"]();
  4587. };
  4588. OfflineService.prototype.saveConfig = function (config_) {
  4589. localStorage.setItem(this.CONFIG_KEY, JSON.stringify(config_));
  4590. };
  4591. OfflineService.prototype.getChanData = function () {
  4592. var data = localStorage.getItem(this.CHAN_KEY);
  4593. if (data != null)
  4594. return JSON.parse(data);
  4595. return ['alpha'];
  4596. };
  4597. OfflineService.prototype.saveChan = function (chan_) {
  4598. var listChan = this.getChanData();
  4599. for (var c = 0; c < listChan.length; c++) {
  4600. if (listChan[c] == chan_)
  4601. return;
  4602. }
  4603. listChan.push(chan_);
  4604. return localStorage.setItem(this.CHAN_KEY, JSON.stringify(listChan));
  4605. };
  4606. OfflineService = __decorate([
  4607. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])({
  4608. providedIn: 'root'
  4609. }),
  4610. __metadata("design:paramtypes", [])
  4611. ], OfflineService);
  4612. return OfflineService;
  4613. }());
  4614. /***/ }),
  4615. /***/ "./src/app/utils/constants.ts":
  4616. /*!************************************!*\
  4617. !*** ./src/app/utils/constants.ts ***!
  4618. \************************************/
  4619. /*! exports provided: Constants */
  4620. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4621. "use strict";
  4622. __webpack_require__.r(__webpack_exports__);
  4623. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Constants", function() { return Constants; });
  4624. var Constants = /** @class */ (function () {
  4625. function Constants() {
  4626. }
  4627. Object.defineProperty(Constants, "ITEM_KEY_UPLOAD_RING", {
  4628. get: function () { return "upload"; },
  4629. enumerable: true,
  4630. configurable: true
  4631. });
  4632. Object.defineProperty(Constants, "ITEM_KEY_DELETE_SPONGE", {
  4633. get: function () { return "post delete"; },
  4634. enumerable: true,
  4635. configurable: true
  4636. });
  4637. Object.defineProperty(Constants, "ITEM_KEY_VARNISH", {
  4638. get: function () { return "varnish powder"; },
  4639. enumerable: true,
  4640. configurable: true
  4641. });
  4642. return Constants;
  4643. }());
  4644. /***/ }),
  4645. /***/ "./src/app/utils/helpers.ts":
  4646. /*!**********************************!*\
  4647. !*** ./src/app/utils/helpers.ts ***!
  4648. \**********************************/
  4649. /*! exports provided: Helpers */
  4650. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4651. "use strict";
  4652. __webpack_require__.r(__webpack_exports__);
  4653. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Helpers", function() { return Helpers; });
  4654. var Helpers = /** @class */ (function () {
  4655. function Helpers() {
  4656. }
  4657. /**
  4658. * Determine the mobile operating system.
  4659. * This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'.
  4660. *
  4661. * @returns {Boolean}
  4662. */
  4663. Helpers.isMobile = function () {
  4664. var userAgent = navigator.userAgent || navigator.vendor;
  4665. // Windows Phone must come first because its UA also contains "Android"
  4666. if (/windows phone/i.test(userAgent)) {
  4667. return true;
  4668. }
  4669. if (/android/i.test(userAgent)) {
  4670. return true;
  4671. }
  4672. // iOS detection from: http://stackoverflow.com/a/9039885/177710
  4673. if (/iPad|iPhone|iPod/.test(userAgent)) {
  4674. return true;
  4675. }
  4676. return false;
  4677. };
  4678. Helpers.antiWord = function (message_) {
  4679. return message_.replace(/nigger/ig, 'noggel');
  4680. };
  4681. Helpers.isPT = function () {
  4682. var lang = navigator.language;
  4683. return (lang.toLowerCase().indexOf('pt') > -1 || lang.toLowerCase().indexOf('BR') > -1);
  4684. };
  4685. return Helpers;
  4686. }());
  4687. /***/ }),
  4688. /***/ "./src/app/utils/urlParser.ts":
  4689. /*!************************************!*\
  4690. !*** ./src/app/utils/urlParser.ts ***!
  4691. \************************************/
  4692. /*! exports provided: UrlParser */
  4693. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4694. "use strict";
  4695. __webpack_require__.r(__webpack_exports__);
  4696. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlParser", function() { return UrlParser; });
  4697. var UrlParser = /** @class */ (function () {
  4698. function UrlParser(url_) {
  4699. this.type = 0;
  4700. this.url = url_;
  4701. this.type = this.getUrlType();
  4702. return this;
  4703. }
  4704. Object.defineProperty(UrlParser, "TYPE_LINK", {
  4705. get: function () { return 0; },
  4706. enumerable: true,
  4707. configurable: true
  4708. });
  4709. Object.defineProperty(UrlParser, "TYPE_IMG", {
  4710. get: function () { return 1; },
  4711. enumerable: true,
  4712. configurable: true
  4713. });
  4714. Object.defineProperty(UrlParser, "TYPE_IMG_GIF", {
  4715. get: function () { return 2; },
  4716. enumerable: true,
  4717. configurable: true
  4718. });
  4719. Object.defineProperty(UrlParser, "TYPE_MOVIE", {
  4720. get: function () { return 3; },
  4721. enumerable: true,
  4722. configurable: true
  4723. });
  4724. Object.defineProperty(UrlParser, "TYPE_YOUTUBE", {
  4725. get: function () { return 4; },
  4726. enumerable: true,
  4727. configurable: true
  4728. });
  4729. Object.defineProperty(UrlParser, "TYPE_MP3", {
  4730. get: function () { return 5; },
  4731. enumerable: true,
  4732. configurable: true
  4733. });
  4734. UrlParser.prototype.setUrl = function (url_) {
  4735. this.url = url_;
  4736. this.type = this.getUrlType();
  4737. return this;
  4738. };
  4739. UrlParser.prototype.getUrlType = function () {
  4740. if (this.url != undefined) {
  4741. var tempUrl = this.url.toLowerCase();
  4742. if (tempUrl.indexOf("png") > -1 || tempUrl.indexOf("jpg") > -1 || tempUrl.indexOf("jpeg") > -1 || tempUrl.indexOf("webp") > -1) {
  4743. return UrlParser.TYPE_IMG;
  4744. }
  4745. else if (tempUrl.indexOf("gif") > -1) {
  4746. return UrlParser.TYPE_IMG_GIF;
  4747. }
  4748. else if (tempUrl.indexOf(".mp4") > -1 || tempUrl.indexOf(".webm") > -1) {
  4749. return UrlParser.TYPE_MOVIE;
  4750. }
  4751. else if (tempUrl.indexOf("youtube.com") > -1 || tempUrl.indexOf("youtu.be") > -1) {
  4752. return UrlParser.TYPE_YOUTUBE;
  4753. }
  4754. else if (tempUrl.indexOf("mp3") > -1) {
  4755. return UrlParser.TYPE_MP3;
  4756. }
  4757. }
  4758. return UrlParser.TYPE_LINK;
  4759. };
  4760. UrlParser.prototype.getYoutubeId = function () {
  4761. var regExp = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
  4762. var match = this.url.match(regExp);
  4763. if (match && match[2].length == 11) {
  4764. return match[2];
  4765. }
  4766. else {
  4767. return "";
  4768. }
  4769. };
  4770. UrlParser.prototype.getImage = function () {
  4771. if (this.type === UrlParser.TYPE_YOUTUBE) {
  4772. //get the preview
  4773. return "https://img.youtube.com/vi/" + this.getYoutubeId() + "/hqdefault.jpg";
  4774. }
  4775. return this.url;
  4776. };
  4777. UrlParser.prototype.getSafeTubeURL = function (sanitizer_) {
  4778. var tmpURl;
  4779. if (this.type === UrlParser.TYPE_YOUTUBE) {
  4780. //get the preview
  4781. tmpURl = "https://www.youtube.com/embed/" + this.getYoutubeId();
  4782. return sanitizer_.bypassSecurityTrustResourceUrl(tmpURl);
  4783. }
  4784. return this.url;
  4785. };
  4786. return UrlParser;
  4787. }());
  4788. /***/ }),
  4789. /***/ "./src/environments/environment.ts":
  4790. /*!*****************************************!*\
  4791. !*** ./src/environments/environment.ts ***!
  4792. \*****************************************/
  4793. /*! exports provided: environment */
  4794. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4795. "use strict";
  4796. __webpack_require__.r(__webpack_exports__);
  4797. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "environment", function() { return environment; });
  4798. // This file can be replaced during build by using the `fileReplacements` array.
  4799. // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
  4800. // The list of file replacements can be found in `angular.json`.
  4801. var environment = {
  4802. production: false,
  4803. apiUrl: 'http://localhost:8888/srv/php/',
  4804. clientUrl: '/',
  4805. };
  4806. /*
  4807. * For easier debugging in development mode, you can import the following file
  4808. * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
  4809. *
  4810. * This import should be commented out in production mode because it will have a negative impact
  4811. * on performance if an error is thrown.
  4812. */
  4813. // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
  4814. /***/ }),
  4815. /***/ "./src/main.ts":
  4816. /*!*********************!*\
  4817. !*** ./src/main.ts ***!
  4818. \*********************/
  4819. /*! no exports provided */
  4820. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4821. "use strict";
  4822. __webpack_require__.r(__webpack_exports__);
  4823. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  4824. /* harmony import */ var _angular_platform_browser_dynamic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/platform-browser-dynamic */ "./node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js");
  4825. /* harmony import */ var _app_app_module__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./app/app.module */ "./src/app/app.module.ts");
  4826. /* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./environments/environment */ "./src/environments/environment.ts");
  4827. if (_environments_environment__WEBPACK_IMPORTED_MODULE_3__["environment"].production) {
  4828. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["enableProdMode"])();
  4829. }
  4830. Object(_angular_platform_browser_dynamic__WEBPACK_IMPORTED_MODULE_1__["platformBrowserDynamic"])().bootstrapModule(_app_app_module__WEBPACK_IMPORTED_MODULE_2__["AppModule"])
  4831. .catch(function (err) { return console.error(err); });
  4832. /***/ }),
  4833. /***/ 0:
  4834. /*!***************************!*\
  4835. !*** multi ./src/main.ts ***!
  4836. \***************************/
  4837. /*! no static exports found */
  4838. /***/ (function(module, exports, __webpack_require__) {
  4839. module.exports = __webpack_require__(/*! /Users/alexandre/Desktop/Alexandre/projetZ/wip/SITEZ/Marquis/Protagoras/ProtagurOS/src/main.ts */"./src/main.ts");
  4840. /***/ })
  4841. },[[0,"runtime","vendor"]]]);
  4842. //# sourceMappingURL=main.js.map