Bounce.LevelEditor.Editor.SetScriptingFields C# (CSharp) Метод

SetScriptingFields() приватный Метод

private SetScriptingFields ( ) : void
Результат void
        private void SetScriptingFields()
        {
            tb_Script.Text = "";
            tb_Script.Enabled = false;
            cbox_Scripted.Checked = false;
            cbox_Scripted.Enabled = false;

            if (currentlySelectedObject == null ||
                !(currentlySelectedObject is Dynamic))
                return;

            Dynamic dyn = (Dynamic)currentlySelectedObject;

            cbox_Scripted.Enabled = true;

            cbox_Scripted.Checked = dyn.IsScripted;
            tb_Script.Enabled = dyn.IsScripted;

            List<string> lines = new List<string>();

            foreach (Instruction inst in dyn.Instructions)
            {
                string line = "";
                string terminate = "\r\n";

                switch (inst.Type)
                {
                    case InstructionType.SetPosition:
                        line = "pos " + inst.Value1 + " " + inst.Value2;
                        break;

                    case InstructionType.SetVelocity:
                        line = "vel " + inst.Value1 + " " + inst.Value2;
                        break;

                    case InstructionType.Move:
                        line = "move for " + inst.Value1;
                        break;

                    case InstructionType.Stop:
                        line = "stop";
                        break;

                    case InstructionType.Goto:
                        line = "goto @";
                        lines[(int)inst.Value1] = "@" + lines[(int)inst.Value1];
                        break;

                    case InstructionType.Wait:
                        line = "wait for " + inst.Value1;
                        break;

                    case InstructionType.LoadPos:
                        line = "loadpos";
                        break;

                    case InstructionType.SavePos:
                        line = "savepos";
                        break;

                    case InstructionType.SetRotation:
                        line = "rot " + (inst.Value1 / MathHelper.Pi * 180.0f);
                        break;

                    case InstructionType.MoveForever:
                        line = "move forever";
                        break;
                }

                lines.Add(line + terminate);
            }

            foreach (string s in lines)
            {
                tb_Script.Text += s;
            }
        }