コード例 #1
0
 private void addObjectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (PackList.Instance.packs.Count > 0)
     {
         FormObjectPicker fop = new FormObjectPicker(PackList.Instance.packs[0], ElementType.LevelObjectDescription);
         if (fop.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             string str = fop.PickedContent[0];
             LevelObjectDescription wod1 = PackList.Instance.GetObject(str) as LevelObjectDescription;
             ResourceCollectorXNA.Engine.Logic.LevelObject testsidelevelobject1 = null;
             try
             {
                 testsidelevelobject1 = ResourceCollectorXNA.Engine.ContentLoader.ContentLoader.LevelObjectFromDescription(wod1, PackList.Instance.packs[0]);
             }
             catch (Exception ecx)
             {
                 MessageBox.Show(ecx.ToString());
                 return;
             }
             testsidelevelobject1.SetGlobalPose(Microsoft.Xna.Framework.Matrix.CreateTranslation(3, 20, 0));
             ResourceCollectorXNA.MyGame.AddOject(testsidelevelobject1);
         }
     }
     else
         MessageBox.Show("Load some packs first");
 }
コード例 #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (PackList.Instance.packs.Count == 0)
            {
                MessageBox.Show("no packs loaded!");
                return;
            }

               FormObjectPicker fop = new FormObjectPicker(PackList.Instance.packs[0], ElementType.LevelContent);
            if (fop.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;
            LevelContent lc = PackList.Instance.packs[0].getobject(fop.PickedContent[0]) as LevelContent;
            Engine.EngineLevel el = new Engine.EngineLevel(lc);
            textBox1.Text = lc.name.Substring(0, lc.name.Length - 1);
            GameEngine.Instance.LoadNewLevel(el);
            GameEngine.Instance.UpdateLevelPart();
            RenderWindow.Instance.Activate();
        }