Skip to content

Commit

Permalink
- Added 'Advanced...' button to the Appearance tab. (WIP)
Browse files Browse the repository at this point in the history
- Resized and repositioned the appearance preset buttons to better fit with the quest facts tab design.
- Fixed #30
  • Loading branch information
Deweh committed Jun 25, 2021
1 parent 252d98e commit bc302b9
Show file tree
Hide file tree
Showing 7 changed files with 350 additions and 61 deletions.
2 changes: 1 addition & 1 deletion CP2077SaveEditor/Utils/AppearanceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public AppearanceGender BodyGender
var playerPuppet = (PlayerPuppetPS)activeSave.GetPSDataContainer().ClassList.Where(x => x is PlayerPuppetPS).FirstOrDefault();
if (value == AppearanceGender.Female)
{
playerPuppet.Gender = string.Empty;
playerPuppet.Gender = "Female";
if (!SuppressBodyGenderPrompt)
{
SetAllValues(JsonConvert.DeserializeObject<CharacterCustomizationAppearances>(CP2077SaveEditor.Properties.Resources.FemaleDefaultPreset));
Expand Down
151 changes: 151 additions & 0 deletions CP2077SaveEditor/Views/AdvancedAppearanceDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions CP2077SaveEditor/Views/AdvancedAppearanceDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CP2077SaveEditor.Extensions;
using static CyberCAT.Core.Classes.NodeRepresentations.CharacterCustomizationAppearances;

namespace CP2077SaveEditor
{
public partial class AdvancedAppearanceDialog : Form
{
private Dictionary<string, HashValueEntry> options = new Dictionary<string, HashValueEntry>();
private Form1 parent;

public AdvancedAppearanceDialog()
{
InitializeComponent();
}

private void AdvancedAppearanceDialog_Load(object sender, EventArgs e)
{
parent = this.Owner as Form1;
var container = Form1.activeSaveFile.GetAppearanceContainer();

foreach (var section in container.FirstSection.AppearanceSections)
{
foreach (var mainEntry in section.MainList)
{
options.Add("face/" + section.SectionName + "/" + mainEntry.SecondString, mainEntry);
}
}

foreach (var section in container.SecondSection.AppearanceSections)
{
foreach (var mainEntry in section.MainList)
{
options.Add("hands/" + section.SectionName + "/" + mainEntry.SecondString, mainEntry);
}
}

foreach (var section in container.ThirdSection.AppearanceSections)
{
foreach (var mainEntry in section.MainList)
{
options.Add("body/" + section.SectionName + "/" + mainEntry.SecondString, mainEntry);
}
}

optionsBox.Items.AddRange(options.Keys.ToArray());
}

private void optionsBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (optionsBox.SelectedItem != null)
{
HashValueEntry entry = options[(string)optionsBox.SelectedItem];

firstBox.Text = entry.FirstString;
secondBox.Text = entry.SecondString;
pathBox.Text = entry.GetPath();
}
}
}
}
60 changes: 60 additions & 0 deletions CP2077SaveEditor/Views/AdvancedAppearanceDialog.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
Loading

0 comments on commit bc302b9

Please sign in to comment.