Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Specie Name #994

Merged
merged 18 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
ToolTip="{Loc 'humanoid-profile-editor-guidebook-button-tooltip'}"/>
<OptionButton Name="CSpeciesButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Species -->
<BoxContainer Name="CCustomSpecieName" HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-customspeciename-label'}" />
<Control HorizontalExpand="True"/>
<LineEdit Name="CCustomSpecieNameEdit" MinSize="270 0" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Age -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-age-label'}" />
Expand Down
27 changes: 27 additions & 0 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@

private LineEdit _ageEdit => CAgeEdit;
private LineEdit _nameEdit => CNameEdit;

private BoxContainer _ccustomspecienamecontainerEdit => CCustomSpecieName;
private LineEdit _customspecienameEdit => CCustomSpecieNameEdit;
private TextEdit? _flavorTextEdit;
private Button _nameRandomButton => CNameRandomize;
private Button _randomizeEverythingButton => CRandomizeEverything;
Expand Down Expand Up @@ -131,6 +134,12 @@

#endregion Name

#region Custom Specie Name

_customspecienameEdit.OnTextChanged += args => { SetCustomSpecieName(args.Text); };

#endregion CustomSpecieName

#region Appearance

CAppearance.Orphan();
Expand Down Expand Up @@ -190,6 +199,7 @@
SetSpecies(_speciesList[args.Id].ID);
UpdateHairPickers();
OnSkinColorOnValueChanged();
UpdateCustomSpecieNameEdit();
};

#endregion Species
Expand Down Expand Up @@ -940,6 +950,12 @@
IsDirty = true;
}

private void SetCustomSpecieName(string customname)
{
Profile = Profile?.WithCustomSpeciesName(customname);
IsDirty = true;
}

private void SetSpawnPriority(SpawnPriorityPreference newSpawnPriority)
{
Profile = Profile?.WithSpawnPriorityPreference(newSpawnPriority);
Expand Down Expand Up @@ -986,6 +1002,16 @@
_nameEdit.Text = Profile?.Name ?? "";
}

private void UpdateCustomSpecieNameEdit()
{
if (Profile == null)
return;

_customspecienameEdit.Text = Profile.Customspeciename ?? "";

_ccustomspecienamecontainerEdit.Visible = _prototypeManager.TryIndex<SpeciesPrototype>(Profile.Species, out var speciesProto)) && speciesProto.CustomName);

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Invalid expression term '&&'

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Invalid expression term '&&'

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Invalid expression term '&&'

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Invalid expression term '&&'

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Invalid expression term '&&'

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Invalid expression term '&&'

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Invalid expression term '&&'

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

} expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Invalid expression term '&&'

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

; expected

Check failure on line 1012 in Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

} expected
}

private void UpdateFlavorTextEdit()
{
if(_flavorTextEdit != null)
Expand Down Expand Up @@ -1270,6 +1296,7 @@
return;

UpdateNameEdit();
UpdateCustomSpecieNameEdit();
UpdateFlavorTextEdit();
UpdateSexControls();
UpdateGenderControls();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private static HumanoidCharacterProfile CharlieCharlieson()
"Charlie Charlieson",
"The biggest boy around.",
"Human",
"",
1,
1,
21,
Expand Down
Loading
Loading