예제 #1
0
 static void Prefix(ref SGBarracksMWCustomizationPopup __instance, ref PortraitSettings portraitSettingsData)
 {
     try {
         if (portraitSettingsData == null)
         {
             if (!string.IsNullOrEmpty(__instance.pilot.pilotDef.Description.Icon))
             {
                 foreach (string path in CommanderPortraitLoader.jsonSearchablePaths)
                 {
                     string filePath = path + __instance.pilot.pilotDef.Description.Icon + ".json";
                     if (File.Exists(filePath))
                     {
                         portraitSettingsData = new PortraitSettings();
                         using (StreamReader r = new StreamReader(filePath))
                         {
                             string json = r.ReadToEnd();
                             portraitSettingsData.FromJSON(json);
                             break;
                         }
                     }
                 }
             }
         }
     } catch (Exception e) {
         Logger.LogError(e);
     }
 }
예제 #2
0
 static void Postfix(ref SGBarracksMWCustomizationPopup __instance)
 {
     if (!string.IsNullOrEmpty(NewVoice.newVoice))
     {
         __instance.pilot.pilotDef.SetVoice(NewVoice.newVoice);
     }
     if (!string.IsNullOrEmpty(__instance.pilot.pilotDef.Description.Icon))
     {
         __instance.pilot.pilotDef.PortraitSettings = null;
     }
 }