Exemplo n.º 1
0
        public TSOForm(TSOConfig tso_config, string[] args)
        {
            InitializeComponent();
            this.ClientSize = tso_config.ClientSize;

            for (int i = 0; i < keysEnabled.Length; i++)
            {
                keysEnabled[i] = true;
            }
            this.KeyDown += new KeyEventHandler(form_OnKeyDown);
            this.KeyUp   += new KeyEventHandler(form_OnKeyUp);

            this.DragDrop += new DragEventHandler(form_OnDragDrop);
            this.DragOver += new DragEventHandler(form_OnDragOver);

            this.viewer = new PlayViewer();

            if (viewer.InitializeApplication(this, true))
            {
                // シーケンスファイルか?
                if (args.Length == 2)
                {
                    if (args[0].ToLower() == "-seq")
                    {
                        seq.SetSequence(args[1], viewer);
                    }
                }
                else
                {
                    foreach (string arg in args)
                    {
                        viewer.LoadAnyFile(arg, true);
                    }
                    if (viewer.FigureList.Count == 0)
                    {
                        viewer.LoadAnyFile(Path.Combine(save_path, "system.tdcgsav.png"), true);
                    }
                    viewer.Camera.SetTranslation(0.0f, +10.0f, +44.0f);
                }

                this.timer1.Enabled = true;
            }
        }
Exemplo n.º 2
0
 private void form_OnDragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         foreach (string src in (string[])e.Data.GetData(DataFormats.FileDrop))
         {
             viewer.LoadAnyFile(src, (e.KeyState & 8) == 8);
         }
     }
 }
Exemplo n.º 3
0
        public bool DoCommand(string[] args)
        {
            try
            {
                switch (args[0].ToLower())
                {
                case "clear":
                    // 全て削除する.
                    viewer.ClearFigureList();
                    viewer.MotionEnabled = false;
                    camrotate            = new Vector3(0, 0, 0);
                    break;

                case "load":
                    // ファイルを読み込む.
                    for (int i = 1; i < args.Length; i++)
                    {
                        viewer.LoadAnyFile(args[i]);
                        //viewer.Camera.SetTranslation(0.0f, +10.0f, +44.0f);
                    }
                    break;

                case "run":
                    // アニメーションを実行する.
                    viewer.MotionEnabled = true;
                    break;

                case "translation":
                {
                    float x = float.Parse(args[1]);
                    float y = float.Parse(args[2]);
                    float z = float.Parse(args[3]);
                    viewer.Camera.SetTranslation(x, y, z);
                }
                break;

                case "angle":
                {
                    float x = Geometry.DegreeToRadian(float.Parse(args[1]));
                    float y = Geometry.DegreeToRadian(float.Parse(args[2]));
                    float z = Geometry.DegreeToRadian(float.Parse(args[3]));
                    viewer.Camera.SetAngle(x, y, z);
                }
                break;

                case "camfocus":
                {
                    viewer.Camera.ResetTranslation();
                    Figure fig;
                    if (viewer.TryGetFigure(out fig))
                    {
                        viewer.Camera.SetCenter(fig.Center + fig.Translation);
                    }
                }
                break;

                case "camtrack":
                {
                    float x = Geometry.DegreeToRadian(float.Parse(args[1]));
                    float y = Geometry.DegreeToRadian(float.Parse(args[2]));
                    float z = Geometry.DegreeToRadian(float.Parse(args[3]));
                    camrotate = new Vector3(x, y, z);
                }
                break;

                case "transition":
                    viewer.ReadyTransition();
                    break;

                case "wait":
                    // 次の待ち時間を設定する.
                    nextperiod += int.Parse(args[1]);
                    return(true);

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("error: " + e.Message);
            }

            return(false);
        }