Decompiled source of UnitCreatorPlusPlus v3.0.7
MidnightCow_UnitCreator.dll
Decompiled an hour ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using DM; using HSVPicker; using HarmonyLib; using InControl; using Landfall.MonoBatch; using Landfall.TABC; using Landfall.TABS; using Landfall.TABS.AI.Components; using Landfall.TABS.AI.Components.Modifiers; using Landfall.TABS.AI.Components.Tags; using Landfall.TABS.AI.Systems; using Landfall.TABS.GameMode; using Landfall.TABS.GameState; using Landfall.TABS.Services; using Landfall.TABS.UnitEditor; using Landfall.TABS.Workshop; using LevelCreator; using Microsoft.CodeAnalysis; using MidnightCow; using MidnightCow.Assets; using MidnightCow.Database; using MidnightCow.Fields; using MidnightCow.Helpers; using Sirenix.Serialization; using TFBGames; using TMPro; using Unity.Collections; using Unity.Entities; using Unity.Jobs; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Profiling; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MidnightCow_UnitCreator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MidnightCow_UnitCreator")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("33906069-5a67-4c29-bc50-0aba1f53a497")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("UCPP_Addons")] [assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } [Serializable] public class ColorChangedEvent : UnityEvent<Color> { } public enum ColorValues { R, G, B, A, Hue, Saturation, Value, Glow } public class HSVChangedEvent : UnityEvent<float, float, float> { } [Serializable] public class MatIndexHolder { public Renderer renderer; public List<int> matIndexs; public MatIndexHolder(Renderer rnd, int firstIndex) { renderer = rnd; matIndexs = new List<int>(); matIndexs.Add(firstIndex); } } public class MC_CustomClickHandler : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { public UnityEvent onLeftClick; public UnityEvent onRightClick; public UnityEvent onMiddleClick; public void OnPointerClick(PointerEventData eventData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 if ((int)eventData.button == 0) { onLeftClick.Invoke(); } else if ((int)eventData.button == 1) { onRightClick.Invoke(); } else if ((int)eventData.button == 2) { onMiddleClick.Invoke(); } } } public class MC_GooglyFix : MonoBehaviour { private GooglyEyes googlyEyes; private bool googlyEyesSetup; private void Awake() { googlyEyes = MCCreator._instance.CreatorScreen.AddComponent<GooglyEyes>(); } private void Update() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown if (!googlyEyesSetup && (Object)googlyEyes != (Object)null && !(((object)googlyEyes).GetType().GetField("mainCamTransform", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(googlyEyes) is Transform) && (Object)MCCreator._instance.SceneCam != (Object)null) { ((object)googlyEyes).GetType().GetField("mainCamTransform", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(googlyEyes, MCCreator._instance.SceneCam.transform); googlyEyesSetup = true; } } } [Serializable] public class MC_MatHolder : MonoBehaviour { public Material originalMaterial; public Material curMaterial; public List<MatIndexHolder> RendererMatIndexHolders; public void AddMatIndex(Renderer rnd, int matIndex) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_002e: Expected O, but got Unknown bool flag = false; foreach (MatIndexHolder rendererMatIndexHolder in RendererMatIndexHolders) { if ((Object)rendererMatIndexHolder.renderer == (Object)rnd) { rendererMatIndexHolder.matIndexs.Add(matIndex); flag = true; } } if (!flag) { MatIndexHolder item = new MatIndexHolder(rnd, matIndex); RendererMatIndexHolders.Add(item); } } public void SetMaterial(Material newMat) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown MC_MatSpec mC_MatSpec = MC_MatSpec.Of(newMat); if (mC_MatSpec != null) { mC_MatSpec.slotName = (((Object)originalMaterial != (Object)null) ? ((Object)originalMaterial).name : mC_MatSpec.slotName); mC_MatSpec.Apply(newMat, originalMaterial); } foreach (MatIndexHolder rendererMatIndexHolder in RendererMatIndexHolders) { Renderer renderer = rendererMatIndexHolder.renderer; Material[] sharedMaterials = renderer.sharedMaterials; foreach (int matIndex in rendererMatIndexHolder.matIndexs) { Material val = sharedMaterials[matIndex]; if ((Object)(object)OwnTeamPair(renderer, matIndex, newMat) != (Object)null || (Same(val, newMat) && ((Object)newMat).name.ToLowerInvariant().Contains("tabs"))) { continue; } if ((Object)val != (Object)null && ((Object)val).name.ToLowerInvariant().Contains("tabs")) { TeamColor[] components = ((Component)renderer).GetComponents<TeamColor>(); foreach (TeamColor val2 in components) { if (val2.materialID == matIndex) { Object.DestroyImmediate((Object)val2); } } } if (((Object)newMat).name.ToLowerInvariant().Contains("tabs")) { TeamColor tCol = null; TeamColor[] components = ((Component)renderer).GetComponents<TeamColor>(); foreach (TeamColor val3 in components) { if (val3.materialID == matIndex) { tCol = val3; } } if ((Object)tCol == (Object)null) { tCol = ((Component)renderer).gameObject.AddComponent<TeamColor>(); tCol.materialID = matIndex; } SetTeamColorMat(ref newMat, ref tCol); newMat = tCol.blueMaterial; } sharedMaterials[matIndex] = newMat; } renderer.sharedMaterials = sharedMaterials; } curMaterial = newMat; if (mC_MatSpec != null && mC_MatSpec.NeedsDriver) { MC_MatFx.Attach(((Component)this).gameObject); return; } MC_MatFx component = ((Component)this).GetComponent<MC_MatFx>(); if ((Object)(object)component != (Object)null) { component.Rescan(); } } private static TeamColor OwnTeamPair(Renderer renderer, int matIndex, Material newMat) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if ((Object)renderer == (Object)null || (Object)newMat == (Object)null) { return null; } TeamColor[] components = ((Component)renderer).GetComponents<TeamColor>(); foreach (TeamColor val in components) { if (!((Object)(object)val == (Object)null) && val.materialID == matIndex && (Same(val.blueMaterial, newMat) || Same(val.redMaterial, newMat))) { return val; } } return null; } private static bool Same(Material a, Material b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_001f: Expected O, but got Unknown if ((Object)a != (Object)null) { if (!((Object)a == (Object)b)) { return ((Object)a).name == ((Object)b).name; } return true; } return false; } private void SetTeamColorMat(ref Material mat, ref TeamColor tCol) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_002e: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_004d: Expected O, but got Unknown TeamColorPaletteData[] teamColors = MC_Compat.ColorPalette.TeamColors; int num = 0; for (int i = 0; i < teamColors.Length; i++) { if ((Object)teamColors[i].m_materialRed == (Object)mat || (Object)teamColors[i].m_materialBlue == (Object)mat) { num = i; break; } } tCol.blueMaterial = teamColors[num].m_materialBlue; tCol.redMaterial = teamColors[num].m_materialRed; } } public class MC_Matlist : MonoBehaviour { public List<MC_MatHolder> MatHolderList; public AssetType type; public static MC_MatHolder LastRead; public void Init(AssetType assetType) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_00f8: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown type = assetType; MatHolderList = new List<MC_MatHolder>(); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { bool num; if (assetType == AssetType.UNITBASE) { if (((Object)((Component)val).gameObject).name.Contains("TabsUnit") || ((Object)((Component)val).gameObject).name.Contains("LOD")) { goto IL_008d; } num = ((Object)((Component)val).gameObject).name.Contains("broom"); } else { num = !((Object)((Component)val).gameObject).name.Contains("Hand"); } if (!num) { continue; } goto IL_008d; IL_008d: for (int j = 0; j < val.sharedMaterials.Length; j++) { Material thisMat = val.sharedMaterials[j]; if (!((Object)thisMat != (Object)null)) { continue; } TeamColor[] teamColors = ((Component)val).GetComponents<TeamColor>(); thisMat = GetBlueIfTeamColor(ref teamColors, ref thisMat, j); MC_MatHolder mC_MatHolder = null; foreach (MC_MatHolder matHolder in MatHolderList) { if ((Object)matHolder.originalMaterial == (Object)thisMat) { mC_MatHolder = matHolder; break; } } if ((Object)mC_MatHolder == (Object)null) { mC_MatHolder = ((Component)this).gameObject.AddComponent<MC_MatHolder>(); mC_MatHolder.originalMaterial = thisMat; mC_MatHolder.curMaterial = thisMat; mC_MatHolder.RendererMatIndexHolders = new List<MatIndexHolder>(); MatHolderList.Add(mC_MatHolder); } mC_MatHolder.AddMatIndex(val, j); } } } public void TransferValues(MC_Matlist referenceMatlist) { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); foreach (MC_MatHolder matHolder in MatHolderList) { MC_MatHolder referenceHolder = referenceMatlist.GetReferenceHolder(matHolder.originalMaterial); List<MatIndexHolder> list = new List<MatIndexHolder>(); foreach (MatIndexHolder rendererMatIndexHolder in referenceHolder.RendererMatIndexHolders) { Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!(((Object)val).name == ((Object)rendererMatIndexHolder.renderer).name)) { continue; } MatIndexHolder matIndexHolder = new MatIndexHolder(val, 0); List<int> list2 = new List<int>(); foreach (int matIndex in rendererMatIndexHolder.matIndexs) { list2.Add(matIndex); } matIndexHolder.matIndexs = list2; matIndexHolder.renderer = val; list.Add(matIndexHolder); break; } } matHolder.RendererMatIndexHolders = list; } } public int GetMatCount() { return MatHolderList.Count; } public List<Material> GetMaterials() { List<Material> list = new List<Material>(); foreach (MC_MatHolder matHolder in MatHolderList) { list.Add(matHolder.curMaterial); } return list; } public Material GetMaterial(int index) { LastRead = MatHolderList[index]; return LastRead.curMaterial; } public void SetMaterial(Material newMat, int index) { MatHolderList[index].SetMaterial(newMat); } public string[] GetMaterialNames() { List<string> list = new List<string>(); foreach (MC_MatHolder matHolder in MatHolderList) { list.Add(((Object)matHolder.curMaterial).name); } return list.ToArray(); } private MC_MatHolder GetReferenceHolder(Material originalMat) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_002c: Expected O, but got Unknown foreach (MC_MatHolder matHolder in MatHolderList) { if ((Object)matHolder.originalMaterial == (Object)originalMat) { return matHolder; } } return null; } private Material GetBlueIfTeamColor(ref TeamColor[] teamColors, ref Material thisMat, int matIndex) { try { string text = ((Object)thisMat).name.ToLowerInvariant(); if (text.Contains("tabs") || text.Contains("team")) { TeamColor[] array = teamColors; foreach (TeamColor val in array) { if (val.materialID == matIndex) { thisMat = val.blueMaterial; return thisMat; } } } } catch { return thisMat; } return thisMat; } } public class SliderOnChangeEndEvent : UnityEvent<float> { } namespace UMods { public class UManager { private AssetBundle CreatorBundle; public static GameObject MasterObject { get; private set; } public void Init(LandfallUnitDatabase db) { Debug.Log((object)"MIDNIGHT UNIT CREATOR UML INIT....................."); } } } namespace MidnightCow { public enum AssetType { UNIT, UNITBASE, FACTION, WEAPON, PROP, COMBATMOVE, MATERIAL, ICON, PROJECTILE, SOUND, FX, GOOGLYEYES, NONE } public class CamLerper : MonoBehaviour { public GameObject TempCam; private Camera Cam; private Transform Rotator; private Transform Tipper; private const float DefaultYaw = 0f; private const float DefaultPitch = 8f; private const float ScreenX = 0.68f; private Vector3 pivot = new Vector3(0f, 1f, 0f); private Vector3 pivotTarget = new Vector3(0f, 1f, 0f); private Vector3 pivotVelocity; private float yaw; private float pitch = 8f; private float yawTarget; private float pitchTarget = 8f; private float distance = 4f; private float fitDistance = 4f; private float zoom = 1f; private float zoomTarget = 1f; private bool snapNext = true; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) Cam = ((Component)this).GetComponent<Camera>(); TempCam = new GameObject("tempCam"); TempCam.SetActive(false); Tipper = new GameObject("MC_CamTipper").transform; Rotator = new GameObject("MC_CamRotator").transform; Tipper.SetParent(Rotator, true); ((Component)this).transform.SetParent(Tipper, true); } public void DoLerp(Vector3 focusPos, Vector3 focusDimensions, bool keepView) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) pivotTarget = focusPos; fitDistance = FitDistance(focusDimensions); if (!keepView) { yawTarget = 0f; pitchTarget = 8f; zoomTarget = 1f; } } public void DoLerp(Vector3 focusPos, Vector3 focusDimensions) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) DoLerp(focusPos, focusDimensions, keepView: true); } public void Snap() { snapNext = true; } public void ResetView() { yawTarget = 0f; pitchTarget = 8f; zoomTarget = 1f; } public void Orbit(float dYaw, float dPitch) { yawTarget += dYaw; pitchTarget = Mathf.Clamp(pitchTarget + dPitch, -15f, 85f); yaw = yawTarget; pitch = pitchTarget; } public void Zoom(float wheel) { zoomTarget = Mathf.Clamp(zoomTarget * Mathf.Pow(0.8f, wheel * 10f), 0.15f, 6f); } public void Pan(Vector2 screenDelta) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) float num = 2f * distance * Mathf.Tan(Cam.fieldOfView * 0.5f * ((float)Math.PI / 180f)) / (float)Mathf.Max(1, Screen.height); Vector3 val = (((Component)this).transform.right * (0f - screenDelta.x) + ((Component)this).transform.up * (0f - screenDelta.y)) * num; pivotTarget += val; pivot += val; } private float FitDistance(Vector3 size) { if ((Object)(object)Cam == (Object)null) { return 4f; } float num = Mathf.Max(0.35f, ((Vector3)(ref size)).magnitude * 0.5f); float num2 = Cam.fieldOfView * 0.5f * ((float)Math.PI / 180f); float num3 = Mathf.Atan(Mathf.Tan(num2) * Mathf.Max(0.5f, Cam.aspect) * 0.6f); float num4 = Mathf.Min(num2, num3); return Mathf.Clamp(num / Mathf.Sin(num4) * 1.05f, 1.2f, 400f); } private void LateUpdate() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Cam == (Object)null)) { float num = Mathf.Min(Time.unscaledDeltaTime, 0.1f); if (snapNext) { snapNext = false; pivot = pivotTarget; yaw = yawTarget; pitch = pitchTarget; zoom = zoomTarget; distance = fitDistance * zoom; } else { pivot = Vector3.SmoothDamp(pivot, pivotTarget, ref pivotVelocity, 0.25f, float.PositiveInfinity, num); float num2 = 1f - Mathf.Exp(-8f * num); yaw = Mathf.LerpAngle(yaw, yawTarget, num2); pitch = Mathf.Lerp(pitch, pitchTarget, num2); zoom = Mathf.Lerp(zoom, zoomTarget, 1f - Mathf.Exp(-12f * num)); distance = Mathf.Lerp(distance, fitDistance * zoom, num2); } float num3 = Mathf.Asin(Mathf.Clamp((0.3f - pivot.y) / Mathf.Max(0.1f, distance), -1f, 1f)) * 57.29578f; num3 = Mathf.Max(num3, -15f); if (pitch < num3) { pitch = num3; } if (pitchTarget < num3) { pitchTarget = num3; } Rotator.position = Vector3.zero; Rotator.rotation = Quaternion.identity; Tipper.localPosition = Vector3.zero; Tipper.localRotation = Quaternion.identity; Quaternion val = Quaternion.Euler(pitch, yaw, 0f); Vector3 val2 = pivot + val * new Vector3(0f, 0f, 0f - distance); float num4 = distance * Mathf.Tan(Cam.fieldOfView * 0.5f * ((float)Math.PI / 180f)) * Cam.aspect; val2 -= val * Vector3.right * (0.36f * num4); ((Component)this).transform.SetPositionAndRotation(val2, val); } } } internal class DoCollisionFX : MonoBehaviour { private ParticleSystem pSparksSys; private MainModule pSparksMain; private CollisionWeapon collisionWeapon; public ParticleSystem CollisionFX; private void Start() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) collisionWeapon = ((Component)this).GetComponent<CollisionWeapon>(); if ((Object)collisionWeapon != (Object)null && (Object)CollisionFX != (Object)null) { pSparksSys = ((Component)((Component)CollisionFX).transform.GetChild(0)).GetComponent<ParticleSystem>(); pSparksMain = pSparksSys.main; TrailModule trails = pSparksSys.trails; ((TrailModule)(ref trails)).enabled = false; collisionWeapon.AddCollisionAction((Action<Collision, float>)Play); } } private void Play(Collision col, float amt) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) ContactPoint contact = col.GetContact(0); if (!((Object)((Component)((ContactPoint)(ref contact)).otherCollider).transform.root).name.ToLowerInvariant().Contains("humanoid")) { Quaternion rotation = ((Component)CollisionFX).transform.rotation; Vector3 impulse = col.impulse; ((Quaternion)(ref rotation)).SetLookRotation(((Vector3)(ref impulse)).normalized); Quaternion rotation2 = ((Component)CollisionFX).transform.rotation; impulse = col.impulse; ((Quaternion)(ref rotation2)).SetLookRotation(((Vector3)(ref impulse)).normalized); Vector3 eulerAngles = ((Quaternion)(ref rotation2)).eulerAngles; eulerAngles.y += 180f; ((Quaternion)(ref rotation2)).eulerAngles = eulerAngles; ((Component)CollisionFX).transform.rotation = rotation2; impulse = col.impulse; float num = ((Vector3)(ref impulse)).magnitude / 100f; ((MainModule)(ref pSparksMain)).startSpeedMultiplier = 15f * num; CollisionFX.Play(true); } } } public class DoMuzzleFlash : MonoBehaviour { private RangeWeapon rangeWeapon; private ParticleSystem muzzleFlash; public bool isPlaying => muzzleFlash.isPlaying; private void Start() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown rangeWeapon = ((Component)this).GetComponent<RangeWeapon>(); Transform val = TransformExtensions.FindChildRecursive(((Component)this).transform, "MuzzleFlash"); if (Object.op_Implicit((Object)val)) { muzzleFlash = ((Component)val).GetComponent<ParticleSystem>(); rangeWeapon.AddShootAction((Action)Play); } } public void Play() { muzzleFlash.Play(true); } public void Stop() { muzzleFlash.Stop(true); } } public enum FieldType { GROUP, LIST, PROPERTYGROUP, VALUE } [BepInPlugin("midnightcow.unitcreator", "MC_UnitCreator", "2.2.0")] public class Launcher : BaseUnityPlugin { private static readonly StringBuilder startTimes = new StringBuilder(); private static double startedAt; public Launcher() { startedAt = MC_LoadTiming.Now; MC_LoadTiming.Step(startTimes, "settings file and tidy-up", delegate { MC_Cfg.Adopt(((BaseUnityPlugin)this).Config); MC_Files.Tidy(); }); MC_LoadTiming.Step(startTimes, "paths and bundle", delegate { new MCInit().Init(); }); } private void Awake() { double now = MC_LoadTiming.Now; try { MC_CombatHooks.Install(); } catch (Exception ex) { Debug.LogWarning((object)("UC++ : battle hooks: " + ex.Message)); } MC_LoadTiming.Add(startTimes, "settings and hooks", now); now = MC_LoadTiming.Now; try { MC_InputTrace.Install(); } catch (Exception ex2) { Debug.LogWarning((object)("UC++ : input trace: " + ex2.Message)); } try { MC_FreezeWatch.Install(); } catch (Exception ex3) { Debug.LogWarning((object)("UC++ : freeze watch: " + ex3.Message)); } try { MC_PerfReport.Install(); } catch (Exception ex4) { Debug.LogWarning((object)("UC++ : performance report: " + ex4.Message)); } try { int num = MC_StableIds.SelfTest(); Debug.Log((object)("UC++ : stable save IDs " + ((num == 0) ? "OK" : (num + " failed")))); } catch (Exception ex5) { Debug.LogWarning((object)("UC++ : stable save IDs: " + ex5.Message)); } MC_LoadTiming.Add(startTimes, "traces and checks", now); MC_LoadTiming.Log("UC++ core start-up " + MC_LoadTiming.Ms(startedAt) + " (includes BepInEx loading between the two parts): " + startTimes); MC_LoadTiming.SettingsLoaded(); } } public class MCCreator : MonoBehaviour { public enum MainButtonType { BACKTOMENU, NEW, CLONE, EDIT, DELETE, EDITING_DONE, EDITING_CANCEL, CATEGORY_UNITS, CATEGORY_FACTIONS, CATEGORY_WEAPONS, CATEGORY_PROJECTILES, CATEGORY_PROPS } [Serializable] [CompilerGenerated] private sealed class _003C_003Ec { public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); public static UnityAction _003C_003E9__8_0; internal void _003CSetupWelcomeScreen_003Eb__8_0() { Application.OpenURL("https://www.youtube.com/channel/UCnUaAWfEs6rU92RIDLtgKQA"); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__52_1; internal void <SetupWelcomeScreen>b__52_1() { Application.OpenURL("https://www.youtube.com/channel/UCnUaAWfEs6rU92RIDLtgKQA"); } } public bool INITED; public bool MESSAGE_ACTIVE; public Shader baseShader; public static readonly MCCreator _instance = new MCCreator(); public LandfallUnitDatabase db; public List<float> ButtonColor_Orange = new List<float> { 1f, 0.5f, 0f }; public Color ButtonColor_Normal = new Color(0.66f, 0.66f, 0.66f); public Color ButtonColor_Over = new Color(1f, 1f, 1f); public SoundPlayer soundPlayer; private Random RandomInt = new Random(); public MC_ScrollRect MainScroller; public GameObject CreatorScreen; public GameObject CreatorCanvas; public GameObject ContentPanel; private GameObject BGCanvas; public GameObject BGCam; public GameObject SceneCam; public GameObject ScreenCam; public GameObject SpawnPoint; private GameObject floorPlane; private GameObject Skel_Base; private GameObject Btn_New; private GameObject Btn_Clone; private GameObject Btn_Edit; private GameObject Btn_Delete; public GameObject previous_CatBtn; private Text MainTitleText; private GameObject Picker; private GameObject MessageBox; private GameObject MessageBox_btn1; private GameObject MessageBox_btn2; private Dictionary<string, GameObject> ParamHolderDict; private GameObject Btn_DoneEdit; private GameObject Btn_CancelEdit; private GameObject MessageBox_Rename; private GameObject Btn_BackToMenu; public GameObject DragArea; public GameObject Btn_Youtube; public GameObject MainTitle; public GameObject WelcomeScreen; public GameObject MainScreen; public Faction DefaultFaction; public bool WelcomeOver; public Dictionary<string, object> rSettings_Original; public Dictionary<string, object> rSettings_Creator; private void OnDestroy() { MC_Compat.ClearProjectilePools(); try { MC_Dependencies.LogFactionReport(); } catch (Exception) { } } public void Init() { StringBuilder stringBuilder = new StringBuilder(); double now = MC_LoadTiming.Now; db = MC_Compat.LegacyDb(); ServiceLocator.GetService<ITimeService>().SetState(1f, 0.2f, true); GetUIStuff(); ServiceLocator.GetService<GameStateManager>().EnterNoneState(); CampaignPlayerDataHolder.StartedPlayingTest(); CreatorScreen.AddComponent<MC_GooglyFix>(); MC_LoadTiming.Step(stringBuilder, "tools", MC_EditorTools.EnsureHost); MCCreatorController._instance.Init(); MC_LoadTiming.Step(stringBuilder, "item lists", MC_FieldMaster._instance.Init); MCModelViewer._instance.Init(); MC_LoadTiming.Step(stringBuilder, "item picker", MCPicker._instance.Init); SetupCameras(); MainScreen.SetActive(false); WelcomeScreen.SetActive(true); SetupWelcomeScreen(); MC_LoadTiming.Step(stringBuilder, "buttons", SetupButtons); MC_LoadTiming.Step(stringBuilder, "first unit shown", delegate { InitClickButtons(doRun: true); }); INITED = true; MC_LoadTiming.Log("UC++ editor built in " + MC_LoadTiming.Ms(now) + ": " + stringBuilder); } private void GetUIStuff() { CreatorScreen = GameObject.Find("CreatorScreen"); CreatorCanvas = ((Component)TransformExtensions.FindChildRecursive(CreatorScreen.transform, "CreatorCanvas")).gameObject; ContentPanel = ((Component)CreatorCanvas.transform.Find("UnitCreator/Main/Container/MainContent/Scroll View/Viewport/Content")).gameObject; WelcomeScreen = ((Component)CreatorCanvas.transform.Find("UnitCreator/WelcomeScreen")).gameObject; MainScreen = ((Component)CreatorCanvas.transform.Find("UnitCreator/Main")).gameObject; ScreenCam = ((Component)CreatorScreen.transform.Find("ScreenCam")).gameObject; SceneCam = ((Component)TransformExtensions.FindChildRecursive(CreatorScreen.transform, "SceneCam")).gameObject; DragArea = ((Component)CreatorCanvas.transform.Find("UnitCreator/DragArea")).gameObject; SpawnPoint = ((Component)CreatorScreen.transform.Find("CreatorScene/SpawnPoint")).gameObject; MessageBox_Rename = ((Component)CreatorCanvas.transform.Find("MessageBox_Rename")).gameObject; MessageBox_Rename.transform.SetAsLastSibling(); MessageBox = ((Component)CreatorCanvas.transform.Find("MessageBox")).gameObject; MessageBox.transform.SetAsLastSibling(); MessageBox_btn1 = ((Component)MessageBox.transform.Find("Buttons/Button1")).gameObject; MessageBox_btn2 = ((Component)MessageBox.transform.Find("Buttons/Button2")).gameObject; Picker = ((Component)CreatorCanvas.transform.Find("DataPicker")).gameObject; Picker.transform.SetAsLastSibling(); } private void SetupButtons() { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Expected O, but got Unknown //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Expected O, but got Unknown //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Expected O, but got Unknown //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Expected O, but got Unknown //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Expected O, but got Unknown //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Expected O, but got Unknown //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Expected O, but got Unknown //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Expected O, but got Unknown MainScroller = ((Component)CreatorCanvas.transform.Find("UnitCreator/Main/Container/MainContent/Scroll View")).gameObject.AddComponent<MC_ScrollRect>(); MCPickerColor._instance.InitPicker(((Component)CreatorCanvas.transform.Find("MC_ColorPicker")).GetComponentInChildren<ColorPicker>()); foreach (GameObject item in new List<GameObject> { ((Component)CreatorCanvas.transform.Find("UnitCreator/Main/Container/ButtonsTOP/Btn_Units")).gameObject, ((Component)CreatorCanvas.transform.Find("UnitCreator/Main/Container/ButtonsTOP/Btn_Factions")).gameObject, ((Component)CreatorCanvas.transform.Find("UnitCreator/Main/Container/ButtonsTOP/Btn_Weapons")).gameObject, ((Component)CreatorCanvas.transform.Find("UnitCreator/Main/Container/ButtonsTOP/Btn_Projectiles")).gameObject, ((Component)CreatorCanvas.transform.Find("UnitCreator/Main/Container/ButtonsTOP/Btn_Props")).gameObject }) { Object.DestroyImmediate((Object)item.GetComponent<Image>()); Object.DestroyImmediate((Object)item.GetComponent<Button>()); GameObject gameObject = ((Component)item.transform.GetChild(0)).gameObject; ((Graphic)gameObject.GetComponent<Image>()).raycastTarget = true; gameObject.AddComponent<MC_ScaleJiggle>(); gameObject.AddComponent<MC_ScaleJiggleAnimation>(); gameObject.AddComponent<MC_UIScaleJiggle>(); GameObject btn = ((Component)gameObject.transform.parent).gameObject; string text = ((Object)((Component)gameObject.transform.parent).gameObject).name.ToLowerInvariant(); MainButtonType btnType = MainButtonType.CATEGORY_UNITS; if (text.Contains("units")) { btnType = MainButtonType.CATEGORY_UNITS; } else if (text.Contains("factions")) { btnType = MainButtonType.CATEGORY_FACTIONS; } else if (text.Contains("weapons")) { btnType = MainButtonType.CATEGORY_WEAPONS; } else if (text.Contains("props")) { btnType = MainButtonType.CATEGORY_PROPS; } else if (text.Contains("projectiles")) { btnType = MainButtonType.CATEGORY_PROJECTILES; } ((UnityEvent)gameObject.AddComponent<Button>().onClick).AddListener((UnityAction)delegate { ButtonClick_MAIN(btn, btnType); }); } MainTitle = ((Component)CreatorCanvas.transform.Find("UnitCreator/Inner/Title")).gameObject; MainTitleText = MainTitle.GetComponent<Text>(); MainTitleText.text = MC_Lang.T("UNITS"); Btn_BackToMenu = GetAndSetupButn("UnitCreator/Main/BackButton"); Btn_New = SetupEditButton("NEW", "UnitCreator/Main/Container/ButtonsBOT/Btn_New"); Btn_Clone = SetupEditButton("CLONE", "UnitCreator/Main/Container/ButtonsBOT/Btn_Clone"); Btn_Edit = SetupEditButton("EDIT", "UnitCreator/Main/Container/ButtonsBOT/Btn_Edit"); Btn_Delete = SetupEditButton("DELETE", "UnitCreator/Main/Container/ButtonsBOT/Btn_Delete"); Btn_DoneEdit = CloneEditButton("DONE", Btn_Clone); Btn_CancelEdit = CloneEditButton("CANCEL", Btn_Clone); GameObject b_backtomenu = Btn_BackToMenu.gameObject; GameObject b_new = Btn_New.gameObject; GameObject b_clone = Btn_Clone.gameObject; GameObject b_edit = Btn_Edit.gameObject; GameObject b_delete = Btn_Delete.gameObject; GameObject b_done = Btn_DoneEdit.gameObject; GameObject b_cancel = Btn_CancelEdit.gameObject; ((UnityEvent)Btn_BackToMenu.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { ButtonClick_MAIN(b_backtomenu, MainButtonType.BACKTOMENU); }); ((UnityEvent)Btn_New.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { ButtonClick_MAIN(b_new, MainButtonType.NEW); }); ((UnityEvent)Btn_Clone.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { ButtonClick_MAIN(b_clone, MainButtonType.CLONE); }); ((UnityEvent)Btn_Edit.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { ButtonClick_MAIN(b_edit, MainButtonType.EDIT); }); ((UnityEvent)Btn_Delete.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { ButtonClick_MAIN(b_delete, MainButtonType.DELETE); }); ((UnityEvent)Btn_DoneEdit.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { ButtonClick_MAIN(b_done, MainButtonType.EDITING_DONE); }); ((UnityEvent)Btn_CancelEdit.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { ButtonClick_MAIN(b_cancel, MainButtonType.EDITING_CANCEL); }); MessageBox.SetActive(false); MessageBox_Rename.SetActive(false); } public void WelcomeStartButton(GameObject btn) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown WelcomeOver = true; if (SpawnPoint.transform.childCount > 0) { Object.Destroy((Object)((Component)SpawnPoint.transform.GetChild(0)).gameObject); } ButtonClick_MainCategory(previous_CatBtn, ModeType.HOME_UNITS); } private void SetupWelcomeScreen() { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown ((UnityEventBase)((Component)TransformExtensions.FindChildRecursive(WelcomeScreen.transform, "ytlink")).gameObject.GetComponent<Button>().onClick).RemoveAllListeners(); ButtonClickedEvent onClick = ((Component)TransformExtensions.FindChildRecursive(WelcomeScreen.transform, "ytlink")).gameObject.GetComponent<Button>().onClick; UnityAction val = _003C_003Ec._003C_003E9__8_0; if (val == null) { object obj = <>c.<>9__52_1; if (obj == null) { UnityAction val2 = delegate { Application.OpenURL("https://www.youtube.com/channel/UCnUaAWfEs6rU92RIDLtgKQA"); }; <>c.<>9__52_1 = val2; obj = (object)val2; } _003C_003Ec._003C_003E9__8_0 = (UnityAction)obj; val = (UnityAction)obj; } ((UnityEvent)onClick).AddListener(val); GameObject StartButn = ((Component)TransformExtensions.FindChildRecursive(WelcomeScreen.transform, "Btn_Continue")).gameObject; ((UnityEvent)StartButn.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { WelcomeStartButton(StartButn); }); } private GameObject SetupEditButton(string label, string path) { GameObject gameObject = ((Component)CreatorCanvas.transform.Find(path)).gameObject; gameObject.AddComponent<MC_MouseOverBtn>(); GameObject gameObject2 = ((Component)gameObject.transform.GetChild(0)).gameObject; AddText(gameObject2, MC_Lang.T(label)); return gameObject; } private GameObject GetAndSetupButn(string path) { GameObject gameObject = ((Component)CreatorCanvas.transform.Find(path)).gameObject; gameObject.AddComponent<ScaleJiggle>(); gameObject.AddComponent<ScaleJiggleAnimation>(); gameObject.AddComponent<UIScaleJiggle>(); return gameObject; } private GameObject CloneEditButton(string label, GameObject source) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) GameObject obj = gInstantiate<GameObject>(source); ((TMP_Text)((Component)obj.transform.GetChild(0)).gameObject.GetComponent<TextMeshProUGUI>()).text = MC_Lang.T(label); obj.transform.SetParent(source.transform.parent); obj.transform.position = source.transform.position; obj.transform.localScale = source.transform.localScale; obj.AddComponent<MC_MouseOverBtn>(); obj.SetActive(false); return obj; } private void SetupCameras() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown GameObject.Find("Floor").layer = 9; GameObject val = GameObject.Find("GlowCube"); baseShader = val.GetComponent<Renderer>().material.shader; Object.Destroy((Object)val); SceneCam.GetComponent<Camera>().depth = 0f; ScreenCam.GetComponent<Camera>().depth = 1f; DragArea.AddComponent<MC_RotateObject>().Cam = SceneCam.transform; } private void InitClickButtons(bool doRun) { if (doRun) { GameObject gameObject = ((Component)CreatorCanvas.transform.Find("UnitCreator/Main/Container/ButtonsTOP/Btn_Units")).gameObject; WelcomeOver = false; previous_CatBtn = gameObject; ButtonClick_MainCategory(gameObject, ModeType.HOME_UNITS); WelcomeOver = true; } } private void ButtonClick_MAIN(GameObject btn, MainButtonType type) { if (!MESSAGE_ACTIVE) { switch (type) { case MainButtonType.BACKTOMENU: ButtonClick_BackToMenu(); break; case MainButtonType.CATEGORY_UNITS: ButtonClick_MainCategory(btn, ModeType.HOME_UNITS); break; case MainButtonType.CATEGORY_FACTIONS: ButtonClick_MainCategory(btn, ModeType.HOME_FACTIONS); break; case MainButtonType.CATEGORY_WEAPONS: ButtonClick_MainCategory(btn, ModeType.HOME_WEAPONS); break; case MainButtonType.CATEGORY_PROJECTILES: ButtonClick_MainCategory(btn, ModeType.HOME_PROJECTILES); break; case MainButtonType.CATEGORY_PROPS: ButtonClick_MainCategory(btn, ModeType.HOME_PROPS); break; case MainButtonType.NEW: RunReported(ButtonClick_New, "New"); break; case MainButtonType.CLONE: RunReported(ButtonClick_Clone, "Clone"); break; case MainButtonType.EDIT: RunReported(ButtonClick_Edit, "Edit"); break; case MainButtonType.DELETE: RunReported(ButtonClick_Delete, "Delete"); break; case MainButtonType.EDITING_DONE: RunReported(ButtonClick_DoneEditing, "Save"); break; case MainButtonType.EDITING_CANCEL: RunReported(ButtonClick_CancelEditing, "Cancel"); break; } } } public void ButtonClick_MainCategory(GameObject btn, ModeType nextMode) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (MC_HelperFunctions.IsEditMode(MCCreatorController._instance.CurrentMode) && !MCCreatorController._instance.CurrentAssetSaved) { string message = "Edit Not Saved - Are you sure you want to abandon " + MCModelViewer._instance.ModelNameText.text + " ?"; Message_YESNO(message, CancelEdit); return; } ((Graphic)previous_CatBtn.GetComponentInChildren<Image>()).color = new Color(0.8f, 0.8f, 0.8f); previous_CatBtn = btn; ((Graphic)previous_CatBtn.GetComponentInChildren<Image>()).color = new Color(0.83f, 0.82f, 0.28f); CreatorSwitchToMode(nextMode); } private void ButtonClick_BackToMenu() { TABSSceneManager.LoadMainMenu(); } public void ButtonClick_New() { MCCreatorController._instance.NewItem(); CreatorSwitchToMode(MCCreatorController._instance.CurrentMode); } private void ButtonClick_Edit() { if (MCCreatorController._instance.CurrentMode == ModeType.HOME_PROPS) { Message_OK("Prop Cloning/Editing Currently Unavailable."); } else if (MCCreatorController._instance.CurrentMode == ModeType.HOME_UNITS && MC_FieldMaster._instance.CurrentlySelectedAssetID.m_modID == -2) { string text = MCModelViewer._instance.ModelNameText.text; MCCreatorController._instance.CloneItem(); CreatorSwitchToMode(MC_HelperFunctions.ModeTypeToEditMode(MCCreatorController._instance.CurrentMode)); Message_OK("\"" + text + "\" was made in the game's own Unit Creator. UC++ made a UC++ copy and opened it; your changes are saved to the copy and the original stays as it is."); } else if (MC_FieldMaster._instance.CurrentlySelectedAssetID.m_modID >= -2) { Message_OK("Can't edit Vanilla items - Clone it first.."); } else { ModeType nextMode = MC_HelperFunctions.ModeTypeToEditMode(MCCreatorController._instance.CurrentMode); CreatorSwitchToMode(nextMode); } } private void ButtonClick_Clone() { if (MCCreatorController._instance.CurrentMode == ModeType.HOME_PROPS) { Message_OK("Prop Cloning/Editing Currently Unavailable."); return; } MCCreatorController._instance.CloneItem(); CreatorSwitchToMode(MCCreatorController._instance.CurrentMode); } private void ButtonClick_Delete() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (MC_FieldMaster._instance.CurrentlySelectedAssetID.m_modID >= -2) { Message_OK("Can't delete Vanilla items.."); return; } string text = "Are you sure you want to delete " + MCModelViewer._instance.ModelNameText.text; string text2 = MC_Dependencies.DescribeUsers(MC_FieldMaster._instance.CurrentlySelectedAssetID, MC_HelperFunctions.ModeTypeToAssetType(MCCreatorController._instance.CurrentMode)); if (text2 != "") { text = text + "? It is used by: " + text2; } Message_YESNO(text, DeleteAsset); } private void ButtonClick_DoneEditing() { MCCreatorController._instance.FinishEdit(); ModeType nextMode = MC_HelperFunctions.ModeTypeToCategoryMode(MCCreatorController._instance.CurrentMode); CreatorSwitchToMode(nextMode); } private void ButtonClick_CancelEditing() { if (MC_Undo.Count > 0) { Message_YESNO("Leave without saving? " + MC_Undo.Count + " unsaved change" + ((MC_Undo.Count == 1) ? "" : "s") + " will be lost.", delegate { MC_Undo.Clear(); ButtonClick_MainCategory(previous_CatBtn, MC_HelperFunctions.ModeTypeToCategoryMode(MCCreatorController._instance.CurrentMode)); }); } else { ButtonClick_MainCategory(previous_CatBtn, MC_HelperFunctions.ModeTypeToCategoryMode(MCCreatorController._instance.CurrentMode)); } } public void SaveAndContinue() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) ModeType currentMode = MCCreatorController._instance.CurrentMode; if (MC_HelperFunctions.IsEditMode(currentMode)) { ButtonClick_DoneEditing(); CreatorSwitchToMode(currentMode); MC_Banner.Show("Saved", new Color(0.5f, 1f, 0.6f)); } } public void CloneSelected() { if (!MC_HelperFunctions.IsEditMode(MCCreatorController._instance.CurrentMode)) { ButtonClick_Clone(); } } public void CreatorSwitchToMode(ModeType nextMode) { if (WelcomeOver) { WelcomeScreen.SetActive(false); MainScreen.SetActive(true); } if (nextMode != MCCreatorController._instance.CurrentMode) { if (MC_HelperFunctions.IsEditMode(nextMode)) { switch (nextMode) { case ModeType.EDIT_UNIT: MainTitle.SetActive(true); MainTitleText.text = MC_Lang.T("EDIT UNIT"); Btn_New.SetActive(false); Btn_BackToMenu.SetActive(false); Btn_Clone.SetActive(false); Btn_Edit.SetActive(false); Btn_Delete.SetActive(false); Btn_CancelEdit.SetActive(true); Btn_DoneEdit.SetActive(true); MCCreatorController._instance.CurrentMode = nextMode; MCCreatorController._instance.StartEdit(nextMode); break; case ModeType.EDIT_FACTION: MainTitle.SetActive(true); MainTitleText.text = MC_Lang.T("EDIT FACTION"); Btn_New.SetActive(false); Btn_BackToMenu.SetActive(false); Btn_Clone.SetActive(false); Btn_Edit.SetActive(false); Btn_Delete.SetActive(false); Btn_CancelEdit.SetActive(true); Btn_DoneEdit.SetActive(true); MCCreatorController._instance.CurrentMode = nextMode; MCCreatorController._instance.StartEdit(nextMode); break; case ModeType.EDIT_WEAPON: MainTitle.SetActive(true); MainTitleText.text = MC_Lang.T("EDIT WEAPON"); Btn_New.SetActive(false); Btn_BackToMenu.SetActive(false); Btn_Clone.SetActive(false); Btn_Edit.SetActive(false); Btn_Delete.SetActive(false); Btn_CancelEdit.SetActive(true); Btn_DoneEdit.SetActive(true); MCCreatorController._instance.CurrentMode = nextMode; MCCreatorController._instance.StartEdit(nextMode); break; case ModeType.EDIT_PROJECTILES: MainTitle.SetActive(true); MainTitleText.text = MC_Lang.T("EDIT PROJECTILE"); Btn_New.SetActive(false); Btn_BackToMenu.SetActive(false); Btn_Clone.SetActive(false); Btn_Edit.SetActive(false); Btn_Delete.SetActive(false); Btn_CancelEdit.SetActive(true); Btn_DoneEdit.SetActive(true); MCCreatorController._instance.CurrentMode = nextMode; MCCreatorController._instance.StartEdit(nextMode); break; } } else { switch (nextMode) { case ModeType.HOME_UNITS: MainTitleText.text = MC_Lang.T("UNITS"); break; case ModeType.HOME_FACTIONS: MainTitleText.text = MC_Lang.T("FACTIONS"); break; case ModeType.HOME_WEAPONS: MainTitleText.text = MC_Lang.T("WEAPONS"); break; case ModeType.HOME_PROJECTILES: MainTitleText.text = MC_Lang.T("PROJECTILES"); break; case ModeType.HOME_PROPS: MainTitleText.text = MC_Lang.T("PROPS"); break; default: MainTitleText.text = MC_Lang.T("HOME"); break; } if (nextMode == ModeType.HOME_UNITS || nextMode == ModeType.HOME_FACTIONS) { Btn_New.SetActive(true); } else { Btn_New.SetActive(false); } MainTitle.SetActive(true); Btn_BackToMenu.SetActive(true); Btn_Clone.SetActive(true); Btn_Edit.SetActive(true); Btn_Delete.SetActive(true); Btn_CancelEdit.SetActive(false); Btn_DoneEdit.SetActive(false); MCCreatorController._instance.CurrentMode = nextMode; MCCreatorController._instance.StartList(nextMode); } } else { MCCreatorController._instance.StartList(nextMode); } MCCreatorController._instance.CurrentMode = nextMode; } private void RunReported(Action action, string actionName) { try { action(); } catch (Exception ex) { Debug.LogError((object)("UC++ " + actionName + " failed: " + ex)); Message_OK(actionName + " failed: " + ex.GetType().Name + " - " + ex.Message); } } public void Message_OK(string message) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown MESSAGE_ACTIVE = true; ((Component)MessageBox.transform.Find("Message")).GetComponent<Text>().text = message; GameObject okayButn = gInstantiate<GameObject>(MessageBox_btn1); ((Component)okayButn.transform).GetComponentInChildren<Text>().text = MC_Lang.T("OK"); okayButn.SetActive(true); okayButn.transform.parent = MessageBox_btn1.transform.parent; okayButn.transform.localPosition = Vector3.zero; ((UnityEvent)okayButn.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown MessageBox_btn1.SetActive(true); MessageBox_btn2.SetActive(true); Object.Destroy((Object)okayButn); MessageBox.SetActive(false); MESSAGE_ACTIVE = false; CreatorSwitchToMode(MCCreatorController._instance.CurrentMode); }); MessageBox_btn1.SetActive(false); MessageBox_btn2.SetActive(false); MessageBox.SetActive(true); } public void Confirm(string message, Action yes, Action no = null) { Message_YESNO(message, yes, no); } private void Message_YESNO(string message, Action yesMethod, Action noMethod = null) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown MESSAGE_ACTIVE = true; ((Component)MessageBox.transform.Find("Message")).GetComponent<Text>().text = message; GameObject yesButn = gInstantiate<GameObject>(MessageBox_btn1); GameObject noButn = gInstantiate<GameObject>(MessageBox_btn2); yesButn.SetActive(true); noButn.SetActive(true); yesButn.transform.parent = MessageBox_btn1.transform.parent; noButn.transform.parent = MessageBox_btn2.transform.parent; yesButn.transform.localPosition = Vector3.zero; noButn.transform.localPosition = Vector3.zero; ((UnityEvent)yesButn.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown MessageBox_btn1.SetActive(true); MessageBox_btn2.SetActive(true); Object.Destroy((Object)yesButn); Object.Destroy((Object)noButn); MessageBox.SetActive(false); MESSAGE_ACTIVE = false; yesMethod(); }); ((UnityEvent)noButn.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown MessageBox_btn1.SetActive(true); MessageBox_btn2.SetActive(true); Object.Destroy((Object)yesButn); Object.Destroy((Object)noButn); MessageBox.SetActive(false); MESSAGE_ACTIVE = false; noMethod?.Invoke(); }); MessageBox_btn1.SetActive(false); MessageBox_btn2.SetActive(false); MessageBox.SetActive(true); } public void RevertEdit() { ModeType currentMode = MCCreatorController._instance.CurrentMode; MCCreatorController._instance.CancelEdit(); CreatorSwitchToMode(MC_HelperFunctions.ModeTypeToCategoryMode(currentMode)); CreatorSwitchToMode(currentMode); } private void CancelEdit() { MCCreatorController._instance.CancelEdit(); ModeType nextMode = MC_HelperFunctions.ModeTypeToCategoryMode(MCCreatorController._instance.CurrentMode); CreatorSwitchToMode(nextMode); } private void DeleteAsset() { MCCreatorController._instance.DeleteAsset(); CreatorSwitchToMode(MCCreatorController._instance.CurrentMode); } private TextMeshProUGUI AddText(GameObject obj, string txt, float sizeMult = 1f, string alignment = "center") { obj.AddComponent<TextMeshProUGUI>(); TextMeshProUGUI component = obj.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).enableAutoSizing = true; ((TMP_Text)component).text = txt; ((TMP_Text)component).fontSize = ((TMP_Text)component).fontSize * sizeMult; switch (alignment) { case "center": ((TMP_Text)component).alignment = (TextAlignmentOptions)514; break; case "right": ((TMP_Text)component).alignment = (TextAlignmentOptions)516; break; case "left": ((TMP_Text)component).alignment = (TextAlignmentOptions)513; break; case "tr": ((TMP_Text)component).alignment = (TextAlignmentOptions)260; break; case "tl": ((TMP_Text)component).alignment = (TextAlignmentOptions)257; break; } return component; } public void SetFlagsChildren(Transform child, HideFlags flag) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Object)((Component)child).gameObject).hideFlags = flag; for (int i = 0; i < child.childCount; i++) { SetFlagsChildren(child.GetChild(i), flag); } } private Dictionary<GearType, string> CreateGearTypeDict() { return new Dictionary<GearType, string> { { (GearType)0, "HEAD" }, { (GearType)1, "NECK" }, { (GearType)2, "SHOULDER" }, { (GearType)3, "TORSO" }, { (GearType)4, "ARMS" }, { (GearType)5, "WRISTS" }, { (GearType)6, "HANDS" }, { (GearType)7, "WAIST" }, { (GearType)8, "LEGS" }, { (GearType)9, "FEET" }, { (GearType)10, "WEAPON" }, { (GearType)11, "CUSTOM" } }; } private Transform FindInChildren(GameObject child, string name) { if (((Object)child).name == name) { return child.transform; } for (int i = 0; i < child.transform.childCount; i++) { FindInChildren(((Component)child.transform.GetChild(i)).gameObject, name); } return null; } public Color GetRandomPalletteColor() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) int num = RandomInt.Next(MC_Compat.ColorPalette.Colors.Length); return MC_Compat.ColorPalette.Colors[num].m_color; } public T gInstantiate<T>(T asset, bool throwaway = false) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown if (typeof(T) == typeof(GameObject)) { GameObject val = Object.Instantiate<GameObject>((GameObject)((asset is GameObject) ? ((object)asset) : null)); if (!throwaway) { ((Object)val).hideFlags = (HideFlags)52; } return (T)Convert.ChangeType(val, typeof(T)); } if (typeof(T) == typeof(UnitBlueprint)) { UnitBlueprint val2 = Object.Instantiate<UnitBlueprint>((UnitBlueprint)((asset is UnitBlueprint) ? ((object)asset) : null)); object obj = asset; MC_BlueprintCopy.CopyUnserialized((UnitBlueprint)((obj is UnitBlueprint) ? obj : null), val2); if (!throwaway) { ((Object)val2).hideFlags = (HideFlags)52; } return (T)Convert.ChangeType(val2, typeof(T)); } if (typeof(T) == typeof(Faction)) { Faction val3 = Object.Instantiate<Faction>((Faction)((asset is Faction) ? ((object)asset) : null)); if (!throwaway) { ((Object)val3).hideFlags = (HideFlags)52; } return (T)Convert.ChangeType(val3, typeof(T)); } return default(T); } } public class MCCreatorController { public bool SilentlyFail = true; public bool DebugMode; public static readonly MCCreatorController _instance = new MCCreatorController(); public LandfallUnitDatabase db; public ModeType CurrentMode; private object ActiveAssetUndoData; public object ActiveAsset; public DatabaseID ActiveAssetID; public bool PauseRefresh; public bool CurrentAssetSaved; private MCCreatorController() { } public void Init() { db = MC_Compat.LegacyDb(); PauseRefresh = false; CurrentMode = ModeType.HOME_UNITS; CurrentAssetSaved = true; } public void StartList(ModeType mode) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) MC_FieldMaster._instance.SwitchMode(mode); ActiveAssetID = MC_FieldMaster._instance.CurrentlySelectedAssetID; ActiveAsset = MC_DatabaseMaster._instance.GetItemByGUID(ActiveAssetID, MC_HelperFunctions.ModeTypeToAssetType(mode)); MCModelViewer._instance.RefreshDisplay(); MCCreator._instance.MainScroller.ScrollToTarget(MC_FieldMaster._instance.CurrentlySelectedField); } public void StartEdit(ModeType mode) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) MC_Undo.Clear(); AssetType assetType = MC_HelperFunctions.ModeTypeToAssetType(mode); StringBuilder stringBuilder = new StringBuilder(); double now = MC_LoadTiming.Now; CurrentAssetSaved = false; MC_LoadTiming.Step(stringBuilder, "copy", delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) ActiveAsset = MC_AssetHandler._instance.PrepareForEdit(MC_FieldMaster._instance.CurrentlySelectedAssetID, assetType); }); ActiveAssetID = MC_DatabaseMaster._instance.GetItemGUID(ActiveAsset, assetType); MC_LoadTiming.Step(stringBuilder, "fields", delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) MC_FieldMaster._instance.GetEditFieldHolder().InitWithAsset(ActiveAssetID); }); MC_LoadTiming.Step(stringBuilder, "show", delegate { MC_FieldMaster._instance.SwitchMode(mode); }); MC_LoadTiming.Step(stringBuilder, "model", MCModelViewer._instance.RefreshDisplay); MC_LoadTiming.Log("opened " + assetType.ToString() + " for editing in " + MC_LoadTiming.Ms(now) + ": " + stringBuilder); } public void FinishEdit() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) MC_Undo.Clear(); AssetType assetType = MC_HelperFunctions.ModeTypeToAssetType(CurrentMode); string displayNameFromGUID = MC_DatabaseMaster._instance.GetDisplayNameFromGUID(MC_FieldMaster._instance.CurrentlySelectedAssetID, assetType); string displayNameFromGUID2 = MC_DatabaseMaster._instance.GetDisplayNameFromGUID(ActiveAssetID, assetType); if (MC_FieldMaster._instance.CurrentlySelectedAssetID.m_modID == -1) { MC_UIData fieldElement = MC_FieldMaster._instance.GetListFieldHolder().AddItemToFieldList(displayNameFromGUID2, ActiveAssetID); MC_FieldMaster._instance.UpdateSelectedField(fieldElement); } else { MC_AssetHandler._instance.ReplaceAsset(ActiveAssetID, MC_FieldMaster._instance.CurrentlySelectedAssetID, assetType); MC_FieldMaster._instance.CurrentlySelectedField.Redraw(); } ActiveAssetID = MC_FieldMaster._instance.CurrentlySelectedAssetID; MC_SaveLoad._instance.Save(MC_FieldMaster._instance.CurrentlySelectedAssetID, assetType, displayNameFromGUID, displayNameFromGUID2); MC_Dependencies.ResaveDependents(MC_FieldMaster._instance.CurrentlySelectedAssetID, assetType); CurrentAssetSaved = true; MCPicker._instance.RebuildList(assetType); MC_Compat.ClearProjectilePools(); } public void CancelEdit() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) MC_Undo.Clear(); AssetType assetType = MC_HelperFunctions.ModeTypeToAssetType(_instance.CurrentMode); MC_AssetHandler._instance.DestroyAsset(ActiveAssetID, assetType); ActiveAssetID = MC_FieldMaster._instance.CurrentlySelectedAssetID; ActiveAsset = MC_DatabaseMaster._instance.GetItemByGUID(ActiveAssetID, assetType); } public void NewItem() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) AssetType assetType = MC_HelperFunctions.ModeTypeToAssetType(CurrentMode); object item = ((assetType == AssetType.PROJECTILE) ? MC_Compat.BasicProjectileTemplate() : MC_DatabaseMaster._instance.GetItemByIndex(0, assetType)); ActiveAsset = MC_AssetHandler._instance.CloneAsset(MC_DatabaseMaster._instance.GetItemGUID(item, assetType), assetType); ActiveAssetID = MC_DatabaseMaster._instance.GetItemGUID(ActiveAsset, assetType); MC_FieldMaster._instance.CurrentlySelectedAssetID = ActiveAssetID; string name = "Blanky"; switch (assetType) { case AssetType.UNIT: { UnitBlueprint val = (UnitBlueprint)ActiveAsset; val.RightWeapon = null; val.m_propData = (PropItemData[])(object)new PropItemData[0]; val.m_props = (GameObject[])(object)new GameObject[0]; ActiveAsset = val; break; } case AssetType.FACTION: name = "EmptyFaction"; ((Faction)ActiveAsset).Units = (UnitBlueprint[])(object)new UnitBlueprint[0]; break; case AssetType.PROJECTILE: name = "NewProjectile"; break; } name = MC_DatabaseMaster._instance.GetUniqueName(name, assetType); MC_DatabaseMaster._instance.SetItemName(ActiveAsset, name, assetType); MC_UIData fieldElement = MC_FieldMaster._instance.GetListFieldHolder().AddItemToFieldList(name, ActiveAssetID); MC_FieldMaster._instance.UpdateSelectedField(fieldElement); MC_SaveLoad._instance.Save(MC_FieldMaster._instance.CurrentlySelectedAssetID, assetType, name, name); MCPicker._instance.RebuildList(assetType); } public void CloneItem() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) AssetType assetType = MC_HelperFunctions.ModeTypeToAssetType(CurrentMode); ActiveAsset = MC_AssetHandler._instance.CloneAsset(MC_FieldMaster._instance.CurrentlySelectedAssetID, assetType); ActiveAssetID = MC_DatabaseMaster._instance.GetItemGUID(ActiveAsset, assetType); string displayNameFromGUID = MC_DatabaseMaster._instance.GetDisplayNameFromGUID(ActiveAssetID, assetType); displayNameFromGUID = MC_DatabaseMaster._instance.GetUniqueName(displayNameFromGUID, assetType); MC_DatabaseMaster._instance.SetItemName(ActiveAsset, displayNameFromGUID, assetType); MC_UIData fieldElement = MC_FieldMaster._instance.GetListFieldHolder().AddItemToFieldList(displayNameFromGUID, ActiveAssetID); MC_FieldMaster._instance.UpdateSelectedField(fieldElement); MC_SaveLoad._instance.Save(MC_FieldMaster._instance.CurrentlySelectedAssetID, assetType, displayNameFromGUID, displayNameFromGUID); MCPicker._instance.RebuildList(assetType); } public void DeleteAsset() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) AssetType assetType = MC_HelperFunctions.ModeTypeToAssetType(CurrentMode); DatabaseID currentlySelectedAssetID = MC_FieldMaster._instance.CurrentlySelectedAssetID; if (assetType == AssetType.UNIT) { MC_Dependencies.RemoveUnitFromFactions(currentlySelectedAssetID); } MC_SaveLoad._instance.DeleteSave(currentlySelectedAssetID, assetType); MC_AssetHandler._instance.DestroyAsset(currentlySelectedAssetID, assetType); MC_FieldMaster._instance.DeleteSelectedField(); ActiveAssetID = MC_FieldMaster._instance.CurrentlySelectedAssetID; ActiveAsset = MC_DatabaseMaster._instance.GetItemByGUID(ActiveAssetID, assetType); MCPicker._instance.RebuildList(assetType); } public void PlaySound(string sound) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (_instance.DebugMode) { MC_Log.Info("PLAYSOUND = " + ((object)Camera.main)?.ToString() + " - " + sound); } ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect(sound, 1f, ((Component)Camera.main).transform.position, (MaterialType)0, (Transform)null, 1f); } } public class MCInit { [Serializable] [CompilerGenerated] private sealed class _003C_003Ec { public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); public static UnityAction _003C_003E9__23_0; internal void _003CSceneLoadedCallback_003Eb__23_0() { MC_LoadTiming.Clicked(); TABSSceneManager.LoadScene("MCUC", false); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__25_1; public static Action <>9__25_2; public static Action <>9__25_3; public static Action <>9__25_5; public static UnityAction <>9__26_0; internal void <LoadSaved>b__25_1() { MC_SaveLoad._instance.Init(_instance); } internal void <LoadSaved>b__25_2() { MC_DatabaseMaster._instance.Init(); } internal void <LoadSaved>b__25_3() { MC_SaveLoad._instance.LoadAll(); } internal void <LoadSaved>b__25_5() { MC_Hooks.EnsurePremades?.Invoke(); } internal void <SceneLoadedCallback>b__26_0() { MC_LoadTiming.Clicked(); TABSSceneManager.LoadScene("MCUC", false); } } public static MCInit _instance; private LandfallUnitDatabase db; public GameObject AssetHolder; public string AppDataPath; public string Path_AssetBundlesDir; public string Path_DebugDir; public string Path_MC_CreatorBundle; public string Path_DebugLogFile; public string Path_DebugDumpFile; public string Path_ContentRoot; public string Path_SaveFiles; public string Path_CustomIcons; public string Path_BackupFiles; public string Path_PrefsFile; public float MCCreator_Version; public GameObject MessageBox; public GameObject Rendering; public GameObject MenuCam; public bool INITED; private string FileType = ".mc"; public MCInit() { _instance = this; } public void Init() { if (SetupPathsAndContent()) { MC_Bundles.Load("midnightcow_uc_bundle", Path_MC_CreatorBundle); SceneManager.sceneLoaded += SceneLoadedCallback; MCCreator_Version = 2f; db = MC_Compat.LegacyDb(); } } private bool SetupPathsAndContent() { AppDataPath = Directory.GetParent(Path.GetFullPath(Assembly.GetExecutingAssembly().Location)).FullName; Path_ContentRoot = AppDataPath; Path_AssetBundlesDir = Path.Combine(Path_ContentRoot, "AssetBundles"); Path_MC_CreatorBundle = Path.Combine(Path_AssetBundlesDir, "midnightcow_uc_bundle"); Path_SaveFiles = Path.Combine(Path_ContentRoot, "SavedFiles"); Path_CustomIcons = Path.Combine(Path_ContentRoot, "CustomIcons"); Path_BackupFiles = Path.Combine(Path_SaveFiles, "BackupFiles"); if (!Directory.Exists(Path_AssetBundlesDir)) { Directory.CreateDirectory(Path_AssetBundlesDir); } if (!Directory.Exists(Path_SaveFiles)) { Directory.CreateDirectory(Path_SaveFiles); } if (!Directory.Exists(Path_BackupFiles)) { Directory.CreateDirectory(Path_BackupFiles); } if (!Directory.Exists(Path_CustomIcons)) { Directory.CreateDirectory(Path_CustomIcons); } OrganiseFiles(); if (!File.Exists(Path_MC_CreatorBundle) && !MC_Bundles.Embedded("midnightcow_uc_bundle")) { if (MCCreatorController._instance.DebugMode) { Debug.Log((object)"-- MCUC++ PROBLEM LOADING FILES"); } return false; } return true; } private void OrganiseFiles() { string[] array = new string[4] { "MC_PROJECTILE_", "MC_WEAPON_", "MC_UNIT_", "MC_FACTION_" }; string[] files = Directory.GetFiles(AppDataPath); foreach (string text in files) { if (MCCreatorController._instance.DebugMode) { MC_Log.Info("CHECKING " + text); } bool flag = false; string[] array2 = array; foreach (string value in array2) { if (text.Contains(value)) { flag = true; } } if (flag) { if (File.Exists(text)) { string fileName = Path.GetFileName(text); string text2 = Path.Combine(Path_SaveFiles, fileName); int num = 1; string text3 = fileName.Substring(0, fileName.IndexOf(".") - 1); while (File.Exists(text2)) { text2 = Path.Combine(Path_SaveFiles, text3 + num + FileType); num++; } File.Move(text, text2); } } else if (text.Contains("midnightcow_uc_bundle")) { if (File.Exists(Path_MC_CreatorBundle)) { File.Delete(Path_MC_CreatorBundle); } File.Move(text, Path_MC_CreatorBundle); } else if (text.ToLowerInvariant().Contains("mc_icon_") && text.Contains(".png")) { string fileName2 = Path.GetFileName(text); string text4 = Path.Combine(Path_CustomIcons, fileName2); if (File.Exists(text4)) { File.Delete(text4); } File.Move(text, text4); } } } private void LoadSaved(string when) { StringBuilder stringBuilder = new StringBuilder(); double now = MC_LoadTiming.Now; MC_LoadTiming.Step(stringBuilder, "unit backup", delegate { MC_SaveGuard.RestoreIfWiped(Path_SaveFiles); }); MC_LoadTiming.Step(stringBuilder, "save setup", delegate { MC_SaveLoad._instance.Init(_instance); }); MC_LoadTiming.Step(stringBuilder, "content lists", delegate { MC_DatabaseMaster._instance.Init(); }); MC_LoadTiming.Step(stringBuilder, "saved files", delegate { MC_SaveLoad._instance.LoadAll(); }); MC_LoadTiming.Step(stringBuilder, "unit backup", delegate { MC_SaveGuard.Mirror(Path_SaveFiles); }); INITED = true; MC_LoadTiming.Step(stringBuilder, "premades", delegate { MC_Hooks.EnsurePremades?.Invoke(); }); MC_LoadTiming.Step(stringBuilder, "import old units", delegate { MC_ImportOld.Run(Path_SaveFiles); }); MC_LoadTiming.Log("saved content (" + when + ") " + MC_LoadTiming.Ms(now) + ": " + stringBuilder); } public void SceneLoadedCallback(Scene scene, LoadSceneMode mode) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown if (INITED) { MC_UnitRefs.Retry("on scene " + ((Scene)(ref scene)).name, report: false); } if (((Scene)(ref scene)).name.ToLowerInvariant().Contains("mcuc")) { MC_LoadTiming.SceneLoaded(); if (!INITED) { LoadSaved("UC++ opened"); } MCCreator._instance.Init(); } if (!INITED && ((Scene)(ref scene)).name.ToLowerInvariant().Contains("menu")) { try { LoadSaved("start"); MC_Log.Info("UC++ : saved content loaded at start"); } catch (Exception ex) { Debug.LogWarning((object)("UC++ : could not load saved content at start (it loads when UC++ opens): " + ex.Message)); } } if (!((Scene)(ref scene)).name.ToLowerInvariant().Contains("menu") || !((Object)GameObject.Find("MCUCButton") == (Object)null)) { return; } GameObject val = GameObject.Find("Canvas"); if (!((Object)val != (Object)null)) { return; } Button[] componentsInChildren = val.GetComponentsInChildren<Button>(); foreach (Button val2 in componentsInChildren) { if (!(((Object)((Component)val2).gameObject).name == "Quit")) { continue; } GameObject obj = Object.Instantiate<GameObject>(((Component)val2).gameObject); ((Object)obj).name = "MCUCButton"; obj.transform.parent = ((Component)val2).transform.parent; obj.transform.SetSiblingIndex(((Component)val2).transform.GetSiblingIndex()); TextMeshProUGUI component = ((Component)obj.transform.GetChild(0)).GetComponent<TextMeshProUGUI>(); Object.DestroyImmediate((Object)((Component)component).GetComponent<LocalizeText>()); Object.DestroyImmediate((Object)((Component)component).GetComponent<MainMenuQuitGame>()); ((UnityEventBase)obj.GetComponent<Button>().onClick).RemoveAllListeners(); ButtonClickedEvent onClick = obj.GetComponent<Button>().onClick; UnityAction val3 = _003C_003Ec._003C_003E9__23_0; if (val3 == null) { object obj2 = <>c.<>9__26_0; if (obj2 == null) { UnityAction val4 = delegate { MC_LoadTiming.Clicked(); TABSSceneManager.LoadScene("MCUC", false); }; <>c.<>9__26_0 = val4; obj2 = (object)val4; } _003C_003Ec._003C_003E9__23_0 = (UnityAction)obj2; val3 = (UnityAction)obj2; } ((UnityEvent)onClick).AddListener(val3); ((TMP_Text)component).text = "MidnightCow UC++"; ((Graphic)component).color = Color.red; break; } } } public class MCModelViewer : MonoBehaviour { public enum DisplayItemType { UNIT, MODEL, FAC } public static readonly MCModelViewer _instance = new MCModelViewer(); public bool REFRESHFAIL = true; private CamLerper camLerper; public GameObject ModelCam; public GameObject SpawnPoint; private GameObject DisplayImage; public List<GameObject> DisplayModel_SpawnedList; public DisplayItemType displayItemType; public Text ModelNameText; private object lastFramedAsset; private MCModelViewer() { } private Vector3 GetCenterPos(Vector3 min, Vector3 max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return (Vector3.zero + min + max) / 2f; } private Quaternion GetLookRot(AssetType assetType) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (assetType == AssetType.PROJECTILE) { return Quaternion.LookRotation(new Vector3(0f, 0f, 1f), Vector3.up); } return Quaternion.LookRotation(new Vector3(0f, 0f, -1f), Vector3.up); } public void FrameArea(Vector3 centre, Vector3 size) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)camLerper != (Object)null) { camLerper.DoLerp(centre, size); } } private bool VisibleBounds(out Bounds result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) result = default(Bounds); bool flag = false; foreach (GameObject displayModel_Spawned in DisplayModel_SpawnedList) { if ((Object)(object)displayModel_Spawned == (Object)null) { continue; } Renderer[] componentsInChildren = displayModel_Spawned.GetComponentsInChildren<Renderer>(false); foreach (Renderer val in componentsInChildren) { if (!val.enabled || !((Component)val).gameObject.activeInHierarchy || (!(val is MeshRenderer) && !(val is SkinnedMeshRenderer))) { continue; } Bounds bounds = val.bounds; if (float.IsNaN(((Bounds)(ref bounds)).center.x)) { continue; } Vector3 extents = ((Bounds)(ref bounds)).extents; if (((Vector3)(ref extents)).magnitude > 60f) { continue; } extents = ((Bounds)(ref bounds)).extents; if (!(((Vector3)(ref extents)).magnitude < 0.0001f)) { if (!flag) { result = bounds; flag = true; } else { ((Bounds)(ref result)).Encapsulate(bounds); } } } } return flag; } public bool TryGetVisibleBounds(out Bounds result) { return VisibleBounds(out result); } public void DisplayModel_SetupCamAndScript() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) DisableScripts(areYouSure: false); object activeAsset = MCCreatorController._instance.ActiveAsset; bool flag = activeAsset != null && activeAsset == lastFramedAsset; lastFramedAsset = activeAsset; if (!VisibleBounds(out var result)) { ((Bounds)(ref result))..ctor(new Vector3(0f, 1f, 0f), new Vector3(1f, 2f, 1f)); } Vector3 val = ((Bounds)(ref result)).center; if (displayItemType == DisplayItemType.MODEL && DisplayModel_SpawnedList.Count > 0) { Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f - ((Bounds)(ref result)).center.x, 0f - ((Bounds)(ref result)).min.y + ((((Bounds)(ref result)).size.y < 1f) ? 0.5f : 0f), 0f - ((Bounds)(ref result)).center.z); Transform transform = DisplayModel_SpawnedList[0].transform; transform.position += val2; val += val2; } camLerper.DoLerp(val, ((Bounds)(ref result)).size, flag); if (!flag) { camLerper.Snap(); } ((MonoBehaviour)camLerper).StopAllCoroutines(); ((MonoBehaviour)camLerper).StartCoroutine(RefitLater()); } private IEnumerator RefitLater() { for (int i = 0; i < 2; i++) { yield return (object)new WaitForSecondsRealtime((i == 0) ? 0.1f : 0.5f); if (DisplayModel_SpawnedList == null || DisplayModel_SpawnedList.Count == 0 || ((Object)(object)MC_EditorTools.Instance != (Object)null && MC_EditorTools.Instance.IsTesting)) { break; } if (VisibleBounds(out var result)) { camLerper.DoLerp(((Bounds)(ref result)).center, ((Bounds)(ref result)).size, keepView: true); } } } public void ResetView() { if ((Object)(object)camLerper != (Object)null) { camLerper.ResetView(); } } public void OrbitView(float dYaw, float dPitch) { if ((Object)(object)camLerper != (Object)null) { camLerper.Orbit(dYaw, dPitch); } } public void ZoomView(float wheel) { if ((Object)(object)camLerper != (Object)null) { camLerper.Zoom(wheel); } } public void PanView(Vector2 delta) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)camLerper != (Object)null) { camLerper.Pan(delta); } } public void ClearDisplay() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if (DisplayModel_SpawnedList != null) { foreach (GameObject displayModel_Spawned in DisplayModel_SpawnedList) { if ((Object)displayModel_Spawned != (Object)null) { Object.Destroy((Object)displayModel_Spawned); } } DisplayModel_SpawnedList.Clear(); } DisplayImage.SetActive(false); } private void DisableScripts(bool areYouSure = true) { if (!areYouSure) { return; } foreach (GameObject displayModel_Spawned in DisplayModel_SpawnedList) { MonoBehaviour[] componentsInChildren = displayModel_Spawned.GetComponentsInChildren<MonoBehaviour>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Behaviour)componentsInChildren[i]).enabled = false; } } } public void RefreshDisplay() { if ((Object)(object)MC_EditorTools.Instance != (Object)null && MC_EditorTools.Instance.IsTesting) { MC_EditorTools.Instance.StopTest(refresh: false); } ClearDisplay(); bool flag = false; if (Enum.GetName(typeof(ModeType), MCCreatorController._instance.CurrentMode).Contains("UNIT")) { flag = Display_Unit(); } if (Enum.GetName(typeof(ModeType), MCCreatorController._instance.CurrentMode).Contains("FACTION")) { flag = Display_Fac(); } if (Enum.GetName(typeof(ModeType), MCCreatorController._instance.CurrentMode).Contains("WEAPON")) { flag = Display_Model(AssetType.WEAPON); } if (Enum.GetName(typeof(ModeType), MCCreatorController._instance.CurrentMode).Contains("PROP")) { flag = Display_Model(AssetType.PROP); } if (Enum.GetName(typeof(ModeType), MCCreatorController._instance.CurrentMode).Contains("PROJECTILE")) { flag = Display_Model(AssetType.PROJECTILE); } REFRESHFAIL = !flag; } public bool Display_Fac() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown Faction val = (Faction)MCCreatorController._instance.ActiveAsset; ModelNameText.text = MC_Names.Pretty(((Object)val).name); DisplayImage.SetActive(true); DisplayImage.GetComponent<Image>().sprite = val.Entity.SpriteIcon; ((Component)DisplayImage.transform.GetChild(0)).gameObject.GetComponent<Image>().sprite = val.Entity.SpriteIcon; displayItemType = DisplayItemType.FAC; return true; } public bool Display_Unit() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown object activeAsset = MCCreatorController._instance.ActiveAsset; UnitBlueprint val = (UnitBlueprint)((activeAsset is UnitBlueprint) ? activeAsset : null); if ((Object)val == (Object)null) { try { MC_Compat.RestoreUserContent(); if (MC_FieldMaster._instance != null) { _ = MC_FieldMaster._instance.CurrentlySelectedAssetID; object itemByGUID = MC_DatabaseMaster._instance.GetItemByGUID(MC_FieldMaster._instance.CurrentlySelectedAssetID, AssetType.UNIT); val = (UnitBlueprint)((itemByGUID is UnitBlueprint) ? itemByGUID : null); } } catch (Exception ex) { Debug.LogWarning((object)("UC++ : could not find the selected unit: " + ex.Message)); } if ((Object)val == (Object)null) { ModelNameText.text = "Unit not found"; return false; } MCCreatorController._instance.ActiveAsset = val; } Unit val2 = null; try { DisplayModel_SpawnedList = new List<GameObject>(val.Spawn(Vector3.zero, GetLookRot(AssetType.UNIT), MC_UnitEditorExtras.PreviewTeam, ref val2, 1f, false, true, 0, (UnitPoolInfo?)null)); } catch (Exception ex2) { Debug.LogWarning((object)("UC++ : could not show " + ((Object)val).name + ": " + ex2.Message)); ModelNameText.text = MC_Names.Pretty(((Object)val).name) + " (could not display)"; return false; } if ((Object)val2 != (Object)null) { val2.FreezeBody(); } displayItemType = DisplayItemType.UNIT; ModelNameText.text = MC_Names.Pretty(((Object)val).name); DisplayModel_SetupCamAndScript(); return true; } public bool Display_Model(AssetType assetType) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown DisplayModel_SpawnedList = new List<GameObject>(); DisplayModel_SpawnedList.Add(Object.Instantiate<GameObject>((GameObject)MCCreatorController._instance.ActiveAsset, Vector3.zero, GetLookRot(assetType))); Rigidbody[] componentsInChildren = DisplayModel_SpawnedList[0].GetComponentsInChildren<Rigidbody>(); foreach (Rigidbody obj in componentsInChildren) { obj.isKinematic = true; obj.useGravity = false; } string text = ((Object)DisplayModel_SpawnedList[0]).name; if (text.LastIndexOf('(') > 0) { text = text.Substring(0, text.LastIndexOf('(')); } displayItemType = DisplayItemType.MODEL; ModelNameText.text = MC_Names.Pretty(text.Trim()); DisplayModel_SetupCamAndScript(); return true; } public void StartDisplay() { if (MCCreator._instance.WelcomeOver) { MCCreator._instance.WelcomeScreen.SetActive(false); MCCreator._instance.MainScreen.SetActive(true); } ClearDisplay(); if (MCCreatorController._instance.CurrentMode == ModeType.HOME_UNITS) { Display_Unit(); } if (MCCreatorController._instance.CurrentMode == ModeType.HOME_FACTIONS) { Display_Fac(); } if (MCCreatorController._instance.CurrentMode == ModeType.HOME_WEAPONS) { Display_Model(AssetType.WEAPON); } if (MCCreatorController._instance.CurrentMode == ModeType.HOME_PROPS) { Display_Model(AssetType.PROP); } if (MCCreatorController._instance.CurrentMode == ModeType.HOME_PROJECTILES) { Display_Model(AssetType.PROJECTILE); } } public void Init() { DisplayImage = ((Component)MCCreator._instance.CreatorCanvas.transform.Find("UnitCreator/Inner/ImageDisplay")).gameObject; ModelCam = MCCreator._instance.SceneCam; SpawnPoint = MCCreator._instance.SpawnPoint; ModelNameText = ((Component)MCCreator._instance.CreatorCanvas.transform.Find("UnitCreator/Inner/AssetName")).gameObject.GetComponent<Text>(); ModelNameText.text = "No Asset Loaded"; DisplayModel_SpawnedList = new List<GameObject>(); DisplayImage.SetActive(false); camLerper = ModelCam.AddComponent<CamLerper>(); } } public class MCPicker : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class _003C_003Ec { public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); public static UnityAction<string> _003C_003E9__24_0; public static UnityAction _003C_003E9__24_1; public static UnityAction _003C_003E9__24_2; internal void _003CSetupPicker_003Eb__24_0(string str) { _instance.SearchDataPicker(str); } internal void _003CSetupPicker_003Eb__24_1() { _instance.ClickOK(); } internal void _003CSetupPicker_003Eb__24_2() { _instance.ClickCANCEL(); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction<string> <>9__45_0; public static UnityAction <>9__45_1; public static UnityAction <>9__45_2; internal void <SetupPicker>b__45_0(string str) { _instance.SearchDataPicker(str); } internal void <SetupPicker>b__45_1() { _instance.ClickOK(); } internal void <SetupPicker>b__45_2() { _instance.ClickCANCEL(); } } private Dictionary<int, string> FieldDict_Factions; private List<GameObject> FieldList_Factions; private Dictionary<int, string> FieldDict_Units; private List<GameObj