diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..73d1437 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/Client/Simitone/Simitone.Client/UI/Panels/CAS/UIFamiliesCASPanel.cs b/Client/Simitone/Simitone.Client/UI/Panels/CAS/UIFamiliesCASPanel.cs index 5659886..99caa41 100644 --- a/Client/Simitone/Simitone.Client/UI/Panels/CAS/UIFamiliesCASPanel.cs +++ b/Client/Simitone/Simitone.Client/UI/Panels/CAS/UIFamiliesCASPanel.cs @@ -28,6 +28,7 @@ public class UIFamiliesCASPanel : UIContainer public UITwoStateButton NewButton; public event Action OnNewFamily; + public event Action OnDeleteFamily; public List Families = new List(); private VM vm; @@ -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); diff --git a/Client/Simitone/Simitone.Client/UI/Screens/TS1CASScreen.cs b/Client/Simitone/Simitone.Client/UI/Screens/TS1CASScreen.cs index 68f7072..f4797ad 100644 --- a/Client/Simitone/Simitone.Client/UI/Screens/TS1CASScreen.cs +++ b/Client/Simitone/Simitone.Client/UI/Screens/TS1CASScreen.cs @@ -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)); @@ -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(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(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