< Summary

Class:DCL.Interface.WebInterfaceUUIDEvent[TPayload]
Assembly:WebInterface
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WebInterface/Interface.cs
Covered lines:1
Uncovered lines:0
Coverable lines:1
Total lines:1622
Line coverage:100% (1 of 1)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
UUIDEvent()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WebInterface/Interface.cs

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

Methods/Properties

UUIDEvent()