| | 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 | |
|
| | 43 | | public void SetPlayerTalking(string talking) { |
| 0 | 44 | | Debug.Log($"VOICECHATDEBUG: Set player talking {talking}"); |
| 0 | 45 | | HUDController.i.taskbarHud?.SetVoiceChatRecording("true".Equals(talking)); |
| 0 | 46 | | } |
| | 47 | |
|
| | 48 | | public void SetVoiceChatEnabledByScene(int enabledPayload) |
| | 49 | | { |
| 0 | 50 | | Debug.Log($"VOICECHATDEBUG: Set voice chat enabled by scene {enabledPayload}"); |
| 0 | 51 | | bool isEnabled = enabledPayload != 0; |
| 0 | 52 | | HUDController.i.taskbarHud?.SetVoiceChatEnabledByScene(isEnabled); |
| 0 | 53 | | } |
| | 54 | |
|
| | 55 | | public void SetUserTalking(string payload) |
| | 56 | | { |
| 0 | 57 | | Debug.Log($"VOICECHATDEBUG: Set user talking {payload}"); |
| 0 | 58 | | var model = JsonUtility.FromJson<UserTalkingModel>(payload); |
| 0 | 59 | | HUDController.i.usersAroundListHud?.SetUserRecording(model.userId, model.talking); |
| 0 | 60 | | } |
| | 61 | |
|
| | 62 | | public void SetUsersMuted(string payload) |
| | 63 | | { |
| 0 | 64 | | var model = JsonUtility.FromJson<UserMutedModel>(payload); |
| 0 | 65 | | HUDController.i.usersAroundListHud?.SetUsersMuted(model.usersId, model.muted); |
| 0 | 66 | | } |
| | 67 | |
|
| 0 | 68 | | public void RequestTeleport(string teleportDataJson) { HUDController.i.teleportHud?.RequestTeleport(teleportDataJson |
| | 69 | |
|
| 0 | 70 | | public void UpdateBalanceOfMANA(string balance) { HUDController.i.profileHud?.SetManaBalance(balance); } |
| | 71 | |
|
| | 72 | | public void ShowAvatarEditorInSignUp() |
| | 73 | | { |
| 0 | 74 | | if (HUDController.i.avatarEditorHud != null) |
| | 75 | | { |
| 0 | 76 | | DataStore.i.common.isSignUpFlow.Set(true); |
| 0 | 77 | | HUDController.i.avatarEditorHud?.SetVisibility(true); |
| | 78 | | } |
| 0 | 79 | | } |
| | 80 | |
|
| | 81 | | #endregion |
| | 82 | | } |