Ejemplo n.º 1
0
        private void btn_NewFromTemplate_Click(object sender, EventArgs e)
        {
            List <string>        templateNames  = objectTemplates.Keys.ToList();
            SelectTemplateWindow selectTemplate = new SelectTemplateWindow(templateNames);

            selectTemplate.Closed += delegate
            {
                switch (selectTemplate.DialogResult)
                {
                case DialogResult.OK:
                    NewGameObject newGameObject = new NewGameObject(Observer);
                    newGameObject.Closed += delegate
                    {
                        switch (newGameObject.ValidObject)
                        {
                        case true:
                            GameObject gameObject = objectTemplates[selectTemplate.SelectedTemplate].CloneGameObject();
                            gameObject.Name = newGameObject.ReturnGameObject.Name;
                            AddGameObjectToDisplay(gameObject);
                            Observer.ObserveGameObject(gameObject);
                            return;

                        case false:
                            return;
                        }
                    };
                    newGameObject.ShowDialog();
                    break;

                case DialogResult.Cancel:
                    return;
                }
            };
            selectTemplate.ShowDialog();
        }
Ejemplo n.º 2
0
 private void btn_NewFromTemplate_Click(object sender, EventArgs e)
 {
     List<string> templateNames = objectTemplates.Keys.ToList();
     SelectTemplateWindow selectTemplate = new SelectTemplateWindow(templateNames);
     selectTemplate.Closed += delegate
     {
         switch (selectTemplate.DialogResult)
         {
             case DialogResult.OK:
                 NewGameObject newGameObject = new NewGameObject(Observer);
                 newGameObject.Closed += delegate
                 {
                     switch (newGameObject.ValidObject)
                     {
                         case true:
                             GameObject gameObject = objectTemplates[selectTemplate.SelectedTemplate].CloneGameObject();
                             gameObject.Name = newGameObject.ReturnGameObject.Name;
                             AddGameObjectToDisplay(gameObject);
                             Observer.ObserveGameObject(gameObject);
                             return;
                         case false:
                             return;
                     }
                 };
                 newGameObject.ShowDialog();
                 break;
             case DialogResult.Cancel:
                 return;
         }
     };
     selectTemplate.ShowDialog();
 }