Esempio n. 1
0
 public static void Prefix(MechRepresentationSimGame __instance)
 {
     try
     {
         MechHardpointRules_GetComponentPrefabName_Patch.SetupCalculator(
             __instance.mechDef?.Chassis,
             __instance.mechDef?.Inventory?.ToList());
     }
     catch (Exception e)
     {
         Control.Logger.Error.Log(e);
     }
 }
Esempio n. 2
0
 public static void Prefix(MechRepresentationSimGame __instance)
 {
     try
     {
         MechHardpointRulesGetComponentPrefabNamePatch.SetupCalculator(
             __instance.mechDef != null ? __instance.mechDef.Chassis : null,
             __instance.mechDef != null ? (__instance.mechDef.Inventory != null ? __instance.mechDef.Inventory.ToList() : null) : null);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }
 public static void Prefix(MechRepresentationSimGame __instance)
 {
     try
     {
         CalculatorSetup.Setup(
             __instance.mechDef?.Chassis,
             __instance.mechDef?.Inventory?.ToList());
     }
     catch (Exception e)
     {
         Control.Logger.Error.Log(e);
     }
 }
Esempio n. 4
0
            static void Postfix(MechRepresentationSimGame __instance, MechDef mechDef)
            {
                if (!chassisScaleFactors.ContainsKey(mechDef.ChassisID))
                {
                    return;
                }

                Logger.Debug($"[MechRepresentationSimGame_Init_POSTFIX] Rescaling...");

                string identifier    = mechDef.ChassisID;
                float  fallbackScale = simGameScaleDefault;

                Vector3 adjustedLocalScale = GetScaleVector(identifier, fallbackScale, true);

                Logger.Debug($"[MechRepresentationSimGame_Init_POSTFIX] {identifier}: {adjustedLocalScale}");

                __instance.rootTransform.localScale = adjustedLocalScale;
            }
Esempio n. 5
0
 static void Prefix(MechRepresentationSimGame __instance)
 {
     try {
         string folder = Path.Combine(MechSkinLoader.ModDirectory, __instance.mechDef.Chassis.PrefabBase);
         if (Directory.Exists(folder))
         {
             List <string> skins = new List <string>();
             string[]      files = Directory.GetFiles(folder);
             foreach (string file in files)
             {
                 skins.Add(Path.GetFileName(file));
             }
             foreach (string skinname in skins)
             {
                 bool        flag  = false;
                 Texture2D[] array = __instance.mechCustomization.paintPatterns;
                 for (int i = 0; i < array.Length; i++)
                 {
                     if (array[i].name == skinname)
                     {
                         flag = true;
                     }
                 }
                 if (!flag)
                 {
                     Texture2D texture2D = UnityEngine.Object.Instantiate <Texture2D>(__instance.mechCustomization.paintPatterns[0]);
                     texture2D.name = skinname;
                     byte[] data = File.ReadAllBytes(Path.Combine(folder, skinname));
                     texture2D.LoadImage(data);
                     Array.Resize <Texture2D>(ref __instance.mechCustomization.paintPatterns, __instance.mechCustomization.paintPatterns.Length + 1);
                     __instance.mechCustomization.paintPatterns[__instance.mechCustomization.paintPatterns.Length - 1] = texture2D;
                     MechSkinLoader.Logger.Log("Added " + skinname + " For " + __instance.mechDef.Chassis.PrefabBase);
                 }
             }
         }
         else
         {
             MechSkinLoader.Logger.LogIfDebug("Not found " + __instance.mechDef.Chassis.PrefabBase);
         }
     }
     catch (Exception e) {
         MechSkinLoader.Logger.LogError(e);
     }
 }
Esempio n. 6
0
 public static void Postfix(MechRepresentationSimGame __instance)
 {
     MechHardpointRules_GetComponentPrefabName_Patch.ResetCalculator();
 }
 public static void Postfix(MechRepresentationSimGame __instance)
 {
     Main.SetupSpin(__instance.gameObject);
 }