public UIShapeBase GetUIShape(int x, int y, bool includeDialog) { float fX = 1.0f / UIEditorMessageService.GetInstance().GetResolutionScaleX() * (float)x; float fY = 1.0f / UIEditorMessageService.GetInstance().GetResolutionScaleY() * (float)y; UIShapeBase findShape = null; foreach (UIShapeBase shape in m_UIShapeList) { // if (includeDialog == false && shape is UIShapeDialog) // continue; bool bResult = shape.Bound.IsInside(fX, fY); if (bResult == true) { if (findShape == null) { findShape = shape; } else if (shape.ChildIndex > findShape.ChildIndex) { findShape = shape; } else if (shape.ChildIndex == findShape.ChildIndex && findShape is UIShapeDialog) { findShape = shape; } } } return(findShape); }
public void MoveUIShapeDelta(UIShapeBase shape, float x, int y) { float fScaleX = 1.0f / UIEditorMessageService.GetInstance().GetResolutionScaleX(); float fScaleY = 1.0f / UIEditorMessageService.GetInstance().GetResolutionScaleY(); shape.PosX += (fScaleX * (float)x); shape.PosY += (fScaleX * (float)y); }
public UIShapeBase CreateNewShape(UIShapeBase shape, UIShapeDialog parent, float PosX, float PosY) { UIShapeBase _newInst = (UIShapeBase)shape.Clone(); _newInst.PosX = PosX; _newInst.PosY = PosY; EditorManager.Actions.Add(new AddShapeAction(_newInst, m_baseDialog, shape.ParentLayer, true)); return _newInst; }
bool m_bCopying = false; // 복사중이므로, selectedShape 등의 처리는 복사도중에는 패스하고, 복사가 완료된 시점에서 처리 public UIShapeBase CreateNewShape(UIShapeBase shape, UIShapeDialog parent, float PosX, float PosY) { UIShapeBase _newInst = (UIShapeBase)shape.Clone(); _newInst.PosX = PosX; _newInst.PosY = PosY; EditorManager.Actions.Add(new AddShapeAction(_newInst, m_baseDialog, shape.ParentLayer, true)); return(_newInst); }
/// <summary> /// The constructor of the node shape, just takes the node name /// </summary> /// <param name="name">Name of the shape in the shape tree</param> public UIShapeTextInput(string name) : base(name) { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Text.png"); UIProperties = UIManager.CreateCollection(this, "VUINodeTextInput"); SizeX = 500; SizeY = 100; Order = 3; // Base render order }
public UIShapeNumericUpDown(string name) : base(name) { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Button.png"); UIProperties = UIManager.CreateCollection(this, "VUINodeNumericUpDown"); SizeX = 200; SizeY = 100; Order = 6; // Base render order }
public UIShapeRotator(string name) : base(name) { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Button.png"); UIProperties = UIManager.CreateCollection(this, "VUINodeRotator"); SizeX = 500; SizeY = 200; Order = 4; // Base render order }
public void SelectUIShape(UIShapeBase shape) { if (m_bCopying == true) { return; } if (m_selectedShapeList.Contains(shape) == false) { m_selectedShapeList.Add(shape); // 선택에 넣음 } if (shape == m_baseDialog || shape.Parent == m_baseDialog) // 작업 다이얼로그는 그대로 { m_UIShapeList.Clear(); foreach (ShapeBase child in m_baseDialog.ChildCollection) { if (child is UIShapeBase) { m_UIShapeList.Add(child as UIShapeBase); } } m_UIShapeList.Add(m_baseDialog); // 다이얼로그는 제일 마지막에 추가 ( 나중에 검색할때 가장 나중에 검색되도록 ) return; } // 작업 다이얼로그가 변경됨 if (shape is UIShapeDialog) { m_baseDialog = shape as UIShapeDialog; } else if (shape.Parent is UIShapeDialog) { m_baseDialog = shape.Parent as UIShapeDialog; } else { return; } m_UIShapeList.Clear(); foreach (ShapeBase child in m_baseDialog.ChildCollection) { if (child is UIShapeBase) { m_UIShapeList.Add(child as UIShapeBase); } } m_UIShapeList.Add(m_baseDialog); // 다이얼로그는 제일 마지막에 추가 ( 나중에 검색할때 가장 나중에 검색되도록 ) }
public override void OnValueChanged(DynamicProperty prop) { base.OnValueChanged(prop); UIShapeBase entity = Owner as UIShapeBase; if (entity.HasEngineInstance()) { string varValue = AsEntityString(prop); entity.EngineInstanceUIShape.SetVariable(prop.PropertyType.Name, varValue); if (entity.ParentLayer != null) { entity.ParentLayer.Modified = true; } } }
/// <summary> /// overridden clone function /// </summary> /// <returns></returns> public override ShapeBase Clone() { // perform deep copy of the dynamic properties UIShapeBase clonedShape = base.Clone() as UIShapeBase; clonedShape.UIProperties = (DynamicPropertyCollection)UIProperties.Clone(); clonedShape.UIProperties.Owner = clonedShape; // clonedShape._snappoints = StaticMeshShape.SNAPPOINTLIST_CACHE_INVALID; // force update next time; // // clonedShape._hotSpotLightGridOfs = null; // clonedShape._cachedBoneList = null; // invalidate cache (and re-cache via children) // clonedShape._copySource = this; // while (clonedShape._copySource._copySource != null) // clonedShape._copySource = clonedShape._copySource._copySource; // ValidateCopySource(); return(clonedShape); }
public void UnSelectUIShape(UIShapeBase shape) { //m_selectedShapeList.Remove(shape); //m_UIShapeList.Clear(); if (m_bCopying == true) { return; } if (m_selectedShapeList.Contains(shape)) // 테스트 { m_selectedShapeList.Remove(shape); } // if (shape == m_baseDialog || shape.Parent == m_baseDialog) //{ // //if (m_selectedShapeList.Contains(shape)) // 테스트 // m_selectedShapeList.Remove(shape); //} //m_baseDialog = null; // m_UIShapeList.Remove(shape); // // foreach (ShapeBase child in shape.ChildCollection) // { // if (child is UIShapeBase) // { // m_UIShapeList.Remove(child as UIShapeBase); // } // } }
/// <summary> /// Overridable that is called when the mouse cursor moves in the view /// </summary> /// <param name="e">Mouse event arguments directly passed through</param> /// <param name="eKeyMod">Key modifier bitmask (Shift, Alt, ...)</param> /// <param name="iOldX">Previous screen x position</param> /// <param name="iOldY">Previous screen y position</param> /// <returns>return true to redraw the view immediately</returns> public override bool OnMouseMove(MouseEventArgs e, KeyModifier eKeyMod, int iOldX, int iOldY) { if (Dragmode == MOUSE_MODE.UI_AREA_SELECT) { View.RenderRectangle2D(m_MouseDownPoint.X, m_MouseDownPoint.Y, e.X, e.Y, VisionColors.RGBA(255, 255, 255, 255), 1.0f); } else if (eKeyMod == KeyModifier.Ctrl) { } else { if (m_selectedShapeList.Count > 0) { if (Dragmode == MOUSE_MODE.UI_MOVE || Dragmode == MOUSE_MODE.UI_COPY) { // this.MoveUIShape(m_selectedShape, e.X, e.Y); foreach (UIShapeBase shape in m_selectedShapeList) { this.MoveUIShapeDelta(shape, e.X - iOldX, e.Y - iOldY); } } else if (Dragmode == MOUSE_MODE.UI_SIZE) { foreach (UIShapeBase shape in m_selectedShapeList) { Rectangle2D newRect = new Rectangle2D(); float fDeltaX = (e.X - iOldX); float fDeltaY = (e.Y - iOldY); if (View.Cursor == Cursors.PanNW) { newRect.Add(shape.ScreenBound.X2, shape.ScreenBound.Y2); newRect.Add(shape.ScreenBound.X1 + fDeltaX, shape.ScreenBound.Y1 + fDeltaY); newRect.Validate(); shape.ScreenBound = newRect; } else if (View.Cursor == Cursors.PanSW) { newRect.Add(shape.ScreenBound.X2, shape.ScreenBound.Y1); newRect.Add(shape.ScreenBound.X1 + fDeltaX, shape.ScreenBound.Y2 + fDeltaY); newRect.Validate(); shape.ScreenBound = newRect; } else if (View.Cursor == Cursors.PanNE) { newRect.Add(shape.ScreenBound.X1, shape.ScreenBound.Y2); newRect.Add(shape.ScreenBound.X2 + fDeltaX, shape.ScreenBound.Y1 + fDeltaY); newRect.Validate(); shape.ScreenBound = newRect; } else if (View.Cursor == Cursors.PanSE) { newRect.Add(shape.ScreenBound.X1, shape.ScreenBound.Y1); newRect.Add(shape.ScreenBound.X2 + fDeltaX, shape.ScreenBound.Y2 + fDeltaY); newRect.Validate(); shape.ScreenBound = newRect; } } } } else { } if (Dragmode == MOUSE_MODE.UI_NONE) { UIShapeBase tempShape = this.GetUIShapeFromSelection(e.X, e.Y); if (tempShape == null) { View.Cursor = Cursors.Default; } else { int margin = 15; Rectangle2D mouseBound = new Rectangle2D(); mouseBound.Add(e.X - margin, e.Y - margin); mouseBound.Add(e.X + margin, e.Y + margin); float fX1 = tempShape.ScreenBound.X1; float fY1 = tempShape.ScreenBound.Y1; float fX2 = tempShape.ScreenBound.X2; float fY2 = tempShape.ScreenBound.Y2; if (mouseBound.IsInside(fX1, fY1)) { View.Cursor = Cursors.PanNW; } else if (mouseBound.IsInside(fX1, fY2)) { View.Cursor = Cursors.PanSW; } else if (mouseBound.IsInside(fX2, fY1)) { View.Cursor = Cursors.PanNE; } else if (mouseBound.IsInside(fX2, fY2)) { View.Cursor = Cursors.PanSE; } else if (tempShape is UIShapeDialog) // 다이얼로그는 사이즈조정밖에 안됨 { View.Cursor = Cursors.Arrow; } else { View.Cursor = Cursors.SizeAll; } } } } return(false); }
public override bool OnMouseDown(MouseEventArgs e, KeyModifier eKeyMod, int iOldX, int iOldY) { // 1. 현재 마우스 포지션의 UI 를 가지고 온다 // 2. UI 가 있고, 커서가 경계에 겹칠 경우 - Select 해주고 마우스 커서 변경 , Move Mode 로 Position 변경 // 3. UI 가 있고, 커서가 경계 안에 있을 경우 - 사이즈 변경 if (e.Button == MouseButtons.Left) { UIShapeBase selectedShape = null; if (View.Cursor == Cursors.Arrow) // 화살표일 경우 선택 모드 { m_selectedShapeList.Clear(); selectedShape = this.GetUIShape(e.X, e.Y, false); } else if (View.Cursor == Cursors.Cross) { selectedShape = this.GetUIShape(e.X, e.Y, false); } else// 화살표가 아니면 선택된 아이템중에 선택 { selectedShape = this.GetUIShapeFromSelection(e.X, e.Y); } if (eKeyMod == KeyModifier.Shift) // Shift 누르면 복사 { m_bCopying = true; Dragmode = MOUSE_MODE.UI_COPY; } if (selectedShape != null) { if (m_selectedShapeList.Contains(selectedShape) == false) { m_selectedShapeList.Add(selectedShape); } } } // if (EditorManager.SelectedShapes.Contains(m_selectedShape) == false ) // { // EditorManager.SelectedShapes = new CSharpFramework.ShapeCollection(); // EditorManager.SelectedShapes.Add(m_selectedShape); // } if (m_selectedShapeList.Count >= 1) { if (View.Cursor == Cursors.SizeAll) { if (eKeyMod == KeyModifier.Shift && Dragmode == MOUSE_MODE.UI_COPY) // 시프트키 눌리고 , 셀렉티드 쉐입에 , Move Mode 이면 복사 { m_bCopying = true; foreach (UIShapeBase shape in m_selectedShapeList) { if (shape != null) { UIShapeBase copyShape = CreateNewShape(shape, m_baseDialog, shape.PosX, shape.PosY); m_UICopyShapeList.Add(copyShape); } } m_selectedShapeList.Clear(); m_selectedShapeList.AddRange(m_UICopyShapeList); m_UIShapeList.AddRange(m_UICopyShapeList); // // foreach (UIShapeBase shape in m_UICopyShapeList) // { // EditorManager.Actions.Add(new AddShapeAction(shape, m_baseDialog, shape.ParentLayer, true)); // } // // EditorManager.SelectedShapes.Clear(); // 기존 선택된 UI 들 지우고 // EditorManager.SelectedShapes.AddRange(m_UICopyShapeList); // 복사된거만 선택 m_bCopying = false; //UIShapeBase copyShape = CreateNewShape(m_selectedShape, m_baseDialog, m_selectedShape.PosX, m_selectedShape.PosY); //m_selectedShape = copyShape; //UIShapeBase copyShape = (UIShapeBase)m_selectedShape.Clone(); //m_UICopyShapeList.Add(copyShape); } else { Dragmode = MOUSE_MODE.UI_MOVE; } } else if (View.Cursor == Cursors.Arrow) { } else { Dragmode = MOUSE_MODE.UI_SIZE; } } if (Dragmode == MOUSE_MODE.UI_COPY) { ShapeCollection collection = new CSharpFramework.ShapeCollection(); collection.AddRange(m_UICopyShapeList); EditorManager.SelectedShapes = collection; } else { ShapeCollection collection = new CSharpFramework.ShapeCollection(); collection.AddRange(m_selectedShapeList); EditorManager.SelectedShapes = collection; } return(false); }
/// <summary> /// Constructor /// </summary> public ModelPreviewShapeCreator() { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Button.png"); }
/// <summary> /// Constructor /// </summary> public DialogShapeCreator() { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Dialog.png"); CategoryIconIndex = IconIndex; }
/// <summary> /// Constructor /// </summary> public SliderControlShapeCreator() { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Text.png"); }
/// <summary> /// The constructor of the node shape, just takes the node name /// </summary> /// <param name="name">Name of the shape in the shape tree</param> public UIShapeSliderControl(string name) : base(name) { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Text.png"); UIProperties = UIManager.CreateCollection(this, "VUINodeSliderControl"); }
public override int GetIconIndex() { return(UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Dialog.png")); }
/// <summary> /// Constructor /// </summary> public TextLabelShapeCreator() { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Text.png"); }
/// <summary> /// Constructor /// </summary> public RotatorShapeCreator() { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Button.png"); }
/// <summary> /// The constructor of the node shape, just takes the node name /// </summary> /// <param name="name">Name of the shape in the shape tree</param> public UIShapeImage(string name) : base(name) { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Image.png"); UIProperties = UIManager.CreateCollection(this, "VUINodeImage"); }
public void SelectUIShape(UIShapeBase shape) { if (m_bCopying == true) return; if ( m_selectedShapeList.Contains( shape ) == false ) m_selectedShapeList.Add(shape); // 선택에 넣음 if (shape == m_baseDialog || shape.Parent == m_baseDialog) // 작업 다이얼로그는 그대로 { m_UIShapeList.Clear(); foreach (ShapeBase child in m_baseDialog.ChildCollection) { if (child is UIShapeBase) { m_UIShapeList.Add(child as UIShapeBase); } } m_UIShapeList.Add(m_baseDialog); // 다이얼로그는 제일 마지막에 추가 ( 나중에 검색할때 가장 나중에 검색되도록 ) return; } // 작업 다이얼로그가 변경됨 if (shape is UIShapeDialog) { m_baseDialog = shape as UIShapeDialog; } else if (shape.Parent is UIShapeDialog) { m_baseDialog = shape.Parent as UIShapeDialog; } else { return; } m_UIShapeList.Clear(); foreach (ShapeBase child in m_baseDialog.ChildCollection) { if (child is UIShapeBase) { m_UIShapeList.Add(child as UIShapeBase); } } m_UIShapeList.Add(m_baseDialog); // 다이얼로그는 제일 마지막에 추가 ( 나중에 검색할때 가장 나중에 검색되도록 ) }
public void UnSelectUIShape(UIShapeBase shape) { //m_selectedShapeList.Remove(shape); //m_UIShapeList.Clear(); if (m_bCopying == true) return; if (m_selectedShapeList.Contains(shape)) // 테스트 m_selectedShapeList.Remove(shape); // if (shape == m_baseDialog || shape.Parent == m_baseDialog) //{ // //if (m_selectedShapeList.Contains(shape)) // 테스트 // m_selectedShapeList.Remove(shape); //} //m_baseDialog = null; // m_UIShapeList.Remove(shape); // // foreach (ShapeBase child in shape.ChildCollection) // { // if (child is UIShapeBase) // { // m_UIShapeList.Remove(child as UIShapeBase); // } // } }
/// <summary> /// Constructor /// </summary> public UIShapeDraggingButtonCreator() { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Button.png"); }
/// <summary> /// Constructor /// </summary> public PushColorButtonShapeCreator() { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Button.png"); }
/// <summary> /// Constructor /// </summary> public NumericUpDownShapeCreator() { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Button.png"); }
/// <summary> /// Constructor /// </summary> public ImageShapeCreator() { IconIndex = UIShapeBase.GetIconIndex("UIEditorPlugin.Icons.Image.png"); }