I'm working on integration with Adventure Creator and Naninovel and
trying to switch Naninovel language manually when a user switched language from Adventure Creator's UI.
With the code below, at first glance it seemd to work without error, but only Managed Text is switched but Script(.nani) remains unchanged.
I would be happy if you could tell me what is wrong!
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using AC;
using Naninovel;
public class CustomScript : MonoBehaviour
{
void setLanguage (int language)
{
int locale = AC.Options.GetLanguage ();
var naniLocaleManager = Engine.GetService<ILocalizationManager>();
if (naniLocaleManager != null)
{
switch (locale)
{
case 0:
naniLocaleManager.SelectLocaleAsync ("ja");
break;
case 1:
naniLocaleManager.SelectLocaleAsync ("en");
break;
}
}
}
void OnEnable ()
{
EventManager.OnChangeLanguage += setLanguage;
}
void OnDisable ()
{
EventManager.OnChangeLanguage -= setLanguage;
}
}