コード例 #1
0
ファイル: GUIContextShape.cs プロジェクト: pilnine/GUIEditor
        /// <summary>
        /// Overridden StringConverter function: Returns the standard values that the dropdown should have
        /// </summary>
        /// <param name="context">The descriptor context</param>
        /// <returns>Collection of standard values</returns>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList className = new ArrayList();

            UIEditorMessageService.GetInstance().GetClassNames("VGUIMainContext", className);
            return(new StandardValuesCollection(className));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public UIShapeBase GetUIShapeFromSelection(int x, int y)
        {
            float fX = 1.0f / UIEditorMessageService.GetInstance().GetResolutionScaleX() * (float)x;
            float fY = 1.0f / UIEditorMessageService.GetInstance().GetResolutionScaleY() * (float)y;

            foreach (UIShapeBase shape in m_selectedShapeList)
            {
                bool bResult = shape.Bound.IsInside(fX, fY);

                //bool bResult = ContainPoint(shape, fScaleX * (float)x, fScaleY * (float)y, fMargin);
                // && !(shape is UIShapeDialog)
                if (bResult == true && shape.Selected == true)
                {
                    return(shape);
                }
            }

            return(null);
        }
コード例 #5
0
        void OnPropertyChanged(object sender, PropertyChangedArgs e)
        {
            if (EngineInstanceUIShape == null)
            {
                return;
            }

            if (e._propertyName == "PosX" || e._propertyName == "PosY")
            {
                EngineInstanceUIShape.SetPosition(PosX, PosY, 0.0f);
            }
            else if (e._propertyName == "SizeX" || e._propertyName == "SizeY")
            {
                EngineInstanceUIShape.SetSize(SizeX, SizeY);
            }
            else if (e._propertyName == "UIKey")
            {
                EngineInstanceUIShape.SetUIKey(UIKey);
            }
            else if (e._propertyName == "Order")
            {
                EngineInstanceUIShape.SetOrder(Order);
            }
            else
            {
                if (e._component is bool)
                {
                    UIEditorMessageService.GetInstance().OnPropertyChanged(e._propertyName, (bool)e._component);
                }
                else if (e._component is int)
                {
                    UIEditorMessageService.GetInstance().OnPropertyChanged(e._propertyName, (int)e._component);
                }
                else if (e._component is float)
                {
                    UIEditorMessageService.GetInstance().OnPropertyChanged(e._propertyName, (float)e._component);
                }
                else if (e._component is string)
                {
                    UIEditorMessageService.GetInstance().OnPropertyChanged(e._propertyName, (string)e._component);
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Overridden render function: Let the engine instance render itself and render a box
        /// </summary>
        /// <param name="view"></param>
        /// <param name="mode"></param>
        public override void RenderShape(VisionViewBase view, ShapeRenderMode mode)
        {
            //    EngineNode.RenderShape(view, mode);
            base.RenderShape(view, mode);

            if (this.Selected == true)
            {
                uint iColor = VisionColors.RGBA(0, 0, 255, 255);

                float fScaleX = UIEditorMessageService.GetInstance().GetResolutionScaleX();
                float fScaleY = UIEditorMessageService.GetInstance().GetResolutionScaleY();

                float fScreenPosX = PosX;
                float fScreenPosY = PosY;

                if (Parent != null && Parent is UIShapeBase)
                {
                    fScreenPosX += ((UIShapeBase)Parent).PosX;
                    fScreenPosY += ((UIShapeBase)Parent).PosY;
                }

                view.RenderRectangle2D(fScreenPosX * fScaleX, fScreenPosY * fScaleY, (fScreenPosX + SizeX) * fScaleX, (fScreenPosY + SizeY) * fScaleY, iColor, 1.0f);
            }
        }