< Summary

Class:DCL.Interface.WebInterface
Assembly:WebInterface
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WebInterface/Interface.cs
Covered lines:276
Uncovered lines:162
Coverable lines:438
Total lines:1591
Line coverage:63% (276 of 438)
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%
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
 77695            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 WearablesRequestFiltersPayload
 614        {
 615            public string ownedByUser;
 616            public string[] wearableIds;
 617            public string[] collectionIds;
 618        }
 619
 620        [System.Serializable]
 621        public class RequestWearablesPayload
 622        {
 623            public WearablesRequestFiltersPayload filters;
 624            public string context;
 625        }
 626
 627        [System.Serializable]
 628        public class HeadersPayload
 629        {
 630            public string method;
 631            public string url;
 1632            public Dictionary<string, object> metadata = new Dictionary<string, object>();
 633        }
 634
 635        [System.Serializable]
 636        public class SearchENSOwnerPayload
 637        {
 638            public string name;
 639            public int maxResults;
 640        }
 641
 642        [System.Serializable]
 643        public class UnpublishScenePayload
 644        {
 645            public string coordinates;
 646        }
 647
 648        [System.Serializable]
 649        public class AvatarStateBase
 650        {
 651            public string type;
 652            public string entityId;
 653            public string avatarShapeId;
 654        }
 655
 656        [System.Serializable]
 657        public class AvatarStateSceneChanged : AvatarStateBase
 658        {
 659            public string sceneId;
 660        }
 661
 662        [System.Serializable]
 663        public class AvatarOnClickPayload
 664        {
 665            public string userId;
 0666            public RayInfo ray = new RayInfo();
 667        }
 668
 669        [System.Serializable]
 670        public class TimeReportPayload
 671        {
 672            public float timeNormalizationFactor;
 673            public float cycleTime;
 674            public bool isPaused;
 675            public float time;
 676        }
 677
 678#if UNITY_WEBGL && !UNITY_EDITOR
 679    /**
 680     * This method is called after the first render. It marks the loading of the
 681     * rest of the JS client.
 682     */
 683    [DllImport("__Internal")] public static extern void StartDecentraland();
 684    [DllImport("__Internal")] public static extern void MessageFromEngine(string type, string message);
 685    [DllImport("__Internal")] public static extern string GetGraphicCard();
 686    [DllImport("__Internal")] public static extern bool CheckURLParam(string targetParam);
 687
 688    public static System.Action<string, string> OnMessageFromEngine;
 689#else
 690        public static Action<string, string> OnMessageFromEngine
 691        {
 692            set
 693            {
 90694                OnMessage = value;
 90695                if (OnMessage != null)
 696                {
 45697                    ProcessQueuedMessages();
 698                }
 90699            }
 0700            get => OnMessage;
 701        }
 702        private static Action<string, string> OnMessage;
 703
 1704        private static bool hasQueuedMessages = false;
 1705        private static List<(string, string)> queuedMessages = new List<(string, string)>();
 0706        public static void StartDecentraland() { }
 707        public static bool CheckURLParam(string targetParam)
 708        {
 0709            return false;
 710        }
 711
 712        public static void MessageFromEngine(string type, string message)
 713        {
 3781714            if (OnMessageFromEngine != null)
 715            {
 1925716                if (hasQueuedMessages)
 717                {
 0718                    ProcessQueuedMessages();
 719                }
 720
 1925721                OnMessageFromEngine.Invoke(type, message);
 1925722                if (VERBOSE)
 723                {
 0724                    Debug.Log("MessageFromEngine called with: " + type + ", " + message);
 725                }
 0726            }
 727            else
 728            {
 1856729                lock (queuedMessages)
 730                {
 1856731                    queuedMessages.Add((type, message));
 1856732                }
 733
 1856734                hasQueuedMessages = true;
 735            }
 3781736        }
 737
 738        private static void ProcessQueuedMessages()
 739        {
 45740            hasQueuedMessages = false;
 45741            lock (queuedMessages)
 742            {
 3800743                foreach ((string type, string payload) in queuedMessages)
 744                {
 1855745                    MessageFromEngine(type, payload);
 746                }
 747
 45748                queuedMessages.Clear();
 45749            }
 45750        }
 751
 0752        public static string GetGraphicCard() => "In Editor Graphic Card";
 753#endif
 754
 755        public static void SendMessage(string type)
 756        {
 757            // sending an empty JSON object to be compatible with other messages
 3758            MessageFromEngine(type, "{}");
 3759        }
 760
 761        public static void SendMessage<T>(string type, T message)
 762        {
 1918763            string messageJson = JsonUtility.ToJson(message);
 764
 1918765            if (VERBOSE)
 766            {
 0767                Debug.Log($"Sending message: " + messageJson);
 768            }
 769
 1918770            MessageFromEngine(type, messageJson);
 1918771        }
 772
 1773        private static ReportPositionPayload positionPayload = new ReportPositionPayload();
 1774        private static CameraModePayload cameraModePayload = new CameraModePayload();
 1775        private static Web3UseResponsePayload web3UseResponsePayload = new Web3UseResponsePayload();
 1776        private static IdleStateChangedPayload idleStateChangedPayload = new IdleStateChangedPayload();
 1777        private static OnMetricsUpdate onMetricsUpdate = new OnMetricsUpdate();
 1778        private static OnClickEvent onClickEvent = new OnClickEvent();
 1779        private static OnPointerDownEvent onPointerDownEvent = new OnPointerDownEvent();
 1780        private static OnPointerUpEvent onPointerUpEvent = new OnPointerUpEvent();
 1781        private static OnTextSubmitEvent onTextSubmitEvent = new OnTextSubmitEvent();
 1782        private static OnTextInputChangeEvent onTextInputChangeEvent = new OnTextInputChangeEvent();
 1783        private static OnTextInputChangeTextEvent onTextInputChangeTextEvent = new OnTextInputChangeTextEvent();
 1784        private static OnScrollChangeEvent onScrollChangeEvent = new OnScrollChangeEvent();
 1785        private static OnFocusEvent onFocusEvent = new OnFocusEvent();
 1786        private static OnBlurEvent onBlurEvent = new OnBlurEvent();
 1787        private static OnEnterEvent onEnterEvent = new OnEnterEvent();
 1788        private static OnSendScreenshot onSendScreenshot = new OnSendScreenshot();
 1789        private static OnPointerEventPayload onPointerEventPayload = new OnPointerEventPayload();
 1790        private static OnGlobalPointerEventPayload onGlobalPointerEventPayload = new OnGlobalPointerEventPayload();
 1791        private static OnGlobalPointerEvent onGlobalPointerEvent = new OnGlobalPointerEvent();
 1792        private static AudioStreamingPayload onAudioStreamingEvent = new AudioStreamingPayload();
 1793        private static SetVoiceChatRecordingPayload setVoiceChatRecordingPayload = new SetVoiceChatRecordingPayload();
 1794        private static SetScenesLoadRadiusPayload setScenesLoadRadiusPayload = new SetScenesLoadRadiusPayload();
 1795        private static ApplySettingsPayload applySettingsPayload = new ApplySettingsPayload();
 1796        private static GIFSetupPayload gifSetupPayload = new GIFSetupPayload();
 1797        private static JumpInPayload jumpInPayload = new JumpInPayload();
 1798        private static GotoEvent gotoEvent = new GotoEvent();
 1799        private static SendChatMessageEvent sendChatMessageEvent = new SendChatMessageEvent();
 1800        private static BaseResolution baseResEvent = new BaseResolution();
 1801        private static AnalyticsPayload analyticsEvent = new AnalyticsPayload();
 1802        private static DelightedSurveyEnabledPayload delightedSurveyEnabled = new DelightedSurveyEnabledPayload();
 1803        private static ExternalActionSceneEventPayload sceneExternalActionEvent = new ExternalActionSceneEventPayload();
 1804        private static MuteUserPayload muteUserEvent = new MuteUserPayload();
 1805        private static StoreSceneStateEvent storeSceneState = new StoreSceneStateEvent();
 1806        private static CloseUserAvatarPayload closeUserAvatarPayload = new CloseUserAvatarPayload();
 1807        private static StringPayload stringPayload = new StringPayload();
 1808        private static KillPortableExperiencePayload killPortableExperiencePayload = new KillPortableExperiencePayload()
 1809        private static RequestWearablesPayload requestWearablesPayload = new RequestWearablesPayload();
 1810        private static SearchENSOwnerPayload searchEnsOwnerPayload = new SearchENSOwnerPayload();
 1811        private static HeadersPayload headersPayload = new HeadersPayload();
 1812        private static AvatarStateBase avatarStatePayload = new AvatarStateBase();
 1813        private static AvatarStateSceneChanged avatarSceneChangedPayload = new AvatarStateSceneChanged();
 1814        public static AvatarOnClickPayload avatarOnClickPayload = new AvatarOnClickPayload();
 1815        private static UUIDEvent<EmptyPayload> onPointerHoverEnterEvent = new UUIDEvent<EmptyPayload>();
 1816        private static UUIDEvent<EmptyPayload> onPointerHoverExitEvent = new UUIDEvent<EmptyPayload>();
 1817        private static TimeReportPayload timeReportPayload = new TimeReportPayload();
 818
 819        public static void SendSceneEvent<T>(string sceneId, string eventType, T payload)
 820        {
 691821            SceneEvent<T> sceneEvent = new SceneEvent<T>();
 691822            sceneEvent.sceneId = sceneId;
 691823            sceneEvent.eventType = eventType;
 691824            sceneEvent.payload = payload;
 825
 691826            SendMessage("SceneEvent", sceneEvent);
 691827        }
 828
 829        private static void SendAllScenesEvent<T>(string eventType, T payload)
 830        {
 599831            AllScenesEvent<T> allScenesEvent = new AllScenesEvent<T>();
 599832            allScenesEvent.eventType = eventType;
 599833            allScenesEvent.payload = payload;
 834
 599835            SendMessage("AllScenesEvent", allScenesEvent);
 599836        }
 837
 838        public static void ReportPosition(Vector3 position, Quaternion rotation, float playerHeight, Quaternion cameraRo
 839        {
 36840            positionPayload.position = position;
 36841            positionPayload.rotation = rotation;
 36842            positionPayload.playerHeight = playerHeight;
 36843            positionPayload.cameraRotation = cameraRotation;
 844
 36845            SendMessage("ReportPosition", positionPayload);
 36846        }
 847
 848        public static void ReportCameraChanged(CameraMode.ModeId cameraMode)
 849        {
 598850            ReportCameraChanged(cameraMode, null);
 598851        }
 852
 853        public static void ReportCameraChanged(CameraMode.ModeId cameraMode, string targetSceneId)
 854        {
 986855            cameraModePayload.cameraMode = cameraMode;
 986856            if (!string.IsNullOrEmpty(targetSceneId))
 857            {
 388858                SendSceneEvent(targetSceneId, "cameraModeChanged", cameraModePayload);
 388859            }
 860            else
 861            {
 598862                SendAllScenesEvent("cameraModeChanged", cameraModePayload);
 863            }
 598864        }
 865
 866        public static void Web3UseResponse(string id, bool result)
 867        {
 0868            web3UseResponsePayload.id = id;
 0869            web3UseResponsePayload.result = result;
 0870            SendMessage("Web3UseResponse", web3UseResponsePayload);
 0871        }
 872
 873        public static void ReportIdleStateChanged(bool isIdle)
 874        {
 1875            idleStateChangedPayload.isIdle = isIdle;
 1876            SendAllScenesEvent("idleStateChanged", idleStateChangedPayload);
 1877        }
 878
 879        public static void ReportControlEvent<T>(T controlEvent) where T : ControlEvent
 880        {
 393881            SendMessage("ControlEvent", controlEvent);
 393882        }
 883
 884        public static void SendRequestHeadersForUrl(string eventName, string method, string url, Dictionary<string, obje
 885        {
 0886            headersPayload.method = method;
 0887            headersPayload.url = url;
 0888            if (metadata != null)
 0889                headersPayload.metadata = metadata;
 0890            SendMessage(eventName, headersPayload);
 0891        }
 892
 893        public static void BuilderInWorldMessage(string type, string message)
 894        {
 5895            MessageFromEngine(type, message);
 5896        }
 897
 898        public static void ReportOnClickEvent(string sceneId, string uuid)
 899        {
 6900            if (string.IsNullOrEmpty(uuid))
 901            {
 0902                return;
 903            }
 904
 6905            onClickEvent.uuid = uuid;
 906
 6907            SendSceneEvent(sceneId, "uuidEvent", onClickEvent);
 6908        }
 909
 910        private static void ReportRaycastResult<T, P>(string sceneId, string queryId, string queryType, P payload) where
 911        {
 0912            T response = new T();
 0913            response.queryId = queryId;
 0914            response.queryType = queryType;
 0915            response.payload = payload;
 916
 0917            SendSceneEvent<T>(sceneId, "raycastResponse", response);
 0918        }
 919
 920        public static void ReportRaycastHitFirstResult(string sceneId, string queryId, RaycastType raycastType, RaycastH
 921        {
 0922            ReportRaycastResult<RaycastHitFirstResponse, RaycastHitEntity>(sceneId, queryId, Protocol.RaycastTypeToLiter
 0923        }
 924
 925        public static void ReportRaycastHitAllResult(string sceneId, string queryId, RaycastType raycastType, RaycastHit
 926        {
 0927            ReportRaycastResult<RaycastHitAllResponse, RaycastHitEntities>(sceneId, queryId, Protocol.RaycastTypeToLiter
 0928        }
 929
 930        private static OnPointerEventPayload.Hit CreateHitObject(string entityId, string meshName, Vector3 point, Vector
 931        {
 19932            OnPointerEventPayload.Hit hit = new OnPointerEventPayload.Hit();
 933
 19934            hit.hitPoint = point;
 19935            hit.length = distance;
 19936            hit.normal = normal;
 19937            hit.worldNormal = normal;
 19938            hit.meshName = meshName;
 19939            hit.entityId = entityId;
 940
 19941            return hit;
 942        }
 943
 944        private static void SetPointerEventPayload(OnPointerEventPayload pointerEventPayload, ACTION_BUTTON buttonId, st
 945        {
 20946            pointerEventPayload.origin = ray.origin;
 20947            pointerEventPayload.direction = ray.direction;
 20948            pointerEventPayload.buttonId = buttonId;
 949
 20950            if (isHitInfoValid)
 19951                pointerEventPayload.hit = CreateHitObject(entityId, meshName, point, normal, distance);
 952            else
 1953                pointerEventPayload.hit = null;
 1954        }
 955
 956        public static void ReportGlobalPointerDownEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal, 
 957        {
 11958            SetPointerEventPayload((OnPointerEventPayload)onGlobalPointerEventPayload, buttonId, entityId, meshName, ray
 11959            onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.DOWN;
 960
 11961            onGlobalPointerEvent.payload = onGlobalPointerEventPayload;
 962
 11963            SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent);
 11964        }
 965
 966        public static void ReportGlobalPointerUpEvent(ACTION_BUTTON buttonId, Ray ray, Vector3 point, Vector3 normal, fl
 967        {
 3968            SetPointerEventPayload((OnPointerEventPayload)onGlobalPointerEventPayload, buttonId, entityId, meshName, ray
 3969            onGlobalPointerEventPayload.type = OnGlobalPointerEventPayload.InputEventType.UP;
 970
 3971            onGlobalPointerEvent.payload = onGlobalPointerEventPayload;
 972
 3973            SendSceneEvent(sceneId, "actionButtonEvent", onGlobalPointerEvent);
 3974        }
 975
 976        public static void ReportOnPointerDownEvent(ACTION_BUTTON buttonId, string sceneId, string uuid, string entityId
 977        {
 4978            if (string.IsNullOrEmpty(uuid))
 979            {
 0980                return;
 981            }
 982
 4983            onPointerDownEvent.uuid = uuid;
 4984            SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point, normal, distance, is
 4985            onPointerDownEvent.payload = onPointerEventPayload;
 986
 4987            SendSceneEvent(sceneId, "uuidEvent", onPointerDownEvent);
 4988        }
 989
 990        public static void ReportOnPointerUpEvent(ACTION_BUTTON buttonId, string sceneId, string uuid, string entityId, 
 991        {
 2992            if (string.IsNullOrEmpty(uuid))
 993            {
 0994                return;
 995            }
 996
 2997            onPointerUpEvent.uuid = uuid;
 2998            SetPointerEventPayload(onPointerEventPayload, buttonId, entityId, meshName, ray, point, normal, distance, is
 2999            onPointerUpEvent.payload = onPointerEventPayload;
 1000
 21001            SendSceneEvent(sceneId, "uuidEvent", onPointerUpEvent);
 21002        }
 1003
 1004        public static void ReportOnTextSubmitEvent(string sceneId, string uuid, string text)
 1005        {
 21006            if (string.IsNullOrEmpty(uuid))
 1007            {
 01008                return;
 1009            }
 1010
 21011            onTextSubmitEvent.uuid = uuid;
 21012            onTextSubmitEvent.payload.text = text;
 1013
 21014            SendSceneEvent(sceneId, "uuidEvent", onTextSubmitEvent);
 21015        }
 1016
 1017        public static void ReportOnTextInputChangedEvent(string sceneId, string uuid, string text)
 1018        {
 171019            if (string.IsNullOrEmpty(uuid))
 1020            {
 171021                return;
 1022            }
 1023
 01024            onTextInputChangeEvent.uuid = uuid;
 01025            onTextInputChangeEvent.payload.value = text;
 1026
 01027            SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeEvent);
 01028        }
 1029
 1030        public static void ReportOnTextInputChangedTextEvent(string sceneId, string uuid, string text, bool isSubmit)
 1031        {
 191032            if (string.IsNullOrEmpty(uuid))
 1033            {
 161034                return;
 1035            }
 1036
 31037            onTextInputChangeTextEvent.uuid = uuid;
 31038            onTextInputChangeTextEvent.payload.value.value = text;
 31039            onTextInputChangeTextEvent.payload.value.isSubmit = isSubmit;
 1040
 31041            SendSceneEvent(sceneId, "uuidEvent", onTextInputChangeTextEvent);
 31042        }
 1043
 1044        public static void ReportOnFocusEvent(string sceneId, string uuid)
 1045        {
 21046            if (string.IsNullOrEmpty(uuid))
 1047            {
 21048                return;
 1049            }
 1050
 01051            onFocusEvent.uuid = uuid;
 01052            SendSceneEvent(sceneId, "uuidEvent", onFocusEvent);
 01053        }
 1054
 1055        public static void ReportOnBlurEvent(string sceneId, string uuid)
 1056        {
 21057            if (string.IsNullOrEmpty(uuid))
 1058            {
 21059                return;
 1060            }
 1061
 01062            onBlurEvent.uuid = uuid;
 01063            SendSceneEvent(sceneId, "uuidEvent", onBlurEvent);
 01064        }
 1065
 1066        public static void ReportOnScrollChange(string sceneId, string uuid, Vector2 value, int pointerId)
 1067        {
 131068            if (string.IsNullOrEmpty(uuid))
 1069            {
 111070                return;
 1071            }
 1072
 21073            onScrollChangeEvent.uuid = uuid;
 21074            onScrollChangeEvent.payload.value = value;
 21075            onScrollChangeEvent.payload.pointerId = pointerId;
 1076
 21077            SendSceneEvent(sceneId, "uuidEvent", onScrollChangeEvent);
 21078        }
 1079
 1080        public static void ReportEvent<T>(string sceneId, T @event)
 1081        {
 01082            SendSceneEvent(sceneId, "uuidEvent", @event);
 01083        }
 1084
 1085        public static void ReportOnMetricsUpdate(string sceneId, MetricsModel current,
 1086            MetricsModel limit)
 1087        {
 1911088            onMetricsUpdate.given = current;
 1911089            onMetricsUpdate.limit = limit;
 1090
 1911091            SendSceneEvent(sceneId, "metricsUpdate", onMetricsUpdate);
 1911092        }
 1093
 1094        public static void ReportOnEnterEvent(string sceneId, string uuid)
 1095        {
 01096            if (string.IsNullOrEmpty(uuid))
 01097                return;
 1098
 01099            onEnterEvent.uuid = uuid;
 1100
 01101            SendSceneEvent(sceneId, "uuidEvent", onEnterEvent);
 01102        }
 1103
 1104        public static void LogOut()
 1105        {
 01106            SendMessage("LogOut");
 01107        }
 1108
 1109        public static void RedirectToSignUp()
 1110        {
 01111            SendMessage("RedirectToSignUp");
 01112        }
 1113
 1114        public static void PreloadFinished(string sceneId)
 1115        {
 01116            SendMessage("PreloadFinished", sceneId);
 01117        }
 1118
 1119        public static void ReportMousePosition(Vector3 mousePosition, string id)
 1120        {
 01121            positionPayload.mousePosition = mousePosition;
 01122            positionPayload.id = id;
 01123            SendMessage("ReportMousePosition", positionPayload);
 01124        }
 1125
 1126        public static void SendScreenshot(string encodedTexture, string id)
 1127        {
 01128            onSendScreenshot.encodedTexture = encodedTexture;
 01129            onSendScreenshot.id = id;
 01130            SendMessage("SendScreenshot", onSendScreenshot);
 01131        }
 1132
 1133        public static void SetDelightedSurveyEnabled(bool enabled)
 1134        {
 661135            delightedSurveyEnabled.enabled = enabled;
 661136            SendMessage("SetDelightedSurveyEnabled", delightedSurveyEnabled);
 661137        }
 1138
 1139        public static void SetScenesLoadRadius(float newRadius)
 1140        {
 11141            setScenesLoadRadiusPayload.newRadius = newRadius;
 11142            SendMessage("SetScenesLoadRadius", setScenesLoadRadiusPayload);
 11143        }
 1144
 1145        [System.Serializable]
 1146        public class SaveAvatarPayload
 1147        {
 1148            public string face256;
 1149            public string body;
 1150            public bool isSignUpFlow;
 1151            public AvatarModel avatar;
 1152        }
 1153
 1154        public static class RendererAuthenticationType
 1155        {
 01156            public static string Guest => "guest";
 01157            public static string WalletConnect => "wallet_connect";
 1158        }
 1159
 1160        [System.Serializable]
 1161        public class SendAuthenticationPayload
 1162        {
 1163            public string rendererAuthenticationType;
 1164        }
 1165
 1166        [System.Serializable]
 1167        public class SendPassportPayload
 1168        {
 1169            public string name;
 1170            public string email;
 1171        }
 1172
 1173        [System.Serializable]
 1174        public class SendSaveUserUnverifiedNamePayload
 1175        {
 1176            public string newUnverifiedName;
 1177        }
 1178
 1179        [System.Serializable]
 1180        public class SendSaveUserDescriptionPayload
 1181        {
 1182            public string description;
 1183
 01184            public SendSaveUserDescriptionPayload(string description)
 1185            {
 01186                this.description = description;
 01187            }
 1188        }
 1189
 1190        [Serializable]
 1191        public class SendVideoProgressEvent
 1192        {
 1193            public string componentId;
 1194            public string sceneId;
 1195            public string videoTextureId;
 1196            public int status;
 1197            public float currentOffset;
 1198            public float videoLength;
 1199        }
 1200
 1201        public static void RequestOwnProfileUpdate()
 1202        {
 11203            SendMessage("RequestOwnProfileUpdate");
 11204        }
 1205
 1206        public static void SendSaveAvatar(AvatarModel avatar, Texture2D face256Snapshot, Texture2D bodySnapshot, bool is
 1207        {
 11208            var payload = new SaveAvatarPayload()
 1209            {
 1210                avatar = avatar,
 1211                face256 = System.Convert.ToBase64String(face256Snapshot.EncodeToPNG()),
 1212                body = System.Convert.ToBase64String(bodySnapshot.EncodeToPNG()),
 1213                isSignUpFlow = isSignUpFlow
 1214            };
 11215            SendMessage("SaveUserAvatar", payload);
 11216        }
 1217
 1218        public static void SendAuthentication(string rendererAuthenticationType)
 1219        {
 01220            SendMessage("SendAuthentication", new SendAuthenticationPayload { rendererAuthenticationType = rendererAuthe
 01221        }
 1222
 1223        public static void SendPassport(string name, string email)
 1224        {
 11225            SendMessage("SendPassport", new SendPassportPayload { name = name, email = email });
 11226        }
 1227
 1228        public static void SendSaveUserUnverifiedName(string newName)
 1229        {
 01230            var payload = new SendSaveUserUnverifiedNamePayload()
 1231            {
 1232                newUnverifiedName = newName
 1233            };
 1234
 01235            SendMessage("SaveUserUnverifiedName", payload);
 01236        }
 1237
 1238        public static void SendSaveUserDescription(string about)
 1239        {
 01240            SendMessage("SaveUserDescription", new SendSaveUserDescriptionPayload(about));
 01241        }
 1242
 1243        public static void SendUserAcceptedCollectibles(string airdropId)
 1244        {
 11245            SendMessage("UserAcceptedCollectibles", new UserAcceptedCollectiblesPayload { id = airdropId });
 11246        }
 1247
 1248        public static void SaveUserTutorialStep(int newTutorialStep)
 1249        {
 211250            SendMessage("SaveUserTutorialStep", new TutorialStepPayload() { tutorialStep = newTutorialStep });
 211251        }
 1252
 1253        public static void SendPerformanceReport(string encodedFrameTimesInMS, bool usingFPSCap, int hiccupsInThousandFr
 1254        {
 01255            SendMessage("PerformanceReport", new PerformanceReportPayload()
 1256            {
 1257                samples = encodedFrameTimesInMS,
 1258                fpsIsCapped = usingFPSCap,
 1259                hiccupsInThousandFrames = hiccupsInThousandFrames,
 1260                hiccupsTime = hiccupsTime,
 1261                totalTime = totalTime
 1262            });
 01263        }
 1264
 1265        public static void SendSystemInfoReport()
 1266        {
 01267            SendMessage("SystemInfoReport", new SystemInfoReportPayload());
 01268        }
 1269
 1270        public static void SendTermsOfServiceResponse(string sceneId, bool accepted, bool dontShowAgain)
 1271        {
 21272            var payload = new TermsOfServiceResponsePayload()
 1273            {
 1274                sceneId = sceneId,
 1275                accepted = accepted,
 1276                dontShowAgain = dontShowAgain
 1277            };
 21278            SendMessage("TermsOfServiceResponse", payload);
 21279        }
 1280
 1281        public static void SendExpression(string expressionID, long timestamp)
 1282        {
 21283            SendMessage("TriggerExpression", new SendExpressionPayload()
 1284            {
 1285                id = expressionID,
 1286                timestamp = timestamp
 1287            });
 21288        }
 1289
 1290        public static void OpenURL(string url)
 1291        {
 1292#if UNITY_WEBGL
 1293            SendMessage("OpenWebURL", new OpenURLPayload { url = url });
 1294#else
 31295            Application.OpenURL(url);
 1296#endif
 31297        }
 1298
 1299        public static void SendReportScene(string sceneID)
 1300        {
 01301            SendMessage("ReportScene", sceneID);
 01302        }
 1303
 1304        public static void SendReportPlayer(string playerName)
 1305        {
 21306            SendMessage("ReportPlayer", playerName);
 21307        }
 1308
 1309        public static void SendBlockPlayer(string userId)
 1310        {
 11311            SendMessage("BlockPlayer", new SendBlockPlayerPayload()
 1312            {
 1313                userId = userId
 1314            });
 11315        }
 1316
 1317        public static void SendUnblockPlayer(string userId)
 1318        {
 01319            SendMessage("UnblockPlayer", new SendUnblockPlayerPayload()
 1320            {
 1321                userId = userId
 1322            });
 01323        }
 1324
 1325        public static void RequestScenesInfoAroundParcel(Vector2 parcel, int maxScenesArea)
 1326        {
 01327            SendMessage("RequestScenesInfoInArea", new RequestScenesInfoAroundParcelPayload()
 1328            {
 1329                parcel = parcel,
 1330                scenesAround = maxScenesArea
 1331            });
 01332        }
 1333
 1334        public static void SendAudioStreamEvent(string url, bool play, float volume)
 1335        {
 11336            onAudioStreamingEvent.url = url;
 11337            onAudioStreamingEvent.play = play;
 11338            onAudioStreamingEvent.volume = volume;
 11339            SendMessage("SetAudioStream", onAudioStreamingEvent);
 11340        }
 1341
 1342        public static void SendSetVoiceChatRecording(bool recording)
 1343        {
 01344            setVoiceChatRecordingPayload.recording = recording;
 01345            SendMessage("SetVoiceChatRecording", setVoiceChatRecordingPayload);
 01346        }
 1347
 1348        public static void ToggleVoiceChatRecording()
 1349        {
 01350            SendMessage("ToggleVoiceChatRecording");
 01351        }
 1352
 1353        public static void ApplySettings(float voiceChatVolume, int voiceChatAllowCategory)
 1354        {
 61355            applySettingsPayload.voiceChatVolume = voiceChatVolume;
 61356            applySettingsPayload.voiceChatAllowCategory = voiceChatAllowCategory;
 61357            SendMessage("ApplySettings", applySettingsPayload);
 61358        }
 1359
 1360        public static void RequestGIFProcessor(string gifURL, string gifId, bool isWebGL1)
 1361        {
 01362            gifSetupPayload.imageSource = gifURL;
 01363            gifSetupPayload.id = gifId;
 01364            gifSetupPayload.isWebGL1 = isWebGL1;
 1365
 01366            SendMessage("RequestGIFProcessor", gifSetupPayload);
 01367        }
 1368
 1369        public static void DeleteGIF(string id)
 1370        {
 01371            stringPayload.value = id;
 01372            SendMessage("DeleteGIF", stringPayload);
 01373        }
 1374
 1375        public static void GoTo(int x, int y)
 1376        {
 41377            gotoEvent.x = x;
 41378            gotoEvent.y = y;
 41379            SendMessage("GoTo", gotoEvent);
 41380        }
 1381
 1382        public static void GoToCrowd()
 1383        {
 01384            SendMessage("GoToCrowd");
 01385        }
 1386
 1387        public static void GoToMagic()
 1388        {
 01389            SendMessage("GoToMagic");
 01390        }
 1391
 1392        public static void JumpIn(int x, int y, string serverName, string layerName)
 1393        {
 31394            jumpInPayload.realm.serverName = serverName;
 31395            jumpInPayload.realm.layer = layerName;
 1396
 31397            jumpInPayload.gridPosition.x = x;
 31398            jumpInPayload.gridPosition.y = y;
 1399
 31400            SendMessage("JumpIn", jumpInPayload);
 31401        }
 1402
 1403        public static void SendChatMessage(ChatMessage message)
 1404        {
 41405            sendChatMessageEvent.message = message;
 41406            SendMessage("SendChatMessage", sendChatMessageEvent);
 41407        }
 1408
 1409        public static void UpdateFriendshipStatus(FriendsController.FriendshipUpdateStatusMessage message)
 1410        {
 41411            SendMessage("UpdateFriendshipStatus", message);
 41412        }
 1413
 1414        public static void ScenesLoadingFeedback(LoadingFeedbackMessage message)
 1415        {
 01416            SendMessage("ScenesLoadingFeedback", message);
 01417        }
 1418
 1419        public static void FetchHotScenes()
 1420        {
 01421            SendMessage("FetchHotScenes");
 01422        }
 1423
 1424        public static void SetBaseResolution(int resolution)
 1425        {
 21426            baseResEvent.baseResolution = resolution;
 21427            SendMessage("SetBaseResolution", baseResEvent);
 21428        }
 1429
 1430        public static void ReportAnalyticsEvent(string eventName)
 1431        {
 01432            ReportAnalyticsEvent(eventName, null);
 01433        }
 1434
 1435        public static void ReportAnalyticsEvent(string eventName, AnalyticsPayload.Property[] eventProperties)
 1436        {
 01437            analyticsEvent.name = eventName;
 01438            analyticsEvent.properties = eventProperties;
 01439            SendMessage("Track", analyticsEvent);
 01440        }
 1441
 1442        public static void FetchBalanceOfMANA()
 1443        {
 21444            SendMessage("FetchBalanceOfMANA");
 21445        }
 1446
 1447        public static void SendSceneExternalActionEvent(string sceneId, string type, string payload)
 1448        {
 671449            sceneExternalActionEvent.type = type;
 671450            sceneExternalActionEvent.payload = payload;
 671451            SendSceneEvent(sceneId, "externalAction", sceneExternalActionEvent);
 671452        }
 1453
 1454        public static void SetMuteUsers(string[] usersId, bool mute)
 1455        {
 01456            muteUserEvent.usersId = usersId;
 01457            muteUserEvent.mute = mute;
 01458            SendMessage("SetMuteUsers", muteUserEvent);
 01459        }
 1460
 1461        public static void SendCloseUserAvatar(bool isSignUpFlow)
 1462        {
 01463            closeUserAvatarPayload.isSignUpFlow = isSignUpFlow;
 01464            SendMessage("CloseUserAvatar", closeUserAvatarPayload);
 01465        }
 1466
 1467        public static void KillPortableExperience(string portableExperienceId)
 1468        {
 01469            killPortableExperiencePayload.portableExperienceId = portableExperienceId;
 01470            SendMessage("KillPortableExperience", killPortableExperiencePayload);
 01471        }
 1472
 1473        public static void RequestWearables(
 1474            string ownedByUser,
 1475            string[] wearableIds,
 1476            string[] collectionIds,
 1477            string context)
 1478        {
 11479            requestWearablesPayload.filters = new WearablesRequestFiltersPayload
 1480            {
 1481                ownedByUser = ownedByUser,
 1482                wearableIds = wearableIds,
 1483                collectionIds = collectionIds
 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
 1505        public static void ReportAvatarFatalError()
 1506        {
 01507            SendMessage("ReportAvatarFatalError");
 01508        }
 1509
 1510        public static void UnpublishScene(Vector2Int sceneCoordinates)
 1511        {
 21512            var payload = new UnpublishScenePayload() { coordinates = $"{sceneCoordinates.x},{sceneCoordinates.y}" };
 21513            SendMessage("UnpublishScene", payload);
 21514        }
 1515
 1516        public static void NotifyStatusThroughChat(string message)
 1517        {
 01518            stringPayload.value = message;
 01519            SendMessage("NotifyStatusThroughChat", stringPayload);
 01520        }
 1521
 1522        public static void ReportVideoProgressEvent(
 1523            string componentId,
 1524            string sceneId,
 1525            string videoClipId,
 1526            int videoStatus,
 1527            float currentOffset,
 1528            float length)
 1529        {
 451530            SendVideoProgressEvent progressEvent = new SendVideoProgressEvent()
 1531            {
 1532                componentId = componentId,
 1533                sceneId = sceneId,
 1534                videoTextureId = videoClipId,
 1535                status = videoStatus,
 1536                currentOffset = currentOffset,
 1537                videoLength = length
 1538            };
 1539
 451540            SendMessage("VideoProgressEvent", progressEvent);
 451541        }
 1542
 1543        public static void ReportAvatarRemoved(string entityId, string avatarId)
 1544        {
 01545            avatarStatePayload.type = "Removed";
 01546            avatarStatePayload.entityId = entityId;
 01547            avatarStatePayload.avatarShapeId = avatarId;
 01548            SendMessage("ReportAvatarState", avatarStatePayload);
 01549        }
 1550
 1551        public static void ReportAvatarSceneChanged(string entityId, string avatarId, string sceneId)
 1552        {
 01553            avatarSceneChangedPayload.type = "SceneChanged";
 01554            avatarSceneChangedPayload.entityId = entityId;
 01555            avatarSceneChangedPayload.avatarShapeId = avatarId;
 01556            avatarSceneChangedPayload.sceneId = sceneId;
 01557            SendMessage("ReportAvatarState", avatarSceneChangedPayload);
 01558        }
 1559
 1560        public static void ReportAvatarClick(string sceneId, string userId, Vector3 rayOrigin, Vector3 rayDirection, flo
 1561        {
 01562            avatarOnClickPayload.userId = userId;
 01563            avatarOnClickPayload.ray.origin = rayOrigin;
 01564            avatarOnClickPayload.ray.direction = rayDirection;
 01565            avatarOnClickPayload.ray.distance = distance;
 1566
 01567            SendSceneEvent(sceneId, "playerClicked", avatarOnClickPayload);
 01568        }
 1569
 1570        public static void ReportOnPointerHoverEnterEvent(string sceneId, string uuid)
 1571        {
 41572            onPointerHoverEnterEvent.uuid = uuid;
 41573            SendSceneEvent(sceneId, "uuidEvent", onPointerHoverEnterEvent);
 41574        }
 1575
 1576        public static void ReportOnPointerHoverExitEvent(string sceneId, string uuid)
 1577        {
 11578            onPointerHoverExitEvent.uuid = uuid;
 11579            SendSceneEvent(sceneId, "uuidEvent", onPointerHoverExitEvent);
 11580        }
 1581
 1582        public static void ReportTime(float time, bool isPaused, float timeNormalizationFactor, float cycleTime)
 1583        {
 61584            timeReportPayload.time = time;
 61585            timeReportPayload.isPaused = isPaused;
 61586            timeReportPayload.timeNormalizationFactor = timeNormalizationFactor;
 61587            timeReportPayload.cycleTime = cycleTime;
 61588            SendMessage("ReportDecentralandTime", timeReportPayload);
 61589        }
 1590    }
 1591}

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)
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)