Example #1
0
        private bool RunInteract()
        {
            if (InputField == null)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(InputField.text))
            {
                Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, transform);
                return(false);
            }

            bool success = ParseTextToMission(InputField.text, out KMMission mission, out var messages);

            if (!success)
            {
                Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, transform);
                foreach (var item in listItems)
                {
                    Destroy(item);
                }
                listItems.Clear();
                foreach (string m in messages)
                {
                    var item = Instantiate(ModuleListItemPrefab, ModuleList);
                    item.Name = m;
                    item.ID   = "";
                    listItems.Add(item.gameObject);
                }
                return(false);
            }

            try
            {
                File.WriteAllText(Path.Combine(Application.persistentDataPath, "LastDynamicMission.txt"), InputField.text);
            }
            catch (Exception ex)
            {
                Debug.LogError("[Dynamic Mission Generator] Could not write LastDynamicMission.txt");
                Debug.LogException(ex, this);
            }
            GameCommands.StartMission(mission, "-1");

            return(false);
        }
Example #2
0
    public void StartMission()
    {
        StartButton.GetComponent <Button>().interactable = false;

        GameCommands.StartMission(SelectedMission.Mission.ID, MissionSeed.ToString());
    }