public void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Пример #2
0
 private void Ok()
 {
     if (string.IsNullOrWhiteSpace(Binocular.Name))
     {
         ViewManager.ShowMessageBox("$BinocularWindow.WarningTitle", "$BinocularWindow.EmptyNameWarningMessage");
     }
     else if (Binoculars.Any(t => t.Name == Binocular.Name && t.Id != Binocular.Id))
     {
         ViewManager.ShowMessageBox("$BinocularWindow.WarningTitle", "$BinocularWindow.NameAlreadyExistsWarningMessage");
     }
     else
     {
         Close(true);
     }
 }
Пример #3
0
        public void Functions_OnOnDutyStateChanged(bool onDuty)
        {
            if (onDuty)
            {
                Common.RegisterCallouts();

                if (Settings.AmbientEvents.EnableAmbientEvents)
                {
                    EventPool.EventsController();
                }

                Globals.HeliCamera.ManagerFiber.Start();

                // set up integration with PoliceSmartRadio
                if (IsLSPDFRPluginRunning("PoliceSmartRadio"))
                {
                    PoliceSmartRadioAvailable = true;
                    PoliceSmartRadioFunctions = new PoliceSmartRadioFunctions();
                }

                GameFiber.StartNew(delegate
                {
                    Logger.LogTrivial("Functions fiber started");

                    while (true)
                    {
                        GameFiber.Yield();

                        if (Controls.ToggleBinoculars.IsJustPressed() &&
                            !Game.LocalPlayer.Character.IsInAnyVehicle(false) && !Binoculars.IsActive &&
                            Settings.General.IsBinocularEnable)
                        {
                            Binoculars.EnableBinoculars();
                        }

                        if (Controls.ToggleInteractionMenu.IsJustPressed() && !Binoculars.IsActive)
                        {
                            InteractionMenu.DisEnable();
                        }
                    }
                });

                Game.DisplayNotification("~g~<font size=\"14\"><b>WILDERNESS CALLOUTS</b></font>~s~~n~Version: ~b~" +
                                         WildernessCallouts.Common.GetVersion(
                                             @"Plugins\LSPDFR\Wilderness Callouts.dll") + "~s~~n~Loaded!");
            }
        }
Пример #4
0
 private void DeleteEquipment(Type equipmentType)
 {
     if (ViewManager.ShowMessageBox("$FovSettingsVM.WarningTitle", "$FovSettingsVM.DeleteEquipmentMessage", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         if (equipmentType == typeof(Telescope))
         {
             Telescopes.Remove(Telescope);
             TelescopeId = Guid.Empty;
             NotifyPropertyChanged(nameof(Telescopes), nameof(TelescopeId));
             Calculate();
             SaveEquipment();
         }
         else if (equipmentType == typeof(Eyepiece))
         {
             Eyepieces.Remove(Eyepiece);
             EyepieceId = Guid.Empty;
             NotifyPropertyChanged(nameof(Eyepieces), nameof(EyepieceId));
             Calculate();
             SaveEquipment();
         }
         else if (equipmentType == typeof(Camera))
         {
             Cameras.Remove(Camera);
             CameraId = Guid.Empty;
             NotifyPropertyChanged(nameof(Cameras), nameof(CameraId));
             Calculate();
             SaveEquipment();
         }
         else if (equipmentType == typeof(Binocular))
         {
             Binoculars.Remove(Binocular);
             BinocularId = Guid.Empty;
             NotifyPropertyChanged(nameof(Binoculars), nameof(BinocularId));
             Calculate();
             SaveEquipment();
         }
     }
 }
Пример #5
0
 private void EditEquipment(Type equipmentType, bool isNew)
 {
     if (equipmentType == typeof(Telescope))
     {
         var vm = ViewManager.CreateViewModel <TelescopeVM>();
         vm.Telescopes = Telescopes;
         if (!isNew)
         {
             vm.Telescope.CopyFrom(Telescope);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Telescopes.Add(vm.Telescope);
             }
             TelescopeId = Guid.Empty;
             TelescopeId = vm.Telescope.Id;
             Telescope.CopyFrom(vm.Telescope);
             _Equipment.Telescopes = new ObservableCollection <Telescope>(Telescopes.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Telescopes), nameof(TelescopeId), nameof(Telescope));
             Calculate();
             SaveEquipment();
         }
     }
     else if (equipmentType == typeof(Eyepiece))
     {
         var vm = ViewManager.CreateViewModel <EyepieceVM>();
         vm.Eyepieces = Eyepieces;
         if (!isNew)
         {
             vm.Eyepiece.CopyFrom(Eyepiece);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Eyepieces.Add(vm.Eyepiece);
             }
             EyepieceId = Guid.Empty;
             EyepieceId = vm.Eyepiece.Id;
             Eyepiece.CopyFrom(vm.Eyepiece);
             _Equipment.Eyepieces = new ObservableCollection <Eyepiece>(Eyepieces.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Eyepieces), nameof(EyepieceId), nameof(Eyepiece));
             Calculate();
             SaveEquipment();
         }
     }
     else if (equipmentType == typeof(Camera))
     {
         var vm = ViewManager.CreateViewModel <CameraVM>();
         vm.Cameras = Cameras;
         if (!isNew)
         {
             vm.Camera.CopyFrom(Camera);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Cameras.Add(vm.Camera);
             }
             CameraId = Guid.Empty;
             CameraId = vm.Camera.Id;
             Camera.CopyFrom(vm.Camera);
             _Equipment.Cameras = new ObservableCollection <Camera>(Cameras.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Cameras), nameof(CameraId), nameof(Camera));
             Calculate();
             SaveEquipment();
         }
     }
     else if (equipmentType == typeof(Binocular))
     {
         var vm = ViewManager.CreateViewModel <BinocularVM>();
         vm.Binoculars = Binoculars;
         if (!isNew)
         {
             vm.Binocular.CopyFrom(Binocular);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Binoculars.Add(vm.Binocular);
             }
             BinocularId = Guid.Empty;
             BinocularId = vm.Binocular.Id;
             Binocular.CopyFrom(vm.Binocular);
             _Equipment.Binoculars = new ObservableCollection <Binocular>(Binoculars.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Binoculars), nameof(BinocularId), nameof(Binocular));
             Calculate();
             SaveEquipment();
         }
     }
 }