コード例 #1
0
 public static void Finally()
 {
     minigameOn = false;
     if (pFiber != null)
     {
         pFiber.Abort();
     }
     if (gFiber != null)
     {
         gFiber.Abort();
     }
 }
コード例 #2
0
ファイル: Main.cs プロジェクト: iPeer/AlfredoRedux
 public override void Finally()
 {
     if (CheckThread.IsRunning())
     {
         CheckThread.Abort();
     }
 }
コード例 #3
0
        private static void EnableIslandMinimap(bool enable)
        {
            bool running = minimapFiber?.IsAlive == true;

            if (running && !enable)
            {
                minimapFiber.Abort();
            }

            if (!running && enable)
            {
                if (!mapBoundsBlip)
                {
                    mapBoundsBlip       = new Blip(new Vector3(7000, -7000, 0));
                    mapBoundsBlip.Scale = 0;
                    mapBoundsBlip.Alpha = 1;
                }

                minimapFiber = GameFiber.ExecuteNewWhile(() =>
                {
                    NativeFunction.Natives.SET_RADAR_AS_INTERIOR_THIS_FRAME(Game.GetHashKey("h4_fake_islandx"), 4700.0f, -5145.0f, 0, 0);
                    NativeFunction.Natives.SET_RADAR_AS_EXTERIOR_THIS_FRAME();
                }, () => true);
            }
        }
コード例 #4
0
 private void End()
 {
     "Dialog Ended".AddLog();
     HasEnded  = true;
     IsRunning = false;
     _lineFiber.Abort();
 }
コード例 #5
0
        private void End()
        {
            NativeFunction.Natives.SET_PED_CAN_SWITCH_WEAPON(Interrogator, true);

            if (Interrogator)
            {
                Interrogator.IsPositionFrozen = false;
            }

            if (Interrogee)
            {
                Interrogee.IsPositionFrozen = false;
            }

            if (_susTOplayer.Exists())
            {
                _susTOplayer.Active = false;
                _susTOplayer.Delete();
            }
            if (_playerTOsus.Exists())
            {
                _gameCam.Active     = true;
                _playerTOsus.Active = true;

                CamInterpolate(_playerTOsus, _gameCam, 2000, true, true, true);

                _playerTOsus.Active = false;
                _playerTOsus.Delete();
            }

            HasEnded = true;
            "Interrogation Ended".AddLog();
            _lineFiber.Abort();
        }
コード例 #6
0
 internal void SwitchFibers(GameFiber stopFiber, Fibers startFiber, CaseData data = null)
 {
     $"Switching fiber {stopFiber} to {startFiber}".AddLog();
     if (stopFiber.IsAlive)
     {
         stopFiber.Abort();
     }
     StartFiber(startFiber, data);
 }
コード例 #7
0
 internal void AbortFiber(GameFiber abortFiber)
 {
     $"Aborting fiber {abortFiber.Name}".AddLog();
     Background.DisableBackground(Background.Type.Computer);
     IsRunning = false;
     if (abortFiber.IsAlive)
     {
         abortFiber.Abort();
     }
 }
コード例 #8
0
ファイル: SHVDN.cs プロジェクト: samtovar/AsiSupport
        public static void Dispose()
        {
            if (fiber != null)
            {
                fiber.Abort();
                fiber = null;
            }

            Support.Instance.KeyboardManager.UnregisterHandler(SendKeyboardMessage);
        }
コード例 #9
0
 private void ShowFiber()
 {
     Screen.Show();
     while (!Game.IsKeyDown(Keys.Enter))
     {
         Screen.Draw();
         GameFiber.Yield();
     }
     _fiber.Abort();
 }
コード例 #10
0
        private static void DeleteObjects(List <StageObject> objList)
        {
            if (objList.Count < 1)
            {
                return;
            }
            var i = 1;

            foreach (var objects in objList)
            {
                switch (objects.ObjectType)
                {
                case StageObject.Type.Ped:
                    if (objects.Ped)
                    {
                        objects.Ped.Delete();
                    }
                    ("Deleted object " + i).AddLog();
                    break;

                case StageObject.Type.Barrier:
                    if (objects.Object.Exists())
                    {
                        objects.Object.Delete();
                    }
                    ("Deleted object " + i).AddLog();
                    break;

                case StageObject.Type.Vehicle:
                    if (objects.Vehicle.Exists())
                    {
                        objects.Vehicle.Delete();
                    }
                    ("Deleted object " + i).AddLog();
                    break;
                }
                i++;
            }
            objList.Clear();
            if (CopFiber.IsAlive)
            {
                CopFiber.Abort();
            }
            if (AmbientFiber.IsAlive)
            {
                AmbientFiber.Abort();
            }
            if (Victim.Exists())
            {
                Victim.Ped.Delete();
            }
        }
コード例 #11
0
        private static void WaitForSuspect(Vehicle vehicle, Vector3 point)
        {
            "WaitForSuspect".AddLog();
            Stopwatch sw = new Stopwatch();

            sw.Start();

            _cameraMovementFiber = new GameFiber(CameraMove);
            _cameraMovementFiber.Start();

            while (vehicle.Position.DistanceTo(point) > 4f)
            {
                if (sw.Elapsed.Seconds >= 15)
                {
                    "Stopwatch elapsed, breaking loop".AddLog(true);
                    break;
                }

                GameFiber.Yield();
            }
            "Vehicle at position".AddLog(true);

            _sus.Tasks.PerformDrivingManeuver(vehicle, VehicleManeuver.Wait);

            _play = false;

            _secCam.Face(_veh);

            _pauseTime = World.TimeOfDay;

            var speedZone = World.AddSpeedZone(_targetPos, 60f, 0f);

            for (var i = _secCam.FOV; i >= GetFOVValue(Vector3.Distance(Game.LocalPlayer.Character.Position, _veh)); i += -0.2f)
            {
                _secCam.FOV = i;
                GameFiber.Sleep(0100);
            }

            GameFiber.Sleep(3000);

            FadeScreen(true);

            World.RemoveSpeedZone(speedZone);

            "Ending".AddLog(true);

            _cameraMovementFiber.Abort();

            Game.RawFrameRender -= OnRawFrameRender;

            EndCamera();
        }
コード例 #12
0
 public override void Finally()
 {
     Globals.Navigation.OnFormAdded   -= NavOnFormAdded;
     Globals.Navigation.OnFormRemoved -= NavOnFormRemoved;
     if (RunComputerPlusFiber.IsRunning())
     {
         RunComputerPlusFiber.Abort();
     }
     if (CheckIfCalloutActiveFiber.IsRunning())
     {
         CheckIfCalloutActiveFiber.Abort();
     }
 }
コード例 #13
0
 public void StopEventMonitoring()
 {
     if (KeyListenerFiber == null)
     {
         return;
     }
     try
     {
         KeyListenerFiber.Abort();
     }
     catch
     {
         KeyListenerFiber = null;
     }
 }
コード例 #14
0
 public static void Finally()
 {
     if (CarrierBlip.Exists())
     {
         CarrierBlip.Delete();
     }
     if (AirportBlip.Exists())
     {
         AirportBlip.Delete();
     }
     if (ProcessFiber.IsAlive)
     {
         ProcessFiber.Abort();
     }
     AircraftSelectorMenu = null;
     CarrierMenu          = null;
     IsActive             = false;
 }
コード例 #15
0
        private static void DebugBones([ConsoleCommandParameter(Name = "Enabled")] bool enabled)
        {
            debugFiber?.Abort();
            if (enabled)
            {
                debugFiber = GameFiber.ExecuteNewWhile(() =>
                {
                    Vehicle truck = controller.Truck;
                    Vector3 a1    = truck.GetBonePosition("arm_1");
                    Vector3 a2    = truck.GetBonePosition("arm_2");
                    Vector3 rb    = truck.GetBonePosition("rotating_base");
                    Vector3 bk    = truck.GetBonePosition("bucket");

                    Quaternion bq     = truck.GetBoneOrientation("bucket");
                    Vector3 bucketBox = controller.GetBucketPosition;
                    Debug.DrawWireBox(bucketBox, bq, Settings.Bucket.BucketSize, Color.Purple);

                    Debug.DrawSphere(a1, 0.3f, Color.Red);
                    Debug.DrawSphere(a2, 0.3f, Color.Green);
                    Debug.DrawSphere(rb, 0.3f, Color.Orange);
                    Debug.DrawSphere(bk, 0.3f, Color.Blue);

                    Debug.DrawLine(rb, a1, Color.HotPink);
                    Debug.DrawLine(a1, a2, Color.HotPink);
                    Debug.DrawLine(a2, bk, Color.HotPink);

                    Vector3 py1 = Game.LocalPlayer.Character.GetOffsetPositionFront(1f);
                    Vector3 py2 = Game.LocalPlayer.Character.GetOffsetPositionFront(-1f);
                    Vector3 pz1 = Game.LocalPlayer.Character.GetOffsetPositionUp(1f);
                    Vector3 pz2 = Game.LocalPlayer.Character.GetOffsetPositionUp(-1f);
                    Vector3 px1 = Game.LocalPlayer.Character.GetOffsetPositionRight(1f);
                    Vector3 px2 = Game.LocalPlayer.Character.GetOffsetPositionRight(-1f);

                    Color c = controller.IsEntityInBucket(Game.LocalPlayer.Character) ? Color.Green : Color.Red;
                    Debug.DrawLine(py1, py2, c);
                    Debug.DrawLine(px1, px2, c);
                    Debug.DrawLine(pz1, pz2, c);
                }, () => controller != null && controller.Truck);
            }
        }
コード例 #16
0
        public void StartCallout(TCalloutData data)
        {
            FinishCurrentCallout();

            if (waitCalloutAcceptanceFiber != null)
            {
                waitCalloutAcceptanceFiber.Abort();
                waitCalloutAcceptanceFiber = null;
            }

            TCalloutData calloutData = data;

            isDisplayingNewCallout = true;
            Game.LogTrivial("Starting callout " + calloutData.InternalName);
            currentCallout           = (Callout)Activator.CreateInstance(calloutData.CalloutType);
            currentCallout.Finished += OnCurrentCalloutFinished;
            OnCalloutCreated(currentCallout);
            Game.LogTrivial("Callout - OnBeforeCalloutDisplayed");
            if (currentCallout.OnBeforeCalloutDisplayed())
            {
                const double notificationDisplayTime = 20.0;
                Game.LogTrivial("Callout - Showing notification");
                Notification.Show(currentCallout.DisplayName, currentCallout.DisplayExtraInfo, notificationDisplayTime);
                NativeFunction.Natives.FlashMinimapDisplay();
                DateTime startTime = DateTime.UtcNow;

                waitCalloutAcceptanceFiber = GameFiber.StartNew(() =>
                {
                    bool accepted = false;
                    Game.LogTrivial("Callout - Start accept key press detect loop");
                    float?dist = currentCallout.CalloutAreaBlip ? Vector3.Distance(Game.LocalPlayer.Character.Position, currentCallout.CalloutAreaBlip.Position) : (float?)null;
                    while ((DateTime.UtcNow - startTime).TotalSeconds < notificationDisplayTime + 2.0)
                    {
                        GameFiber.Yield();

                        if (dist.HasValue)
                        {
                            Game.SetRadarZoomLevelThisFrame(Math.Min(dist.Value, 800f));
                        }

                        if (Plugin.Controls["ACCEPT_CALLOUT"].IsJustPressed())
                        {
                            Game.LogTrivial("Callout - Pressed accept key, breaking loop");
                            accepted = true;
                            break;
                        }
                    }

                    if (accepted)
                    {
                        Game.LogTrivial("Callout - OnCalloutAccepted");
                        currentCallout.HasBeenAccepted = true;
                        if (currentCallout.OnCalloutAccepted())
                        {
                            Game.LogTrivial("Callout - OnCalloutAccepted:True");
                            runCalloutUpdate = true;
                        }
                        else
                        {
                            Game.LogTrivial("Callout - OnCalloutAccepted:False");
                            FinishCurrentCallout();
                        }
                    }
                    else
                    {
                        Game.LogTrivial("Callout - OnCalloutNotAccepted");
                        currentCallout?.OnCalloutNotAccepted();
                        FinishCurrentCallout();
                    }

                    waitCalloutAcceptanceFiber = null;
                }, "Wait for callout acceptance fiber - Callout:" + calloutData.InternalName);
            }
            else
            {
                FinishCurrentCallout();
            }
        }
コード例 #17
0
 public static void Stop()
 {
     _MenuPool.CloseAllMenus();
     menuProcessFiber.Abort();
 }