当前位置: 首页>>代码示例>>C#>>正文


C# Property.Set方法代码示例

本文整理汇总了C#中Property.Set方法的典型用法代码示例。如果您正苦于以下问题:C# Property.Set方法的具体用法?C# Property.Set怎么用?C# Property.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Property的用法示例。


在下文中一共展示了Property.Set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StudioUI

        public StudioUI(Studio studio, Sequence sequence, Gui gui, Layer gridLayer, Layer uiLayer)
        {
            _gui = gui;

            // create layers
            var studioLayer = Add(new Layer());
            var annotationLayer = studioLayer.Add(new Layer());

            // fullscreen switch

            Add(new KeyBinding(Keys.F1, () => Render.Viewport.IsFullScreen = !Render.Viewport.IsFullScreen));

            // tool bars setup

            var panel = uiLayer.Add(new StackPanel(5) { Padding = new Margin() });
            var horizontalBar = panel.Add(new StackPanel(5) { Padding = new Margin(), Orientation = Orientation.Horizontal });
            //var verticalBar = panel.Add(new StackPanel(5));
            //uiLayer.Add(new BackgroundView(verticalBar));

            // time controls

            var timePanel = horizontalBar.Add(new StackPanel(5) { Orientation = Orientation.Horizontal });
            uiLayer.Add(new BackgroundView(timePanel));

            // camera
            var cameraMode = Add(new ToolUI());
            cameraMode.Add(new EditorCameraController());

            // editor mode / game mode switch

            var toolMode = new ToggleComponent(v =>
            {
                UI.ToolMode.Set(v);
                Hgl.Time.IsPaused = v;
                gui.Scene.IsFocusable = v;
                uiLayer.IsEnabled = v;
            });

            var pauseButton = timePanel.Add(new ToggleButton(toolMode) { Size = _buttonSize });
            uiLayer.Add(new ToggleButonView(pauseButton, DataPack.Textures.Studio.Pause, DataPack.Textures.Studio.Play));
            //Add(new PropertyRecorder<bool>("toolMode", toolMode));
            Add(new KeyBinding(Keys.Tab, toolMode.Toggle));
            Add(new KeyBinding(Keys.Q, Hgl.Time.TogglePause));

            // next frame

            var nextFrameButton = timePanel.Add(new Button(() => NextFrame(pauseButton)) { Size = _buttonSize });
            uiLayer.Add(new PressButtonView(nextFrameButton, DataPack.Textures.Studio.NextFrame));
            Add(new KeyBinding(Keys.E, nextFrameButton));

            // slow motion

            var slowMo = Add(new SlowMotion(pauseButton));
            var slowMoButton = timePanel.Add(new Button(slowMo.Start, slowMo.Stop) { Size = _buttonSize });
            uiLayer.Add(new PressButtonView(slowMoButton, DataPack.Textures.Studio.SlowMotion));
            Add(new KeyBinding(Keys.R, slowMoButton));

            // sequence

            var seqPanel = horizontalBar.Add(new StackPanel(5) { Orientation = Orientation.Horizontal });
            uiLayer.Add(new BackgroundView(seqPanel));

            var previousButton = seqPanel.Add(new Button(sequence.Previous) { Size = _buttonSize });
            uiLayer.Add(new PressButtonView(previousButton, DataPack.Textures.Studio.Previous));
            Add(new KeyBinding(Keys.OemMinus, previousButton));

            var nextButton = seqPanel.Add(new Button(sequence.Next) { Size = _buttonSize });
            uiLayer.Add(new PressButtonView(nextButton, DataPack.Textures.Studio.Next));
            Add(new KeyBinding(Keys.OemPlus, nextButton));

            var reloadButton = seqPanel.Add(new Button(() => ReloadCurrentScene(sequence)) { Size = _buttonSize });
            uiLayer.Add(new PressButtonView(reloadButton, DataPack.Textures.Studio.Reload));
            Add(new KeyBinding(Keys.Back, reloadButton));

            // tool bar

            var toolBar = horizontalBar.Add(new StackPanel(5) { Orientation = Orientation.Horizontal });
            uiLayer.Add(new BackgroundView(toolBar));

            // camera home position

            var homePosition = new Property<Vector2>();
            uiLayer.Add(new PropertyRecorder<Vector2>("homePosition", homePosition));
            uiLayer.Add(new KeyBinding(Keys.End, () => homePosition.Set(Render.Camera.Position)));
            uiLayer.Add(new KeyBinding(Keys.Home, () => Render.Camera.Position = homePosition.Get()));

            // grid

            var grid = new Node
                       {
                           new Grid(Color.White, size: .1f, minZoomLevel: .02f, fullZoomLevel: 9f),
                           new Grid(Color.White, size: 1, minZoomLevel: .008f, fullZoomLevel: .8f),
                           new Grid(Color.White, size: 10, minZoomLevel: .005f, fullZoomLevel: .1f),
                           new Grid(Color.White, size: 100, minZoomLevel: .001f, fullZoomLevel: .01f),
                           new Grid(Color.White, size: 1000, minZoomLevel: .0001f, fullZoomLevel: .001f),
                       };

            var gridSwitch = new ToggleComponent(() => gridLayer.Add(grid), () => gridLayer.Remove(grid));
            var gridControl = toolBar.Add(new ToggleButton(gridSwitch) { Size = _buttonSize });
            Add(gridControl);
//.........这里部分代码省略.........
开发者ID:hgrandry,项目名称:Mgx,代码行数:101,代码来源:StudioUI.cs


注:本文中的Property.Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。