@hytopia.com/examples 1.0.18 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2824,7 +2824,7 @@ window.ItemTooltips = (function() {
2824
2824
 
2825
2825
  body.mobile .dialogue-content * {
2826
2826
  overflow-y: scroll;
2827
- touch-action: pan-y !important;
2827
+
2828
2828
  }
2829
2829
 
2830
2830
  body.mobile .dialogue-message {
@@ -2832,6 +2832,7 @@ window.ItemTooltips = (function() {
2832
2832
  font-size: 11px;
2833
2833
  margin-bottom: 8px;
2834
2834
  border-radius: 4px;
2835
+ touch-action: pan-y;
2835
2836
  }
2836
2837
 
2837
2838
  body.mobile .dialogue-option {
@@ -2844,6 +2845,11 @@ window.ItemTooltips = (function() {
2844
2845
  width: 14px;
2845
2846
  height: 14px;
2846
2847
  }
2848
+
2849
+ body.mobile .dialogue-option,
2850
+ body.mobile .dialogue-close {
2851
+ touch-action: manipulation !important;
2852
+ }
2847
2853
  </style>
2848
2854
 
2849
2855
  <!-- Included from: ./menus/quests.html -->
@@ -3761,7 +3767,6 @@ window.ItemTooltips = (function() {
3761
3767
  }
3762
3768
 
3763
3769
  body.mobile .quests-list * {
3764
- touch-action: pan-y !important;
3765
3770
  overflow-y: scroll;
3766
3771
  }
3767
3772
 
@@ -3790,7 +3795,6 @@ window.ItemTooltips = (function() {
3790
3795
  }
3791
3796
 
3792
3797
  body.mobile .quests-details-content * {
3793
- touch-action: pan-y !important;
3794
3798
  overflow-y: scroll;
3795
3799
  }
3796
3800
 
@@ -422,7 +422,7 @@
422
422
 
423
423
  body.mobile .dialogue-content * {
424
424
  overflow-y: scroll;
425
- touch-action: pan-y !important;
425
+
426
426
  }
427
427
 
428
428
  body.mobile .dialogue-message {
@@ -430,6 +430,7 @@
430
430
  font-size: 11px;
431
431
  margin-bottom: 8px;
432
432
  border-radius: 4px;
433
+ touch-action: pan-y;
433
434
  }
434
435
 
435
436
  body.mobile .dialogue-option {
@@ -442,4 +443,9 @@
442
443
  width: 14px;
443
444
  height: 14px;
444
445
  }
446
+
447
+ body.mobile .dialogue-option,
448
+ body.mobile .dialogue-close {
449
+ touch-action: manipulation !important;
450
+ }
445
451
  </style>
@@ -912,7 +912,6 @@
912
912
  }
913
913
 
914
914
  body.mobile .quests-list * {
915
- touch-action: pan-y !important;
916
915
  overflow-y: scroll;
917
916
  }
918
917
 
@@ -941,7 +940,6 @@
941
940
  }
942
941
 
943
942
  body.mobile .quests-details-content * {
944
- touch-action: pan-y !important;
945
943
  overflow-y: scroll;
946
944
  }
947
945
 
@@ -77,7 +77,7 @@ export default class GameManager {
77
77
  }
78
78
 
79
79
  private _selectWorldForPlayer = async (player: Player): Promise<World | undefined> => {
80
- const gamePlayer = await GamePlayer.getOrCreate(player);
80
+ const gamePlayer = GamePlayer.getOrCreate(player);
81
81
  return gamePlayer.currentRegion?.world ?? this._startRegion.world;
82
82
  }
83
83
  }
@@ -88,13 +88,15 @@ export default class GamePlayer {
88
88
  this.hotbar.onSelectedItemChanged = this._onHotbarSelectedItemChanged;
89
89
  }
90
90
 
91
- public static async getOrCreate(player: Player): Promise<GamePlayer> {
91
+ public static getOrCreate(player: Player): GamePlayer {
92
92
  let gamePlayer = this._instances.get(player.id);
93
+
93
94
  if (!gamePlayer) {
94
95
  gamePlayer = new GamePlayer(player);
95
- await gamePlayer.load();
96
+ gamePlayer.load();
96
97
  this._instances.set(player.id, gamePlayer);
97
98
  }
99
+
98
100
  return gamePlayer;
99
101
  }
100
102
 
@@ -342,8 +344,8 @@ export default class GamePlayer {
342
344
  this.player.joinWorld(region.world);
343
345
  }
344
346
 
345
- public async load(): Promise<void> {
346
- const serializedGamePlayerData = await this.player.getPersistedData();
347
+ public load(): void {
348
+ const serializedGamePlayerData = this.player.getPersistedData();
347
349
 
348
350
  if (serializedGamePlayerData) { // Existing player, load their state
349
351
  this._loadFromSerializedData(serializedGamePlayerData as SerializedGamePlayerData);
@@ -140,9 +140,8 @@ export default class GameRegion {
140
140
  }
141
141
  }
142
142
 
143
- protected async onPlayerJoin(player: Player) {
144
- console.log('onPlayerJoin', this.name);
145
- const gamePlayer = await GamePlayer.getOrCreate(player);
143
+ protected onPlayerJoin(player: Player) {
144
+ const gamePlayer = GamePlayer.getOrCreate(player);
146
145
 
147
146
  // Set the current region for the player
148
147
  gamePlayer.setCurrentRegion(this);
@@ -153,11 +152,6 @@ export default class GameRegion {
153
152
  const gamePlayerEntity = new GamePlayerEntity(gamePlayer);
154
153
 
155
154
  gamePlayerEntity.spawn(this._world, spawnPoint, Quaternion.fromEuler(0, spawnFacingAngle, 0));
156
-
157
- // Since we're using an async onPlayerJoin, we need to explicitly set the camera
158
- // since the camera attachment logic as of SDK 0.6.7 only checks for an entity
159
- // the first tick after a player joins a world in order to auto attach the camera.
160
- player.camera.setAttachedToEntity(gamePlayerEntity);
161
155
 
162
156
  // Make the camera look at the correct spawn facing angle.
163
157
  // Calculate look direction based on facing angle (identity direction is -z, consistent with threejs)
@@ -200,8 +194,8 @@ export default class GameRegion {
200
194
  // The HYTOPIA SDK handles resynchronization of all persisted state back to the player client such as
201
195
  // their entity, scene ui states, etc, but anything that uses ephemeral state (Such as UI) we need
202
196
  // to handle reloading for them manually here.
203
- protected async onPlayerReconnected(player: Player) {
204
- const gamePlayer = await GamePlayer.getOrCreate(player);
197
+ protected onPlayerReconnected(player: Player) {
198
+ const gamePlayer = GamePlayer.getOrCreate(player);
205
199
  gamePlayer.onPlayerReconnected();
206
200
  }
207
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hytopia.com/examples",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -1,111 +0,0 @@
1
- {
2
- "health": 120,
3
- "currentRegionId": "stalkhaven",
4
- "skillExperience": [
5
- [
6
- "exploration",
7
- 225
8
- ],
9
- [
10
- "combat",
11
- 162
12
- ],
13
- [
14
- "agility",
15
- 20
16
- ]
17
- ],
18
- "backpack": {
19
- "items": []
20
- },
21
- "hotbar": {
22
- "items": [
23
- {
24
- "position": 0,
25
- "itemId": "dull_sword"
26
- },
27
- {
28
- "position": 2,
29
- "itemId": "toy_sword"
30
- },
31
- {
32
- "position": 3,
33
- "itemId": "gold",
34
- "quantity": 82
35
- },
36
- {
37
- "position": 1,
38
- "itemId": "ratkin_tail"
39
- },
40
- {
41
- "position": 4,
42
- "itemId": "ratkin_tooth"
43
- },
44
- {
45
- "position": 5,
46
- "itemId": "ratkin_eyes",
47
- "quantity": 3
48
- },
49
- {
50
- "position": 6,
51
- "itemId": "ratkin_bones",
52
- "quantity": 3
53
- }
54
- ]
55
- },
56
- "questLog": {
57
- "quests": [
58
- {
59
- "questId": "welcome-to-stalkhaven",
60
- "state": "completed",
61
- "objectiveProgress": {
62
- "talk-to-mark": 1
63
- }
64
- },
65
- {
66
- "questId": "exploring-stalkhaven",
67
- "state": "completed",
68
- "objectiveProgress": {
69
- "talk-to-mycelis": 1,
70
- "talk-to-finn": 1,
71
- "talk-to-sporn": 1,
72
- "talk-to-mark": 1
73
- }
74
- },
75
- {
76
- "questId": "tested-mettle",
77
- "state": "active",
78
- "objectiveProgress": {
79
- "kill-5-ratkin": 5,
80
- "dodge-3-times": 3,
81
- "talk-to-mark": 0
82
- }
83
- },
84
- {
85
- "questId": "dip-duck-dodge",
86
- "state": "active",
87
- "objectiveProgress": {
88
- "dodge": 0,
89
- "talk-to-sporn": 0
90
- }
91
- }
92
- ]
93
- },
94
- "storage": {
95
- "items": []
96
- },
97
- "wearables": {
98
- "items": [
99
- {
100
- "position": 1,
101
- "itemId": "adventurer_tunic"
102
- }
103
- ]
104
- },
105
- "currentRegionSpawnFacingAngle": 0,
106
- "currentRegionSpawnPoint": {
107
- "x": 1,
108
- "y": 2,
109
- "z": 40
110
- }
111
- }