using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using CrewBoomMono; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("CrewBoomMono")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Library to supply monobehaviours for Crew Boom characters.")] [assembly: AssemblyFileVersion("1.10.0.0")] [assembly: AssemblyInformationalVersion("1.10.0+905ea7ff42b19009cf72f409d144f6bc9dad7f19")] [assembly: AssemblyProduct("CrewBoomMono")] [assembly: AssemblyTitle("CrewBoomMono")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.10.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CrewBoom.Mono { public class EmbeddedBundle : IDisposable { private const string Magic = "STREAM"; private const byte Version = 0; private string _path; private FileStream _stream; public EmbeddedBundle(string bundlePath) { _path = bundlePath; } public void OpenRead() { Close(); _stream = new FileStream(_path, FileMode.Open, FileAccess.Read); } public void OpenWrite() { Close(); _stream = new FileStream(_path, FileMode.Open, FileAccess.Write); } public void Close() { if (_stream != null) { _stream.Dispose(); } _stream = null; } public void Dispose() { if (_stream != null) { _stream.Dispose(); } } public AssetBundle LoadAssetBundle() { Close(); return AssetBundle.LoadFromFile(_path); } public void AppendStreamData(CharacterStreamData streamData) { if (_stream == null) { throw new IOException("There isn't any stream open to write!"); } if (!_stream.CanWrite) { throw new IOException("The FileStream can't write!"); } _stream.Seek(0L, SeekOrigin.End); int value = (int)_stream.Position; using BinaryWriter binaryWriter = new BinaryWriter(_stream); streamData.Write(binaryWriter); binaryWriter.Write(value); binaryWriter.Write(Encoding.ASCII.GetBytes("STREAM")); binaryWriter.Write((byte)0); } public bool TryRetrieveStreamData(out CharacterStreamData streamData) { if (_stream == null) { throw new IOException("There isn't any stream open to read!"); } if (!_stream.CanRead) { throw new IOException("The FileStream can't read!"); } streamData = null; int num = "STREAM".Length + 1; _stream.Seek(-num, SeekOrigin.End); byte[] array = new byte[num]; _stream.Read(array, 0, num); if (Encoding.ASCII.GetString(array, 0, "STREAM".Length) != "STREAM") { return false; } byte b = array[6]; if (b < 0 || b > 0) { throw new IOException($"Unrecognized Stream Data version {b}"); } _stream.Seek(-num - 4, SeekOrigin.End); byte[] array2 = new byte[4]; _stream.Read(array2, 0, 4); int num2 = BitConverter.ToInt32(array2, 0); _stream.Seek(num2, SeekOrigin.Begin); using (BinaryReader reader = new BinaryReader(_stream)) { streamData = new CharacterStreamData(); streamData.Read(reader); } return true; } } } namespace CrewBoomMono { [AddComponentMenu("Crew Boom/Character Definition")] public class CharacterDefinition : MonoBehaviour { public bool OverrideBundleFilename; public string BundleFilename = ""; public string CharacterName = "New Custom Character"; public BrcCharacter FreestyleAnimation = BrcCharacter.Red; public BrcCharacter BounceAnimation = BrcCharacter.Red; public BrcMovestyle DefaultMovestyle = BrcMovestyle.Skateboard; public UnlockType UnlockType; public string BoEBounceAnimation = ""; public bool BoEBounceAnimationVanilla; public SkinnedMeshRenderer[] Renderers; public CharacterOutfit[] Outfits; public Material Graffiti; public string GraffitiName; public string GraffitiArtist; public AudioClip[] VoiceDie; public AudioClip[] VoiceDieFall; public AudioClip[] VoiceTalk; public AudioClip[] VoiceBoostTrick; public AudioClip[] VoiceCombo; public AudioClip[] VoiceGetHit; public AudioClip[] VoiceJump; public bool CanBlink; public string Id; } public class CharacterConfig { public string CharacterToReplace = "None"; } public enum BrcCharacter { None = -1, Vinyl, Frank, Coil, Red, Tryce, Bel, Rave, DotExeMember, Solace, DjCyber, EclipseMember, DevilTheoryMember, FauxWithBoostPack, FleshPrince, Irene, Felix, OldHeadMember, Base, Jet, Mesh, FuturismMember, Rise, Shine, FauxWithoutBoostPack, DotExeBoss, FelixWithCyberHead } public enum BrcMovestyle { Bmx = 1, Skateboard, Skates } public enum UnlockType { AlwaysUnlocked, Unlockable, Locked } public class CharacterOutfit : MonoBehaviour { public string Name; public bool[] EnabledRenderers; public CharacterOutfitRenderer[] MaterialContainers; } public class CharacterOutfitRenderer : MonoBehaviour { public Material[] Materials; public bool[] UseShaderForMaterial; } public class CharacterStreamData { private const byte Version = 0; public string Id; public UnlockType UnlockType; public BrcMovestyle DefaultMoveStyle; public string Name; public string GrafTitle; public string GrafAuthor; public bool HasGraffiti; public BrcCharacter IdleDance; public string BoEIdleDance; public bool BoEIdleDanceVanilla; public Texture2D GraffitiTexture; public void FromCharacter(CharacterDefinition character) { Id = character.Id; UnlockType = character.UnlockType; DefaultMoveStyle = character.DefaultMovestyle; Name = character.CharacterName; HasGraffiti = (Object)(object)character.Graffiti != (Object)null; GrafTitle = character.GraffitiName; GrafAuthor = character.GraffitiArtist; IdleDance = character.BounceAnimation; BoEIdleDance = character.BoEBounceAnimation; BoEIdleDanceVanilla = character.BoEBounceAnimationVanilla; if (HasGraffiti) { Texture mainTexture = character.Graffiti.mainTexture; CopyGraffitiTexture((Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null)); } } public void Write(BinaryWriter writer) { writer.Write((byte)0); writer.Write(Id); writer.Write((int)UnlockType); writer.Write((int)DefaultMoveStyle); writer.Write(Name); writer.Write(HasGraffiti); writer.Write(GrafTitle); writer.Write(GrafAuthor); writer.Write((int)IdleDance); writer.Write(BoEIdleDance); writer.Write(BoEIdleDanceVanilla); if (HasGraffiti) { byte[] array = ImageConversion.EncodeToPNG(GraffitiTexture); writer.Write(array.Length); writer.Write(array); } } public void Read(BinaryReader reader, bool grafreadable = false) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown reader.ReadByte(); Id = reader.ReadString(); UnlockType = (UnlockType)reader.ReadInt32(); DefaultMoveStyle = (BrcMovestyle)reader.ReadInt32(); Name = reader.ReadString(); HasGraffiti = reader.ReadBoolean(); GrafTitle = reader.ReadString(); GrafAuthor = reader.ReadString(); IdleDance = (BrcCharacter)reader.ReadInt32(); BoEIdleDance = reader.ReadString(); BoEIdleDanceVanilla = reader.ReadBoolean(); if (HasGraffiti) { int count = reader.ReadInt32(); byte[] array = reader.ReadBytes(count); GraffitiTexture = new Texture2D(2, 2); ImageConversion.LoadImage(GraffitiTexture, array, !grafreadable); } } private void CopyGraffitiTexture(Texture2D source) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) RenderTexture temporary = RenderTexture.GetTemporary(((Texture)source).width, ((Texture)source).height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); Graphics.Blit((Texture)(object)source, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; GraffitiTexture = new Texture2D(((Texture)source).width, ((Texture)source).height, (TextureFormat)5, false); GraffitiTexture.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); GraffitiTexture.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); } public void Release() { if ((Object)(object)GraffitiTexture != (Object)null) { Object.DestroyImmediate((Object)(object)GraffitiTexture); } } } }