| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using DCL.Helpers; |
| | 4 | | using DCL.Models; |
| | 5 | | using UnityEngine; |
| | 6 | | using Ray = UnityEngine.Ray; |
| | 7 | |
|
| | 8 | | #if UNITY_WEBGL && !UNITY_EDITOR |
| | 9 | | using System.Runtime.InteropServices; |
| | 10 | | #endif |
| | 11 | |
|
| | 12 | | namespace DCL.Interface |
| | 13 | | { |
| | 14 | | /** |
| | 15 | | * This class contains the outgoing interface of Decentraland. |
| | 16 | | * You must call those functions to interact with the WebInterface. |
| | 17 | | * |
| | 18 | | * The messages comming from the WebInterface instead, are reported directly to |
| | 19 | | * the handler GameObject by name. |
| | 20 | | */ |
| | 21 | | public static class WebInterface |
| | 22 | | { |
| 1 | 23 | | public static bool VERBOSE = false; |
| | 24 | |
|
| | 25 | | [System.Serializable] |
| | 26 | | private class ReportPositionPayload |
| | 27 | | { |
| | 28 | | /** Camera position, world space */ |
| | 29 | | public Vector3 position; |
| | 30 | |
|
| | 31 | | /** Camera rotation */ |
| | 32 | | public Quaternion rotation; |
| | 33 | |
|
| | 34 | | /** Camera height, relative to the feet of the avatar or ground */ |
| | 35 | | public float playerHeight; |
| | 36 | |
|
| | 37 | | public Vector3 mousePosition; |
| | 38 | |
|
| | 39 | | public string id; |
| | 40 | | } |
| | 41 | |
|
| | 42 | | [System.Serializable] |
| | 43 | | public abstract class ControlEvent |
| | 44 | | { |
| | 45 | | public string eventType; |
| | 46 | | } |
| | 47 | |
|
| | 48 | | public abstract class ControlEvent<T> : ControlEvent |
| | 49 | | { |
| | 50 | | public T payload; |
| | 51 | |
|
| | 52 | | protected ControlEvent(string eventType, T payload) |
| | 53 | | { |
| | 54 | | this.eventType = eventType; |
| | 55 | | this.payload = payload; |
| | 56 | | } |
| | 57 | | } |
| | 58 | |
|
| | 59 | | [System.Serializable] |
| | 60 | | public class StartStatefulMode : ControlEvent<StartStatefulMode.Payload> |
| | 61 | | { |
| | 62 | | [System.Serializable] |
| | 63 | | public class Payload |
| | 64 | | { |
| | 65 | | public string sceneId; |
| | 66 | | } |
| | 67 | |
|
| 4 | 68 | | public StartStatefulMode(string sceneId) : base("StartStatefulMode", new Payload() { sceneId = sceneId }) { |
| | 69 | | } |
| | 70 | |
|
| | 71 | | [System.Serializable] |
| | 72 | | public class StopStatefulMode : ControlEvent<StopStatefulMode.Payload> |
| | 73 | | { |
| | 74 | | [System.Serializable] |
| | 75 | | public class Payload |
| | 76 | | { |
| | 77 | | public string sceneId; |
| | 78 | | } |
| | 79 | |
|
| 4 | 80 | | public StopStatefulMode(string sceneId) : base("StopStatefulMode", new Payload() { sceneId = sceneId }) { } |
| | 81 | | } |
| | 82 | |
|
| | 83 | | [System.Serializable] |
| | 84 | | public class SceneReady : ControlEvent<SceneReady.Payload> |
| | 85 | | { |
| | 86 | | [System.Serializable] |
| | 87 | | public class Payload |
| | 88 | | { |
| | 89 | | public string sceneId; |
| | 90 | | } |
| | 91 | |
|
| 796 | 92 | | public SceneReady(string sceneId) : base("SceneReady", new Payload() { sceneId = sceneId }) { } |
| | 93 | | } |
| | 94 | |
|
| | 95 | | [System.Serializable] |
| | 96 | | public class ActivateRenderingACK : ControlEvent<object> |
| | 97 | | { |
| 2 | 98 | | public ActivateRenderingACK() : base("ActivateRenderingACK", null) { } |
| | 99 | | } |
| | 100 | |
|
| | 101 | | [System.Serializable] |
| | 102 | | public class DeactivateRenderingACK : ControlEvent<object> |
| | 103 | | { |
| 0 | 104 | | public DeactivateRenderingACK() : base("DeactivateRenderingACK", null) { } |
| | 105 | | } |
| | 106 | |
|
| | 107 | | [System.Serializable] |
| | 108 | | public class SceneEvent<T> |
| | 109 | | { |
| | 110 | | public string sceneId; |
| | 111 | | public string eventType; |
| | 112 | | public T payload; |
| | 113 | | } |
| | 114 | |
|
| | 115 | | [System.Serializable] |
| | 116 | | public class AllScenesEvent<T> |
| | 117 | | { |
| | 118 | | public string eventType; |
| | 119 | | public T payload; |
| | 120 | | } |
| | 121 | |
|
| | 122 | | [System.Serializable] |
| | 123 | | public class UUIDEvent<TPayload> |
| | 124 | | where TPayload : class, new() |
| | 125 | | { |
| | 126 | | public string uuid; |
| | 127 | | public TPayload payload = new TPayload(); |
| | 128 | | } |
| | 129 | |
|
| | 130 | | public enum ACTION_BUTTON |
| | 131 | | { |
| | 132 | | POINTER, |
| | 133 | | PRIMARY, |
| | 134 | | SECONDARY, |
| | 135 | | ANY, |
| | 136 | | FORWARD, |
| | 137 | | BACKWARD, |
| | 138 | | RIGHT, |
| | 139 | | LEFT, |
| | 140 | | JUMP, |
| | 141 | | WALK, |
| | 142 | | ACTION_3, |
| | 143 | | ACTION_4, |
| | 144 | | ACTION_5, |
| | 145 | | ACTION_6 |
| | 146 | | } |
| | 147 | |
|
| | 148 | | [System.Serializable] |
| | 149 | | public class OnClickEvent : UUIDEvent<OnClickEventPayload> { }; |
| | 150 | |
|
| | 151 | | [System.Serializable] |
| | 152 | | public class CameraModePayload |
| | 153 | | { |
| | 154 | | public CameraMode.ModeId cameraMode; |
| | 155 | | }; |
| | 156 | |
|
| | 157 | | [System.Serializable] |
| | 158 | | public class IdleStateChangedPayload |
| | 159 | | { |
| | 160 | | public bool isIdle; |
| | 161 | | }; |
| | 162 | |
|
| | 163 | | [System.Serializable] |
| | 164 | | public class OnPointerDownEvent : UUIDEvent<OnPointerEventPayload> { }; |
| | 165 | |
|
| | 166 | | [System.Serializable] |
| | 167 | | public class OnGlobalPointerEvent |
| | 168 | | { |
| 0 | 169 | | public OnGlobalPointerEventPayload payload = new OnGlobalPointerEventPayload(); |
| | 170 | | }; |
| | 171 | |
|
| | 172 | | [System.Serializable] |
| | 173 | | public class OnPointerUpEvent : UUIDEvent<OnPointerEventPayload> { }; |
| | 174 | |
|
| | 175 | | [System.Serializable] |
| | 176 | | private class OnTextSubmitEvent : UUIDEvent<OnTextSubmitEventPayload> { }; |
| | 177 | |
|
| | 178 | | [System.Serializable] |
| | 179 | | private class OnTextInputChangeEvent : UUIDEvent<OnTextInputChangeEventPayload> { }; |
| | 180 | |
|
| | 181 | | [System.Serializable] |
| | 182 | | private class OnTextInputChangeTextEvent : UUIDEvent<OnTextInputChangeTextEventPayload> { }; |
| | 183 | |
|
| | 184 | | [System.Serializable] |
| | 185 | | private class OnScrollChangeEvent : UUIDEvent<OnScrollChangeEventPayload> { }; |
| | 186 | |
|
| | 187 | | [System.Serializable] |
| | 188 | | private class OnFocusEvent : UUIDEvent<EmptyPayload> { }; |
| | 189 | |
|
| | 190 | | [System.Serializable] |
| | 191 | | private class OnBlurEvent : UUIDEvent<EmptyPayload> { }; |
| | 192 | |
|
| | 193 | | [System.Serializable] |
| | 194 | | public class OnEnterEvent : UUIDEvent<OnEnterEventPayload> { }; |
| | 195 | |
|
| | 196 | | [System.Serializable] |
| | 197 | | public class OnClickEventPayload |
| | 198 | | { |
| | 199 | | public ACTION_BUTTON buttonId = ACTION_BUTTON.POINTER; |
| | 200 | | } |
| | 201 | |
|
| | 202 | | [System.Serializable] |
| | 203 | | public class SendChatMessageEvent |
| | 204 | | { |
| | 205 | | public ChatMessage message; |
| | 206 | | } |
| | 207 | |
|
| | 208 | | [System.Serializable] |
| | 209 | | public class RemoveEntityComponentsPayLoad |
| | 210 | | { |
| | 211 | | public string entityId; |
| | 212 | | public string componentId; |
| | 213 | | }; |
| | 214 | |
|
| | 215 | | [System.Serializable] |
| | 216 | | public class StoreSceneStateEvent |
| | 217 | | { |
| 1 | 218 | | public string type = "StoreSceneState"; |
| 1 | 219 | | public string payload = ""; |
| | 220 | | }; |
| | 221 | |
|
| | 222 | | [System.Serializable] |
| | 223 | | public class OnPointerEventPayload |
| | 224 | | { |
| | 225 | | [System.Serializable] |
| | 226 | | public class Hit |
| | 227 | | { |
| | 228 | | public Vector3 origin; |
| | 229 | | public float length; |
| | 230 | | public Vector3 hitPoint; |
| | 231 | | public Vector3 normal; |
| | 232 | | public Vector3 worldNormal; |
| | 233 | | public string meshName; |
| | 234 | | public string entityId; |
| | 235 | | } |
| | 236 | |
|
| | 237 | | public ACTION_BUTTON buttonId; |
| | 238 | | public Vector3 origin; |
| | 239 | | public Vector3 direction; |
| | 240 | | public Hit hit; |
| | 241 | | } |
| | 242 | |
|
| | 243 | | [System.Serializable] |
| | 244 | | public class OnGlobalPointerEventPayload : OnPointerEventPayload |
| | 245 | | { |
| | 246 | | public enum InputEventType |
| | 247 | | { |
| | 248 | | DOWN, |
| | 249 | | UP |
| | 250 | | } |
| | 251 | |
|
| | 252 | | public InputEventType type; |
| | 253 | | } |
| | 254 | |
|
| | 255 | | [System.Serializable] |
| | 256 | | public class OnTextSubmitEventPayload |
| | 257 | | { |
| | 258 | | public string id; |
| | 259 | | public string text; |
| | 260 | | } |
| | 261 | |
|
| | 262 | | [System.Serializable] |
| | 263 | | public class OnTextInputChangeEventPayload |
| | 264 | | { |
| | 265 | | public string value; |
| | 266 | | } |
| | 267 | |
|
| | 268 | | [System.Serializable] |
| | 269 | | public class OnTextInputChangeTextEventPayload |
| | 270 | | { |
| | 271 | | [System.Serializable] |
| | 272 | | public class Payload |
| | 273 | | { |
| | 274 | | public string value; |
| | 275 | | public bool isSubmit; |
| | 276 | | } |
| | 277 | |
|
| 2 | 278 | | public Payload value = new Payload(); |
| | 279 | | } |
| | 280 | |
|
| | 281 | | [System.Serializable] |
| | 282 | | public class OnScrollChangeEventPayload |
| | 283 | | { |
| | 284 | | public Vector2 value; |
| | 285 | | public int pointerId; |
| | 286 | | } |
| | 287 | |
|
| | 288 | | [System.Serializable] |
| | 289 | | public class EmptyPayload { } |
| | 290 | |
|
| | 291 | | [System.Serializable] |
| | 292 | | public class MetricsModel |
| | 293 | | { |
| | 294 | | public int meshes; |
| | 295 | | public int bodies; |
| | 296 | | public int materials; |
| | 297 | | public int textures; |
| | 298 | | public int triangles; |
| | 299 | | public int entities; |
| | 300 | |
|
| | 301 | | public static MetricsModel operator +(MetricsModel lhs, MetricsModel rhs) |
| | 302 | | { |
| 0 | 303 | | return new MetricsModel() |
| | 304 | | { |
| | 305 | | meshes = lhs.meshes + rhs.meshes, |
| | 306 | | bodies = lhs.bodies + rhs.bodies, |
| | 307 | | materials = lhs.materials + rhs.materials, |
| | 308 | | textures = lhs.textures + rhs.textures, |
| | 309 | | triangles = lhs.triangles + rhs.triangles, |
| | 310 | | entities = lhs.entities + rhs.entities |
| | 311 | | }; |
| | 312 | | } |
| | 313 | | } |
| | 314 | |
|
| | 315 | | [System.Serializable] |
| | 316 | | private class OnMetricsUpdate |
| | 317 | | { |
| 1 | 318 | | public MetricsModel given = new MetricsModel(); |
| 1 | 319 | | public MetricsModel limit = new MetricsModel(); |
| | 320 | | } |
| | 321 | |
|
| | 322 | | [System.Serializable] |
| | 323 | | public class OnEnterEventPayload { } |
| | 324 | |
|
| | 325 | | [System.Serializable] |
| | 326 | | public class TransformPayload |
| | 327 | | { |
| 0 | 328 | | public Vector3 position = Vector3.zero; |
| 0 | 329 | | public Quaternion rotation = Quaternion.identity; |
| 0 | 330 | | public Vector3 scale = Vector3.one; |
| | 331 | | } |
| | 332 | |
|
| | 333 | | public class OnSendScreenshot |
| | 334 | | { |
| | 335 | | public string id; |
| | 336 | | public string encodedTexture; |
| | 337 | | }; |
| | 338 | |
|
| | 339 | | [System.Serializable] |
| | 340 | | public class GotoEvent |
| | 341 | | { |
| | 342 | | public int x; |
| | 343 | | public int y; |
| | 344 | | }; |
| | 345 | |
|
| | 346 | | [System.Serializable] |
| | 347 | | public class BaseResolution |
| | 348 | | { |
| | 349 | | public int baseResolution; |
| | 350 | | }; |
| | 351 | |
|
| | 352 | | //----------------------------------------------------- |
| | 353 | | // Raycast |
| | 354 | | [System.Serializable] |
| | 355 | | public class RayInfo |
| | 356 | | { |
| | 357 | | public Vector3 origin; |
| | 358 | | public Vector3 direction; |
| | 359 | | public float distance; |
| | 360 | | } |
| | 361 | |
|
| | 362 | | [System.Serializable] |
| | 363 | | public class RaycastHitInfo |
| | 364 | | { |
| | 365 | | public bool didHit; |
| | 366 | | public RayInfo ray; |
| | 367 | |
|
| | 368 | | public Vector3 hitPoint; |
| | 369 | | public Vector3 hitNormal; |
| | 370 | | } |
| | 371 | |
|
| | 372 | | [System.Serializable] |
| | 373 | | public class HitEntityInfo |
| | 374 | | { |
| | 375 | | public string entityId; |
| | 376 | | public string meshName; |
| | 377 | | } |
| | 378 | |
|
| | 379 | | [System.Serializable] |
| | 380 | | public class RaycastHitEntity : RaycastHitInfo |
| | 381 | | { |
| | 382 | | public HitEntityInfo entity; |
| | 383 | | } |
| | 384 | |
|
| | 385 | | [System.Serializable] |
| | 386 | | public class RaycastHitEntities : RaycastHitInfo |
| | 387 | | { |
| | 388 | | public RaycastHitEntity[] entities; |
| | 389 | | } |
| | 390 | |
|
| | 391 | | [System.Serializable] |
| | 392 | | public class RaycastResponse<T> where T : RaycastHitInfo |
| | 393 | | { |
| | 394 | | public string queryId; |
| | 395 | | public string queryType; |
| | 396 | | public T payload; |
| | 397 | | } |
| | 398 | |
|
| | 399 | | // Note (Zak): We need to explicitly define this classes for the JsonUtility to |
| | 400 | | // be able to serialize them |
| | 401 | | [System.Serializable] |
| | 402 | | public class RaycastHitFirstResponse : RaycastResponse<RaycastHitEntity> { } |
| | 403 | |
|
| | 404 | | [System.Serializable] |
| | 405 | | public class RaycastHitAllResponse : RaycastResponse<RaycastHitEntities> { } |
| | 406 | |
|
| | 407 | | [System.Serializable] |
| | 408 | | public class SendExpressionPayload |
| | 409 | | { |
| | 410 | | public string id; |
| | 411 | | public long timestamp; |
| | 412 | | } |
| | 413 | |
|
| | 414 | | [System.Serializable] |
| | 415 | | public class UserAcceptedCollectiblesPayload |
| | 416 | | { |
| | 417 | | public string id; |
| | 418 | | } |
| | 419 | |
|
| | 420 | | [System.Serializable] |
| | 421 | | public class SendBlockPlayerPayload |
| | 422 | | { |
| | 423 | | public string userId; |
| | 424 | | } |
| | 425 | |
|
| | 426 | | [System.Serializable] |
| | 427 | | public class SendUnblockPlayerPayload |
| | 428 | | { |
| | 429 | | public string userId; |
| | 430 | | } |
| | 431 | |
|
| | 432 | | [System.Serializable] |
| | 433 | | public class TutorialStepPayload |
| | 434 | | { |
| | 435 | | public int tutorialStep; |
| | 436 | | } |
| | 437 | |
|
| | 438 | | [System.Serializable] |
| | 439 | | public class PerformanceReportPayload |
| | 440 | | { |
| | 441 | | public string samples; |
| | 442 | | public bool fpsIsCapped; |
| | 443 | | public int hiccupsInThousandFrames; |
| | 444 | | public float hiccupsTime; |
| | 445 | | public float totalTime; |
| | 446 | | } |
| | 447 | |
|
| | 448 | | [System.Serializable] |
| | 449 | | public class SystemInfoReportPayload |
| | 450 | | { |
| 0 | 451 | | public string graphicsDeviceName = SystemInfo.graphicsDeviceName; |
| 0 | 452 | | public string graphicsDeviceVersion = SystemInfo.graphicsDeviceVersion; |
| 0 | 453 | | public int graphicsMemorySize = SystemInfo.graphicsMemorySize; |
| 0 | 454 | | public string processorType = SystemInfo.processorType; |
| 0 | 455 | | public int processorCount = SystemInfo.processorCount; |
| 0 | 456 | | public int systemMemorySize = SystemInfo.systemMemorySize; |
| | 457 | | } |
| | 458 | |
|
| | 459 | | [System.Serializable] |
| | 460 | | public class GenericAnalyticPayload |
| | 461 | | { |
| | 462 | | public string eventName; |
| | 463 | | public Dictionary<object, object> data; |
| | 464 | | } |
| | 465 | |
|
| | 466 | | [System.Serializable] |
| | 467 | | public class PerformanceHiccupPayload |
| | 468 | | { |
| | 469 | | public int hiccupsInThousandFrames; |
| | 470 | | public float hiccupsTime; |
| | 471 | | public float totalTime; |
| | 472 | | } |
| | 473 | |
|
| | 474 | | [System.Serializable] |
| | 475 | | public class TermsOfServiceResponsePayload |
| | 476 | | { |
| | 477 | | public string sceneId; |
| | 478 | | public bool dontShowAgain; |
| | 479 | | public bool accepted; |
| | 480 | | } |
| | 481 | |
|
| | 482 | | [System.Serializable] |
| | 483 | | public class OpenURLPayload |
| | 484 | | { |
| | 485 | | public string url; |
| | 486 | | } |
| | 487 | |
|
| | 488 | | [System.Serializable] |
| | 489 | | public class GIFSetupPayload |
| | 490 | | { |
| | 491 | | public string imageSource; |
| | 492 | | public string id; |
| | 493 | | public bool isWebGL1; |
| | 494 | | } |
| | 495 | |
|
| | 496 | | [System.Serializable] |
| | 497 | | public class RequestScenesInfoAroundParcelPayload |
| | 498 | | { |
| | 499 | | public Vector2 parcel; |
| | 500 | | public int scenesAround; |
| | 501 | | } |
| | 502 | |
|
| | 503 | | [System.Serializable] |
| | 504 | | public class AudioStreamingPayload |
| | 505 | | { |
| | 506 | | public string url; |
| | 507 | | public bool play; |
| | 508 | | public float volume; |
| | 509 | | } |
| | 510 | |
|
| | 511 | | [System.Serializable] |
| | 512 | | public class SetScenesLoadRadiusPayload |
| | 513 | | { |
| | 514 | | public float newRadius; |
| | 515 | | } |
| | 516 | |
|
| | 517 | | [System.Serializable] |
| | 518 | | public class SetVoiceChatRecordingPayload |
| | 519 | | { |
| | 520 | | public bool recording; |
| | 521 | | } |
| | 522 | |
|
| | 523 | | [System.Serializable] |
| | 524 | | public class ApplySettingsPayload |
| | 525 | | { |
| | 526 | | public float voiceChatVolume; |
| | 527 | | public int voiceChatAllowCategory; |
| | 528 | | } |
| | 529 | |
|
| | 530 | | [System.Serializable] |
| | 531 | | public class JumpInPayload |
| | 532 | | { |
| 0 | 533 | | public FriendsController.UserStatus.Realm realm = new FriendsController.UserStatus.Realm(); |
| | 534 | | public Vector2 gridPosition; |
| | 535 | | } |
| | 536 | |
|
| | 537 | | [System.Serializable] |
| | 538 | | public class LoadingFeedbackMessage |
| | 539 | | { |
| | 540 | | public string message; |
| | 541 | | public int loadPercentage; |
| | 542 | | } |
| | 543 | |
|
| | 544 | | [System.Serializable] |
| | 545 | | public class AnalyticsPayload |
| | 546 | | { |
| | 547 | | [System.Serializable] |
| | 548 | | public class Property |
| | 549 | | { |
| | 550 | | public string key; |
| | 551 | | public string value; |
| | 552 | |
|
| 101 | 553 | | public Property(string key, string value) |
| | 554 | | { |
| 101 | 555 | | this.key = key; |
| 101 | 556 | | this.value = value; |
| 101 | 557 | | } |
| | 558 | | } |
| | 559 | |
|
| | 560 | | public string name; |
| | 561 | | public Property[] properties; |
| | 562 | | } |
| | 563 | |
|
| | 564 | | [System.Serializable] |
| | 565 | | public class DelightedSurveyEnabledPayload |
| | 566 | | { |
| | 567 | | public bool enabled; |
| | 568 | | } |
| | 569 | |
|
| | 570 | | [System.Serializable] |
| | 571 | | public class ExternalActionSceneEventPayload |
| | 572 | | { |
| | 573 | | public string type; |
| | 574 | | public string payload; |
| | 575 | | } |
| | 576 | |
|
| | 577 | | [System.Serializable] |
| | 578 | | public class MuteUserPayload |
| | 579 | | { |
| | 580 | | public string[] usersId; |
| | 581 | | public bool mute; |
| | 582 | | } |
| | 583 | |
|
| | 584 | | [System.Serializable] |
| | 585 | | public class CloseUserAvatarPayload |
| | 586 | | { |
| | 587 | | public bool isSignUpFlow; |
| | 588 | | } |
| | 589 | |
|
| | 590 | | [System.Serializable] |
| | 591 | | public class StringPayload |
| | 592 | | { |
| | 593 | | public string value; |
| | 594 | | } |
| | 595 | |
|
| | 596 | | [System.Serializable] |
| | 597 | | public class KillPortableExperiencePayload |
| | 598 | | { |
| | 599 | | public string portableExperienceId; |
| | 600 | | } |
| | 601 | |
|
| | 602 | | [System.Serializable] |
| | 603 | | public class WearablesRequestFiltersPayload |
| | 604 | | { |
| | 605 | | public string ownedByUser; |
| | 606 | | public string[] wearableIds; |
| | 607 | | public string[] collectionIds; |
| | 608 | | } |
| | 609 | |
|
| | 610 | | [System.Serializable] |
| | 611 | | public class RequestWearablesPayload |
| | 612 | | { |
| | 613 | | public WearablesRequestFiltersPayload filters; |
| | 614 | | public string context; |
| | 615 | | } |
| | 616 | |
|
| | 617 | | [System.Serializable] |
| | 618 | | public class HeadersPayload |
| | 619 | | { |
| | 620 | | public string method; |
| | 621 | | public string url; |
| 1 | 622 | | public Dictionary<string, object> metadata = new Dictionary<string, object>(); |
| | 623 | | } |
| | 624 | |
|
| | 625 | | [System.Serializable] |
| | 626 | | public class SearchENSOwnerPayload |
| | 627 | | { |
| | 628 | | public string name; |
| | 629 | | public int maxResults; |
| | 630 | | } |
| | 631 | |
|
| | 632 | | [System.Serializable] |
| | 633 | | public class UnpublishScenePayload |
| | 634 | | { |
| | 635 | | public string coordinates; |
| | 636 | | } |
| | 637 | |
|
| | 638 | | [System.Serializable] |
| | 639 | | public class AvatarStateBase |
| | 640 | | { |
| | 641 | | public string type; |
| | 642 | | public string entityId; |
| | 643 | | public string avatarShapeId; |
| | 644 | | } |
| | 645 | |
|
| | 646 | | [System.Serializable] |
| | 647 | | public class AvatarStateSceneChanged : AvatarStateBase |
| | 648 | | { |
| | 649 | | public string sceneId; |
| | 650 | | } |
| | 651 | |
|
| | 652 | | [System.Serializable] |
| | 653 | | public class AvatarOnClickPayload |
| | 654 | | { |
| | 655 | | public string userId; |
| 0 | 656 | | public RayInfo ray = new RayInfo(); |
| | 657 | | } |
| | 658 | |
|
| | 659 | | #if UNITY_WEBGL && !UNITY_EDITOR |
| | 660 | | /** |
| | 661 | | * This method is called after the first render. It marks the loading of the |
| | 662 | | * rest of the JS client. |
| | 663 | | */ |
| | 664 | | [DllImport("__Internal")] public static extern void StartDecentraland(); |
| | 665 | | [DllImport("__Internal")] public static extern void MessageFromEngine(string type, string message); |
| | 666 | | [DllImport("__Internal")] public static extern string GetGraphicCard(); |
| | 667 | | [DllImport("__Internal")] public static extern bool CheckURLParam(string targetParam); |
| | 668 | |
|
| | 669 | | public static System.Action<string, string> OnMessageFromEngine; |
| | 670 | | #else |
| | 671 | | public static Action<string, string> OnMessageFromEngine |
| | 672 | | { |
| | 673 | | set |
| | 674 | | { |
| 72 | 675 | | OnMessage = value; |
| 72 | 676 | | if (OnMessage != null) |
| | 677 | | { |
| 36 | 678 | | ProcessQueuedMessages(); |
| | 679 | | } |
| 72 | 680 | | } |
| 0 | 681 | | get => OnMessage; |
| | 682 | | } |
| | 683 | | private static Action<string, string> OnMessage; |
| | 684 | |
|
| 1 | 685 | | private static bool hasQueuedMessages = false; |
| 1 | 686 | | private static List<(string, string)> queuedMessages = new List<(string, string)>(); |
| 0 | 687 | | public static void StartDecentraland() { } |
| | 688 | | public static bool CheckURLParam(string targetParam) |
| | 689 | | { |
| 0 | 690 | | return false; |
| | 691 | | } |
| | 692 | |
|
| | 693 | | public static void MessageFromEngine(string type, string message) |
| | 694 | | { |
| 3810 | 695 | | if (OnMessageFromEngine != null) |
| | 696 | | { |
| 1936 | 697 | | if (hasQueuedMessages) |
| | 698 | | { |
| 0 | 699 | | ProcessQueuedMessages(); |
| | 700 | | } |
| | 701 | |
|
| 1936 | 702 | | OnMessageFromEngine.Invoke(type, message); |
| 1936 | 703 | | if (VERBOSE) |
| | 704 | | { |
| 0 | 705 | | Debug.Log("MessageFromEngine called with: " + type + ", " + message); |
| | 706 | | } |
| 0 | 707 | | } |
| | 708 | | else |
| | 709 | | { |
| 1874 | 710 | | lock (queuedMessages) |
| | 711 | | { |
| 1874 | 712 | | queuedMessages.Add((type, message)); |
| 1874 | 713 | | } |
| | 714 | |
|
| 1874 | 715 | | hasQueuedMessages = true; |
| | 716 | | } |
| 3810 | 717 | | } |
| | 718 | |
|
| | 719 | | private static void ProcessQueuedMessages() |
| | 720 | | { |
| 36 | 721 | | hasQueuedMessages = false; |
| 36 | 722 | | lock (queuedMessages) |
| | 723 | | { |
| 3818 | 724 | | foreach ((string type, string payload) in queuedMessages) |
| | 725 | | { |
| 1873 | 726 | | MessageFromEngine(type, payload); |
| | 727 | | } |
| | 728 | |
|
| 36 | 729 | | queuedMessages.Clear(); |
| 36 | 730 | | } |
| 36 | 731 | | } |
| | 732 | |
|
| 0 | 733 | | public static string GetGraphicCard() => "In Editor Graphic Card"; |
| | 734 | | #endif |
| | 735 | |
|
| | 736 | | public static void SendMessage(string type) |
| | 737 | | { |
| | 738 | | // sending an empty JSON object to be compatible with other messages |
| 3 | 739 | | MessageFromEngine(type, "{}"); |
| 3 | 740 | | } |
| | 741 | |
|
| | 742 | | public static void SendMessage<T>(string type, T message) |
| | 743 | | { |
| 1929 | 744 | | string messageJson = JsonUtility.ToJson(message); |
| | 745 | |
|
| 1929 | 746 | | if (VERBOSE) |
| | 747 | | { |
| 0 | 748 | | Debug.Log($"Sending message: " + messageJson); |
| | 749 | | } |
| | 750 | |
|
| 1929 | 751 | | MessageFromEngine(type, messageJson); |
| 1929 | 752 | | } |
| | 753 | |
|
| 1 | 754 | | private static ReportPositionPayload positionPayload = new ReportPositionPayload(); |
| 1 | 755 | | private static CameraModePayload cameraModePayload = new CameraModePayload(); |
| 1 | 756 | | private static IdleStateChangedPayload idleStateChangedPayload = new IdleStateChangedPayload(); |
| 1 | 757 | | private static OnMetricsUpdate onMetricsUpdate = new OnMetricsUpdate(); |
| 1 | 758 | | private static OnClickEvent onClickEvent = new OnClickEvent(); |
| 1 | 759 | | private static OnPointerDownEvent onPointerDownEvent = new OnPointerDownEvent(); |
| 1 | 760 | | private static OnPointerUpEvent onPointerUpEvent = new OnPointerUpEvent(); |
| 1 | 761 | | private static OnTextSubmitEvent onTextSubmitEvent = new OnTextSubmitEvent(); |
| 1 | 762 | | private static OnTextInputChangeEvent onTextInputChangeEvent = new OnTextInputChangeEvent(); |
| 1 | 763 | | private static OnTextInputChangeTextEvent onTextInputChangeTextEvent = new OnTextInputChangeTextEvent(); |
| 1 | 764 | | private static OnScrollChangeEvent onScrollChangeEvent = new OnScrollChangeEvent(); |
| 1 | 765 | | private static OnFocusEvent onFocusEvent = new OnFocusEvent(); |
| 1 | 766 | | private static OnBlurEvent onBlurEvent = new OnBlurEvent(); |
| 1 | 767 | | private static OnEnterEvent onEnterEvent = new OnEnterEvent(); |
| 1 | 768 | | private static OnSendScreenshot onSendScreenshot = new OnSendScreenshot(); |
| 1 | 769 | | private static OnPointerEventPayload onPointerEventPayload = new OnPointerEventPayload(); |
| 1 | 770 | | private static OnGlobalPointerEventPayload onGlobalPointerEventPayload = new OnGlobalPointerEventPayload(); |
| 1 | 771 | | private static OnGlobalPointerEvent onGlobalPointerEvent = new OnGlobalPointerEvent(); |
| 1 | 772 | | private static AudioStreamingPayload onAudioStreamingEvent = new AudioStreamingPayload(); |
| 1 | 773 | | private static SetVoiceChatRecordingPayload setVoiceChatRecordingPayload = new SetVoiceChatRecordingPayload(); |
| 1 | 774 | | private static SetScenesLoadRadiusPayload setScenesLoadRadiusPayload = new SetScenesLoadRadiusPayload(); |
| 1 | 775 | | private static ApplySettingsPayload applySettingsPayload = new ApplySettingsPayload(); |
| 1 | 776 | | private static GIFSetupPayload gifSetupPayload = new GIFSetupPayload(); |
| 1 | 777 | | private static JumpInPayload jumpInPayload = new JumpInPayload(); |
| 1 | 778 | | private static GotoEvent gotoEvent = new GotoEvent(); |
| 1 | 779 | | private static SendChatMessageEvent sendChatMessageEvent = new SendChatMessageEvent(); |
| 1 | 780 | | private static BaseResolution baseResEvent = new BaseResolution(); |
| 1 | 781 | | private static AnalyticsPayload analyticsEvent = new AnalyticsPayload(); |
| 1 | 782 | | private static DelightedSurveyEnabledPayload delightedSurveyEnabled = new DelightedSurveyEnabledPayload(); |
| 1 | 783 | | private static ExternalActionSceneEventPayload sceneExternalActionEvent = new ExternalActionSceneEventPayload(); |
| 1 | 784 | | private static MuteUserPayload muteUserEvent = new MuteUserPayload(); |
| 1 | 785 | | private static StoreSceneStateEvent storeSceneState = new StoreSceneStateEvent(); |
| 1 | 786 | | private static CloseUserAvatarPayload closeUserAvatarPayload = new CloseUserAvatarPayload(); |
| 1 | 787 | | private static StringPayload stringPayload = new StringPayload(); |
| 1 | 788 | | private static KillPortableExperiencePayload killPortableExperiencePayload = new KillPortableExperiencePayload() |
| 1 | 789 | | private static RequestWearablesPayload requestWearablesPayload = new RequestWearablesPayload(); |
| 1 | 790 | | private static SearchENSOwnerPayload searchEnsOwnerPayload = new SearchENSOwnerPayload(); |
| 1 | 791 | | private static HeadersPayload headersPayload = new HeadersPayload(); |
| 1 | 792 | | private static AvatarStateBase avatarStatePayload = new AvatarStateBase(); |
| 1 | 793 | | private static AvatarStateSceneChanged avatarSceneChangedPayload = new AvatarStateSceneChanged(); |
| 1 | 794 | | public static AvatarOnClickPayload avatarOnClickPayload = new AvatarOnClickPayload(); |
| | 795 | |
|
| | 796 | | public static void SendSceneEvent<T>(string sceneId, string eventType, T payload) |
| | 797 | | { |
| 655 | 798 | | SceneEvent<T> sceneEvent = new SceneEvent<T>(); |
| 655 | 799 | | sceneEvent.sceneId = sceneId; |
| 655 | 800 | | sceneEvent.eventType = eventType; |
| 655 | 801 | | sceneEvent.payload = payload; |
| | 802 | |
|
| 655 | 803 | | SendMessage("SceneEvent", sceneEvent); |
| 655 | 804 | | } |
| | 805 | |
|
| | 806 | | private static void SendAllScenesEvent<T>(string eventType, T payload) |
| | 807 | | { |
| 614 | 808 | | AllScenesEvent<T> allScenesEvent = new AllScenesEvent<T>(); |
| 614 | 809 | | allScenesEvent.eventType = eventType; |
| 614 | 810 | | allScenesEvent.payload = payload; |
| | 811 | |
|
| 614 | 812 | | SendMessage("AllScenesEvent", allScenesEvent); |
| 614 | 813 | | } |
| | 814 | |
|
| | 815 | | public static void ReportPosition(Vector3 position, Quaternion rotation, float playerHeight) |
| | 816 | | { |
| 37 | 817 | | positionPayload.position = position; |
| 37 | 818 | | positionPayload.rotation = rotation; |
| 37 | 819 | | positionPayload.playerHeight = playerHeight; |
| | 820 | |
|
| 37 | 821 | | SendMessage("ReportPosition", positionPayload); |
| 37 | 822 | | } |
| | 823 | |
|
| | 824 | | public static void ReportCameraChanged(CameraMode.ModeId cameraMode) |
| | 825 | | { |
| 613 | 826 | | ReportCameraChanged(cameraMode, null); |
| 613 | 827 | | } |
| | 828 | |
|
| | 829 | | public static void ReportCameraChanged(CameraMode.ModeId cameraMode, string targetSceneId) |
| | 830 | | { |
| 1011 | 831 | | cameraModePayload.cameraMode = cameraMode; |
| 1011 | 832 | | if (!string.IsNullOrEmpty(targetSceneId)) |
| | 833 | | { |
| 398 | 834 | | SendSceneEvent(targetSceneId, "cameraModeChanged", cameraModePayload); |
| 398 | 835 | | } |
| | 836 | | else |
| | 837 | | { |
| 613 | 838 | | SendAllScenesEvent("cameraModeChanged", cameraModePayload); |
| | 839 | | } |
| 613 | 840 | | } |
| | 841 | |
|
| | 842 | | public static void ReportIdleStateChanged(bool isIdle) |
| | 843 | | { |
| 1 | 844 | | idleStateChangedPayload.isIdle = isIdle; |
| 1 | 845 | | SendAllScenesEvent("idleStateChanged", idleStateChangedPayload); |
| 1 | 846 | | } |
| | 847 | |
|
| | 848 | | public static void ReportControlEvent<T>(T controlEvent) where T : ControlEvent |
| | 849 | | { |
| 403 | 850 | | SendMessage("ControlEvent", controlEvent); |
| 403 | 851 | | } |
| | 852 | |
|
| | 853 | | public static void SendRequestHeadersForUrl(string eventName, string method, string url, Dictionary<string, obje |
| | 854 | | { |
| 0 | 855 | | headersPayload.method = method; |
| 0 | 856 | | headersPayload.url = url; |
| 0 | 857 | | if (metadata != null) |
| 0 | 858 | | headersPayload.metadata = metadata; |
| 0 | 859 | | SendMessage(eventName, headersPayload); |
| 0 | 860 | | } |
| | 861 | |
|
| | 862 | | public static void BuilderInWorldMessage(string type, string message) |
| | 863 | | { |
| 5 | 864 | | MessageFromEngine(type, message); |
| 5 | 865 | | } |
| | 866 | |
|
| | 867 | | public static void ReportOnClickEvent(string sceneId, string uuid) |
| | 868 | | { |
| 6 | 869 | | if (string.IsNullOrEmpty(uuid)) |
| | 870 | | { |
| 0 | 871 | | return; |
| | 872 | | } |
| | 873 | |
|
| 6 | 874 | | onClickEvent.uuid = uuid; |
| | 875 | |
|
| 6 | 876 | | SendSceneEvent(sceneId, "uuidEvent", onClickEvent); |
| 6 | 877 | | } |
| | 878 | |
|
| | 879 | | private static void ReportRaycastResult<T, P>(string sceneId, string queryId, string queryType, P payload) where |
| | 880 | | { |
| 0 | 881 | | T response = new T(); |
| 0 | 882 | | response.queryId = queryId; |
| 0 | 883 | | response.queryType = queryType; |
| 0 | 884 | | response.payload = payload; |
| | 885 | |
|
| 0 | 886 | | SendSceneEvent<T>(sceneId, "raycastResponse", response); |
| 0 | 887 | | } |
| | 888 | |
|
| | 889 | | public static void ReportRaycastHitFirstResult(string sceneId, string queryId, RaycastType raycastType, RaycastH |
| | 890 | | { |
| 0 | 891 | | ReportRaycastResult<RaycastHitFirstResponse, RaycastHitEntity>(sceneId, queryId, Protocol.RaycastTypeToLiter |
| 0 | 892 | | } |
| | 893 | |
|
| | 894 | | public static void ReportRaycastHitAllResult(string sceneId, string queryId, RaycastType raycastType, RaycastHit |
| | 895 | | { |
| 0 | 896 | | ReportRaycastResult<RaycastHitAllResponse, RaycastHitEntities>(sceneId, queryId, Protocol.RaycastTypeToLiter |
| 0 | 897 | | } |
| | 898 | |
|
| | 899 | | private static OnPointerEventPayload.Hit CreateHitObject(string entityId, string meshName, Vector3 point, Vector |
| | 900 | | { |
| 19 | 901 | | OnPointerEventPayload.Hit hit = new OnPointerEventPayload.Hit(); |
| | 902 | |
|
| 19 | 903 | | hit.hitPoint = point; |
| 19 | 904 | | hit.length = distance; |
| 19 | 905 | | hit.normal = normal; |
| 19 | 906 | | hit.worldNormal = normal; |
| 19 | 907 | | hit.meshName = meshName; |
| 19 | 908 | | hit.entityId = entityId; |
| | 909 | |
|
| 19 | 910 | | return hit; |
| | 911 | | } |
| | 912 | |
|
| | 913 | | private static void SetPointerEventPayload(OnPointerEventPayload pointerEventPayload, ACTION_BUTTON buttonId, st |
| | 914 | | { |
| 20 | 915 | | pointerEventPayload.origin = ray.origin; |
| 20 | 916 | | pointerEventPayload.direction = ray.direction; |
| 20 | 917 | | pointerEventPayload.buttonId = buttonId; |
| | 918 | |
|
| 20 | 919 | | if (isHitInfoValid) |
| 19 | 920 | | pointerEventPayload.hit = CreateHitObject(entityId, meshName, point, normal, distance); |
| | 921 | | else |
| 1 | 922 | | pointerEventPayload.hit = null; |
| 1 | 923 | | } |
| | 924 | |
|
| | 925 | | public static void ReportGlobalPointerDownEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal, |
| | 926 | | { |
| 11 | 927 | | SetPointerEventPayload((OnPointerEventPayload)onGlobalPointerEventPayload, buttonId, entityId, meshName, ray |
| 11 | 928 | | onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.DOWN; |
| | 929 | |
|
| 11 | 930 | | onGlobalPointerEvent.payload = onGlobalPointerEventPayload; |
| | 931 | |
|
| 11 | 932 | | SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent); |
| 11 | 933 | | } |
| | 934 | |
|
| | 935 | | public static void ReportGlobalPointerUpEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal, fl |
| | 936 | | { |
| 3 | 937 | | SetPointerEventPayload((OnPointerEventPayload)onGlobalPointerEventPayload, buttonId, entityId, meshName, ray |
| 3 | 938 | | onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.UP; |
| | 939 | |
|
| 3 | 940 | | onGlobalPointerEvent.payload = onGlobalPointerEventPayload; |
| | 941 | |
|
| 3 | 942 | | SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent); |
| 3 | 943 | | } |
| | 944 | |
|
| | 945 | | public static void ReportOnPointerDownEvent(ACTION_BUTTON buttonId, string sceneId, string uuid, string entityId |
| | 946 | | { |
| 4 | 947 | | if (string.IsNullOrEmpty(uuid)) |
| | 948 | | { |
| 0 | 949 | | return; |
| | 950 | | } |
| | 951 | |
|
| 4 | 952 | | onPointerDownEvent.uuid = uuid; |
| 4 | 953 | | SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point, normal, distance, is |
| 4 | 954 | | onPointerDownEvent.payload = onPointerEventPayload; |
| | 955 | |
|
| 4 | 956 | | SendSceneEvent(sceneId, "uuidEvent", onPointerDownEvent); |
| 4 | 957 | | } |
| | 958 | |
|
| | 959 | | public static void ReportOnPointerUpEvent(ACTION_BUTTON buttonId, string sceneId, string uuid, string entityId, |
| | 960 | | { |
| 2 | 961 | | if (string.IsNullOrEmpty(uuid)) |
| | 962 | | { |
| 0 | 963 | | return; |
| | 964 | | } |
| | 965 | |
|
| 2 | 966 | | onPointerUpEvent.uuid = uuid; |
| 2 | 967 | | SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point, normal, distance, is |
| 2 | 968 | | onPointerUpEvent.payload = onPointerEventPayload; |
| | 969 | |
|
| 2 | 970 | | SendSceneEvent(sceneId, "uuidEvent", onPointerUpEvent); |
| 2 | 971 | | } |
| | 972 | |
|
| | 973 | | public static void ReportOnTextSubmitEvent(string sceneId, string uuid, string text) |
| | 974 | | { |
| 2 | 975 | | if (string.IsNullOrEmpty(uuid)) |
| | 976 | | { |
| 0 | 977 | | return; |
| | 978 | | } |
| | 979 | |
|
| 2 | 980 | | onTextSubmitEvent.uuid = uuid; |
| 2 | 981 | | onTextSubmitEvent.payload.text = text; |
| | 982 | |
|
| 2 | 983 | | SendSceneEvent(sceneId, "uuidEvent", onTextSubmitEvent); |
| 2 | 984 | | } |
| | 985 | |
|
| | 986 | | public static void ReportOnTextInputChangedEvent(string sceneId, string uuid, string text) |
| | 987 | | { |
| 17 | 988 | | if (string.IsNullOrEmpty(uuid)) |
| | 989 | | { |
| 17 | 990 | | return; |
| | 991 | | } |
| | 992 | |
|
| 0 | 993 | | onTextInputChangeEvent.uuid = uuid; |
| 0 | 994 | | onTextInputChangeEvent.payload.value = text; |
| | 995 | |
|
| 0 | 996 | | SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeEvent); |
| 0 | 997 | | } |
| | 998 | |
|
| | 999 | | public static void ReportOnTextInputChangedTextEvent(string sceneId, string uuid, string text, bool isSubmit) |
| | 1000 | | { |
| 19 | 1001 | | if (string.IsNullOrEmpty(uuid)) |
| | 1002 | | { |
| 16 | 1003 | | return; |
| | 1004 | | } |
| | 1005 | |
|
| 3 | 1006 | | onTextInputChangeTextEvent.uuid = uuid; |
| 3 | 1007 | | onTextInputChangeTextEvent.payload.value.value = text; |
| 3 | 1008 | | onTextInputChangeTextEvent.payload.value.isSubmit = isSubmit; |
| | 1009 | |
|
| 3 | 1010 | | SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeTextEvent); |
| 3 | 1011 | | } |
| | 1012 | |
|
| | 1013 | | public static void ReportOnFocusEvent(string sceneId, string uuid) |
| | 1014 | | { |
| 2 | 1015 | | if (string.IsNullOrEmpty(uuid)) |
| | 1016 | | { |
| 2 | 1017 | | return; |
| | 1018 | | } |
| | 1019 | |
|
| 0 | 1020 | | onFocusEvent.uuid = uuid; |
| 0 | 1021 | | SendSceneEvent(sceneId, "uuidEvent", onFocusEvent); |
| 0 | 1022 | | } |
| | 1023 | |
|
| | 1024 | | public static void ReportOnBlurEvent(string sceneId, string uuid) |
| | 1025 | | { |
| 2 | 1026 | | if (string.IsNullOrEmpty(uuid)) |
| | 1027 | | { |
| 2 | 1028 | | return; |
| | 1029 | | } |
| | 1030 | |
|
| 0 | 1031 | | onBlurEvent.uuid = uuid; |
| 0 | 1032 | | SendSceneEvent(sceneId, "uuidEvent", onBlurEvent); |
| 0 | 1033 | | } |
| | 1034 | |
|
| | 1035 | | public static void ReportOnScrollChange(string sceneId, string uuid, Vector2 value, int pointerId) |
| | 1036 | | { |
| 13 | 1037 | | if (string.IsNullOrEmpty(uuid)) |
| | 1038 | | { |
| 11 | 1039 | | return; |
| | 1040 | | } |
| | 1041 | |
|
| 2 | 1042 | | onScrollChangeEvent.uuid = uuid; |
| 2 | 1043 | | onScrollChangeEvent.payload.value = value; |
| 2 | 1044 | | onScrollChangeEvent.payload.pointerId = pointerId; |
| | 1045 | |
|
| 2 | 1046 | | SendSceneEvent(sceneId, "uuidEvent", onScrollChangeEvent); |
| 2 | 1047 | | } |
| | 1048 | |
|
| | 1049 | | public static void ReportEvent<T>(string sceneId, T @event) |
| | 1050 | | { |
| 0 | 1051 | | SendSceneEvent(sceneId, "uuidEvent", @event); |
| 0 | 1052 | | } |
| | 1053 | |
|
| | 1054 | | public static void ReportOnMetricsUpdate(string sceneId, MetricsModel current, |
| | 1055 | | MetricsModel limit) |
| | 1056 | | { |
| 150 | 1057 | | onMetricsUpdate.given = current; |
| 150 | 1058 | | onMetricsUpdate.limit = limit; |
| | 1059 | |
|
| 150 | 1060 | | SendSceneEvent(sceneId, "metricsUpdate", onMetricsUpdate); |
| 150 | 1061 | | } |
| | 1062 | |
|
| | 1063 | | public static void ReportOnEnterEvent(string sceneId, string uuid) |
| | 1064 | | { |
| 0 | 1065 | | if (string.IsNullOrEmpty(uuid)) |
| 0 | 1066 | | return; |
| | 1067 | |
|
| 0 | 1068 | | onEnterEvent.uuid = uuid; |
| | 1069 | |
|
| 0 | 1070 | | SendSceneEvent(sceneId, "uuidEvent", onEnterEvent); |
| 0 | 1071 | | } |
| | 1072 | |
|
| | 1073 | | public static void LogOut() |
| | 1074 | | { |
| 0 | 1075 | | SendMessage("LogOut"); |
| 0 | 1076 | | } |
| | 1077 | |
|
| | 1078 | | public static void RedirectToSignUp() |
| | 1079 | | { |
| 0 | 1080 | | SendMessage("RedirectToSignUp"); |
| 0 | 1081 | | } |
| | 1082 | |
|
| | 1083 | | public static void PreloadFinished(string sceneId) |
| | 1084 | | { |
| 0 | 1085 | | SendMessage("PreloadFinished", sceneId); |
| 0 | 1086 | | } |
| | 1087 | |
|
| | 1088 | | public static void ReportMousePosition(Vector3 mousePosition, string id) |
| | 1089 | | { |
| 0 | 1090 | | positionPayload.mousePosition = mousePosition; |
| 0 | 1091 | | positionPayload.id = id; |
| 0 | 1092 | | SendMessage("ReportMousePosition", positionPayload); |
| 0 | 1093 | | } |
| | 1094 | |
|
| | 1095 | | public static void SendScreenshot(string encodedTexture, string id) |
| | 1096 | | { |
| 0 | 1097 | | onSendScreenshot.encodedTexture = encodedTexture; |
| 0 | 1098 | | onSendScreenshot.id = id; |
| 0 | 1099 | | SendMessage("SendScreenshot", onSendScreenshot); |
| 0 | 1100 | | } |
| | 1101 | |
|
| | 1102 | | public static void SetDelightedSurveyEnabled(bool enabled) |
| | 1103 | | { |
| 66 | 1104 | | delightedSurveyEnabled.enabled = enabled; |
| 66 | 1105 | | SendMessage("SetDelightedSurveyEnabled", delightedSurveyEnabled); |
| 66 | 1106 | | } |
| | 1107 | |
|
| | 1108 | | public static void SetScenesLoadRadius(float newRadius) |
| | 1109 | | { |
| 1 | 1110 | | setScenesLoadRadiusPayload.newRadius = newRadius; |
| 1 | 1111 | | SendMessage("SetScenesLoadRadius", setScenesLoadRadiusPayload); |
| 1 | 1112 | | } |
| | 1113 | |
|
| | 1114 | | [System.Serializable] |
| | 1115 | | public class SaveAvatarPayload |
| | 1116 | | { |
| | 1117 | | public string face; |
| | 1118 | | public string face128; |
| | 1119 | | public string face256; |
| | 1120 | | public string body; |
| | 1121 | | public bool isSignUpFlow; |
| | 1122 | | public AvatarModel avatar; |
| | 1123 | | } |
| | 1124 | |
|
| | 1125 | | public static class RendererAuthenticationType |
| | 1126 | | { |
| 0 | 1127 | | public static string Guest => "guest"; |
| 0 | 1128 | | public static string WalletConnect => "wallet_connect"; |
| | 1129 | | } |
| | 1130 | |
|
| | 1131 | | [System.Serializable] |
| | 1132 | | public class SendAuthenticationPayload |
| | 1133 | | { |
| | 1134 | | public string rendererAuthenticationType; |
| | 1135 | | } |
| | 1136 | |
|
| | 1137 | | [System.Serializable] |
| | 1138 | | public class SendPassportPayload |
| | 1139 | | { |
| | 1140 | | public string name; |
| | 1141 | | public string email; |
| | 1142 | | } |
| | 1143 | |
|
| | 1144 | | [System.Serializable] |
| | 1145 | | public class SendSaveUserUnverifiedNamePayload |
| | 1146 | | { |
| | 1147 | | public string newUnverifiedName; |
| | 1148 | | } |
| | 1149 | |
|
| | 1150 | | [System.Serializable] |
| | 1151 | | public class SendSaveUserDescriptionPayload |
| | 1152 | | { |
| | 1153 | | public string description; |
| | 1154 | |
|
| 0 | 1155 | | public SendSaveUserDescriptionPayload(string description) |
| | 1156 | | { |
| 0 | 1157 | | this.description = description; |
| 0 | 1158 | | } |
| | 1159 | | } |
| | 1160 | |
|
| | 1161 | | [Serializable] |
| | 1162 | | public class SendVideoProgressEvent |
| | 1163 | | { |
| | 1164 | | public string componentId; |
| | 1165 | | public string sceneId; |
| | 1166 | | public string videoTextureId; |
| | 1167 | | public int status; |
| | 1168 | | public float currentOffset; |
| | 1169 | | public float videoLength; |
| | 1170 | | } |
| | 1171 | |
|
| | 1172 | | public static void RequestOwnProfileUpdate() |
| | 1173 | | { |
| 1 | 1174 | | SendMessage("RequestOwnProfileUpdate"); |
| 1 | 1175 | | } |
| | 1176 | |
|
| | 1177 | | public static void SendSaveAvatar(AvatarModel avatar, Texture2D faceSnapshot, Texture2D face128Snapshot, Texture |
| | 1178 | | { |
| 1 | 1179 | | var payload = new SaveAvatarPayload() |
| | 1180 | | { |
| | 1181 | | avatar = avatar, |
| | 1182 | | face = System.Convert.ToBase64String(faceSnapshot.EncodeToPNG()), |
| | 1183 | | face128 = System.Convert.ToBase64String(face128Snapshot.EncodeToPNG()), |
| | 1184 | | face256 = System.Convert.ToBase64String(face256Snapshot.EncodeToPNG()), |
| | 1185 | | body = System.Convert.ToBase64String(bodySnapshot.EncodeToPNG()), |
| | 1186 | | isSignUpFlow = isSignUpFlow |
| | 1187 | | }; |
| 1 | 1188 | | SendMessage("SaveUserAvatar", payload); |
| 1 | 1189 | | } |
| | 1190 | |
|
| | 1191 | | public static void SendAuthentication(string rendererAuthenticationType) |
| | 1192 | | { |
| 0 | 1193 | | SendMessage("SendAuthentication", new SendAuthenticationPayload { rendererAuthenticationType = rendererAuthe |
| 0 | 1194 | | } |
| | 1195 | |
|
| | 1196 | | public static void SendPassport(string name, string email) |
| | 1197 | | { |
| 1 | 1198 | | SendMessage("SendPassport", new SendPassportPayload { name = name, email = email }); |
| 1 | 1199 | | } |
| | 1200 | |
|
| | 1201 | | public static void SendSaveUserUnverifiedName(string newName) |
| | 1202 | | { |
| 0 | 1203 | | var payload = new SendSaveUserUnverifiedNamePayload() |
| | 1204 | | { |
| | 1205 | | newUnverifiedName = newName |
| | 1206 | | }; |
| | 1207 | |
|
| 0 | 1208 | | SendMessage("SaveUserUnverifiedName", payload); |
| 0 | 1209 | | } |
| | 1210 | |
|
| | 1211 | | public static void SendSaveUserDescription(string about) |
| | 1212 | | { |
| 0 | 1213 | | SendMessage("SaveUserDescription", new SendSaveUserDescriptionPayload(about)); |
| 0 | 1214 | | } |
| | 1215 | |
|
| | 1216 | | public static void SendUserAcceptedCollectibles(string airdropId) |
| | 1217 | | { |
| 1 | 1218 | | SendMessage("UserAcceptedCollectibles", new UserAcceptedCollectiblesPayload { id = airdropId }); |
| 1 | 1219 | | } |
| | 1220 | |
|
| | 1221 | | public static void SaveUserTutorialStep(int newTutorialStep) |
| | 1222 | | { |
| 21 | 1223 | | SendMessage("SaveUserTutorialStep", new TutorialStepPayload() { tutorialStep = newTutorialStep }); |
| 21 | 1224 | | } |
| | 1225 | |
|
| | 1226 | | public static void SendPerformanceReport(string encodedFrameTimesInMS, bool usingFPSCap, int hiccupsInThousandFr |
| | 1227 | | { |
| 0 | 1228 | | SendMessage("PerformanceReport", new PerformanceReportPayload() |
| | 1229 | | { |
| | 1230 | | samples = encodedFrameTimesInMS, |
| | 1231 | | fpsIsCapped = usingFPSCap, |
| | 1232 | | hiccupsInThousandFrames = hiccupsInThousandFrames, |
| | 1233 | | hiccupsTime = hiccupsTime, |
| | 1234 | | totalTime = totalTime |
| | 1235 | | }); |
| 0 | 1236 | | } |
| | 1237 | |
|
| | 1238 | | public static void SendSystemInfoReport() |
| | 1239 | | { |
| 0 | 1240 | | SendMessage("SystemInfoReport", new SystemInfoReportPayload()); |
| 0 | 1241 | | } |
| | 1242 | |
|
| | 1243 | | public static void SendTermsOfServiceResponse(string sceneId, bool accepted, bool dontShowAgain) |
| | 1244 | | { |
| 2 | 1245 | | var payload = new TermsOfServiceResponsePayload() |
| | 1246 | | { |
| | 1247 | | sceneId = sceneId, |
| | 1248 | | accepted = accepted, |
| | 1249 | | dontShowAgain = dontShowAgain |
| | 1250 | | }; |
| 2 | 1251 | | SendMessage("TermsOfServiceResponse", payload); |
| 2 | 1252 | | } |
| | 1253 | |
|
| | 1254 | | public static void SendExpression(string expressionID, long timestamp) |
| | 1255 | | { |
| 2 | 1256 | | SendMessage("TriggerExpression", new SendExpressionPayload() |
| | 1257 | | { |
| | 1258 | | id = expressionID, |
| | 1259 | | timestamp = timestamp |
| | 1260 | | }); |
| 2 | 1261 | | } |
| | 1262 | |
|
| | 1263 | | public static void ReportMotdClicked() |
| | 1264 | | { |
| 0 | 1265 | | SendMessage("MotdConfirmClicked"); |
| 0 | 1266 | | } |
| | 1267 | |
|
| | 1268 | | public static void OpenURL(string url) |
| | 1269 | | { |
| | 1270 | | #if UNITY_WEBGL |
| | 1271 | | SendMessage("OpenWebURL", new OpenURLPayload { url = url }); |
| | 1272 | | #else |
| 3 | 1273 | | Application.OpenURL(url); |
| | 1274 | | #endif |
| 3 | 1275 | | } |
| | 1276 | |
|
| | 1277 | | public static void SendReportScene(string sceneID) |
| | 1278 | | { |
| 0 | 1279 | | SendMessage("ReportScene", sceneID); |
| 0 | 1280 | | } |
| | 1281 | |
|
| | 1282 | | public static void SendReportPlayer(string playerName) |
| | 1283 | | { |
| 2 | 1284 | | SendMessage("ReportPlayer", playerName); |
| 2 | 1285 | | } |
| | 1286 | |
|
| | 1287 | | public static void SendBlockPlayer(string userId) |
| | 1288 | | { |
| 1 | 1289 | | SendMessage("BlockPlayer", new SendBlockPlayerPayload() |
| | 1290 | | { |
| | 1291 | | userId = userId |
| | 1292 | | }); |
| 1 | 1293 | | } |
| | 1294 | |
|
| | 1295 | | public static void SendUnblockPlayer(string userId) |
| | 1296 | | { |
| 0 | 1297 | | SendMessage("UnblockPlayer", new SendUnblockPlayerPayload() |
| | 1298 | | { |
| | 1299 | | userId = userId |
| | 1300 | | }); |
| 0 | 1301 | | } |
| | 1302 | |
|
| | 1303 | | public static void RequestScenesInfoAroundParcel(Vector2 parcel, int maxScenesArea) |
| | 1304 | | { |
| 0 | 1305 | | SendMessage("RequestScenesInfoInArea", new RequestScenesInfoAroundParcelPayload() |
| | 1306 | | { |
| | 1307 | | parcel = parcel, |
| | 1308 | | scenesAround = maxScenesArea |
| | 1309 | | }); |
| 0 | 1310 | | } |
| | 1311 | |
|
| | 1312 | | public static void SendAudioStreamEvent(string url, bool play, float volume) |
| | 1313 | | { |
| 1 | 1314 | | onAudioStreamingEvent.url = url; |
| 1 | 1315 | | onAudioStreamingEvent.play = play; |
| 1 | 1316 | | onAudioStreamingEvent.volume = volume; |
| 1 | 1317 | | SendMessage("SetAudioStream", onAudioStreamingEvent); |
| 1 | 1318 | | } |
| | 1319 | |
|
| | 1320 | | public static void SendSetVoiceChatRecording(bool recording) |
| | 1321 | | { |
| 0 | 1322 | | setVoiceChatRecordingPayload.recording = recording; |
| 0 | 1323 | | SendMessage("SetVoiceChatRecording", setVoiceChatRecordingPayload); |
| 0 | 1324 | | } |
| | 1325 | |
|
| | 1326 | | public static void ToggleVoiceChatRecording() |
| | 1327 | | { |
| 0 | 1328 | | SendMessage("ToggleVoiceChatRecording"); |
| 0 | 1329 | | } |
| | 1330 | |
|
| | 1331 | | public static void ApplySettings(float voiceChatVolume, int voiceChatAllowCategory) |
| | 1332 | | { |
| 6 | 1333 | | applySettingsPayload.voiceChatVolume = voiceChatVolume; |
| 6 | 1334 | | applySettingsPayload.voiceChatAllowCategory = voiceChatAllowCategory; |
| 6 | 1335 | | SendMessage("ApplySettings", applySettingsPayload); |
| 6 | 1336 | | } |
| | 1337 | |
|
| | 1338 | | public static void RequestGIFProcessor(string gifURL, string gifId, bool isWebGL1) |
| | 1339 | | { |
| 0 | 1340 | | gifSetupPayload.imageSource = gifURL; |
| 0 | 1341 | | gifSetupPayload.id = gifId; |
| 0 | 1342 | | gifSetupPayload.isWebGL1 = isWebGL1; |
| | 1343 | |
|
| 0 | 1344 | | SendMessage("RequestGIFProcessor", gifSetupPayload); |
| 0 | 1345 | | } |
| | 1346 | |
|
| | 1347 | | public static void DeleteGIF(string id) |
| | 1348 | | { |
| 0 | 1349 | | stringPayload.value = id; |
| 0 | 1350 | | SendMessage("DeleteGIF", stringPayload); |
| 0 | 1351 | | } |
| | 1352 | |
|
| | 1353 | | public static void GoTo(int x, int y) |
| | 1354 | | { |
| 4 | 1355 | | gotoEvent.x = x; |
| 4 | 1356 | | gotoEvent.y = y; |
| 4 | 1357 | | SendMessage("GoTo", gotoEvent); |
| 4 | 1358 | | } |
| | 1359 | |
|
| | 1360 | | public static void GoToCrowd() |
| | 1361 | | { |
| 0 | 1362 | | SendMessage("GoToCrowd"); |
| 0 | 1363 | | } |
| | 1364 | |
|
| | 1365 | | public static void GoToMagic() |
| | 1366 | | { |
| 0 | 1367 | | SendMessage("GoToMagic"); |
| 0 | 1368 | | } |
| | 1369 | |
|
| | 1370 | | public static void JumpIn(int x, int y, string serverName, string layerName) |
| | 1371 | | { |
| 3 | 1372 | | jumpInPayload.realm.serverName = serverName; |
| 3 | 1373 | | jumpInPayload.realm.layer = layerName; |
| | 1374 | |
|
| 3 | 1375 | | jumpInPayload.gridPosition.x = x; |
| 3 | 1376 | | jumpInPayload.gridPosition.y = y; |
| | 1377 | |
|
| 3 | 1378 | | SendMessage("JumpIn", jumpInPayload); |
| 3 | 1379 | | } |
| | 1380 | |
|
| | 1381 | | public static void SendChatMessage(ChatMessage message) |
| | 1382 | | { |
| 5 | 1383 | | sendChatMessageEvent.message = message; |
| 5 | 1384 | | SendMessage("SendChatMessage", sendChatMessageEvent); |
| 5 | 1385 | | } |
| | 1386 | |
|
| | 1387 | | public static void UpdateFriendshipStatus(FriendsController.FriendshipUpdateStatusMessage message) |
| | 1388 | | { |
| 4 | 1389 | | SendMessage("UpdateFriendshipStatus", message); |
| 4 | 1390 | | } |
| | 1391 | |
|
| | 1392 | | public static void ScenesLoadingFeedback(LoadingFeedbackMessage message) |
| | 1393 | | { |
| 0 | 1394 | | SendMessage("ScenesLoadingFeedback", message); |
| 0 | 1395 | | } |
| | 1396 | |
|
| | 1397 | | public static void FetchHotScenes() |
| | 1398 | | { |
| 0 | 1399 | | SendMessage("FetchHotScenes"); |
| 0 | 1400 | | } |
| | 1401 | |
|
| | 1402 | | public static void SetBaseResolution(int resolution) |
| | 1403 | | { |
| 2 | 1404 | | baseResEvent.baseResolution = resolution; |
| 2 | 1405 | | SendMessage("SetBaseResolution", baseResEvent); |
| 2 | 1406 | | } |
| | 1407 | |
|
| | 1408 | | public static void ReportAnalyticsEvent(string eventName) |
| | 1409 | | { |
| 0 | 1410 | | ReportAnalyticsEvent(eventName, null); |
| 0 | 1411 | | } |
| | 1412 | |
|
| | 1413 | | public static void ReportAnalyticsEvent(string eventName, AnalyticsPayload.Property[] eventProperties) |
| | 1414 | | { |
| 26 | 1415 | | analyticsEvent.name = eventName; |
| 26 | 1416 | | analyticsEvent.properties = eventProperties; |
| 26 | 1417 | | SendMessage("Track", analyticsEvent); |
| 26 | 1418 | | } |
| | 1419 | |
|
| | 1420 | | public static void FetchBalanceOfMANA() |
| | 1421 | | { |
| 2 | 1422 | | SendMessage("FetchBalanceOfMANA"); |
| 2 | 1423 | | } |
| | 1424 | |
|
| | 1425 | | public static void SendSceneExternalActionEvent(string sceneId, string type, string payload) |
| | 1426 | | { |
| 67 | 1427 | | sceneExternalActionEvent.type = type; |
| 67 | 1428 | | sceneExternalActionEvent.payload = payload; |
| 67 | 1429 | | SendSceneEvent(sceneId, "externalAction", sceneExternalActionEvent); |
| 67 | 1430 | | } |
| | 1431 | |
|
| | 1432 | | public static void SetMuteUsers(string[] usersId, bool mute) |
| | 1433 | | { |
| 0 | 1434 | | muteUserEvent.usersId = usersId; |
| 0 | 1435 | | muteUserEvent.mute = mute; |
| 0 | 1436 | | SendMessage("SetMuteUsers", muteUserEvent); |
| 0 | 1437 | | } |
| | 1438 | |
|
| | 1439 | | public static void SendCloseUserAvatar(bool isSignUpFlow) |
| | 1440 | | { |
| 0 | 1441 | | closeUserAvatarPayload.isSignUpFlow = isSignUpFlow; |
| 0 | 1442 | | SendMessage("CloseUserAvatar", closeUserAvatarPayload); |
| 0 | 1443 | | } |
| | 1444 | |
|
| | 1445 | | public static void KillPortableExperience(string portableExperienceId) |
| | 1446 | | { |
| 0 | 1447 | | killPortableExperiencePayload.portableExperienceId = portableExperienceId; |
| 0 | 1448 | | SendMessage("KillPortableExperience", killPortableExperiencePayload); |
| 0 | 1449 | | } |
| | 1450 | |
|
| | 1451 | | public static void RequestWearables( |
| | 1452 | | string ownedByUser, |
| | 1453 | | string[] wearableIds, |
| | 1454 | | string[] collectionIds, |
| | 1455 | | string context) |
| | 1456 | | { |
| 1 | 1457 | | requestWearablesPayload.filters = new WearablesRequestFiltersPayload |
| | 1458 | | { |
| | 1459 | | ownedByUser = ownedByUser, |
| | 1460 | | wearableIds = wearableIds, |
| | 1461 | | collectionIds = collectionIds |
| | 1462 | | }; |
| | 1463 | |
|
| 1 | 1464 | | requestWearablesPayload.context = context; |
| | 1465 | |
|
| 1 | 1466 | | SendMessage("RequestWearables", requestWearablesPayload); |
| 1 | 1467 | | } |
| | 1468 | |
|
| | 1469 | | public static void SearchENSOwner(string name, int maxResults) |
| | 1470 | | { |
| 6 | 1471 | | searchEnsOwnerPayload.name = name; |
| 6 | 1472 | | searchEnsOwnerPayload.maxResults = maxResults; |
| | 1473 | |
|
| 6 | 1474 | | SendMessage("SearchENSOwner", searchEnsOwnerPayload); |
| 6 | 1475 | | } |
| | 1476 | |
|
| | 1477 | | public static void RequestUserProfile(string userId) |
| | 1478 | | { |
| 16 | 1479 | | stringPayload.value = userId; |
| 16 | 1480 | | SendMessage("RequestUserProfile", stringPayload); |
| 16 | 1481 | | } |
| | 1482 | |
|
| | 1483 | | public static void ReportAvatarFatalError() |
| | 1484 | | { |
| 0 | 1485 | | SendMessage("ReportAvatarFatalError"); |
| 0 | 1486 | | } |
| | 1487 | |
|
| | 1488 | | public static void UnpublishScene(Vector2Int sceneCoordinates) |
| | 1489 | | { |
| 2 | 1490 | | var payload = new UnpublishScenePayload() { coordinates = $"{sceneCoordinates.x},{sceneCoordinates.y}" }; |
| 2 | 1491 | | SendMessage("UnpublishScene", payload); |
| 2 | 1492 | | } |
| | 1493 | |
|
| | 1494 | | public static void NotifyStatusThroughChat(string message) |
| | 1495 | | { |
| 0 | 1496 | | stringPayload.value = message; |
| 0 | 1497 | | SendMessage("NotifyStatusThroughChat", stringPayload); |
| 0 | 1498 | | } |
| | 1499 | |
|
| | 1500 | | public static void ReportVideoProgressEvent( |
| | 1501 | | string componentId, |
| | 1502 | | string sceneId, |
| | 1503 | | string videoClipId, |
| | 1504 | | int videoStatus, |
| | 1505 | | float currentOffset, |
| | 1506 | | float length) |
| | 1507 | | { |
| 45 | 1508 | | SendVideoProgressEvent progressEvent = new SendVideoProgressEvent() |
| | 1509 | | { |
| | 1510 | | componentId = componentId, |
| | 1511 | | sceneId = sceneId, |
| | 1512 | | videoTextureId = videoClipId, |
| | 1513 | | status = videoStatus, |
| | 1514 | | currentOffset = currentOffset, |
| | 1515 | | videoLength = length |
| | 1516 | | }; |
| | 1517 | |
|
| 45 | 1518 | | SendMessage("VideoProgressEvent", progressEvent); |
| 45 | 1519 | | } |
| | 1520 | |
|
| | 1521 | | public static void ReportAvatarRemoved(string entityId, string avatarId) |
| | 1522 | | { |
| 0 | 1523 | | avatarStatePayload.type = "Removed"; |
| 0 | 1524 | | avatarStatePayload.entityId = entityId; |
| 0 | 1525 | | avatarStatePayload.avatarShapeId = avatarId; |
| 0 | 1526 | | SendMessage("ReportAvatarState", avatarStatePayload); |
| 0 | 1527 | | } |
| | 1528 | |
|
| | 1529 | | public static void ReportAvatarSceneChanged(string entityId, string avatarId, string sceneId) |
| | 1530 | | { |
| 0 | 1531 | | avatarSceneChangedPayload.type = "SceneChanged"; |
| 0 | 1532 | | avatarSceneChangedPayload.entityId = entityId; |
| 0 | 1533 | | avatarSceneChangedPayload.avatarShapeId = avatarId; |
| 0 | 1534 | | avatarSceneChangedPayload.sceneId = sceneId; |
| 0 | 1535 | | SendMessage("ReportAvatarState", avatarSceneChangedPayload); |
| 0 | 1536 | | } |
| | 1537 | |
|
| | 1538 | | public static void ReportAvatarClick(string sceneId, string userId, Vector3 rayOrigin, Vector3 rayDirection, flo |
| | 1539 | | { |
| 0 | 1540 | | avatarOnClickPayload.userId = userId; |
| 0 | 1541 | | avatarOnClickPayload.ray.origin = rayOrigin; |
| 0 | 1542 | | avatarOnClickPayload.ray.direction = rayDirection; |
| 0 | 1543 | | avatarOnClickPayload.ray.distance = distance; |
| | 1544 | |
|
| 0 | 1545 | | SendSceneEvent(sceneId, "playerClicked", avatarOnClickPayload); |
| 0 | 1546 | | } |
| | 1547 | | } |
| | 1548 | | } |