Ejemplo n.º 1
0
        private void FxHighlight_OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index, UIMenuItem itemToControl, FxName fxName, string asset, bool useEvolutionArg = false)
        {
            if (selectedItem == itemToControl)
            {
                PTFXHelper.RemovePTFX(fxHandle);

                if (itemToControl.Text == "REMOVED")
                {
                    return;
                }

                Ped player = Game.Player.Character;

                PlayLoopOrNonLoopedFX(player.IsInVehicle() ? player.CurrentVehicle : (Entity)player, asset, fxName, useEvolutionArg);

                lastAsset  = asset;
                lastFXName = fxName;

                if (Game.IsKeyPressed(Keys.ShiftKey))
                {
                    if (sender == FavouritesMenu || (sender.ParentMenu != null && sender.ParentMenu == FavouritesMenu)) //Remove from favourites
                    {
                        try
                        {
                            FavouritesList.Remove(FavouritesList.Find(d => d.FxName == fxName && d.AssetName == asset));
                            ForceDecimal();
                            XMLHelper.SaveObjectToXML(FavouritesList, @"scripts\ParticleFxFavourites.xml");

                            if (sender == FavouritesMenu)
                            {
                                itemToControl.Text        = "REMOVED";
                                itemToControl.Value       = null;
                                itemToControl.Description = null;
                            }
                            else if (sender.ParentMenu != null && sender.ParentMenu == FavouritesMenu)
                            {
                                sender.Title                  = "REMOVED";
                                sender.ParentItem.Text        = "REMOVED";
                                sender.ParentItem.Description = null;
                            }

                            UI.ShowSubtitle("Removed from Favourites!");
                        }
                        catch { }
                    }
                    else //Add to favourites
                    {
                        DetailedFx newFav = new DetailedFx(asset, fxName);
                        FavouritesList.Add(newFav);
                        ForceDecimal();
                        XMLHelper.SaveObjectToXML(FavouritesList, @"scripts\ParticleFxFavourites.xml");
                        UI.ShowSubtitle("Saved to Favourites!");

                        favLastIndex      = FavouritesMenu.SelectedIndex;
                        rebuildFavourites = true;
                        allowMenuDraw     = false;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        void PlayLoopOrNonLoopedFX(Entity e, string asset, FxName fxName, bool useEvolutionArgument)
        {
            if (!PTFXHelper.HasNamedPTFXAssetLoaded(asset))
            {
                PTFXHelper.RequestNamedPTFXAsset(asset);
                UI.ShowSubtitle("~r~ PTFX asset is not loaded, please try again ~n~ PTFX asset may not exist..");
            }

            if (PTFXHelper.HasNamedPTFXAssetLoaded(asset))
            {
                string  fxType;
                Vector3 pos = e.Position + e.ForwardVector * 2f + e.RightVector * 1.5f;

                fxHandle = PTFXHelper.SpawnPTFXOnEntity(asset, fxName.PTFXName, e, new Vector3(1.5f, 2f, 0f), new Vector3(0.0f, 0.0f, 180.0f), fxSize);
                fxType   = "Looped on Entity";

                /*if (!PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                 * {
                 *  fxHandle = PTFXHelper.SpawnPTFXOnEntityBone(asset, fxname, e, default(Vector3), default(Vector3), (int)Bone.IK_R_Hand, fxSize);
                 *  fxType = "Looped on Entity Bone";
                 * }
                 *
                 * if (!PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                 * {
                 *  fxHandle = PTFXHelper.SpawnPTFXOnPedBone(asset, fxname, (Ped)e, default(Vector3), default(Vector3), (int)Bone.IK_R_Hand, fxSize);
                 *  fxType = "Looped on Ped Bone";
                 * }*/

                if (!PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                {
                    fxHandle = PTFXHelper.SpawnPTFXAtCoordinate(asset, fxName.PTFXName, pos, new Vector3(0, 0, 180.0f), fxSize);
                    fxType   = "Looped on Coordinate";
                }

                if (!PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                {
                    PTFXHelper.StartPTFXOnEntity(asset, fxName.PTFXName, e, new Vector3(1.5f, 2f, 0f), new Vector3(0.0f, 0.0f, 180.0f), fxSize);
                    PTFXHelper.StartPTFXAtCoordinate(asset, fxName.PTFXName, pos, new Vector3(0, 0, 180.0f), fxSize);
                    fxType = "Non Looped on Entity or on Coordinate, or doesn't work :(";
                }

                UI.ShowSubtitle("PTFX Spawn Type: " + fxType);

                if (useEvolutionArgument && PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                {
                    foreach (var evo in fxName.EvolutionList)
                    {
                        PTFXHelper.SetEvolution(fxHandle, evo.EvolutionName, evo.Amount);
                        PTFXHelper.SetAlpha(fxHandle, 1);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void FxEvolution_OnItemLeftRight(UIMenu sender, UIMenuItem selectedItem, int index, bool left, UIMenuItem itemToControl, string fxName, string asset, bool useEvolutionArg, FxEvolution evo, string evolutionArg = "")
 {
     if (selectedItem == itemToControl)
     {
         evo.Amount = sender.ControlFloatValue(itemToControl, left, evo.Amount, 0.1f, 0.01f, 2, true);
         if (PTFXHelper.DoesPTFXLoopedExist(fxHandle))
         {
             PTFXHelper.SetEvolution(fxHandle, evolutionArg, evo.Amount);
             PTFXHelper.SetAlpha(fxHandle, 1);
         }
     }
 }
Ejemplo n.º 4
0
        private void FXMenu_OnItemLeftRight(UIMenu sender, UIMenuItem selectedItem, int index, bool left)
        {
            if (selectedItem == ItemFxSize)
            {
                fxSize = FXMenu.ControlFloatValue(ItemFxSize, left, fxSize, 0.1f, 1.0f);
                if (PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                {
                    PTFXHelper.SetScale(fxHandle, fxSize);
                }
            }

            else if (selectedItem == ItemColourR)
            {
                colourR = FXMenu.ControlFloatValue(ItemColourR, left, colourR, 1f, 10f, 0, true, 0f, 255.0f);
                if (PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                {
                    PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB);
                }
            }

            else if (selectedItem == ItemColourG)
            {
                colourG = FXMenu.ControlFloatValue(ItemColourG, left, colourG, 1f, 10f, 0, true, 0f, 255.0f);
                if (PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                {
                    PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB);
                }
            }

            else if (selectedItem == ItemColourB)
            {
                colourB = FXMenu.ControlFloatValue(ItemColourB, left, colourB, 1f, 10f, 0, true, 0f, 255.0f);
                if (PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                {
                    PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB);
                }
            }

            else if (selectedItem == ItemRange)
            {
                rangeFx = FXMenu.ControlFloatValue(ItemRange, left, rangeFx, 0.1f, 1f, 1);
                if (PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                {
                    PTFXHelper.SetRange(fxHandle, rangeFx);
                }
            }
        }
Ejemplo n.º 5
0
 void ForceRemoveSurroundingFX(Entity e)
 {
     PTFXHelper.RemovePTFX(fxHandle);
     PTFXHelper.RemovePTFXInRange(e.Position, 10f);
 }
Ejemplo n.º 6
0
        private void FXMenu_OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)
        {
            if (selectedItem == ItemRemoveNearbyFx)
            {
                ForceRemoveSurroundingFX(Game.Player.Character);
            }

            if (selectedItem == ItemSearch)
            {
                searchString = Game.GetUserInput(25);
                if (searchString == null || searchString == "")
                {
                    FXMenu.IsVisible = false; SearchMenu.IsVisible = true; return;
                }
                SearchMenu.ResetIndexPosition();
                SearchMenu.SelectedItem = null;
                if (SearchMenu.UIMenuItemList.Count > 0)
                {
                    SearchMenu.UIMenuItemList.Clear();
                }
                FXMenu.IsVisible = false; SearchMenu.IsVisible = true;

                doSearch      = true;
                allowMenuDraw = false;
            }

            if (selectedItem == ItemMoveTask)
            {
                if (PlayerIsTaskedToMove)
                {
                    Game.Player.Character.Task.ClearAll();
                    PlayerIsTaskedToMove = false;
                }
                else
                {
                    if (Game.Player.Character.IsInVehicle())
                    {
                        Game.Player.Character.Task.CruiseWithVehicle(Game.Player.Character.CurrentVehicle, 50f, 6); //gtaforums.com/topic/822314-guide-driving-styles/
                    }
                    else
                    {
                        Game.Player.Character.Task.WanderAround();
                    }
                    PlayerIsTaskedToMove = true;
                }
            }

            if (selectedItem == ItemColourR || selectedItem == ItemColourG || selectedItem == ItemColourB || selectedItem == ItemFxSize || selectedItem == ItemRange)
            {
                if (lastAsset != null && lastFXName != null)
                {
                    PTFXHelper.RemovePTFX(fxHandle);

                    Ped player = Game.Player.Character;

                    PlayLoopOrNonLoopedFX(player.IsInVehicle() ? player.CurrentVehicle : (Entity)player, lastAsset, lastFXName, lastFXName.EvolutionList.Count > 0 ? true : false);

                    if (PTFXHelper.DoesPTFXLoopedExist(fxHandle))
                    {
                        if (selectedItem == ItemColourR || selectedItem == ItemColourG || selectedItem == ItemColourB)
                        {
                            PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB);
                        }
                        else if (selectedItem == ItemRange)
                        {
                            PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB);
                            PTFXHelper.SetRange(fxHandle, rangeFx);
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
 private void OnAbort(object sender, EventArgs e)
 {
     PTFXHelper.RemovePTFX(fxHandle);
     ForceRemoveSurroundingFX(Game.Player.Character);
 }