HaoYue.Personality/AkiragestuProject/Form1.cs

132 lines
3.3 KiB
C#
Raw Normal View History

2018-10-11 20:53:13 +08:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AkiragestuProject
{
public partial class Form1 : Form
{
/// <summary>
/// 参数影响类
/// </summary>
akMood akm = new akMood();
/// <summary>
/// 内容语言识别
/// </summary>
akLanguage akl = new akLanguage();
/// <summary>
/// 运算类
/// </summary>
akOperation ako = new akOperation();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
LoadAkira();
}
#region
/// <summary>
/// 基本人格载入
/// </summary>
public void LoadAkira()
{
try
{
AddMessage(1, "皓月人格模拟载入中……");
AddMessage(1, "版本 Ver.0.0.1");
AddMessage(1, "----------------");
AddMessage(1, "皓月基本参数读取...");
var ak = akm.GetMain();
AddMessage(1, "心情:" + ak.Mood);
AddMessage(1, "精力:" + ak.Energy);
AddMessage(1, "饥饿:" + ak.Hungry);
AddMessage(1, "主要心理状态:" + ak.MentalityType);
AddMessage(1, "皓月模拟人格数据载入完毕");
AddMessage(1, "----------------");
AddMessage(1, "输入 /help 可以获得基本帮助 (~ ̄▽ ̄~)");
}
catch (Exception ex)
{
AddMessage(2, ex.ToString());
}
}
private void button1_Click(object sender, EventArgs e)
{
var Msg = textBox1.Text;
textBox1.Text = null;
if (Msg != null)
{
AddMessage(Msg);
//识别内容
int Type = akl.GetlanguageType(Msg);
if (Type == 2)
{
var Comstr = Msg.Substring(1);
if(Comstr != null && Comstr != "")
{
AddMessage(1,akl.GetCommand(Comstr));
}
}
}
}
#endregion
#region
public void AddMessage(string str)
{
var msgtype = "> UserMsg : ";
listBox1.Items.Add(DateTime.Now.ToLongTimeString().ToString() + msgtype + str);
}
public void AddMessage(int messagetype,string str)
{
var msgtype = "";
switch (messagetype)
{
case 1:
msgtype = "> Msg : ";
break;
case 2:
msgtype = "> Error :";
break;
case 3:
msgtype = "> Wran :";
break;
}
listBox1.Items.Add(DateTime.Now.ToLongTimeString().ToString() + msgtype + str);
}
#endregion
}
}