public Suit(string name) { Name = name; Gender = Util.HasSuffix(name, 'm') ? ProtoCrewMember.Gender.Male : Util.HasSuffix(name, 'f') ? ProtoCrewMember.Gender.Female : (Gender?)null; Kind = Util.HasSuffix(name, 'V') ? KerbalSuit.Vintage : Util.HasSuffix(name, 'F') ? KerbalSuit.Future : KerbalSuit.Default; Excluded = Util.HasSuffix(name, 'x'); }
void drawSuitPreviewPanel() { GUILayout.BeginVertical(); GUILayout.BeginScrollView(Vector2.zero, suitPreviewPanelWidth); ProtoCrewMember.KerbalSuit suitType = ProtoCrewMember.KerbalSuit.Default; if (selectedCombo != null) { string suitTypeString = string.Empty; switch (selectedCombo.suitType.ToLower()) { case "vintage": suitType = ProtoCrewMember.KerbalSuit.Vintage; suitTypeString = Localizer.Format("#autoLOC_8012022"); break; case "future": suitType = ProtoCrewMember.KerbalSuit.Future; suitTypeString = Localizer.Format("#autoLOC_8012023"); break; default: suitType = ProtoCrewMember.KerbalSuit.Default; suitTypeString = Localizer.Format("#autoLOC_8012021"); break; } GUILayout.Label("<color=white>" + Localizer.Format(selectedCombo.displayName) + " " + suitTypeString + "</color>"); } // Suit sprite if (suitSprite != null) { GUILayout.Label(suitSprite); } GUILayout.EndScrollView(); if (GUILayout.Button(Localizer.Format("#LOC_SUNKWORKS_suitSwitcherSelectSuit")) && selectedCrew != null && selectedCombo != null) { selectedCrew.ComboId = selectedCombo.name; if (!string.IsNullOrEmpty(selectedCombo.suitTexture)) { selectedCrew.SuitTexturePath = selectedCombo.suitTexture; } if (!string.IsNullOrEmpty(selectedCombo.normalTexture)) { selectedCrew.NormalTexturePath = selectedCombo.normalTexture; } selectedCrew.suit = suitType; switch (selectedCombo.suitType.ToLower()) { case "vintage": selectedCrew.suit = ProtoCrewMember.KerbalSuit.Vintage; break; case "future": selectedCrew.suit = ProtoCrewMember.KerbalSuit.Future; break; default: selectedCrew.suit = ProtoCrewMember.KerbalSuit.Default; break; } selectedCrew.UseStockTexture = suitCombos.StockCombos.Contains(selectedCombo); } GUILayout.EndVertical(); }
public RMKerbal(double currentTime, ProtoCrewMember kerbal, bool isnew, bool modKerbal) { LastUpdate = currentTime; Kerbal = kerbal; IsNew = isnew; Name = kerbal.name; if (isnew) { Trait = kerbal.trait; Type = kerbal.type; Status = kerbal.rosterStatus; VesselId = Guid.Empty; VesselName = string.Empty; double diceMinage = _rnd.Next(RMLifeSpan.Instance.RMGameSettings.MinimumAge - 3, RMLifeSpan.Instance.RMGameSettings.MinimumAge + 3); // Randomly set their age. Age = diceMinage; double diceMaxage = _rnd.Next(RMLifeSpan.Instance.RMGameSettings.MaximumAge - 5, RMLifeSpan.Instance.RMGameSettings.MaximumAge + 5); // Randomly set their age. Lifespan = diceMaxage; TimelastBirthday = currentTime; TimeNextBirthday = BirthdayNextDue(currentTime); Timelastsalary = currentTime; TimeSalaryDue = SalaryNextDue(currentTime); Salary = RMLifeSpan.Instance.RMGameSettings.DefaultSalary; if (Api.InstalledMods.IsDfInstalled) { if (kerbal.rosterStatus == ProtoCrewMember.RosterStatus.Dead && kerbal.type == ProtoCrewMember.KerbalType.Unowned) // if they are frozen store time frozen { if (RMAddon.FrozenKerbals.ContainsKey(kerbal.name)) { TimeDfFrozen = RMAddon.FrozenKerbals[kerbal.name].LastUpdate; } } } Name = kerbal.name; Stupidity = kerbal.stupidity; Courage = kerbal.courage; Badass = kerbal.isBadass; Gender = kerbal.gender; Suit = kerbal.suit; Skill = kerbal.experienceLevel; Experience = kerbal.experience; Kerbal = kerbal; } if (!modKerbal) { return; } Stupidity = kerbal.stupidity; Courage = kerbal.courage; Badass = kerbal.isBadass; if (SalaryContractDispute) { RealTrait = kerbal.trait; Trait = "Tourist"; KerbalRoster.SetExperienceTrait(kerbal, Trait); } else { if (Status == ProtoCrewMember.RosterStatus.Assigned) { UnregisterExperienceTrait(this); } Trait = kerbal.trait; RealTrait = kerbal.trait; KerbalRoster.SetExperienceTrait(kerbal, Trait); if (Status == ProtoCrewMember.RosterStatus.Assigned) { RegisterExperienceTrait(this); } } Gender = kerbal.gender; Suit = kerbal.suit; Skill = kerbal.experienceLevel; Experience = kerbal.experience; }