Ejemplo n.º 1
0
        private void AddMenuItemRequestAVehicle(UIMenu menu)
        {
            var newItem = new UIMenuItem("Request A Vehicle", "Request a new personal vehicle nearby.");

            newItem.SetRightBadge(UIMenuItem.BadgeStyle.Car);
            menu.AddItem(newItem);
            menu.OnItemSelect += (sender, item, index) => {
                if (item != newItem)
                {
                    return;
                }
                //string output = ketchup ? "You have ordered ~b~{0}~w~ ~r~with~w~ ketchup." : "You have ordered ~b~{0}~w~ ~r~without~w~ ketchup.";
                //UI.ShowSubtitle(String.Format(output, dish));
                UI.Notify("Requesting a vehicle");
                PersonalVehicleController.DeployANewPersonalVehicle(CurrentPlayerName, true);
            };
        }
Ejemplo n.º 2
0
        private void AddMenuRequestASpecificVehicle(UIMenu menu)
        {
            var subMenu = _menuPool.AddSubMenu(menu, "Request A Specific Vehicle", "Request a specific personal vehicle nearby.");

            foreach (var vehicleDefinition in PersonalVehicleController.CurrentVehicleDefinitions(CurrentPlayerName))
            {
                var eachItem = new UIMenuItem(vehicleDefinition.VehicleName, vehicleDefinition.Colors.Primary.ToString());
                subMenu.AddItem(eachItem);
                menu.OnItemSelect += (sender, item, index) => {
                    if (item != eachItem)
                    {
                        return;
                    }
                    UI.Notify("Requesting: " + item.Text);
                    VehicleDefinition specificVehicleDefinition = PersonalVehicleController.CurrentVehicleDefinitions(CurrentPlayerName)[index];
                    PersonalVehicleController.DeployANewPersonalVehicle(CurrentPlayerName, isForDelivery: true, specificVehicleDefinition: specificVehicleDefinition);
                };
            }
        }
Ejemplo n.º 3
0
        public void OnTick(object sender, EventArgs e) // roughly every 16ms (60 times per second)
        // when player switch begins
        {
            if (_playerIsInControl && IsPlayerSwitchingUnderArrestDeadOrLoading())
            {
                Logger.Log("OnTick(): Player has lost control of " + CurrentPlayerName);
                switch (CurrentPlayerName)
                {
                case "Michael":
                    _lastTimeMichaelWasInControl.Restart();
                    break;

                case "Franklin":
                    _lastTimeFranklinWasInControl.Restart();
                    break;

                case "Trevor":
                    _lastTimeTrevorWasInControl.Restart();
                    break;

                default:
                    Logger.Log("OnTick(): couldn't match on character name. This should never happen.");
                    _lastTimeMichaelWasInControl.Restart();
                    _lastTimeFranklinWasInControl.Restart();
                    _lastTimeTrevorWasInControl.Restart();
                    break;
                }
                _playerIsInControl = false;
                return;
            }

            // when player switch ends
            if (!_playerIsInControl && !IsPlayerSwitchingUnderArrestDeadOrLoading())
            {
                CurrentPlayerName = ((PedHash)Game.Player.Character.Model.Hash).ToString();
                Logger.Log("OnTick(): Player has gained control of " + CurrentPlayerName);
                _playerIsInControl = true;
                switch (CurrentPlayerName)
                {
                case "Michael":
                    Logger.Log("OnTick(): _lastTimeMichaelWasInControl.ElapsedMilliseconds " + _lastTimeMichaelWasInControl.ElapsedMilliseconds);
                    if (_lastTimeMichaelWasInControl.ElapsedMilliseconds > _millisecondsToDelayQualityOfLife)
                    {
                        ProvideQualityOfLifeForCharacter();
                    }
                    break;

                case "Franklin":
                    Logger.Log("OnTick(): _lastTimeFranklinWasInControl.ElapsedMilliseconds " + _lastTimeFranklinWasInControl.ElapsedMilliseconds);
                    if (_lastTimeFranklinWasInControl.ElapsedMilliseconds > _millisecondsToDelayQualityOfLife)
                    {
                        ProvideQualityOfLifeForCharacter();
                    }
                    break;

                case "Trevor":
                    Logger.Log("OnTick(): _lastTimeTrevorWasInControl.ElapsedMilliseconds " + _lastTimeTrevorWasInControl.ElapsedMilliseconds);
                    if (_lastTimeTrevorWasInControl.ElapsedMilliseconds > _millisecondsToDelayQualityOfLife)
                    {
                        ProvideQualityOfLifeForCharacter();
                    }
                    break;

                default:
                    Logger.Log("OnTick(): couldn't match on character name. This should never happen.");
                    break;
                }
            }

            _mainMenu.OnTickHandler();
            PersonalVehicleController.UpdateHandler(CurrentPlayerName, _playerIsInControl);
            XBoxControllerUpdate();
            //Logger.LogFPS(); // this file gets big fast...
        }