mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 15:40:29 +01:00
Changed selectable menu item text color to Gold. Updated rotation step to 10
This commit is contained in:
parent
bee2d44c4a
commit
2d08f9e2b5
1 changed files with 23 additions and 13 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -17,7 +18,7 @@ namespace SceneManager
|
||||||
// TODO: Refactor as dictionary
|
// TODO: Refactor as dictionary
|
||||||
private static UIMenuListScrollerItem<string> barrierList = new UIMenuListScrollerItem<string>("Select Barrier", "", new[] { "Large Striped Cone", "Large Cone", "Medium Striped Cone", "Medium Cone", "Roadpole A", "Roadpole B", "Police Barrier", "Road Barrier", "Flare" });
|
private static UIMenuListScrollerItem<string> barrierList = new UIMenuListScrollerItem<string>("Select Barrier", "", new[] { "Large Striped Cone", "Large Cone", "Medium Striped Cone", "Medium Cone", "Roadpole A", "Roadpole B", "Police Barrier", "Road Barrier", "Flare" });
|
||||||
private static string[] barrierObjectNames = new string[] { "prop_mp_cone_01", "prop_roadcone01c", "prop_mp_cone_02", "prop_mp_cone_03", "prop_roadpole_01a", "prop_roadpole_01b", "prop_barrier_work05", "prop_barrier_work06a", "prop_flare_01b" };
|
private static string[] barrierObjectNames = new string[] { "prop_mp_cone_01", "prop_roadcone01c", "prop_mp_cone_02", "prop_mp_cone_03", "prop_roadpole_01a", "prop_roadpole_01b", "prop_barrier_work05", "prop_barrier_work06a", "prop_flare_01b" };
|
||||||
private static UIMenuNumericScrollerItem<int> rotateBarrier = new UIMenuNumericScrollerItem<int>("Rotate Barrier", "Rotate the barrier.", 0, 359, 10);
|
private static UIMenuNumericScrollerItem<int> rotateBarrier = new UIMenuNumericScrollerItem<int>("Rotate Barrier", "Rotate the barrier.", 0, 350, 10);
|
||||||
private static UIMenuListScrollerItem<string> removeBarrierOptions = new UIMenuListScrollerItem<string>("Remove Barrier", "", new[] { "Last Barrier", "Nearest Barrier", "All Barriers" });
|
private static UIMenuListScrollerItem<string> removeBarrierOptions = new UIMenuListScrollerItem<string>("Remove Barrier", "", new[] { "Last Barrier", "Nearest Barrier", "All Barriers" });
|
||||||
public static Rage.Object shadowBarrier;
|
public static Rage.Object shadowBarrier;
|
||||||
|
|
||||||
|
|
@ -31,9 +32,14 @@ namespace SceneManager
|
||||||
public static void BuildBarrierMenu()
|
public static void BuildBarrierMenu()
|
||||||
{
|
{
|
||||||
barrierMenu.AddItem(removeBarrierOptions, 0);
|
barrierMenu.AddItem(removeBarrierOptions, 0);
|
||||||
|
removeBarrierOptions.ForeColor = Color.Gold;
|
||||||
removeBarrierOptions.Enabled = false;
|
removeBarrierOptions.Enabled = false;
|
||||||
|
|
||||||
barrierMenu.AddItem(rotateBarrier, 0);
|
barrierMenu.AddItem(rotateBarrier, 0);
|
||||||
|
|
||||||
barrierMenu.AddItem(barrierList, 0);
|
barrierMenu.AddItem(barrierList, 0);
|
||||||
|
barrierList.ForeColor = Color.Gold;
|
||||||
|
|
||||||
barrierMenu.RefreshIndex();
|
barrierMenu.RefreshIndex();
|
||||||
|
|
||||||
barrierMenu.OnItemSelect += BarrierMenu_OnItemSelected;
|
barrierMenu.OnItemSelect += BarrierMenu_OnItemSelected;
|
||||||
|
|
@ -78,7 +84,7 @@ namespace SceneManager
|
||||||
DisableBarrierMenuOptionsIfShadowConeTooFar();
|
DisableBarrierMenuOptionsIfShadowConeTooFar();
|
||||||
shadowBarrier.Position = TracePlayerView(15, TraceFlags.IntersectEverything).HitPosition;
|
shadowBarrier.Position = TracePlayerView(15, TraceFlags.IntersectEverything).HitPosition;
|
||||||
Rage.Native.NativeFunction.Natives.PLACE_OBJECT_ON_GROUND_PROPERLY(shadowBarrier);
|
Rage.Native.NativeFunction.Natives.PLACE_OBJECT_ON_GROUND_PROPERLY(shadowBarrier);
|
||||||
shadowBarrier.Heading = rotateBarrier.Index;
|
shadowBarrier.Heading = rotateBarrier.Value;
|
||||||
|
|
||||||
void DisableBarrierMenuOptionsIfShadowConeTooFar()
|
void DisableBarrierMenuOptionsIfShadowConeTooFar()
|
||||||
{
|
{
|
||||||
|
|
@ -87,6 +93,11 @@ namespace SceneManager
|
||||||
barrierList.Enabled = false;
|
barrierList.Enabled = false;
|
||||||
rotateBarrier.Enabled = false;
|
rotateBarrier.Enabled = false;
|
||||||
}
|
}
|
||||||
|
else if(shadowBarrier.Position.DistanceTo2D(Game.LocalPlayer.Character.Position) <= 15f && barrierList.SelectedItem == "Flare")
|
||||||
|
{
|
||||||
|
barrierList.Enabled = true;
|
||||||
|
rotateBarrier.Enabled = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
barrierList.Enabled = true;
|
barrierList.Enabled = true;
|
||||||
|
|
@ -101,7 +112,7 @@ namespace SceneManager
|
||||||
{
|
{
|
||||||
CreateShadowBarrier(barrierMenu);
|
CreateShadowBarrier(barrierMenu);
|
||||||
|
|
||||||
if (barrierObjectNames[barrierList.Index] == "prop_flare_01b")
|
if(barrierList.SelectedItem == "Flare")
|
||||||
{
|
{
|
||||||
rotateBarrier.Enabled = false;
|
rotateBarrier.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
@ -123,8 +134,7 @@ namespace SceneManager
|
||||||
{
|
{
|
||||||
// Attach some invisible object to the cone which the AI try to drive around
|
// Attach some invisible object to the cone which the AI try to drive around
|
||||||
// Barrier rotates with cone and becomes invisible similar to ASC when created
|
// Barrier rotates with cone and becomes invisible similar to ASC when created
|
||||||
|
if(barrierList.SelectedItem == "Flare")
|
||||||
if (shadowBarrier.Model.Name == "prop_flare_01b".ToUpper())
|
|
||||||
{
|
{
|
||||||
SpawnFlare();
|
SpawnFlare();
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +153,7 @@ namespace SceneManager
|
||||||
|
|
||||||
private static void SpawnBarrier()
|
private static void SpawnBarrier()
|
||||||
{
|
{
|
||||||
var cone = new Rage.Object(shadowBarrier.Model, shadowBarrier.Position, rotateBarrier.Index);
|
var cone = new Rage.Object(shadowBarrier.Model, shadowBarrier.Position, rotateBarrier.Value);
|
||||||
cone.SetPositionWithSnap(shadowBarrier.Position);
|
cone.SetPositionWithSnap(shadowBarrier.Position);
|
||||||
Rage.Native.NativeFunction.Natives.SET_DISABLE_FRAG_DAMAGE(cone, true);
|
Rage.Native.NativeFunction.Natives.SET_DISABLE_FRAG_DAMAGE(cone, true);
|
||||||
Rage.Native.NativeFunction.Natives.SET_DISABLE_BREAKING(cone, true);
|
Rage.Native.NativeFunction.Natives.SET_DISABLE_BREAKING(cone, true);
|
||||||
|
|
@ -183,15 +193,15 @@ namespace SceneManager
|
||||||
private static void SpawnFlare()
|
private static void SpawnFlare()
|
||||||
{
|
{
|
||||||
var flare = new Weapon("weapon_flare", shadowBarrier.Position, 1);
|
var flare = new Weapon("weapon_flare", shadowBarrier.Position, 1);
|
||||||
flare.SetPositionWithSnap(shadowBarrier.Position);
|
//flare.SetPositionWithSnap(shadowBarrier.Position);
|
||||||
|
|
||||||
// The purpose of this fiber is to allow the flare to spawn and fall to the ground naturally before freezing its position because you can't spawn it on the ground gracefully (it stands upright)
|
// The purpose of this fiber is to allow the flare to spawn and fall to the ground naturally before freezing its position because you can't spawn it on the ground gracefully (it stands upright)
|
||||||
GameFiber.StartNew(delegate
|
//GameFiber.StartNew(delegate
|
||||||
{
|
//{
|
||||||
GameFiber.Sleep(1000);
|
// GameFiber.Sleep(1000);
|
||||||
flare.IsPositionFrozen = true;
|
// flare.IsPositionFrozen = true;
|
||||||
flare.IsCollisionEnabled = false;
|
// flare.IsCollisionEnabled = false;
|
||||||
});
|
//});
|
||||||
|
|
||||||
barriers.Add(flare);
|
barriers.Add(flare);
|
||||||
removeBarrierOptions.Enabled = true;
|
removeBarrierOptions.Enabled = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue