コード例 #1
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            try
            {
                this.saveToolStripMenuItem_Click(sender, e);
            }
            catch (Exception ex)
            {
                EditorTools.WriteText(richTextBoxChat, "The IAT asset must be saved", Color.Red, true);
                return;
            }

            var sources = LoadedAsset.GetAllCharacterSources();

            if (sources.Count() <= 1)
            {
                EditorTools.WriteText(richTextBoxChat, "At least two characters are needed.", Color.Red, true);
                return;
            }

            agentsInChat = new List <RolePlayCharacterAsset>();
            foreach (var s in sources)
            {
                var rpc = RolePlayCharacterAsset.LoadFromFile(s.Source);
                rpc.LoadAssociatedAssets();
                LoadedAsset.BindToRegistry(rpc.DynamicPropertiesRegistry);
                if (rpc.CharacterName.ToString().ToLower().Contains("player"))
                {
                    rpc.IsPlayer = true;
                }

                agentsInChat.Add(rpc);
            }

            richTextBoxChat.Clear();
            listBoxPlayerDialogues.DataSource = new List <string>();
            comboBoxAgChat.DataSource         = agentsInChat.Select(a => a.CharacterName.ToString()).ToList();

            EditorTools.WriteText(richTextBoxChat, "Characters were loaded with success (" + DateTime.Now + ")",
                                  Color.Blue, true);
            var enterEvents = new List <WellFormedNames.Name>();

            foreach (var ag in agentsInChat)
            {
                enterEvents.Add(EventHelper.ActionEnd(ag.CharacterName.ToString(), "Enters", "-"));
            }

            foreach (var ag in agentsInChat)
            {
                ag.Perceive(enterEvents);

                EditorTools.WriteText(richTextBoxChat, ag.CharacterName + " enters the chat.", Color.Black, false);
                EditorTools.WriteText(richTextBoxChat,
                                      " (" + ag.GetInternalStateString() + " | " + ag.GetSIRelationsString() + ")", Color.DarkRed, true);
            }

            EditorTools.WriteText(richTextBoxChat, "", Color.Black, true);

            buttonContinue.Enabled = true;
            textBoxTick.Text       = agentsInChat[0].Tick.ToString();
            this.buttonContinue_Click(sender, e);
        }