private void ReloadStrings() { if (stringsLoader == null) { stringsLoader = new StringsLoader(); } // Using keyboard so load the keyboard strings if (activeInputListenerType == typeof(KeyboardInputListener)) { stringsLoader.Load("Global/tutorialMessagesKeyboard.xml"); } else { stringsLoader.Load("Global/tutorialMessagesXbone.xml"); } }
/// <summary> /// Loads in a string resource from XML as a set of strings /// </summary> /// <param name="resource">String Resource name (name in the path after the language code)</param> public void LoadText(string resource) { Destroy(textWriterObject); StringsLoader loader = new StringsLoader(); loader.Load(resource); if (loader.Value != null) { // This probably isn't very efficient texts = new Stack <string>(loader.Value.Values.Reverse().ToList()); } }
public void ShowDialog(string xml) { var existing = FindObjectOfType <TextWriterComponent>(); if (!UnityUtils.Exists(existing)) { var textWriterQueuePrefab = GetRequiredResource <GameObject>("Prefabs/UI/TextWriterQueue"); var stringLoader = new StringsLoader(); stringLoader.Load(xml); var textWriterQueueInstance = Instantiate(textWriterQueuePrefab, FindOrCreateCanvas().transform); var textQueueComp = GetRequiredComponent <TextWriterQueueComponent>(textWriterQueueInstance); textQueueComp.InitQueue(new Queue <string>(stringLoader.Value.Values)); } }
public override void ComponentAwake() { timer = GetRequiredComponent <IntervalTimerComponent>(); timer.IsActive = false; fadeAnimator = GetRequiredComponent <Animator>(fadeObject); antagonistAnimator = GetRequiredComponent <Animator>(antagonistActor); protagonistAnimator = GetRequiredComponent <Animator>(protagonistActor); femaleAnimator = GetRequiredComponent <Animator>(femaleActor); antagSkeleton = GetRequiredComponent <SkeletonMecanim>(antagonistActor); antagRigidBody = GetRequiredComponent <Rigidbody2D>(antagonistActor); // Localize and prepare the dynamic menu // Load the dialog menu strings stringLoader.Load("Intro/intro_05_protagOptions.xml"); dynamicMenuComponent = GetRequiredComponent <DynamicMenuComponent>(dynamicMenuObject); dynamicMenuObject.SetActive(false); var allMenuItems = new DynamicMenuComponent.MenuItem[] { new DynamicMenuComponent.MenuItem() { Text = stringLoader.Value["protag_scared"], OnItemSelected = new UnityEvent() }, new DynamicMenuComponent.MenuItem() { Text = stringLoader.Value["protag_smart"], OnItemSelected = new UnityEvent() }, new DynamicMenuComponent.MenuItem() { Text = stringLoader.Value["protag_brave"], OnItemSelected = new UnityEvent() }, new DynamicMenuComponent.MenuItem() { Text = stringLoader.Value["protag_silent"], OnItemSelected = new UnityEvent() } }; allMenuItems[0].OnItemSelected.AddListener(() => ChooseOption(0)); allMenuItems[1].OnItemSelected.AddListener(() => ChooseOption(1)); allMenuItems[2].OnItemSelected.AddListener(() => ChooseOption(2)); allMenuItems[3].OnItemSelected.AddListener(() => ChooseOption(3)); dynamicMenuComponent.InitializeMenu(allMenuItems); femaleBrainParticleSystem = GetRequiredComponent <ParticleSystem>(GetRequiredChild("BrainChunkEmitter", femaleActor)); protagBrainParticleSystem = GetRequiredComponent <ParticleSystem>(GetRequiredChild("BrainChunkEmitter", protagonistActor)); base.ComponentAwake(); }