using MPUIKIT; using UnityEngine; public class PromptsLanguage : MonoBehaviour { [SerializeField] private Sprite flag_en; [SerializeField] private Sprite flag_fr; [SerializeField] private MPImageBasic image; private string currentLanguage = "en"; private void Start() { RoomManager.Instance.OnRoomCreated += Initialize; } private void Initialize() { RoomManager.Instance.OnRoomCreated -= Initialize; currentLanguage = PlayerPrefs.GetString("promptslanguage", currentLanguage); SetLanguageOnRoom(); } public void SwapLanguage() { currentLanguage = currentLanguage == "en" ? "fr" : "en"; PlayerPrefs.SetString("promptslanguage", currentLanguage); SetLanguageOnRoom(); } private void SetLanguageOnRoom() { image.sprite = currentLanguage == "fr" ? flag_fr : flag_en; RoomManager.Instance.SetPromptsLanguage(currentLanguage); } }