-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using HarmonyLib; | ||
using Monitor; | ||
using Process; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
namespace AquaMai.UX; | ||
|
||
public class CustomLogo | ||
{ | ||
private static List<Sprite> segaLogo = new(); | ||
private static List<Sprite> allNetLogo = new(); | ||
|
||
public static void DoCustomPatch(HarmonyLib.Harmony h) | ||
{ | ||
EnumSprite(segaLogo, Path.Combine(Environment.CurrentDirectory, "LocalAssets", "SegaLogo")); | ||
EnumSprite(allNetLogo, Path.Combine(Environment.CurrentDirectory, "LocalAssets", "AllNetLogo")); | ||
} | ||
|
||
private static void EnumSprite(List<Sprite> collection, string path) | ||
{ | ||
if (!Directory.Exists(path)) return; | ||
foreach (var file in Directory.EnumerateFiles(path, "*.png")) | ||
{ | ||
var data = File.ReadAllBytes(file); | ||
var texture2D = new Texture2D(1, 1, TextureFormat.RGBA32, false); | ||
if (texture2D.LoadImage(data)) | ||
{ | ||
collection.Add(Sprite.Create(texture2D, new Rect(0f, 0f, texture2D.width, texture2D.height), new Vector2(0.5f, 0.5f))); | ||
} | ||
} | ||
} | ||
|
||
[HarmonyPatch(typeof(AdvertiseProcess), "OnStart")] | ||
[HarmonyPostfix] | ||
private static void AdvProcessPostFix(AdvertiseMonitor[] ____monitors) | ||
{ | ||
if (segaLogo.Count > 0) | ||
{ | ||
foreach (var monitor in ____monitors) | ||
{ | ||
monitor.transform.Find("Canvas/Main/SegaAllNet_LOGO/NUL_ADT_SegaAllNet_LOGO/SegaLogo").GetComponent<Image>().sprite = segaLogo[UnityEngine.Random.Range(0, segaLogo.Count)]; | ||
} | ||
} | ||
|
||
if (allNetLogo.Count > 0) | ||
{ | ||
foreach (var monitor in ____monitors) | ||
{ | ||
monitor.transform.Find("Canvas/Main/SegaAllNet_LOGO/NUL_ADT_SegaAllNet_LOGO/AllNetLogo").GetComponent<Image>().sprite = (allNetLogo[UnityEngine.Random.Range(0, allNetLogo.Count)]); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters