예제 #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = ToolsLocalization.Translate("Various",
                                                        "Map files (*.map)|*.map|All files (*.*)|*.*");

            dialog.InitialDirectory = VirtualFileSystem.ResourceDirectoryPath;
            dialog.RestoreDirectory = true;

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string virtualFileName = VirtualFileSystem.GetVirtualPathByReal(dialog.FileName);

            if (string.IsNullOrEmpty(virtualFileName))
            {
                Log.Warning(ToolsLocalization.Translate("Various",
                                                        "Unable to load file. You cannot load map outside \"Data\" directory."));
                return;
            }

            MapLoad(virtualFileName);
        }
예제 #2
0
 public override PropertyDescriptorCollection GetProperties()
 {
     if (this.propertyDescriptorCollection == null)
     {
         this.propertyDescriptorCollection = new PropertyDescriptorCollection(null);
         Type           type       = this.entity.GetType();
         PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
         for (int i = 0; i < properties.Length; i++)
         {
             PropertyInfo propertyInfo   = properties[i];
             bool         propertyIgnore = propertyInfo.Name == "Type" && propertyInfo.DeclaringType != typeof(Entity);
             if (!propertyIgnore)
             {
                 List <Attribute> list          = propertyInfo.GetCustomAttributes(true).OfType <Attribute>().ToList();
                 bool             categoryFound = list.Where(_attr => _attr is CategoryAttribute).Count() > 0;
                 if (!categoryFound)
                 {
                     string format   = ToolsLocalization.Translate("EntityCustomTypeDescriptor", "class {0}");
                     string category = string.Format(format, propertyInfo.DeclaringType.Name);
                     list.Add(new CategoryAttribute(category));
                 }
                 propertyDescriptorCollection.Add(new EntityPropertyDescriptor(entity, propertyInfo, list.ToArray()));
             }
         }
     }
     return(this.propertyDescriptorCollection);
 }
예제 #3
0
파일: MapWorld.cs 프로젝트: nistck/Jx
        public string ChooseSavePath()
        {
            if (Map.Instance == null)
            {
                return(null);
            }

            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.FileName = "Map.map";
            saveFileDialog.Filter   = ToolsLocalization.Translate("Various", MAP_FILTER);
            if (string.IsNullOrEmpty(Map.Instance.VirtualFileName))
            {
                saveFileDialog.InitialDirectory = VirtualFileSystem.GetRealPathByVirtual("Maps");
            }
            else
            {
                saveFileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(VirtualFileSystem.GetRealPathByVirtual(Map.Instance.VirtualFileName));
            }
            saveFileDialog.RestoreDirectory = true;

            string result = null;

            if (saveFileDialog.ShowDialog() != DialogResult.OK)
            {
                result = saveFileDialog.FileName;
            }

            return(null);
        }
예제 #4
0
        public void AddLeaf(OptionsLeaf leaf, OptionsLeaf parentLeaf, bool selected)
        {
            TreeNode parentNode = TreeViewUtils.FindNodeByTag(treeView, parentLeaf);

            TreeNode node = new TreeNode(ToolsLocalization.Translate("OptionsDialog", leaf.ToString()));

            //node.Name = leaf.ToString();
            node.Tag = leaf;

            Image image = leaf.GetImage();

            if (image != null)
            {
                imageList.Images.Add(image);
                node.ImageIndex         = imageList.Images.Count - 1;
                node.SelectedImageIndex = node.ImageIndex;
            }

            parentNode.Nodes.Add(node);

            parentNode.Expand();

            if (selected)
            {
                treeView.SelectedNode = node;
            }
        }
예제 #5
0
 private void LocalizationTranslate()
 {
     base.TabText = ToolsLocalization.Translate("EntityTypesForm", base.TabText);
     foreach (ToolStripItem toolStripItem in this.XTS.Items)
     {
         toolStripItem.ToolTipText = ToolsLocalization.Translate("EntityTypesForm", toolStripItem.ToolTipText);
     }
     foreach (TabPage tabPage in this.tabControl.TabPages)
     {
         tabPage.Text = ToolsLocalization.Translate("EntityTypesForm", tabPage.Text);
     }
 }
예제 #6
0
        protected virtual bool OnEndEditMode()
        {
            if (this.modified)
            {
                string       format       = ToolsLocalization.Translate("Various", "Save resource \"{0}\"?");
                string       text         = string.Format(format, this.ToString());
                string       caption      = ToolsLocalization.Translate("Various", "Resource Editor");
                DialogResult dialogResult = MessageBox.Show(text, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Cancel)
                {
                    return(false);
                }
                if (dialogResult == DialogResult.Yes && !this.DoSave())
                {
                    return(false);
                }
            }
            this.editModeActive = false;
            MainForm.Instance.PropertiesForm.ReadOnly = true;
            MainForm.Instance.PropertiesForm.ModalDialogCollectionEditorOK -= new PropertiesForm.ModalDialogCollectionEditorOKDelegate(PropertiesForm_ModalDialogCollectionEditorOk);
            MainForm.Instance.PropertiesForm.PropertyValueChanged          -= PropertiesForm_PropertyValueChanged;

            return(true);

            /*
             * if (this.modified)
             * {
             *  string format = ToolsLocalization.Translate("Various", "Save resource \"{0}\"?");
             *  string text = string.Format(format, this.ToString());
             *  string caption = ToolsLocalization.Translate("Various", "Resource Editor");
             *  DialogResult dialogResult = MessageBox.Show(text, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
             *  if (dialogResult == DialogResult.Cancel)
             *  {
             *      return false;
             *  }
             *  if (dialogResult == DialogResult.Yes && !this.DoSave())
             *  {
             *      return false;
             *  }
             * }
             * if (UndoSystem.Instance != null)
             * {
             *  UndoSystem.Instance.Clear();
             * }
             * MainForm.Instance.PropertiesForm.ModalDialogCollectionEditorOK -= new PropertiesForm.ModalDialogCollectionEditorOKDelegate(this.A);
             * MainForm.Instance.PropertiesForm.PropertyValueChanged -= new PropertiesForm.PropertyValueChangeDelegate(this.A);
             * MainForm.Instance.ResourcesForm.Focus();
             * MainForm.Instance.ResourcesForm.TreeViewSelect();
             * this.editModeActive = false;
             * MainForm.Instance.PropertiesForm.ReadOnly = true;
             * return true;
             * //*/
        }
예제 #7
0
파일: MapWorld.cs 프로젝트: nistck/Jx
        public string ChooseOpenPath()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.FileName         = "";
            ofd.Filter           = ToolsLocalization.Translate("Various", MAP_FILTER);
            ofd.InitialDirectory = VirtualFileSystem.GetRealPathByVirtual("Maps");
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                return(ofd.FileName);
            }
            return(null);
        }
예제 #8
0
        private void A(Entity entity)
        {
            this.BJb.BeginUpdate();
            this.BJb.Nodes.Clear();
            TreeNode treeNode = null;

            foreach (Entity current in Entities.Instance.EntitiesCollection)
            {
                if (!current.Editor_IsExcludedFromWorld() && (!(this.BJe != null) || this.BJe.IsAssignableFrom(current.GetType())))
                {
                    bool flag = !string.IsNullOrEmpty(current.Name);
                    if (this.BJE != null)
                    {
                        LogicEntityClass logicEntityClass = current as LogicEntityClass;
                        if (logicEntityClass != null && logicEntityClass.EntityClassInfo != null && logicEntityClass.EntityClassInfo.EntityClassType.IsAssignableFrom(this.BJE.GetType()))
                        {
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        TreeNode treeNode2 = new TreeNode(current.ToString(), 2, 2);
                        treeNode2.Name = treeNode2.Text;
                        treeNode2.Tag  = current;
                        this.BJb.Nodes.Add(treeNode2);
                        if (current == entity)
                        {
                            treeNode = treeNode2;
                        }
                    }
                }
            }
            this.BJb.TreeViewNodeSorter = new AT();
            this.BJb.Sort();
            if (treeNode != null)
            {
                //TreeViewUtils.ExpandAllPathToNode(treeNode);
                this.BJb.SelectedNode = treeNode;
            }
            if (this.BJF)
            {
                this.BJf      = new TreeNode(ToolsLocalization.Translate("ChooseEntityForm", "(Null)"), 1, 1);
                this.BJf.Name = this.BJf.Text;
                this.BJb.Nodes.Add(this.BJf);
                if (entity == null)
                {
                    this.BJb.SelectedNode = this.BJf;
                }
            }
            this.BJb.EndUpdate();
        }
예제 #9
0
        void Translate()
        {
            Text = ToolsLocalization.Translate("OptionsDialog", Text);

            foreach (Control control in Controls)
            {
                if (control is Label || control is Button)
                {
                    control.Text = ToolsLocalization.Translate("OptionsDialog", control.Text);
                }
            }

            resetToolStripMenuItem.Text =
                ToolsLocalization.Translate("OptionsDialog", resetToolStripMenuItem.Text);
        }
예제 #10
0
파일: MapWorld.cs 프로젝트: nistck/Jx
        public bool Save(string virtualPathByReal)
        {
            bool result;

            using (new CursorKeeper(Cursors.WaitCursor))
            {
                if (string.IsNullOrEmpty(virtualPathByReal))
                {
                    string p = ChooseSavePath();
                    if (p == null)
                    {
                        return(false);
                    }

                    virtualPathByReal = VirtualFileSystem.GetVirtualPathByReal(p);
                    if (string.IsNullOrEmpty(virtualPathByReal))
                    {
                        Log.Warning(ToolsLocalization.Translate("Various", "Unable to save file. You cannot save map outside \"Data\" directory."));
                        result = false;
                        return(result);
                    }
                }
                EntityWorld.Instance.ResetBeforeMapSave();
                UndoSystem.Instance.Clear();
                Map.Instance.GetDataForEditor().ClearDeletedEntities();
                bool flag;
                try
                {
                    MainForm.Instance.WatchFileSystem = false;
                    flag = MapSystemWorld.MapSave(virtualPathByReal, true);
                }
                finally
                {
                    MainForm.Instance.WatchFileSystem = true;
                }
                if (!flag)
                {
                    result = false;
                }
                else
                {
                    Modified = false;
                    result   = true;
                }
                MainForm.Instance.NotifyUpdate(false);   // Save
            }
            return(result);
        }
예제 #11
0
 void propertiesForm_PropertyItemDoubleClick(object sender, EventArgs e)
 {
     if (PropertiesForm.SelectedGridItem != null && PropertiesForm.SelectedGridItem.Label == "LogicClass" && EntityWorld.Instance.SelectedEntities.Count == 1)
     {
         Entity entity = EntityWorld.Instance.SelectedEntities[0];
         if (entity.LogicClass == null)
         {
             string text    = ToolsLocalization.Translate("Various", "Tick you want create the class of Logic Editor for selected object?");
             string caption = ToolsLocalization.Translate("Various", "Map Editor");
             if (MessageBox.Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
             {
                 return;
             }
         }
         A(entity.LogicClass, entity.LogicClass == null);
     }
 }
예제 #12
0
        private void OnResourceBeginEditMode(EventArgs eventArgs)
        {
            if (this.currentResourceObjectEditor == null)
            {
                string realPathByVirtual = VirtualFileSystem.GetRealPathByVirtual(this.currentResourcePath);
                Shell32Api.ShellExecuteEx(null, realPathByVirtual);
                return;
            }
            if (!this.currentResourceObjectEditor.AllowEditMode)
            {
                string realPathByVirtual2 = VirtualFileSystem.GetRealPathByVirtual(this.currentResourcePath);
                Shell32Api.ShellExecuteEx(null, realPathByVirtual2);
                return;
            }
            if (VirtualFile.IsInArchive(this.currentResourceObjectEditor.FileName))
            {
                Log.Warning(ToolsLocalization.Translate("Various", "This file is inside an archive. Unable to edit it."));
                return;
            }
            this.currentResourceObjectEditor.BeginEditMode();

            Log.Info("MainForm.Instance.EngineAppControl.Focus();");
        }
예제 #13
0
파일: MapWorld.cs 프로젝트: nistck/Jx
        /// <summary>
        /// 打开一个 保存对话框 让用户选择
        /// </summary>
        /// <returns></returns>
        public DialogResult ConfirmSave()
        {
            if (Map.Instance == null)
            {
                return(DialogResult.No);
            }

            string format = ToolsLocalization.Translate("Various", "Save map \"{0}\"?");
            string arg;

            if (!string.IsNullOrEmpty(Map.Instance.VirtualFileName))
            {
                arg = Map.Instance.VirtualFileName;
            }
            else
            {
                arg = ToolsLocalization.Translate("Various", "Untitled");
            }

            string text    = string.Format(format, arg);
            string caption = ToolsLocalization.Translate("Various", "Map Editor");

            return(MessageBox.Show(text, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question));
        }
예제 #14
0
 public override bool IsAllowToChangeScale(out string reason)
 {
     reason = ToolsLocalization.Translate("Various", "Characters do not support scaling.");
     return(false);
 }
예제 #15
0
 string Translate(string text)
 {
     return(ToolsLocalization.Translate("ExportTo3DModelMEAddonForm", text));
 }
예제 #16
0
        void propertiesForm_ContextMenuOpening(ContextMenuStrip contextMenuStrip)
        {
            if (PropertiesForm.SelectedGridItem != null && PropertiesForm.SelectedGridItem.Label == "Tags")
            {
                List <Entity> entitiesSelected = EntityWorld.Instance.SelectedEntities;

                var q = entitiesSelected.Select(_entity =>
                {
                    var _tags = _entity.Tags.Select(_tag => new Entity.TagInfo(_tag.Name, _tag.Value));
                    return(new UndoObjectsPropertyChangeAction.Item(_entity, typeof(Entity).GetProperty("Tags"), _tags));
                });

                contextMenuStrip.Items.Add(new ToolStripSeparator());
                //*
                string            textAddTag = ToolsLocalization.Translate("Various", "Add Tag");
                ToolStripMenuItem tsmiAddTag = new ToolStripMenuItem(textAddTag, Properties.Resources.new_16, delegate(object s, EventArgs e2)
                {
                    EntityAddTagDialog entityAddTagDialog = new EntityAddTagDialog();
                    if (entityAddTagDialog.ShowDialog() == DialogResult.OK)
                    {
                        UndoSystem.Instance.CommitAction(new UndoObjectsPropertyChangeAction(q.ToArray()));
                        foreach (Entity current in entitiesSelected)
                        {
                            current.SetTag(entityAddTagDialog.TagName, entityAddTagDialog.TagValue);
                        }

                        PropertiesForm.RefreshProperties();
                        MapWorld.Instance.Modified = true;
                    }
                });
                tsmiAddTag.Enabled = true;
                contextMenuStrip.Items.Add(tsmiAddTag);

                List <string> tagsSet = entitiesSelected.SelectMany(_entity => _entity.Tags.Select(_tag => _tag.Name)).Distinct().ToList();

                string            textRemoveTag = ToolsLocalization.Translate("Various", "Remove Tag");
                ToolStripMenuItem tsmiRemoveTag = new ToolStripMenuItem(textRemoveTag, Properties.Resources.delete_16);
                tsmiRemoveTag.Enabled = (tagsSet.Count != 0);
                contextMenuStrip.Items.Add(tsmiRemoveTag);

                foreach (string tag in tagsSet)
                {
                    ToolStripMenuItem tsmiDeleteTag = new ToolStripMenuItem(tag, Properties.Resources.item_16, delegate(object s, EventArgs e2)
                    {
                        string name = (string)((ToolStripMenuItem)s).Tag;
                        UndoSystem.Instance.CommitAction(new UndoObjectsPropertyChangeAction(q.ToArray()));
                        foreach (Entity current in entitiesSelected)
                        {
                            current.RemoveTag(name);
                        }

                        PropertiesForm.RefreshProperties();
                        MapWorld.Instance.Modified = true;
                    });
                    tsmiDeleteTag.Tag = tag;
                    contextMenuStrip.Items.Add(tsmiRemoveTag);

                    tsmiRemoveTag.DropDownItems.Add(tsmiDeleteTag);
                }
            }
        }
 public override bool OnInit(out string mainMenuItemText, out Image mainMenuItemIcon)
 {
     mainMenuItemText = ToolsLocalization.Translate("Addons", "Exporting To 3D Model");              //(FBX, COLLADA...
     mainMenuItemIcon = Properties.Resources.Addon_16;
     return(true);
 }
예제 #18
0
 private string A(string text)
 {
     return(ToolsLocalization.Translate("EntityTypeResourceType", text));
 }
 string Translate(string text)
 {
     return(ToolsLocalization.Translate("GridBasedNavigationSystemFunctionalityArea", text));
 }
예제 #20
0
 static string Translate(string text)
 {
     return(ToolsLocalization.Translate("MainForm", text));
 }
예제 #21
0
 string Translate(string text)
 {
     return(ToolsLocalization.Translate("RecastNavigationSystemExtendedFunctionalityDescriptor", text));
 }
예제 #22
0
        public override string ToString()
        {
            string str = ToolsLocalization.Translate("Various", this.resourceType.DisplayName);

            return(str + ": " + this.fileName);
        }
예제 #23
0
 private string Translate(string text)
 {
     return(ToolsLocalization.Translate("ChooseResourceForm", text));
 }
예제 #24
0
		string Translate( string text )
		{
			return ToolsLocalization.Translate( "GridBasedNavigationSystemExtendedFunctionalityDescriptor", text );
		}
예제 #25
0
 string Translate(string text)
 {
     return(ToolsLocalization.Translate(GetType().Name, text));
 }
예제 #26
0
        private void UpdateData(string currentPath)
        {
            this.treeView.BeginUpdate();
            this.treeView.Nodes.Clear();
            while (this.imageListTreeView.Images.Count > 2)
            {
                this.imageListTreeView.Images.RemoveAt(2);
            }
            foreach (ResourceType current in ResourceTypeManager.Instance.Types)
            {
                Image icon = current.Icon;
                if (icon != null)
                {
                    int count = this.imageListTreeView.Images.Count;
                    this.imageListTreeView.Images.Add(icon);
                    icon.Tag = count;
                }
            }
            this.rootNode = new TreeNode("Data", 0, 0);
            this.treeView.Nodes.Add(rootNode);
            this.UpdateDataDirectory("", rootNode);
            this.treeView.TreeViewNodeSorter = new NodeComparer();
            this.treeView.Sort();
            this.rootNode.Expand();
            if (this.rootNode.Nodes.Count == 1)
            {
                this.rootNode.Nodes[0].Expand();
            }
            bool flag = false;

            if (!string.IsNullOrEmpty(currentPath))
            {
                TreeNode nodeByPath = this.GetNodeByPath(currentPath);
                if (nodeByPath != null)
                {
                    TreeViewUtil.ExpandTo(nodeByPath);
                    this.treeView.SelectedNode = nodeByPath;
                    flag = true;
                }
            }
            if (!flag && string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(currentHelperDirectoryName))
            {
                TreeNode nodeByPath2 = GetNodeByPath(currentHelperDirectoryName);
                if (nodeByPath2 != null)
                {
                    TreeViewUtil.ExpandTo(nodeByPath2);
                    treeView.SelectedNode = nodeByPath2;
                    flag = true;
                }
            }
            if (this.allowChooseNull)
            {
                this.nullValueNode      = new TreeNode(ToolsLocalization.Translate("ChooseResourceForm", "(Null)"), 1, 1);
                this.nullValueNode.Name = nullValueNode.Text;
                this.treeView.Nodes.Add(nullValueNode);
                if (string.IsNullOrEmpty(currentPath) && !flag)
                {
                    this.treeView.SelectedNode = nullValueNode;
                    flag = true;
                }
            }
            if (!flag && treeView.Nodes.Count != 0)
            {
                this.treeView.SelectedNode = treeView.Nodes[0];
            }
            this.treeView.EndUpdate();
        }