Ejemplo n.º 1
0
        private void PlayNextScriptLine()
        {
            if (ScriptList.Count == 0)
            {
                return;
            }

            if (NextScriptLine != null)
            {
                LightSpotX    = NextScriptLine.X;
                LightSpotY    = NextScriptLine.Y;
                LightSpotSize = NextScriptLine.Size;

                PlayMove();
            }

            if (ScriptQueue.Count > 0)
            {
                NextScriptLine = ScriptQueue.Pop();
            }
            else
            {
                NextScriptLine = null;
                //PlayScript();
            }
        }
Ejemplo n.º 2
0
        private void Load_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
            ofd.Filter           = "TXT file (*.txt)|*.txt";
            ofd.RestoreDirectory = true;
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                StreamReader sr = new StreamReader(ofd.FileName, Encoding.Default);
                ScriptPreviewText.Text = Script = sr.ReadToEnd();

                ScriptList.Clear();
                string[] separator    = { System.Environment.NewLine };
                var      lineStrArray = Script.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                foreach (var lineStr in lineStrArray)
                {
                    var line = new ScriptLine();

                    int index = 0;
                    var arg_1 = lineStr.Substring(index, lineStr.IndexOf(",", index) - index);
                    index += arg_1.Length + 1;
                    var arg_2 = lineStr.Substring(index, lineStr.IndexOf(",", index) - index);
                    index += arg_2.Length + 1;
                    var arg_3 = lineStr.Substring(index, lineStr.IndexOf(",", index) - index);
                    index += arg_3.Length + 1;
                    var arg_4 = lineStr.Substring(index, lineStr.IndexOf(",", index) - index);

                    line.X    = Double.Parse(arg_1);
                    line.Y    = Double.Parse(arg_2);
                    line.Size = Double.Parse(arg_3);
                    line.Time = Double.Parse(arg_4);

                    ScriptList.Add(line);
                }
            }
        }
Ejemplo n.º 3
0
        private void PlayScript()
        {
            ResetSpot();

            ScriptQueue.Clear();
            int index = ScriptList.Count - 1;

            while (index >= 0)
            {
                ScriptQueue.Push(ScriptList[index]);
                index--;
            }

            NextScriptLine = ScriptQueue.Pop();

            StartTick();
        }
Ejemplo n.º 4
0
        private void AddScriptLine()
        {
            if (IsEditMode == false)
            {
                return;
            }

            ScriptLine newLine = new ScriptLine();

            newLine.X    = LightSpotX;
            newLine.Y    = LightSpotY;
            newLine.Size = LightSpotSize;
            newLine.Time = Media.Position.TotalSeconds;

            ScriptList.Add(newLine);
            PreviewScript();
        }