示例#1
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}");
            }
        }
示例#2
0
    public static bool IsHUDElementDeprecated(HUDElementID element)
    {
        Type enumType  = typeof(HUDElementID);
        var  enumName  = enumType.GetEnumName(element);
        var  fieldInfo = enumType.GetField(enumName);

        return(Attribute.IsDefined(fieldInfo, typeof(ObsoleteAttribute)));
    }
示例#3
0
    public IHUD GetHUDElement(HUDElementID id)
    {
        if (!hudElements.ContainsKey(id))
        {
            return(null);
        }

        return(hudElements[id]);
    }
示例#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
    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);
        }
    }
示例#9
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);
        }
    }
示例#10
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);
        }
    }
示例#11
0
    public virtual IHUD CreateHUD(HUDElementID hudElementId)
    {
        IHUD hudElement = null;

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

        case HUDElementID.MINIMAP:
            hudElement = new MinimapHUDController();
            break;

        case HUDElementID.PROFILE_HUD:
            hudElement = new ProfileHUDController();
            break;

        case HUDElementID.NOTIFICATION:
            hudElement = new NotificationHUDController();
            break;

        case HUDElementID.AVATAR_EDITOR:
            hudElement = new AvatarEditorHUDController();
            break;

        case HUDElementID.SETTINGS_PANEL:
            hudElement = new SettingsPanelHUDController();
            break;

        case HUDElementID.EXPRESSIONS:
            hudElement = new ExpressionsHUDController();
            break;

        case HUDElementID.PLAYER_INFO_CARD:
            hudElement = new PlayerInfoCardHUDController();
            break;

        case HUDElementID.AIRDROPPING:
            hudElement = new AirdroppingHUDController();
            break;

        case HUDElementID.TERMS_OF_SERVICE:
            hudElement = new TermsOfServiceHUDController();
            break;

        case HUDElementID.WORLD_CHAT_WINDOW:
            hudElement = new WorldChatWindowHUDController();
            break;

        case HUDElementID.FRIENDS:
            hudElement = new FriendsHUDController();
            break;

        case HUDElementID.PRIVATE_CHAT_WINDOW:
            hudElement = new PrivateChatWindowHUDController();
            break;

        case HUDElementID.TASKBAR:
            hudElement = new TaskbarHUDController();
            break;

        case HUDElementID.MESSAGE_OF_THE_DAY:
            hudElement = new WelcomeHUDController();
            break;

        case HUDElementID.OPEN_EXTERNAL_URL_PROMPT:
            hudElement = new ExternalUrlPromptHUDController();
            break;

        case HUDElementID.NFT_INFO_DIALOG:
            hudElement = new NFTPromptHUDController();
            break;

        case HUDElementID.TELEPORT_DIALOG:
            hudElement = new TeleportPromptHUDController();
            break;

        case HUDElementID.CONTROLS_HUD:
            hudElement = new ControlsHUDController();
            break;

        case HUDElementID.EXPLORE_HUD:
            hudElement = new ExploreHUDController();
            break;

        case HUDElementID.HELP_AND_SUPPORT_HUD:
            hudElement = new HelpAndSupportHUDController();
            break;

        case HUDElementID.USERS_AROUND_LIST_HUD:
            hudElement = new UsersAroundListHUDController();
            break;

        case HUDElementID.GRAPHIC_CARD_WARNING:
            hudElement = new GraphicCardWarningHUDController();
            break;

        case HUDElementID.BUILDER_IN_WORLD_MAIN:
            hudElement = new BuildModeHUDController();
            break;

        case HUDElementID.QUESTS_PANEL:
            hudElement = new QuestsPanelHUDController();
            break;

        case HUDElementID.QUESTS_TRACKER:
            hudElement = new QuestsTrackerHUDController();
            break;

        case HUDElementID.SIGNUP:
            hudElement = new SignupHUDController();
            break;

        case HUDElementID.BUILDER_PROJECTS_PANEL:
            hudElement = new BuilderProjectsPanelController();
            break;

        case HUDElementID.LOADING:
            hudElement = new LoadingHUDController();
            break;

        case HUDElementID.AVATAR_NAMES:
            hudElement = new AvatarNamesHUDController();
            break;
        }

        return(hudElement);
    }