Update() публичный Метод

public Update ( ) : void
Результат void
Пример #1
0
        private int UpdateData()
        {
            string ApplicationId = ddlApplicationList.SelectedValue;
            string ModuleTitle   = txtModuleTitle.Text;

            bool AllTab = false, IsAdmin = false, IsDeleted = false, InheritViewPermissions = false;

            if (ckbAllTab.Checked)
            {
                AllTab = true;
            }
            if (ckbIsAdmin.Checked)
            {
                IsAdmin = true;
            }
            if (ckbIsDeleted.Checked)
            {
                IsDeleted = true;
            }
            if (ckbInheritViewPermissions.Checked)
            {
                InheritViewPermissions = true;
            }
            Modules module_obj = new Modules();
            int     result     = module_obj.Update(_idx, ApplicationId, ModuleTitle, AllTab, IsAdmin, IsDeleted, InheritViewPermissions);

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Call Update on the screen managers and check their visibility against the camera viewport.
        /// </summary>
        /// <param name="elapsedGameTime">The time in seconds since the last frame</param>
        public override void Update(float elapsedGameTime)
        {
            base.Update(elapsedGameTime);

            if (Lights.ShouldUpdate)
            {
                Lights.Update(elapsedGameTime);
            }
            if (EnvironmentObjects.ShouldUpdate)
            {
                EnvironmentObjects.Update(elapsedGameTime);
            }
            if (GameObjects.ShouldUpdate)
            {
                GameObjects.Update(elapsedGameTime);
            }
            if (InGameUIObjects.ShouldUpdate)
            {
                InGameUIObjects.Update(elapsedGameTime);
            }
            if (ScreenUIObjects.ShouldUpdate)
            {
                ScreenUIObjects.Update(elapsedGameTime);
            }

            if (Modules.ShouldUpdate)
            {
                Modules.Update(elapsedGameTime);
            }

            /*Camera.CheckVisibility(Lights, false);
             * Camera.CheckVisibility(EnvironmentObjects, false);
             * Camera.CheckVisibility(GameObjects, false);
             * Camera.CheckVisibility(InGameUIObjects, false);
             * Camera.CheckVisibility(ScreenUIObjects, true);*/
        }
Пример #3
0
        private static void Run()
        {
            // timer
            var timer            = Stopwatch.StartNew();
            var lastTime         = new TimeSpan();
            var fixedAccumulator = TimeSpan.Zero;
            var framecount       = 0;
            var frameticks       = 0L;

            while (Running)
            {
                var forceFixedTimestep = ForceFixedTimestep;
                if (!forceFixedTimestep)
                {
                    System.Input.Step();
                }

                Modules.FrameStart();

                // get current time & diff
                var currTime = TimeSpan.FromTicks(timer.Elapsed.Ticks);
                var diffTime = (currTime - lastTime);
                lastTime = currTime;

                // fixed timestep update
                {
                    // fixed delta time is always the same
                    var fixedTarget = TimeSpan.FromSeconds(1f / Time.FixedStepTarget);
                    Time.RawDelta = Time.RawFixedDelta = (float)fixedTarget.TotalSeconds;
                    Time.Delta    = Time.FixedDelta = Time.RawFixedDelta * Time.DeltaScale;

                    if (forceFixedTimestep)
                    {
                        Time.RawVariableDelta = Time.RawFixedDelta;
                        Time.VariableDelta    = Time.FixedDelta;
                    }

                    // increment time
                    fixedAccumulator += diffTime;

                    // if we're forcing fixed timestep and running too fast,
                    // we should sleep the thread while we wait
                    if (forceFixedTimestep)
                    {
                        while (fixedAccumulator < fixedTarget)
                        {
                            Thread.Sleep((int)((fixedTarget - fixedAccumulator).TotalMilliseconds));

                            currTime          = TimeSpan.FromTicks(timer.Elapsed.Ticks);
                            diffTime          = (currTime - lastTime);
                            lastTime          = currTime;
                            fixedAccumulator += diffTime;
                        }
                    }

                    // Do not allow any update to take longer than our maximum.
                    if (fixedAccumulator > Time.FixedMaxElapsedTime)
                    {
                        fixedAccumulator = Time.FixedMaxElapsedTime;
                    }

                    // do as many fixed updates as we can
                    while (fixedAccumulator >= fixedTarget)
                    {
                        Time.FixedDuration += fixedTarget;
                        fixedAccumulator   -= fixedTarget;

                        if (forceFixedTimestep)
                        {
                            Time.Duration += fixedTarget;

                            System.Input.Step();
                            Modules.FixedUpdate();
                            Modules.Update();
                        }
                        else
                        {
                            Modules.FixedUpdate();
                        }

                        if (Exiting)
                        {
                            break;
                        }
                    }
                }

                // variable timestep update
                if (!forceFixedTimestep)
                {
                    // get Time values
                    Time.Duration += diffTime;
                    Time.RawDelta  = Time.RawVariableDelta = (float)diffTime.TotalSeconds;
                    Time.Delta     = Time.VariableDelta = Time.RawDelta * Time.DeltaScale;

                    // update
                    Modules.Update();
                }

                Modules.FrameEnd();

                // Check if the Primary Window has been closed
                if (_primaryWindow == null || !_primaryWindow.Opened)
                {
                    Exit();
                }

                // render
                if (!Exiting)
                {
                    Modules.BeforeRender();

                    for (int i = 0; i < System.Windows.Count; i++)
                    {
                        if (System.Windows[i].Opened)
                        {
                            System.Windows[i].Render();
                        }
                    }

                    for (int i = 0; i < System.Windows.Count; i++)
                    {
                        if (System.Windows[i].Opened)
                        {
                            System.Windows[i].Present();
                        }
                    }

                    Modules.AfterRender();
                }

                // get fps
                framecount++;
                if (TimeSpan.FromTicks(timer.Elapsed.Ticks - frameticks).TotalSeconds >= 1)
                {
                    Time.FPS   = framecount;
                    frameticks = timer.Elapsed.Ticks;
                    framecount = 0;
                }
            }

            // finalize
            Modules.Shutdown();
            _primaryWindow = null;
            Exiting        = false;

            Log.Info("Exited");
        }