public static void Postfix(SGBarracksDossierPanel __instance, Pilot p, Image ___portrait)
            {
                if (p == null)
                {
                    return;
                }

                var tooltip = ___portrait.gameObject.GetComponent <HBSTooltip>() ??
                              ___portrait.gameObject.AddComponent <HBSTooltip>();

                var desc = tooltip.GetText();

                if (String.IsNullOrEmpty(desc))
                {
                    desc = "";
                }

                var specDesc = Descriptions.GetPilotSpecializationsOrProgress(p);

                desc += specDesc;

                var descDef = new BaseDescriptionDef("PilotSpecs", p.Callsign, desc, null);

                tooltip.SetDefaultStateData(TooltipUtilities.GetStateDataFromObject(descDef));
            }
Example #2
0
        static void Postfix(SGBarracksMWDetailPanel __instance, Pilot p,
                            SGBarracksAdvancementPanel ___advancement, GameObject ___advancementSectionGO,
                            SGBarracksDossierPanel ___dossier,
                            SGBarracksServicePanel ___servicePanel, GameObject ___serviceSectionGO,
                            HBSDOTweenButton ___customizeButton)
        {
            if (p == null)
            {
                return;
            }
            CrewDetails details = ModState.GetCrewDetails(p.pilotDef);

            GameObject skillsButton = __instance.gameObject.FindFirstChildNamed(ModConsts.GO_HBS_Barracks_Skill_Button);

            if (skillsButton == null)
            {
                Mod.Log.Debug?.Write("SkillsButton is null!");
            }

            if (details.IsMechTechCrew || details.IsMedTechCrew || details.IsAerospaceCrew)
            {
                __instance.OnServiceSectionClicked();
                skillsButton.SetActive(false);
            }
            else
            {
                skillsButton.SetActive(true);
            }
        }
Example #3
0
        static void Postfix(SGBarracksMWDetailPanel __instance,
                            Pilot ___curPilot,
                            SGBarracksAdvancementPanel ___advancement, GameObject ___advancementSectionGO,
                            SGBarracksDossierPanel ___dossier,
                            SGBarracksServicePanel ___servicePanel, GameObject ___serviceSectionGO,
                            HBSDOTweenButton ___customizeButton)
        {
            if (___curPilot == null)
            {
                return;
            }

            CrewDetails details = ModState.GetCrewDetails(___curPilot.pilotDef);

            if (details.IsMechTechCrew || details.IsMedTechCrew || details.IsAerospaceCrew)
            {
                ___advancementSectionGO.SetActive(false);
            }
        }
        public static void Postfix(ref SGCharacterCreationNamePanel __instance, ref Gender __result)
        {
            if (CustomVoiceFetcher.isCustomVoicesDetected)
            {
                return;
            }
            bool lastVOWasLight = false;

            WwiseManager.PostEvent(AudioEventList_vo.vo_stop_pilots, WwiseManager.GlobalAudioObject, null, null);
            NewVoice.newVoice = string.Empty;
            string text = __instance.pronounSelector.selection.ToLower();

            if (text != null)
            {
                if (CommanderPortraitLoader.customVoices != null)
                {
                    foreach (CustomVoice cv in CommanderPortraitLoader.customVoices)
                    {
                        if (text == cv.name)
                        {
                            NewVoice.newVoice = cv.name;
                            __result          = cv.gender;
                            SGBarracksDossierPanel.PlayVO(cv.name);
                            return;
                        }
                    }
                }
                if (!(text == "male pro") && !(text == "male british") && !(text == "male david") && !(text == "male brad") && !(text == "male rick") && !(text == "male matthew") && !(text == "male allan") && !(text == "male ermy") && !(text == "male bear") && !(text == "male raju") && !(text == "male rizzo") && !(text == "male vizzini") && !(text == "male overload"))
                {
                    if (!(text == "female pro") && !(text == "female pro 2") && !(text == "female british") && !(text == "female asian") && !(text == "female irish") && !(text == "female midwest") && !(text == "female tanesha") && !(text == "female tough") && !(text == "female bear") && !(text == "female creep") && !(text == "female russian") && !(text == "female kamea") && !(text == "female overload"))
                    {
                        if (text == "onboard ai")
                        {
                            __result = Gender.NonBinary;
                        }
                    }
                    else
                    {
                        if (text == "female pro")
                        {
                            NewVoice.newVoice = "f_pro01";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro01, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female pro 2")
                        {
                            NewVoice.newVoice = "f_pro07";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro07, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female british")
                        {
                            NewVoice.newVoice = "f_pro01_brit";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro01_brit, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female asian")
                        {
                            NewVoice.newVoice = "f_pro02_asian";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro02_asian, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female irish")
                        {
                            NewVoice.newVoice = "f_pro02_irish";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro02_irish, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female midwest")
                        {
                            NewVoice.newVoice = "f_pro04_midwest";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro04_midwest, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female tanesha")
                        {
                            NewVoice.newVoice = "f_pro05_tanesha";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro05_tanesha, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female tough")
                        {
                            NewVoice.newVoice = "f_pro06_tough";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_pro06_tough, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female bear")
                        {
                            NewVoice.newVoice = "f_bear02";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_bear02, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female creep")
                        {
                            NewVoice.newVoice = "f_creep01";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_creep01, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female russian")
                        {
                            NewVoice.newVoice = "f_glum01_russian";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_glum01_russian, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female kamea")
                        {
                            NewVoice.newVoice = "f_kamea";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_kamea, WwiseManager.GlobalAudioObject);
                        }
                        if (text == "female overload")
                        {
                            NewVoice.newVoice = "f_overload01";
                            WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.f_overload01, WwiseManager.GlobalAudioObject);
                        }
                        __result = Gender.Female;
                    }
                }
                else
                {
                    if (text == "male pro")
                    {
                        NewVoice.newVoice = "m_pro01_stark_chad";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro01_stark_chad, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male british")
                    {
                        NewVoice.newVoice = "m_pro03_brit";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro03_brit, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male david")
                    {
                        NewVoice.newVoice = "m_pro02_david";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro02_david, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male brad")
                    {
                        NewVoice.newVoice = "m_pro04_brad";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro04_brad, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male rick")
                    {
                        NewVoice.newVoice = "m_pro05_rick";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro05_rick, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male matthew")
                    {
                        NewVoice.newVoice = "m_pro06_matthew";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro06_matthew, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male allan")
                    {
                        NewVoice.newVoice = "m_pro07_allan";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_pro07_allan, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male ermy")
                    {
                        NewVoice.newVoice = "m_ermy01";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_ermy01, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male bear")
                    {
                        NewVoice.newVoice = "m_bear01";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_bear01, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male raju")
                    {
                        NewVoice.newVoice = "m_raju";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_raju, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male rizzo")
                    {
                        NewVoice.newVoice = "m_rizzo01";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_rizzo01, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male vizzini")
                    {
                        NewVoice.newVoice = "m_vizzini01";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_vizzini01, WwiseManager.GlobalAudioObject);
                    }
                    if (text == "male overload")
                    {
                        NewVoice.newVoice = "m_overload02";
                        WwiseManager.SetSwitch(AudioSwitch_dialog_character_type_pilots.m_overload02, WwiseManager.GlobalAudioObject);
                    }
                    __result = Gender.Male;
                }
                if (NewVoice.newVoice == string.Empty)
                {
                    WwiseManager.SetSwitch(AudioSwitch_dialog_lines_computer_ai.welcome_commander, WwiseManager.GlobalAudioObject);
                    WwiseManager.PostEvent(AudioEventList_vo.vo_play_computer_ai, WwiseManager.GlobalAudioObject, null, null);
                }
                else
                {
                    WwiseManager.SetSwitch(AudioSwitch_dialog_lines_pilots.chosen, WwiseManager.GlobalAudioObject);
                    if (lastVOWasLight)
                    {
                        WwiseManager.SetSwitch(AudioSwitch_dialog_dark_light.dark, WwiseManager.GlobalAudioObject);
                        lastVOWasLight = !lastVOWasLight;
                    }
                    else
                    {
                        WwiseManager.SetSwitch(AudioSwitch_dialog_dark_light.light, WwiseManager.GlobalAudioObject);
                        lastVOWasLight = !lastVOWasLight;
                    }
                    WwiseManager.PostEvent(AudioEventList_vo.vo_play_pilots, WwiseManager.GlobalAudioObject, null, null);
                }
            }
            return;
        }
            public static bool Prefix(SGBarracksMWDetailPanel __instance, Pilot ___curPilot, SGBarracksDossierPanel ___dossier)
            {
                var background = UIManager.Instance.UILookAndColorConstants.PopupBackfill;

                var hk = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);

                if (!hk)
                {
                    return(true);
                }
                var resetSpecs = true;

                if (___curPilot.IsPlayerCharacter && SpecManager.ManagerInstance.StratComs.Count > 1)
                {
                    GenericPopupBuilder
                    .Create("Change Stratcoms or Reset Specs?",
                            "Do you wish to change StratComs or reset specializations?.")
                    .AddButton("Change StratComs", () =>
                    {
                        var stratDesc = "";
                        var stratcoms = SpecManager.ManagerInstance.StratComs;
                        foreach (var stratCom in stratcoms)
                        {
                            var description =
                                $"<b>{stratCom.StratComName}:</b> {stratCom.description}\n\n";
                            stratDesc += description;
                        }

                        var popup = GenericPopupBuilder.Create("Select Active StratCom", stratDesc).CancelOnEscape()
                                    .AddFader(background);
                        foreach (var stratCom in stratcoms)
                        {
                            popup.AddButton(stratCom.StratComName, () =>
                            {
                                SpecManager.ManagerInstance.SetStratCom(stratCom.StratComID, ___curPilot, ___dossier, __instance);
                                resetSpecs = false;
                            });
                        }
                        popup.Render();
                    })
                    .AddButton("Reset Specs", () =>
                    {
                        if (!String.IsNullOrEmpty(ModInit.modSettings.argoUpgradeToReset) && resetSpecs &&
                            !sim.CompanyTags.Contains(ModInit.modSettings.argoUpgradeToReset))
                        {
                            GenericPopupBuilder
                            .Create("Unable To Reset Specializations", $"Required Argo Upgrade Not Found: {ModInit.modSettings.argoUpgradeToReset}.")
                            .AddButton("Understood")
                            .CancelOnEscape()
                            .AddFader(background)
                            .Render();
                        }

                        else if ((!String.IsNullOrEmpty(ModInit.modSettings.argoUpgradeToReset) && resetSpecs &&
                                  sim.CompanyTags.Contains(ModInit.modSettings.argoUpgradeToReset)) ||
                                 String.IsNullOrEmpty(ModInit.modSettings.argoUpgradeToReset))
                        {
                            GenericPopupBuilder
                            .Create("Reset Specializations",
                                    "Are you sure you want to reset all specializations and progress for this pilot?")
                            .AddButton("Cancel")
                            .AddButton("Reset Mission Specs",
                                       () => SpecManager.ManagerInstance.ResetMissionSpecs(___curPilot, ___dossier,
                                                                                           __instance))
                            .AddButton("Reset Opfor Specs",
                                       () => SpecManager.ManagerInstance.ResetOpForSpecs(___curPilot, ___dossier,
                                                                                         __instance))
                            .CancelOnEscape()
                            .AddFader(background)
                            .Render();
                        }
                    }).CancelOnEscape()
                    .AddFader(background)
                    .Render();
                    return(false);
                }

                if (!String.IsNullOrEmpty(ModInit.modSettings.argoUpgradeToReset) && resetSpecs &&
                    !sim.CompanyTags.Contains(ModInit.modSettings.argoUpgradeToReset))
                {
                    GenericPopupBuilder
                    .Create("Unable To Reset Specializations", $"Required Argo Upgrade Not Found: {ModInit.modSettings.argoUpgradeToReset}.")
                    .AddButton("Understood")
                    .CancelOnEscape()
                    .AddFader(background)
                    .Render();
                    return(false);
                }

                else if ((!String.IsNullOrEmpty(ModInit.modSettings.argoUpgradeToReset) && resetSpecs &&
                          sim.CompanyTags.Contains(ModInit.modSettings.argoUpgradeToReset)) || String.IsNullOrEmpty(ModInit.modSettings.argoUpgradeToReset))
                {
                    GenericPopupBuilder
                    .Create("Reset Specializations", "Are you sure you want to reset all specializations and progress for this pilot?")
                    .AddButton("Cancel")
                    .AddButton("Reset Mission Specs", () => SpecManager.ManagerInstance.ResetMissionSpecs(___curPilot, ___dossier, __instance))
                    .AddButton("Reset Opfor Specs", () => SpecManager.ManagerInstance.ResetOpForSpecs(___curPilot, ___dossier, __instance))
                    .CancelOnEscape()
                    .AddFader(background)
                    .Render();
                    return(false);
                }
                else
                {
                    return(false);
                }
            }
        static void Postfix(SGBarracksDossierPanel __instance, Pilot p,
                            LocalizableText ___healthText, List <GameObject> ___healthList, LocalizableText ___salary,
                            LocalizableText ___firstName, LocalizableText ___lastName)
        {
            if (p == null)
            {
                return;
            }

            Mod.DossierLog.Debug?.Write($"Updating Dossier for pilot: {p.Name}");
            CrewDetails details = ModState.GetCrewDetails(p.pilotDef);

            if (details.IsMechTechCrew || details.IsMedTechCrew || details.IsAerospaceCrew)
            {
                ___healthText.SetText("N/A");
                for (int i = 0; i < ___healthList.Count; i++)
                {
                    ___healthList[i].SetActive(false);
                }
            }

            string nameS = new Text(Mod.LocalizedText.Labels[ModText.LT_Crew_Name_Format],
                                    new object[] { p.FirstName, p.LastName }).ToString();

            ___firstName.SetText(nameS);

            // Set the firstname label to 'Name' instead of 'First Name'
            Mod.DossierLog.Debug?.Write("Updating firstName to Name");
            GameObject      firstNameGO      = __instance.gameObject.FindFirstChildNamed(ModConsts.GO_HBS_Barracks_Dossier_LastName);
            GameObject      firstNameLabelGO = firstNameGO.transform.parent.GetChild(0).GetChild(0).gameObject;
            LocalizableText firstNameLabel   = firstNameLabelGO.GetComponentInChildren <LocalizableText>();
            string          firstNameS       = new Text(Mod.LocalizedText.Labels[ModText.LT_Crew_Dossier_Contract_Term]).ToString();

            firstNameLabel.SetText(firstNameS);

            // Set the lastname label to 'Contract End' and the name value to the remaining days
            Mod.DossierLog.Debug?.Write("Updating lastName to ContractTerm");
            GameObject      lastNameGO      = __instance.gameObject.FindFirstChildNamed(ModConsts.GO_HBS_Barracks_Dossier_LastName);
            GameObject      lastNameLabelGO = lastNameGO.transform.parent.GetChild(0).GetChild(0).gameObject; // should be text_lastName -> parent -> layout-label -> label
            LocalizableText lastNameLabel   = lastNameLabelGO.GetComponentInChildren <LocalizableText>();
            string          contractTermS   = new Text(Mod.LocalizedText.Labels[ModText.LT_Crew_Dossier_Contract_Term]).ToString();

            lastNameLabel.SetText(contractTermS);

            string contractTermRemaining = "------";

            if (!details.IsPlayer && details.ContractTerm != 0)
            {
                int daysRemaining = details.ExpirationDay - ModState.SimGameState.DaysPassed;
                if (daysRemaining < 0)
                {
                    daysRemaining = 0;
                }
                contractTermRemaining = new Text(Mod.LocalizedText.Labels[ModText.LT_Crew_Dossier_Days_Remaining],
                                                 new object[] { daysRemaining }).ToString();
                Mod.DossierLog.Debug?.Write($" {daysRemaining} daysRemaining = {ModState.SimGameState.DaysPassed} daysPassed - {details.ExpirationDay} endDay");
            }

            ___lastName.SetText(contractTermRemaining);
            Mod.DossierLog.Debug?.Write($"  -- done updating dossier for pilot: {p.Name}");
        }