Пример #1
0
 private void start_Click(object sender, EventArgs e)
 {
     Th902Interface.openDanmakuFile(@"D:\th902\th902-main\src\resources\Danmaku\里冬.mbg");
 }
Пример #2
0
 private void right_Click(object sender, EventArgs e)
 {
     Th902Interface.getPalyerPosition().X += 5;
 }
Пример #3
0
 private void bottom_Click(object sender, EventArgs e)
 {
     Th902Interface.getPalyerPosition().Y += 5;
 }
Пример #4
0
 private void timer2_Tick(object sender, EventArgs e)
 {
     Th902Interface.update();
 }
Пример #5
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     bulletCount.Text = "bullet:" + Th902Interface.getBulletCount();
 }
Пример #6
0
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main()
        {
            new Main().Initialize("set.xna");
            while (true)
            {
                string command = Console.ReadLine();
                switch (command[0])
                {
                case 'q':
                    return;

                case 'o':
                    Th902Interface.OpenMbg(command.Substring(1));
                    break;

                case 'p':
                    string[] s = command.Substring(1).Split(',');
                    Th902Interface.SetPlayerPosition(float.Parse(s[0]) / 1.5f, float.Parse(s[1]) / 1.5f);
                    break;

                case 'r':
                    Th902Interface.SetRandomSeed(int.Parse(command.Substring(1)));
                    break;

                case 'u':
                    Th902Interface.Update();
                    break;

                case 'g':
                    var list     = Th902Interface.GetBulletList();
                    var filtered = new List <Barrage> ();
                    foreach (var item in list)
                    {
                        if (item.IsLase || item.IsRay)
                        {
                            continue;
                        }
                        if (item.x < -320.0f || item.x > 960.0f || item.y < -240.0f || item.y > 720.0f)
                        {
                            continue;
                        }
                        filtered.Add(item);
                    }
                    using (MemoryStream ms = new MemoryStream()) {
                        using (BinaryWriter bw = new BinaryWriter(ms)) {
                            for (int i = 0; i < filtered.Count; i++)
                            {
                                Barrage b = filtered[i];
                                bw.Write(b.x * 1.5f);
                                bw.Write(b.y * 1.5f);
                                bw.Write(b.type);
                                bw.Write(b.wscale);
                                bw.Write(b.hscale);
                                bw.Write(b.Blend);
                                bw.Write(b.R / 255.0f);
                                bw.Write(b.G / 255.0f);
                                bw.Write(b.B / 255.0f);
                                bw.Write(b.alpha / 100.0f);
                                bw.Write(b.head + 90.0f);
                            }
                            Console.Write(ms.Length.ToString("0000000000"));
                            Console.Out.Flush();
                            using (Stream stdout = Console.OpenStandardOutput()) {
                                stdout.Flush();
                                ms.Seek(0, SeekOrigin.Begin);
                                ms.CopyTo(stdout, Math.Max(32768, (int)ms.Length));
                                stdout.Flush();
                            }
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            ;
        }