コード例 #1
0
    public void Init()
    {
        if (isInit)
        {
            return;
        }

        isInit = true;

        InitGameObjects();

        HUDConfiguration hudConfig = new HUDConfiguration();

        hudConfig.active  = true;
        hudConfig.visible = false;
        HUDController.i.CreateHudElement <BuildModeHUDController>(hudConfig, HUDController.HUDElementID.BUILDER_IN_WORLD_MAIN);
        HUDController.i.CreateHudElement <BuilderInWorldInititalHUDController>(hudConfig, HUDController.HUDElementID.BUILDER_IN_WORLD_INITIAL);
        HUDController.i.builderInWorldMainHud.Initialize();

        HUDController.i.builderInWorldInititalHud.OnEnterEditMode += TryStartEnterEditMode;
        HUDController.i.builderInWorldMainHud.OnTutorialAction    += StartTutorial;
        HUDController.i.builderInWorldMainHud.OnLogoutAction      += ExitEditMode;

        InitControllers();

        CommonScriptableObjects.builderInWorldNotNecessaryUIVisibilityStatus.Set(true);

        ExternalCallsController.i.GetContentAsString(BuilderInWorldSettings.BASE_URL_ASSETS_PACK, CatalogReceived);
        BuilderInWorldNFTController.i.Initialize();
        BuilderInWorldNFTController.i.OnNFTUsageChange += OnNFTUsageChange;
    }
コード例 #2
0
        public IEnumerator CreateHudIfConfigurationIsActive()
        {
            // There must be a hud controller
            HUDController hudController = HUDController.i;

            Assert.IsNotNull(hudController, "There must be a HUDController in the scene");

            HUDConfiguration config = new HUDConfiguration()
            {
                active = true, visible = true
            };

            for (int i = 1; i < (int)HUDController.HUDElementID.COUNT; i++)
            {
                hudController.ConfigureHUDElement((HUDController.HUDElementID)i, config, null);
            }

            yield return(null);

            // HUD controllers are created
            for (int i = 1; i < (int)HUDController.HUDElementID.COUNT; i++)
            {
                Assert.IsNotNull(hudController.GetHUDElement((HUDController.HUDElementID)i), $"Failed to create {(HUDController.HUDElementID) i}");
            }
        }
コード例 #3
0
        public IEnumerator CreateHudIfConfigurationIsActive()
        {
            // There must be a hud controller
            Assert.IsNotNull(hudController, "There must be a HUDController in the scene");

            HUDConfiguration config = new HUDConfiguration()
            {
                active = true, visible = true
            };

            for (int i = 1; i < (int)HUDElementID.COUNT; i++)
            {
                hudController.ConfigureHUDElement((HUDElementID)i, config, null);
            }

            yield return(null);

            // HUD controllers are created
            for (int i = 1; i < (int)HUDElementID.COUNT; i++)
            {
                HUDElementID elementID = (HUDElementID)i;
                if (HUDController.IsHUDElementDeprecated(elementID))
                {
                    continue;
                }

                Assert.IsNotNull(hudController.GetHUDElement(elementID), $"Failed to create {elementID}");
            }
        }
コード例 #4
0
    public void ConfigureHUDElement(string payload)
    {
        ConfigureHUDElementMessage message = JsonUtility.FromJson <ConfigureHUDElementMessage>(payload);

        HUDConfiguration configuration = message.configuration;
        HUDElementID     id            = message.hudElementId;

        ConfigureHUDElement(id, configuration);
    }
コード例 #5
0
    public void ConfigureHUDElement(string payload)
    {
        ConfigureHUDElementMessage message = JsonUtility.FromJson <ConfigureHUDElementMessage>(payload);

        HUDElementID     id            = message.hudElementId;
        HUDConfiguration configuration = message.configuration;
        string           extraPayload  = message.extraPayload;

        HUDController.i.ConfigureHUDElement(id, configuration, extraPayload);
    }
コード例 #6
0
    public void UpdateHudElement(HUDConfiguration config, HUDElementID id)
    {
        if (!hudElements.ContainsKey(id))
        {
            return;
        }

        if (VERBOSE)
        {
            Debug.Log($"Updating {id}, type {hudElements[id].GetType().Name}, active: {config.active} visible: {config.visible}");
        }

        hudElements[id].SetVisibility(config.visible);
    }
コード例 #7
0
    public void CreateHudElement(HUDConfiguration config, HUDElementID id)
    {
        bool controllerCreated = hudElements.ContainsKey(id);

        if (config.active && !controllerCreated)
        {
            hudElements.Add(id, hudFactory.CreateHUD(id));

            if (VERBOSE)
            {
                Debug.Log($"Adding {id} .. type {hudElements[id].GetType().Name}");
            }
        }
    }
コード例 #8
0
    private void InitHUD()
    {
        HUDConfiguration hudConfig = new HUDConfiguration();

        hudConfig.active  = true;
        hudConfig.visible = false;
        HUDController.i.CreateHudElement(hudConfig, HUDElementID.BUILDER_IN_WORLD_MAIN);
        HUDController.i.OnBuilderProjectPanelCreation += InitBuilderProjectPanel;

        HUDController.i.builderInWorldMainHud.Initialize();

        HUDController.i.builderInWorldMainHud.OnTutorialAction  += StartTutorial;
        HUDController.i.builderInWorldMainHud.OnStartExitAction += StartExitMode;
        HUDController.i.builderInWorldMainHud.OnLogoutAction    += ExitEditMode;

        if (HUDController.i.builderProjectsPanelController != null)
        {
            HUDController.i.builderProjectsPanelController.OnJumpInOrEdit += GetCatalog;
        }
    }
コード例 #9
0
 public void SetConfiguration(HUDConfiguration configuration)
 {
     SetVisibility(configuration.active);
 }
コード例 #10
0
ファイル: HUDController.cs プロジェクト: maraoz/explorer
    public void ConfigureHUDElement(HUDElementID hudElementId, HUDConfiguration configuration, string extraPayload = null)
    {
        //TODO(Brian): For now, the factory code is using this switch approach.
        //             In order to avoid the factory upkeep we can transform the IHUD elements
        //             To ScriptableObjects. In this scenario, we can make each element handle its own
        //             specific initialization details.
        //
        //             This will allow us to unify the serialized factory objects design,
        //             like we already do with ECS components.

        switch (hudElementId)
        {
        case HUDElementID.NONE:
            break;

        case HUDElementID.MINIMAP:
            CreateHudElement <MinimapHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.PROFILE_HUD:
            var avatarHudConfig = JsonUtility.FromJson <Legacy.AvatarHUDConfiguration>(extraPayload);
            if (avatarHudConfig != null && avatarHudConfig.useNewVersion)
            {
                CreateHudElement <ProfileHUDController>(configuration, hudElementId);
            }
            else
            {
                CreateHudElement <Legacy.AvatarHUDController>(configuration, hudElementId);
            }

            if (avatarHud_Legacy != null)
            {
                avatarHud_Legacy.Initialize();
                avatarHud_Legacy.OnEditAvatarPressed += ShowAvatarEditor;
                avatarHud_Legacy.OnSettingsPressed   += ShowSettings;
                avatarHud_Legacy.OnControlsPressed   += ShowControls;
                ownUserProfile.OnUpdate += OwnUserProfileUpdated;
                OwnUserProfileUpdated(ownUserProfile);
            }

            break;

        case HUDElementID.NOTIFICATION:
            CreateHudElement <NotificationHUDController>(configuration, hudElementId);
            NotificationsController.i?.Initialize(notificationHud);
            break;

        case HUDElementID.AVATAR_EDITOR:
            CreateHudElement <AvatarEditorHUDController>(configuration, hudElementId);
            avatarEditorHud?.Initialize(ownUserProfile, wearableCatalog);
            break;

        case HUDElementID.SETTINGS:
            CreateHudElement <SettingsHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.EXPRESSIONS:
            CreateHudElement <ExpressionsHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.PLAYER_INFO_CARD:
            CreateHudElement <PlayerInfoCardHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.AIRDROPPING:
            CreateHudElement <AirdroppingHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.TERMS_OF_SERVICE:
            CreateHudElement <TermsOfServiceHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.WORLD_CHAT_WINDOW:
            if (worldChatWindowHud == null)
            {
                CreateHudElement <WorldChatWindowHUDController>(configuration, hudElementId);

                if (worldChatWindowHud != null)
                {
                    worldChatWindowHud.Initialize(ChatController.i, DCL.InitialSceneReferences.i?.mouseCatcher);
                    worldChatWindowHud.OnPressPrivateMessage    -= OpenPrivateChatWindow;
                    worldChatWindowHud.OnPressPrivateMessage    += OpenPrivateChatWindow;
                    worldChatWindowHud.view.OnDeactivatePreview -= View_OnDeactivatePreview;
                    worldChatWindowHud.view.OnDeactivatePreview += View_OnDeactivatePreview;

                    taskbarHud?.AddWorldChatWindow(worldChatWindowHud);
                }
            }
            else
            {
                UpdateHudElement <WorldChatWindowHUDController>(configuration, hudElementId);
            }

            break;

        case HUDElementID.FRIENDS:
            if (friendsHud == null)
            {
                CreateHudElement <FriendsHUDController>(configuration, hudElementId);

                if (friendsHud != null)
                {
                    friendsHud.Initialize(FriendsController.i, UserProfile.GetOwnUserProfile());
                    friendsHud.OnPressWhisper -= OpenPrivateChatWindow;
                    friendsHud.OnPressWhisper += OpenPrivateChatWindow;

                    taskbarHud?.AddFriendsWindow(friendsHud);
                }
            }
            else
            {
                UpdateHudElement <FriendsHUDController>(configuration, hudElementId);

                if (!configuration.active)
                {
                    taskbarHud?.DisableFriendsWindow();
                }
            }

            if (privateChatWindowHud == null)
            {
                CreateHudElement <PrivateChatWindowHUDController>(configuration, HUDElementID.PRIVATE_CHAT_WINDOW);

                if (privateChatWindowHud != null)
                {
                    privateChatWindowHud.Initialize(ChatController.i);
                    privateChatWindowHud.OnPressBack -= PrivateChatWindowHud_OnPressBack;
                    privateChatWindowHud.OnPressBack += PrivateChatWindowHud_OnPressBack;

                    taskbarHud?.AddPrivateChatWindow(privateChatWindowHud);
                }
            }

            break;

        case HUDElementID.TASKBAR:
            if (taskbarHud == null)
            {
                CreateHudElement <TaskbarHUDController>(configuration, hudElementId);

                if (taskbarHud != null)
                {
                    taskbarHud.Initialize(DCL.InitialSceneReferences.i?.mouseCatcher, ChatController.i,
                                          FriendsController.i, newTaskbarIsEnabled);
                    taskbarHud.OnAnyTaskbarButtonClicked -= TaskbarHud_onAnyTaskbarButtonClicked;
                    taskbarHud.OnAnyTaskbarButtonClicked += TaskbarHud_onAnyTaskbarButtonClicked;

                    taskbarHud.AddSettingsWindow(settingsHud);
                    taskbarHud.AddBackpackWindow(avatarEditorHud);
                }
            }
            else
            {
                UpdateHudElement <TaskbarHUDController>(configuration, hudElementId);
            }

            break;

        case HUDElementID.MESSAGE_OF_THE_DAY:
            CreateHudElement <WelcomeHUDController>(configuration, hudElementId);
            messageOfTheDayHud?.Initialize(ownUserProfile.hasConnectedWeb3);
            break;

        case HUDElementID.OPEN_EXTERNAL_URL_PROMPT:
            CreateHudElement <ExternalUrlPromptHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.NFT_INFO_DIALOG:
            CreateHudElement <NFTPromptHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.TELEPORT_DIALOG:
            CreateHudElement <TeleportPromptHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.CONTROLS_HUD:
            CreateHudElement <ControlsHUDController>(configuration, hudElementId);
            taskbarHud?.AddControlsMoreOption();
            break;

        case HUDElementID.EXPLORE_HUD:
            CreateHudElement <ExploreHUDController>(configuration, hudElementId);
            if (exploreHud != null)
            {
                exploreHud.Initialize(FriendsController.i, newTaskbarIsEnabled);
                taskbarHud?.AddExploreWindow(exploreHud);
            }
            break;

        case HUDElementID.MANA_HUD:
            CreateHudElement <ManaHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.HELP_AND_SUPPORT_HUD:
            CreateHudElement <HelpAndSupportHUDController>(configuration, hudElementId);
            taskbarHud?.AddHelpAndSupportWindow(helpAndSupportHud);
            break;

        case HUDElementID.GO_TO_GENESIS_PLAZA_HUD:
            CreateHudElement <GoToGenesisPlazaHUDController>(configuration, hudElementId);
            taskbarHud?.AddGoToGenesisWindow(goToGenesisPlazaHud);
            break;
        }

        var hudElement = GetHUDElement(hudElementId);

        if (hudElement != null)
        {
            hudElement.SetVisibility(configuration.active && configuration.visible);
        }
    }
コード例 #11
0
    public void ConfigureHUDElement(HUDElementID hudElementId, HUDConfiguration configuration, string extraPayload = null)
    {
        //TODO(Brian): For now, the factory code is using this switch approach.
        //             In order to avoid the factory upkeep we can transform the IHUD elements
        //             To ScriptableObjects. In this scenario, we can make each element handle its own
        //             specific initialization details.
        //
        //             This will allow us to unify the serialized factory objects design,
        //             like we already do with ECS components.

        switch (hudElementId)
        {
        case HUDElementID.NONE:
            break;

        case HUDElementID.MINIMAP:
            CreateHudElement(configuration, hudElementId);
            break;

        case HUDElementID.PROFILE_HUD:
            CreateHudElement(configuration, hudElementId);
            if (profileHud != null)
            {
                //TODO This coupling might introduce a race condition if kernel configures this HUD before AvatarEditorHUD
                profileHud?.AddBackpackWindow(avatarEditorHud);
            }

            break;

        case HUDElementID.NOTIFICATION:
            CreateHudElement(configuration, hudElementId);
            NotificationsController.i?.Initialize(notificationHud);
            break;

        case HUDElementID.AVATAR_EDITOR:
            CreateHudElement(configuration, hudElementId);
            if (avatarEditorHud != null)
            {
                avatarEditorHud.Initialize(ownUserProfile, wearableCatalog);
            }

            break;

        case HUDElementID.SETTINGS_PANEL:
            CreateHudElement(configuration, hudElementId);
            if (settingsPanelHud != null)
            {
                settingsPanelHud.Initialize();
            }
            break;

        case HUDElementID.EXPRESSIONS:
            CreateHudElement(configuration, hudElementId);
            break;

        case HUDElementID.PLAYER_INFO_CARD:
            CreateHudElement(configuration, hudElementId);
            break;

        case HUDElementID.AIRDROPPING:
            CreateHudElement(configuration, hudElementId);
            break;

        case HUDElementID.TERMS_OF_SERVICE:
            CreateHudElement(configuration, hudElementId);
            break;

        case HUDElementID.WORLD_CHAT_WINDOW:
            if (worldChatWindowHud == null)
            {
                CreateHudElement(configuration, hudElementId);

                if (worldChatWindowHud != null)
                {
                    worldChatWindowHud.Initialize(ChatController.i, DCL.InitialSceneReferences.i?.mouseCatcher);
                    worldChatWindowHud.OnPressPrivateMessage    -= OpenPrivateChatWindow;
                    worldChatWindowHud.OnPressPrivateMessage    += OpenPrivateChatWindow;
                    worldChatWindowHud.view.OnDeactivatePreview -= View_OnDeactivatePreview;
                    worldChatWindowHud.view.OnDeactivatePreview += View_OnDeactivatePreview;

                    taskbarHud?.AddWorldChatWindow(worldChatWindowHud);
                }
            }
            else
            {
                UpdateHudElement(configuration, hudElementId);
            }

            break;

        case HUDElementID.FRIENDS:
            if (friendsHud == null)
            {
                CreateHudElement(configuration, hudElementId);

                if (friendsHud != null)
                {
                    friendsHud.Initialize(FriendsController.i, UserProfile.GetOwnUserProfile());
                    friendsHud.OnPressWhisper -= OpenPrivateChatWindow;
                    friendsHud.OnPressWhisper += OpenPrivateChatWindow;

                    taskbarHud?.AddFriendsWindow(friendsHud);
                }
            }
            else
            {
                UpdateHudElement(configuration, hudElementId);

                if (!configuration.active)
                {
                    taskbarHud?.DisableFriendsWindow();
                }
            }

            if (privateChatWindowHud == null)
            {
                CreateHudElement(configuration, HUDElementID.PRIVATE_CHAT_WINDOW);

                if (privateChatWindowHud != null)
                {
                    privateChatWindowHud.Initialize(ChatController.i);
                    privateChatWindowHud.OnPressBack -= PrivateChatWindowHud_OnPressBack;
                    privateChatWindowHud.OnPressBack += PrivateChatWindowHud_OnPressBack;

                    taskbarHud?.AddPrivateChatWindow(privateChatWindowHud);
                }
            }

            break;

        case HUDElementID.TASKBAR:
            if (taskbarHud == null)
            {
                CreateHudElement(configuration, hudElementId);

                if (taskbarHud != null)
                {
                    taskbarHud.Initialize(
                        InitialSceneReferences.i?.mouseCatcher,
                        ChatController.i,
                        FriendsController.i,
                        DCL.Environment.i.world.sceneController,
                        DCL.Environment.i.world.state);
                    taskbarHud.OnAnyTaskbarButtonClicked -= TaskbarHud_onAnyTaskbarButtonClicked;
                    taskbarHud.OnAnyTaskbarButtonClicked += TaskbarHud_onAnyTaskbarButtonClicked;

                    if (!string.IsNullOrEmpty(extraPayload))
                    {
                        var config = JsonUtility.FromJson <TaskbarHUDController.Configuration>(extraPayload);
                        if (config.enableVoiceChat)
                        {
                            taskbarHud.OnAddVoiceChat();
                        }

                        taskbarHud.SetQuestsPanelStatus(config.enableQuestPanel);
                    }

                    taskbarHud.AddSettingsWindow(settingsPanelHud);
                }
            }
            else
            {
                UpdateHudElement(configuration, hudElementId);
            }

            break;

        case HUDElementID.MESSAGE_OF_THE_DAY:
            CreateHudElement(configuration, hudElementId);
            messageOfTheDayHud?.Initialize(JsonUtility.FromJson <MessageOfTheDayConfig>(extraPayload));
            break;

        case HUDElementID.OPEN_EXTERNAL_URL_PROMPT:
            CreateHudElement(configuration, hudElementId);
            break;

        case HUDElementID.NFT_INFO_DIALOG:
            CreateHudElement(configuration, hudElementId);
            break;

        case HUDElementID.TELEPORT_DIALOG:
            CreateHudElement(configuration, hudElementId);
            break;

        case HUDElementID.CONTROLS_HUD:
            CreateHudElement(configuration, hudElementId);
            taskbarHud?.AddControlsMoreOption();
            break;

        case HUDElementID.EXPLORE_HUD:
            CreateHudElement(configuration, hudElementId);
            if (exploreHud != null)
            {
                exploreHud.Initialize(FriendsController.i);
                taskbarHud?.AddExploreWindow(exploreHud);
            }

            break;

        case HUDElementID.HELP_AND_SUPPORT_HUD:
            CreateHudElement(configuration, hudElementId);
            taskbarHud?.AddHelpAndSupportWindow(helpAndSupportHud);
            break;

        case HUDElementID.USERS_AROUND_LIST_HUD:
            CreateHudElement(configuration, hudElementId);
            if (usersAroundListHud != null)
            {
                minimapHud?.AddUsersAroundIndicator(usersAroundListHud);
            }

            break;

        case HUDElementID.GRAPHIC_CARD_WARNING:
            CreateHudElement(configuration, hudElementId);
            break;

        case HUDElementID.BUILDER_IN_WORLD_MAIN:
            CreateHudElement(configuration, hudElementId);
            if (configuration.active)
            {
                builderInWorldMainHud.Initialize();
            }
            break;

        case HUDElementID.QUESTS_PANEL:
            CreateHudElement(configuration, hudElementId);
            if (configuration.active)
            {
                questsPanelHUD.Initialize(QuestsController.i);
            }
            break;

        case HUDElementID.QUESTS_TRACKER:
            CreateHudElement(configuration, hudElementId);
            if (configuration.active)
            {
                questsTrackerHUD.Initialize(QuestsController.i);
            }
            break;

        case HUDElementID.SIGNUP:
            CreateHudElement(configuration, hudElementId);
            if (configuration.active)
            {
                //Same race condition risks as with the ProfileHUD
                //TODO Refactor the way AvatarEditor sets its visibility to match our data driven pattern
                //Then this reference can be removed so we just work with a BaseVariable<bool>.
                //This refactor applies to the ProfileHUD and the way kernel asks the HUDController during signup
                signupHUD.Initialize(avatarEditorHud);
            }
            break;

        case HUDElementID.BUILDER_PROJECTS_PANEL:
            CreateHudElement(configuration, hudElementId);
            if (configuration.active)
            {
                builderProjectsPanelController.Initialize();
                taskbarHud.SetBuilderInWorldStatus(true);
            }
            OnBuilderProjectPanelCreation?.Invoke();
            break;

        case HUDElementID.LOADING:
            CreateHudElement(configuration, hudElementId);
            if (configuration.active)
            {
                loadingController.Initialize();
            }
            break;

        case HUDElementID.AVATAR_NAMES:
            CreateHudElement(configuration, hudElementId);
            if (configuration.active)
            {
                avatarNamesController.Initialize();
            }
            break;
        }

        var hudElement = GetHUDElement(hudElementId);

        if (hudElement != null)
        {
            hudElement.SetVisibility(configuration.active && configuration.visible);
        }
    }
コード例 #12
0
    void Start()
    {
        KernelConfig.i.EnsureConfigInitialized().Then(config => activeFeature = config.features.enableBuilderInWorld);
        KernelConfig.i.OnChange += OnKernelConfigChanged;

        if (snapGO == null)
        {
            snapGO = new GameObject("SnapGameObject");
        }

        snapGO.transform.SetParent(transform);

        if (freeMovementGO == null)
        {
            freeMovementGO = new GameObject("FreeMovementGO");
        }

        freeMovementGO.transform.SetParent(cameraParentGO.transform);

        if (editionGO == null)
        {
            editionGO = new GameObject("EditionGO");
        }

        editionGO.transform.SetParent(cameraParentGO.transform);

        if (undoGO == null)
        {
            undoGO = new GameObject("UndoGameObject");
            undoGO.transform.SetParent(transform);
        }

        HUDConfiguration hudConfig = new HUDConfiguration();

        hudConfig.active  = true;
        hudConfig.visible = false;
        HUDController.i.CreateHudElement <BuildModeHUDController>(hudConfig, HUDController.HUDElementID.BUILDER_IN_WORLD_MAIN);
        HUDController.i.CreateHudElement <BuilderInWorldInititalHUDController>(hudConfig, HUDController.HUDElementID.BUILDER_IN_WORLD_INITIAL);

        editModeChangeInputAction.OnTriggered += OnEditModeChangeAction;

        createLastSceneObjectDelegate = (action) => CreateLastSceneObject();
        redoDelegate     = (action) => RedoAction();
        undoDelegate     = (action) => UndoAction();
        snapModeDelegate = (action) => ChangeSnapMode();

        toggleCreateLastSceneObjectInputAction.OnTriggered += createLastSceneObjectDelegate;
        toggleRedoActionInputAction.OnTriggered            += redoDelegate;
        toggleUndoActionInputAction.OnTriggered            += undoDelegate;
        toggleSnapModeInputAction.OnTriggered += snapModeDelegate;

        multiSelectionStartDelegate    = (action) => StartMultiSelection();
        multiSelectionFinishedDelegate = (action) => EndMultiSelection();

        multiSelectionInputAction.OnStarted  += multiSelectionStartDelegate;
        multiSelectionInputAction.OnFinished += multiSelectionFinishedDelegate;

        HUDController.i.builderInWorldInititalHud.OnEnterEditMode += TryStartEnterEditMode;
        HUDController.i.builderInWorldMainHud.OnStopInput         += StopInput;
        HUDController.i.builderInWorldMainHud.OnResumeInput       += ResumeInput;


        HUDController.i.builderInWorldMainHud.OnChangeModeAction += ChangeAdvanceMode;
        HUDController.i.builderInWorldMainHud.OnResetAction      += ResetScaleAndRotation;

        HUDController.i.builderInWorldMainHud.OnSceneObjectSelected += OnSceneObjectSelected;
        HUDController.i.builderInWorldMainHud.OnTutorialAction      += StartTutorial;
        HUDController.i.builderInWorldMainHud.OnPublishAction       += PublishScene;
        HUDController.i.builderInWorldMainHud.OnLogoutAction        += ExitEditMode;

        BuilderInWorldNFTController.i.OnNFTUsageChange += OnNFTUsageChange;

        builderInputWrapper.OnMouseClick += MouseClick;

        builderInWorldEntityHandler.Init();
        InitEditModes();


        CommonScriptableObjects.builderInWorldNotNecessaryUIVisibilityStatus.Set(true);


        if (!isTestMode)
        {
            ExternalCallsController.i.GetContentAsString(BuilderInWorldSettings.BASE_URL_ASSETS_PACK, CatalogReceived);
            BuilderInWorldNFTController.i.Initialize();
        }

        meshLoadIndicator.SetCamera(Camera.main);
    }
コード例 #13
0
    public void ConfigureHUDElement(HUDElementID hudElementId, HUDConfiguration configuration, string extraPayload = null)
    {
        //TODO(Brian): For now, the factory code is using this switch approach.
        //             In order to avoid the factory upkeep we can transform the IHUD elements
        //             To ScriptableObjects. In this scenario, we can make each element handle its own
        //             specific initialization details.
        //
        //             This will allow us to unify the serialized factory objects design,
        //             like we already do with ECS components.

        switch (hudElementId)
        {
        case HUDElementID.NONE:
            break;

        case HUDElementID.MINIMAP:
            CreateHudElement <MinimapHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.PROFILE_HUD:
            CreateHudElement <ProfileHUDController>(configuration, hudElementId);
            if (profileHud != null)
            {
                profileHud?.AddBackpackWindow(avatarEditorHud);
            }

            break;

        case HUDElementID.NOTIFICATION:
            CreateHudElement <NotificationHUDController>(configuration, hudElementId);
            NotificationsController.i?.Initialize(notificationHud);
            break;

        case HUDElementID.AVATAR_EDITOR:
            CreateHudElement <AvatarEditorHUDController>(configuration, hudElementId);
            if (avatarEditorHud != null)
            {
                avatarEditorHud.Initialize(ownUserProfile, wearableCatalog);
            }

            break;

        case HUDElementID.SETTINGS_PANEL:
            CreateHudElement <SettingsPanelHUDController>(configuration, hudElementId);
            if (settingsPanelHud != null)
            {
                settingsPanelHud.Initialize();
            }
            break;

        case HUDElementID.EXPRESSIONS:
            CreateHudElement <ExpressionsHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.PLAYER_INFO_CARD:
            CreateHudElement <PlayerInfoCardHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.AIRDROPPING:
            CreateHudElement <AirdroppingHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.TERMS_OF_SERVICE:
            CreateHudElement <TermsOfServiceHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.WORLD_CHAT_WINDOW:
            if (worldChatWindowHud == null)
            {
                CreateHudElement <WorldChatWindowHUDController>(configuration, hudElementId);

                if (worldChatWindowHud != null)
                {
                    worldChatWindowHud.Initialize(ChatController.i, DCL.InitialSceneReferences.i?.mouseCatcher);
                    worldChatWindowHud.OnPressPrivateMessage    -= OpenPrivateChatWindow;
                    worldChatWindowHud.OnPressPrivateMessage    += OpenPrivateChatWindow;
                    worldChatWindowHud.view.OnDeactivatePreview -= View_OnDeactivatePreview;
                    worldChatWindowHud.view.OnDeactivatePreview += View_OnDeactivatePreview;

                    taskbarHud?.AddWorldChatWindow(worldChatWindowHud);
                }
            }
            else
            {
                UpdateHudElement <WorldChatWindowHUDController>(configuration, hudElementId);
            }

            break;

        case HUDElementID.FRIENDS:
            if (friendsHud == null)
            {
                CreateHudElement <FriendsHUDController>(configuration, hudElementId);

                if (friendsHud != null)
                {
                    friendsHud.Initialize(FriendsController.i, UserProfile.GetOwnUserProfile());
                    friendsHud.OnPressWhisper -= OpenPrivateChatWindow;
                    friendsHud.OnPressWhisper += OpenPrivateChatWindow;

                    taskbarHud?.AddFriendsWindow(friendsHud);
                }
            }
            else
            {
                UpdateHudElement <FriendsHUDController>(configuration, hudElementId);

                if (!configuration.active)
                {
                    taskbarHud?.DisableFriendsWindow();
                }
            }

            if (privateChatWindowHud == null)
            {
                CreateHudElement <PrivateChatWindowHUDController>(configuration, HUDElementID.PRIVATE_CHAT_WINDOW);

                if (privateChatWindowHud != null)
                {
                    privateChatWindowHud.Initialize(ChatController.i);
                    privateChatWindowHud.OnPressBack -= PrivateChatWindowHud_OnPressBack;
                    privateChatWindowHud.OnPressBack += PrivateChatWindowHud_OnPressBack;

                    taskbarHud?.AddPrivateChatWindow(privateChatWindowHud);
                }
            }

            break;

        case HUDElementID.TASKBAR:
            if (taskbarHud == null)
            {
                CreateHudElement <TaskbarHUDController>(configuration, hudElementId);

                if (taskbarHud != null)
                {
                    taskbarHud.Initialize(
                        InitialSceneReferences.i?.mouseCatcher,
                        ChatController.i,
                        FriendsController.i,
                        DCL.Environment.i.world.sceneController,
                        DCL.Environment.i.world.state);
                    taskbarHud.OnAnyTaskbarButtonClicked -= TaskbarHud_onAnyTaskbarButtonClicked;
                    taskbarHud.OnAnyTaskbarButtonClicked += TaskbarHud_onAnyTaskbarButtonClicked;
                    taskbarHud.AddBuilderInWorldWindow(builderInWorldInititalHud);


                    if (!string.IsNullOrEmpty(extraPayload))
                    {
                        var config = JsonUtility.FromJson <TaskbarHUDController.Configuration>(extraPayload);
                        if (config.enableVoiceChat)
                        {
                            taskbarHud.OnAddVoiceChat();
                        }
                        taskbarHud.SetQuestsPanelStatus(config.enableQuestPanel);
                    }

                    taskbarHud.AddSettingsWindow(settingsPanelHud);
                }
            }
            else
            {
                UpdateHudElement <TaskbarHUDController>(configuration, hudElementId);
            }

            break;

        case HUDElementID.MESSAGE_OF_THE_DAY:
            CreateHudElement <WelcomeHUDController>(configuration, hudElementId);
            messageOfTheDayHud?.Initialize(JsonUtility.FromJson <MessageOfTheDayConfig>(extraPayload));
            break;

        case HUDElementID.OPEN_EXTERNAL_URL_PROMPT:
            CreateHudElement <ExternalUrlPromptHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.NFT_INFO_DIALOG:
            CreateHudElement <NFTPromptHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.TELEPORT_DIALOG:
            CreateHudElement <TeleportPromptHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.CONTROLS_HUD:
            CreateHudElement <ControlsHUDController>(configuration, hudElementId);
            taskbarHud?.AddControlsMoreOption();
            break;

        case HUDElementID.EMAIL_PROMPT:
            if (emailPromptHud == null)
            {
                CreateHudElement <EmailPromptHUDController>(configuration, hudElementId);
            }

            emailPromptHud?.SetEnable(configuration.active);
            break;

        case HUDElementID.EXPLORE_HUD:
            CreateHudElement <ExploreHUDController>(configuration, hudElementId);
            if (exploreHud != null)
            {
                exploreHud.Initialize(FriendsController.i);
                taskbarHud?.AddExploreWindow(exploreHud);
            }

            break;

        case HUDElementID.HELP_AND_SUPPORT_HUD:
            CreateHudElement <HelpAndSupportHUDController>(configuration, hudElementId);
            taskbarHud?.AddHelpAndSupportWindow(helpAndSupportHud);
            break;

        case HUDElementID.USERS_AROUND_LIST_HUD:
            CreateHudElement <UsersAroundListHUDController>(configuration, hudElementId);
            if (usersAroundListHud != null)
            {
                minimapHud?.AddUsersAroundIndicator(usersAroundListHud);
            }

            break;

        case HUDElementID.GRAPHIC_CARD_WARNING:
            CreateHudElement <GraphicCardWarningHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.BUILDER_IN_WORLD_MAIN:
            CreateHudElement <BuildModeHUDController>(configuration, hudElementId);
            if (configuration.active)
            {
                builderInWorldMainHud.Initialize();
            }
            break;

        case HUDElementID.BUILDER_IN_WORLD_INITIAL:
            CreateHudElement <BuilderInWorldInititalHUDController>(configuration, hudElementId);
            break;

        case HUDElementID.QUESTS_PANEL:
            CreateHudElement <QuestsPanelHUDController>(configuration, hudElementId);
            if (configuration.active)
            {
                questsPanelHUD.Initialize(QuestsController.i);
            }
            break;

        case HUDElementID.QUESTS_TRACKER:
            CreateHudElement <QuestsTrackerHUDController>(configuration, hudElementId);
            if (configuration.active)
            {
                questsTrackerHUD.Initialize(QuestsController.i);
            }
            break;
        }

        var hudElement = GetHUDElement(hudElementId);

        if (hudElement != null)
        {
            hudElement.SetVisibility(configuration.active && configuration.visible);
        }
    }
コード例 #14
0
 public void SetConfiguration(HUDConfiguration configuration)
 {
     SetActive(configuration.active);
 }