static void ChooseCompanionColor(CharacterSettings characterSettings, UnitEntityData unitEntityData) { if (GUILayout.Button("Create Doll", GUILayout.Width(DefaultLabelWidth))) { var race = unitEntityData.Descriptor.Progression.Race; var options = unitEntityData.Descriptor.Gender == Gender.Male ? race.MaleOptions : race.FemaleOptions; var dollState = new DollState(); dollState.SetRace(unitEntityData.Descriptor.Progression.Race); //Race must be set before class //This is a hack to work around harmony not allowing calls to the unpatched method CharacterManager.disableEquipmentClassPatch = true; dollState.SetClass(unitEntityData.Descriptor.Progression.GetEquipmentClass()); CharacterManager.disableEquipmentClassPatch = false; dollState.SetGender(unitEntityData.Descriptor.Gender); dollState.SetRacePreset(race.Presets[0]); unitEntityData.Descriptor.LeftHandedOverride = false; if (options.Hair.Length > 0) { dollState.SetHair(options.Hair[0]); } if (options.Heads.Length > 0) { dollState.SetHead(options.Hair[0]); } if (options.Beards.Length > 0) { dollState.SetBeard(options.Hair[0]); } dollState.Validate(); unitEntityData.Descriptor.Doll = dollState.CreateData(); unitEntityData.Descriptor.ForcceUseClassEquipment = true; CharacterManager.RebuildCharacter(unitEntityData); } GUILayout.Label("Note: Colors only applies to non-default outfits, the default companion custom voice is None"); { GUILayout.BeginHorizontal(); GUILayout.Label("Primary Outfit Color ", GUILayout.Width(DefaultLabelWidth)); var newIndex = (int)Math.Round(GUILayout.HorizontalSlider(characterSettings.companionPrimary, -1, 35, GUILayout.Width(DefaultSliderWidth)), 0); GUILayout.Label(" " + newIndex, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (newIndex != characterSettings.companionPrimary) { characterSettings.companionPrimary = newIndex; CharacterManager.UpdateModel(unitEntityData.View); } } { GUILayout.BeginHorizontal(); GUILayout.Label("Secondary Outfit Color ", GUILayout.Width(DefaultLabelWidth)); var newIndex = (int)Math.Round(GUILayout.HorizontalSlider(characterSettings.companionSecondary, -1, 35, GUILayout.Width(DefaultSliderWidth)), 0); GUILayout.Label(" " + newIndex, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (newIndex != characterSettings.companionSecondary) { characterSettings.companionSecondary = newIndex; CharacterManager.UpdateModel(unitEntityData.View); } } ChoosePortrait(unitEntityData); ChooseAsks(unitEntityData); }
static void ChooseRamp(UnitEntityData unitEntityData, DollState doll, string label, List <Texture2D> textures, int currentRamp, Action <int> setter) { ChooseFromList(label, textures, ref currentRamp, () => { setter(currentRamp); unitEntityData.Descriptor.Doll = doll.CreateData(); CharacterManager.RebuildCharacter(unitEntityData); }); }
static void ChooseEEL(UnitEntityData unitEntityData, DollState doll, string label, EquipmentEntityLink[] links, EquipmentEntityLink link, Action <EquipmentEntityLink> setter) { var index = links.ToList().FindIndex((eel) => eel.AssetId == link.AssetId); ChooseFromList(label, links, ref index, () => { setter(links[index]); unitEntityData.Descriptor.Doll = doll.CreateData(); CharacterManager.RebuildCharacter(unitEntityData); }); }
/* static void ChooseRace(UnitEntityData unitEntityData, DollState doll) * { * var currentRace = doll.Race; * var racess = new List<BlueprintRace> { }; * foreach(BlueprintRace race in BlueprintRoot.Instance.Progression.CharacterRaces) * { * racess.AddItem(race); * } * var races = racess.ToArray(); * foreach(BlueprintRace race in races) * { * Main.logger.Log(race.NameForAcronym); * } * /// var index = Array.FindIndex(races, (race) => race == currentRace); * var index = 1; * GUILayout.BeginHorizontal(); * ChooseFromList("Race", races, ref index, () => { * doll.SetRace(races[index]); * unitEntityData.Descriptor.Doll = doll.CreateData(); * CharacterManager.RebuildCharacter(unitEntityData); * }); * GUILayout.Label(" " + races[index].Name); * GUILayout.EndHorizontal(); * }*/ static void ChooseVisualPreset(UnitEntityData unitEntityData, DollState doll, string label, BlueprintRaceVisualPreset[] presets, BlueprintRaceVisualPreset currentPreset) { var index = Array.FindIndex(presets, (vp) => vp == currentPreset); ChooseFromList(label, presets, ref index, () => { doll.SetRacePreset(presets[index]); unitEntityData.Descriptor.Doll = doll.CreateData(); CharacterManager.RebuildCharacter(unitEntityData); }); }
static void ChooseEEL(UnitEntityData unitEntityData, DollState doll, string label, EquipmentEntityLink[] links, EquipmentEntityLink link, Action <EquipmentEntityLink> setter) { if (links.Length == 0) { GUILayout.Label($"Missing equipment for {label}"); } var index = links.ToList().FindIndex((eel) => eel != null && eel.AssetId == link?.AssetId); ChooseFromList(label, links, ref index, () => { setter(links[index]); unitEntityData.Descriptor.Doll = doll.CreateData(); CharacterManager.RebuildCharacter(unitEntityData); }); }
static void ChooseRace(UnitEntityData unitEntityData, DollState doll) { var currentRace = doll.Race; var races = BlueprintRoot.Instance.Progression.CharacterRaces; var index = Array.FindIndex(races, (race) => race == currentRace); GUILayout.BeginHorizontal(); ChooseFromList("Race", races, ref index, () => { doll.SetRace(races[index]); unitEntityData.Descriptor.Doll = doll.CreateData(); CharacterManager.RebuildCharacter(unitEntityData); }); GUILayout.Label(" " + races[index].Name); GUILayout.EndHorizontal(); }