コード例 #1
0
        public override void Draw()
        {
            try
            {
                if (DedicatedServer || _lastDrawTick == Tick || _paused)
                {
                    return;
                }
                _lastDrawTick = Tick;
                DsUtil.Start("draw");

                CameraMatrix          = Session.Camera.WorldMatrix;
                CameraPos             = CameraMatrix.Translation;
                CameraFrustrum.Matrix = (Camera.ViewMatrix * Camera.ProjectionMatrix);

                if (HudUi.TexturesToAdd > 0)
                {
                    HudUi.DrawTextures();
                }

                if ((UiInput.PlayerCamera || UiInput.FirstPersonView || InGridAiBlock) && !InMenu && !Session.Config.MinimalHud && !MyAPIGateway.Gui.IsCursorVisible)
                {
                    if (WheelUi.WheelActive)
                    {
                        WheelUi.DrawWheel();
                    }
                    TargetUi.DrawTargetUi();
                }

                Av.Run();
                DsUtil.Complete("draw", true);
            }
            catch (Exception ex) { Log.Line($"Exception in SessionDraw: {ex}"); }
        }
コード例 #2
0
        public override Av GetEN1993ShearArea(double fy)
        {
            Av av = new Av();

            av.Avyy = 2.0 * this.A / 3.1415926535897931;
            av.Avzz = av.Avyy;
            return(av);
        }
コード例 #3
0
        public override void Draw()
        {
            try
            {
                if (SuppressWc || DedicatedServer || _lastDrawTick == Tick || _paused)
                {
                    return;
                }

                if (DebugLos)
                {
                    LosDebuging();
                }

                _lastDrawTick = Tick;
                DsUtil.Start("draw");
                CameraMatrix          = Session.Camera.WorldMatrix;
                CameraPos             = CameraMatrix.Translation;
                CameraFrustrum.Matrix = (Camera.ViewMatrix * Camera.ProjectionMatrix);
                var newFov = Camera.FovWithZoom;

                if (!MyUtils.IsEqual(newFov, CurrentFovWithZoom))
                {
                    FovChanged();
                }

                CurrentFovWithZoom = newFov;
                AspectRatio        = Camera.ViewportSize.X / Camera.ViewportSize.Y;
                AspectRatioInv     = Camera.ViewportSize.Y / Camera.ViewportSize.X;

                ScaleFov = Math.Tan(CurrentFovWithZoom * 0.5);

                if (!Session.Config.MinimalHud && InGridAiBlock)
                {
                    if (HudUi.TexturesToAdd > 0 || HudUi.KeepBackground)
                    {
                        HudUi.DrawTextures();
                    }

                    if ((UiInput.PlayerCamera || UiInput.FirstPersonView || UiInput.CameraBlockView) && !InMenu && !MyAPIGateway.Gui.IsCursorVisible && PlayerDummyTargets.ContainsKey(PlayerId))
                    {
                        TargetUi.DrawTargetUi();
                    }

                    if (HudUi.AgingTextures)
                    {
                        HudUi.DrawText();
                    }
                }

                Av.Run();
                DrawDisabledGuns();
                DsUtil.Complete("draw", true);
            }
            catch (Exception ex) { Log.Line($"Exception in SessionDraw: {ex}"); }
        }
コード例 #4
0
        public override Av GetEN1993ShearArea(double fy)
        {
            Av av = new Av();

            if (this.fabrication == SectionFabrication.Welded)
            {
                av.Avyy = this.A;
                av.Avzz = 0.0;
                return(av);
            }
            throw new NotImplementedException();
        }
コード例 #5
0
        public override Av GetEN1993ShearArea(double fy)
        {
            Av     av  = new Av();
            double num = this.h - 2.0 * this.tf;

            if (this.fabrication == SectionFabrication.Welded)
            {
                av.Avyy = this.A - 2.0 * num * this.tw;
                double num2 = 1.2;
                if (fy > 460.0)
                {
                    num2 = 1.0;
                }
                av.Avzz = num2 * 2.0 * num * this.tw;
                return(av);
            }
            throw new NotImplementedException();
        }
コード例 #6
0
        public override Av GetEN1993ShearArea(double fy)
        {
            Av av = new Av();

            if (this.Fabrication == SectionFabrication.Rolled)
            {
                av.Avyy = this.A * this.h / (this.b + this.h);
                av.Avzz = this.A * this.b / (this.b + this.h);
                return(av);
            }
            if (this.Fabrication == SectionFabrication.Welded)
            {
                av.Avyy = this.A - 2.0 * this.h * this.t;
                double num = 1.2;
                if (fy > 460.0)
                {
                    num = 1.0;
                }
                av.Avzz = num * 2.0 * this.h * this.t;
                return(av);
            }
            throw new NotImplementedException();
        }
コード例 #7
0
        public override Av GetEN1993ShearArea(double fy)
        {
            Av     av  = new Av();
            double num = this.h - 2.0 * this.tf;

            if (this.Fabrication == SectionFabrication.Rolled)
            {
                av.Avyy = this.A - 2.0 * this.b * this.tf + (this.tw + 2.0 * this.r) * this.tf;
                double num2 = 1.2;
                if (fy > 460.0)
                {
                    num2 = 1.0;
                }
                if (av.Avyy < num2 * num * this.tw)
                {
                    av.Avyy = num2 * num * this.tw;
                }
                av.Avzz = this.A - num * this.tw;

                return(av);
            }
            else if (this.Fabrication == SectionFabrication.Welded)
            {
                double num3 = 1.2;
                if (fy > 460.0)
                {
                    num3 = 1.0;
                }
                if (av.Avyy < num3 * num * this.tw)
                {
                    av.Avyy = num3 * num * this.tw;
                }
                av.Avzz = this.A - num * this.tw;
                return(av);
            }
            throw new NotImplementedException();
        }
コード例 #8
0
ファイル: SessionRun.cs プロジェクト: keleios/WeaponCore
        public override void Draw()
        {
            try
            {
                if (SupressLoad || DedicatedServer || _lastDrawTick == Tick || _paused)
                {
                    return;
                }
                _lastDrawTick = Tick;
                DsUtil.Start("draw");
                CameraMatrix          = Session.Camera.WorldMatrix;
                CameraPos             = CameraMatrix.Translation;
                CameraFrustrum.Matrix = (Camera.ViewMatrix * Camera.ProjectionMatrix);
                var newFov = Camera.FovWithZoom;

                if (!MyUtils.IsEqual(newFov, CurrentFovWithZoom))
                {
                    FovChanged();
                }

                CurrentFovWithZoom = newFov;
                ScaleFov           = Math.Tan(CurrentFovWithZoom * 0.5);

                if (HudUi.TexturesToAdd > 0)
                {
                    HudUi.DrawTextures();
                }

                if ((UiInput.PlayerCamera || UiInput.FirstPersonView || InGridAiBlock) && !InMenu && !Session.Config.MinimalHud && !MyAPIGateway.Gui.IsCursorVisible)
                {
                    TargetUi.DrawTargetUi();
                }
                Av.Run();
                DsUtil.Complete("draw", true);
            }
            catch (Exception ex) { Log.Line($"Exception in SessionDraw: {ex}"); }
        }
コード例 #9
0
        public override void Simulate()
        {
            try
            {
                if (SuppressWc)
                {
                    return;
                }

                if (!DedicatedServer)
                {
                    EntityControlUpdate();
                    CameraMatrix = Session.Camera.WorldMatrix;
                    CameraPos    = CameraMatrix.Translation;
                    PlayerPos    = Session.Player?.Character?.WorldAABB.Center ?? Vector3D.Zero;
                }

                if (GameLoaded)
                {
                    DsUtil.Start("ai");
                    AiLoop();
                    DsUtil.Complete("ai", true);


                    DsUtil.Start("charge");
                    if (ChargingWeapons.Count > 0)
                    {
                        UpdateChargeWeapons();
                    }
                    DsUtil.Complete("charge", true);

                    DsUtil.Start("acquire");
                    if (AcquireTargets.Count > 0)
                    {
                        CheckAcquire();
                    }
                    DsUtil.Complete("acquire", true);

                    DsUtil.Start("shoot");
                    if (ShootingWeapons.Count > 0)
                    {
                        ShootWeapons();
                    }
                    DsUtil.Complete("shoot", true);
                }

                if (!DedicatedServer && !InMenu)
                {
                    UpdateLocalAiAndCockpit();
                    if ((UiInput.PlayerCamera && ActiveCockPit != null || ActiveControlBlock is MyRemoteControl && !UiInput.PlayerCamera || UiInput.CameraBlockView) && PlayerDummyTargets.ContainsKey(PlayerId))
                    {
                        TargetSelection();
                    }
                }

                DsUtil.Start("ps");
                Projectiles.SpawnAndMove();
                DsUtil.Complete("ps", true);

                DsUtil.Start("pi");
                Projectiles.Intersect();
                DsUtil.Complete("pi", true);

                DsUtil.Start("pd");
                Projectiles.Damage();
                DsUtil.Complete("pd", true);

                DsUtil.Start("pa");
                Projectiles.AvUpdate();
                DsUtil.Complete("pa", true);

                DsUtil.Start("av");
                if (!DedicatedServer)
                {
                    Av.End();
                }
                DsUtil.Complete("av", true);

                if (MpActive)
                {
                    DsUtil.Start("network1");
                    if (PacketsToClient.Count > 0 || PrunedPacketsToClient.Count > 0)
                    {
                        ProccessServerPacketsForClients();
                    }
                    if (PacketsToServer.Count > 0)
                    {
                        ProccessClientPacketsForServer();
                    }

                    if (EwarNetDataDirty)
                    {
                        SendEwaredBlocks();
                    }

                    DsUtil.Complete("network1", true);
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SessionSim: {ex}"); }
        }
コード例 #10
0
        public override void UpdateBeforeSimulation()
        {
            try
            {
                //
                // Finish work from last frame
                //
                DsUtil.Start("projectiles2");
                Projectiles.Stage2();
                DsUtil.Complete("projectiles2", true);

                DsUtil.Start("damage");
                if (_effectedCubes.Count > 0)
                {
                    ApplyGridEffect();
                }

                if (Tick60)
                {
                    GridEffects();
                }

                if (Hits.Count > 0)
                {
                    ProcessHits();
                }
                DsUtil.Complete("damage", true);

                if (MpActive)
                {
                    DsUtil.Start("network1");
                    if (WeaponsToSync.Count > 0)
                    {
                        Proccessor.Proccess();
                    }
                    if (UiInput.InputChanged && ActiveControlBlock != null)
                    {
                        SendMouseUpdate(ActiveControlBlock);
                    }
                    if (ClientGridResyncRequests.Count > 0)
                    {
                        ProccessGridResyncRequests();
                    }

                    Proccessor.AddPackets();

                    if (PacketsToClient.Count > 0)
                    {
                        ProccessServerPacketsForClients();
                    }
                    if (PacketsToServer.Count > 0)
                    {
                        ProccessClientPacketsForServer();
                    }
                    if (ClientSideErrorPktList.Count > 0)
                    {
                        ReproccessClientErrorPackets();
                    }
                    DsUtil.Complete("network1", true);
                }

                DsUtil.Start("av");
                if (!DedicatedServer)
                {
                    Av.End();
                }
                DsUtil.Complete("av", true);
                //
                // Finished last frame
                //
                Timings();

                if (!WeaponAmmoRemoveQueue.IsEmpty && CTask.IsComplete)
                {
                    if (CTask.valid && CTask.Exceptions != null)
                    {
                        TaskHasErrors(ref CTask, "CTask");
                    }

                    CTask = MyAPIGateway.Parallel.StartBackground(AmmoToRemove, RemoveAmmo);
                }

                if (!WeaponAmmoPullQueue.IsEmpty && ITask.IsComplete)
                {
                    if (ITask.valid && ITask.Exceptions != null)
                    {
                        TaskHasErrors(ref ITask, "ITask");
                    }

                    ITask = MyAPIGateway.Parallel.StartBackground(AmmoPull, MoveAmmo);
                }

                if (!CompsToStart.IsEmpty)
                {
                    StartComps();
                }

                if (Tick120 && CompsDelayed.Count > 0)
                {
                    DelayedComps();
                }

                if (CompReAdds.Count > 0)
                {
                    ChangeReAdds();
                }

                if (Tick3600 && MpActive)
                {
                    NetReport();
                }

                if (Tick180)
                {
                    ProfilePerformance();
                }

                FutureEvents.Tick(Tick);

                if (!DedicatedServer && ActiveControlBlock != null && !InMenu)
                {
                    WheelUi.UpdatePosition();
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SessionBeforeSim: {ex}"); }
        }
コード例 #11
0
ファイル: SessionRun.cs プロジェクト: Coreman230/WeaponCore
        public override void UpdateBeforeSimulation()
        {
            try
            {
                DsUtil.Start("av");
                if (!DedicatedServer)
                {
                    Av.End();
                }
                DsUtil.Complete("av", true);

                Timings();

                if (!WeaponAmmoRemoveQueue.IsEmpty && CTask.IsComplete)
                {
                    if (CTask.valid && CTask.Exceptions != null)
                    {
                        TaskHasErrors(ref CTask, "CTask");
                    }

                    CTask = MyAPIGateway.Parallel.StartBackground(AmmoToRemove, RemoveAmmo);
                }

                if (!WeaponAmmoPullQueue.IsEmpty && ITask.IsComplete)
                {
                    if (ITask.valid && ITask.Exceptions != null)
                    {
                        TaskHasErrors(ref ITask, "ITask");
                    }

                    ITask = MyAPIGateway.Parallel.StartBackground(AmmoPull, MoveAmmo);
                }

                if (!CompsToStart.IsEmpty)
                {
                    StartComps();
                }

                if (Tick120 && CompsDelayed.Count > 0)
                {
                    DelayedComps();
                }

                if (CompReAdds.Count > 0)
                {
                    ChangeReAdds();
                }

                if (Tick3600 && MpActive)
                {
                    NetReport();
                }

                if (Tick180)
                {
                    ProfilePerformance();
                }

                FutureEvents.Tick(Tick);

                if (!DedicatedServer && UiInput.PlayerCamera && !InMenu)
                {
                    WheelUi.UpdatePosition();
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SessionBeforeSim: {ex}"); }
        }