Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build Simitone

on:
workflow_dispatch:
inputs:
configuration:
description: 'Build configuration'
required: false
default: 'Release'
type: choice
options:
- Release
- Debug

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'

- name: Run Protobuild
shell: pwsh
run: |
cd FreeSO/Other/libs/FSOMonoGame/
./protobuild.exe --generate
continue-on-error: true

- name: Restore Simitone dependencies
run: dotnet restore Client/Simitone/Simitone.sln

- name: Restore FreeSO dependencies
run: dotnet restore FreeSO/TSOClient/FreeSO.sln
continue-on-error: true

- name: Restore Roslyn dependencies
shell: pwsh
run: |
cd FreeSO/TSOClient/FSO.SimAntics.JIT.Roslyn/
dotnet restore
continue-on-error: true

- name: Build
run: dotnet build Client/Simitone/Simitone.sln -c ${{ inputs.configuration || 'Release' }} --no-restore

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: SimitoneWindows-${{ inputs.configuration || 'Release' }}
path: Client/Simitone/Simitone.Windows/bin/${{ inputs.configuration || 'Release' }}/net9.0-windows/
if-no-files-found: error
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class UIFamiliesCASPanel : UIContainer
public UITwoStateButton NewButton;

public event Action OnNewFamily;
public event Action OnDeleteFamily;

public List<FAMI> Families = new List<FAMI>();
private VM vm;
Expand Down Expand Up @@ -63,6 +64,7 @@ public UIFamiliesCASPanel()
DeleteButton = new UITwoStateButton(ui.Get("btn_deletefam.png").Get(gd));
DeleteButton.Position = new Vector2(sw - 140, sh - 260);
Add(DeleteButton);
DeleteButton.OnButtonClick += (btn) => OnDeleteFamily?.Invoke();

NewButton = new UITwoStateButton(ui.Get("btn_createfam.png").Get(gd));
NewButton.Position = new Vector2(sw - 140, sh - 380);
Expand Down
37 changes: 37 additions & 0 deletions Client/Simitone/Simitone.Client/UI/Screens/TS1CASScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ public TS1CASScreen()

FamiliesPanel = new UIFamiliesCASPanel();
FamiliesPanel.OnNewFamily += () => { SetMode(UICASMode.FamilyEdit); };
FamiliesPanel.OnDeleteFamily += DeleteFamily;
Add(FamiliesPanel);

BackButton = new UITwoStateButton(ui.Get("btn_back.png").Get(gd));
Expand Down Expand Up @@ -764,6 +765,42 @@ public override void Update(UpdateState state)
}
}

public void DeleteFamily()
{
if (FamiliesPanel.Selection == -1) return;

var selectedFamily = FamiliesPanel.Families[FamiliesPanel.Selection];
var familyName = Content.Get().Neighborhood.MainResource.Get<FAMs>(selectedFamily.ChunkID)?.GetString(0) ?? "this family";

if (ConfirmDialog == null)
{
ConfirmDialog = new UIMobileAlert(new UIAlertOptions()
{
Title = "Delete Family",
Message = $"Are you sure you want to delete the {familyName} family? This cannot be undone.",
Buttons = UIAlertButton.YesNo(
(ybtn) => {
ConfirmDialog.Close();
ConfirmDialog = null;
var neigh = Content.Get().Neighborhood;
var fami = selectedFamily;
var fams = neigh.MainResource.Get<FAMs>(fami.ChunkID);

fami.ChunkParent.FullRemoveChunk(fami);
if (fams != null) fams.ChunkParent.FullRemoveChunk(fams);

neigh.SaveNeighbourhood(true);

FamiliesPanel.SetSelection(-1);
SetFamilies();
},
(nbtn) => { ConfirmDialog.Close(); ConfirmDialog = null; }
)
});
UIScreen.GlobalShowDialog(ConfirmDialog, true);
}
}

public void SetFamilies()
{
//get all families that don't have a house from neighbourhood, and populate the list
Expand Down