public async System.Threading.Tasks.Task OpenEditor() { var context = new EditorCommon.Resources.ResourceEditorContext("CommonEditor", this); var mtl = EngineNS.CEngine.Instance.PhyContext.LoadMaterial(this.ResourceName); context.PropertyShowValue = mtl; context.SaveAction = () => { mtl.Save2Xnd(this.ResourceName); }; await EditorCommon.Program.OpenEditor(context); }
public async System.Threading.Tasks.Task SetObjectToEdit(EditorCommon.Resources.ResourceEditorContext context) { SetBinding(TitleProperty, new Binding("ResourceName") { Source = context.ResInfo, Converter = new EditorCommon.Converter.RNameConverter_PureName() }); // ResInfo 可能在不同的线程生成的,所以这里强制读取一下文件 CurrentResourceInfo = await EditorCommon.Resources.ResourceInfoManager.Instance.CreateResourceInfoFromFile(context.ResInfo.AbsInfoFileName, context.ResInfo.ParentBrowser) as Macross.ResourceInfos.MacrossResourceInfo; var mclaInfo = CurrentResourceInfo as ResourceInfos.McLogicAnimationResourceInfo; UpdateUndoRedoKey(); var att = EngineNS.Rtti.AttributeHelper.GetCustomAttribute(CurrentResourceInfo.BaseType, typeof(EngineNS.Editor.Editor_MacrossClassAttribute).FullName, false); if (att != null) { var csType = (EngineNS.ECSType)EngineNS.Rtti.AttributeHelper.GetCustomAttributePropertyValue(att, "CSType"); switch (csType) { case EngineNS.ECSType.Common: { ClientVisible = Visibility.Visible; ServerVisible = Visibility.Visible; CCSShowIdx = 0; Macross_Client.CurrentResourceInfo = mclaInfo; Macross_Server.CurrentResourceInfo = mclaInfo; } break; case EngineNS.ECSType.Client: { ClientVisible = Visibility.Visible; ServerVisible = Visibility.Collapsed; CCSShowIdx = 0; Macross_Client.CurrentResourceInfo = mclaInfo; } break; case EngineNS.ECSType.Server: { ClientVisible = Visibility.Collapsed; ServerVisible = Visibility.Visible; CCSShowIdx = 1; Macross_Server.CurrentResourceInfo = mclaInfo; } break; } } await Load(); }
public async System.Threading.Tasks.Task OpenEditor() { var context = new EditorCommon.Resources.ResourceEditorContext(EditorTypeName, this); await EditorCommon.Program.OpenEditor(context); }