public ConfigureActionBasePage(Profile profile, VehicleActionType actionType, VehicleAction action, IProfileService profileService) { Profile = profile; ActionType = actionType; Action = action; ProfileService = profileService; Content = SetupView(); }
public static QueuedVehicleAction Create(string name, VehicleAction vehicleAction, string leadVehicleName) { return(new QueuedVehicleAction() { Name = name, VehicleAction = vehicleAction, Handled = false, leadVehicleName = leadVehicleName }); }
private async Task AddVehicleActionToQueue(string vehicleKey, VehicleAction action, string leadVehicleName) { await _VehicleActionsLock.WaitAsync(); try { if (!_updatingVehicleActions) { _updatingVehicleActions = true; var vehicle = this._gameScenario.Vehicles.Where(v => v.Key == vehicleKey).Select(x => x.Value).Single(); TryAddVehicleActionToQueue(vehicle.Name, action, leadVehicleName); _updatingVehicleActions = false; } } finally { _VehicleActionsLock.Release(); } }
public EditActionPage(Profile profile, VehicleAction action, IProfileService profileService) { NavigationPage.SetHasNavigationBar(this, false); FirstButton = new MenuItem { Icon = new FileImageSource { File = "b_option_list_icon_delete.png", } }; FirstButton.Command = new Command(async() => { profile.Actions.Remove(action); await profileService.UpsertProfileAsync(profile); await Navigation.PopAsync(); }); if (action.Type.IsCustomizable()) { SecondButton = new MenuItem { Icon = new FileImageSource { File = "baseline_edit_white_36dp.png", } }; SecondButton.Command = new Command(async() => { await action.Type.CustomizeOrReturn(profile, action, Navigation, profileService); }); } Content = new Label { HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, Text = action.Name, }; }
/// <summary> /// Calls the TASK_VEHICLE_TEMP_ACTION native in order to control a Vehicle /// </summary> /// <param name="ped">The driver</param> /// <param name="vehicle">The target Vehicle</param> /// <param name="action">Any of enum VehicleAction</param> private void PerformVehicleAction(Ped ped, Vehicle vehicle, VehicleAction action) { Function.Call(Hash.TASK_VEHICLE_TEMP_ACTION, ped, vehicle, (int)action, -1); }
/// <summary> /// This method will get called by the Script so this PlayerPed can update its state /// </summary> public void Tick() { if (Ped.IsInVehicle()) { UpdateCombat(() => { return(Input.isPressed(DeviceButton.LeftShoulder)); }, () => { return(Input.isPressed(DeviceButton.RightShoulder)); }); Vehicle v = Ped.CurrentVehicle; if (v.GetPedOnSeat(VehicleSeat.Driver) == Ped) { VehicleAction action = GetVehicleAction(v); if (action != LastVehicleAction) { LastVehicleAction = action; PerformVehicleAction(Ped, v, action); } } if (Input.isPressed(DeviceButton.X)) { if (CanDoAction(PlayerPedAction.SelectWeapon, 500)) { if (UpdateWeaponIndex()) { SelectWeapon(Ped, weapons[WeaponIndex]); } } NotifyWeapon(); } } else { UpdateFoot(); } // for entering / leaving a vehicle if (Input.isPressed(DeviceButton.Y)) { if (Ped.IsInVehicle()) { Vehicle v = Ped.CurrentVehicle; if (v.Speed > 7f) { //4160 = ped is throwing himself out, even when the vehicle is still (that's what the speed check is for) Function.Call(Hash.TASK_LEAVE_VEHICLE, Ped, v, 4160); } else { Ped.Task.LeaveVehicle(); } } else { TwoPlayerMod.HandleEnterVehicle(Ped); } } if (Ped.IsDead) { UI.Notify("Player " + "~g~" + UserIndex + "~w~ press ~g~" + DeviceButton.Back + "~w~ to respawn~w~."); if (Input.isPressed(DeviceButton.Back)) { Respawn(); } } if (!Ped.IsNearEntity(Player1, new Vector3(20, 20, 20))) { UI.Notify("Player " + "~g~" + UserIndex + "~w~ press ~g~" + DeviceButton.Back + "~w~ to go back to player ~g~" + UserIndex.One + "~w~."); if (Input.isPressed(DeviceButton.Back)) { Ped.Position = Player1.Position.Around(5); } } }
private bool TryAddVehicleActionToQueue(string vehicleKey, VehicleAction vehicleAction, string leadVehicleName) { return(_queuedVehicleActions.TryAdd(vehicleKey, QueuedVehicleAction.Factory.Create(vehicleKey, vehicleAction, leadVehicleName))); }
public ConfigureClimateSetTemps(Profile profile, VehicleActionType actionType, VehicleAction action, IProfileService profileService) : base(profile, actionType, action, profileService) { }