Skip to content

Commit

Permalink
Update Button for 3.5s
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardel-DW committed Mar 10, 2021
1 parent 6aa0c00 commit b3a686c
Show file tree
Hide file tree
Showing 18 changed files with 229 additions and 62 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
175 changes: 175 additions & 0 deletions Bundle Source/Overlay.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3668647659476866951
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7608622581512741164}
- component: {fileID: 450242223141283909}
- component: {fileID: 5691496797087729308}
m_Layer: 0
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7608622581512741164
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3668647659476866951}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 94361864308711762}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &450242223141283909
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3668647659476866951}
m_CullTransparentMesh: 0
--- !u!114 &5691496797087729308
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3668647659476866951}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 7d7298c2979dcd44cb3cf11fa9302bb7, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &8328478596661229829
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 94361864308711762}
- component: {fileID: 5525086368304608198}
- component: {fileID: 1800676283972863926}
- component: {fileID: 1244047861170702109}
m_Layer: 0
m_Name: Overlay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &94361864308711762
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8328478596661229829}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 7608622581512741164}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &5525086368304608198
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8328478596661229829}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 1
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &1800676283972863926
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8328478596661229829}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &1244047861170702109
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8328478596661229829}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
Binary file added Bundle Source/Rewind-Red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Bundle Source/Rewind.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Libs/Essentials-2021.3.5s.dll
Binary file not shown.
3 changes: 0 additions & 3 deletions RolesMods/Patch/HudPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public static void UpdateMeetingHUD(MeetingHud __instance) {

[HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))]
public static class HudUpdatePatch {

public static void Postfix(HudManager __instance) {
if (MeetingHud.Instance != null)
HudPatch.UpdateMeetingHUD(MeetingHud.Instance);
Expand All @@ -41,8 +40,6 @@ public static void Postfix(HudManager __instance) {
if (PlayerControl.AllPlayerControls.Count > 1 && GlobalVariable.PsychicList != null && HelperRoles.IsPsychic(PlayerControl.LocalPlayer.PlayerId))
PlayerControl.LocalPlayer.nameText.Color = new Color(0.73f, 0f, 0.73f, 1f);
}

CooldownButton.HudUpdate();
}
}
}
35 changes: 0 additions & 35 deletions RolesMods/Patch/MeetingPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,6 @@

namespace RolesMods.Patch {

[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Close))]
public static class MeetingClosePatch {

public static void Postfix(MeetingHud __instance) {
if (GlobalVariable.TimeMaster != null) {
if (HelperRoles.IsTimeMaster(PlayerControl.LocalPlayer.PlayerId)) {
GlobalVariable.buttonTime.Timer = RolesMods.TimeMasterCooldown.GetValue();
}
}

if (GlobalVariable.PsychicList != null) {
if (HelperRoles.IsPsychic(PlayerControl.LocalPlayer.PlayerId)) {
GlobalVariable.buttonPsychic.Timer = RolesMods.PsychicCooldown.GetValue();
}
}
}
}

[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Update))]
public static class MeetingUpdatePatch {
public static void Postfix(MeetingHud __instance) {
if (GlobalVariable.TimeMaster != null) {
if (HelperRoles.IsTimeMaster(PlayerControl.LocalPlayer.PlayerId)) {
GlobalVariable.buttonTime.SetCanUse(false);
}
}

if (GlobalVariable.PsychicList != null) {
if (HelperRoles.IsPsychic(PlayerControl.LocalPlayer.PlayerId)) {
GlobalVariable.buttonPsychic.SetCanUse(false);
}
}
}
}

[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Awake))]
public static class MeetingStartPatch {
public static void Postfix(MeetingHud __instance) {
Expand Down
10 changes: 9 additions & 1 deletion RolesMods/ResourceLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ namespace RolesMods {
public static class ResourceLoader {
private static readonly Assembly myAsembly = Assembly.GetExecutingAssembly();
public static GameObject Overlay;
public static Sprite RewindRedSprite;
public static Sprite RewindSprite;
public static Sprite FootprintSprite;
public static Sprite OverlaySprite;
public static Sprite ForsightSprite;

public static void LoadAssets() {
var resourceSteam = myAsembly.GetManifestResourceStream("RolesMods.Resources.psychic");
var resourceSteam = myAsembly.GetManifestResourceStream("RolesMods.Resources.bundle-toomanyrole");
var assetBundle = AssetBundle.LoadFromMemory(resourceSteam.ReadFully());

Overlay = assetBundle.LoadAsset<GameObject>("Overlay.prefab").DontDestroy();
RewindRedSprite = assetBundle.LoadAsset<Sprite>("Rewind-Red").DontDestroy();
RewindSprite = assetBundle.LoadAsset<Sprite>("Rewind").DontDestroy();
FootprintSprite = assetBundle.LoadAsset<Sprite>("Footprint").DontDestroy();
OverlaySprite = assetBundle.LoadAsset<Sprite>("Overlay").DontDestroy();
ForsightSprite = assetBundle.LoadAsset<Sprite>("Forsight").DontDestroy();
}
}
}
Binary file added RolesMods/Resources/Foresight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified RolesMods/Resources/Rewind.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RolesMods/Resources/bundle-toomanyrole
Binary file not shown.
Binary file removed RolesMods/Resources/psychic
Binary file not shown.
6 changes: 2 additions & 4 deletions RolesMods/RolesMods.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@

<ItemGroup>
<Deobfuscate Include="$(AmongUs)\BepInEx\plugins\Reactor-$(GameVersion).dll" />
<EmbeddedResource Include="Resources\bundle-toomanyrole"></EmbeddedResource>
<EmbeddedResource Include="Resources\Foresight.png"></EmbeddedResource>
<EmbeddedResource Include="Resources\Rewind.png"></EmbeddedResource>
<EmbeddedResource Include="Resources\Psychic.png"></EmbeddedResource>
<EmbeddedResource Include="Resources\Footprint.png"></EmbeddedResource>
<EmbeddedResource Include="Resources\Overlay.png"></EmbeddedResource>
<EmbeddedResource Include="Resources\psychic"></EmbeddedResource>
<PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="0.2.9" />
</ItemGroup>

Expand Down
5 changes: 2 additions & 3 deletions RolesMods/Systems/Psychic/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ public static void Postfix(HudManager __instance) {
GlobalVariable.buttonPsychic = new CooldownButton
(() => OnClick(),
RolesMods.PsychicCooldown.GetValue(),
"RolesMods.Resources.Psychic.png",
1008f,
"RolesMods.Resources.Foresight.png",
1000,
new Vector2(0f, 0f),
Visibility.Everyone,
__instance,
RolesMods.PsychicDuration.GetValue(),
() => OnEffectEnd(),
Expand Down
3 changes: 1 addition & 2 deletions RolesMods/Systems/TimeMaster/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ public static void Postfix(HudManager __instance) {
(() => OnClick(),
RolesMods.TimeMasterCooldown.GetValue(),
"RolesMods.Resources.Rewind.png",
250f,
250,
new Vector2(0f, 0f),
Visibility.Everyone,
__instance,
RolesMods.TimeMasterDuration.GetValue() / 2,
() => OnEffectEnd(),
Expand Down
Loading

0 comments on commit b3a686c

Please sign in to comment.