-
Notifications
You must be signed in to change notification settings - Fork 1
/
EntryPoint.cs
54 lines (46 loc) · 1.59 KB
/
EntryPoint.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using HarmonyLib;
using SALT;
using SALT.Extensions;
using SALT.Registries;
using SALT.Config;
using SALT.Console;
using SALT.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace OhFuck
{
public class EntryPoint : ModEntryPoint
{
/// <summary>THE EXECUTING ASSEMBLY</summary>
public static Assembly execAssembly;
public static AssetBundle bundle;
public override void PreLoad()
{
// Gets the Assembly being executed
execAssembly = Assembly.GetExecutingAssembly();
HarmonyInstance.PatchAll(execAssembly);
bundle = LoadAssetbundle("ohfuck");
}
public override void Load()
{
CharacterPack ame = CharacterRegistry.GetCharacter(Character.AMELIA).GetComponent<CharacterPack>();
CharacterPack ame_mous = CharacterRegistry.GetCharacter(Character.AMELIA_MOUSTACHE).GetComponent<CharacterPack>();
var clone = ame.deathSounds.ToList();
AudioClip oh_fuck = bundle.LoadAsset<AudioClip>("oh_fuck");
clone.Add(oh_fuck);
ame.deathSounds = clone;
ame_mous.deathSounds = clone;
}
public static AssetBundle LoadAssetbundle(string name)
{
Stream stream = execAssembly.GetManifestResourceStream(typeof(EntryPoint), name);
if (stream == null)
throw new Exception("AssetBundle " + name + " was not found");
return AssetBundle.LoadFromStream(stream);
}
}
}