FANDOM


This script swaps out your default Journal, InGame and Conversation Menus with an alternative set when the game's language is not set to anything other than the original.

To use it, make sure your Menu Manager has Menus named "Journal", "InGame" and "Conversation" as well as an alternative set named "Journal_Alt", "InGame_Alt" and "Conversation_Alt". Then place it in a script file named "ChangeMenusWithLanguage" and attach to a GameObject in your AC scene.

This is useful if e.g. we want to change the Menus to ones that use a different font when using a certain language.

It is intended for demonstration only - you'll almost certainly want to amend it in a real production.


using UnityEngine;
using AC;

public class ChangeMenusWithLangage : MonoBehaviour
{

private void Start ()
{
OnChangeLanguage (Options.GetLanguage ());
}

private void OnEnable ()
{
EventManager.OnChangeLanguage += OnChangeLanguage;
}

private void OnDisable ()
{
EventManager.OnChangeLanguage -= OnChangeLanguage;
}

private void OnChangeLanguage (int languageIndex)
{
bool useOriginals = (languageIndex == 0);

AC.PlayerMenus.GetMenuWithName ("Journal").isLocked = !useOriginals;
AC.PlayerMenus.GetMenuWithName ("InGame").isLocked = !useOriginals;
AC.PlayerMenus.GetMenuWithName ("Conversation").isLocked = !useOriginals;

AC.PlayerMenus.GetMenuWithName ("Journal_Alt").isLocked = useOriginals;
AC.PlayerMenus.GetMenuWithName ("InGame_Alt").isLocked = useOriginals;
AC.PlayerMenus.GetMenuWithName ("Conversation_Alt").isLocked = useOriginals;
}

}
Community content is available under CC-BY-SA unless otherwise noted.