⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 这是一个实现小精灵提醒的程序
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;//用来实现RegistyKey
using System.IO;
namespace 泉哥提醒
{
    public partial class Form1 : Form
    {
        //private AxAgentObjects.AxAgent axAgent1;//精灵组件,用于载入和下载具体的精灵
        private AgentObjects.IAgentCtlCharacterEx Chatacter;//精灵角色对象,负责处理精灵的动作和行为
        private string agent;//当前使用的精灵名称
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.button1.Enabled = true;
            this.button2.Enabled = false;
            this.button3.Enabled = false;
            this.button4.Enabled = true;
            //axAgent1.Characters.Load("Robby", (object)"ROBBY.ACS");
            //Chatacter = axAgent1.Characters["Robby"];
            //Chatacter.Show(null);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //激活形象的代码
            //得到精灵的名称
            string s = comboBox1.SelectedItem.ToString();
            this .agent =s;
            //导入选择的精灵
            switch (s)
            {
                case"Genie":
                    axAgent1.Characters.Load ("Genie",(object)"GENIE.ACS");
                    Chatacter=axAgent1 .Characters["Genie"];
                    break;
                case "Merlin":
                    axAgent1.Characters.Load("Merlin", (object)"MERLIN.ACS");
                    Chatacter = axAgent1.Characters["Merlin"];
                    break;
                case "Peedyy":
                    axAgent1.Characters.Load("Peedyy", (object)"PEEDY.ACS");
                    Chatacter = axAgent1.Characters["Peedyy"];
                    break;
                case "Robby":
                    axAgent1.Characters.Load("Robby", (object)"ROBBY.ACS");
                    Chatacter = axAgent1.Characters["Robby"];
                    break;
            }
            //显示精灵
            //Chatacter.Height = 200;
            //Chatacter.Width = 200;
            Chatacter.Show(null);
           
            this.button1.Enabled = false;
            this.button2.Enabled = true;
            this.button3.Enabled = true;
            this.button4.Enabled = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //重新选择
            this.Chatacter.Stop(null);//精灵动作停止
            this.axAgent1.Characters.Unload(agent);//卸载导入的精灵
            this.button1.Enabled = true;
            this.button2.Enabled = false;
            this.button3.Enabled = false;
            this.button4.Enabled = true;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Visible = false;//Hide Form
            this.Chatacter.Hide(null);//Hide精灵
            //确定隐藏时间
            int i = (int)this.numericUpDown1.Value * 60 * 1000;//设置时间单位为秒
            System.Threading.Thread.Sleep(i);//等待过程
            this.Chatacter.Show(null);
            string ss = this.richTextBox1.Text;
            Chatacter.Speak(ss, null);//精灵说话
            Chatacter.Play("Surprised");
            Chatacter.GestureAt(200, 200);
            Chatacter.MoveTo(200, 200, 10000);
            Chatacter.Play("Greet");
            Chatacter.MoveTo(400, 500, 10000);
            Chatacter.Play("LookLeft");
            Chatacter.MoveTo(100, 100, 10000);
            Chatacter.Play("write");
            Chatacter.MoveTo(600, 600, 10000);
            Chatacter.Play("Searching");
            Chatacter.GestureAt(200, 200);
            Chatacter.Play("Think");
            Chatacter.Play("Announce");
            Chatacter.Play("Surprised");
            Chatacter.Activate(null);
            Chatacter.Speak(ss, null);
            Chatacter.GestureAt(200, 200);
            Chatacter.MoveTo(200, 200, 1000);
            Chatacter.Think(ss);
            Chatacter.Play("LookLeft");
            Chatacter.Play("wave");
            Chatacter.MoveTo(200, 700, 1000);
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程
            Chatacter.Show(null);
            Chatacter.GestureAt(200, 200);
            Chatacter.Play("wave");
            Chatacter.Speak(ss, null);
            Chatacter.MoveTo(700, 200, 1000);
            Chatacter.Play("Acknowledge");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(80000);//等待过程
            Chatacter.Show(null);
            Chatacter.Play("Alert");
            //Chatacter.Play("Reading");
            Chatacter.Play("Sad");
            Chatacter.Play("Think");
            Chatacter.MoveTo(300, 200, 1000);
            Chatacter.Play("Announce");
            Chatacter.Speak("发现程序入侵:来源:192.168.99.100", null);
            Chatacter.Play("Surprised");

            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程
            Chatacter.Show(null);
            Chatacter.Think("入侵已经拦截,详细信息已经登记!");
            Chatacter.MoveTo(500, 900, 1000);
            Chatacter.Play("Greet");
            Chatacter.Speak("有泉哥在,一切尽请放心!", null);
            Chatacter.MoveTo(900, 500, 3000);
            //Chatacter.Play("Reading");
            Chatacter.Play("Sad");
            Chatacter.Play("Think");
            Chatacter.Play("Announce");
            Chatacter.MoveTo(900, 200, 1000);
            Chatacter.Play("LookLeft");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(110000);//等待过程
            Chatacter.Show(null);
            Chatacter.GestureAt(200, 200);
            Chatacter.MoveTo(200, 200, 1000);
            Chatacter.Play("wave");
            Chatacter.Speak("向泉哥致敬", null);
            Chatacter.Play("Acknowledge");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(110000);//等待过程
            Chatacter.Show(null);
            Chatacter.MoveTo(100, 100, 1000);
            Chatacter.Play("write");
            Chatacter.MoveTo(600, 600, 1000);
            //Chatacter.Play("Reading");
            Chatacter.Play("Sad");
            Chatacter.Play("Think");
            Chatacter.Play("Announce");
            Chatacter.MoveTo(100, 100, 1000);
            //Chatacter.Play("Searching");
            Chatacter.GestureAt(200, 200);
            //Chatacter.Show(null);
            Chatacter.Play("Blink");
            Chatacter.Speak(ss, null);
            Chatacter.GestureAt(700, 900);
            Chatacter.MoveTo(300, 200, 1000);
            Chatacter.Think(ss);
            Chatacter.Play("wave");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(50000);//等待过程
            Chatacter.Show(null);
            Chatacter.GestureAt(200, 200);
            Chatacter.Play("wave");
            Chatacter.MoveTo(600, 600, 1000);
            Chatacter.Speak("向泉哥致敬", null);
            Chatacter.Play("Acknowledge");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(190000);//等待过程
            Chatacter.Show(null);
            Chatacter.GestureAt(600, 1000);
            Chatacter.Play("wave");
            Chatacter.Speak("向泉哥致敬", null);
            Chatacter.Play("Acknowledge");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(190000);//等待过程
            Chatacter.Show(null);
            Chatacter.Play("Sad");
            Chatacter.Play("Think");
            Chatacter.Speak("发现程序入侵:来源:192.168.99.100", null);
            Chatacter.MoveTo(50, 800, 1000);
            Chatacter.Play("Surprised");
            Chatacter.Hide(null);
            System.Threading.Thread.Sleep(10000);//等待过程

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -