コード例 #1
0
    static void Init()
    {
        CreateItemDialog window = (CreateItemDialog)EditorWindow.GetWindow <CreateItemDialog>("Create Item");

        window.minSize = new Vector2(400, 150);
        window.Show();
    }
コード例 #2
0
        /// <summary>
        /// Создание меню создаваемых файлов
        /// </summary>
        /// <param name="col">Список для добавления</param>
        private void AddCreationMenuItems(ToolStripItemCollection col)
        {
            // Папка
            col.Add(ControlStrings.InspectorContextFolder, ShadowImage.CompiledFromImage(InspectorIcons.Folder, 16, 1), (sndr, args) => {
                Project.Dir d        = projectInspector.Tag as Project.Dir;
                CreateItemDialog dlg = new CreateItemDialog(ControlStrings.InspectorContextFolder);
                dlg.ExistingNames    = d.UsedNames;
                DialogResult dr      = dlg.ShowDialog();
                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    localFileEvent = true;
                    NSDirectoryInspector.Entry en = new NSDirectoryInspector.Entry();
                    en.IsDirectory = true;
                    en.Name        = dlg.SpecifiedName;
                    en.Tag         = Project.CreateDir(dlg.SpecifiedName, d);
                    projectInspector.Entries.Add(en);
                    projectInspector.SelectedEntry = en;
                    localFileEvent = false;
                }
            });

            if (Editor.CreatableList.Length > 0)
            {
                col.Add(new ToolStripSeparator());
                foreach (Editor.FileCreator fc in Editor.CreatableList)
                {
                    col.Add(fc.Name, ShadowImage.CompiledFromImage(fc.Icon, 16, 1), (sndr, args) => {
                        Project.Dir cd       = projectInspector.Tag as Project.Dir;
                        Editor.FileCreator f = fc;
                        if (cd != null)
                        {
                            CreateItemDialog dlg = new CreateItemDialog(fc.Name);
                            dlg.Extension        = f.Extension;
                            dlg.ExistingNames    = cd.UsedNames;
                            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                localFileEvent   = true;
                                Project.Entry ce = Project.CreateEntry(dlg.SpecifiedName, cd);
                                NSDirectoryInspector.Entry en = new NSDirectoryInspector.Entry();
                                en.IsDirectory = false;
                                en.Name        = System.IO.Path.GetFileNameWithoutExtension(dlg.SpecifiedName);
                                en.Icon        = ce.Icon;
                                en.Tag         = (object)ce;
                                projectInspector.Entries.Add(en);
                                projectInspector.SelectedEntry = en;
                                localFileEvent = false;
                            }
                        }
                    });
                }
            }
        }
コード例 #3
0
        public static void SendCreateItem(CreateItemDialog dialog)
        {
            var args = new Dictionary <string, object>()
            {
                { "envID", dialog.Environment.ObjectID },
                { "area", dialog.Area },
                { "itemID", dialog.ItemID },
                { "materialID", dialog.MaterialID },
            };

            var script =
                @"env = world.GetObject(envID)
for p in area.Range():
	builder = Dwarrowdelf.Server.ItemObjectBuilder(itemID, materialID)
	item = builder.Create(world)
	item.MoveTo(env, p)"    ;

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }