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; } }
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); }
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); }
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); }
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); } }
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; * //*/ }
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); }
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(); }
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); }
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); }
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); } }
protected override void OnFormClosing(FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { if (!SaveEngineConfig()) { e.Cancel = true; return; } } //update tools localization file if (ToolsLocalization.IsInitialized && ToolsLocalization.NewKeysWasAdded) { ToolsLocalization.Save(); } base.OnFormClosing(e); }
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();"); }
/// <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)); }
private string A(string text) { return(ToolsLocalization.Translate("EntityTypeResourceType", text)); }
private void MainForm_Load(object sender, EventArgs e) { //Engine.config parameters string renderingSystemComponentName = ""; bool allowShaders = true; bool depthBufferAccess = true; string fullSceneAntialiasing = ""; RendererWorld.FilteringModes filtering = RendererWorld.FilteringModes.RecommendedSetting; string renderTechnique = ""; bool fullScreen = true; string videoMode = ""; bool multiMonitorMode = false; bool verticalSync = true; bool allowChangeDisplayFrequency = true; string physicsSystemComponentName = ""; //bool physicsAllowHardwareAcceleration = false; string soundSystemComponentName = ""; string language = "Autodetect"; bool localizeEngine = true; bool localizeToolset = true; string renderingDeviceName = ""; int renderingDeviceIndex = 0; //load from Deployment.config if (VirtualFileSystem.Deployed) { if (!string.IsNullOrEmpty(VirtualFileSystem.DeploymentParameters.DefaultLanguage)) { language = VirtualFileSystem.DeploymentParameters.DefaultLanguage; } } //load from Engine.config { string error; TextBlock block = TextBlockUtils.LoadFromRealFile( VirtualFileSystem.GetRealPathByVirtual("user:Configs/Engine.config"), out error); if (block != null) { //Renderer TextBlock rendererBlock = block.FindChild("Renderer"); if (rendererBlock != null) { renderingSystemComponentName = rendererBlock.GetAttribute("implementationComponent"); if (rendererBlock.IsAttributeExist("renderingDeviceName")) { renderingDeviceName = rendererBlock.GetAttribute("renderingDeviceName"); } if (rendererBlock.IsAttributeExist("renderingDeviceIndex")) { renderingDeviceIndex = int.Parse(rendererBlock.GetAttribute("renderingDeviceIndex")); } if (rendererBlock.IsAttributeExist("allowShaders")) { allowShaders = bool.Parse(rendererBlock.GetAttribute("allowShaders")); } if (rendererBlock.IsAttributeExist("depthBufferAccess")) { depthBufferAccess = bool.Parse(rendererBlock.GetAttribute("depthBufferAccess")); } if (rendererBlock.IsAttributeExist("fullSceneAntialiasing")) { fullSceneAntialiasing = rendererBlock.GetAttribute("fullSceneAntialiasing"); } if (rendererBlock.IsAttributeExist("filtering")) { try { filtering = (RendererWorld.FilteringModes) Enum.Parse(typeof(RendererWorld.FilteringModes), rendererBlock.GetAttribute("filtering")); } catch { } } if (rendererBlock.IsAttributeExist("renderTechnique")) { renderTechnique = rendererBlock.GetAttribute("renderTechnique"); } if (rendererBlock.IsAttributeExist("fullScreen")) { fullScreen = bool.Parse(rendererBlock.GetAttribute("fullScreen")); } if (rendererBlock.IsAttributeExist("videoMode")) { videoMode = rendererBlock.GetAttribute("videoMode"); } if (rendererBlock.IsAttributeExist("multiMonitorMode")) { multiMonitorMode = bool.Parse(rendererBlock.GetAttribute("multiMonitorMode")); } if (rendererBlock.IsAttributeExist("verticalSync")) { verticalSync = bool.Parse(rendererBlock.GetAttribute("verticalSync")); } if (rendererBlock.IsAttributeExist("allowChangeDisplayFrequency")) { allowChangeDisplayFrequency = bool.Parse( rendererBlock.GetAttribute("allowChangeDisplayFrequency")); } } //Physics system TextBlock physicsSystemBlock = block.FindChild("PhysicsSystem"); if (physicsSystemBlock != null) { physicsSystemComponentName = physicsSystemBlock.GetAttribute("implementationComponent"); //if( physicsSystemBlock.IsAttributeExist( "allowHardwareAcceleration" ) ) //{ // physicsAllowHardwareAcceleration = // bool.Parse( physicsSystemBlock.GetAttribute( "allowHardwareAcceleration" ) ); //} } //Sound system TextBlock soundSystemBlock = block.FindChild("SoundSystem"); if (soundSystemBlock != null) { soundSystemComponentName = soundSystemBlock.GetAttribute("implementationComponent"); } //Localization TextBlock localizationBlock = block.FindChild("Localization"); if (localizationBlock != null) { if (localizationBlock.IsAttributeExist("language")) { language = localizationBlock.GetAttribute("language"); } if (localizationBlock.IsAttributeExist("localizeEngine")) { localizeEngine = bool.Parse(localizationBlock.GetAttribute("localizeEngine")); } if (localizationBlock.IsAttributeExist("localizeToolset")) { localizeToolset = bool.Parse(localizationBlock.GetAttribute("localizeToolset")); } } } } //init toolset language if (localizeToolset) { if (!string.IsNullOrEmpty(language)) { string language2 = language; if (string.Compare(language2, "autodetect", true) == 0) { language2 = DetectLanguage(); } string languageDirectory = Path.Combine(LanguageManager.LanguagesDirectory, language2); string fileName = Path.Combine(languageDirectory, "Configurator.language"); ToolsLocalization.Init(fileName); } } //fill render system { EngineComponentManager.ComponentInfo[] components = GetSortedComponentsByType( EngineComponentManager.ComponentTypeFlags.RenderingSystem); if (string.IsNullOrEmpty(renderingSystemComponentName)) { //find component by default foreach (EngineComponentManager.ComponentInfo component2 in components) { if (component2.IsEnabledByDefaultForThisPlatform()) { renderingSystemComponentName = component2.Name; break; } } } //rendering systems combo box foreach (EngineComponentManager.ComponentInfo component in components) { string text = component.FullName; if (component.IsEnabledByDefaultForThisPlatform()) { text = string.Format(Translate("{0} (default)"), text); } int itemId = comboBoxRenderSystems.Items.Add(text); if (renderingSystemComponentName == component.Name) { comboBoxRenderSystems.SelectedIndex = itemId; } } if (comboBoxRenderSystems.Items.Count != 0 && comboBoxRenderSystems.SelectedIndex == -1) { comboBoxRenderSystems.SelectedIndex = 0; } //rendering device { if (comboBoxRenderingDevices.Items.Count > 1 && !string.IsNullOrEmpty(renderingDeviceName)) { int deviceCountWithSelectedName = 0; for (int n = 1; n < comboBoxRenderingDevices.Items.Count; n++) { string name = (string)comboBoxRenderingDevices.Items[n]; if (name == renderingDeviceName) { comboBoxRenderingDevices.SelectedIndex = n; deviceCountWithSelectedName++; } } if (deviceCountWithSelectedName > 1) { int comboBoxIndex = renderingDeviceIndex + 1; if (comboBoxIndex < comboBoxRenderingDevices.Items.Count) { string name = (string)comboBoxRenderingDevices.Items[comboBoxIndex]; if (name == renderingDeviceName) { comboBoxRenderingDevices.SelectedIndex = comboBoxIndex; } } } } if (comboBoxRenderingDevices.SelectedIndex == -1 && comboBoxRenderingDevices.Items.Count != 0) { comboBoxRenderingDevices.SelectedIndex = 0; } } //allowShaders checkBoxAllowShaders.Checked = allowShaders; //depthBufferAccess comboBoxDepthBufferAccess.Items.Add(Translate("No")); comboBoxDepthBufferAccess.Items.Add(Translate("Yes")); comboBoxDepthBufferAccess.SelectedIndex = depthBufferAccess ? 1 : 0; //fullSceneAntialiasing for (int n = 0; n < comboBoxAntialiasing.Items.Count; n++) { ComboBoxItem item = (ComboBoxItem)comboBoxAntialiasing.Items[n]; if (item.Identifier == fullSceneAntialiasing) { comboBoxAntialiasing.SelectedIndex = n; } } if (comboBoxAntialiasing.SelectedIndex == -1) { comboBoxAntialiasing.SelectedIndex = 0; } //filtering { Type enumType = typeof(RendererWorld.FilteringModes); LocalizedEnumConverter enumConverter = new LocalizedEnumConverter(enumType); RendererWorld.FilteringModes[] values = (RendererWorld.FilteringModes[])Enum.GetValues(enumType); for (int n = 0; n < values.Length; n++) { RendererWorld.FilteringModes value = values[n]; int index = comboBoxFiltering.Items.Add(enumConverter.ConvertToString(value)); if (filtering == value) { comboBoxFiltering.SelectedIndex = index; } } } //renderTechnique { comboBoxRenderTechnique.Items.Add(new ComboBoxItem("RecommendedSetting", "Recommended setting")); comboBoxRenderTechnique.Items.Add(new ComboBoxItem("Standard", "Low Dynamic Range (Standard)")); comboBoxRenderTechnique.Items.Add(new ComboBoxItem("HDR", "64-bit High Dynamic Range (HDR)")); for (int n = 0; n < comboBoxRenderTechnique.Items.Count; n++) { ComboBoxItem item = (ComboBoxItem)comboBoxRenderTechnique.Items[n]; if (item.Identifier == renderTechnique) { comboBoxRenderTechnique.SelectedIndex = n; } } if (comboBoxRenderTechnique.SelectedIndex == -1) { comboBoxRenderTechnique.SelectedIndex = 0; } } //video mode { comboBoxVideoMode.Items.Add(Translate("Current screen resolution")); comboBoxVideoMode.SelectedIndex = 0; comboBoxVideoMode.Items.Add(Translate("Use all displays (multi-monitor mode)")); if (multiMonitorMode) { comboBoxVideoMode.SelectedIndex = 1; } foreach (Vec2I mode in DisplaySettings.VideoModes) { if (mode.X < 640) { continue; } comboBoxVideoMode.Items.Add(string.Format("{0}x{1}", mode.X, mode.Y)); if (mode.ToString() == videoMode) { comboBoxVideoMode.SelectedIndex = comboBoxVideoMode.Items.Count - 1; } } if (!string.IsNullOrEmpty(videoMode) && comboBoxVideoMode.SelectedIndex == 0) { try { Vec2I mode = Vec2I.Parse(videoMode); comboBoxVideoMode.Items.Add(string.Format("{0}x{1}", mode.X, mode.Y)); comboBoxVideoMode.SelectedIndex = comboBoxVideoMode.Items.Count - 1; } catch { } } } //full screen checkBoxFullScreen.Checked = fullScreen; //vertical sync checkBoxVerticalSync.Checked = verticalSync; } //fill physics system page { EngineComponentManager.ComponentInfo[] components = GetSortedComponentsByType( EngineComponentManager.ComponentTypeFlags.PhysicsSystem); if (string.IsNullOrEmpty(physicsSystemComponentName)) { //find component by default foreach (EngineComponentManager.ComponentInfo component2 in components) { if (component2.IsEnabledByDefaultForThisPlatform()) { physicsSystemComponentName = component2.Name; break; } } } //update combo box foreach (EngineComponentManager.ComponentInfo component in components) { string text = component.FullName; if (component.IsEnabledByDefaultForThisPlatform()) { text = string.Format(Translate("{0} (default)"), text); } int itemId = comboBoxPhysicsSystems.Items.Add(text); if (physicsSystemComponentName == component.Name) { comboBoxPhysicsSystems.SelectedIndex = itemId; } } if (comboBoxPhysicsSystems.SelectedIndex == -1) { comboBoxPhysicsSystems.SelectedIndex = 0; } //if( checkBoxPhysicsAllowHardwareAcceleration.Enabled ) // checkBoxPhysicsAllowHardwareAcceleration.Checked = physicsAllowHardwareAcceleration; } //fill sound system page { EngineComponentManager.ComponentInfo[] components = GetSortedComponentsByType( EngineComponentManager.ComponentTypeFlags.SoundSystem); if (string.IsNullOrEmpty(soundSystemComponentName)) { //find component by default foreach (EngineComponentManager.ComponentInfo component2 in components) { if (component2.IsEnabledByDefaultForThisPlatform()) { soundSystemComponentName = component2.Name; break; } } } //update combo box foreach (EngineComponentManager.ComponentInfo component in components) { string text = component.FullName; if (component.IsEnabledByDefaultForThisPlatform()) { text = string.Format(Translate("{0} (default)"), text); } int itemId = comboBoxSoundSystems.Items.Add(text); if (soundSystemComponentName == component.Name) { comboBoxSoundSystems.SelectedIndex = itemId; } } if (comboBoxSoundSystems.SelectedIndex == -1) { comboBoxSoundSystems.SelectedIndex = 0; } } //fill localization page { List <string> languages = new List <string>(); { languages.Add(Translate("Autodetect")); string[] directories = VirtualDirectory.GetDirectories(LanguageManager.LanguagesDirectory, "*.*", SearchOption.TopDirectoryOnly); foreach (string directory in directories) { languages.Add(Path.GetFileNameWithoutExtension(directory)); } } foreach (string lang in languages) { int itemId = comboBoxLanguages.Items.Add(lang); if (string.Compare(language, lang, true) == 0) { comboBoxLanguages.SelectedIndex = itemId; } } if (comboBoxLanguages.SelectedIndex == -1) { comboBoxLanguages.SelectedIndex = 0; } checkBoxLocalizeEngine.Checked = localizeEngine; checkBoxLocalizeToolset.Checked = localizeToolset; } Translate(); formLoaded = true; }
string Translate(string text) { return(ToolsLocalization.Translate("GridBasedNavigationSystemFunctionalityArea", text)); }
public override bool IsAllowToChangeScale(out string reason) { reason = ToolsLocalization.Translate("Various", "Characters do not support scaling."); return(false); }
string Translate(string text) { return(ToolsLocalization.Translate("ExportTo3DModelMEAddonForm", text)); }
public override string ToString() { string str = ToolsLocalization.Translate("Various", this.resourceType.DisplayName); return(str + ": " + this.fileName); }
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); } } }
string Translate( string text ) { return ToolsLocalization.Translate( "GridBasedNavigationSystemExtendedFunctionalityDescriptor", text ); }
static string Translate(string text) { return(ToolsLocalization.Translate("MainForm", text)); }
string Translate(string text) { return(ToolsLocalization.Translate(GetType().Name, text)); }
private string Translate(string text) { return(ToolsLocalization.Translate("ChooseResourceForm", text)); }
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(); }
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); }
string Translate(string text) { return(ToolsLocalization.Translate("RecastNavigationSystemExtendedFunctionalityDescriptor", text)); }