예제 #1
0
        /// <summary>
        /// Renders a particle
        /// </summary>
        /// <param name="part"></param>
        private void DrawParticle(Particle part)
        {
            FPoint position = new FPoint(part.Position.X, part.Position.Y);

            position.X += CommonAttribService.ACTUAL_TABLE_WIDTH / 2;
            position.Y += CommonAttribService.ACTUAL_TABLE_HEIGHT / 2;
            position.X *= ratioX;
            position.Y *= ratioY;


            if (CommonAttribService.DEFAULT_FADE_COLORS == null || CommonAttribService.DEFAULT_FADE_COLORS.Count == 0 || !GraphicsSettings.Instance().DEFAULT_PARTICLE_COLOR_ALLOWED)
            {
                DrawCircle((int)position.X, (int)position.Y, (int)part.Settings.size, color_particle);
            }
            else
            {
                // distinguish among various settings
                if (GraphicsSettings.Instance().DEFAULT_PARTICLE_COLOR_MODE == ParticleColorMode.GRAVITY)
                {
                    DrawCircle((int)position.X, (int)position.Y, (int)part.Settings.size, ColorVelocity(part.Vector_Acceleration.Size() / 5.0));
                }
                else if (GraphicsSettings.Instance().DEFAULT_PARTICLE_COLOR_MODE == ParticleColorMode.SIZE)
                {
                    DrawCircle((int)position.X, (int)position.Y, (int)part.Settings.size, ColorVelocity(part.Settings.size / 30.0));
                }
                else if (GraphicsSettings.Instance().DEFAULT_PARTICLE_COLOR_MODE == ParticleColorMode.VELOCITY)
                {
                    DrawCircle((int)position.X, (int)position.Y, (int)part.Settings.size, ColorVelocity(part.Vector_Velocity.Size() / 25.0));
                }
                else if (GraphicsSettings.Instance().DEFAULT_PARTICLE_COLOR_MODE == ParticleColorMode.WEIGH)
                {
                    DrawCircle((int)position.X, (int)position.Y, (int)part.Settings.size, ColorVelocity(part.Settings.weigh / 50.0));
                }
            }
        }
        public override void Layout(GraphicsSettings gs, Size maximumSize)
        {
            SyncSectionsToColumns(HeaderColumnSection.DisplayMode.Customise);

            const int verticalMargin = 5;
            const int columnItemSeparation = 7;

            Point pt = new Point(Location.X + columnItemSeparation, Location.Y + verticalMargin);
            int bottom = 0;
            if (Children.Count == 0)
            {
                SizeF messageSize = gs.Graphics.MeasureString(_emptyGroupMessage, Host.Font);
                _minimumWidth = (int) messageSize.Width + _paintEmptyMessageMargin*2;
            }
            else
            {
                foreach (HeaderColumnSection hcs in Children)
                {
                    hcs.Location = pt;
                    hcs.Layout(gs, maximumSize);
                    pt.X += hcs.Size.Width + columnItemSeparation;
                    pt.Y += hcs.Size.Height/2;
                    bottom = hcs.Rectangle.Bottom;
                    _minimumWidth = hcs.Rectangle.Right - Rectangle.Left;
                }
            }
            bottom += verticalMargin;
            Size = new Size(maximumSize.Width, Math.Max(30, bottom));
        }
예제 #3
0
        public virtual Size GetIdealSize(GraphicsSettings gs)
        {
            const int margin = 2;
            SizeF     size   = gs.Graphics.MeasureString(DisplayItem.ToString(), Font);

            return(new Size((int)size.Width + 4, (int)size.Height + margin * 2));
        }
예제 #4
0
        public override void PaintBackground(GraphicsSettings gs, Rectangle clipRect)
        {
            PaintSelection(gs);
            _drawnSelected = IsSelected;

            if (IsFocused)
            {
                Rectangle rc        = HostBasedRectangle;
                int       indent    = IndentWidth;
                Rectangle focusRect = new Rectangle(rc.X + indent, rc.Y, rc.Width - indent, Rectangle.Height);

                focusRect.Width -= 1;
                if (this is GroupSection)
                {
                    focusRect.Height -= _separatorLineHeight;
                }
                focusRect.Height -= 2;

                using (Pen pen = new Pen(SystemColors.ControlDark))
                {
                    pen.DashStyle = DashStyle.Dot;
                    gs.Graphics.DrawRectangle(pen, focusRect);
                }
            }
        }
        void RenderForeground()
        {
            float            oldFar             = gameCamera.farClipPlane;
            CameraClearFlags oldFlags           = gameCamera.clearFlags;
            Color            oldBackgroundColor = gameCamera.backgroundColor;

            gameCamera.farClipPlane = Mathf.Max(gameCamera.nearClipPlane + 0.001f, CalculatePlayerDepth() + 0.5f * layerOverlap);

            gameCamera.clearFlags      = CameraClearFlags.SolidColor;
            gameCamera.backgroundColor = clearColor;

            Shader originalScreenSpaceShadowShader = GraphicsSettings.GetCustomShader(BuiltinShaderType.ScreenSpaceShadows);

            GraphicsSettings.SetCustomShader(BuiltinShaderType.ScreenSpaceShadows, noForegroundShadowFadeShader);

            RenderGameCamera(gameCamera, quadrantTex);

            GraphicsSettings.SetCustomShader(BuiltinShaderType.ScreenSpaceShadows, originalScreenSpaceShadowShader);

            gameCamera.farClipPlane    = oldFar;
            gameCamera.clearFlags      = oldFlags;
            gameCamera.backgroundColor = oldBackgroundColor;

            Graphics.SetRenderTarget(Output as RenderTexture);
            Graphics.DrawTexture(new Rect(Screen.width * 0.5f, 0, Screen.width * 0.5f, Screen.height * 0.5f), quadrantTex);
        }
예제 #6
0
        public override void Layout(GraphicsSettings gs, Size maximumSize)
        {
            DeleteChildren();

            int bottom = Location.Y;

            foreach (Section s in _headerSection.Children)
            {
                HeaderColumnSection hcs = s as HeaderColumnSection;

                if (hcs != null)
                {
                    CellSection cellSection = Host.SectionFactory.CreateCellSection(Host, hcs, Item);

                    Children.Add(cellSection);

                    //
                    //	We position the cell aligned to its corresponding HeaderColumnSection. We nudge it to right here
                    //	based on any difference between the column size and the headers columns actual size. The only time there
                    //	will be a different currently is when we have multiple groups reserving initial space on the first column.
                    cellSection.Location = new Point(hcs.Location.X + hcs.Rectangle.Width - hcs.Column.Width, Location.Y);
                    cellSection.Layout(gs, new Size(hcs.Column.Width, maximumSize.Height));
                    bottom = Math.Max(bottom, cellSection.Rectangle.Bottom);
                }
            }
            int newHeigt = MinimumHeight;

            if (bottom - Rectangle.Top > MinimumHeight)
            {
                newHeigt = bottom - Rectangle.Top;
            }
            Size = new Size(HeaderSection.Rectangle.Width, newHeigt);
        }
예제 #7
0
                public override void Paint(GraphicsSettings gs, Rectangle clipRect)
                {
                    base.Paint(gs, clipRect);

                    if (_style == Style.AllRows || IsSelected)
                    {
                        using (Font autoPreviewFont = AutoPreviewFont)
                        {
                            Person person      = (Person)Item;
                            string description = person.Description;

                            Rectangle rect = _rect;

                            rect.Offset(HostBasedRectangle.Location);

                            Color color;

                            if (IsSelected)
                            {
                                color = SystemColors.HighlightText;
                            }
                            else
                            {
                                color = SystemColors.ControlDarkDark;
                            }

                            BinaryComponents.WinFormsUtility.Drawing.GdiPlusEx.DrawString
                                (gs.Graphics, description, AutoPreviewFont, color, rect
                                , BinaryComponents.WinFormsUtility.Drawing.GdiPlusEx.TextSplitting.MultiLine, BinaryComponents.WinFormsUtility.Drawing.GdiPlusEx.Ampersands.Display);
                        }
                    }
                }
예제 #8
0
        public override void Paint(GraphicsSettings gs, Rectangle clipRect)
        {
            Rectangle rcText;

            GetDrawRectangles(out rcText, out _buttonRectangle);
            Rectangle rc = HostBasedRectangle;

            //
            // Fill indent area if any
            if (_groupIndentWidth > 0)
            {
                Rectangle rcIndent = new Rectangle(rc.X, rc.Y, _groupIndentWidth, rc.Height);

                PaintIndentArea(gs.Graphics, rcIndent);
            }

            gs.Graphics.DrawIcon(DrawIcon, _buttonRectangle.X, _buttonRectangle.Y);

            GdiPlusEx.DrawString
                (gs.Graphics, Text, Font, (Host.FocusedSection == ListSection && IsSelected) ? SystemColors.HighlightText : ListControl.GroupSectionForeColor, rcText
                , GdiPlusEx.Alignment.Left, ListControl.GroupSectionVerticalAlignment, GdiPlusEx.TextSplitting.SingleLineEllipsis, GdiPlusEx.Ampersands.Display);

            Rectangle rcLine = rc;

            rcLine.X += _groupIndentWidth;
            PaintSeparatorLine(gs.Graphics, rcLine);
        }
예제 #9
0
    /// <summary>
    /// We need to get all the dependencies of the graphics settings
    /// Grab everything we can from the settings that is exposed to script
    /// </summary>
    private void AddGraphicsSettings()
    {
        HashSet <string> settingsFiles = new HashSet <string>();

        if (GraphicsSettings.renderPipelineAsset != null)
        {
            string rpAssetPath = AssetDatabase.GetAssetPath(GraphicsSettings.renderPipelineAsset);
            Debug.LogFormat("Render Pipeline Asset {0}", rpAssetPath);
            settingsFiles.Add(rpAssetPath);
        }

        foreach (BuiltinShaderType shaderType in System.Enum.GetValues(typeof(BuiltinShaderType)))
        {
            Shader shader = GraphicsSettings.GetCustomShader(shaderType);
            if (shader != null)
            {
                string shaderPath = AssetDatabase.GetAssetPath(shader);
                Debug.LogFormat("Shader {0}", shaderPath);
                if (File.Exists(shaderPath))
                {
                    settingsFiles.Add(shaderPath);
                }
            }
        }

        AddDependencies(settingsFiles);
    }
예제 #10
0
        // Token: 0x060035F9 RID: 13817 RVA: 0x0016C678 File Offset: 0x0016AA78
        private static void onClickedResolutionButton(SleekButton button)
        {
            int index = (button.positionOffset_Y - 100) / 40;

            GraphicsSettings.resolution = new GraphicsSettingsResolution(MenuConfigurationDisplayUI.resolutions[index]);
            GraphicsSettings.apply();
        }
예제 #11
0
        public override void Paint(GraphicsSettings gs, Rectangle clipRect)
        {
            for (int i = 0; i < ExcludeFirstChildrenFromVScroll; i++)
            {
                Children[i].Paint(gs, clipRect);
            }

            GraphicsContainer container = gs.Graphics.BeginContainer();

            try
            {
                using (Region clipRegion = new Region(clipRect))
                {
                    clipRegion.Intersect(WorkingRectangle);
                    gs.Graphics.Clip = clipRegion;
                    for (int i = ExcludeFirstChildrenFromVScroll; i < Children.Count; i++)
                    {
                        Section s = Children[i];
                        if (clipRect.IntersectsWith(s.HostBasedRectangle))
                        {
                            s.Paint(gs, clipRect);
                        }
                    }
                }
            }
            finally
            {
                gs.Graphics.EndContainer(container);
            }
        }
예제 #12
0
        public static SerializedProperty LoadCustomRenderPipeline()
        {
            GraphicsSettings graphicsSettings = AssetDatabase.LoadAssetAtPath <GraphicsSettings>(GraphicsSettingsPath);
            var so = new SerializedObject(graphicsSettings);

            return(so.FindProperty("m_CustomRenderPipeline"));
        }
예제 #13
0
        void RenderForeground()
        {
            float            oldFar             = gameCamera.farClipPlane;
            CameraClearFlags oldFlags           = gameCamera.clearFlags;
            Color            oldBackgroundColor = gameCamera.backgroundColor;

            gameCamera.farClipPlane = Mathf.Max(gameCamera.nearClipPlane + 0.001f, CalculatePlayerDepth() + 0.5f * layerOverlap);

            gameCamera.clearFlags      = CameraClearFlags.SolidColor;
            gameCamera.backgroundColor = new Color(clearColor.r, clearColor.g, clearColor.b, 0);

            Shader originalScreenSpaceShadowShader = GraphicsSettings.GetCustomShader(BuiltinShaderType.ScreenSpaceShadows);

            GraphicsSettings.SetCustomShader(BuiltinShaderType.ScreenSpaceShadows, noForegroundShadowFadeShader);

            if (takeUnfilteredAlpha)
            {
                gameCamera.AddCommandBuffer(CameraEvent.BeforeImageEffects, grabAlphaCommand);  //Instruction to copy out the state of the RenderTexture before Image Effects are applied
            }
            RenderGameCamera(gameCamera, quadrantTex);
            if (takeUnfilteredAlpha)
            {
                gameCamera.RemoveCommandBuffer(CameraEvent.BeforeImageEffects, grabAlphaCommand);
                Graphics.Blit(lastFrameAlpha, quadrantTex, copyAlphaMat);      //Overwrite the potentially broken post-effects alpha channel with the pre-effect copy
            }

            GraphicsSettings.SetCustomShader(BuiltinShaderType.ScreenSpaceShadows, originalScreenSpaceShadowShader);

            gameCamera.farClipPlane    = oldFar;
            gameCamera.clearFlags      = oldFlags;
            gameCamera.backgroundColor = oldBackgroundColor;
        }
예제 #14
0
 private void InitGraphicsMode()
 {
     DisplayOutputSettings.DisplayMode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
     GraphicsSettings.SetPreferredBackBuffer(DisplayOutputSettings.ScreenWidth, DisplayOutputSettings.ScreenHeight);
     GraphicsSettings.SetFullscreen(DisplayOutputSettings.isFullScreen);
     GraphicsSettings.ApplyChanges();
 }
예제 #15
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     CalibrationSettings.Instance().Save();
     CaptureSettings.Instance().Save();
     GraphicsSettings.Instance().Save();
     PhysicSettings.Instance().Save();
 }
예제 #16
0
        public DeferredShadingUtils()
        {
            AssetBundle AB = AssetBundle.LoadFromFile(Application.dataPath + "/../plugins/PHIBL/deferredskin");

            if (AB == null)
            {
                Console.WriteLine("DeferredShadingUtil: \"deferredskin\" file missing!");
            }
            DiffuseScatteringOnRing = AB.LoadAsset <Texture2D>("DiffuseScatteringOnRing");
            DefaultSpotCookie       = AB.LoadAsset <Texture2D>("DefaultSpotCookie");
            AlloyBlurNormal         = AB.LoadAsset <Shader>("Assets/Alloy/Scripts/DeferredRendererPlus/Shaders/BlurNormals.shader");
            AlloyTransmissionBlit   = AB.LoadAsset <Shader>("Assets/Alloy/Scripts/DeferredRendererPlus/Shaders/TransmissionBlit.shader");
            GraphicsSettings.SetShaderMode(BuiltinShaderType.DeferredReflections, BuiltinShaderMode.UseCustom);
            GraphicsSettings.SetShaderMode(BuiltinShaderType.DeferredShading, BuiltinShaderMode.UseCustom);
            GraphicsSettings.SetShaderMode(BuiltinShaderType.ScreenSpaceShadows, BuiltinShaderMode.UseCustom);
            GraphicsSettings.SetCustomShader(BuiltinShaderType.DeferredShading, AB.LoadAsset <Shader>("Assets/Alloy/Shaders/Alloy Deferred Skin.shader"));
            GraphicsSettings.SetCustomShader(BuiltinShaderType.DeferredReflections, AB.LoadAsset <Shader>("Assets/Alloy/Shaders/Alloy Deferred Reflections.shader"));
            GraphicsSettings.SetCustomShader(BuiltinShaderType.ScreenSpaceShadows, AB.LoadAsset <Shader>("Assets/Psychose Interactive/NGSS/Internal-ScreenSpaceShadows.shader"));
            AlloyDeferredSkinShader = AB.LoadAsset <Material>("skin").shader;
            AlloyAlpha = AB.LoadAsset <Material>("nip").shader;
            if (AlloyDeferredSkinShader == null)
            {
                Console.WriteLine("DeferredShadingUtil: Can't find deferred skin shader!");
            }
            AB.Unload(false);
            skinMaterials = new List <Material>();
        }
        public override void Layout(GraphicsSettings gs, Size maximumSize)
        {
            SyncSectionsToColumns(HeaderColumnSection.DisplayMode.Customise);

            const int verticalMargin       = 5;
            const int columnItemSeparation = 7;

            Point pt     = new Point(Location.X + columnItemSeparation, Location.Y + verticalMargin);
            int   bottom = 0;

            if (Children.Count == 0)
            {
                SizeF messageSize = gs.Graphics.MeasureString(_emptyGroupMessage, Host.Font);
                _minimumWidth = (int)messageSize.Width + _paintEmptyMessageMargin * 2;
            }
            else
            {
                foreach (HeaderColumnSection hcs in Children)
                {
                    hcs.Location = pt;
                    hcs.Layout(gs, maximumSize);
                    pt.X         += hcs.Size.Width + columnItemSeparation;
                    pt.Y         += hcs.Size.Height / 2;
                    bottom        = hcs.Rectangle.Bottom;
                    _minimumWidth = hcs.Rectangle.Right - Rectangle.Left;
                }
            }
            bottom += verticalMargin;
            Size    = new Size(maximumSize.Width, Math.Max(30, bottom));
        }
예제 #18
0
    protected virtual void buildObject(int level)
    {
        _sprite = gameObject.GetComponent <tk2dAnimatedSprite>();

        settings = graphicSettings[level];

        level = level;

        ContentManager.instance.configureObject(_sprite, settings.spriteAtlas, settings.defaultSprite);
        if (settings.animationAtlas != "")
        {
            ContentManager.instance.precacheAnimation(_sprite, settings.animationAtlas);
        }

        if (zSort)
        {
            Vector3 position = gameObject.transform.localPosition;
            position.z = (((position.y - _sprite.GetBounds().size.y / 2) * 0.01f)) + .01f;
            gameObject.transform.localPosition = position;
        }

        if (gameObject.GetComponent <BoxCollider>() == null)
        {
            BoxCollider box = gameObject.AddComponent <BoxCollider>();
            box.size = new Vector3(_sprite.GetBounds().size.x, _sprite.GetBounds().size.y, 1);
        }
    }
예제 #19
0
 public static void LoadShader()
 {
     if (Settings.betterLighting.Value)
     {
         //string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "deferredshader");
         //AssetBundle bundle = AssetBundle.LoadFromFile(path);
         AssetBundle bundle = AssetBundle.LoadFromMemory(DeferredShader.shader);
         DeferredShader.shader = null;
         if (bundle == null)
         {
             VSideLoader.Logger.LogInfo("Loading bundle failed");
         }
         else
         {
             Shader shader = bundle.LoadAsset("assets/internal-deferredshading.shader") as Shader;
             if (shader != null)
             {
                 VSideLoader.Logger.LogInfo("Setting shader");
                 GraphicsSettings.SetCustomShader(BuiltinShaderType.DeferredShading, shader);
             }
             else
             {
                 VSideLoader.Logger.LogInfo("Could not find shader");
             }
         }
     }
 }
        public override void Paint(GraphicsSettings gs, Rectangle clipRect)
        {
            base.Paint(gs, clipRect);

            if (Children.Count == 0)
            {
                SizeF      messageSize = gs.Graphics.MeasureString(_emptyGroupMessage, Host.Font);
                RectangleF rcDraw      = new RectangleF(0, 0, messageSize.Width + _paintEmptyMessageMargin, messageSize.Height + _paintEmptyMessageMargin);

                rcDraw.Offset(5, (Rectangle.Height - rcDraw.Height) / 2);

                StringFormat sf = new StringFormat(gs.DefaultStringFormat);
                sf.Alignment     = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;

                gs.Graphics.FillRectangle(SystemBrushes.ButtonFace, rcDraw);
                gs.Graphics.DrawString(_emptyGroupMessage, Host.Font, Brushes.Gray, rcDraw, sf);
            }
            else
            {
                for (int i = 1; i < Children.Count; i++)
                {
                    Rectangle rcPrior = Children[i - 1].Rectangle;
                    Rectangle rcHcs   = Children[i].Rectangle;

                    Point[] linkPoints = new Point[]
                    {
                        new Point(rcPrior.Right - 4, rcPrior.Bottom - 2),
                        new Point(rcPrior.Right - 4, rcHcs.Top + rcHcs.Height / 2),
                        new Point(rcHcs.Left - 1, rcHcs.Top + rcHcs.Height / 2),
                    };
                    gs.Graphics.DrawLines(Pens.Black, linkPoints);
                }
            }
        }
예제 #21
0
        /// <summary>
        /// Po nacteni hlavniho okna se inicializuje hlavni manazer, ktery se postara
        /// o zbytek inicializace; take se inicializuje manazer kamery
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // pokud loading timer uz nebezi, zrus loading okno
            if (!loadingTimer.Enabled)
            {
                loadingWindow.Close();
            }

            // nacteni veskereho nastaveni z XML souboru
            CalibrationSettings.Instance().Load();
            CaptureSettings.Instance().Load();
            GraphicsSettings.Instance().Load();
            PhysicSettings.Instance().Load();


            CommonAttribService.mainWindow = this;

            // vytvoreni manazeru, ktery propoji funkcionalitu VSEM hlavnim modelum
            myManager          = new WindowManager();
            myManager.MyWindow = this;
            myManager.LoadDefaultValues();
            myManager.ManageMainWindow();

            CameraManager.Reinitialize();
        }
예제 #22
0
 /// <summary>
 /// Reset of al settings
 /// </summary>
 private void resetBut_Click(object sender, RoutedEventArgs e)
 {
     CalibrationSettings.Instance().Restart();
     CaptureSettings.Instance().Restart();
     GraphicsSettings.Instance().Restart();
     PhysicSettings.Instance().Restart();
 }
예제 #23
0
 /// <summary>
 /// Renders the system
 /// </summary>
 /// <param name="objects"></param>
 public void Repaint(TableDepositor objects)
 {
     if (CommonAttribService.OUTPUT_DRAW_ALLOWED)
     {
         BitmapSource bmp = null;
         if (GraphicsSettings.Instance().OUTPUT_TABLE_SIZE_DEPENDENT)
         {
             bmp = tableDrawingManager.CreateBitmap(objects, true);
         }
         else
         {
             if (((int)tableDrawingManager.actual_size.X) != CommonAttribService.ACTUAL_OUTPUT_WIDTH)
             {
                 tableDrawingManager.Resize(CommonAttribService.ACTUAL_OUTPUT_WIDTH,
                                            (int)(CommonAttribService.ACTUAL_TABLE_HEIGHT * (((double)CommonAttribService.ACTUAL_OUTPUT_WIDTH) / CommonAttribService.ACTUAL_TABLE_WIDTH)));
             }
             bmp = tableDrawingManager.CreateBitmap(objects, false);
         }
         if (bmp != null)
         {
             tableImage.Source = bmp;
             tableImage.Width  = ActualWidth;
             tableImage.Height = ActualHeight;
         }
     }
 }
        void GrabForeground(GameFrame targetFrame)
        {
            gameCamera.farClipPlane  = targetFrame.playerDepth + 0.5f * layerOverlap;
            gameCamera.nearClipPlane = gameNearClipPlane;
            //
            gameCamera.clearFlags      = CameraClearFlags.Color | CameraClearFlags.Depth;
            gameCamera.backgroundColor = new Color(0, 0, 0, 0);

            Shader originalScreenSpaceShadowShader = GraphicsSettings.GetCustomShader(BuiltinShaderType.ScreenSpaceShadows);

            GraphicsSettings.SetCustomShader(BuiltinShaderType.ScreenSpaceShadows, noForegroundShadowFadeShader);

            LayerMask oldCull = gameCamera.cullingMask;

            if (forceToBackground > 0)
            {
                gameCamera.cullingMask = forceToBackground;
                gameCamera.RenderWithShader(blockoutBackgroundShader, null);
                gameCamera.clearFlags = CameraClearFlags.Nothing;       //Whole point: next Render() respects this depth buffer
            }

            gameCamera.cullingMask = oldCull ^ forceToBackground;
            RenderGameCamera(gameCamera, targetFrame.foregroundBuffer);
            gameCamera.cullingMask = oldCull;

            GraphicsSettings.SetCustomShader(BuiltinShaderType.ScreenSpaceShadows, originalScreenSpaceShadowShader);

            gameCamera.nearClipPlane = gameNearClipPlane;
            gameCamera.farClipPlane  = gameFarClipPlane;
        }
        /////////////////////////////////////////////////////////////////////////////////
        // initialization

        private void Start()
        {
            // don't initialize anything if is in editor and not playing
            if (IsEditing())
            {
                return;
            }

            // initialize parameter factory
            StereoRenderManager.Instance.InitParamFactory();

            // initialize stereo camera rig
            if (stereoCameraHead == null)
            {
                CreateStereoCameraRig();
            }

            // FIX Unity 5.4 shadow bug (issue trakcer ID 686520) ++
            #if UNITY_5_4
            GraphicsSettings.SetCustomShader(BuiltinShaderType.ScreenSpaceShadows, Shader.Find("ScreenSpaceShadows-ForCustomPerspectiveMat"));
            #endif
            // FIX Unity 5.4 shadow bug (issue trakcer ID 686520) --

            // swap correct stereo shader for different unity versions; also create stereo material if nothing is there
            SwapStereoShader();

            // create render textures as target of stereo rendering
            CreateRenderTextures(StereoRenderManager.Instance.paramFactory.GetRenderWidth(), StereoRenderManager.Instance.paramFactory.GetRenderHeight());

            // get main camera and registor to StereoRenderManager
            StereoRenderManager.Instance.AddToManager(this);
        }
예제 #26
0
    public override void onAction()
    {
        if (_pieceNum > 0)
        {
            if (Inventory.instance.canAddStuff())
            {
                Inventory.instance.addStuf(cakeType.ToString());

                _pieceNum--;

                GraphicsSettings settings = graphicSettings[level];

                if (_pieceNum == 3)
                {
                    ContentManager.instance.configureObject(_sprite, settings.spriteAtlas, threePieceSprite);
                }
                else if (_pieceNum == 2)
                {
                    ContentManager.instance.configureObject(_sprite, settings.spriteAtlas, twoPieceSprite);
                }
                else if (_pieceNum == 1)
                {
                    ContentManager.instance.configureObject(_sprite, settings.spriteAtlas, onePieceSprite);
                }
                else
                {
                    ContentManager.instance.configureObject(_sprite, settings.spriteAtlas, emptySprite);
                }
            }
        }

        PlayerBehaviour.instance.setState(PlayerState.DEFAULT);
    }
예제 #27
0
 private static bool IsUsingCustomRenderPipeline()
 {
     if (RenderPipelineManager.get_currentPipeline() == null)
     {
         return(Object.op_Inequality((Object)GraphicsSettings.get_renderPipelineAsset(), (Object)null));
     }
     return(true);
 }
예제 #28
0
    public void test()
    {
        _pieceNum = 4;

        GraphicsSettings settings = graphicSettings[level];

        ContentManager.instance.configureObject(_sprite, settings.spriteAtlas, fourPieceSprite);
    }
예제 #29
0
 public ChartHolder(GraphicsSettings graphicsSettings, NumberPointsSettings pointsSettings,
                    PaletteSettings paletteSettings)
 {
     this.graphicsSettings = graphicsSettings;
     this.pointsSettings   = pointsSettings;
     this.paletteSettings  = paletteSettings;
     Dock = DockStyle.Fill;
 }
        protected void RenderCommonProbeFields(bool useMiniStyle)
        {
            bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath();
            bool isDeferredReflections   = isDeferredRenderingPath && (GraphicsSettings.GetShaderMode(BuiltinShaderType.DeferredReflections) != BuiltinShaderMode.Disabled);

            m_Probes.RenderReflectionProbeUsage(useMiniStyle, isDeferredRenderingPath, isDeferredReflections);
            m_Probes.RenderProbeAnchor(useMiniStyle);
        }
 static ShadowUtils()
 {
     m_ShadowmapFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Shadowmap)
         ? RenderTextureFormat.Shadowmap
         : RenderTextureFormat.Depth;
     m_ForceShadowPointSampling = SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal &&
                                  GraphicsSettings.HasShaderDefine(Graphics.activeTier, BuiltinShaderDefine.UNITY_METAL_SHADOWS_USE_POINT_FILTERING);
 }
예제 #32
0
        public override void Layout(GraphicsSettings settings, Size maximumSize)
        {
            int width = 0;
            int height = 0;

            SyncSectionsToColumns(HeaderColumnSection.DisplayMode.Header);

            Point pt = new Point(Location.X, Location.Y);

            int reservedSpace = LayoutController == null ? 0 : LayoutController.ReservedNearSpace;

            bool first = true;

            foreach (Section hcs in Children)
            {
                hcs.Location = pt;
                hcs.Layout(settings, new Size(maximumSize.Width - pt.X, _isVisible ? maximumSize.Height - pt.Y : 0));
                if (first)
                {
                    hcs.Size = new Size(hcs.Size.Width + reservedSpace, hcs.Size.Height);
                    first = false;
                }
                pt = new Point(hcs.Rectangle.Right, pt.Y);
                width += hcs.Rectangle.Width;
                if (hcs.Size.Height > height)
                {
                    height = hcs.Size.Height;
                }
            }
            if (height == 0 && _isVisible)
            {
                if (VisualStyleRenderer.IsSupported)
                {
                    VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.Header.Item.Normal);

                    height = renderer.GetPartSize(settings.Graphics, ThemeSizeType.True).Height;
                }
                else
                {
                    height = SystemFonts.DialogFont.Height + 6;
                }
            }
            _idealWidth = width;
            if (height < MinimumHeight)
            {
                height = MinimumHeight;
            }
            Size = new Size(Math.Max(maximumSize.Width, _idealWidth), height);
            if (LayoutController != null)
            {
                LayoutController.HeaderLayedOut();
            }
        }
예제 #33
0
        public override void Layout(GraphicsSettings gs, Size maximumSize)
        {
            CustomiseGroupingSection groupSection = (CustomiseGroupingSection) _customiseGroupingSection;
            OptionsToolbarSection optionsSection = (OptionsToolbarSection) _optionsToolbarSection;
            ListSection listSection = ListSection;

            groupSection.Location = Location;
            groupSection.Layout(gs, maximumSize);

            optionsSection.Layout(gs,
                                  new Size(Math.Max(optionsSection.MinimumWidth, maximumSize.Width - groupSection.MinimumWidth),
                                           groupSection.Size.Height));

            groupSection.Size = new Size(maximumSize.Width - optionsSection.Size.Width, groupSection.Size.Height);
            optionsSection.Location = new Point(groupSection.Rectangle.Right, Location.Y);
            optionsSection.Visible = true;

            Size = new Size(maximumSize.Width, optionsSection.Size.Height);
        }
예제 #34
0
 public override void Layout(GraphicsSettings gs, Size maximumSize)
 {
     _toolStrip.MaximumSize = new Size(maximumSize.Width, 0);
     Size = new Size(_toolStrip.Size.Width, maximumSize.Height);
 }
예제 #35
0
 public virtual Size GetIdealSize( GraphicsSettings gs )
 {
     const int margin = 2;
     SizeF size = gs.Graphics.MeasureString( DisplayItem.ToString(), Font );
     return new Size( (int)size.Width + 4, (int)size.Height + margin * 2 );
 }
예제 #36
0
 public void PaintSelection( GraphicsSettings gs )
 {
     System.Diagnostics.Debug.WriteLine( this.Host.CurrentSectionDraggedOver );
     if( IsSelected )
     {
         gs.Graphics.FillRectangle( Host.FocusedSection == ListSection ? SystemBrushes.Highlight : SystemBrushes.ButtonFace, Rectangle );
     }
     else if( this.Host.CurrentSectionDraggedOver == this )
     {
         Color h = SystemColors.Highlight;
         Color c = Color.FromArgb( h.A / 3, h.R, h.G, h.B );
         using( SolidBrush brush = new SolidBrush( c ) )
         {
             gs.Graphics.FillRectangle( brush, Rectangle );
         }
     }
     else if( ListControl.AlternatingRowColor != Color.Empty && Position % 2 == 0 && RowIdentifier.GroupColumns.Length == 0 )
     {
         gs.Graphics.FillRectangle( new SolidBrush( ListControl.AlternatingRowColor ), Rectangle );
     }
 }
예제 #37
0
 public override Size GetIdealSize( GraphicsSettings gs )
 {
     return new Size( Image.Width + 2, Image.Height + 2 );
 }
예제 #38
0
 public override void Layout( GraphicsSettings gs, Size maximumSize )
 {
     base.Layout( gs, maximumSize );
     Size = new Size( Size.Width, Children.Count == 0 ? 0 : Children[Children.Count - 1].Rectangle.Bottom - Rectangle.Top );
 }
예제 #39
0
        public override void Paint( GraphicsSettings gs, Rectangle clipRect )
        {
            //
            // Fill indent area
            if( Children.Count > 0 )
            {
                Rectangle rc = HostBasedRectangle;
                Rectangle rcIndent = new Rectangle( rc.X, Rectangle.Y, Children[0].HostBasedRectangle.X - rc.X, rc.Height );

                PaintIndentArea( gs.Graphics, rcIndent );
            }

            base.Paint( gs, clipRect );

            Rectangle rcLine = Rectangle;
            rcLine.X += IndentWidth;
            PaintSeparatorLine( gs.Graphics, rcLine );
        }
예제 #40
0
    protected virtual void buildObject(int level)
    {
        _sprite = gameObject.GetComponent<tk2dAnimatedSprite>();

        settings = graphicSettings[level];

        level = level;

        ContentManager.instance.configureObject(_sprite, settings.spriteAtlas, settings.defaultSprite);
        if (settings.animationAtlas != "")
            ContentManager.instance.precacheAnimation(_sprite, settings.animationAtlas);

        if (zSort)
        {
            Vector3 position = gameObject.transform.localPosition;
            position.z = (((position.y-_sprite.GetBounds().size.y/2)*0.01f))+.01f;
            gameObject.transform.localPosition = position;
        }

        if (gameObject.GetComponent<BoxCollider>() == null)
        {
            BoxCollider box = gameObject.AddComponent<BoxCollider>();
            box.size = new Vector3(_sprite.GetBounds().size.x, _sprite.GetBounds().size.y, 1);
        }
    }
예제 #41
0
        public override void Paint(GraphicsSettings gs, Rectangle clipRect)
        {
            for (int i = 0; i < ExcludeFirstChildrenFromVScroll; i++)
            {
                Children[i].Paint(gs, clipRect);
            }

            GraphicsContainer container = gs.Graphics.BeginContainer();
            try
            {
                using (Region clipRegion = new Region(clipRect))
                {
                    clipRegion.Intersect(WorkingRectangle);
                    gs.Graphics.Clip = clipRegion;
                    for (int i = ExcludeFirstChildrenFromVScroll; i < Children.Count; i++)
                    {
                        Section s = Children[i];
                        if (clipRect.IntersectsWith(s.HostBasedRectangle))
                        {
                            s.Paint(gs, clipRect);
                        }
                    }
                }
            }
            finally
            {
                gs.Graphics.EndContainer(container);
            }
        }
예제 #42
0
        /// <summary>
        /// Initializes the game.
        /// </summary>
        protected override void Initialize()
        {
            Logger.Trace("init()"); // log the init.
            this.Window.Title = string.Format("Voxeliq [{0}/{1}]", PlatformInfo.GameFramework, PlatformInfo.GraphicsApi); // set the window title.

            this.IsMouseVisible = false;

            // read settings.
            var audioSettings = new AudioSettings();
            var graphicsSettings = new GraphicsSettings();

            // create a new engine configuration.
            var config = new EngineConfig
            {
                Chunk =
                {
                    WidthInBlocks = 16,
                    HeightInBlocks = 128,
                    LenghtInBlocks = 16,
                },
                Cache =
                {
                    CacheExtraChunks = true,
                    ViewRange = 8,
                    CacheRange = 12,
                },
                Graphics =
                {
                    Width = graphicsSettings.Width,
                    Height = graphicsSettings.Height,
                    FullScreenEnabled = graphicsSettings.FullScreenEnabled,
                    VerticalSyncEnabled = graphicsSettings.VerticalSyncEnabled,
                    FixedTimeStepsEnabled = graphicsSettings.FixedTimeStepsEnabled,
                },
                World =
                {
                    IsInfinitive = true,
                },
                Debugging =
                {
                    GraphsEnabled = true,
                },
                Bloom =
                {
                    Enabled = false,
                    State = BloomState.Default,
                },
                Audio =
                {
                    Enabled = audioSettings.Enabled,
                }
            };

            var engine = new Engine(this, config);
            this.ScreenManager = new GraphicsManager(this._graphicsDeviceManager, this); // start the screen manager.

            engine.EngineStart += OnEngineStart;

            engine.Run();

            base.Initialize();
        }
예제 #43
0
        protected virtual void DrawSortArrow( GraphicsSettings gs, Rectangle rc )
        {
            if( !_column.ShowHeaderSortArrow )
            {
                return;
            }

            if( rc.Width <= 0 )
            {
                return;
            }

            int offset = 0;

            if( Parent.LayoutController != null )
            {
                offset = Parent.LayoutController.CurrentHorizontalScrollPosition;
            }
            //
            // Draw sort arrows
            const int halfArrowWidth = _arrowWidth / 2;
            int right = Rectangle.Right - offset;
            Rectangle rcArrow = new Rectangle( right - _arrowWidth - _arrowSpaceXMargin * 2,
                                                                                Rectangle.Y + (Rectangle.Height - _arrowWidth) / 2,
                                                                                _arrowWidth,
                                                                                _arrowWidth
                    );

            SortOrder sortOrder = Parent.GetColumnSortOrder( Column );

            switch( sortOrder )
            {
                case SortOrder.Ascending:
                    {
                        int xTop = rcArrow.Left + rcArrow.Width / 2 + 1;
                        int yTop = rcArrow.Top + (rcArrow.Height - halfArrowWidth) / 2 - 1;
                        int xLeft = xTop - halfArrowWidth;
                        int yLeft = yTop + halfArrowWidth + 1;
                        int xRight = xTop + halfArrowWidth + 1;
                        int yRight = yTop + halfArrowWidth + 1;

                        gs.Graphics.FillPolygon( SystemBrushes.ControlDark, new Point[]
                                                                               {
                                                                                   new Point(xTop, yTop),
                                                                                   new Point(xLeft, yLeft),
                                                                                   new Point(xRight, yRight)
                                                                               } );
                    }
                    break;
                case SortOrder.Descending:
                    {
                        int xBottom = rcArrow.Left + rcArrow.Width / 2 + 1;
                        int xLeft = xBottom - halfArrowWidth + 1;
                        int yLeft = rcArrow.Top + (rcArrow.Height - halfArrowWidth) / 2;
                        int xRight = xBottom + halfArrowWidth;
                        int yRight = rcArrow.Top + (rcArrow.Height - halfArrowWidth) / 2;
                        int yBottom = yRight + halfArrowWidth;

                        gs.Graphics.FillPolygon( SystemBrushes.ControlDark, new Point[]
                                                                               {
                                                                                   new Point(xLeft, yLeft),
                                                                                   new Point(xBottom, yBottom),
                                                                                   new Point(xRight, yRight)
                                                                               } );
                    }
                    break;
            }
        }
예제 #44
0
        public override void Paint( GraphicsSettings gs, Rectangle clipRect )
        {
            Rectangle rcText;
            GetDrawRectangles( out rcText, out _buttonRectangle );
            Rectangle rc = HostBasedRectangle;

            //
            // Fill indent area if any
            if( _groupIndentWidth > 0 )
            {
                Rectangle rcIndent = new Rectangle( rc.X, rc.Y, _groupIndentWidth, rc.Height );

                PaintIndentArea( gs.Graphics, rcIndent );
            }

            gs.Graphics.DrawIcon( DrawIcon, _buttonRectangle.X, _buttonRectangle.Y );

            GdiPlusEx.DrawString
                    ( gs.Graphics, Text, Font, (Host.FocusedSection == ListSection && IsSelected) ? SystemColors.HighlightText : ListControl.GroupSectionForeColor, rcText
                     , GdiPlusEx.Alignment.Left, ListControl.GroupSectionVerticalAlignment, GdiPlusEx.TextSplitting.SingleLineEllipsis, GdiPlusEx.Ampersands.Display );

            Rectangle rcLine = rc;
            rcLine.X += _groupIndentWidth;
            PaintSeparatorLine( gs.Graphics, rcLine );
        }
예제 #45
0
 public override void Layout( GraphicsSettings gs, Size maximumSize )
 {
     SizeF size = gs.Graphics.MeasureString( Text, Font );
     if( size.Height < MinimumHeight )
     {
         size.Height = MinimumHeight;
     }
     Size = new Size( HeaderSection.Rectangle.Width, (int)size.Height + _margin + _separatorLineHeight );
 }
예제 #46
0
        public void SizeColumnsToFit( params Column[] columns )
        {
            using( Graphics grfx = Host.CreateGraphics() )
            {
                GraphicsSettings grfxSettings = new GraphicsSettings( grfx );
                int[] columnWidths = new int[Columns.Count];
                int position = 0;

                HeaderColumnSection[] hcsSections = new HeaderColumnSection[columns.Length];
                for( int iColumn = 0; iColumn < columns.Length; iColumn++ )
                {
                    HeaderColumnSection hcs = Host.SectionFactory.CreateHeaderColumnSection( Host, HeaderColumnSection.DisplayMode.Customise, columns[iColumn] );
                    hcs.Layout( grfxSettings, new Size( int.MaxValue, int.MaxValue ) );
                    hcsSections[iColumn] = hcs;
                }

                Type[] lastColumnTypes = new Type[columns.Length];
                CellSection[] columnCellSections = new CellSection[columns.Length];

                //
                //	Pick the widest cell to be the width of the column.
                foreach( object rowItem in ItemList.ToArray() )
                {
                    for( int iColumn = 0; iColumn < columns.Length; iColumn++ )
                    {
                        Column column = columns[iColumn];
                        CellSection cs = columnCellSections[iColumn];
                        object columnItem = column.ColumnItemAccessor( rowItem );
                        Type lastColumnType = lastColumnTypes[iColumn] == null ? null : lastColumnTypes[iColumn].GetType();
                        if( lastColumnType == null || columnItem.GetType() != lastColumnType )
                        {
                            cs = columnCellSections[iColumn] = Host.SectionFactory.CreateCellSection( Host, hcsSections[iColumn], rowItem );
                            lastColumnTypes[iColumn] = columnItem.GetType();
                        }
                        cs.Item = rowItem;
                        Size size = cs.GetIdealSize( grfxSettings );
                        if( columnWidths[iColumn] < size.Width )
                        {
                            columnWidths[iColumn] = size.Width;
                        }
                    }
                    position++;
                }

                //
                //	Set columns widths...
                for( int iColumn = 0; iColumn < columns.Length; iColumn++ )
                {
                    columns[iColumn].Width = columnWidths[iColumn] == 0 ? hcsSections[iColumn].Size.Width : columnWidths[iColumn];
                }
            }
        }
예제 #47
0
 public override void Layout( GraphicsSettings gs, Size maximumSize )
 {
     const int margin = 2;
     SizeF size;
     if( HeaderColumnSection.Column.WrapText )
     {
         size = GdiPlusEx.MeasureString( gs.Graphics, DisplayItem.ToString(), Font, maximumSize.Width - 5 );
     }
     else
     {
         size = gs.Graphics.MeasureString( DisplayItem.ToString(), Font );
     }
     if( size.Height < MinimumHeight )
     {
         size.Height = MinimumHeight;
     }
     Size = new Size( maximumSize.Width, (int)size.Height + margin * 2 );
 }
예제 #48
0
        public override void PaintBackground(GraphicsSettings gs, Rectangle clipRect)
        {
            Rectangle rc = Rectangle;

            rc.Width += 2; // hide end vert bars

            if (VisualStyleRenderer.IsSupported)
            {
                VisualStyleRenderer vsr = new VisualStyleRenderer(VisualStyleElement.Header.Item.Normal);

                vsr.DrawBackground(gs.Graphics, rc);
            }
            else
            {
                gs.Graphics.FillRectangle(SystemBrushes.Control, rc);
                ControlPaint.DrawBorder3D(gs.Graphics, rc, Border3DStyle.Raised);
            }

            base.Paint(gs, clipRect);
        }
예제 #49
0
        public override void Paint( GraphicsSettings gs, Rectangle clipRect )
        {
            Rectangle rc = DrawRectangle;

            GdiPlusEx.TextSplitting textSplitting =
                    (HeaderColumnSection.Column.WrapText) ? GdiPlusEx.TextSplitting.MultiLine : GdiPlusEx.TextSplitting.SingleLineEllipsis;

            GdiPlusEx.DrawString
                    ( gs.Graphics,
                     DisplayItemString,
                     Font,
                     (Host.FocusedSection == ListSection && RowSection.IsSelected) ? SystemColors.HighlightText : Color,
                     rc,
                     GdiExAlignment, GdiExVerticalAlignment,
                     textSplitting, GdiPlusEx.Ampersands.Display );
        }
예제 #50
0
 protected virtual void DrawCaption( GraphicsSettings gs, Rectangle rc )
 {
     TextRendererEx.DrawText( gs.Graphics,
                                                     _column.Caption,
                                                     SystemFonts.MenuFont,
                                                     rc,
                                                     Color.Black,
                                                     GetTextFormatFlags() );
 }
예제 #51
0
 public override void Layout( GraphicsSettings gs, Size maximumSize )
 {
     base.Layout( gs, maximumSize );
     Size = new Size( maximumSize.Width, Size.Height );
 }
예제 #52
0
        public override void Paint( GraphicsSettings gs, Rectangle clipRect )
        {
            using( SolidBrush brush = new SolidBrush( Host.TextColor ) )
            {
                Rectangle rc = Rectangle;
                int offset = 0;

                if( Parent.LayoutController != null )
                {
                    offset = Parent.LayoutController.CurrentHorizontalScrollPosition;
                    rc.X -= offset;
                }

                if( _displayMode == DisplayMode.Header )
                {
                    if( VisualStyleRenderer.IsSupported )
                    {
                        VisualStyleRenderer renderer = GetRenderer();

                        renderer.DrawBackground( gs.Graphics, rc );
                    }
                    else
                    {
                        gs.Graphics.FillRectangle( SystemBrushes.Control, rc );

                        if( _leftMouseButtonPressed )
                        {
                            ControlPaint.DrawBorder3D( gs.Graphics, rc, Border3DStyle.Sunken );
                        }
                        else
                        {
                            ControlPaint.DrawBorder3D( gs.Graphics, rc, Border3DStyle.Raised );
                        }
                    }
                }
                else
                {
                    DrawBox( gs.Graphics, rc );
                }

                DrawIcon( gs.Graphics, ref rc );

                const int textMargin = 2;

                rc.X += textMargin;
                rc.Width -= textMargin;

                if( Parent.LayoutController != null )
                {
                    if( _column.ShowHeaderSortArrow )
                    {
                        rc.Width -= _arrowWidth + _arrowSpaceXMargin * 2;
                    }
                }

                rc.Y -= 2;

                DrawCaption( gs, rc );

                DrawSortArrow( gs, rc );
            }
        }
예제 #53
0
        public override void Layout( GraphicsSettings gs, Size maximumSize )
        {
            DeleteChildren();

            int bottom = Location.Y;

            foreach( Section s in _headerSection.Children )
            {
                HeaderColumnSection hcs = s as HeaderColumnSection;

                if( hcs != null )
                {
                    CellSection cellSection = Host.SectionFactory.CreateCellSection( Host, hcs, Item );

                    Children.Add( cellSection );

                    //
                    //	We position the cell aligned to its corresponding HeaderColumnSection. We nudge it to right here
                    //	based on any difference between the column size and the headers columns actual size. The only time there
                    //	will be a different currently is when we have multiple groups reserving initial space on the first column.
                    cellSection.Location = new Point( hcs.Location.X + hcs.Rectangle.Width - hcs.Column.Width, Location.Y );
                    cellSection.Layout( gs, new Size( hcs.Column.Width, maximumSize.Height ) );
                    bottom = Math.Max( bottom, cellSection.Rectangle.Bottom );
                }
            }
            int newHeigt = MinimumHeight;
            if( bottom - Rectangle.Top > MinimumHeight )
            {
                newHeigt = bottom - Rectangle.Top;
            }
            Size = new Size( HeaderSection.Rectangle.Width, newHeigt );
        }
예제 #54
0
        public override void Layout( GraphicsSettings gs, Size maximumSize )
        {
            const int widthPadding = 10;
            int headerWidth;
            int height;

            if( VisualStyleRenderer.IsSupported )
            {
                VisualStyleRenderer renderer = GetRenderer();

                height = renderer.GetPartSize( gs.Graphics, ThemeSizeType.True ).Height;
            }
            else
            {
                height = SystemFonts.DialogFont.Height + 6;
            }
            if( height > maximumSize.Height )
            {
                height = maximumSize.Height;
            }

            switch( _displayMode )
            {
                case DisplayMode.Header:
                    headerWidth = _column.Width;
                    break;
                case DisplayMode.Customise:
                    headerWidth = TextRenderer.MeasureText( _column.Caption, SystemFonts.MenuFont ).Width + widthPadding + _arrowWidth + _arrowSpaceXMargin * 2;
                    break;
                default:
                    throw new NotSupportedException();
            }
            if( height < MinimumHeight )
            {
                height = MinimumHeight;
            }
            Size = new Size( headerWidth, height );
        }
예제 #55
0
        public override void PaintBackground( GraphicsSettings gs, Rectangle clipRect )
        {
            PaintSelection( gs );
            _drawnSelected = IsSelected;

            if( IsFocused )
            {
                Rectangle rc = HostBasedRectangle;
                int indent = IndentWidth;
                Rectangle focusRect = new Rectangle( rc.X + indent, rc.Y, rc.Width - indent, Rectangle.Height );

                focusRect.Width -= 1;
                if( this is GroupSection )
                {
                    focusRect.Height -= _separatorLineHeight;
                }
                focusRect.Height -= 2;

                using( Pen pen = new Pen( SystemColors.ControlDark ) )
                {
                    pen.DashStyle = DashStyle.Dot;
                    gs.Graphics.DrawRectangle( pen, focusRect );
                }
            }
        }
예제 #56
0
        public override void Layout(GraphicsSettings gs, Size maximumSize)
        {
            base.Layout(gs, maximumSize);
            Point pt = Location;

            //
            // Default handling is to arrange down.
            foreach (Section s in Children)
            {
                s.Location = pt;
                s.Layout(gs, maximumSize);
                pt.Y = s.Rectangle.Bottom;
                maximumSize.Height -= s.Size.Height;
            }
        }
예제 #57
0
 protected override void DrawSortArrow( GraphicsSettings gs, Rectangle rc )
 {
     // do nothing.
 }
예제 #58
0
 public override void PaintBackground(GraphicsSettings gs, Rectangle clipRect)
 {
     foreach (Section s in Children)
     {
         if (clipRect.IntersectsWith(s.Rectangle))
         {
             s.PaintBackground(gs, clipRect);
         }
     }
 }
예제 #59
0
        public override void Paint(GraphicsSettings gs, Rectangle clipRect)
        {
            base.Paint(gs, clipRect);

            if (Children.Count == 0)
            {
                SizeF messageSize = gs.Graphics.MeasureString(_emptyGroupMessage, Host.Font);
                RectangleF rcDraw = new RectangleF(0, 0, messageSize.Width + _paintEmptyMessageMargin, messageSize.Height + _paintEmptyMessageMargin);

                rcDraw.Offset(5, (Rectangle.Height - rcDraw.Height)/2);

                StringFormat sf = new StringFormat(gs.DefaultStringFormat);
                sf.Alignment = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;

                gs.Graphics.FillRectangle(SystemBrushes.ButtonFace, rcDraw);
                gs.Graphics.DrawString(_emptyGroupMessage, Host.Font, Brushes.Gray, rcDraw, sf);
            }
            else
            {
                for (int i = 1; i < Children.Count; i++)
                {
                    Rectangle rcPrior = Children[i - 1].Rectangle;
                    Rectangle rcHcs = Children[i].Rectangle;

                    Point[] linkPoints = new Point[]
                        {
                            new Point(rcPrior.Right - 4, rcPrior.Bottom - 2),
                            new Point(rcPrior.Right - 4, rcHcs.Top + rcHcs.Height/2),
                            new Point(rcHcs.Left - 1, rcHcs.Top + rcHcs.Height/2),
                        };
                    gs.Graphics.DrawLines(Pens.Black, linkPoints);
                }
            }
        }
예제 #60
0
 public override void PaintBackground(GraphicsSettings gs, Rectangle clipRect)
 {
     gs.Graphics.FillRectangle(SystemBrushes.ControlDark, Rectangle);
     base.PaintBackground(gs, clipRect);
 }