< Summary

Class:DCL.Interface.WebInterface
Assembly:WebInterface
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WebInterface/Interface.cs
Covered lines:280
Uncovered lines:162
Coverable lines:442
Total lines:1606
Line coverage:63.3% (280 of 442)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
WebInterface()0%110100%
StartStatefulMode(...)0%110100%
StopStatefulMode(...)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%
MessageFromEngine(...)0%5.395075%
ProcessQueuedMessages()0%330100%
GetGraphicCard()0%2100%
SendMessage(...)0%110100%
SendMessage[T](...)0%2.032080%
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%
SendReportScene(...)0%2100%
SendReportPlayer(...)0%110100%
SendBlockPlayer(...)0%110100%
SendUnblockPlayer(...)0%2100%
RequestScenesInfoAroundParcel(...)0%2100%
SendAudioStreamEvent(...)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%110100%
UpdateFriendshipStatus(...)0%110100%
ScenesLoadingFeedback(...)0%2100%
FetchHotScenes()0%2100%
SetBaseResolution(...)0%110100%
ReportAnalyticsEvent(...)0%2100%
ReportAnalyticsEvent(...)0%2100%
FetchBalanceOfMANA()0%110100%
SendSceneExternalActionEvent(...)0%110100%
SetMuteUsers(...)0%2100%
SendCloseUserAvatar(...)0%2100%
KillPortableExperience(...)0%2100%
SetDisabledPortableExperiences(...)0%110100%
RequestWearables(...)0%110100%
SearchENSOwner(...)0%110100%
RequestUserProfile(...)0%110100%
ReportAvatarFatalError()0%2100%
UnpublishScene(...)0%110100%
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.Helpers;
 4using DCL.Models;
 5using UnityEngine;
 6using Ray = UnityEngine.Ray;
 7
 8#if UNITY_WEBGL && !UNITY_EDITOR
 9using System.Runtime.InteropServices;
 10#endif
 11
 12namespace DCL.Interface
 13{
 14    /**
 15     * This class contains the outgoing interface of Decentraland.
 16     * You must call those functions to interact with the WebInterface.
 17     *
 18     * The messages comming from the WebInterface instead, are reported directly to
 19     * the handler GameObject by name.
 20     */
 21    public static class WebInterface
 22    {
 123        public static bool VERBOSE = false;
 24
 25        [System.Serializable]
 26        public class ReportPositionPayload
 27        {
 28            /** Camera position, world space */
 29            public Vector3 position;
 30
 31            /** Character rotation */
 32            public Quaternion rotation;
 33
 34            /** Camera rotation */
 35            public Quaternion cameraRotation;
 36
 37            /** Camera height, relative to the feet of the avatar or ground */
 38            public float playerHeight;
 39
 40            public Vector3 mousePosition;
 41
 42            public string id;
 43        }
 44
 45        [System.Serializable]
 46        public abstract class ControlEvent
 47        {
 48            public string eventType;
 49        }
 50
 51        public abstract class ControlEvent<T> : ControlEvent
 52        {
 53            public T payload;
 54
 55            protected ControlEvent(string eventType, T payload)
 56            {
 57                this.eventType = eventType;
 58                this.payload = payload;
 59            }
 60        }
 61
 62        [System.Serializable]
 63        public class StartStatefulMode : ControlEvent<StartStatefulMode.Payload>
 64        {
 65            [System.Serializable]
 66            public class Payload
 67            {
 68                public string sceneId;
 69            }
 70
 471            public StartStatefulMode(string sceneId) : base("StartStatefulMode", new Payload() { sceneId = sceneId }) { 
 72        }
 73
 74        [System.Serializable]
 75        public class StopStatefulMode : ControlEvent<StopStatefulMode.Payload>
 76        {
 77            [System.Serializable]
 78            public class Payload
 79            {
 80                public string sceneId;
 81            }
 82
 483            public StopStatefulMode(string sceneId) : base("StopStatefulMode", new Payload() { sceneId = sceneId }) { }
 84        }
 85
 86        [System.Serializable]
 87        public class SceneReady : ControlEvent<SceneReady.Payload>
 88        {
 89            [System.Serializable]
 90            public class Payload
 91            {
 92                public string sceneId;
 93            }
 94
 77895            public SceneReady(string sceneId) : base("SceneReady", new Payload() { sceneId = sceneId }) { }
 96        }
 97
 98        [System.Serializable]
 99        public class ActivateRenderingACK : ControlEvent<object>
 100        {
 2101            public ActivateRenderingACK() : base("ActivateRenderingACK", null) { }
 102        }
 103
 104        [System.Serializable]
 105        public class DeactivateRenderingACK : ControlEvent<object>
 106        {
 0107            public DeactivateRenderingACK() : base("DeactivateRenderingACK", null) { }
 108        }
 109
 110        [System.Serializable]
 111        public class SceneEvent<T>
 112        {
 113            public string sceneId;
 114            public string eventType;
 115            public T payload;
 116        }
 117
 118        [System.Serializable]
 119        public class AllScenesEvent<T>
 120        {
 121            public string eventType;
 122            public T payload;
 123        }
 124
 125        [System.Serializable]
 126        public class UUIDEvent<TPayload>
 127            where TPayload : class, new()
 128        {
 129            public string uuid;
 130            public TPayload payload = new TPayload();
 131        }
 132
 133        public enum ACTION_BUTTON
 134        {
 135            POINTER,
 136            PRIMARY,
 137            SECONDARY,
 138            ANY,
 139            FORWARD,
 140            BACKWARD,
 141            RIGHT,
 142            LEFT,
 143            JUMP,
 144            WALK,
 145            ACTION_3,
 146            ACTION_4,
 147            ACTION_5,
 148            ACTION_6
 149        }
 150
 151        [System.Serializable]
 152        public class OnClickEvent : UUIDEvent<OnClickEventPayload> { };
 153
 154        [System.Serializable]
 155        public class CameraModePayload
 156        {
 157            public CameraMode.ModeId cameraMode;
 158        };
 159
 160        [System.Serializable]
 161        public class Web3UseResponsePayload
 162        {
 163            public string id;
 164            public bool result;
 165        };
 166
 167        [System.Serializable]
 168        public class IdleStateChangedPayload
 169        {
 170            public bool isIdle;
 171        };
 172
 173        [System.Serializable]
 174        public class OnPointerDownEvent : UUIDEvent<OnPointerEventPayload> { };
 175
 176        [System.Serializable]
 177        public class OnGlobalPointerEvent
 178        {
 0179            public OnGlobalPointerEventPayload payload = new OnGlobalPointerEventPayload();
 180        };
 181
 182        [System.Serializable]
 183        public class OnPointerUpEvent : UUIDEvent<OnPointerEventPayload> { };
 184
 185        [System.Serializable]
 186        private class OnTextSubmitEvent : UUIDEvent<OnTextSubmitEventPayload> { };
 187
 188        [System.Serializable]
 189        private class OnTextInputChangeEvent : UUIDEvent<OnTextInputChangeEventPayload> { };
 190
 191        [System.Serializable]
 192        private class OnTextInputChangeTextEvent : UUIDEvent<OnTextInputChangeTextEventPayload> { };
 193
 194        [System.Serializable]
 195        private class OnScrollChangeEvent : UUIDEvent<OnScrollChangeEventPayload> { };
 196
 197        [System.Serializable]
 198        private class OnFocusEvent : UUIDEvent<EmptyPayload> { };
 199
 200        [System.Serializable]
 201        private class OnBlurEvent : UUIDEvent<EmptyPayload> { };
 202
 203        [System.Serializable]
 204        public class OnEnterEvent : UUIDEvent<OnEnterEventPayload> { };
 205
 206        [System.Serializable]
 207        public class OnClickEventPayload
 208        {
 209            public ACTION_BUTTON buttonId = ACTION_BUTTON.POINTER;
 210        }
 211
 212        [System.Serializable]
 213        public class SendChatMessageEvent
 214        {
 215            public ChatMessage message;
 216        }
 217
 218        [System.Serializable]
 219        public class RemoveEntityComponentsPayLoad
 220        {
 221            public string entityId;
 222            public string componentId;
 223        };
 224
 225        [System.Serializable]
 226        public class StoreSceneStateEvent
 227        {
 1228            public string type = "StoreSceneState";
 1229            public string payload = "";
 230        };
 231
 232        [System.Serializable]
 233        public class OnPointerEventPayload
 234        {
 235            [System.Serializable]
 236            public class Hit
 237            {
 238                public Vector3 origin;
 239                public float length;
 240                public Vector3 hitPoint;
 241                public Vector3 normal;
 242                public Vector3 worldNormal;
 243                public string meshName;
 244                public string entityId;
 245            }
 246
 247            public ACTION_BUTTON buttonId;
 248            public Vector3 origin;
 249            public Vector3 direction;
 250            public Hit hit;
 251        }
 252
 253        [System.Serializable]
 254        public class OnGlobalPointerEventPayload : OnPointerEventPayload
 255        {
 256            public enum InputEventType
 257            {
 258                DOWN,
 259                UP
 260            }
 261
 262            public InputEventType type;
 263        }
 264
 265        [System.Serializable]
 266        public class OnTextSubmitEventPayload
 267        {
 268            public string id;
 269            public string text;
 270        }
 271
 272        [System.Serializable]
 273        public class OnTextInputChangeEventPayload
 274        {
 275            public string value;
 276        }
 277
 278        [System.Serializable]
 279        public class OnTextInputChangeTextEventPayload
 280        {
 281            [System.Serializable]
 282            public class Payload
 283            {
 284                public string value;
 285                public bool isSubmit;
 286            }
 287
 2288            public Payload value = new Payload();
 289        }
 290
 291        [System.Serializable]
 292        public class OnScrollChangeEventPayload
 293        {
 294            public Vector2 value;
 295            public int pointerId;
 296        }
 297
 298        [System.Serializable]
 299        public class EmptyPayload { }
 300
 301        [System.Serializable]
 302        public class MetricsModel
 303        {
 304            public int meshes;
 305            public int bodies;
 306            public int materials;
 307            public int textures;
 308            public int triangles;
 309            public int entities;
 310
 311            public static MetricsModel operator +(MetricsModel lhs, MetricsModel rhs)
 312            {
 0313                return new MetricsModel()
 314                {
 315                    meshes = lhs.meshes + rhs.meshes,
 316                    bodies = lhs.bodies + rhs.bodies,
 317                    materials = lhs.materials + rhs.materials,
 318                    textures = lhs.textures + rhs.textures,
 319                    triangles = lhs.triangles + rhs.triangles,
 320                    entities = lhs.entities + rhs.entities
 321                };
 322            }
 323        }
 324
 325        [System.Serializable]
 326        private class OnMetricsUpdate
 327        {
 1328            public MetricsModel given = new MetricsModel();
 1329            public MetricsModel limit = new MetricsModel();
 330        }
 331
 332        [System.Serializable]
 333        public class OnEnterEventPayload { }
 334
 335        [System.Serializable]
 336        public class TransformPayload
 337        {
 0338            public Vector3 position = Vector3.zero;
 0339            public Quaternion rotation = Quaternion.identity;
 0340            public Vector3 scale = Vector3.one;
 341        }
 342
 343        public class OnSendScreenshot
 344        {
 345            public string id;
 346            public string encodedTexture;
 347        };
 348
 349        [System.Serializable]
 350        public class GotoEvent
 351        {
 352            public int x;
 353            public int y;
 354        };
 355
 356        [System.Serializable]
 357        public class BaseResolution
 358        {
 359            public int baseResolution;
 360        };
 361
 362        //-----------------------------------------------------
 363        // Raycast
 364        [System.Serializable]
 365        public class RayInfo
 366        {
 367            public Vector3 origin;
 368            public Vector3 direction;
 369            public float distance;
 370        }
 371
 372        [System.Serializable]
 373        public class RaycastHitInfo
 374        {
 375            public bool didHit;
 376            public RayInfo ray;
 377
 378            public Vector3 hitPoint;
 379            public Vector3 hitNormal;
 380        }
 381
 382        [System.Serializable]
 383        public class HitEntityInfo
 384        {
 385            public string entityId;
 386            public string meshName;
 387        }
 388
 389        [System.Serializable]
 390        public class RaycastHitEntity : RaycastHitInfo
 391        {
 392            public HitEntityInfo entity;
 393        }
 394
 395        [System.Serializable]
 396        public class RaycastHitEntities : RaycastHitInfo
 397        {
 398            public RaycastHitEntity[] entities;
 399        }
 400
 401        [System.Serializable]
 402        public class RaycastResponse<T> where T : RaycastHitInfo
 403        {
 404            public string queryId;
 405            public string queryType;
 406            public T payload;
 407        }
 408
 409        // Note (Zak): We need to explicitly define this classes for the JsonUtility to
 410        // be able to serialize them
 411        [System.Serializable]
 412        public class RaycastHitFirstResponse : RaycastResponse<RaycastHitEntity> { }
 413
 414        [System.Serializable]
 415        public class RaycastHitAllResponse : RaycastResponse<RaycastHitEntities> { }
 416
 417        [System.Serializable]
 418        public class SendExpressionPayload
 419        {
 420            public string id;
 421            public long timestamp;
 422        }
 423
 424        [System.Serializable]
 425        public class UserAcceptedCollectiblesPayload
 426        {
 427            public string id;
 428        }
 429
 430        [System.Serializable]
 431        public class SendBlockPlayerPayload
 432        {
 433            public string userId;
 434        }
 435
 436        [System.Serializable]
 437        public class SendUnblockPlayerPayload
 438        {
 439            public string userId;
 440        }
 441
 442        [System.Serializable]
 443        public class TutorialStepPayload
 444        {
 445            public int tutorialStep;
 446        }
 447
 448        [System.Serializable]
 449        public class PerformanceReportPayload
 450        {
 451            public string samples;
 452            public bool fpsIsCapped;
 453            public int hiccupsInThousandFrames;
 454            public float hiccupsTime;
 455            public float totalTime;
 456        }
 457
 458        [System.Serializable]
 459        public class SystemInfoReportPayload
 460        {
 0461            public string graphicsDeviceName = SystemInfo.graphicsDeviceName;
 0462            public string graphicsDeviceVersion = SystemInfo.graphicsDeviceVersion;
 0463            public int graphicsMemorySize = SystemInfo.graphicsMemorySize;
 0464            public string processorType = SystemInfo.processorType;
 0465            public int processorCount = SystemInfo.processorCount;
 0466            public int systemMemorySize = SystemInfo.systemMemorySize;
 467        }
 468
 469        [System.Serializable]
 470        public class GenericAnalyticPayload
 471        {
 472            public string eventName;
 473            public Dictionary<object, object> data;
 474        }
 475
 476        [System.Serializable]
 477        public class PerformanceHiccupPayload
 478        {
 479            public int hiccupsInThousandFrames;
 480            public float hiccupsTime;
 481            public float totalTime;
 482        }
 483
 484        [System.Serializable]
 485        public class TermsOfServiceResponsePayload
 486        {
 487            public string sceneId;
 488            public bool dontShowAgain;
 489            public bool accepted;
 490        }
 491
 492        [System.Serializable]
 493        public class OpenURLPayload
 494        {
 495            public string url;
 496        }
 497
 498        [System.Serializable]
 499        public class GIFSetupPayload
 500        {
 501            public string imageSource;
 502            public string id;
 503            public bool isWebGL1;
 504        }
 505
 506        [System.Serializable]
 507        public class RequestScenesInfoAroundParcelPayload
 508        {
 509            public Vector2 parcel;
 510            public int scenesAround;
 511        }
 512
 513        [System.Serializable]
 514        public class AudioStreamingPayload
 515        {
 516            public string url;
 517            public bool play;
 518            public float volume;
 519        }
 520
 521        [System.Serializable]
 522        public class SetScenesLoadRadiusPayload
 523        {
 524            public float newRadius;
 525        }
 526
 527        [System.Serializable]
 528        public class SetVoiceChatRecordingPayload
 529        {
 530            public bool recording;
 531        }
 532
 533        [System.Serializable]
 534        public class ApplySettingsPayload
 535        {
 536            public float voiceChatVolume;
 537            public int voiceChatAllowCategory;
 538        }
 539
 540        [System.Serializable]
 541        public class JumpInPayload
 542        {
 0543            public FriendsController.UserStatus.Realm realm = new FriendsController.UserStatus.Realm();
 544            public Vector2 gridPosition;
 545        }
 546
 547        [System.Serializable]
 548        public class LoadingFeedbackMessage
 549        {
 550            public string message;
 551            public int loadPercentage;
 552        }
 553
 554        [System.Serializable]
 555        public class AnalyticsPayload
 556        {
 557            [System.Serializable]
 558            public class Property
 559            {
 560                public string key;
 561                public string value;
 562
 0563                public Property(string key, string value)
 564                {
 0565                    this.key = key;
 0566                    this.value = value;
 0567                }
 568            }
 569
 570            public string name;
 571            public Property[] properties;
 572        }
 573
 574        [System.Serializable]
 575        public class DelightedSurveyEnabledPayload
 576        {
 577            public bool enabled;
 578        }
 579
 580        [System.Serializable]
 581        public class ExternalActionSceneEventPayload
 582        {
 583            public string type;
 584            public string payload;
 585        }
 586
 587        [System.Serializable]
 588        public class MuteUserPayload
 589        {
 590            public string[] usersId;
 591            public bool mute;
 592        }
 593
 594        [System.Serializable]
 595        public class CloseUserAvatarPayload
 596        {
 597            public bool isSignUpFlow;
 598        }
 599
 600        [System.Serializable]
 601        public class StringPayload
 602        {
 603            public string value;
 604        }
 605
 606        [System.Serializable]
 607        public class KillPortableExperiencePayload
 608        {
 609            public string portableExperienceId;
 610        }
 611
 612        [System.Serializable]
 613        public class SetDisabledPortableExperiencesPayload
 614        {
 615            public string[] idsToDisable;
 616        }
 617
 618        [System.Serializable]
 619        public class WearablesRequestFiltersPayload
 620        {
 621            public string ownedByUser;
 622            public string[] wearableIds;
 623            public string[] collectionIds;
 624        }
 625
 626        [System.Serializable]
 627        public class RequestWearablesPayload
 628        {
 629            public WearablesRequestFiltersPayload filters;
 630            public string context;
 631        }
 632
 633        [System.Serializable]
 634        public class HeadersPayload
 635        {
 636            public string method;
 637            public string url;
 1638            public Dictionary<string, object> metadata = new Dictionary<string, object>();
 639        }
 640
 641        [System.Serializable]
 642        public class SearchENSOwnerPayload
 643        {
 644            public string name;
 645            public int maxResults;
 646        }
 647
 648        [System.Serializable]
 649        public class UnpublishScenePayload
 650        {
 651            public string coordinates;
 652        }
 653
 654        [System.Serializable]
 655        public class AvatarStateBase
 656        {
 657            public string type;
 658            public string entityId;
 659            public string avatarShapeId;
 660        }
 661
 662        [System.Serializable]
 663        public class AvatarStateSceneChanged : AvatarStateBase
 664        {
 665            public string sceneId;
 666        }
 667
 668        [System.Serializable]
 669        public class AvatarOnClickPayload
 670        {
 671            public string userId;
 0672            public RayInfo ray = new RayInfo();
 673        }
 674
 675        [System.Serializable]
 676        public class TimeReportPayload
 677        {
 678            public float timeNormalizationFactor;
 679            public float cycleTime;
 680            public bool isPaused;
 681            public float time;
 682        }
 683
 684#if UNITY_WEBGL && !UNITY_EDITOR
 685    /**
 686     * This method is called after the first render. It marks the loading of the
 687     * rest of the JS client.
 688     */
 689    [DllImport("__Internal")] public static extern void StartDecentraland();
 690    [DllImport("__Internal")] public static extern void MessageFromEngine(string type, string message);
 691    [DllImport("__Internal")] public static extern string GetGraphicCard();
 692    [DllImport("__Internal")] public static extern bool CheckURLParam(string targetParam);
 693
 694    public static System.Action<string, string> OnMessageFromEngine;
 695#else
 696        public static Action<string, string> OnMessageFromEngine
 697        {
 698            set
 699            {
 90700                OnMessage = value;
 90701                if (OnMessage != null)
 702                {
 45703                    ProcessQueuedMessages();
 704                }
 90705            }
 0706            get => OnMessage;
 707        }
 708        private static Action<string, string> OnMessage;
 709
 1710        private static bool hasQueuedMessages = false;
 1711        private static List<(string, string)> queuedMessages = new List<(string, string)>();
 0712        public static void StartDecentraland() { }
 713        public static bool CheckURLParam(string targetParam)
 714        {
 0715            return false;
 716        }
 717
 718        public static void MessageFromEngine(string type, string message)
 719        {
 3857720            if (OnMessageFromEngine != null)
 721            {
 1961722                if (hasQueuedMessages)
 723                {
 0724                    ProcessQueuedMessages();
 725                }
 726
 1961727                OnMessageFromEngine.Invoke(type, message);
 1961728                if (VERBOSE)
 729                {
 0730                    Debug.Log("MessageFromEngine called with: " + type + ", " + message);
 731                }
 0732            }
 733            else
 734            {
 1896735                lock (queuedMessages)
 736                {
 1896737                    queuedMessages.Add((type, message));
 1896738                }
 739
 1896740                hasQueuedMessages = true;
 741            }
 3857742        }
 743
 744        private static void ProcessQueuedMessages()
 745        {
 45746            hasQueuedMessages = false;
 45747            lock (queuedMessages)
 748            {
 3880749                foreach ((string type, string payload) in queuedMessages)
 750                {
 1895751                    MessageFromEngine(type, payload);
 752                }
 753
 45754                queuedMessages.Clear();
 45755            }
 45756        }
 757
 0758        public static string GetGraphicCard() => "In Editor Graphic Card";
 759#endif
 760
 761        public static void SendMessage(string type)
 762        {
 763            // sending an empty JSON object to be compatible with other messages
 3764            MessageFromEngine(type, "{}");
 3765        }
 766
 767        public static void SendMessage<T>(string type, T message)
 768        {
 1954769            string messageJson = JsonUtility.ToJson(message);
 770
 1954771            if (VERBOSE)
 772            {
 0773                Debug.Log($"Sending message: " + messageJson);
 774            }
 775
 1954776            MessageFromEngine(type, messageJson);
 1954777        }
 778
 1779        private static ReportPositionPayload positionPayload = new ReportPositionPayload();
 1780        private static CameraModePayload cameraModePayload = new CameraModePayload();
 1781        private static Web3UseResponsePayload web3UseResponsePayload = new Web3UseResponsePayload();
 1782        private static IdleStateChangedPayload idleStateChangedPayload = new IdleStateChangedPayload();
 1783        private static OnMetricsUpdate onMetricsUpdate = new OnMetricsUpdate();
 1784        private static OnClickEvent onClickEvent = new OnClickEvent();
 1785        private static OnPointerDownEvent onPointerDownEvent = new OnPointerDownEvent();
 1786        private static OnPointerUpEvent onPointerUpEvent = new OnPointerUpEvent();
 1787        private static OnTextSubmitEvent onTextSubmitEvent = new OnTextSubmitEvent();
 1788        private static OnTextInputChangeEvent onTextInputChangeEvent = new OnTextInputChangeEvent();
 1789        private static OnTextInputChangeTextEvent onTextInputChangeTextEvent = new OnTextInputChangeTextEvent();
 1790        private static OnScrollChangeEvent onScrollChangeEvent = new OnScrollChangeEvent();
 1791        private static OnFocusEvent onFocusEvent = new OnFocusEvent();
 1792        private static OnBlurEvent onBlurEvent = new OnBlurEvent();
 1793        private static OnEnterEvent onEnterEvent = new OnEnterEvent();
 1794        private static OnSendScreenshot onSendScreenshot = new OnSendScreenshot();
 1795        private static OnPointerEventPayload onPointerEventPayload = new OnPointerEventPayload();
 1796        private static OnGlobalPointerEventPayload onGlobalPointerEventPayload = new OnGlobalPointerEventPayload();
 1797        private static OnGlobalPointerEvent onGlobalPointerEvent = new OnGlobalPointerEvent();
 1798        private static AudioStreamingPayload onAudioStreamingEvent = new AudioStreamingPayload();
 1799        private static SetVoiceChatRecordingPayload setVoiceChatRecordingPayload = new SetVoiceChatRecordingPayload();
 1800        private static SetScenesLoadRadiusPayload setScenesLoadRadiusPayload = new SetScenesLoadRadiusPayload();
 1801        private static ApplySettingsPayload applySettingsPayload = new ApplySettingsPayload();
 1802        private static GIFSetupPayload gifSetupPayload = new GIFSetupPayload();
 1803        private static JumpInPayload jumpInPayload = new JumpInPayload();
 1804        private static GotoEvent gotoEvent = new GotoEvent();
 1805        private static SendChatMessageEvent sendChatMessageEvent = new SendChatMessageEvent();
 1806        private static BaseResolution baseResEvent = new BaseResolution();
 1807        private static AnalyticsPayload analyticsEvent = new AnalyticsPayload();
 1808        private static DelightedSurveyEnabledPayload delightedSurveyEnabled = new DelightedSurveyEnabledPayload();
 1809        private static ExternalActionSceneEventPayload sceneExternalActionEvent = new ExternalActionSceneEventPayload();
 1810        private static MuteUserPayload muteUserEvent = new MuteUserPayload();
 1811        private static StoreSceneStateEvent storeSceneState = new StoreSceneStateEvent();
 1812        private static CloseUserAvatarPayload closeUserAvatarPayload = new CloseUserAvatarPayload();
 1813        private static StringPayload stringPayload = new StringPayload();
 1814        private static KillPortableExperiencePayload killPortableExperiencePayload = new KillPortableExperiencePayload()
 1815        private static SetDisabledPortableExperiencesPayload setDisabledPortableExperiencesPayload = new SetDisabledPort
 1816        private static RequestWearablesPayload requestWearablesPayload = new RequestWearablesPayload();
 1817        private static SearchENSOwnerPayload searchEnsOwnerPayload = new SearchENSOwnerPayload();
 1818        private static HeadersPayload headersPayload = new HeadersPayload();
 1819        private static AvatarStateBase avatarStatePayload = new AvatarStateBase();
 1820        private static AvatarStateSceneChanged avatarSceneChangedPayload = new AvatarStateSceneChanged();
 1821        public static AvatarOnClickPayload avatarOnClickPayload = new AvatarOnClickPayload();
 1822        private static UUIDEvent<EmptyPayload> onPointerHoverEnterEvent = new UUIDEvent<EmptyPayload>();
 1823        private static UUIDEvent<EmptyPayload> onPointerHoverExitEvent = new UUIDEvent<EmptyPayload>();
 1824        private static TimeReportPayload timeReportPayload = new TimeReportPayload();
 825
 826        public static void SendSceneEvent<T>(string sceneId, string eventType, T payload)
 827        {
 680828            SceneEvent<T> sceneEvent = new SceneEvent<T>();
 680829            sceneEvent.sceneId = sceneId;
 680830            sceneEvent.eventType = eventType;
 680831            sceneEvent.payload = payload;
 832
 680833            SendMessage("SceneEvent", sceneEvent);
 680834        }
 835
 836        private static void SendAllScenesEvent<T>(string eventType, T payload)
 837        {
 600838            AllScenesEvent<T> allScenesEvent = new AllScenesEvent<T>();
 600839            allScenesEvent.eventType = eventType;
 600840            allScenesEvent.payload = payload;
 841
 600842            SendMessage("AllScenesEvent", allScenesEvent);
 600843        }
 844
 845        public static void ReportPosition(Vector3 position, Quaternion rotation, float playerHeight, Quaternion cameraRo
 846        {
 74847            positionPayload.position = position;
 74848            positionPayload.rotation = rotation;
 74849            positionPayload.playerHeight = playerHeight;
 74850            positionPayload.cameraRotation = cameraRotation;
 851
 74852            SendMessage("ReportPosition", positionPayload);
 74853        }
 854
 855        public static void ReportCameraChanged(CameraMode.ModeId cameraMode)
 856        {
 599857            ReportCameraChanged(cameraMode, null);
 599858        }
 859
 860        public static void ReportCameraChanged(CameraMode.ModeId cameraMode, string targetSceneId)
 861        {
 988862            cameraModePayload.cameraMode = cameraMode;
 988863            if (!string.IsNullOrEmpty(targetSceneId))
 864            {
 389865                SendSceneEvent(targetSceneId, "cameraModeChanged", cameraModePayload);
 389866            }
 867            else
 868            {
 599869                SendAllScenesEvent("cameraModeChanged", cameraModePayload);
 870            }
 599871        }
 872
 873        public static void Web3UseResponse(string id, bool result)
 874        {
 0875            web3UseResponsePayload.id = id;
 0876            web3UseResponsePayload.result = result;
 0877            SendMessage("Web3UseResponse", web3UseResponsePayload);
 0878        }
 879
 880        public static void ReportIdleStateChanged(bool isIdle)
 881        {
 1882            idleStateChangedPayload.isIdle = isIdle;
 1883            SendAllScenesEvent("idleStateChanged", idleStateChangedPayload);
 1884        }
 885
 886        public static void ReportControlEvent<T>(T controlEvent) where T : ControlEvent
 887        {
 394888            SendMessage("ControlEvent", controlEvent);
 394889        }
 890
 891        public static void SendRequestHeadersForUrl(string eventName, string method, string url, Dictionary<string, obje
 892        {
 0893            headersPayload.method = method;
 0894            headersPayload.url = url;
 0895            if (metadata != null)
 0896                headersPayload.metadata = metadata;
 0897            SendMessage(eventName, headersPayload);
 0898        }
 899
 900        public static void BuilderInWorldMessage(string type, string message)
 901        {
 5902            MessageFromEngine(type, message);
 5903        }
 904
 905        public static void ReportOnClickEvent(string sceneId, string uuid)
 906        {
 6907            if (string.IsNullOrEmpty(uuid))
 908            {
 0909                return;
 910            }
 911
 6912            onClickEvent.uuid = uuid;
 913
 6914            SendSceneEvent(sceneId, "uuidEvent", onClickEvent);
 6915        }
 916
 917        private static void ReportRaycastResult<T, P>(string sceneId, string queryId, string queryType, P payload) where
 918        {
 0919            T response = new T();
 0920            response.queryId = queryId;
 0921            response.queryType = queryType;
 0922            response.payload = payload;
 923
 0924            SendSceneEvent<T>(sceneId, "raycastResponse", response);
 0925        }
 926
 927        public static void ReportRaycastHitFirstResult(string sceneId, string queryId, RaycastType raycastType, RaycastH
 928        {
 0929            ReportRaycastResult<RaycastHitFirstResponse, RaycastHitEntity>(sceneId, queryId, Protocol.RaycastTypeToLiter
 0930        }
 931
 932        public static void ReportRaycastHitAllResult(string sceneId, string queryId, RaycastType raycastType, RaycastHit
 933        {
 0934            ReportRaycastResult<RaycastHitAllResponse, RaycastHitEntities>(sceneId, queryId, Protocol.RaycastTypeToLiter
 0935        }
 936
 937        private static OnPointerEventPayload.Hit CreateHitObject(string entityId, string meshName, Vector3 point, Vector
 938        {
 19939            OnPointerEventPayload.Hit hit = new OnPointerEventPayload.Hit();
 940
 19941            hit.hitPoint = point;
 19942            hit.length = distance;
 19943            hit.normal = normal;
 19944            hit.worldNormal = normal;
 19945            hit.meshName = meshName;
 19946            hit.entityId = entityId;
 947
 19948            return hit;
 949        }
 950
 951        private static void SetPointerEventPayload(OnPointerEventPayload pointerEventPayload, ACTION_BUTTON buttonId, st
 952        {
 20953            pointerEventPayload.origin = ray.origin;
 20954            pointerEventPayload.direction = ray.direction;
 20955            pointerEventPayload.buttonId = buttonId;
 956
 20957            if (isHitInfoValid)
 19958                pointerEventPayload.hit = CreateHitObject(entityId, meshName, point, normal, distance);
 959            else
 1960                pointerEventPayload.hit = null;
 1961        }
 962
 963        public static void ReportGlobalPointerDownEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal, 
 964        {
 11965            SetPointerEventPayload((OnPointerEventPayload)onGlobalPointerEventPayload, buttonId, entityId, meshName, ray
 11966            onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.DOWN;
 967
 11968            onGlobalPointerEvent.payload = onGlobalPointerEventPayload;
 969
 11970            SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent);
 11971        }
 972
 973        public static void ReportGlobalPointerUpEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal, fl
 974        {
 3975            SetPointerEventPayload((OnPointerEventPayload)onGlobalPointerEventPayload, buttonId, entityId, meshName, ray
 3976            onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.UP;
 977
 3978            onGlobalPointerEvent.payload = onGlobalPointerEventPayload;
 979
 3980            SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent);
 3981        }
 982
 983        public static void ReportOnPointerDownEvent(ACTION_BUTTON buttonId, string sceneId, string uuid, string entityId
 984        {
 4985            if (string.IsNullOrEmpty(uuid))
 986            {
 0987                return;
 988            }
 989
 4990            onPointerDownEvent.uuid = uuid;
 4991            SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point, normal, distance, is
 4992            onPointerDownEvent.payload = onPointerEventPayload;
 993
 4994            SendSceneEvent(sceneId, "uuidEvent", onPointerDownEvent);
 4995        }
 996
 997        public static void ReportOnPointerUpEvent(ACTION_BUTTON buttonId, string sceneId, string uuid, string entityId, 
 998        {
 2999            if (string.IsNullOrEmpty(uuid))
 1000            {
 01001                return;
 1002            }
 1003
 21004            onPointerUpEvent.uuid = uuid;
 21005            SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point, normal, distance, is
 21006            onPointerUpEvent.payload = onPointerEventPayload;
 1007
 21008            SendSceneEvent(sceneId, "uuidEvent", onPointerUpEvent);
 21009        }
 1010
 1011        public static void ReportOnTextSubmitEvent(string sceneId, string uuid, string text)
 1012        {
 21013            if (string.IsNullOrEmpty(uuid))
 1014            {
 01015                return;
 1016            }
 1017
 21018            onTextSubmitEvent.uuid = uuid;
 21019            onTextSubmitEvent.payload.text = text;
 1020
 21021            SendSceneEvent(sceneId, "uuidEvent", onTextSubmitEvent);
 21022        }
 1023
 1024        public static void ReportOnTextInputChangedEvent(string sceneId, string uuid, string text)
 1025        {
 171026            if (string.IsNullOrEmpty(uuid))
 1027            {
 171028                return;
 1029            }
 1030
 01031            onTextInputChangeEvent.uuid = uuid;
 01032            onTextInputChangeEvent.payload.value = text;
 1033
 01034            SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeEvent);
 01035        }
 1036
 1037        public static void ReportOnTextInputChangedTextEvent(string sceneId, string uuid, string text, bool isSubmit)
 1038        {
 191039            if (string.IsNullOrEmpty(uuid))
 1040            {
 161041                return;
 1042            }
 1043
 31044            onTextInputChangeTextEvent.uuid = uuid;
 31045            onTextInputChangeTextEvent.payload.value.value = text;
 31046            onTextInputChangeTextEvent.payload.value.isSubmit = isSubmit;
 1047
 31048            SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeTextEvent);
 31049        }
 1050
 1051        public static void ReportOnFocusEvent(string sceneId, string uuid)
 1052        {
 21053            if (string.IsNullOrEmpty(uuid))
 1054            {
 21055                return;
 1056            }
 1057
 01058            onFocusEvent.uuid = uuid;
 01059            SendSceneEvent(sceneId, "uuidEvent", onFocusEvent);
 01060        }
 1061
 1062        public static void ReportOnBlurEvent(string sceneId, string uuid)
 1063        {
 21064            if (string.IsNullOrEmpty(uuid))
 1065            {
 21066                return;
 1067            }
 1068
 01069            onBlurEvent.uuid = uuid;
 01070            SendSceneEvent(sceneId, "uuidEvent", onBlurEvent);
 01071        }
 1072
 1073        public static void ReportOnScrollChange(string sceneId, string uuid, Vector2 value, int pointerId)
 1074        {
 131075            if (string.IsNullOrEmpty(uuid))
 1076            {
 111077                return;
 1078            }
 1079
 21080            onScrollChangeEvent.uuid = uuid;
 21081            onScrollChangeEvent.payload.value = value;
 21082            onScrollChangeEvent.payload.pointerId = pointerId;
 1083
 21084            SendSceneEvent(sceneId, "uuidEvent", onScrollChangeEvent);
 21085        }
 1086
 1087        public static void ReportEvent<T>(string sceneId, T @event)
 1088        {
 01089            SendSceneEvent(sceneId, "uuidEvent", @event);
 01090        }
 1091
 1092        public static void ReportOnMetricsUpdate(string sceneId, MetricsModel current,
 1093            MetricsModel limit)
 1094        {
 1791095            onMetricsUpdate.given = current;
 1791096            onMetricsUpdate.limit = limit;
 1097
 1791098            SendSceneEvent(sceneId, "metricsUpdate", onMetricsUpdate);
 1791099        }
 1100
 1101        public static void ReportOnEnterEvent(string sceneId, string uuid)
 1102        {
 01103            if (string.IsNullOrEmpty(uuid))
 01104                return;
 1105
 01106            onEnterEvent.uuid = uuid;
 1107
 01108            SendSceneEvent(sceneId, "uuidEvent", onEnterEvent);
 01109        }
 1110
 1111        public static void LogOut()
 1112        {
 01113            SendMessage("LogOut");
 01114        }
 1115
 1116        public static void RedirectToSignUp()
 1117        {
 01118            SendMessage("RedirectToSignUp");
 01119        }
 1120
 1121        public static void PreloadFinished(string sceneId)
 1122        {
 01123            SendMessage("PreloadFinished", sceneId);
 01124        }
 1125
 1126        public static void ReportMousePosition(Vector3 mousePosition, string id)
 1127        {
 01128            positionPayload.mousePosition = mousePosition;
 01129            positionPayload.id = id;
 01130            SendMessage("ReportMousePosition", positionPayload);
 01131        }
 1132
 1133        public static void SendScreenshot(string encodedTexture, string id)
 1134        {
 01135            onSendScreenshot.encodedTexture = encodedTexture;
 01136            onSendScreenshot.id = id;
 01137            SendMessage("SendScreenshot", onSendScreenshot);
 01138        }
 1139
 1140        public static void SetDelightedSurveyEnabled(bool enabled)
 1141        {
 661142            delightedSurveyEnabled.enabled = enabled;
 661143            SendMessage("SetDelightedSurveyEnabled", delightedSurveyEnabled);
 661144        }
 1145
 1146        public static void SetScenesLoadRadius(float newRadius)
 1147        {
 11148            setScenesLoadRadiusPayload.newRadius = newRadius;
 11149            SendMessage("SetScenesLoadRadius", setScenesLoadRadiusPayload);
 11150        }
 1151
 1152        [System.Serializable]
 1153        public class SaveAvatarPayload
 1154        {
 1155            public string face256;
 1156            public string body;
 1157            public bool isSignUpFlow;
 1158            public AvatarModel avatar;
 1159        }
 1160
 1161        public static class RendererAuthenticationType
 1162        {
 01163            public static string Guest => "guest";
 01164            public static string WalletConnect => "wallet_connect";
 1165        }
 1166
 1167        [System.Serializable]
 1168        public class SendAuthenticationPayload
 1169        {
 1170            public string rendererAuthenticationType;
 1171        }
 1172
 1173        [System.Serializable]
 1174        public class SendPassportPayload
 1175        {
 1176            public string name;
 1177            public string email;
 1178        }
 1179
 1180        [System.Serializable]
 1181        public class SendSaveUserUnverifiedNamePayload
 1182        {
 1183            public string newUnverifiedName;
 1184        }
 1185
 1186        [System.Serializable]
 1187        public class SendSaveUserDescriptionPayload
 1188        {
 1189            public string description;
 1190
 01191            public SendSaveUserDescriptionPayload(string description)
 1192            {
 01193                this.description = description;
 01194            }
 1195        }
 1196
 1197        [Serializable]
 1198        public class SendVideoProgressEvent
 1199        {
 1200            public string componentId;
 1201            public string sceneId;
 1202            public string videoTextureId;
 1203            public int status;
 1204            public float currentOffset;
 1205            public float videoLength;
 1206        }
 1207
 1208        public static void RequestOwnProfileUpdate()
 1209        {
 11210            SendMessage("RequestOwnProfileUpdate");
 11211        }
 1212
 1213        public static void SendSaveAvatar(AvatarModel avatar, Texture2D face256Snapshot, Texture2D bodySnapshot, bool is
 1214        {
 11215            var payload = new SaveAvatarPayload()
 1216            {
 1217                avatar = avatar,
 1218                face256 = System.Convert.ToBase64String(face256Snapshot.EncodeToPNG()),
 1219                body = System.Convert.ToBase64String(bodySnapshot.EncodeToPNG()),
 1220                isSignUpFlow = isSignUpFlow
 1221            };
 11222            SendMessage("SaveUserAvatar", payload);
 11223        }
 1224
 1225        public static void SendAuthentication(string rendererAuthenticationType)
 1226        {
 01227            SendMessage("SendAuthentication", new SendAuthenticationPayload { rendererAuthenticationType = rendererAuthe
 01228        }
 1229
 1230        public static void SendPassport(string name, string email)
 1231        {
 11232            SendMessage("SendPassport", new SendPassportPayload { name = name, email = email });
 11233        }
 1234
 1235        public static void SendSaveUserUnverifiedName(string newName)
 1236        {
 01237            var payload = new SendSaveUserUnverifiedNamePayload()
 1238            {
 1239                newUnverifiedName = newName
 1240            };
 1241
 01242            SendMessage("SaveUserUnverifiedName", payload);
 01243        }
 1244
 1245        public static void SendSaveUserDescription(string about)
 1246        {
 01247            SendMessage("SaveUserDescription", new SendSaveUserDescriptionPayload(about));
 01248        }
 1249
 1250        public static void SendUserAcceptedCollectibles(string airdropId)
 1251        {
 11252            SendMessage("UserAcceptedCollectibles", new UserAcceptedCollectiblesPayload { id = airdropId });
 11253        }
 1254
 1255        public static void SaveUserTutorialStep(int newTutorialStep)
 1256        {
 211257            SendMessage("SaveUserTutorialStep", new TutorialStepPayload() { tutorialStep = newTutorialStep });
 211258        }
 1259
 1260        public static void SendPerformanceReport(string encodedFrameTimesInMS, bool usingFPSCap, int hiccupsInThousandFr
 1261        {
 01262            SendMessage("PerformanceReport", new PerformanceReportPayload()
 1263            {
 1264                samples = encodedFrameTimesInMS,
 1265                fpsIsCapped = usingFPSCap,
 1266                hiccupsInThousandFrames = hiccupsInThousandFrames,
 1267                hiccupsTime = hiccupsTime,
 1268                totalTime = totalTime
 1269            });
 01270        }
 1271
 1272        public static void SendSystemInfoReport()
 1273        {
 01274            SendMessage("SystemInfoReport", new SystemInfoReportPayload());
 01275        }
 1276
 1277        public static void SendTermsOfServiceResponse(string sceneId, bool accepted, bool dontShowAgain)
 1278        {
 21279            var payload = new TermsOfServiceResponsePayload()
 1280            {
 1281                sceneId = sceneId,
 1282                accepted = accepted,
 1283                dontShowAgain = dontShowAgain
 1284            };
 21285            SendMessage("TermsOfServiceResponse", payload);
 21286        }
 1287
 1288        public static void SendExpression(string expressionID, long timestamp)
 1289        {
 21290            SendMessage("TriggerExpression", new SendExpressionPayload()
 1291            {
 1292                id = expressionID,
 1293                timestamp = timestamp
 1294            });
 21295        }
 1296
 1297        public static void OpenURL(string url)
 1298        {
 1299#if UNITY_WEBGL
 1300            SendMessage("OpenWebURL", new OpenURLPayload { url = url });
 1301#else
 31302            Application.OpenURL(url);
 1303#endif
 31304        }
 1305
 1306        public static void SendReportScene(string sceneID)
 1307        {
 01308            SendMessage("ReportScene", sceneID);
 01309        }
 1310
 1311        public static void SendReportPlayer(string playerName)
 1312        {
 21313            SendMessage("ReportPlayer", playerName);
 21314        }
 1315
 1316        public static void SendBlockPlayer(string userId)
 1317        {
 11318            SendMessage("BlockPlayer", new SendBlockPlayerPayload()
 1319            {
 1320                userId = userId
 1321            });
 11322        }
 1323
 1324        public static void SendUnblockPlayer(string userId)
 1325        {
 01326            SendMessage("UnblockPlayer", new SendUnblockPlayerPayload()
 1327            {
 1328                userId = userId
 1329            });
 01330        }
 1331
 1332        public static void RequestScenesInfoAroundParcel(Vector2 parcel, int maxScenesArea)
 1333        {
 01334            SendMessage("RequestScenesInfoInArea", new RequestScenesInfoAroundParcelPayload()
 1335            {
 1336                parcel = parcel,
 1337                scenesAround = maxScenesArea
 1338            });
 01339        }
 1340
 1341        public static void SendAudioStreamEvent(string url, bool play, float volume)
 1342        {
 11343            onAudioStreamingEvent.url = url;
 11344            onAudioStreamingEvent.play = play;
 11345            onAudioStreamingEvent.volume = volume;
 11346            SendMessage("SetAudioStream", onAudioStreamingEvent);
 11347        }
 1348
 1349        public static void SendSetVoiceChatRecording(bool recording)
 1350        {
 01351            setVoiceChatRecordingPayload.recording = recording;
 01352            SendMessage("SetVoiceChatRecording", setVoiceChatRecordingPayload);
 01353        }
 1354
 1355        public static void ToggleVoiceChatRecording()
 1356        {
 01357            SendMessage("ToggleVoiceChatRecording");
 01358        }
 1359
 1360        public static void ApplySettings(float voiceChatVolume, int voiceChatAllowCategory)
 1361        {
 61362            applySettingsPayload.voiceChatVolume = voiceChatVolume;
 61363            applySettingsPayload.voiceChatAllowCategory = voiceChatAllowCategory;
 61364            SendMessage("ApplySettings", applySettingsPayload);
 61365        }
 1366
 1367        public static void RequestGIFProcessor(string gifURL, string gifId, bool isWebGL1)
 1368        {
 01369            gifSetupPayload.imageSource = gifURL;
 01370            gifSetupPayload.id = gifId;
 01371            gifSetupPayload.isWebGL1 = isWebGL1;
 1372
 01373            SendMessage("RequestGIFProcessor", gifSetupPayload);
 01374        }
 1375
 1376        public static void DeleteGIF(string id)
 1377        {
 01378            stringPayload.value = id;
 01379            SendMessage("DeleteGIF", stringPayload);
 01380        }
 1381
 1382        public static void GoTo(int x, int y)
 1383        {
 41384            gotoEvent.x = x;
 41385            gotoEvent.y = y;
 41386            SendMessage("GoTo", gotoEvent);
 41387        }
 1388
 1389        public static void GoToCrowd()
 1390        {
 01391            SendMessage("GoToCrowd");
 01392        }
 1393
 1394        public static void GoToMagic()
 1395        {
 01396            SendMessage("GoToMagic");
 01397        }
 1398
 1399        public static void JumpIn(int x, int y, string serverName, string layerName)
 1400        {
 31401            jumpInPayload.realm.serverName = serverName;
 31402            jumpInPayload.realm.layer = layerName;
 1403
 31404            jumpInPayload.gridPosition.x = x;
 31405            jumpInPayload.gridPosition.y = y;
 1406
 31407            SendMessage("JumpIn", jumpInPayload);
 31408        }
 1409
 1410        public static void SendChatMessage(ChatMessage message)
 1411        {
 41412            sendChatMessageEvent.message = message;
 41413            SendMessage("SendChatMessage", sendChatMessageEvent);
 41414        }
 1415
 1416        public static void UpdateFriendshipStatus(FriendsController.FriendshipUpdateStatusMessage message)
 1417        {
 41418            SendMessage("UpdateFriendshipStatus", message);
 41419        }
 1420
 1421        public static void ScenesLoadingFeedback(LoadingFeedbackMessage message)
 1422        {
 01423            SendMessage("ScenesLoadingFeedback", message);
 01424        }
 1425
 1426        public static void FetchHotScenes()
 1427        {
 01428            SendMessage("FetchHotScenes");
 01429        }
 1430
 1431        public static void SetBaseResolution(int resolution)
 1432        {
 21433            baseResEvent.baseResolution = resolution;
 21434            SendMessage("SetBaseResolution", baseResEvent);
 21435        }
 1436
 1437        public static void ReportAnalyticsEvent(string eventName)
 1438        {
 01439            ReportAnalyticsEvent(eventName, null);
 01440        }
 1441
 1442        public static void ReportAnalyticsEvent(string eventName, AnalyticsPayload.Property[] eventProperties)
 1443        {
 01444            analyticsEvent.name = eventName;
 01445            analyticsEvent.properties = eventProperties;
 01446            SendMessage("Track", analyticsEvent);
 01447        }
 1448
 1449        public static void FetchBalanceOfMANA()
 1450        {
 21451            SendMessage("FetchBalanceOfMANA");
 21452        }
 1453
 1454        public static void SendSceneExternalActionEvent(string sceneId, string type, string payload)
 1455        {
 671456            sceneExternalActionEvent.type = type;
 671457            sceneExternalActionEvent.payload = payload;
 671458            SendSceneEvent(sceneId, "externalAction", sceneExternalActionEvent);
 671459        }
 1460
 1461        public static void SetMuteUsers(string[] usersId, bool mute)
 1462        {
 01463            muteUserEvent.usersId = usersId;
 01464            muteUserEvent.mute = mute;
 01465            SendMessage("SetMuteUsers", muteUserEvent);
 01466        }
 1467
 1468        public static void SendCloseUserAvatar(bool isSignUpFlow)
 1469        {
 01470            closeUserAvatarPayload.isSignUpFlow = isSignUpFlow;
 01471            SendMessage("CloseUserAvatar", closeUserAvatarPayload);
 01472        }
 1473
 1474        // Warning: Use this method only for PEXs non-associated to smart wearables.
 1475        //          For PEX associated to smart wearables use 'SetDisabledPortableExperiences'.
 1476        public static void KillPortableExperience(string portableExperienceId)
 1477        {
 01478            killPortableExperiencePayload.portableExperienceId = portableExperienceId;
 01479            SendMessage("KillPortableExperience", killPortableExperiencePayload);
 01480        }
 1481
 1482        public static void SetDisabledPortableExperiences(string[] idsToDisable)
 1483        {
 71484            setDisabledPortableExperiencesPayload.idsToDisable = idsToDisable;
 71485            SendMessage("SetDisabledPortableExperiences", setDisabledPortableExperiencesPayload);
 71486        }
 1487
 1488        public static void RequestWearables(
 1489            string ownedByUser,
 1490            string[] wearableIds,
 1491            string[] collectionIds,
 1492            string context)
 1493        {
 11494            requestWearablesPayload.filters = new WearablesRequestFiltersPayload
 1495            {
 1496                ownedByUser = ownedByUser,
 1497                wearableIds = wearableIds,
 1498                collectionIds = collectionIds
 1499            };
 1500
 11501            requestWearablesPayload.context = context;
 1502
 11503            SendMessage("RequestWearables", requestWearablesPayload);
 11504        }
 1505
 1506        public static void SearchENSOwner(string name, int maxResults)
 1507        {
 61508            searchEnsOwnerPayload.name = name;
 61509            searchEnsOwnerPayload.maxResults = maxResults;
 1510
 61511            SendMessage("SearchENSOwner", searchEnsOwnerPayload);
 61512        }
 1513
 1514        public static void RequestUserProfile(string userId)
 1515        {
 161516            stringPayload.value = userId;
 161517            SendMessage("RequestUserProfile", stringPayload);
 161518        }
 1519
 1520        public static void ReportAvatarFatalError()
 1521        {
 01522            SendMessage("ReportAvatarFatalError");
 01523        }
 1524
 1525        public static void UnpublishScene(Vector2Int sceneCoordinates)
 1526        {
 21527            var payload = new UnpublishScenePayload() { coordinates = $"{sceneCoordinates.x},{sceneCoordinates.y}" };
 21528            SendMessage("UnpublishScene", payload);
 21529        }
 1530
 1531        public static void NotifyStatusThroughChat(string message)
 1532        {
 01533            stringPayload.value = message;
 01534            SendMessage("NotifyStatusThroughChat", stringPayload);
 01535        }
 1536
 1537        public static void ReportVideoProgressEvent(
 1538            string componentId,
 1539            string sceneId,
 1540            string videoClipId,
 1541            int videoStatus,
 1542            float currentOffset,
 1543            float length)
 1544        {
 451545            SendVideoProgressEvent progressEvent = new SendVideoProgressEvent()
 1546            {
 1547                componentId = componentId,
 1548                sceneId = sceneId,
 1549                videoTextureId = videoClipId,
 1550                status = videoStatus,
 1551                currentOffset = currentOffset,
 1552                videoLength = length
 1553            };
 1554
 451555            SendMessage("VideoProgressEvent", progressEvent);
 451556        }
 1557
 1558        public static void ReportAvatarRemoved(string entityId, string avatarId)
 1559        {
 01560            avatarStatePayload.type = "Removed";
 01561            avatarStatePayload.entityId = entityId;
 01562            avatarStatePayload.avatarShapeId = avatarId;
 01563            SendMessage("ReportAvatarState", avatarStatePayload);
 01564        }
 1565
 1566        public static void ReportAvatarSceneChanged(string entityId, string avatarId, string sceneId)
 1567        {
 01568            avatarSceneChangedPayload.type = "SceneChanged";
 01569            avatarSceneChangedPayload.entityId = entityId;
 01570            avatarSceneChangedPayload.avatarShapeId = avatarId;
 01571            avatarSceneChangedPayload.sceneId = sceneId;
 01572            SendMessage("ReportAvatarState", avatarSceneChangedPayload);
 01573        }
 1574
 1575        public static void ReportAvatarClick(string sceneId, string userId, Vector3 rayOrigin, Vector3 rayDirection, flo
 1576        {
 01577            avatarOnClickPayload.userId = userId;
 01578            avatarOnClickPayload.ray.origin = rayOrigin;
 01579            avatarOnClickPayload.ray.direction = rayDirection;
 01580            avatarOnClickPayload.ray.distance = distance;
 1581
 01582            SendSceneEvent(sceneId, "playerClicked", avatarOnClickPayload);
 01583        }
 1584
 1585        public static void ReportOnPointerHoverEnterEvent(string sceneId, string uuid)
 1586        {
 41587            onPointerHoverEnterEvent.uuid = uuid;
 41588            SendSceneEvent(sceneId, "uuidEvent", onPointerHoverEnterEvent);
 41589        }
 1590
 1591        public static void ReportOnPointerHoverExitEvent(string sceneId, string uuid)
 1592        {
 11593            onPointerHoverExitEvent.uuid = uuid;
 11594            SendSceneEvent(sceneId, "uuidEvent", onPointerHoverExitEvent);
 11595        }
 1596
 1597        public static void ReportTime(float time, bool isPaused, float timeNormalizationFactor, float cycleTime)
 1598        {
 61599            timeReportPayload.time = time;
 61600            timeReportPayload.isPaused = isPaused;
 61601            timeReportPayload.timeNormalizationFactor = timeNormalizationFactor;
 61602            timeReportPayload.cycleTime = cycleTime;
 61603            SendMessage("ReportDecentralandTime", timeReportPayload);
 61604        }
 1605    }
 1606}

Methods/Properties

WebInterface()
StartStatefulMode(System.String)
StopStatefulMode(System.String)
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)
MessageFromEngine(System.String, System.String)
ProcessQueuedMessages()
GetGraphicCard()
SendMessage(System.String)
SendMessage[T](System.String, T)
SendSceneEvent[T](System.String, System.String, T)
SendAllScenesEvent[T](System.String, T)
ReportPosition(UnityEngine.Vector3, UnityEngine.Quaternion, System.Single, UnityEngine.Quaternion)
ReportCameraChanged(CameraMode/ModeId)
ReportCameraChanged(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, System.Boolean, System.Int32, System.Single, System.Single)
SendSystemInfoReport()
SendTermsOfServiceResponse(System.String, System.Boolean, System.Boolean)
SendExpression(System.String, System.Int64)
OpenURL(System.String)
SendReportScene(System.String)
SendReportPlayer(System.String)
SendBlockPlayer(System.String)
SendUnblockPlayer(System.String)
RequestScenesInfoAroundParcel(UnityEngine.Vector2, System.Int32)
SendAudioStreamEvent(System.String, System.Boolean, System.Single)
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)
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, System.String)
ReportAvatarSceneChanged(System.String, 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)