< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ControlEvent(...)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
 40557            protected ControlEvent(string eventType, T payload)
 58            {
 40559                this.eventType = eventType;
 40560                this.payload = payload;
 40561            }
 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;
 108            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        [System.Serializable]
 415        public class SendUnblockPlayerPayload
 416        {
 417            public string userId;
 418        }
 419
 420        [System.Serializable]
 421        public class TutorialStepPayload
 422        {
 423            public int tutorialStep;
 424        }
 425
 426        [System.Serializable]
 427        public class PerformanceReportPayload
 428        {
 429            public string samples;
 430            public bool fpsIsCapped;
 431            public int hiccupsInThousandFrames;
 432            public float hiccupsTime;
 433            public float totalTime;
 434            public int gltfInProgress;
 435            public int gltfFailed;
 436            public int gltfCancelled;
 437            public int gltfLoaded;
 438            public int abInProgress;
 439            public int abFailed;
 440            public int abCancelled;
 441            public int abLoaded;
 442            public int gltfTexturesLoaded;
 443            public int abTexturesLoaded;
 444            public int promiseTexturesLoaded;
 445            public int enqueuedMessages;
 446            public int processedMessages;
 447            public int playerCount;
 448            public int loadRadius;
 449            public Dictionary<string, long> sceneScores;
 450            public object drawCalls; //int *
 451            public object memoryReserved; //long, in total bytes *
 452            public object memoryUsage; //long, in total bytes *
 453            public object totalGCAlloc; //long, in total bytes, its the sum of all GCAllocs per frame over 1000 frames *
 454
 455            //* is NULL if SendProfilerMetrics is false
 456        }
 457
 458        [System.Serializable]
 459        public class SystemInfoReportPayload
 460        {
 461            public string graphicsDeviceName = SystemInfo.graphicsDeviceName;
 462            public string graphicsDeviceVersion = SystemInfo.graphicsDeviceVersion;
 463            public int graphicsMemorySize = SystemInfo.graphicsMemorySize;
 464            public string processorType = SystemInfo.processorType;
 465            public int processorCount = SystemInfo.processorCount;
 466            public int systemMemorySize = SystemInfo.systemMemorySize;
 467
 468            // TODO: remove useBinaryTransform after ECS7 is fully in prod
 469            public bool useBinaryTransform = true;
 470        }
 471
 472        [System.Serializable]
 473        public class GenericAnalyticPayload
 474        {
 475            public string eventName;
 476            public Dictionary<object, object> data;
 477        }
 478
 479        [System.Serializable]
 480        public class PerformanceHiccupPayload
 481        {
 482            public int hiccupsInThousandFrames;
 483            public float hiccupsTime;
 484            public float totalTime;
 485        }
 486
 487        [System.Serializable]
 488        public class TermsOfServiceResponsePayload
 489        {
 490            public string sceneId;
 491            public bool dontShowAgain;
 492            public bool accepted;
 493        }
 494
 495        [System.Serializable]
 496        public class OpenURLPayload
 497        {
 498            public string url;
 499        }
 500
 501        [System.Serializable]
 502        public class GIFSetupPayload
 503        {
 504            public string imageSource;
 505            public string id;
 506            public bool isWebGL1;
 507        }
 508
 509        [System.Serializable]
 510        public class RequestScenesInfoAroundParcelPayload
 511        {
 512            public Vector2 parcel;
 513            public int scenesAround;
 514        }
 515
 516        [System.Serializable]
 517        public class AudioStreamingPayload
 518        {
 519            public string url;
 520            public bool play;
 521            public float volume;
 522        }
 523
 524        [System.Serializable]
 525        public class SetScenesLoadRadiusPayload
 526        {
 527            public float newRadius;
 528        }
 529
 530        [System.Serializable]
 531        public class SetVoiceChatRecordingPayload
 532        {
 533            public bool recording;
 534        }
 535
 536        [System.Serializable]
 537        public class ApplySettingsPayload
 538        {
 539            public float voiceChatVolume;
 540            public int voiceChatAllowCategory;
 541        }
 542
 543        [System.Serializable]
 544        public class JumpInPayload
 545        {
 546            public FriendsController.UserStatus.Realm realm = new FriendsController.UserStatus.Realm();
 547            public Vector2 gridPosition;
 548        }
 549
 550        [System.Serializable]
 551        public class LoadingFeedbackMessage
 552        {
 553            public string message;
 554            public int loadPercentage;
 555        }
 556
 557        [System.Serializable]
 558        public class AnalyticsPayload
 559        {
 560            [System.Serializable]
 561            public class Property
 562            {
 563                public string key;
 564                public string value;
 565
 566                public Property(string key, string value)
 567                {
 568                    this.key = key;
 569                    this.value = value;
 570                }
 571            }
 572
 573            public string name;
 574            public Property[] properties;
 575        }
 576
 577        [System.Serializable]
 578        public class DelightedSurveyEnabledPayload
 579        {
 580            public bool enabled;
 581        }
 582
 583        [System.Serializable]
 584        public class ExternalActionSceneEventPayload
 585        {
 586            public string type;
 587            public string payload;
 588        }
 589
 590        [System.Serializable]
 591        public class MuteUserPayload
 592        {
 593            public string[] usersId;
 594            public bool mute;
 595        }
 596
 597        [System.Serializable]
 598        public class CloseUserAvatarPayload
 599        {
 600            public bool isSignUpFlow;
 601        }
 602
 603        [System.Serializable]
 604        public class StringPayload
 605        {
 606            public string value;
 607        }
 608
 609        [System.Serializable]
 610        public class KillPortableExperiencePayload
 611        {
 612            public string portableExperienceId;
 613        }
 614
 615        [System.Serializable]
 616        public class SetDisabledPortableExperiencesPayload
 617        {
 618            public string[] idsToDisable;
 619        }
 620
 621        [System.Serializable]
 622        public class WearablesRequestFiltersPayload
 623        {
 624            public string ownedByUser;
 625            public string[] wearableIds;
 626            public string[] collectionIds;
 627            public string thirdPartyId;
 628        }
 629
 630        [System.Serializable]
 631        public class RequestWearablesPayload
 632        {
 633            public WearablesRequestFiltersPayload filters;
 634            public string context;
 635        }
 636
 637        [System.Serializable]
 638        public class HeadersPayload
 639        {
 640            public string method;
 641            public string url;
 642            public Dictionary<string, object> metadata = new Dictionary<string, object>();
 643        }
 644
 645        [System.Serializable]
 646        public class SearchENSOwnerPayload
 647        {
 648            public string name;
 649            public int maxResults;
 650        }
 651
 652        [System.Serializable]
 653        public class UnpublishScenePayload
 654        {
 655            public string coordinates;
 656        }
 657
 658        [System.Serializable]
 659        public class AvatarStateBase
 660        {
 661            public string type;
 662            public string avatarShapeId;
 663        }
 664
 665        [System.Serializable]
 666        public class AvatarStateSceneChanged : AvatarStateBase
 667        {
 668            public string sceneId;
 669        }
 670
 671        [System.Serializable]
 672        public class AvatarOnClickPayload
 673        {
 674            public string userId;
 675            public RayInfo ray = new RayInfo();
 676        }
 677
 678        [System.Serializable]
 679        public class TimeReportPayload
 680        {
 681            public float timeNormalizationFactor;
 682            public float cycleTime;
 683            public bool isPaused;
 684            public float time;
 685        }
 686
 687#if UNITY_WEBGL && !UNITY_EDITOR
 688    /**
 689     * This method is called after the first render. It marks the loading of the
 690     * rest of the JS client.
 691     */
 692    [DllImport("__Internal")] public static extern void StartDecentraland();
 693    [DllImport("__Internal")] public static extern void MessageFromEngine(string type, string message);
 694    [DllImport("__Internal")] public static extern string GetGraphicCard();
 695    [DllImport("__Internal")] public static extern void BinaryMessageFromEngine(string sceneId, byte[] bytes, int size);
 696
 697    public static System.Action<string, string> OnMessageFromEngine;
 698#else
 699        public static Action<string, string> OnMessageFromEngine
 700        {
 701            set
 702            {
 703                OnMessage = value;
 704                if (OnMessage != null)
 705                {
 706                    ProcessQueuedMessages();
 707                }
 708            }
 709            get => OnMessage;
 710        }
 711        private static Action<string, string> OnMessage;
 712
 713        private static bool hasQueuedMessages = false;
 714        private static List<(string, string)> queuedMessages = new List<(string, string)>();
 715        public static void StartDecentraland() { }
 716        public static bool CheckURLParam(string targetParam) { return false; }
 717        public static string GetURLParam(string targetParam) { return String.Empty; }
 718
 719        public static void MessageFromEngine(string type, string message)
 720        {
 721            if (OnMessageFromEngine != null)
 722            {
 723                if (hasQueuedMessages)
 724                {
 725                    ProcessQueuedMessages();
 726                }
 727
 728                OnMessageFromEngine.Invoke(type, message);
 729                if (VERBOSE)
 730                {
 731                    Debug.Log("MessageFromEngine called with: " + type + ", " + message);
 732                }
 733            }
 734            else
 735            {
 736                lock (queuedMessages)
 737                {
 738                    queuedMessages.Add((type, message));
 739                }
 740
 741                hasQueuedMessages = true;
 742            }
 743        }
 744
 745        private static void ProcessQueuedMessages()
 746        {
 747            hasQueuedMessages = false;
 748            lock (queuedMessages)
 749            {
 750                foreach ((string type, string payload) in queuedMessages)
 751                {
 752                    MessageFromEngine(type, payload);
 753                }
 754
 755                queuedMessages.Clear();
 756            }
 757        }
 758
 759        public static string GetGraphicCard() => "In Editor Graphic Card";
 760#endif
 761
 762        public static void SendMessage(string type)
 763        {
 764            // sending an empty JSON object to be compatible with other messages
 765            MessageFromEngine(type, "{}");
 766        }
 767
 768        public static void SendMessage<T>(string type, T message)
 769        {
 770            string messageJson = JsonUtility.ToJson(message);
 771            SendJson(type, messageJson);
 772        }
 773
 774        public static void SendJson(string type, string json)
 775        {
 776            if (VERBOSE)
 777            {
 778                Debug.Log($"Sending message: " + json);
 779            }
 780
 781            MessageFromEngine(type, json);
 782        }
 783
 784        private static ReportPositionPayload positionPayload = new ReportPositionPayload();
 785        private static CameraModePayload cameraModePayload = new CameraModePayload();
 786        private static Web3UseResponsePayload web3UseResponsePayload = new Web3UseResponsePayload();
 787        private static IdleStateChangedPayload idleStateChangedPayload = new IdleStateChangedPayload();
 788        private static OnMetricsUpdate onMetricsUpdate = new OnMetricsUpdate();
 789        private static OnClickEvent onClickEvent = new OnClickEvent();
 790        private static OnPointerDownEvent onPointerDownEvent = new OnPointerDownEvent();
 791        private static OnPointerUpEvent onPointerUpEvent = new OnPointerUpEvent();
 792        private static OnTextSubmitEvent onTextSubmitEvent = new OnTextSubmitEvent();
 793        private static OnTextInputChangeEvent onTextInputChangeEvent = new OnTextInputChangeEvent();
 794        private static OnTextInputChangeTextEvent onTextInputChangeTextEvent = new OnTextInputChangeTextEvent();
 795        private static OnScrollChangeEvent onScrollChangeEvent = new OnScrollChangeEvent();
 796        private static OnFocusEvent onFocusEvent = new OnFocusEvent();
 797        private static OnBlurEvent onBlurEvent = new OnBlurEvent();
 798        private static OnEnterEvent onEnterEvent = new OnEnterEvent();
 799        private static OnSendScreenshot onSendScreenshot = new OnSendScreenshot();
 800        private static OnPointerEventPayload onPointerEventPayload = new OnPointerEventPayload();
 801        private static OnGlobalPointerEventPayload onGlobalPointerEventPayload = new OnGlobalPointerEventPayload();
 802        private static OnGlobalPointerEvent onGlobalPointerEvent = new OnGlobalPointerEvent();
 803        private static AudioStreamingPayload onAudioStreamingEvent = new AudioStreamingPayload();
 804        private static SetVoiceChatRecordingPayload setVoiceChatRecordingPayload = new SetVoiceChatRecordingPayload();
 805        private static SetScenesLoadRadiusPayload setScenesLoadRadiusPayload = new SetScenesLoadRadiusPayload();
 806        private static ApplySettingsPayload applySettingsPayload = new ApplySettingsPayload();
 807        private static GIFSetupPayload gifSetupPayload = new GIFSetupPayload();
 808        private static JumpInPayload jumpInPayload = new JumpInPayload();
 809        private static GotoEvent gotoEvent = new GotoEvent();
 810        private static SendChatMessageEvent sendChatMessageEvent = new SendChatMessageEvent();
 811        private static BaseResolution baseResEvent = new BaseResolution();
 812        private static AnalyticsPayload analyticsEvent = new AnalyticsPayload();
 813        private static DelightedSurveyEnabledPayload delightedSurveyEnabled = new DelightedSurveyEnabledPayload();
 814        private static ExternalActionSceneEventPayload sceneExternalActionEvent = new ExternalActionSceneEventPayload();
 815        private static MuteUserPayload muteUserEvent = new MuteUserPayload();
 816        private static StoreSceneStateEvent storeSceneState = new StoreSceneStateEvent();
 817        private static CloseUserAvatarPayload closeUserAvatarPayload = new CloseUserAvatarPayload();
 818        private static StringPayload stringPayload = new StringPayload();
 819        private static KillPortableExperiencePayload killPortableExperiencePayload = new KillPortableExperiencePayload()
 820        private static SetDisabledPortableExperiencesPayload setDisabledPortableExperiencesPayload = new SetDisabledPort
 821        private static RequestWearablesPayload requestWearablesPayload = new RequestWearablesPayload();
 822        private static SearchENSOwnerPayload searchEnsOwnerPayload = new SearchENSOwnerPayload();
 823        private static HeadersPayload headersPayload = new HeadersPayload();
 824        private static AvatarStateBase avatarStatePayload = new AvatarStateBase();
 825        private static AvatarStateSceneChanged avatarSceneChangedPayload = new AvatarStateSceneChanged();
 826        public static AvatarOnClickPayload avatarOnClickPayload = new AvatarOnClickPayload();
 827        private static UUIDEvent<EmptyPayload> onPointerHoverEnterEvent = new UUIDEvent<EmptyPayload>();
 828        private static UUIDEvent<EmptyPayload> onPointerHoverExitEvent = new UUIDEvent<EmptyPayload>();
 829        private static TimeReportPayload timeReportPayload = new TimeReportPayload();
 830
 831        public static void SendSceneEvent<T>(string sceneId, string eventType, T payload)
 832        {
 833            SceneEvent<T> sceneEvent = new SceneEvent<T>();
 834            sceneEvent.sceneId = sceneId;
 835            sceneEvent.eventType = eventType;
 836            sceneEvent.payload = payload;
 837
 838            SendMessage("SceneEvent", sceneEvent);
 839        }
 840
 841        private static void SendAllScenesEvent<T>(string eventType, T payload)
 842        {
 843            AllScenesEvent<T> allScenesEvent = new AllScenesEvent<T>();
 844            allScenesEvent.eventType = eventType;
 845            allScenesEvent.payload = payload;
 846
 847            SendMessage("AllScenesEvent", allScenesEvent);
 848        }
 849
 850        public static void ReportPosition(Vector3 position, Quaternion rotation, float playerHeight, Quaternion cameraRo
 851        {
 852            positionPayload.position = position;
 853            positionPayload.rotation = rotation;
 854            positionPayload.playerHeight = playerHeight;
 855            positionPayload.cameraRotation = cameraRotation;
 856
 857            SendMessage("ReportPosition", positionPayload);
 858        }
 859
 860        public static void ReportCameraChanged(CameraMode.ModeId cameraMode) { ReportCameraChanged(cameraMode, null); }
 861
 862        public static void ReportCameraChanged(CameraMode.ModeId cameraMode, string targetSceneId)
 863        {
 864            cameraModePayload.cameraMode = cameraMode;
 865            if (!string.IsNullOrEmpty(targetSceneId))
 866            {
 867                SendSceneEvent(targetSceneId, "cameraModeChanged", cameraModePayload);
 868            }
 869            else
 870            {
 871                SendAllScenesEvent("cameraModeChanged", cameraModePayload);
 872            }
 873        }
 874
 875        public static void Web3UseResponse(string id, bool result)
 876        {
 877            web3UseResponsePayload.id = id;
 878            web3UseResponsePayload.result = result;
 879            SendMessage("Web3UseResponse", web3UseResponsePayload);
 880        }
 881
 882        public static void ReportIdleStateChanged(bool isIdle)
 883        {
 884            idleStateChangedPayload.isIdle = isIdle;
 885            SendAllScenesEvent("idleStateChanged", idleStateChangedPayload);
 886        }
 887
 888        public static void ReportControlEvent<T>(T controlEvent) where T : ControlEvent { SendMessage("ControlEvent", co
 889
 890        public static void SendRequestHeadersForUrl(string eventName, string method, string url, Dictionary<string, obje
 891        {
 892            headersPayload.method = method;
 893            headersPayload.url = url;
 894            if (metadata != null)
 895                headersPayload.metadata = metadata;
 896            SendMessage(eventName, headersPayload);
 897        }
 898
 899        public static void BuilderInWorldMessage(string type, string message) { MessageFromEngine(type, message); }
 900
 901        public static void ReportOnClickEvent(string sceneId, string uuid)
 902        {
 903            if (string.IsNullOrEmpty(uuid))
 904            {
 905                return;
 906            }
 907
 908            onClickEvent.uuid = uuid;
 909
 910            SendSceneEvent(sceneId, "uuidEvent", onClickEvent);
 911        }
 912
 913        private static void ReportRaycastResult<T, P>(string sceneId, string queryId, string queryType, P payload) where
 914        {
 915            T response = new T();
 916            response.queryId = queryId;
 917            response.queryType = queryType;
 918            response.payload = payload;
 919
 920            SendSceneEvent<T>(sceneId, "raycastResponse", response);
 921        }
 922
 923        public static void ReportRaycastHitFirstResult(string sceneId, string queryId, RaycastType raycastType, RaycastH
 924
 925        public static void ReportRaycastHitAllResult(string sceneId, string queryId, RaycastType raycastType, RaycastHit
 926
 927        private static OnPointerEventPayload.Hit CreateHitObject(string entityId, string meshName, Vector3 point,
 928            Vector3 normal, float distance)
 929        {
 930            OnPointerEventPayload.Hit hit = new OnPointerEventPayload.Hit();
 931
 932            hit.hitPoint = point;
 933            hit.length = distance;
 934            hit.normal = normal;
 935            hit.worldNormal = normal;
 936            hit.meshName = meshName;
 937            hit.entityId = entityId;
 938
 939            return hit;
 940        }
 941
 942        private static void SetPointerEventPayload(OnPointerEventPayload pointerEventPayload, ACTION_BUTTON buttonId,
 943            string entityId, string meshName, Ray ray, Vector3 point, Vector3 normal, float distance,
 944            bool isHitInfoValid)
 945        {
 946            pointerEventPayload.origin = ray.origin;
 947            pointerEventPayload.direction = ray.direction;
 948            pointerEventPayload.buttonId = buttonId;
 949
 950            if (isHitInfoValid)
 951                pointerEventPayload.hit = CreateHitObject(entityId, meshName, point, normal, distance);
 952            else
 953                pointerEventPayload.hit = null;
 954        }
 955
 956        public static void ReportGlobalPointerDownEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal,
 957            float distance, string sceneId, string entityId = "0", string meshName = null, bool isHitInfoValid = false)
 958        {
 959            SetPointerEventPayload((OnPointerEventPayload) onGlobalPointerEventPayload, buttonId,
 960                entityId, meshName, ray, point, normal, distance,
 961                isHitInfoValid);
 962            onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.DOWN;
 963
 964            onGlobalPointerEvent.payload = onGlobalPointerEventPayload;
 965
 966            SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent);
 967        }
 968
 969        public static void ReportGlobalPointerUpEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal,
 970            float distance, string sceneId, string entityId = "0", string meshName = null, bool isHitInfoValid = false)
 971        {
 972            SetPointerEventPayload((OnPointerEventPayload) onGlobalPointerEventPayload, buttonId,
 973                entityId, meshName, ray, point, normal, distance,
 974                isHitInfoValid);
 975            onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.UP;
 976
 977            onGlobalPointerEvent.payload = onGlobalPointerEventPayload;
 978
 979            SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent);
 980        }
 981
 982        public static void ReportOnPointerDownEvent(ACTION_BUTTON buttonId, string sceneId, string uuid,
 983            string entityId, string meshName, Ray ray, Vector3 point, Vector3 normal, float distance)
 984        {
 985            if (string.IsNullOrEmpty(uuid))
 986            {
 987                return;
 988            }
 989
 990            onPointerDownEvent.uuid = uuid;
 991            SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point,
 992                normal, distance, isHitInfoValid: true);
 993            onPointerDownEvent.payload = onPointerEventPayload;
 994
 995            SendSceneEvent(sceneId, "uuidEvent", onPointerDownEvent);
 996        }
 997
 998        public static void ReportOnPointerUpEvent(ACTION_BUTTON buttonId, string sceneId, string uuid, string entityId,
 999            string meshName, Ray ray, Vector3 point, Vector3 normal, float distance)
 1000        {
 1001            if (string.IsNullOrEmpty(uuid))
 1002            {
 1003                return;
 1004            }
 1005
 1006            onPointerUpEvent.uuid = uuid;
 1007            SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point,
 1008                normal, distance, isHitInfoValid: true);
 1009            onPointerUpEvent.payload = onPointerEventPayload;
 1010
 1011            SendSceneEvent(sceneId, "uuidEvent", onPointerUpEvent);
 1012        }
 1013
 1014        public static void ReportOnTextSubmitEvent(string sceneId, string uuid, string text)
 1015        {
 1016            if (string.IsNullOrEmpty(uuid))
 1017            {
 1018                return;
 1019            }
 1020
 1021            onTextSubmitEvent.uuid = uuid;
 1022            onTextSubmitEvent.payload.text = text;
 1023
 1024            SendSceneEvent(sceneId, "uuidEvent", onTextSubmitEvent);
 1025        }
 1026
 1027        public static void ReportOnTextInputChangedEvent(string sceneId, string uuid, string text)
 1028        {
 1029            if (string.IsNullOrEmpty(uuid))
 1030            {
 1031                return;
 1032            }
 1033
 1034            onTextInputChangeEvent.uuid = uuid;
 1035            onTextInputChangeEvent.payload.value = text;
 1036
 1037            SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeEvent);
 1038        }
 1039
 1040        public static void ReportOnTextInputChangedTextEvent(string sceneId, string uuid, string text, bool isSubmit)
 1041        {
 1042            if (string.IsNullOrEmpty(uuid))
 1043            {
 1044                return;
 1045            }
 1046
 1047            onTextInputChangeTextEvent.uuid = uuid;
 1048            onTextInputChangeTextEvent.payload.value.value = text;
 1049            onTextInputChangeTextEvent.payload.value.isSubmit = isSubmit;
 1050
 1051            SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeTextEvent);
 1052        }
 1053
 1054        public static void ReportOnFocusEvent(string sceneId, string uuid)
 1055        {
 1056            if (string.IsNullOrEmpty(uuid))
 1057            {
 1058                return;
 1059            }
 1060
 1061            onFocusEvent.uuid = uuid;
 1062            SendSceneEvent(sceneId, "uuidEvent", onFocusEvent);
 1063        }
 1064
 1065        public static void ReportOnBlurEvent(string sceneId, string uuid)
 1066        {
 1067            if (string.IsNullOrEmpty(uuid))
 1068            {
 1069                return;
 1070            }
 1071
 1072            onBlurEvent.uuid = uuid;
 1073            SendSceneEvent(sceneId, "uuidEvent", onBlurEvent);
 1074        }
 1075
 1076        public static void ReportOnScrollChange(string sceneId, string uuid, Vector2 value, int pointerId)
 1077        {
 1078            if (string.IsNullOrEmpty(uuid))
 1079            {
 1080                return;
 1081            }
 1082
 1083            onScrollChangeEvent.uuid = uuid;
 1084            onScrollChangeEvent.payload.value = value;
 1085            onScrollChangeEvent.payload.pointerId = pointerId;
 1086
 1087            SendSceneEvent(sceneId, "uuidEvent", onScrollChangeEvent);
 1088        }
 1089
 1090        public static void ReportEvent<T>(string sceneId, T @event) { SendSceneEvent(sceneId, "uuidEvent", @event); }
 1091
 1092        public static void ReportOnMetricsUpdate(string sceneId, MetricsModel current,
 1093            MetricsModel limit)
 1094        {
 1095            onMetricsUpdate.given = current;
 1096            onMetricsUpdate.limit = limit;
 1097
 1098            SendSceneEvent(sceneId, "metricsUpdate", onMetricsUpdate);
 1099        }
 1100
 1101        public static void ReportOnEnterEvent(string sceneId, string uuid)
 1102        {
 1103            if (string.IsNullOrEmpty(uuid))
 1104                return;
 1105
 1106            onEnterEvent.uuid = uuid;
 1107
 1108            SendSceneEvent(sceneId, "uuidEvent", onEnterEvent);
 1109        }
 1110
 1111        public static void LogOut() { SendMessage("LogOut"); }
 1112
 1113        public static void RedirectToSignUp() { SendMessage("RedirectToSignUp"); }
 1114
 1115        public static void PreloadFinished(string sceneId) { SendMessage("PreloadFinished", sceneId); }
 1116
 1117        public static void ReportMousePosition(Vector3 mousePosition, string id)
 1118        {
 1119            positionPayload.mousePosition = mousePosition;
 1120            positionPayload.id = id;
 1121            SendMessage("ReportMousePosition", positionPayload);
 1122        }
 1123
 1124        public static void SendScreenshot(string encodedTexture, string id)
 1125        {
 1126            onSendScreenshot.encodedTexture = encodedTexture;
 1127            onSendScreenshot.id = id;
 1128            SendMessage("SendScreenshot", onSendScreenshot);
 1129        }
 1130
 1131        public static void SetDelightedSurveyEnabled(bool enabled)
 1132        {
 1133            delightedSurveyEnabled.enabled = enabled;
 1134            SendMessage("SetDelightedSurveyEnabled", delightedSurveyEnabled);
 1135        }
 1136
 1137        public static void SetScenesLoadRadius(float newRadius)
 1138        {
 1139            setScenesLoadRadiusPayload.newRadius = newRadius;
 1140            SendMessage("SetScenesLoadRadius", setScenesLoadRadiusPayload);
 1141        }
 1142
 1143        [System.Serializable]
 1144        public class SaveAvatarPayload
 1145        {
 1146            public string face256;
 1147            public string body;
 1148            public bool isSignUpFlow;
 1149            public AvatarModel avatar;
 1150        }
 1151
 1152        public static class RendererAuthenticationType
 1153        {
 1154            public static string Guest => "guest";
 1155            public static string WalletConnect => "wallet_connect";
 1156        }
 1157
 1158        [System.Serializable]
 1159        public class SendAuthenticationPayload
 1160        {
 1161            public string rendererAuthenticationType;
 1162        }
 1163
 1164        [System.Serializable]
 1165        public class SendPassportPayload
 1166        {
 1167            public string name;
 1168            public string email;
 1169        }
 1170
 1171        [System.Serializable]
 1172        public class SendSaveUserUnverifiedNamePayload
 1173        {
 1174            public string newUnverifiedName;
 1175        }
 1176
 1177        [System.Serializable]
 1178        public class SendSaveUserDescriptionPayload
 1179        {
 1180            public string description;
 1181
 1182            public SendSaveUserDescriptionPayload(string description) { this.description = description; }
 1183        }
 1184
 1185        [Serializable]
 1186        public class SendVideoProgressEvent
 1187        {
 1188            public string componentId;
 1189            public string sceneId;
 1190            public string videoTextureId;
 1191            public int status;
 1192            public float currentOffset;
 1193            public float videoLength;
 1194        }
 1195
 1196        public static void RequestOwnProfileUpdate() { SendMessage("RequestOwnProfileUpdate"); }
 1197
 1198        public static void SendSaveAvatar(AvatarModel avatar, Texture2D face256Snapshot, Texture2D bodySnapshot, bool is
 1199        {
 1200            var payload = new SaveAvatarPayload()
 1201            {
 1202                avatar = avatar,
 1203                face256 = System.Convert.ToBase64String(face256Snapshot.EncodeToPNG()),
 1204                body = System.Convert.ToBase64String(bodySnapshot.EncodeToPNG()),
 1205                isSignUpFlow = isSignUpFlow
 1206            };
 1207            SendMessage("SaveUserAvatar", payload);
 1208        }
 1209
 1210        public static void SendAuthentication(string rendererAuthenticationType) { SendMessage("SendAuthentication", new
 1211
 1212        public static void SendPassport(string name, string email) { SendMessage("SendPassport", new SendPassportPayload
 1213
 1214        public static void SendSaveUserUnverifiedName(string newName)
 1215        {
 1216            var payload = new SendSaveUserUnverifiedNamePayload()
 1217            {
 1218                newUnverifiedName = newName
 1219            };
 1220
 1221            SendMessage("SaveUserUnverifiedName", payload);
 1222        }
 1223
 1224        public static void SendSaveUserDescription(string about) { SendMessage("SaveUserDescription", new SendSaveUserDe
 1225
 1226        public static void SendUserAcceptedCollectibles(string airdropId) { SendMessage("UserAcceptedCollectibles", new 
 1227
 1228        public static void SaveUserTutorialStep(int newTutorialStep) { SendMessage("SaveUserTutorialStep", new TutorialS
 1229
 1230        public static void SendPerformanceReport(string performanceReportPayload)
 1231        {
 1232            SendJson("PerformanceReport", performanceReportPayload);
 1233        }
 1234
 1235        public static void SendSystemInfoReport() { SendMessage("SystemInfoReport", new SystemInfoReportPayload()); }
 1236
 1237        public static void SendTermsOfServiceResponse(string sceneId, bool accepted, bool dontShowAgain)
 1238        {
 1239            var payload = new TermsOfServiceResponsePayload()
 1240            {
 1241                sceneId = sceneId,
 1242                accepted = accepted,
 1243                dontShowAgain = dontShowAgain
 1244            };
 1245            SendMessage("TermsOfServiceResponse", payload);
 1246        }
 1247
 1248        public static void SendExpression(string expressionID, long timestamp)
 1249        {
 1250            SendMessage("TriggerExpression", new SendExpressionPayload()
 1251            {
 1252                id = expressionID,
 1253                timestamp = timestamp
 1254            });
 1255        }
 1256
 1257        public static void OpenURL(string url)
 1258        {
 1259#if UNITY_WEBGL
 1260            SendMessage("OpenWebURL", new OpenURLPayload { url = url });
 1261#else
 1262            Application.OpenURL(url);
 1263#endif
 1264        }
 1265
 1266        public static void PublishStatefulScene(ProtocolV2.PublishPayload payload) { MessageFromEngine("PublishSceneStat
 1267
 1268        public static void StartIsolatedMode(IsolatedConfig config) { MessageFromEngine("StartIsolatedMode", JsonConvert
 1269
 1270        public static void StopIsolatedMode(IsolatedConfig config) { MessageFromEngine("StopIsolatedMode", JsonConvert.S
 1271
 1272        public static void SendReportScene(string sceneID) { SendMessage("ReportScene", sceneID); }
 1273
 1274        public static void SendReportPlayer(string playerName) { SendMessage("ReportPlayer", playerName); }
 1275
 1276        public static void SendBlockPlayer(string userId)
 1277        {
 1278            SendMessage("BlockPlayer", new SendBlockPlayerPayload()
 1279            {
 1280                userId = userId
 1281            });
 1282        }
 1283
 1284        public static void SendUnblockPlayer(string userId)
 1285        {
 1286            SendMessage("UnblockPlayer", new SendUnblockPlayerPayload()
 1287            {
 1288                userId = userId
 1289            });
 1290        }
 1291
 1292        public static void RequestScenesInfoAroundParcel(Vector2 parcel, int maxScenesArea)
 1293        {
 1294            SendMessage("RequestScenesInfoInArea", new RequestScenesInfoAroundParcelPayload()
 1295            {
 1296                parcel = parcel,
 1297                scenesAround = maxScenesArea
 1298            });
 1299        }
 1300
 1301        public static void SendAudioStreamEvent(string url, bool play, float volume)
 1302        {
 1303            onAudioStreamingEvent.url = url;
 1304            onAudioStreamingEvent.play = play;
 1305            onAudioStreamingEvent.volume = volume;
 1306            SendMessage("SetAudioStream", onAudioStreamingEvent);
 1307        }
 1308
 1309        public static void SendSetVoiceChatRecording(bool recording)
 1310        {
 1311            setVoiceChatRecordingPayload.recording = recording;
 1312            SendMessage("SetVoiceChatRecording", setVoiceChatRecordingPayload);
 1313        }
 1314
 1315        public static void ToggleVoiceChatRecording() { SendMessage("ToggleVoiceChatRecording"); }
 1316
 1317        public static void ApplySettings(float voiceChatVolume, int voiceChatAllowCategory)
 1318        {
 1319            applySettingsPayload.voiceChatVolume = voiceChatVolume;
 1320            applySettingsPayload.voiceChatAllowCategory = voiceChatAllowCategory;
 1321            SendMessage("ApplySettings", applySettingsPayload);
 1322        }
 1323
 1324        public static void RequestGIFProcessor(string gifURL, string gifId, bool isWebGL1)
 1325        {
 1326            gifSetupPayload.imageSource = gifURL;
 1327            gifSetupPayload.id = gifId;
 1328            gifSetupPayload.isWebGL1 = isWebGL1;
 1329
 1330            SendMessage("RequestGIFProcessor", gifSetupPayload);
 1331        }
 1332
 1333        public static void DeleteGIF(string id)
 1334        {
 1335            stringPayload.value = id;
 1336            SendMessage("DeleteGIF", stringPayload);
 1337        }
 1338
 1339        public static void GoTo(int x, int y)
 1340        {
 1341            gotoEvent.x = x;
 1342            gotoEvent.y = y;
 1343            SendMessage("GoTo", gotoEvent);
 1344        }
 1345
 1346        public static void GoToCrowd() { SendMessage("GoToCrowd"); }
 1347
 1348        public static void GoToMagic() { SendMessage("GoToMagic"); }
 1349
 1350        public static void JumpIn(int x, int y, string serverName, string layerName)
 1351        {
 1352            jumpInPayload.realm.serverName = serverName;
 1353            jumpInPayload.realm.layer = layerName;
 1354
 1355            jumpInPayload.gridPosition.x = x;
 1356            jumpInPayload.gridPosition.y = y;
 1357
 1358            SendMessage("JumpIn", jumpInPayload);
 1359        }
 1360
 1361        public static void SendChatMessage(ChatMessage message)
 1362        {
 1363            sendChatMessageEvent.message = message;
 1364            SendMessage("SendChatMessage", sendChatMessageEvent);
 1365        }
 1366
 1367        public static void UpdateFriendshipStatus(FriendsController.FriendshipUpdateStatusMessage message) { SendMessage
 1368
 1369        public static void ScenesLoadingFeedback(LoadingFeedbackMessage message) { SendMessage("ScenesLoadingFeedback", 
 1370
 1371        public static void FetchHotScenes() { SendMessage("FetchHotScenes"); }
 1372
 1373        public static void SetBaseResolution(int resolution)
 1374        {
 1375            baseResEvent.baseResolution = resolution;
 1376            SendMessage("SetBaseResolution", baseResEvent);
 1377        }
 1378
 1379        public static void ReportAnalyticsEvent(string eventName) { ReportAnalyticsEvent(eventName, null); }
 1380
 1381        public static void ReportAnalyticsEvent(string eventName, AnalyticsPayload.Property[] eventProperties)
 1382        {
 1383            analyticsEvent.name = eventName;
 1384            analyticsEvent.properties = eventProperties;
 1385            SendMessage("Track", analyticsEvent);
 1386        }
 1387
 1388        public static void FetchBalanceOfMANA() { SendMessage("FetchBalanceOfMANA"); }
 1389
 1390        public static void SendSceneExternalActionEvent(string sceneId, string type, string payload)
 1391        {
 1392            sceneExternalActionEvent.type = type;
 1393            sceneExternalActionEvent.payload = payload;
 1394            SendSceneEvent(sceneId, "externalAction", sceneExternalActionEvent);
 1395        }
 1396
 1397        public static void SetMuteUsers(string[] usersId, bool mute)
 1398        {
 1399            muteUserEvent.usersId = usersId;
 1400            muteUserEvent.mute = mute;
 1401            SendMessage("SetMuteUsers", muteUserEvent);
 1402        }
 1403
 1404        public static void SendCloseUserAvatar(bool isSignUpFlow)
 1405        {
 1406            closeUserAvatarPayload.isSignUpFlow = isSignUpFlow;
 1407            SendMessage("CloseUserAvatar", closeUserAvatarPayload);
 1408        }
 1409
 1410        // Warning: Use this method only for PEXs non-associated to smart wearables.
 1411        //          For PEX associated to smart wearables use 'SetDisabledPortableExperiences'.
 1412        public static void KillPortableExperience(string portableExperienceId)
 1413        {
 1414            killPortableExperiencePayload.portableExperienceId = portableExperienceId;
 1415            SendMessage("KillPortableExperience", killPortableExperiencePayload);
 1416        }
 1417
 1418        public static void RequestThirdPartyWearables(
 1419            string ownedByUser,
 1420            string thirdPartyCollectionId,
 1421            string context)
 1422        {
 1423            requestWearablesPayload.filters = new WearablesRequestFiltersPayload
 1424            {
 1425                ownedByUser = ownedByUser,
 1426                thirdPartyId = thirdPartyCollectionId,
 1427                collectionIds = null,
 1428                wearableIds = null
 1429            };
 1430
 1431            requestWearablesPayload.context = context;
 1432
 1433            SendMessage("RequestWearables", requestWearablesPayload);
 1434        }
 1435
 1436        public static void SetDisabledPortableExperiences(string[] idsToDisable)
 1437        {
 1438            setDisabledPortableExperiencesPayload.idsToDisable = idsToDisable;
 1439            SendMessage("SetDisabledPortableExperiences", setDisabledPortableExperiencesPayload);
 1440        }
 1441
 1442        public static void RequestWearables(
 1443            string ownedByUser,
 1444            string[] wearableIds,
 1445            string[] collectionIds,
 1446            string context)
 1447        {
 1448            requestWearablesPayload.filters = new WearablesRequestFiltersPayload
 1449            {
 1450                ownedByUser = ownedByUser,
 1451                wearableIds = wearableIds,
 1452                collectionIds = collectionIds,
 1453                thirdPartyId = null
 1454            };
 1455
 1456            requestWearablesPayload.context = context;
 1457
 1458            SendMessage("RequestWearables", requestWearablesPayload);
 1459        }
 1460
 1461        public static void SearchENSOwner(string name, int maxResults)
 1462        {
 1463            searchEnsOwnerPayload.name = name;
 1464            searchEnsOwnerPayload.maxResults = maxResults;
 1465
 1466            SendMessage("SearchENSOwner", searchEnsOwnerPayload);
 1467        }
 1468
 1469        public static void RequestUserProfile(string userId)
 1470        {
 1471            stringPayload.value = userId;
 1472            SendMessage("RequestUserProfile", stringPayload);
 1473        }
 1474
 1475        public static void ReportAvatarFatalError() { SendMessage("ReportAvatarFatalError"); }
 1476
 1477        public static void UnpublishScene(Vector2Int sceneCoordinates)
 1478        {
 1479            var payload = new UnpublishScenePayload() { coordinates = $"{sceneCoordinates.x},{sceneCoordinates.y}" };
 1480            SendMessage("UnpublishScene", payload);
 1481        }
 1482
 1483        public static void NotifyStatusThroughChat(string message)
 1484        {
 1485            stringPayload.value = message;
 1486            SendMessage("NotifyStatusThroughChat", stringPayload);
 1487        }
 1488
 1489        public static void ReportVideoProgressEvent(
 1490            string componentId,
 1491            string sceneId,
 1492            string videoClipId,
 1493            int videoStatus,
 1494            float currentOffset,
 1495            float length)
 1496        {
 1497            SendVideoProgressEvent progressEvent = new SendVideoProgressEvent()
 1498            {
 1499                componentId = componentId,
 1500                sceneId = sceneId,
 1501                videoTextureId = videoClipId,
 1502                status = videoStatus,
 1503                currentOffset = currentOffset,
 1504                videoLength = length
 1505            };
 1506
 1507            SendMessage("VideoProgressEvent", progressEvent);
 1508        }
 1509
 1510        public static void ReportAvatarRemoved(string avatarId)
 1511        {
 1512            avatarStatePayload.type = "Removed";
 1513            avatarStatePayload.avatarShapeId = avatarId;
 1514            SendMessage("ReportAvatarState", avatarStatePayload);
 1515        }
 1516
 1517        public static void ReportAvatarSceneChanged(string avatarId, string sceneId)
 1518        {
 1519            avatarSceneChangedPayload.type = "SceneChanged";
 1520            avatarSceneChangedPayload.avatarShapeId = avatarId;
 1521            avatarSceneChangedPayload.sceneId = sceneId;
 1522            SendMessage("ReportAvatarState", avatarSceneChangedPayload);
 1523        }
 1524
 1525        public static void ReportAvatarClick(string sceneId, string userId, Vector3 rayOrigin, Vector3 rayDirection, flo
 1526        {
 1527            avatarOnClickPayload.userId = userId;
 1528            avatarOnClickPayload.ray.origin = rayOrigin;
 1529            avatarOnClickPayload.ray.direction = rayDirection;
 1530            avatarOnClickPayload.ray.distance = distance;
 1531
 1532            SendSceneEvent(sceneId, "playerClicked", avatarOnClickPayload);
 1533        }
 1534
 1535        public static void ReportOnPointerHoverEnterEvent(string sceneId, string uuid)
 1536        {
 1537            onPointerHoverEnterEvent.uuid = uuid;
 1538            SendSceneEvent(sceneId, "uuidEvent", onPointerHoverEnterEvent);
 1539        }
 1540
 1541        public static void ReportOnPointerHoverExitEvent(string sceneId, string uuid)
 1542        {
 1543            onPointerHoverExitEvent.uuid = uuid;
 1544            SendSceneEvent(sceneId, "uuidEvent", onPointerHoverExitEvent);
 1545        }
 1546
 1547        public static void ReportTime(float time, bool isPaused, float timeNormalizationFactor, float cycleTime)
 1548        {
 1549            timeReportPayload.time = time;
 1550            timeReportPayload.isPaused = isPaused;
 1551            timeReportPayload.timeNormalizationFactor = timeNormalizationFactor;
 1552            timeReportPayload.cycleTime = cycleTime;
 1553            SendMessage("ReportDecentralandTime", timeReportPayload);
 1554        }
 1555    }
 1556}

Methods/Properties

ControlEvent(System.String, T)