private void AddComponentItems <T>() where T : PComponent { this.AddComponentItems( DesignerManager.GetElementTypes() .Where(attr => attr.Attribute.Visible && attr.Element.CanCastingTo <T>())); }
private void UpdateTargetType() { if (TargetType == null) { this.Clear(); } else { PropertyList.Clear(); foreach (var prop in DesignerManager.GetProperties(TargetType)) { var item = new PropertyItem(prop); dictItems[item.Property] = item; PropertyList.Add(item); } if (this.Model.Property != null && dictItems.ContainsKey(this.Model.Property)) { propertyBox.SelectedItem = dictItems[this.Model.Property]; } else { propertyBox.SelectedIndex = 0; } } OnTargetTypeChanged(); }
private void bResetLevel_Click(object sender, EventArgs e) { //StaticData.EngineManager = new EngineManager(StaticData.EngineManager.Game1); StaticData.GameSessionMode = SessionMode.DesignMode; StaticData.ManipulationGameMode = ManipulationGameMode.DragRigidMode; DesignerManager.InitializeEngineForDesignerWithComponents(); }
private void AddEventItems(Type pObjType) { foreach (var ev in DesignerManager.GetEvents(pObjType)) { var item = new ComponentBoxItemView( new ComponentBoxItemModel(ev)); this.AddItem(item); } }
/// <summary> /// 注册代码 /// </summary> void IAutoRegister.AutoRegist() { DesignerManager.Registe <EntityConfig, FieldsViewModel>("字段基本"); DesignerManager.Registe <EntityConfig, CppFieldsViewModel>("字段类型"); DesignerManager.Registe <EntityConfig, RegularViewModel>("数据校验"); DesignerManager.Registe <EntityConfig, ModelViewModel>("实体模型"); DesignerManager.Registe <EntityConfig, AllFieldsViewModel>("所有字段"); CommandIoc.NewEntityCommand = NewEntityCommand; CommandIoc.AddFieldsCommand = AddFieldsCommand; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
/// <summary> /// 注册代码 /// </summary> void IAutoRegister.AutoRegist() { DesignerManager.Registe <EntityConfig, FieldsPanel>("字段基本", "Entity"); DesignerManager.Registe <EntityConfig, RegularPanel>("数据校验", "Entity"); DesignerManager.Registe <EntityConfig, ModelCodePanel>("实体模型", "Entity"); DesignerManager.Registe <EntityConfig, JsonPanel>("序列化设置", "Entity", "Model"); DesignerManager.Registe <EntityConfig, AllFieldsPanel>("所有字段", short.MaxValue + 1); CommandIoc.EditEntityCommand = EditEntityCommand; CommandIoc.AddFieldsCommand = AddFieldsCommand; }
/// <summary> /// 화면을 생성합니다. /// </summary> /// <returns></returns> public ContentControl AddNewScreen() { var metadata = DesignerManager.GetElementType(typeof(PContentPage)); var control = this.GenerateToElement(this, metadata.Element, pushTask: false) as ContentControl; var model = (PContentPage)control.GetRenderer().Model; LayoutExtension.SetPageName( model, $"Screen{Screens?.Count}"); Keyboard.Focus(this); return(control); }
// Use this for initialization void Start() { #if UNITY_STANDALONE_WIN meshRenderer = GetComponent <MeshRenderer>(); #endif designerManager = DesignerManager.GetInstance(); if (designerManager == null) { Debug.Log("CreateMapElementOnIt: designerManager is null!"); } mapElementFactory = MapElementFactory.GetInstance(); if (mapElementFactory == null) { Debug.Log("CreateMapElementOnIt: mapElementFactory is null!"); } }
private void SelectedObjects_Changed(object sender, EventArgs e) { foreach (PropertyGridItemModel item in this) { if (item.Setter is IDisposable disposable) { disposable.Dispose(); } } this.Clear(); if (SelectedObjects?.Length > 0 && !SelectedObjects[0].Equals(presentedObject)) { SetPresentedObject((DependencyObject)SelectedObjects[0]); foreach (var prop in DesignerManager.GetProperties(presentedObject.GetType())) { ISetter setter; if (string.IsNullOrEmpty(prop.Attribute.Key)) { setter = SetterManager.CreateSetter(presentedObject, prop.Element); } else { setter = SetterManager.CreateSetter(presentedObject, prop.Element, prop.Attribute.Key); } if (setter == null) { continue; } this.AddItem( new PropertyGridItemModel(prop, setter)); } } else { SetPresentedObject(null); } }
/// <summary> /// 로직 컴포넌트를 생성합니다. /// </summary> /// <param name="model"></param> /// <param name="position"></param> /// <returns></returns> public FrameworkElement AddNewComponent(ComponentBoxItemModel model, Point position) { Type pType = model.ItemModelType; if (pType == null) { MessageBox.Show("Coming soon! (Logic)"); return(null); } var metadata = DesignerManager.GetElementType(pType); var control = this.GenerateToElement(this, metadata.Element, position) as ComponentElement; // Trigger Setting if (model.ComponentType == ComponentType.Event) { var triggerRenderer = control.GetRenderer() as TriggerRenderer; triggerRenderer.Model.SetRuntimeEvent(model.Data as EventInfo); } // Selector Setting if (model.ComponentType == ComponentType.Instance) { var selectorRenderer = control.GetRenderer() as SelectorRenderer; selectorRenderer.Model.Title = model.Title; selectorRenderer.Model.TargetVisual = model.Data as PVisual; } // Function Setting if (model.ComponentType == ComponentType.Function) { var functionRenderer = control.GetRenderer() as FunctionRenderer; functionRenderer.Model.SetRuntimeFunction(model.Data as MethodInfo); } ZoomFocusTo(control.GetRenderer()); return(control); }
void Start() { meshRenderer = GetComponent <MeshRenderer>(); Material[] mats = meshRenderer.materials; originalColor = new Color[mats.Length]; for (int i = 0; i < mats.Length; i++) { originalColor[i] = mats[i].color; } designerManager = DesignerManager.GetInstance(); if (designerManager == null) { Debug.Log("MapElement: DesignerManager is null!"); } mapElementFactory = MapElementFactory.GetInstance(); if (mapElementFactory == null) { Debug.Log("MapElement: mapElementFactory is null!"); } }
private void InitializeLayouts() { // ToolBox foreach (var element in DesignerManager.GetElementTypes() .OrderBy(data => data.Attribute.Category) .OrderBy(data => data.Element.CanCastingTo <PComponent>() ? 1 : 0)) { if (!element.Attribute.Visible) { continue; } var resource = ResourceManager.GetDesignerResource(element.Element); toolBox.AddItem( new ToolBoxItemView( new ToolBoxItemModel(element, resource))); } foreach (var function in SDKManager.GetFunctions()) { var resource = new DesignerResource() { Content = new Image() { Source = ResourceManager.GetImageSource("Icons/IconFunction.png") } }; toolBox.AddItem( new ToolBoxItemView( new ToolBoxItemFunctionModel( function.Element, new AttributeTuple <Core.DesignElementAttribute, Type>(function.Attribute, typeof(PFunction)), resource))); } }
/// <summary> /// 注册代码 /// </summary> void IAutoRegister.AutoRegist() { DesignerManager.Registe <EntityConfig, TemplatePanel>("LUA模板"); }
/// <summary> /// 注册代码 /// </summary> void IAutoRegister.AutoRegist() { DesignerManager.Registe <EnumConfig, EnumEdit>("编辑枚举"); }
/// <summary> /// 注册代码 /// </summary> void IAutoRegister.AutoRegist() { DesignerManager.Registe <EntityConfig, DataBasePanel>("数据库设计", "DataBase"); DesignerManager.Registe <EntityConfig, RelationPanel>("数据关系", short.MaxValue, "DataBase", "Model"); }
private void InvlidateTargetObject() { this.Clear(); if (TargetObject != null) { // 레이아웃에서 드래그한 경우 if (TargetObject is PObject) { AddEventItems(TargetObject.GetType()); } // 스토리보드 우클릭한 경우 if (TargetObject is Storyboard) { AddComponentItems <PComponent>(); AddFunctionItems(); AddRendererItems(); } // BindThumb에서 드래그한 경우 if (TargetObject is BindRequest) { var request = TargetObject as BindRequest; switch (request.Source.BindOption) { case BindOptions.Output: case BindOptions.Input: AddComponentItems <PComponent>(); AddFunctionItems(); break; case BindOptions.Parameter: AddComponentItems <PComponent>(); AddFunctionItems(); AddRendererItems(); break; case BindOptions.Return: if (request.Source.Binder.Host is PSelector) { AddComponentItems <PTargetable>(); } break; } } } IsEmpty = this.ItemCount == 0; // ** Local Methods (C# 7.0) ** void AddComponentItems <T>() where T : PComponent { this.AddComponentItems( DesignerManager.GetElementTypes() .Where(attr => attr.Attribute.Visible && attr.Element.CanCastingTo <T>())); } void AddRendererItems() { this.AddRendererItems( GlobalModels.Items .Select(obj => obj.GetRenderer()) .Where(r => { if (r == null) { return(false); } // 렌더러가 태스크에 의해 삭제된 상태 (파괴되기전) if (!r.Element.IsVisible) { return(false); } if (r.Model is PVisual == false) { return(false); } return(true); })); } void AddFunctionItems() { this.AddFunctionItems(SDKManager.GetFunctions()); } }
/// <summary> /// 注册代码 /// </summary> void IAutoRegister.AutoRegist() { DesignerManager.Registe <EntityConfig, EasyUiViewModel>("EasyUi界面"); }
/// <summary> /// 注册代码 /// </summary> void IAutoRegister.AutoRegist() { DesignerManager.Registe <EntityConfig, UiPanel>("EasyUi界面", "Model"); }
public void ExecDesigner() { DesignerManager designerManager = new DesignerManager(); designerManager.Run(); }
private IEnumerable <(int HashCode, AttributeTuple <DesignElementAttribute, PropertyInfo> Value)> GetHashedProperties(DependencyObject obj) { return(DesignerManager.GetProperties(obj.GetType()) .Select(p => (CreatePropertyHash(p), p))); }
/// <summary> /// 注册代码 /// </summary> void IAutoRegister.AutoRegist() { DesignerManager.Registe <EntityConfig, DataBaseViewModel>("数据库设计"); DesignerManager.Registe <EntityConfig, DataRelationViewModel>("数据关系"); }