Ejemplo n.º 1
0
        public override bool IsHandleClick(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler, long lMillisecond)
        {
            int  y1      = 1;
            int  y2      = ruler.HeaderOffset / 2;
            int  x1      = ruler.ScaleValueToPixel((double)lMillisecond) - (y2 / 2) - 1;
            int  x2      = x1 + y2;
            bool bRetVal = false;

            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                if ((e.X >= x1) && (e.X <= x2) && (e.Y >= y1) && (e.Y <= y2))
                {
                    bRetVal = true;
                }
            }
            else
            {
                if ((e.Y >= x1) && (e.Y <= x2) && (e.X >= y1) && (e.X <= y2))
                {
                    bRetVal = true;
                }
            }

            return(bRetVal);
        }
Ejemplo n.º 2
0
        public override void Draw(Graphics g, TimeRuler ruler)
        {
            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                int iSecondPos = ruler.ScaleValueToPixel((double)_StartMillisecond);
                int x = iSecondPos - 1;
                int y1 = ruler.HeaderOffset / 2, y2 = ruler.Height;
                g.DrawLine(new Pen(new SolidBrush(this.Color), 3), x, y1, x, y2);

                Point   left           = new Point(iSecondPos - y1, 1);
                Point   right          = new Point(iSecondPos + y1, 1);
                Point   bottom         = new Point(iSecondPos, ruler.HeaderOffset / 2);
                Point[] trianglePoints = { left, right, bottom };
                g.FillPolygon(new SolidBrush(this.Color), trianglePoints, System.Drawing.Drawing2D.FillMode.Winding);

                g.DrawPolygon(new Pen(new SolidBrush(ruler.ForeColor)), trianglePoints);
            }
            else
            {
                int iSecondPos = ruler.ScaleValueToPixel((double)_StartMillisecond);
                int y = iSecondPos - 1;
                int x1 = ruler.HeaderOffset / 2, x2 = ruler.Height;
                g.DrawLine(new Pen(new SolidBrush(this.Color), 3), x1, y, x2, y);

                Point   left           = new Point(1, iSecondPos - x1);
                Point   right          = new Point(1, iSecondPos + x1);
                Point   bottom         = new Point(ruler.HeaderOffset / 2, iSecondPos);
                Point[] trianglePoints = { left, right, bottom };
                g.FillPolygon(new SolidBrush(this.Color), trianglePoints, System.Drawing.Drawing2D.FillMode.Winding);

                g.DrawPolygon(new Pen(new SolidBrush(ruler.ForeColor)), trianglePoints);
            }
        }
Ejemplo n.º 3
0
        public virtual int DistanceFromHandle(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler, long lMillisecond)
        {
            int iMousePosition = ((ruler.Orientation == enumOrientation.orHorizontal) ? e.X : e.Y);
            int x = ruler.ScaleValueToPixel((double)lMillisecond);

            return(Math.Abs(x - iMousePosition));
        }
Ejemplo n.º 4
0
        public override void MoveFrame(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler)
        {
            int  iMousePosition  = ((ruler.Orientation == enumOrientation.orHorizontal) ? e.X : e.Y);
            long lNewMillisecond = (long)ruler.PixelToScaleValue(iMousePosition);

            if (lNewMillisecond > ruler.CurrentMillisecond)
            {
                int iStartDist = DistanceFromHandle(e, ruler, _StartMillisecond);
                int iEndDist   = DistanceFromHandle(e, ruler, _EndMillisecond);

                if (iStartDist < iEndDist)
                {
                    if (_StartMillisecond > ruler.CurrentMillisecond &&
                        !ruler.KeyFrames.Overlaps(lNewMillisecond, this._EndMillisecond, this))
                    {
                        _StartMillisecond = lNewMillisecond;
                    }
                }
                else
                {
                    if (_EndMillisecond > ruler.CurrentMillisecond &&
                        !ruler.KeyFrames.Overlaps(this._StartMillisecond, lNewMillisecond, this))
                    {
                        _EndMillisecond = lNewMillisecond;
                    }
                }

                ruler.RedrawBitmap();
            }
        }
Ejemplo n.º 5
0
        public virtual void Draw(Graphics g, TimeRuler ruler)
        {
            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                int x = ruler.ScaleValueToPixel((double)_StartMillisecond) - 1;
                int y1 = ruler.HeaderOffset, y2 = ruler.Height;
                g.DrawLine(_DrawingPen, x, y1, x, y2);

                y1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1 - 1;
                x  = ruler.ScaleValueToPixel((double)_StartMillisecond) - (y2 / 2) - 1;
                g.DrawEllipse(new Pen(new SolidBrush(ruler.ForeColor)), x, y1, y2, y2);
                g.FillEllipse(_DrawingBrush, x, y1, y2, y2);
            }
            else
            {
                int y = ruler.ScaleValueToPixel((double)_StartMillisecond) - 1;
                int x1 = ruler.HeaderOffset, x2 = ruler.Height;
                g.DrawLine(_DrawingPen, x1, y, x2, y);

                x1 = ruler.HeaderOffset / 2;
                x2 = ruler.HeaderOffset - x1 - 1;
                y  = ruler.ScaleValueToPixel((double)_StartMillisecond) - (x2 / 2) - 1;
                g.DrawEllipse(new Pen(new SolidBrush(ruler.ForeColor)), x1, y, x2, x2);
                g.FillEllipse(_DrawingBrush, x1, y, x2, x2);
            }
        }
        void UpdateClientTimeRuler(DevExpress.Web.ASPxScheduler.DayView view)
        {
            TimeRuler ruler = view.TimeRulers[0];
            string    tzId  = ASPxScheduler1.OptionsBehavior.ClientTimeZoneId;

            ruler.TimeZoneId = tzId;
            ruler.Caption    = String.Format("Client: {0}", tzId);
        }
Ejemplo n.º 7
0
        public virtual bool CanBeMoved(TimeRuler ruler)
        {
            if ((_StartMillisecond <= ruler.ActualMillisecond) || (_EndMillisecond <= ruler.ActualMillisecond))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 8
0
        public DiagnosticsManager(Game game)
        {
            ui      = new DiagnosticsUI(game, this);
            host    = new DiagnosticsCommandHost(ui);
            fps     = new FPSCounter(game, this);
            ruler   = new TimeRuler(game, this);
            factory = new GameComponentFactory(game, this);

            InitBasicCommands();
        }
Ejemplo n.º 9
0
 public void Update(float elapsedTime)
 {
     TimeRuler.RenderOffsetX = CurViewOffsetX;
     TimeRuler.Update(elapsedTime);
     foreach (var ln in Lines.Values)
     {
         ln.RenderOffsetX = CurViewOffsetX;
         ln.Update(elapsedTime);
     }
 }
Ejemplo n.º 10
0
        public KeyFrameCollection(TimeRuler ruler)
        {
            // Must provide a valid manager instance
            if (ruler == null)
            {
                throw new ArgumentNullException("TimeRuler");
            }

            // Default the state
            _Ruler = ruler;
        }
Ejemplo n.º 11
0
        public virtual void MoveFrame(long lStart, long lEnd, TimeRuler ruler)
        {
            if (lStart > ruler.ActualMillisecond &&
                _StartMillisecond > ruler.ActualMillisecond &&
                !ruler.KeyFrames.Overlaps(lStart, lStart, this))
            {
                _StartMillisecond = lStart;
                _EndMillisecond   = _StartMillisecond;

                ruler.RedrawBitmap();
            }
        }
Ejemplo n.º 12
0
 public virtual bool IsHandleClick(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler)
 {
     if (IsHandleClick(e, ruler, _StartMillisecond))
     {
         return(true);
     }
     if (IsHandleClick(e, ruler, _EndMillisecond))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 13
0
        public override void MoveFrame(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler)
        {
            int  iMousePosition  = ((ruler.Orientation == enumOrientation.orHorizontal) ? e.X : e.Y);
            long lNewMillisecond = (long)ruler.PixelToScaleValue(iMousePosition);

            if (lNewMillisecond < ruler.ActualMillisecond)
            {
                _StartMillisecond = lNewMillisecond;
                _EndMillisecond   = _StartMillisecond;

                ruler.RedrawBitmap();
            }
        }
Ejemplo n.º 14
0
        private void OnEngineStart(object sender, System.EventArgs e)
        {
            this._timeRuler = new TimeRuler(this)
            {
                Visible = true, ShowLog = true
            };
            this.Components.Add(this._timeRuler);

        #if XNA
            this._bloomComponent = new BloomComponent(this);
            this.Components.Add(this._bloomComponent);
        #endif
        }
Ejemplo n.º 15
0
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._chunkStorage = (IChunkStorage)this.Game.Services.GetService(typeof(IChunkStorage));
            this._camera       = (ICamera)this.Game.Services.GetService(typeof(ICamera));
            this._player       = (IPlayer)this.Game.Services.GetService(typeof(IPlayer));
            this._fogger       = (IFogger)this.Game.Services.GetService(typeof(IFogger));
            this.VertexBuilder = (IVertexBuilder)this.Game.Services.GetService(typeof(IVertexBuilder));
            this._timeRuler    = (TimeRuler)this.Game.Services.GetService(typeof(TimeRuler));

            this.Generator = new BiomedTerrain(new RainForest());
            base.Initialize();
        }
Ejemplo n.º 16
0
 public MainGame()
 {
     Content.RootDirectory = "Content"; // set content root directory
     var graphicsDeviceManager = new GraphicsDeviceManager(this)
     {
         PreferredBackBufferHeight = 720,
         PreferredBackBufferWidth = 1440
     };
     #if DEBUG
     m_timeRuler = new TimeRuler(this)
     {
         Visible = true,
         ShowLog = true
     };
     #endif
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Adds game-components.
        /// </summary>
        private void AddComponents()
        {
            this.Components.Add(new InputManager(this));

            this.Components.Add(new AssetManager(this));

            #if XNA
            this.Components.Add(new Sky(this));
            #endif

            this.Components.Add(new Fogger(this));

            var chunkStorage = new ChunkStorage(this);
            this.Components.Add(chunkStorage);

            var vertexBuilder = new VertexBuilder(this);
            this.Components.Add(vertexBuilder);

            var chunkCache = new ChunkCache(this);
            this.Components.Add(chunkCache);

            var world = new World(this, chunkStorage, chunkCache);
            this.Components.Add(world);

            this.Components.Add(new Player(this, world));

            #if XNA
            bloom = new BloomComponent(this);
            this.Components.Add(bloom);
            #endif

            this.Components.Add(new Camera(this));
            this.Components.Add(new UserInterface(this));

            this.Components.Add(new InGameDebugger(this));
            this.Components.Add(new Statistics(this));
            this.Components.Add(new GraphManager(this));

            #if XNA
            this.Components.Add(new AudioManager(this));
            #endif

            this._timeRuler         = new TimeRuler(this);
            this._timeRuler.Visible = true;
            this._timeRuler.ShowLog = true;
            this.Components.Add(this._timeRuler);
        }
Ejemplo n.º 18
0
        public override void MoveFrame(long lStart, long lEnd, TimeRuler ruler)
        {
            if (lStart > ruler.CurrentMillisecond && lEnd > ruler.CurrentMillisecond)
            {
                if (_StartMillisecond > ruler.CurrentMillisecond &&
                    !ruler.KeyFrames.Overlaps(lStart, this._EndMillisecond, this))
                {
                    _StartMillisecond = lStart;
                }

                if (_EndMillisecond > ruler.CurrentMillisecond &&
                    !ruler.KeyFrames.Overlaps(this._StartMillisecond, lEnd, this))
                {
                    _EndMillisecond = lEnd;
                }

                ruler.RedrawBitmap();
            }
        }
Ejemplo n.º 19
0
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._chunkStorage = (IChunkStorage) this.Game.Services.GetService(typeof (IChunkStorage));
            this._camera = (ICamera) this.Game.Services.GetService(typeof (ICamera));
            this._player = (IPlayer) this.Game.Services.GetService(typeof (IPlayer));
            this._fogger = (IFogger) this.Game.Services.GetService(typeof (IFogger));
            this.VertexBuilder = (IVertexBuilder) this.Game.Services.GetService(typeof (IVertexBuilder));            
            this._timeRuler = (TimeRuler) this.Game.Services.GetService(typeof (TimeRuler));

            this._assetManager = (IAssetManager)this.Game.Services.GetService(typeof(IAssetManager));
            if (this._assetManager == null)
                throw new NullReferenceException("Can not find asset manager component.");

            this.Generator = new BiomedTerrain(new RainForest());
            base.Initialize();
        }
Ejemplo n.º 20
0
        protected override void Initialize()
        {
            // マウス カーソルを可視にします。
            IsMouseVisible = true;

            // UIManager を初期化して登録します。
            uiManager = new UIManager(this);
            uiManager.ScreenFactory = CreateScreenFactory();
            Components.Add(uiManager);

            // StorageManager を登録します。
            storageManager = new StorageManager(this);
            Components.Add(storageManager);

            // StorageBlockManager を登録します。
            storageBlockManager = new StorageBlockManager(this);

            #region Debug

            var fpsCounter = new FpsCounter(this);
            fpsCounter.Content.RootDirectory = "Content";
            fpsCounter.HorizontalAlignment   = DebugHorizontalAlignment.Left;
            fpsCounter.SampleSpan            = TimeSpan.FromSeconds(2);
            Components.Add(fpsCounter);

            timeRuler = new TimeRuler(this);
            Components.Add(timeRuler);

            updateMarker          = timeRuler.CreateMarker();
            updateMarker.Name     = "Update";
            updateMarker.BarIndex = 0;
            updateMarker.Color    = Color.Cyan;

            drawMarker          = timeRuler.CreateMarker();
            drawMarker.Name     = "Draw";
            drawMarker.BarIndex = 1;
            drawMarker.Color    = Color.Yellow;

            #endregion

            base.Initialize();
        }
Ejemplo n.º 21
0
        public static void Initialize(Game g)
        {
            _debugManager = new DebugManager(g);
            g.Components.Add(_debugManager);

            _debugCommandUI           = new DebugCommandUI(g);
            _debugCommandUI.DrawOrder = int.MaxValue;
            g.Components.Add(_debugCommandUI);

            _fpsCounter = new FpsCounter(g);
            g.Components.Add(_fpsCounter);

            _memTracker = new MemoryTracker(g);
            g.Components.Add(_memTracker);

            _currentRuler = new TimeRuler(g);
            g.Components.Add(_currentRuler);

            _timeHistory = new TimeHistory(g, _currentRuler);
            g.Components.Add(_timeHistory);
        }
Ejemplo n.º 22
0
        protected override void Initialize()
        {
            var fpsCounter = new FpsCounter(this);

            fpsCounter.Content.RootDirectory = "Content";
            fpsCounter.HorizontalAlignment   = DebugHorizontalAlignment.Right;
            fpsCounter.SampleSpan            = TimeSpan.FromSeconds(2);
            Components.Add(fpsCounter);

            timeRuler = new TimeRuler(this);
            Components.Add(timeRuler);

            updateMarker          = timeRuler.CreateMarker();
            updateMarker.Name     = "Draw";
            updateMarker.BarIndex = 0;
            updateMarker.Color    = Color.Cyan;

            drawMarker          = timeRuler.CreateMarker();
            drawMarker.Name     = "Draw";
            drawMarker.BarIndex = 1;
            drawMarker.Color    = Color.Yellow;

            // テスト用にメモリ上で Block データを作ります。
            //var block = CreateFullFilledBlock();
            var block = CreateOctahedronLikeBlock();

            using (var stream = new MemoryStream())
            {
                blockSerializer.Serialize(stream, block);
                blockData = Encoding.ASCII.GetString(stream.ToArray());
            }

            UpdateStatusString();

            base.Initialize();
        }
Ejemplo n.º 23
0
        public override void EndMove(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler)
        {
            int  iMousePosition  = ((ruler.Orientation == enumOrientation.orHorizontal) ? e.X : e.Y);
            long lNewMillisecond = (long)ruler.PixelToScaleValue(iMousePosition);

            KeyFrame keyClosest = ruler.KeyFrames.FindClosest(KeyFrame.enumKeyFrameType.Snapshot, lNewMillisecond, true);

            //If we can not find a single frame close to the current end position that is within the current time zone then move
            //it back to the currenttime. Otherwise move it to the closest key frame.
            if (keyClosest != null)
            {
                SetTimes(keyClosest.StartMillisecond);
                ruler.CurrentMillisecond = keyClosest.StartMillisecond;
                ruler.OnCurrentFrameMoved(keyClosest);
            }
            else
            {
                SetTimes(ruler.ActualMillisecond);
                ruler.CurrentMillisecond = ruler.ActualMillisecond;
                ruler.OnCurrentFrameMoved(null);
            }

            ruler.RedrawBitmap();
        }
Ejemplo n.º 24
0
        public void Draw(GraphicsDevice device)
        {
            device.Clear(Color.Black);
            ConfirmUsingEffect(device);
            UsingEffect.Begin();
            device.Viewport = PanelViewport;
            foreach (EffectPass pass in UsingEffect.CurrentTechnique.Passes)
            {
                pass.Begin();
                foreach (var ln in Lines.Values)
                {
                    ln.Draw(device);
                }
                TimeRuler.Draw(device);
                pass.End();
            }
            UsingEffect.End();

            var rect     = device.Viewport.TitleSafeArea;
            var rectDest = device.Viewport.TitleSafeArea;

            rectDest.X -= CurViewOffsetX;
            device.Present(rect, rectDest, (IntPtr)ParentPanel.Handle);
        }
Ejemplo n.º 25
0
        private void LoadScheduler()
        {
            if (IterationScheduler != null)
            {
                return;
            }
            IterationScheduler = new SchedulerControl();
            this.layoutControlItem1.Control     = IterationScheduler;
            this.layoutControlItem1.TextVisible = false;
            this.dataLayoutControl1.Controls.Add(IterationScheduler);

            IterationScheduler.ActiveViewType = DevExpress.XtraScheduler.SchedulerViewType.Gantt;
            IterationScheduler.GroupType      = DevExpress.XtraScheduler.SchedulerGroupType.Resource;
            IterationScheduler.Name           = "IterationScheduler";
            IterationScheduler.Start          = new System.DateTime(2012, 7, 1, 0, 0, 0, 0);
            IterationScheduler.Storage        = this.schedulerStorage1;
            IterationScheduler.ActiveView.ResourcesPerPage = 4;

            //timeRuler1
            TimeRuler timeRuler1 = new TimeRuler();

            timeRuler1.TimeZone.DaylightBias = System.TimeSpan.Parse("-01:00:00");
            timeRuler1.TimeZone.UtcOffset    = System.TimeSpan.Parse("08:00:00");
            timeRuler1.UseClientTimeZone     = false;

            //timeScaleYear1
            TimeScaleYear timeScaleYear1 = new TimeScaleYear();

            timeScaleYear1.Enabled = false;

            //timeScaleQuarter1
            TimeScaleQuarter timeScaleQuarter1 = new TimeScaleQuarter();

            timeScaleQuarter1.Enabled = false;

            //timeScaleMonth1
            TimeScaleMonth timeScaleMonth1 = new TimeScaleMonth();

            timeScaleMonth1.Visible = false;

            //timeScaleWeek1
            TimeScaleWeek timeScaleWeek1 = new TimeScaleWeek();

            timeScaleWeek1.DisplayFormat = "MMMM dd";
            timeScaleWeek1.Width         = 120;

            //timeScaleDay1
            TimeScaleDay timeScaleDay1 = new TimeScaleDay();

            timeScaleDay1.Enabled = false;
            timeScaleDay1.Visible = false;
            timeScaleDay1.Width   = 28;

            //timeScaleHour1
            TimeScaleHour timeScaleHour1 = new TimeScaleHour();

            timeScaleHour1.Enabled = false;

            // timeScaleFixedInterval1
            TimeScaleFixedInterval timeScaleFixedInterval1 = new TimeScaleFixedInterval();

            timeScaleFixedInterval1.Enabled = false;


            IterationScheduler.Views.DayView.TimeRulers.Add(timeRuler1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleYear1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleQuarter1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleMonth1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleWeek1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleDay1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleHour1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleFixedInterval1);
            this.IterationScheduler.Views.GanttView.ShowResourceHeaders = false;

            //timeScaleYear2
            TimeScaleYear timeScaleYear2 = new DevExpress.XtraScheduler.TimeScaleYear();

            timeScaleYear2.Enabled = false;

            //timeScaleQuarter2
            TimeScaleQuarter timeScaleQuarter2 = new TimeScaleQuarter();

            timeScaleQuarter2.Enabled = false;

            //timeScaleMonth2
            TimeScaleMonth timeScaleMonth2 = new TimeScaleMonth();

            timeScaleMonth2.Enabled = false;

            //timeScaleWeek2
            TimeScaleWeek timeScaleWeek2 = new TimeScaleWeek();

            timeScaleWeek2.DisplayFormat = "yyyy-MM-dd";

            //timeScaleDay2
            TimeScaleDay timeScaleDay2 = new TimeScaleDay();

            timeScaleDay2.Visible = false;
            timeScaleDay2.Width   = 20;

            //timeScaleHour2
            TimeScaleHour timeScaleHour2 = new TimeScaleHour();

            timeScaleHour2.Enabled = false;

            //timeScaleFixedInterval2
            TimeScaleFixedInterval timeScaleFixedInterval2 = new TimeScaleFixedInterval();

            timeScaleFixedInterval2.Enabled = false;

            //timeRuler2
            TimeRuler timeRuler2 = new TimeRuler();

            timeRuler2.TimeZone.DaylightBias = System.TimeSpan.Parse("-01:00:00");
            timeRuler2.TimeZone.UtcOffset    = System.TimeSpan.Parse("08:00:00");
            timeRuler2.UseClientTimeZone     = false;

            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleYear2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleQuarter2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleMonth2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleWeek2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleDay2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleHour2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleFixedInterval2);
            this.IterationScheduler.Views.WorkWeekView.TimeRulers.Add(timeRuler2);
            this.resourcesTree1.SchedulerControl = IterationScheduler;
        }
Ejemplo n.º 26
0
        protected override void Initialize()
        {
            // UIManager を初期化して登録します。
            uiManager = new UIManager(this);
            uiManager.ScreenFactory = CreateScreenFactory();
            Components.Add(uiManager);

            var fpsCounter = new FpsCounter(this);

            fpsCounter.Content.RootDirectory = "Content";
            fpsCounter.HorizontalAlignment   = DebugHorizontalAlignment.Right;
            fpsCounter.SampleSpan            = TimeSpan.FromSeconds(2);
            Components.Add(fpsCounter);

            timeRuler = new TimeRuler(this);
            Components.Add(timeRuler);

            updateMarker          = timeRuler.CreateMarker();
            updateMarker.Name     = "Update";
            updateMarker.BarIndex = 0;
            updateMarker.Color    = Color.Cyan;

            drawMarker          = timeRuler.CreateMarker();
            drawMarker.Name     = "Draw";
            drawMarker.BarIndex = 1;
            drawMarker.Color    = Color.Yellow;

            // StorageManager を登録します。
            storageManager = new StorageManager(this);
            storageManager.ContainerSelected += (s, c) =>
            {
                // IBoxService が登録されているならば BoxIntegration を初期化します。
                if (boxManager != null)
                {
                    BoxIntegration.Initialize();
                }
            };
            Components.Add(storageManager);

            // StorageBlockManager を登録します。
            storageBlockManager = new StorageBlockManager(this);

            // AsyncTaskManager を登録します。
            asyncTaskManager = new AsyncTaskManager(this);
            Components.Add(asyncTaskManager);

            // IBoxService を登録します。
            var assemblyFile    = "Willcraftia.Net.Box.BlockViewer.ApiKey.dll";
            var apiKeyClassName = "Willcraftia.Net.Box.BlockViewer.ApiKey";

            try
            {
                boxManager = new BoxManager(assemblyFile, apiKeyClassName);
                Services.AddService(typeof(IBoxService), boxManager);

                BoxIntegration = new BoxIntegration(this);
            }
            catch
            {
                // IBoxService を無効とします。
            }

            // マウス カーソルを可視にします。
            IsMouseVisible = true;

            base.Initialize();
        }
Ejemplo n.º 27
0
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._chunkStorage = (IChunkStorage) this.Game.Services.GetService(typeof (IChunkStorage));
            this._camera = (ICamera) this.Game.Services.GetService(typeof (ICamera));
            this._player = (IPlayer) this.Game.Services.GetService(typeof (IPlayer));
            this._fogger = (IFogger) this.Game.Services.GetService(typeof (IFogger));
            this.VertexBuilder = (IVertexBuilder) this.Game.Services.GetService(typeof (IVertexBuilder));
            this._timeRuler = (TimeRuler) this.Game.Services.GetService(typeof (TimeRuler));

            this._assetManager = (IAssetManager)this.Game.Services.GetService(typeof(IAssetManager));
            if (this._assetManager == null)
                throw new NullReferenceException("Can not find asset manager component.");

            this.Generator = new BiomedTerrain(new RainForest());
            base.Initialize();
        }
Ejemplo n.º 28
0
        public override void Draw(Graphics g, TimeRuler ruler)
        {
            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                int x1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - 1;
                int y1 = ruler.HeaderOffset, y2 = ruler.Height;
                g.DrawLine(_DrawingPen, x1, y1, x1, y2);

                x1 = ruler.ScaleValueToPixel((double)_EndMillisecond) - 1;
                y1 = ruler.HeaderOffset;
                y2 = ruler.Height;
                g.DrawLine(_DrawingPen, x1, y1, x1, y2);

                y1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1;
                x1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - 2;
                int x2 = ruler.ScaleValueToPixel((double)_EndMillisecond);
                x2 = x2 - x1;
                g.DrawRectangle(new Pen(new SolidBrush(ruler.ForeColor)), x1, y1, x2, y2);
                g.FillRectangle(_DrawingBrush, x1, y1, x2, y2);

                y1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1;
                x1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - (y2 / 2) - 1;
                g.FillRectangle(new SolidBrush(ruler.ForeColor), x1, y1, y2, y2);

                y1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1;
                x1 = ruler.ScaleValueToPixel((double)_EndMillisecond) - (y2 / 2) - 1;
                g.FillRectangle(new SolidBrush(ruler.ForeColor), x1, y1, y2, y2);
            }
            else
            {
                int y1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - 1;
                int x1 = ruler.HeaderOffset, x2 = ruler.Width;
                g.DrawLine(_DrawingPen, x1, y1, x2, y1);

                y1 = ruler.ScaleValueToPixel((double)_EndMillisecond) - 1;
                x1 = ruler.HeaderOffset;
                x2 = ruler.Height;
                g.DrawLine(_DrawingPen, x1, y1, x2, y1);

                x1 = ruler.HeaderOffset / 2;
                x2 = ruler.HeaderOffset - x1;
                y1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - 2;
                int y2 = ruler.ScaleValueToPixel((double)_EndMillisecond);
                y2 = y2 - y1;
                g.DrawRectangle(new Pen(new SolidBrush(ruler.ForeColor)), x1, y1, x2, y2);
                g.FillRectangle(_DrawingBrush, x1, y1, x2, y2);

                x1 = ruler.HeaderOffset / 2;
                x2 = ruler.HeaderOffset - x1;
                y1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - (x2 / 2) - 1;
                g.FillRectangle(new SolidBrush(ruler.ForeColor), x1, y1, x2, x2);

                x1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1;
                y1 = ruler.ScaleValueToPixel((double)_EndMillisecond) - (x2 / 2) - 1;
                g.FillRectangle(new SolidBrush(ruler.ForeColor), x1, y1, x2, x2);
            }
        }
Ejemplo n.º 29
0
 public override bool CanBeMoved(TimeRuler ruler)
 {
     return(true);
 }
 public override string GetMinutesOnlyFormat(TimeRuler ruler)
 {
     return(ruler.UseClientTimeZone ? "''" : "mm");
 }
 public override string GetTimeDesignatorOnlyFormat(TimeRuler ruler)
 {
     return(ruler.UseClientTimeZone ? "''" : "mm");
 }
Ejemplo n.º 32
0
        /// <summary>
        /// 建立与成员的事件连接
        /// </summary>
        private void BuildRouted()
        {
            // 项目树
            PTView = new ProjectTreeView();
            foreach (SimuViewDiagramModel svdmodel in SubRoutines)
            {
                PTView.AddTreeViewItem(svdmodel.Name, ProjectTreeView.ADDTVI_TYPE_SUBROUTINES);
            }
            PTView.AddTreeViewItem("所有函数", ProjectTreeView.ADDTVI_TYPE_FUNCBLOCKS);
            foreach (SimuViewFuncBlockModel svfmodel in FuncBlocks)
            {
                PTView.AddTreeViewItem(svfmodel.Name, ProjectTreeView.ADDTVI_TYPE_FUNCBLOCKS);
            }
            TreeViewItem tvi_mrou = PTView.TVI_MainRoutine;
            TreeViewItem tvi_srou = PTView.TVI_SubRoutines;
            TreeViewItem tvi_fblo = PTView.TVI_FuncBlocks;
            TreeViewItem tvi_char = PTView.TVI_Chart;

            tvi_mrou.MouseDoubleClick += OnProjectTreeDoubleClicked;
            foreach (TreeViewItem tvi in tvi_srou.Items)
            {
                tvi.MouseDoubleClick += OnProjectTreeDoubleClicked;
            }
            foreach (TreeViewItem tvi in tvi_fblo.Items)
            {
                tvi.MouseDoubleClick += OnProjectTreeDoubleClicked;
            }
            tvi_char.MouseDoubleClick += OnProjectTreeDoubleClicked;
            // 监视列表的第一个空表单
            SimulateVInputUnit sviunit = new SimulateVInputUnit();

            smvars.Add(sviunit);
            // 监视列表
            MTable = new MonitorTable();
            MTable.VariableUnitChanged  += OnVariableUnitChanged;
            MTable.VariableUnitLocked   += OnVariableUnitLocked;
            MTable.VariableUnitUnlocked += OnVariableUnitUnlocked;
            MTable.SVUnits = smvars;
            MTable.Update();
            // 主图表
            MainChart                = new SimuViewChartModel();
            MainChart.SDModelView   += OnSimulateDataModelView;
            MainChart.SDModelLock   += OnSimulateDataModelLock;
            MainChart.SDModelUnlock += OnSimulateDataModelUnlock;
            MainChart.SDModelUnview += OnSimulateDataModelUnview;
            MainChart.SDModelRun    += OnSimulateDataModelRun;
            MainChart.SDModelDraw   += OnSimulateDataModelDraw;
            MainChart.XYModelCreate += OnSimuViewXYModelCreate;
            MainChart.BuildRouted(this);
            // 时间尺
            TRuler = MainChart.TRuler;
            TRuler.PointStartEnable  += OnPointStartEnable;
            TRuler.PointStartDisable += OnPointStartDisable;
            TRuler.PointEndEnable    += OnPointEndEnable;
            TRuler.PointEndDisable   += OnPointEndDisable;
            // 仿真管理器
            //smanager.RunDataFinished += OnRunDataFinished;
            //smanager.RunDrawFinished += OnRunDrawFinished;
            // DLL模型
            dllmodel.SimulateStart    += OnSimulateStart;
            dllmodel.SimulatePause    += OnSimulatePause;
            dllmodel.SimulateAbort    += OnSimulateAbort;
            dllmodel.SimulateProgress += OnSimulateProgress;
        }
Ejemplo n.º 33
0
        private void OnEngineStart(object sender, System.EventArgs e)
        {
            this._timeRuler = new TimeRuler(this) { Visible = true, ShowLog = true };
            this.Components.Add(this._timeRuler);

            #if XNA
            this._bloomComponent = new BloomComponent(this);
            this.Components.Add(this._bloomComponent);
            #endif
        }