private void tvItems_DoubleClick(object sender, EventArgs e) { if (tvItems.SelectedNode == null) { return; } TreeNode ActiveNode = tvItems.SelectedNode; TreeNode EditorNode = ActiveNode.Parent; if (ActiveNode.Nodes.Count > 0 || EditorNode == null || EditorNode.Tag == null) { return; } EditorInfo Info = (EditorInfo)EditorNode.Tag; try { BaseEditor instance = Activator.CreateInstance(Info.EditorType, GetFilePathForItemNode(ActiveNode), Info.InitParams) as BaseEditor; instance.Show(); } catch (Exception E) { MessageBox.Show(E.Message); } if (EditorNode == null) { MessageBox.Show("Unable to find a corresponding editor to open."); } }
private void treeControl_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { TreeViewItem treeItem = e.NewValue as TreeViewItem; if (treeItem == null) { return; } IconTextItem item = treeItem.Header as IconTextItem; if (item == null) { return; } string name = item.Name; MogitorsRoot mogRoot = MogitorsRoot.Instance; BaseEditor curEdit = mogRoot.FindObject(name, 0); if (curEdit != mogRoot.Selected) { if (mogRoot.Selected != null) { mogRoot.Selected.IsSelected = false; } if (curEdit != null) { curEdit.IsSelected = true; } } }
public override void gGrid1_DoubleClick(object sender, EventArgs e) { try { if (this.EditorT != null) { DateTime time1 = DateTime.Now; BaseEditor editor = System.Activator.CreateInstance(this.EditorT) as BaseEditor; editor.ShowInTaskbar = false; editor.StartPosition = FormStartPosition.CenterScreen; IDbObject obj = gGrid1.GetCurSelect <IDbObject>(); editor.SetData(obj); var audit = G.Core.ClassHelper.GetFieldValue(obj, AuditField) != null?G.Core.ClassHelper.GetFieldValue(obj, AuditField).ToString() : ""; editor.CurEditStatus = EditorStatus.Audit; editor.listTool = new List <string>() { "预览", "打印", "|", "审核", "反审", "|", "供应商", "|", "结清", "反结清", "|", "退出" }; DateTime time2 = DateTime.Now; G.AppInfo.GGlobal.SetInfo((time2 - time1).TotalSeconds.ToString()); editor.ShowDialog(); RefreshData(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void TestGUIRenameFromFolder() { TreeNode UnitsNode = TestGui.tvItems.Nodes.Find("Units", false)[0]; TreeNode NormalNode = UnitsNode.Nodes.Find("Normal", false)[0]; TreeNode NewFolderNode = TestGui.CreateNewFolder(NormalNode); // Create New Folder TreeNode NewNode = TestGui.CreateNewItem(NewFolderNode); // Create New Item TreeNode NewItemNode = NewFolderNode.Nodes.Find(NewItemName, false)[0]; List <ItemContainer> ListContainerUnits = BaseEditor.GetItemsByRoot(BaseEditor.GUIRootPathUnits).ToList(); List <ItemContainer> ListContainerUnitsNormal = BaseEditor.GetItemsByRoot(BaseEditor.GUIRootPathUnitsNormal).ToList(); ItemContainer ContainerUnits = ListContainerUnits[0]; ItemContainer ContainerUnitsNormal = ListContainerUnitsNormal[0]; TestGui.RenameNode(NewItemNode, RenamedItemName); Assert.IsTrue(File.Exists(RenamedItemInFolderFilePath)); Assert.IsTrue(ContainerUnits.ListItem.ContainsKey(RenamedItemInFolderLogicName)); Assert.IsTrue(ContainerUnitsNormal.ListItem.ContainsKey(RenamedItemInFolderLogicName)); Assert.AreEqual(RenamedItemInFolderFilePath, ContainerUnits.ListItem[RenamedItemInFolderLogicName]); Assert.AreEqual(RenamedItemInFolderFilePath, ContainerUnitsNormal.ListItem[RenamedItemInFolderLogicName]); }
private void treeControl_ContextMenuOpening(object sender, ContextMenuEventArgs e) { TreeViewItem treeItem = e.Source as TreeViewItem; if (treeItem == null) { e.Handled = true; return; } treeItem.Focus(); IconTextItem item = treeItem.Header as IconTextItem; if (item == null) { e.Handled = true; return; } BaseEditor editor = MogitorsRoot.Instance.FindObject(item.Name, 0); if (editor == null) { e.Handled = true; return; } }
/// <summary> /// 切换到下一页(正常顺序) /// </summary> /// <param name="current"></param> public void SwitchToNextPage(BaseEditor current) { //保存当前页 SaveEditor(current); //下一步 int currentIndex = EditorIndexLists.IndexOf(current); if (currentIndex + 1 >= EditorIndexLists.Count) { return; } else { BaseEditor next = EditorIndexLists[currentIndex + 1]; if (next.Parent is KryptonPage) { //上一个页签归0 KryptonNavigator subTab = GetTabControl(current); subTab.SelectedIndex = 0; //目标子Tab切换 subTab = GetTabControl(next); subTab.SelectedPage = GetPageControl(next); //主Tab切换 edithost2.SelectedPage = ((KryptonPage)subTab.Parent); } //刷新视图 next.RefreshView(); } }
public override void Modify() { try { if (this.EditorT != null) { DateTime time1 = DateTime.Now; BaseEditor editor = System.Activator.CreateInstance(this.EditorT) as BaseEditor; editor.ShowInTaskbar = false; editor.StartPosition = FormStartPosition.CenterScreen; SM_POCKET obj = gGrid1.GetCurSelect <SM_POCKET>(); editor.SetData(obj); var audit = G.Core.ClassHelper.GetFieldValue(obj, AuditField) != null?G.Core.ClassHelper.GetFieldValue(obj, AuditField).ToString() : ""; if (audit != "N") { editor.CurEditStatus = EditorStatus.Look; } else { editor.CurEditStatus = EditorStatus.Modify; } DateTime time2 = DateTime.Now; G.AppInfo.GGlobal.SetInfo((time2 - time1).TotalSeconds.ToString()); editor.ShowDialog(); RefreshData(); } } catch (Exception e) { MessageBox.Show(e.Message); } }
public void TestGUICreateItemFromRoot() { TreeNode UnitsNode = TestGui.tvItems.Nodes.Find("Units", false)[0]; TreeNode NormalNode = UnitsNode.Nodes.Find("Normal", false)[0]; TreeNode NewNode = TestGui.CreateNewItem(NormalNode); // Create New Item Assert.IsTrue(File.Exists(NewItemFilePath)); TreeNode NewItemNode = NormalNode.Nodes.Find(NewItemName, false)[0]; Assert.AreEqual(NewNode, NewItemNode); Assert.AreEqual(NewItemName, NewItemNode.Text); List <ItemContainer> ListContainerUnits = BaseEditor.GetItemsByRoot(BaseEditor.GUIRootPathUnits).ToList(); List <ItemContainer> ListContainerUnitsNormal = BaseEditor.GetItemsByRoot(BaseEditor.GUIRootPathUnitsNormal).ToList(); Assert.AreEqual(1, ListContainerUnits.Count); Assert.AreEqual(1, ListContainerUnitsNormal.Count); ItemContainer ContainerUnits = ListContainerUnits[0]; ItemContainer ContainerUnitsNormal = ListContainerUnitsNormal[0]; Assert.IsTrue(ContainerUnits.ListItem.ContainsKey(NewItemName)); Assert.IsTrue(ContainerUnitsNormal.ListItem.ContainsKey(NewItemName)); Assert.AreEqual(NewItemFilePath, ContainerUnits.ListItem[NewItemName]); Assert.AreEqual(NewItemFilePath, ContainerUnitsNormal.ListItem[NewItemName]); }
private void AnimatedBitmapSpawnerHelper_Shown(object sender, EventArgs e) { //Show the user a list of sprite to pick. if (MarkerViewer.ActiveMarker == null) { ListMenuItemsSelected(BaseEditor.ShowContextMenuWithItem("Animations/Sprites", "Select a Sprite to use", false)); } }
private void btnAddNewTileSetAsBackground_Click(object sender, EventArgs e) {//If there is a map loaded(and so ActiveMap.TileSize.X is not 0). if (BattleMapViewer.ActiveMap.TileSize.X != 0) { ItemSelectionChoice = ItemSelectionChoices.TileAsBackground; ListMenuItemsSelected(BaseEditor.ShowContextMenuWithItem(BaseEditor.GUIRootPathMapTilesetImages)); } }
private void btnSelectAnimation_Click(object sender, EventArgs e) { if (lstAttack.SelectedIndex >= 0 && lstAttackAnimations.SelectedIndex >= 0) { ItemSelectionChoice = ItemSelectionChoices.Animation; ListMenuItemsSelected(BaseEditor.ShowContextMenuWithItem(BaseEditor.GUIRootPathAnimations)); } }
public bool SetProperty(object caller) { BaseEditor selected = MogitorsRoot.Instance.Selected; //if (selected != null && selected != caller && selected.Parent != caller) // return false; this.propsControl.Selected = caller; return(true); }
public override void DrawUpdate(BaseEditor editor) { base.DrawUpdate(editor); AddAction(new Rect(110f, 22f, 13f, 13f), "folder.png", () => { GUI.FocusControl(null); //string currentDir = Path.GetDirectoryName(Environment.CurrentDirectory).Replace("\\", "/"); string path = EditorUtility.OpenFolderPanel("", "Assets", "").Replace("\\", "/"); if (path == "" || path == null) { return; } string assetPath = Application.dataPath.Replace("\\", ""); if (!path.Contains(assetPath)) { EditorUtility.DisplayDialog("", "Selected path must be under /Assets folder", "Ok"); return; } path = path.Replace(assetPath, "").TrimStart('/'); entity.dialogues_path = path; editor.SavePreferences(); }); EditorGUILayout.LabelField(new GUIContent("Dialogues Path", "The path to where the dialogues will be saved. The dialogue path will correspond the to name of the dialogue." + "\n\n" + "This path is relative to the project's /Assets folder."), EditorStyles.boldLabel); GUILayout.Label(String.IsNullOrEmpty(entity.dialogues_path) ? "-" : entity.dialogues_path); //entity.dialogues_path = TextInput("Dialogues path", entity.dialogues_path, "The path to where the dialogues will be saved. The dialogue path will correspond the to name of the dialogue." + // "\n\n" + // "This path is relative to the project's /Assets folder."); //if (GUILayout.Button("Save")) { // var contents = JsonUtility.ToJson(entity); // string path = Application.dataPath + "/dialoguesmith-prefs.json"; // File.WriteAllText(path, contents); // Debug.Log("Preferences saved.."); //} if (!String.IsNullOrEmpty(entity.dialogues_path)) { if (GUILayout.Button(new GUIContent("Sync Tree Names", "When there's a manual changes to file name / location inside the path, you can use this to synchronize the tree names accordingly."))) { editor.SyncNaming(); } } }
void be_SaveEvent(object sender, EventArgs args) { BaseEditor current = (BaseEditor)sender; //保存RTF //if (current is RTFTextEditor) //{ // ((RTFTextEditor)current).RichTextBoxControl.SaveFile(Path.Combine(ProjectFilesDir, current.Name + ".rtf")); //} }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService svc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { List <string> Items = BaseEditor.ShowContextMenuWithItem(BaseEditor.GUIRootPathAttacks); if (Items != null) { value = Path.GetFileNameWithoutExtension(Items[0]); } } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService svc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { List <string> Items = BaseEditor.ShowContextMenuWithItem(BaseEditor.GUIRootPathUnitsVehicleTripleThunder, "Select Vehicle", false); if (Items != null) { value = Items[0].Substring(0, Items[0].Length - 5).Substring(38); } } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService svc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { List <string> Items = BaseEditor.ShowContextMenuWithItem(BaseEditor.GUIRootPathUnitsConquest); if (Items != null) { value = Items[0].Substring(0, Items[0].Length - 4).Substring(Items[0].LastIndexOf("Units") + 6); } } return(value); }
void be_NextEvent(object sender, EventArgs args) { BaseEditor current = (BaseEditor)sender; if (current.EnabledAutoNextPage) { //切换到下一页(正常顺序) SwitchToNextPage(current); } else { //使用自定义切换 current.NextPage(); } }
private void OnShapeListGUI(GUISkin skin) { if (!GUI.Foldout(EditorData.Instance.GetData(RigidBody, "Shapes"), GUI.MakeLabel("Shapes", true), skin)) { return; } Shape[] shapes = RigidBody.GetComponentsInChildren <Shape>(); if (shapes.Length == 0) { using (new GUI.Indent(12)) GUILayout.Label(GUI.MakeLabel("Empty", true), skin.label); return; } using (new GUI.Indent(12)) { foreach (var shape in shapes) { GUI.Separator(); if (!GUI.Foldout(EditorData.Instance.GetData(RigidBody, shape.GetInstanceID().ToString()), GUI.MakeLabel("[" + GUI.AddColorTag(shape.GetType().Name, Color.Lerp(Color.green, Color.black, 0.4f)) + "] " + shape.name), skin)) { continue; } GUI.Separator(); using (new GUI.Indent(12)) { Undo.RecordObjects(shape.GetUndoCollection(), "Shape"); shape.enabled = GUI.Toggle(GUI.MakeLabel("Enable"), shape.enabled, skin.button, skin.label); if (shape is AGXUnity.Collide.Mesh) { GUI.Separator(); var newMeshSource = GUI.ShapeMeshSourceGUI((shape as AGXUnity.Collide.Mesh).SourceObjects.FirstOrDefault(), skin); if (newMeshSource != null) { (shape as AGXUnity.Collide.Mesh).SetSourceObject(newMeshSource); } } GUI.Separator(); BaseEditor <Shape> .Update(shape, shape, skin); } } } }
private void btnAddNewCharacter_Click(object sender, EventArgs e) { List <string> Items = BaseEditor.ShowContextMenuWithItem(BaseEditor.GUIRootPathCharacters, "Chose a new character."); if (Items == null || Items.Count == 0) { return; } string FullName = Items[0].Substring(0, Items[0].Length - 4).Substring(19); SpeakerPriority NewSpeakerPriority = new SpeakerPriority(SpeakerPriority.PriorityTypes.Character, FullName); lstSpeakerPriority.Items.Add(NewSpeakerPriority); ListSpeakerPriority.Add(NewSpeakerPriority); }
/// <summary> /// Provides the editor for this node, and link the editor with the edited model element /// </summary> /// <returns></returns> public override BaseEditor GetEditor() { BaseEditor retVal = NodeEditor; if (retVal == null) { Editor editor = CreateEditor(); editor.Item = Item; editor.Node = this; retVal = editor; } return(retVal); }
public override BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { CameraEditor obj = new CameraEditor(); Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("Init")) != parameters.End()) { parameters["Name"] = "Camera" + MogitorsRoot.Instance.CreateUniqueID("Camera", "", -1); } obj.ProcessParameters(parameters); obj.Parent = parent; InstanceCount++; return(obj); }
bool MogitorsRoot.IDragDropHandler.OnDrageEnter(DragData dragData) { IconTextItem item = dragData.SourceObject as IconTextItem; if (item == null) { return(false); } BaseEditorFactory factory = MogitorsRoot.Instance.GetEditorObjectFactory(item.Name + " Object"); if (factory == null) { return(false); } dragData.ObjectType = factory.TypeName; string placeHolder = ""; if (factory.RequirePlacement) { placeHolder = factory.PlaceHolderName; } if (placeHolder == "") { return(true); } dragData.Parameters["Init"] = "true"; dragData.Parameters["MeshFile"] = placeHolder; dragData.Parameters["Position"] = "999999 999999 999999"; BaseEditor parent = MogitorsRoot.Instance.SceneManagerEditor; dragData.Object = EntityEditor.Factory.CreateObject(ref parent, dragData.Parameters); dragData.Object.Load(); (dragData.Object.Handle as Mogre.Entity).SetMaterialName("scbMATWIREFRAME"); (dragData.Object.Handle as Mogre.Entity).QueryFlags = 0; return(true); }
public void TestGUIRenameFromRoot() { TreeNode UnitsNode = TestGui.tvItems.Nodes.Find("Units", false)[0]; TreeNode NormalNode = UnitsNode.Nodes.Find("Normal", false)[0]; TreeNode NewItemNode = TestGui.CreateNewItem(NormalNode); // Create New Item ItemContainer ContainerUnits = BaseEditor.GetItemsByRoot(BaseEditor.GUIRootPathUnits).First(); ItemContainer ContainerUnitsNormal = BaseEditor.GetItemsByRoot(BaseEditor.GUIRootPathUnitsNormal).First(); TestGui.RenameNode(NewItemNode, RenamedItemName); Assert.IsTrue(File.Exists(RenamedItemPath)); Assert.IsTrue(ContainerUnits.ListItem.ContainsKey(RenamedItemName)); Assert.IsTrue(ContainerUnitsNormal.ListItem.ContainsKey(RenamedItemName)); Assert.AreEqual(RenamedItemPath, ContainerUnits.ListItem[RenamedItemName]); Assert.AreEqual(RenamedItemPath, ContainerUnitsNormal.ListItem[RenamedItemName]); }
public void CommandBinding_EditRenameCmdExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { BaseEditor obj = MogitorsRoot.Instance.Selected; if (obj == null) { return; } InputDialog dlg = new InputDialog("Enter a new name", "Name : ", obj.Name); if (dlg.ShowDialog() == true) { string text = dlg.InputText.Trim(); if (text != obj.Name) { obj.Name = text; } } }
private void HandleConstraintControllerGUI(ElementaryConstraintController controller, GUISkin skin) { var controllerType = controller.GetControllerType(); var controllerTypeTag = controllerType.ToString().Substring(0, 1); string dimString = "[" + GUI.AddColorTag(controllerTypeTag, controllerType == Constraint.ControllerType.Rotational ? Color.Lerp(UnityEngine.GUI.color, Color.red, 0.75f) : Color.Lerp(UnityEngine.GUI.color, Color.green, 0.75f)) + "] "; if (GUI.Foldout(Selected(SelectedFoldout.Controller, controllerTypeTag + ConstraintUtils.FindName(controller)), GUI.MakeLabel(dimString + ConstraintUtils.FindName(controller), true), skin, OnFoldoutStateChange)) { using (new GUI.Indent(12)) { controller.Enable = GUI.Toggle(GUI.MakeLabel("Enable", controller.Enable), controller.Enable, skin.button, skin.label); BaseEditor <ElementaryConstraint> .Update(controller, controller, skin); } } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService svc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { List <string> Items = BaseEditor.ShowContextMenuWithItem(BaseEditor.GUIRootPathTripleThunderWeapons, "Select every Weapons to use", true); if (Items != null) { for (int W = Items.Count - 1; W >= 0; --W) { Items[W] = Items[W].Substring(0, Items[W].Length - 4).Substring(31); } value = Items; } } return(value); }
public void SaveEditor(BaseEditor current) { ProjectReporter.Forms.UIDoWorkProcessForm upf = new Forms.UIDoWorkProcessForm(); upf.EnabledDisplayProgress = false; upf.LabalText = "正在保存,请等待..."; upf.ShowProgress(); try { //保存 current.OnSaveEvent(); } catch (Exception ex) { MessageBox.Show("保存失败!Ex:" + ex.ToString()); } finally { upf.Close(); } }
public TreeNode CreateNewItem(TreeNode EditorNode) { if (EditorNode.Tag == null) { EditorNode = EditorNode.Parent; } EditorInfo Editor = (EditorInfo)EditorNode.Tag; string NewItemName = "New Item"; if (EditorNode.Nodes.ContainsKey(NewItemName)) { int SameItemCount = 2; while (EditorNode.Nodes.ContainsKey(NewItemName + " (" + SameItemCount + ")")) { SameItemCount++; } NewItemName += " (" + SameItemCount + ")"; } string NewItemPath = GetFilePathForItem(Editor, NewItemName); TreeNode NewItem = new TreeNode(NewItemName); NewItem.Name = NewItem.Text; EditorNode.Nodes.Add(NewItem); foreach (string GUIPath in Editor.ArrayLogicPath) { ItemContainer Container = GetItemContainerByPath(GUIPath, Editor.ItemContainer.ContainerGUIPath); Container.ListItem.Add(Editor.FolderPath + NewItemName, NewItemPath); } //Force the editor to access the item and create the file. BaseEditor instance = Activator.CreateInstance(Editor.EditorType, NewItemPath, Editor.InitParams) as BaseEditor; return(NewItem); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService svc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { List <string> Items = BaseEditor.ShowContextMenuWithItem(BaseEditor.GUIRootPathCharacters); if (Items != null) { string[] ArraySelectedCharacter = new string[Items.Count]; for (int C = 0; C < Items.Count; C++) { ArraySelectedCharacter[C] = Items[C].Substring(0, Items[C].Length - 4).Substring(Items[C].LastIndexOf("Characters") + 11); } value = ArraySelectedCharacter; } } return(value); }
public override BaseEditor CreateObject(ref BaseEditor parent, Mogre.NameValuePairList parameters) { CameraEditor obj = new CameraEditor(); Mogre.NameValuePairList.Iterator ni; if ((ni = parameters.Find("Init")) != parameters.End()) { parameters["Name"] = "Camera" + MogitorsRoot.Instance.CreateUniqueID("Camera", "", -1); } obj.ProcessParameters(parameters); obj.Parent = parent; InstanceCount++; return obj; }