Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
yukieiji committed Mar 10, 2024
2 parents babd858 + b8c8602 commit 42e3254
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 101 deletions.
4 changes: 2 additions & 2 deletions ExtremeRoles/ExtremeRoles.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<WarningLevel>7</WarningLevel>
<!--<Version>10.0.0.0</Version>-->
<VersionPrefix>10.0.0</VersionPrefix>
<Version>10.0.0.1</Version>
<!--<VersionPrefix>10.0.0</VersionPrefix>-->
<VersionSuffix>AmongUsV2024305</VersionSuffix>
<Description>Extreme Roles for Advanced user</Description>
<Authors>yukieiji</Authors>
Expand Down
21 changes: 21 additions & 0 deletions ExtremeRoles/Helper/GameSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,27 @@ public static void AddSpawnPoint(in List<Vector2> pos, in byte playerId)
}
}

public static ArrowBehaviour GetArrowTemplate()
{
ArrowBehaviour? template = null;

foreach (var task in CachedShipStatus.Instance.SpecialTasks)
{
if (!task.IsTryCast<SabotageTask>(out var saboTask) ||
saboTask!.Arrows.Count == 0)
{
continue;
}
template = saboTask!.Arrows[0];
break;
}
if (template == null)
{
throw new ArgumentNullException("Arrow is Null!!");
}
return template;
}

public static ShipStatus GetShipObj(byte mapId)
{
byte optionMapId = GameOptionsManager.Instance.CurrentGameOptions.GetByte(
Expand Down
116 changes: 53 additions & 63 deletions ExtremeRoles/Module/Arrow.cs
Original file line number Diff line number Diff line change
@@ -1,88 +1,78 @@
using UnityEngine;

using ExtremeRoles.Module.CustomMonoBehaviour;
using ExtremeRoles.Helper;

namespace ExtremeRoles.Module
namespace ExtremeRoles.Module;

#nullable enable

public sealed class Arrow
{
public GameObject Main
{
get => this.arrowBehaviour.gameObject;
}

public Vector3 Target { get; private set; }

private readonly ArrowBehaviour arrowBehaviour;
private static readonly Vector3 defaultPos = new Vector3(100.0f, 100.0f, 100.0f);
private static ArrowBehaviour? arrow = null;

public sealed class Arrow
public Arrow(Color color)
{
public GameObject Main
if (arrow == null)
{
get => this.body;
arrow = GameSystem.GetArrowTemplate();
}

public Vector3 Target { get; private set; }
this.arrowBehaviour = Object.Instantiate(arrow);
this.arrowBehaviour.gameObject.SetActive(true);
this.arrowBehaviour.image.color = color;
this.arrowBehaviour.MaxScale = 0.75f;

private const float xzMaxSize = 0.4f;
private const float yMaxSize = 0.525f;

private GameObject body;
private SpriteRenderer image;
private ArrowBehaviour arrowBehaviour;
private static readonly Vector3 defaultPos = new Vector3(100.0f, 100.0f, 100.0f);
this.Target = defaultPos;
}

public Arrow(Color color)
public void Update()
{
if (this.Target == defaultPos)
{
this.body = new GameObject("Arrow");

this.body.layer = 5;
this.image = this.body.AddComponent<SpriteRenderer>();

if (Prefab.Arrow != null)
{
this.image.sprite = Prefab.Arrow;
}
this.image.color = color;
this.arrowBehaviour = this.body.AddComponent<ArrowBehaviour>();
this.arrowBehaviour.image = this.image;

Resizeer resizer = this.body.AddComponent<Resizeer>();
resizer.SetScale(xzMaxSize, yMaxSize, xzMaxSize);
this.Target = defaultPos;
this.Target = Vector3.zero;
}
UpdateTarget();
}

public void Update()
public void SetColor(Color? color = null)
{
if (color.HasValue)
{
if (Prefab.Arrow != null && this.image == null)
{
this.image.sprite = Prefab.Arrow;
}
if (this.Target == defaultPos)
{
this.Target = Vector3.zero;
}
UpdateTarget();
this.arrowBehaviour.image.color = color.Value;
}
}

public void SetColor(Color? color = null)
public void UpdateTarget(Vector3? target = null)
{
if (this.arrowBehaviour == null) { return; }

if (target.HasValue)
{
if (color.HasValue) { this.image.color = color.Value; };
this.Target = target.Value;
}

public void UpdateTarget(Vector3? target = null)
{
if (this.body == null) { return; }
this.arrowBehaviour.target = this.Target;
}

if (target.HasValue)
{
this.Target = target.Value;
}
public void Clear()
{
if (this.arrowBehaviour == null) { return; }

this.arrowBehaviour.target = this.Target;
this.arrowBehaviour.Update();
}
Object.Destroy(this.arrowBehaviour);
}
public void SetActive(bool active)
{
if (this.arrowBehaviour == null) { return; }

public void Clear()
{
Object.Destroy(this.body);
}
public void SetActive(bool active)
{
if (this.body != null)
{
this.body.SetActive(active);
}
}
this.arrowBehaviour.gameObject.SetActive(active);
}
}
6 changes: 1 addition & 5 deletions ExtremeRoles/Module/CustomMonoBehaviour/ExtremeConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@

namespace ExtremeRoles.Module.CustomMonoBehaviour;

[Il2CppRegister(
new Type[]
{
typeof(IUsable)
})]
[Il2CppRegister([ typeof(IUsable) ])]
public sealed class ExtremeConsole : MonoBehaviour, IAmongUs.IUsable
{
public interface IBehavior
Expand Down
21 changes: 0 additions & 21 deletions ExtremeRoles/Module/CustomMonoBehaviour/ExtremePlayerTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,6 @@ public interface IBehavior
public void OnRemove();
public void OnComplete();

protected static ArrowBehaviour GetArrowTemplate()
{
ArrowBehaviour? template = null;

foreach (var task in CachedShipStatus.Instance.SpecialTasks)
{
if (!task.IsTryCast<SabotageTask>(out var saboTask) ||
saboTask!.Arrows.Count == 0)
{
continue;
}
template = saboTask!.Arrows[0];
break;
}
if (template == null)
{
throw new ArgumentNullException("Arrow is Null!!");
}
return template;
}

protected static void CloseMinigame<T>() where T : Minigame
{
if (Minigame.Instance.IsTryCast<T>(out var targetMinigame) &&
Expand Down
1 change: 0 additions & 1 deletion ExtremeRoles/Module/Prefab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace ExtremeRoles.Module;

public static class Prefab
{
public static Sprite Arrow;
public static TextMeshPro Text;
public static GenericPopup Prop;
public static PoolablePlayer PlayerPrefab;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void Initialize(PlayerControl owner, Transform transform)
{
if (owner == null || !owner.AmOwner) { return; }

ArrowBehaviour arrow = ExtremePlayerTask.IBehavior.GetArrowTemplate();
ArrowBehaviour arrow = GameSystem.GetArrowTemplate();

foreach (var (index, console) in this.system.setBomb)
{
Expand Down
4 changes: 0 additions & 4 deletions ExtremeRoles/Patches/Manager/GameStartManagerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ public static void StartPrefix(GameStartManager __instance)
[HarmonyPatch(typeof(GameStartManager), nameof(GameStartManager.Start))]
public static void StartPostfix(GameStartManager __instance)
{
if (Module.Prefab.Arrow == null)
{
Module.Prefab.Arrow = __instance.StartButton.sprite;
}
updateText(__instance, DataManager.Settings.Gameplay.StreamerMode);
}

Expand Down
2 changes: 1 addition & 1 deletion ExtremeRoles/Roles/Combination/HeroAcademia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public AllPlayerArrows(byte rolePlayerId)

var text = GameObject.Instantiate(
Prefab.Text, playerArrow.Main.transform);
text.fontSize = text.fontSizeMax = text.fontSizeMin = 3.8f;
text.fontSize = text.fontSizeMax = text.fontSizeMin = 3.25f;
Object.Destroy(text.fontMaterial);
text.fontMaterial = UnityEngine.Object.Instantiate(
FastDestroyableSingleton<HudManager>.Instance.UseButton.buttonLabelText.fontMaterial,
Expand Down
4 changes: 2 additions & 2 deletions ExtremeSkins/ExtremeSkins.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<WarningLevel>7</WarningLevel>
<!--<Version>9.0.0.0</Version>-->
<VersionPrefix>9.0.0</VersionPrefix>
<Version>9.0.0.1</Version>
<!--<VersionPrefix>9.0.0</VersionPrefix>-->
<VersionSuffix>AmongUsV2024305</VersionSuffix>
<Description>Extreme Skins for Extreme Roles</Description>
<Authors>yukieiji</Authors>
Expand Down
2 changes: 1 addition & 1 deletion ExtremeVoiceEngine/ExtremeVoiceEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<WarningLevel>7</WarningLevel>
<Version>2.0.0.51</Version>
<Version>2.0.0.52</Version>
<!--<VersionPrefix>2.0.0</VersionPrefix>-->
<VersionSuffix>AmongUsV20230711</VersionSuffix>
<Description>Extreme Voice Engine for bridging Extreme Roles and Voice Engine</Description>
Expand Down

0 comments on commit 42e3254

Please sign in to comment.