< Summary

Class:DCL.Interface.WebInterface
Assembly:WebInterface
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WebInterface/Interface.cs
Covered lines:281
Uncovered lines:143
Coverable lines:424
Total lines:1586
Line coverage:66.2% (281 of 424)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
WebInterface()0%110100%
SceneReady(...)0%110100%
ActivateRenderingACK()0%110100%
DeactivateRenderingACK()0%2100%
OnGlobalPointerEvent()0%2100%
StoreSceneStateEvent()0%110100%
OnTextInputChangeTextEventPayload()0%110100%
operator+(...)0%2100%
OnMetricsUpdate()0%110100%
TransformPayload()0%2100%
SystemInfoReportPayload()0%2100%
JumpInPayload()0%2100%
Property(...)0%2100%
HeadersPayload()0%110100%
AvatarOnClickPayload()0%2100%
StartDecentraland()0%2100%
CheckURLParam(...)0%2100%
GetURLParam(...)0%2100%
MessageFromEngine(...)0%5.395075%
ProcessQueuedMessages()0%330100%
GetGraphicCard()0%2100%
SendMessage(...)0%110100%
SendMessage[T](...)0%110100%
SendJson(...)0%2.062075%
SendSceneEvent[T](...)0%110100%
SendAllScenesEvent[T](...)0%110100%
ReportPosition(...)0%110100%
ReportCameraChanged(...)0%110100%
ReportCameraChanged(...)0%220100%
Web3UseResponse(...)0%2100%
ReportIdleStateChanged(...)0%110100%
ReportControlEvent[T](...)0%110100%
SendRequestHeadersForUrl(...)0%6200%
BuilderInWorldMessage(...)0%110100%
ReportOnClickEvent(...)0%2.032080%
ReportRaycastResult[T, P](...)0%2100%
ReportRaycastHitFirstResult(...)0%2100%
ReportRaycastHitAllResult(...)0%2100%
CreateHitObject(...)0%110100%
SetPointerEventPayload(...)0%220100%
ReportGlobalPointerDownEvent(...)0%110100%
ReportGlobalPointerUpEvent(...)0%110100%
ReportOnPointerDownEvent(...)0%2.012085.71%
ReportOnPointerUpEvent(...)0%2.012085.71%
ReportOnTextSubmitEvent(...)0%2.022083.33%
ReportOnTextInputChangedEvent(...)0%3.192033.33%
ReportOnTextInputChangedTextEvent(...)0%220100%
ReportOnFocusEvent(...)0%2.862040%
ReportOnBlurEvent(...)0%2.862040%
ReportOnScrollChange(...)0%220100%
ReportEvent[T](...)0%2100%
ReportOnMetricsUpdate(...)0%110100%
ReportOnEnterEvent(...)0%6200%
LogOut()0%2100%
RedirectToSignUp()0%2100%
PreloadFinished(...)0%2100%
ReportMousePosition(...)0%2100%
SendScreenshot(...)0%2100%
SetDelightedSurveyEnabled(...)0%110100%
SetScenesLoadRadius(...)0%110100%
SendSaveUserDescriptionPayload(...)0%2100%
RequestOwnProfileUpdate()0%110100%
SendSaveAvatar(...)0%110100%
SendAuthentication(...)0%2100%
SendPassport(...)0%110100%
SendSaveUserUnverifiedName(...)0%2100%
SendSaveUserDescription(...)0%2100%
SendUserAcceptedCollectibles(...)0%110100%
SaveUserTutorialStep(...)0%110100%
SendPerformanceReport(...)0%2100%
SendSystemInfoReport()0%2100%
SendTermsOfServiceResponse(...)0%110100%
SendExpression(...)0%110100%
OpenURL(...)0%110100%
PublishStatefulScene(...)0%110100%
StartIsolatedMode(...)0%110100%
StopIsolatedMode(...)0%110100%
SendReportScene(...)0%110100%
SendReportPlayer(...)0%110100%
SendBlockPlayer(...)0%110100%
SendUnblockPlayer(...)0%2100%
RequestScenesInfoAroundParcel(...)0%110100%
SendAudioStreamEvent(...)0%110100%
JoinVoiceChat()0%110100%
LeaveVoiceChat()0%110100%
SendSetVoiceChatRecording(...)0%2100%
ToggleVoiceChatRecording()0%2100%
ApplySettings(...)0%110100%
RequestGIFProcessor(...)0%2100%
DeleteGIF(...)0%2100%
GoTo(...)0%110100%
GoToCrowd()0%2100%
GoToMagic()0%2100%
JumpIn(...)0%110100%
SendChatMessage(...)0%2100%
UpdateFriendshipStatus(...)0%2100%
ScenesLoadingFeedback(...)0%2100%
FetchHotScenes()0%2100%
SetBaseResolution(...)0%110100%
ReportAnalyticsEvent(...)0%2100%
ReportAnalyticsEvent(...)0%2100%
FetchBalanceOfMANA()0%110100%
SendSceneExternalActionEvent(...)0%110100%
SetMuteUsers(...)0%110100%
SendCloseUserAvatar(...)0%2100%
KillPortableExperience(...)0%2100%
RequestThirdPartyWearables(...)0%110100%
SetDisabledPortableExperiences(...)0%110100%
RequestWearables(...)0%110100%
SearchENSOwner(...)0%110100%
RequestUserProfile(...)0%110100%
ReportAvatarFatalError()0%2100%
UnpublishScene(...)0%2100%
NotifyStatusThroughChat(...)0%2100%
ReportVideoProgressEvent(...)0%110100%
ReportAvatarRemoved(...)0%2100%
ReportAvatarSceneChanged(...)0%2100%
ReportAvatarClick(...)0%2100%
ReportOnPointerHoverEnterEvent(...)0%110100%
ReportOnPointerHoverExitEvent(...)0%110100%
ReportTime(...)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    {
 125        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
 82273            public SceneReady(string sceneId) : base("SceneReady", new Payload() { sceneId = sceneId }) { }
 74        }
 75
 76        [System.Serializable]
 77        public class ActivateRenderingACK : ControlEvent<object>
 78        {
 279            public ActivateRenderingACK() : base("ActivateRenderingACK", null) { }
 80        }
 81
 82        [System.Serializable]
 83        public class DeactivateRenderingACK : ControlEvent<object>
 84        {
 085            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        {
 0157            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        {
 1206            public string type = "StoreSceneState";
 1207            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
 2266            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            {
 0291                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        {
 1306            public MetricsModel given = new MetricsModel();
 1307            public MetricsModel limit = new MetricsModel();
 308        }
 309
 310        [System.Serializable]
 311        public class OnEnterEventPayload { }
 312
 313        [System.Serializable]
 314        public class TransformPayload
 315        {
 0316            public Vector3 position = Vector3.zero;
 0317            public Quaternion rotation = Quaternion.identity;
 0318            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        {
 0474            public string graphicsDeviceName = SystemInfo.graphicsDeviceName;
 0475            public string graphicsDeviceVersion = SystemInfo.graphicsDeviceVersion;
 0476            public int graphicsMemorySize = SystemInfo.graphicsMemorySize;
 0477            public string processorType = SystemInfo.processorType;
 0478            public int processorCount = SystemInfo.processorCount;
 0479            public int systemMemorySize = SystemInfo.systemMemorySize;
 480
 481            // TODO: remove useBinaryTransform after ECS7 is fully in prod
 0482            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        {
 0559            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
 0579                public Property(string key, string value)
 580                {
 0581                    this.key = key;
 0582                    this.value = value;
 0583                }
 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 RequestWearablesPayload
 645        {
 646            public WearablesRequestFiltersPayload filters;
 647            public string context;
 648        }
 649
 650        [System.Serializable]
 651        public class HeadersPayload
 652        {
 653            public string method;
 654            public string url;
 1655            public Dictionary<string, object> metadata = new Dictionary<string, object>();
 656        }
 657
 658        [System.Serializable]
 659        public class SearchENSOwnerPayload
 660        {
 661            public string name;
 662            public int maxResults;
 663        }
 664
 665        [System.Serializable]
 666        public class UnpublishScenePayload
 667        {
 668            public string coordinates;
 669        }
 670
 671        [System.Serializable]
 672        public class AvatarStateBase
 673        {
 674            public string type;
 675            public string avatarShapeId;
 676        }
 677
 678        [System.Serializable]
 679        public class AvatarStateSceneChanged : AvatarStateBase
 680        {
 681            public string sceneId;
 682        }
 683
 684        [System.Serializable]
 685        public class AvatarOnClickPayload
 686        {
 687            public string userId;
 0688            public RayInfo ray = new RayInfo();
 689        }
 690
 691        [System.Serializable]
 692        public class TimeReportPayload
 693        {
 694            public float timeNormalizationFactor;
 695            public float cycleTime;
 696            public bool isPaused;
 697            public float time;
 698        }
 699
 700#if UNITY_WEBGL && !UNITY_EDITOR
 701    /**
 702     * This method is called after the first render. It marks the loading of the
 703     * rest of the JS client.
 704     */
 705    [DllImport("__Internal")] public static extern void StartDecentraland();
 706    [DllImport("__Internal")] public static extern void MessageFromEngine(string type, string message);
 707    [DllImport("__Internal")] public static extern string GetGraphicCard();
 708    [DllImport("__Internal")] public static extern void BinaryMessageFromEngine(string sceneId, byte[] bytes, int size);
 709
 710    public static System.Action<string, string> OnMessageFromEngine;
 711#else
 712        public static Action<string, string> OnMessageFromEngine
 713        {
 714            set
 715            {
 82716                OnMessage = value;
 82717                if (OnMessage != null)
 718                {
 41719                    ProcessQueuedMessages();
 720                }
 82721            }
 0722            get => OnMessage;
 723        }
 724        private static Action<string, string> OnMessage;
 725
 1726        private static bool hasQueuedMessages = false;
 1727        private static List<(string, string)> queuedMessages = new List<(string, string)>();
 0728        public static void StartDecentraland() { }
 0729        public static bool CheckURLParam(string targetParam) { return false; }
 0730        public static string GetURLParam(string targetParam) { return String.Empty; }
 731
 732        public static void MessageFromEngine(string type, string message)
 733        {
 3944734            if (OnMessageFromEngine != null)
 735            {
 1992736                if (hasQueuedMessages)
 737                {
 0738                    ProcessQueuedMessages();
 739                }
 740
 1992741                OnMessageFromEngine.Invoke(type, message);
 1992742                if (VERBOSE)
 743                {
 0744                    Debug.Log("MessageFromEngine called with: " + type + ", " + message);
 745                }
 0746            }
 747            else
 748            {
 1952749                lock (queuedMessages)
 750                {
 1952751                    queuedMessages.Add((type, message));
 1952752                }
 753
 1952754                hasQueuedMessages = true;
 755            }
 3944756        }
 757
 758        private static void ProcessQueuedMessages()
 759        {
 41760            hasQueuedMessages = false;
 41761            lock (queuedMessages)
 762            {
 3932763                foreach ((string type, string payload) in queuedMessages)
 764                {
 1925765                    MessageFromEngine(type, payload);
 766                }
 767
 41768                queuedMessages.Clear();
 41769            }
 41770        }
 771
 0772        public static string GetGraphicCard() => "In Editor Graphic Card";
 773#endif
 774
 775        public static void SendMessage(string type)
 776        {
 777            // sending an empty JSON object to be compatible with other messages
 5778            MessageFromEngine(type, "{}");
 5779        }
 780
 781        public static void SendMessage<T>(string type, T message)
 782        {
 2000783            string messageJson = JsonUtility.ToJson(message);
 2000784            SendJson(type, messageJson);
 2000785        }
 786
 787        public static void SendJson(string type, string json)
 788        {
 2000789            if (VERBOSE)
 790            {
 0791                Debug.Log($"Sending message: " + json);
 792            }
 793
 2000794            MessageFromEngine(type, json);
 2000795        }
 796
 1797        private static ReportPositionPayload positionPayload = new ReportPositionPayload();
 1798        private static CameraModePayload cameraModePayload = new CameraModePayload();
 1799        private static Web3UseResponsePayload web3UseResponsePayload = new Web3UseResponsePayload();
 1800        private static IdleStateChangedPayload idleStateChangedPayload = new IdleStateChangedPayload();
 1801        private static OnMetricsUpdate onMetricsUpdate = new OnMetricsUpdate();
 1802        private static OnClickEvent onClickEvent = new OnClickEvent();
 1803        private static OnPointerDownEvent onPointerDownEvent = new OnPointerDownEvent();
 1804        private static OnPointerUpEvent onPointerUpEvent = new OnPointerUpEvent();
 1805        private static OnTextSubmitEvent onTextSubmitEvent = new OnTextSubmitEvent();
 1806        private static OnTextInputChangeEvent onTextInputChangeEvent = new OnTextInputChangeEvent();
 1807        private static OnTextInputChangeTextEvent onTextInputChangeTextEvent = new OnTextInputChangeTextEvent();
 1808        private static OnScrollChangeEvent onScrollChangeEvent = new OnScrollChangeEvent();
 1809        private static OnFocusEvent onFocusEvent = new OnFocusEvent();
 1810        private static OnBlurEvent onBlurEvent = new OnBlurEvent();
 1811        private static OnEnterEvent onEnterEvent = new OnEnterEvent();
 1812        private static OnSendScreenshot onSendScreenshot = new OnSendScreenshot();
 1813        private static OnPointerEventPayload onPointerEventPayload = new OnPointerEventPayload();
 1814        private static OnGlobalPointerEventPayload onGlobalPointerEventPayload = new OnGlobalPointerEventPayload();
 1815        private static OnGlobalPointerEvent onGlobalPointerEvent = new OnGlobalPointerEvent();
 1816        private static AudioStreamingPayload onAudioStreamingEvent = new AudioStreamingPayload();
 1817        private static SetVoiceChatRecordingPayload setVoiceChatRecordingPayload = new SetVoiceChatRecordingPayload();
 1818        private static SetScenesLoadRadiusPayload setScenesLoadRadiusPayload = new SetScenesLoadRadiusPayload();
 1819        private static ApplySettingsPayload applySettingsPayload = new ApplySettingsPayload();
 1820        private static GIFSetupPayload gifSetupPayload = new GIFSetupPayload();
 1821        private static JumpInPayload jumpInPayload = new JumpInPayload();
 1822        private static GotoEvent gotoEvent = new GotoEvent();
 1823        private static SendChatMessageEvent sendChatMessageEvent = new SendChatMessageEvent();
 1824        private static BaseResolution baseResEvent = new BaseResolution();
 1825        private static AnalyticsPayload analyticsEvent = new AnalyticsPayload();
 1826        private static DelightedSurveyEnabledPayload delightedSurveyEnabled = new DelightedSurveyEnabledPayload();
 1827        private static ExternalActionSceneEventPayload sceneExternalActionEvent = new ExternalActionSceneEventPayload();
 1828        private static MuteUserPayload muteUserEvent = new MuteUserPayload();
 1829        private static StoreSceneStateEvent storeSceneState = new StoreSceneStateEvent();
 1830        private static CloseUserAvatarPayload closeUserAvatarPayload = new CloseUserAvatarPayload();
 1831        private static StringPayload stringPayload = new StringPayload();
 1832        private static KillPortableExperiencePayload killPortableExperiencePayload = new KillPortableExperiencePayload()
 1833        private static SetDisabledPortableExperiencesPayload setDisabledPortableExperiencesPayload = new SetDisabledPort
 1834        private static RequestWearablesPayload requestWearablesPayload = new RequestWearablesPayload();
 1835        private static SearchENSOwnerPayload searchEnsOwnerPayload = new SearchENSOwnerPayload();
 1836        private static HeadersPayload headersPayload = new HeadersPayload();
 1837        private static AvatarStateBase avatarStatePayload = new AvatarStateBase();
 1838        private static AvatarStateSceneChanged avatarSceneChangedPayload = new AvatarStateSceneChanged();
 1839        public static AvatarOnClickPayload avatarOnClickPayload = new AvatarOnClickPayload();
 1840        private static UUIDEvent<EmptyPayload> onPointerHoverEnterEvent = new UUIDEvent<EmptyPayload>();
 1841        private static UUIDEvent<EmptyPayload> onPointerHoverExitEvent = new UUIDEvent<EmptyPayload>();
 1842        private static TimeReportPayload timeReportPayload = new TimeReportPayload();
 843
 844        public static void SendSceneEvent<T>(string sceneId, string eventType, T payload)
 845        {
 712846            SceneEvent<T> sceneEvent = new SceneEvent<T>();
 712847            sceneEvent.sceneId = sceneId;
 712848            sceneEvent.eventType = eventType;
 712849            sceneEvent.payload = payload;
 850
 712851            SendMessage("SceneEvent", sceneEvent);
 712852        }
 853
 854        private static void SendAllScenesEvent<T>(string eventType, T payload)
 855        {
 594856            AllScenesEvent<T> allScenesEvent = new AllScenesEvent<T>();
 594857            allScenesEvent.eventType = eventType;
 594858            allScenesEvent.payload = payload;
 859
 594860            SendMessage("AllScenesEvent", allScenesEvent);
 594861        }
 862
 863        public static void ReportPosition(Vector3 position, Quaternion rotation, float playerHeight, Quaternion cameraRo
 864        {
 42865            positionPayload.position = position;
 42866            positionPayload.rotation = rotation;
 42867            positionPayload.playerHeight = playerHeight;
 42868            positionPayload.cameraRotation = cameraRotation;
 869
 42870            SendMessage("ReportPosition", positionPayload);
 42871        }
 872
 1186873        public static void ReportCameraChanged(CameraMode.ModeId cameraMode) { ReportCameraChanged(cameraMode, null); }
 874
 875        public static void ReportCameraChanged(CameraMode.ModeId cameraMode, string targetSceneId)
 876        {
 1004877            cameraModePayload.cameraMode = cameraMode;
 1004878            if (!string.IsNullOrEmpty(targetSceneId))
 879            {
 411880                SendSceneEvent(targetSceneId, "cameraModeChanged", cameraModePayload);
 411881            }
 882            else
 883            {
 593884                SendAllScenesEvent("cameraModeChanged", cameraModePayload);
 885            }
 593886        }
 887
 888        public static void Web3UseResponse(string id, bool result)
 889        {
 0890            web3UseResponsePayload.id = id;
 0891            web3UseResponsePayload.result = result;
 0892            SendMessage("Web3UseResponse", web3UseResponsePayload);
 0893        }
 894
 895        public static void ReportIdleStateChanged(bool isIdle)
 896        {
 1897            idleStateChangedPayload.isIdle = isIdle;
 1898            SendAllScenesEvent("idleStateChanged", idleStateChangedPayload);
 1899        }
 900
 824901        public static void ReportControlEvent<T>(T controlEvent) where T : ControlEvent { SendMessage("ControlEvent", co
 902
 903        public static void SendRequestHeadersForUrl(string eventName, string method, string url, Dictionary<string, obje
 904        {
 0905            headersPayload.method = method;
 0906            headersPayload.url = url;
 0907            if (metadata != null)
 0908                headersPayload.metadata = metadata;
 0909            SendMessage(eventName, headersPayload);
 0910        }
 911
 8912        public static void BuilderInWorldMessage(string type, string message) { MessageFromEngine(type, message); }
 913
 914        public static void ReportOnClickEvent(string sceneId, string uuid)
 915        {
 6916            if (string.IsNullOrEmpty(uuid))
 917            {
 0918                return;
 919            }
 920
 6921            onClickEvent.uuid = uuid;
 922
 6923            SendSceneEvent(sceneId, "uuidEvent", onClickEvent);
 6924        }
 925
 926        private static void ReportRaycastResult<T, P>(string sceneId, string queryId, string queryType, P payload) where
 927        {
 0928            T response = new T();
 0929            response.queryId = queryId;
 0930            response.queryType = queryType;
 0931            response.payload = payload;
 932
 0933            SendSceneEvent<T>(sceneId, "raycastResponse", response);
 0934        }
 935
 0936        public static void ReportRaycastHitFirstResult(string sceneId, string queryId, RaycastType raycastType, RaycastH
 937
 0938        public static void ReportRaycastHitAllResult(string sceneId, string queryId, RaycastType raycastType, RaycastHit
 939
 940        private static OnPointerEventPayload.Hit CreateHitObject(string entityId, string meshName, Vector3 point,
 941            Vector3 normal, float distance)
 942        {
 19943            OnPointerEventPayload.Hit hit = new OnPointerEventPayload.Hit();
 944
 19945            hit.hitPoint = point;
 19946            hit.length = distance;
 19947            hit.normal = normal;
 19948            hit.worldNormal = normal;
 19949            hit.meshName = meshName;
 19950            hit.entityId = entityId;
 951
 19952            return hit;
 953        }
 954
 955        private static void SetPointerEventPayload(OnPointerEventPayload pointerEventPayload, ACTION_BUTTON buttonId,
 956            string entityId, string meshName, Ray ray, Vector3 point, Vector3 normal, float distance,
 957            bool isHitInfoValid)
 958        {
 20959            pointerEventPayload.origin = ray.origin;
 20960            pointerEventPayload.direction = ray.direction;
 20961            pointerEventPayload.buttonId = buttonId;
 962
 20963            if (isHitInfoValid)
 19964                pointerEventPayload.hit = CreateHitObject(entityId, meshName, point, normal, distance);
 965            else
 1966                pointerEventPayload.hit = null;
 1967        }
 968
 969        public static void ReportGlobalPointerDownEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal,
 970            float distance, string sceneId, string entityId = "0", string meshName = null, bool isHitInfoValid = false)
 971        {
 11972            SetPointerEventPayload((OnPointerEventPayload) onGlobalPointerEventPayload, buttonId,
 973                entityId, meshName, ray, point, normal, distance,
 974                isHitInfoValid);
 11975            onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.DOWN;
 976
 11977            onGlobalPointerEvent.payload = onGlobalPointerEventPayload;
 978
 11979            SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent);
 11980        }
 981
 982        public static void ReportGlobalPointerUpEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal,
 983            float distance, string sceneId, string entityId = "0", string meshName = null, bool isHitInfoValid = false)
 984        {
 3985            SetPointerEventPayload((OnPointerEventPayload) onGlobalPointerEventPayload, buttonId,
 986                entityId, meshName, ray, point, normal, distance,
 987                isHitInfoValid);
 3988            onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.UP;
 989
 3990            onGlobalPointerEvent.payload = onGlobalPointerEventPayload;
 991
 3992            SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent);
 3993        }
 994
 995        public static void ReportOnPointerDownEvent(ACTION_BUTTON buttonId, string sceneId, string uuid,
 996            string entityId, string meshName, Ray ray, Vector3 point, Vector3 normal, float distance)
 997        {
 4998            if (string.IsNullOrEmpty(uuid))
 999            {
 01000                return;
 1001            }
 1002
 41003            onPointerDownEvent.uuid = uuid;
 41004            SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point,
 1005                normal, distance, isHitInfoValid: true);
 41006            onPointerDownEvent.payload = onPointerEventPayload;
 1007
 41008            SendSceneEvent(sceneId, "uuidEvent", onPointerDownEvent);
 41009        }
 1010
 1011        public static void ReportOnPointerUpEvent(ACTION_BUTTON buttonId, string sceneId, string uuid, string entityId,
 1012            string meshName, Ray ray, Vector3 point, Vector3 normal, float distance)
 1013        {
 21014            if (string.IsNullOrEmpty(uuid))
 1015            {
 01016                return;
 1017            }
 1018
 21019            onPointerUpEvent.uuid = uuid;
 21020            SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point,
 1021                normal, distance, isHitInfoValid: true);
 21022            onPointerUpEvent.payload = onPointerEventPayload;
 1023
 21024            SendSceneEvent(sceneId, "uuidEvent", onPointerUpEvent);
 21025        }
 1026
 1027        public static void ReportOnTextSubmitEvent(string sceneId, string uuid, string text)
 1028        {
 21029            if (string.IsNullOrEmpty(uuid))
 1030            {
 01031                return;
 1032            }
 1033
 21034            onTextSubmitEvent.uuid = uuid;
 21035            onTextSubmitEvent.payload.text = text;
 1036
 21037            SendSceneEvent(sceneId, "uuidEvent", onTextSubmitEvent);
 21038        }
 1039
 1040        public static void ReportOnTextInputChangedEvent(string sceneId, string uuid, string text)
 1041        {
 171042            if (string.IsNullOrEmpty(uuid))
 1043            {
 171044                return;
 1045            }
 1046
 01047            onTextInputChangeEvent.uuid = uuid;
 01048            onTextInputChangeEvent.payload.value = text;
 1049
 01050            SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeEvent);
 01051        }
 1052
 1053        public static void ReportOnTextInputChangedTextEvent(string sceneId, string uuid, string text, bool isSubmit)
 1054        {
 191055            if (string.IsNullOrEmpty(uuid))
 1056            {
 161057                return;
 1058            }
 1059
 31060            onTextInputChangeTextEvent.uuid = uuid;
 31061            onTextInputChangeTextEvent.payload.value.value = text;
 31062            onTextInputChangeTextEvent.payload.value.isSubmit = isSubmit;
 1063
 31064            SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeTextEvent);
 31065        }
 1066
 1067        public static void ReportOnFocusEvent(string sceneId, string uuid)
 1068        {
 21069            if (string.IsNullOrEmpty(uuid))
 1070            {
 21071                return;
 1072            }
 1073
 01074            onFocusEvent.uuid = uuid;
 01075            SendSceneEvent(sceneId, "uuidEvent", onFocusEvent);
 01076        }
 1077
 1078        public static void ReportOnBlurEvent(string sceneId, string uuid)
 1079        {
 21080            if (string.IsNullOrEmpty(uuid))
 1081            {
 21082                return;
 1083            }
 1084
 01085            onBlurEvent.uuid = uuid;
 01086            SendSceneEvent(sceneId, "uuidEvent", onBlurEvent);
 01087        }
 1088
 1089        public static void ReportOnScrollChange(string sceneId, string uuid, Vector2 value, int pointerId)
 1090        {
 151091            if (string.IsNullOrEmpty(uuid))
 1092            {
 131093                return;
 1094            }
 1095
 21096            onScrollChangeEvent.uuid = uuid;
 21097            onScrollChangeEvent.payload.value = value;
 21098            onScrollChangeEvent.payload.pointerId = pointerId;
 1099
 21100            SendSceneEvent(sceneId, "uuidEvent", onScrollChangeEvent);
 21101        }
 1102
 01103        public static void ReportEvent<T>(string sceneId, T @event) { SendSceneEvent(sceneId, "uuidEvent", @event); }
 1104
 1105        public static void ReportOnMetricsUpdate(string sceneId, MetricsModel current,
 1106            MetricsModel limit)
 1107        {
 1891108            onMetricsUpdate.given = current;
 1891109            onMetricsUpdate.limit = limit;
 1110
 1891111            SendSceneEvent(sceneId, "metricsUpdate", onMetricsUpdate);
 1891112        }
 1113
 1114        public static void ReportOnEnterEvent(string sceneId, string uuid)
 1115        {
 01116            if (string.IsNullOrEmpty(uuid))
 01117                return;
 1118
 01119            onEnterEvent.uuid = uuid;
 1120
 01121            SendSceneEvent(sceneId, "uuidEvent", onEnterEvent);
 01122        }
 1123
 01124        public static void LogOut() { SendMessage("LogOut"); }
 1125
 01126        public static void RedirectToSignUp() { SendMessage("RedirectToSignUp"); }
 1127
 01128        public static void PreloadFinished(string sceneId) { SendMessage("PreloadFinished", sceneId); }
 1129
 1130        public static void ReportMousePosition(Vector3 mousePosition, string id)
 1131        {
 01132            positionPayload.mousePosition = mousePosition;
 01133            positionPayload.id = id;
 01134            SendMessage("ReportMousePosition", positionPayload);
 01135        }
 1136
 1137        public static void SendScreenshot(string encodedTexture, string id)
 1138        {
 01139            onSendScreenshot.encodedTexture = encodedTexture;
 01140            onSendScreenshot.id = id;
 01141            SendMessage("SendScreenshot", onSendScreenshot);
 01142        }
 1143
 1144        public static void SetDelightedSurveyEnabled(bool enabled)
 1145        {
 711146            delightedSurveyEnabled.enabled = enabled;
 711147            SendMessage("SetDelightedSurveyEnabled", delightedSurveyEnabled);
 711148        }
 1149
 1150        public static void SetScenesLoadRadius(float newRadius)
 1151        {
 11152            setScenesLoadRadiusPayload.newRadius = newRadius;
 11153            SendMessage("SetScenesLoadRadius", setScenesLoadRadiusPayload);
 11154        }
 1155
 1156        [System.Serializable]
 1157        public class SaveAvatarPayload
 1158        {
 1159            public string face256;
 1160            public string body;
 1161            public bool isSignUpFlow;
 1162            public AvatarModel avatar;
 1163        }
 1164
 1165        public static class RendererAuthenticationType
 1166        {
 01167            public static string Guest => "guest";
 01168            public static string WalletConnect => "wallet_connect";
 1169        }
 1170
 1171        [System.Serializable]
 1172        public class SendAuthenticationPayload
 1173        {
 1174            public string rendererAuthenticationType;
 1175        }
 1176
 1177        [System.Serializable]
 1178        public class SendPassportPayload
 1179        {
 1180            public string name;
 1181            public string email;
 1182        }
 1183
 1184        [System.Serializable]
 1185        public class SendSaveUserUnverifiedNamePayload
 1186        {
 1187            public string newUnverifiedName;
 1188        }
 1189
 1190        [System.Serializable]
 1191        public class SendSaveUserDescriptionPayload
 1192        {
 1193            public string description;
 1194
 01195            public SendSaveUserDescriptionPayload(string description) { this.description = description; }
 1196        }
 1197
 1198        [Serializable]
 1199        public class SendVideoProgressEvent
 1200        {
 1201            public string componentId;
 1202            public string sceneId;
 1203            public string videoTextureId;
 1204            public int status;
 1205            public float currentOffset;
 1206            public float videoLength;
 1207        }
 1208
 21209        public static void RequestOwnProfileUpdate() { SendMessage("RequestOwnProfileUpdate"); }
 1210
 1211        public static void SendSaveAvatar(AvatarModel avatar, Texture2D face256Snapshot, Texture2D bodySnapshot, bool is
 1212        {
 11213            var payload = new SaveAvatarPayload()
 1214            {
 1215                avatar = avatar,
 1216                face256 = System.Convert.ToBase64String(face256Snapshot.EncodeToPNG()),
 1217                body = System.Convert.ToBase64String(bodySnapshot.EncodeToPNG()),
 1218                isSignUpFlow = isSignUpFlow
 1219            };
 11220            SendMessage("SaveUserAvatar", payload);
 11221        }
 1222
 01223        public static void SendAuthentication(string rendererAuthenticationType) { SendMessage("SendAuthentication", new
 1224
 21225        public static void SendPassport(string name, string email) { SendMessage("SendPassport", new SendPassportPayload
 1226
 1227        public static void SendSaveUserUnverifiedName(string newName)
 1228        {
 01229            var payload = new SendSaveUserUnverifiedNamePayload()
 1230            {
 1231                newUnverifiedName = newName
 1232            };
 1233
 01234            SendMessage("SaveUserUnverifiedName", payload);
 01235        }
 1236
 01237        public static void SendSaveUserDescription(string about) { SendMessage("SaveUserDescription", new SendSaveUserDe
 1238
 21239        public static void SendUserAcceptedCollectibles(string airdropId) { SendMessage("UserAcceptedCollectibles", new 
 1240
 441241        public static void SaveUserTutorialStep(int newTutorialStep) { SendMessage("SaveUserTutorialStep", new TutorialS
 1242
 1243        public static void SendPerformanceReport(string performanceReportPayload)
 1244        {
 01245            SendJson("PerformanceReport", performanceReportPayload);
 01246        }
 1247
 01248        public static void SendSystemInfoReport() { SendMessage("SystemInfoReport", new SystemInfoReportPayload()); }
 1249
 1250        public static void SendTermsOfServiceResponse(string sceneId, bool accepted, bool dontShowAgain)
 1251        {
 21252            var payload = new TermsOfServiceResponsePayload()
 1253            {
 1254                sceneId = sceneId,
 1255                accepted = accepted,
 1256                dontShowAgain = dontShowAgain
 1257            };
 21258            SendMessage("TermsOfServiceResponse", payload);
 21259        }
 1260
 1261        public static void SendExpression(string expressionID, long timestamp)
 1262        {
 11263            SendMessage("TriggerExpression", new SendExpressionPayload()
 1264            {
 1265                id = expressionID,
 1266                timestamp = timestamp
 1267            });
 11268        }
 1269
 1270        public static void OpenURL(string url)
 1271        {
 1272#if UNITY_WEBGL
 31273            SendMessage("OpenWebURL", new OpenURLPayload { url = url });
 1274#else
 1275            Application.OpenURL(url);
 1276#endif
 31277        }
 1278
 21279        public static void PublishStatefulScene(ProtocolV2.PublishPayload payload) { MessageFromEngine("PublishSceneStat
 1280
 121281        public static void StartIsolatedMode(IsolatedConfig config) { MessageFromEngine("StartIsolatedMode", JsonConvert
 1282
 61283        public static void StopIsolatedMode(IsolatedConfig config) { MessageFromEngine("StopIsolatedMode", JsonConvert.S
 1284
 1285        public static void SendReportScene(string sceneID)
 1286        {
 11287            SendMessage("ReportScene", new SendReportScenePayload
 1288            {
 1289                sceneId = sceneID
 1290            });
 11291        }
 1292
 1293        public static void SendReportPlayer(string playerId, string playerName)
 1294        {
 11295            SendMessage("ReportPlayer", new SendReportPlayerPayload
 1296            {
 1297                userId = playerId,
 1298                name = playerName
 1299            });
 11300        }
 1301
 1302        public static void SendBlockPlayer(string userId)
 1303        {
 11304            SendMessage("BlockPlayer", new SendBlockPlayerPayload()
 1305            {
 1306                userId = userId
 1307            });
 11308        }
 1309
 1310        public static void SendUnblockPlayer(string userId)
 1311        {
 01312            SendMessage("UnblockPlayer", new SendUnblockPlayerPayload()
 1313            {
 1314                userId = userId
 1315            });
 01316        }
 1317
 1318        public static void RequestScenesInfoAroundParcel(Vector2 parcel, int maxScenesArea)
 1319        {
 51320            SendMessage("RequestScenesInfoInArea", new RequestScenesInfoAroundParcelPayload()
 1321            {
 1322                parcel = parcel,
 1323                scenesAround = maxScenesArea
 1324            });
 51325        }
 1326
 1327        public static void SendAudioStreamEvent(string url, bool play, float volume)
 1328        {
 271329            onAudioStreamingEvent.url = url;
 271330            onAudioStreamingEvent.play = play;
 271331            onAudioStreamingEvent.volume = volume;
 271332            SendMessage("SetAudioStream", onAudioStreamingEvent);
 271333        }
 1334
 21335        public static void JoinVoiceChat() { SendMessage("JoinVoiceChat"); }
 1336
 21337        public static void LeaveVoiceChat() { SendMessage("LeaveVoiceChat"); }
 1338
 1339        public static void SendSetVoiceChatRecording(bool recording)
 1340        {
 01341            setVoiceChatRecordingPayload.recording = recording;
 01342            SendMessage("SetVoiceChatRecording", setVoiceChatRecordingPayload);
 01343        }
 1344
 01345        public static void ToggleVoiceChatRecording() { SendMessage("ToggleVoiceChatRecording"); }
 1346
 1347        public static void ApplySettings(float voiceChatVolume, int voiceChatAllowCategory)
 1348        {
 61349            applySettingsPayload.voiceChatVolume = voiceChatVolume;
 61350            applySettingsPayload.voiceChatAllowCategory = voiceChatAllowCategory;
 61351            SendMessage("ApplySettings", applySettingsPayload);
 61352        }
 1353
 1354        public static void RequestGIFProcessor(string gifURL, string gifId, bool isWebGL1)
 1355        {
 01356            gifSetupPayload.imageSource = gifURL;
 01357            gifSetupPayload.id = gifId;
 01358            gifSetupPayload.isWebGL1 = isWebGL1;
 1359
 01360            SendMessage("RequestGIFProcessor", gifSetupPayload);
 01361        }
 1362
 1363        public static void DeleteGIF(string id)
 1364        {
 01365            stringPayload.value = id;
 01366            SendMessage("DeleteGIF", stringPayload);
 01367        }
 1368
 1369        public static void GoTo(int x, int y)
 1370        {
 31371            gotoEvent.x = x;
 31372            gotoEvent.y = y;
 31373            SendMessage("GoTo", gotoEvent);
 31374        }
 1375
 01376        public static void GoToCrowd() { SendMessage("GoToCrowd"); }
 1377
 01378        public static void GoToMagic() { SendMessage("GoToMagic"); }
 1379
 1380        public static void JumpIn(int x, int y, string serverName, string layerName)
 1381        {
 31382            jumpInPayload.realm.serverName = serverName;
 31383            jumpInPayload.realm.layer = layerName;
 1384
 31385            jumpInPayload.gridPosition.x = x;
 31386            jumpInPayload.gridPosition.y = y;
 1387
 31388            SendMessage("JumpIn", jumpInPayload);
 31389        }
 1390
 1391        public static void SendChatMessage(ChatMessage message)
 1392        {
 01393            sendChatMessageEvent.message = message;
 01394            SendMessage("SendChatMessage", sendChatMessageEvent);
 01395        }
 1396
 01397        public static void UpdateFriendshipStatus(FriendsController.FriendshipUpdateStatusMessage message) { SendMessage
 1398
 01399        public static void ScenesLoadingFeedback(LoadingFeedbackMessage message) { SendMessage("ScenesLoadingFeedback", 
 1400
 01401        public static void FetchHotScenes() { SendMessage("FetchHotScenes"); }
 1402
 1403        public static void SetBaseResolution(int resolution)
 1404        {
 21405            baseResEvent.baseResolution = resolution;
 21406            SendMessage("SetBaseResolution", baseResEvent);
 21407        }
 1408
 01409        public static void ReportAnalyticsEvent(string eventName) { ReportAnalyticsEvent(eventName, null); }
 1410
 1411        public static void ReportAnalyticsEvent(string eventName, AnalyticsPayload.Property[] eventProperties)
 1412        {
 01413            analyticsEvent.name = eventName;
 01414            analyticsEvent.properties = eventProperties;
 01415            SendMessage("Track", analyticsEvent);
 01416        }
 1417
 41418        public static void FetchBalanceOfMANA() { SendMessage("FetchBalanceOfMANA"); }
 1419
 1420        public static void SendSceneExternalActionEvent(string sceneId, string type, string payload)
 1421        {
 701422            sceneExternalActionEvent.type = type;
 701423            sceneExternalActionEvent.payload = payload;
 701424            SendSceneEvent(sceneId, "externalAction", sceneExternalActionEvent);
 701425        }
 1426
 1427        public static void SetMuteUsers(string[] usersId, bool mute)
 1428        {
 41429            muteUserEvent.usersId = usersId;
 41430            muteUserEvent.mute = mute;
 41431            SendMessage("SetMuteUsers", muteUserEvent);
 41432        }
 1433
 1434        public static void SendCloseUserAvatar(bool isSignUpFlow)
 1435        {
 01436            closeUserAvatarPayload.isSignUpFlow = isSignUpFlow;
 01437            SendMessage("CloseUserAvatar", closeUserAvatarPayload);
 01438        }
 1439
 1440        // Warning: Use this method only for PEXs non-associated to smart wearables.
 1441        //          For PEX associated to smart wearables use 'SetDisabledPortableExperiences'.
 1442        public static void KillPortableExperience(string portableExperienceId)
 1443        {
 01444            killPortableExperiencePayload.portableExperienceId = portableExperienceId;
 01445            SendMessage("KillPortableExperience", killPortableExperiencePayload);
 01446        }
 1447
 1448        public static void RequestThirdPartyWearables(
 1449            string ownedByUser,
 1450            string thirdPartyCollectionId,
 1451            string context)
 1452        {
 11453            requestWearablesPayload.filters = new WearablesRequestFiltersPayload
 1454            {
 1455                ownedByUser = ownedByUser,
 1456                thirdPartyId = thirdPartyCollectionId,
 1457                collectionIds = null,
 1458                wearableIds = null
 1459            };
 1460
 11461            requestWearablesPayload.context = context;
 1462
 11463            SendMessage("RequestWearables", requestWearablesPayload);
 11464        }
 1465
 1466        public static void SetDisabledPortableExperiences(string[] idsToDisable)
 1467        {
 81468            setDisabledPortableExperiencesPayload.idsToDisable = idsToDisable;
 81469            SendMessage("SetDisabledPortableExperiences", setDisabledPortableExperiencesPayload);
 81470        }
 1471
 1472        public static void RequestWearables(
 1473            string ownedByUser,
 1474            string[] wearableIds,
 1475            string[] collectionIds,
 1476            string context)
 1477        {
 11478            requestWearablesPayload.filters = new WearablesRequestFiltersPayload
 1479            {
 1480                ownedByUser = ownedByUser,
 1481                wearableIds = wearableIds,
 1482                collectionIds = collectionIds,
 1483                thirdPartyId = null
 1484            };
 1485
 11486            requestWearablesPayload.context = context;
 1487
 11488            SendMessage("RequestWearables", requestWearablesPayload);
 11489        }
 1490
 1491        public static void SearchENSOwner(string name, int maxResults)
 1492        {
 61493            searchEnsOwnerPayload.name = name;
 61494            searchEnsOwnerPayload.maxResults = maxResults;
 1495
 61496            SendMessage("SearchENSOwner", searchEnsOwnerPayload);
 61497        }
 1498
 1499        public static void RequestUserProfile(string userId)
 1500        {
 161501            stringPayload.value = userId;
 161502            SendMessage("RequestUserProfile", stringPayload);
 161503        }
 1504
 01505        public static void ReportAvatarFatalError() { SendMessage("ReportAvatarFatalError"); }
 1506
 1507        public static void UnpublishScene(Vector2Int sceneCoordinates)
 1508        {
 01509            var payload = new UnpublishScenePayload() { coordinates = $"{sceneCoordinates.x},{sceneCoordinates.y}" };
 01510            SendMessage("UnpublishScene", payload);
 01511        }
 1512
 1513        public static void NotifyStatusThroughChat(string message)
 1514        {
 01515            stringPayload.value = message;
 01516            SendMessage("NotifyStatusThroughChat", stringPayload);
 01517        }
 1518
 1519        public static void ReportVideoProgressEvent(
 1520            string componentId,
 1521            string sceneId,
 1522            string videoClipId,
 1523            int videoStatus,
 1524            float currentOffset,
 1525            float length)
 1526        {
 451527            SendVideoProgressEvent progressEvent = new SendVideoProgressEvent()
 1528            {
 1529                componentId = componentId,
 1530                sceneId = sceneId,
 1531                videoTextureId = videoClipId,
 1532                status = videoStatus,
 1533                currentOffset = currentOffset,
 1534                videoLength = length
 1535            };
 1536
 451537            SendMessage("VideoProgressEvent", progressEvent);
 451538        }
 1539
 1540        public static void ReportAvatarRemoved(string avatarId)
 1541        {
 01542            avatarStatePayload.type = "Removed";
 01543            avatarStatePayload.avatarShapeId = avatarId;
 01544            SendMessage("ReportAvatarState", avatarStatePayload);
 01545        }
 1546
 1547        public static void ReportAvatarSceneChanged(string avatarId, string sceneId)
 1548        {
 01549            avatarSceneChangedPayload.type = "SceneChanged";
 01550            avatarSceneChangedPayload.avatarShapeId = avatarId;
 01551            avatarSceneChangedPayload.sceneId = sceneId;
 01552            SendMessage("ReportAvatarState", avatarSceneChangedPayload);
 01553        }
 1554
 1555        public static void ReportAvatarClick(string sceneId, string userId, Vector3 rayOrigin, Vector3 rayDirection, flo
 1556        {
 01557            avatarOnClickPayload.userId = userId;
 01558            avatarOnClickPayload.ray.origin = rayOrigin;
 01559            avatarOnClickPayload.ray.direction = rayDirection;
 01560            avatarOnClickPayload.ray.distance = distance;
 1561
 01562            SendSceneEvent(sceneId, "playerClicked", avatarOnClickPayload);
 01563        }
 1564
 1565        public static void ReportOnPointerHoverEnterEvent(string sceneId, string uuid)
 1566        {
 41567            onPointerHoverEnterEvent.uuid = uuid;
 41568            SendSceneEvent(sceneId, "uuidEvent", onPointerHoverEnterEvent);
 41569        }
 1570
 1571        public static void ReportOnPointerHoverExitEvent(string sceneId, string uuid)
 1572        {
 11573            onPointerHoverExitEvent.uuid = uuid;
 11574            SendSceneEvent(sceneId, "uuidEvent", onPointerHoverExitEvent);
 11575        }
 1576
 1577        public static void ReportTime(float time, bool isPaused, float timeNormalizationFactor, float cycleTime)
 1578        {
 61579            timeReportPayload.time = time;
 61580            timeReportPayload.isPaused = isPaused;
 61581            timeReportPayload.timeNormalizationFactor = timeNormalizationFactor;
 61582            timeReportPayload.cycleTime = cycleTime;
 61583            SendMessage("ReportDecentralandTime", timeReportPayload);
 61584        }
 1585    }
 1586}

Methods/Properties

WebInterface()
SceneReady(System.String)
ActivateRenderingACK()
DeactivateRenderingACK()
OnGlobalPointerEvent()
StoreSceneStateEvent()
OnTextInputChangeTextEventPayload()
operator+(DCL.Interface.WebInterface/MetricsModel, DCL.Interface.WebInterface/MetricsModel)
OnMetricsUpdate()
TransformPayload()
SystemInfoReportPayload()
JumpInPayload()
Property(System.String, System.String)
HeadersPayload()
AvatarOnClickPayload()
OnMessageFromEngine(System.Action[String,String])
OnMessageFromEngine()
StartDecentraland()
CheckURLParam(System.String)
GetURLParam(System.String)
MessageFromEngine(System.String, System.String)
ProcessQueuedMessages()
GetGraphicCard()
SendMessage(System.String)
SendMessage[T](System.String, T)
SendJson(System.String, System.String)
SendSceneEvent[T](System.String, System.String, T)
SendAllScenesEvent[T](System.String, T)
ReportPosition(UnityEngine.Vector3, UnityEngine.Quaternion, System.Single, UnityEngine.Quaternion)
ReportCameraChanged(DCL.CameraTool.CameraMode/ModeId)
ReportCameraChanged(DCL.CameraTool.CameraMode/ModeId, System.String)
Web3UseResponse(System.String, System.Boolean)
ReportIdleStateChanged(System.Boolean)
ReportControlEvent[T](T)
SendRequestHeadersForUrl(System.String, System.String, System.String, System.Collections.Generic.Dictionary[String,Object])
BuilderInWorldMessage(System.String, System.String)
ReportOnClickEvent(System.String, System.String)
ReportRaycastResult[T, P](System.String, System.String, System.String, P)
ReportRaycastHitFirstResult(System.String, System.String, DCL.Models.RaycastType, DCL.Interface.WebInterface/RaycastHitEntity)
ReportRaycastHitAllResult(System.String, System.String, DCL.Models.RaycastType, DCL.Interface.WebInterface/RaycastHitEntities)
CreateHitObject(System.String, System.String, UnityEngine.Vector3, UnityEngine.Vector3, System.Single)
SetPointerEventPayload(DCL.Interface.WebInterface/OnPointerEventPayload, DCL.Interface.WebInterface/ACTION_BUTTON, System.String, System.String, UnityEngine.Ray, UnityEngine.Vector3, UnityEngine.Vector3, System.Single, System.Boolean)
ReportGlobalPointerDownEvent(DCL.Interface.WebInterface/ACTION_BUTTON, UnityEngine.Ray, UnityEngine.Vector3, UnityEngine.Vector3, System.Single, System.String, System.String, System.String, System.Boolean)
ReportGlobalPointerUpEvent(DCL.Interface.WebInterface/ACTION_BUTTON, UnityEngine.Ray, UnityEngine.Vector3, UnityEngine.Vector3, System.Single, System.String, System.String, System.String, System.Boolean)
ReportOnPointerDownEvent(DCL.Interface.WebInterface/ACTION_BUTTON, System.String, System.String, System.String, System.String, UnityEngine.Ray, UnityEngine.Vector3, UnityEngine.Vector3, System.Single)
ReportOnPointerUpEvent(DCL.Interface.WebInterface/ACTION_BUTTON, System.String, System.String, System.String, System.String, UnityEngine.Ray, UnityEngine.Vector3, UnityEngine.Vector3, System.Single)
ReportOnTextSubmitEvent(System.String, System.String, System.String)
ReportOnTextInputChangedEvent(System.String, System.String, System.String)
ReportOnTextInputChangedTextEvent(System.String, System.String, System.String, System.Boolean)
ReportOnFocusEvent(System.String, System.String)
ReportOnBlurEvent(System.String, System.String)
ReportOnScrollChange(System.String, System.String, UnityEngine.Vector2, System.Int32)
ReportEvent[T](System.String, T)
ReportOnMetricsUpdate(System.String, DCL.Interface.WebInterface/MetricsModel, DCL.Interface.WebInterface/MetricsModel)
ReportOnEnterEvent(System.String, System.String)
LogOut()
RedirectToSignUp()
PreloadFinished(System.String)
ReportMousePosition(UnityEngine.Vector3, System.String)
SendScreenshot(System.String, System.String)
SetDelightedSurveyEnabled(System.Boolean)
SetScenesLoadRadius(System.Single)
Guest()
WalletConnect()
SendSaveUserDescriptionPayload(System.String)
RequestOwnProfileUpdate()
SendSaveAvatar(AvatarModel, UnityEngine.Texture2D, UnityEngine.Texture2D, System.Boolean)
SendAuthentication(System.String)
SendPassport(System.String, System.String)
SendSaveUserUnverifiedName(System.String)
SendSaveUserDescription(System.String)
SendUserAcceptedCollectibles(System.String)
SaveUserTutorialStep(System.Int32)
SendPerformanceReport(System.String)
SendSystemInfoReport()
SendTermsOfServiceResponse(System.String, System.Boolean, System.Boolean)
SendExpression(System.String, System.Int64)
OpenURL(System.String)
PublishStatefulScene(ProtocolV2/PublishPayload)
StartIsolatedMode(IsolatedConfig)
StopIsolatedMode(IsolatedConfig)
SendReportScene(System.String)
SendReportPlayer(System.String, System.String)
SendBlockPlayer(System.String)
SendUnblockPlayer(System.String)
RequestScenesInfoAroundParcel(UnityEngine.Vector2, System.Int32)
SendAudioStreamEvent(System.String, System.Boolean, System.Single)
JoinVoiceChat()
LeaveVoiceChat()
SendSetVoiceChatRecording(System.Boolean)
ToggleVoiceChatRecording()
ApplySettings(System.Single, System.Int32)
RequestGIFProcessor(System.String, System.String, System.Boolean)
DeleteGIF(System.String)
GoTo(System.Int32, System.Int32)
GoToCrowd()
GoToMagic()
JumpIn(System.Int32, System.Int32, System.String, System.String)
SendChatMessage(DCL.Interface.ChatMessage)
UpdateFriendshipStatus(FriendsController/FriendshipUpdateStatusMessage)
ScenesLoadingFeedback(DCL.Interface.WebInterface/LoadingFeedbackMessage)
FetchHotScenes()
SetBaseResolution(System.Int32)
ReportAnalyticsEvent(System.String)
ReportAnalyticsEvent(System.String, DCL.Interface.WebInterface/AnalyticsPayload/Property[])
FetchBalanceOfMANA()
SendSceneExternalActionEvent(System.String, System.String, System.String)
SetMuteUsers(System.String[], System.Boolean)
SendCloseUserAvatar(System.Boolean)
KillPortableExperience(System.String)
RequestThirdPartyWearables(System.String, System.String, System.String)
SetDisabledPortableExperiences(System.String[])
RequestWearables(System.String, System.String[], System.String[], System.String)
SearchENSOwner(System.String, System.Int32)
RequestUserProfile(System.String)
ReportAvatarFatalError()
UnpublishScene(UnityEngine.Vector2Int)
NotifyStatusThroughChat(System.String)
ReportVideoProgressEvent(System.String, System.String, System.String, System.Int32, System.Single, System.Single)
ReportAvatarRemoved(System.String)
ReportAvatarSceneChanged(System.String, System.String)
ReportAvatarClick(System.String, System.String, UnityEngine.Vector3, UnityEngine.Vector3, System.Single)
ReportOnPointerHoverEnterEvent(System.String, System.String)
ReportOnPointerHoverExitEvent(System.String, System.String)
ReportTime(System.Single, System.Boolean, System.Single, System.Single)