| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using DCL; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | public class HUDBridge : MonoBehaviour |
| | 7 | | { |
| | 8 | | #region MessagesFromKernel |
| | 9 | |
|
| | 10 | | [System.Serializable] |
| | 11 | | class ConfigureHUDElementMessage |
| | 12 | | { |
| | 13 | | public HUDElementID hudElementId; |
| | 14 | | public HUDConfiguration configuration; |
| | 15 | | public string extraPayload; |
| | 16 | | } |
| | 17 | |
|
| | 18 | | public void ConfigureHUDElement(string payload) |
| | 19 | | { |
| 0 | 20 | | ConfigureHUDElementMessage message = JsonUtility.FromJson<ConfigureHUDElementMessage>(payload); |
| | 21 | |
|
| 0 | 22 | | HUDElementID id = message.hudElementId; |
| 0 | 23 | | HUDConfiguration configuration = message.configuration; |
| 0 | 24 | | string extraPayload = message.extraPayload; |
| | 25 | |
|
| 0 | 26 | | HUDController.i.ConfigureHUDElement(id, configuration, extraPayload); |
| 0 | 27 | | } |
| | 28 | |
|
| 0 | 29 | | public void TriggerSelfUserExpression(string id) { UserProfile.GetOwnUserProfile().SetAvatarExpression(id); } |
| | 30 | |
|
| | 31 | | public void AirdroppingRequest(string payload) |
| | 32 | | { |
| 0 | 33 | | var model = JsonUtility.FromJson<AirdroppingHUDController.Model>(payload); |
| 0 | 34 | | HUDController.i.airdroppingHud.AirdroppingRequested(model); |
| 0 | 35 | | } |
| | 36 | |
|
| | 37 | | public void ShowTermsOfServices(string payload) |
| | 38 | | { |
| 0 | 39 | | var model = JsonUtility.FromJson<TermsOfServiceHUDController.Model>(payload); |
| 0 | 40 | | HUDController.i.termsOfServiceHud?.ShowTermsOfService(model); |
| 0 | 41 | | } |
| | 42 | |
|
| 0 | 43 | | public void SetPlayerTalking(string talking) { HUDController.i.taskbarHud?.SetVoiceChatRecording("true".Equals(talki |
| | 44 | |
|
| | 45 | | public void SetVoiceChatEnabledByScene(int enabledPayload) |
| | 46 | | { |
| 0 | 47 | | bool isEnabled = enabledPayload != 0; |
| 0 | 48 | | HUDController.i.taskbarHud?.SetVoiceChatEnabledByScene(isEnabled); |
| 0 | 49 | | } |
| | 50 | |
|
| | 51 | | public void SetUserTalking(string payload) |
| | 52 | | { |
| 0 | 53 | | var model = JsonUtility.FromJson<UserTalkingModel>(payload); |
| 0 | 54 | | HUDController.i.usersAroundListHud?.SetUserRecording(model.userId, model.talking); |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | public void SetUsersMuted(string payload) |
| | 58 | | { |
| 0 | 59 | | var model = JsonUtility.FromJson<UserMutedModel>(payload); |
| 0 | 60 | | HUDController.i.usersAroundListHud?.SetUsersMuted(model.usersId, model.muted); |
| 0 | 61 | | } |
| | 62 | |
|
| 0 | 63 | | public void RequestTeleport(string teleportDataJson) { HUDController.i.teleportHud?.RequestTeleport(teleportDataJson |
| | 64 | |
|
| 0 | 65 | | public void UpdateBalanceOfMANA(string balance) { HUDController.i.profileHud?.SetManaBalance(balance); } |
| | 66 | |
|
| | 67 | | public void ShowAvatarEditorInSignUp() |
| | 68 | | { |
| 0 | 69 | | if (HUDController.i.avatarEditorHud != null) |
| | 70 | | { |
| 0 | 71 | | DataStore.i.common.isSignUpFlow.Set(true); |
| 0 | 72 | | HUDController.i.avatarEditorHud?.SetVisibility(true); |
| | 73 | | } |
| 0 | 74 | | } |
| | 75 | |
|
| | 76 | | #endregion |
| | 77 | | } |