├── .gitattributes ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── App.xaml ├── App.xaml.cs ├── Assets ├── AppIcon16x16.ico ├── AppIcon32x32.ico ├── AppIcon44x44.ico ├── AppIcon512x512.ico ├── BadgeLogo.scale-100.png ├── BadgeLogo.scale-125.png ├── BadgeLogo.scale-150.png ├── BadgeLogo.scale-200.png ├── BadgeLogo.scale-400.png ├── LargeTile.scale-100.png ├── LargeTile.scale-125.png ├── LargeTile.scale-150.png ├── LargeTile.scale-200.png ├── LargeTile.scale-400.png ├── LockScreenLogo.scale-200.png ├── Other │ └── Github Banner.png ├── Screenshots │ ├── DarkThemeWithPieces.png │ ├── LightThemeWithPieces.png │ ├── ScreenshotDark.png │ └── ScreenshotLight.png ├── SmallTile.scale-100.png ├── SmallTile.scale-125.png ├── SmallTile.scale-150.png ├── SmallTile.scale-200.png ├── SmallTile.scale-400.png ├── SplashScreen.scale-100.png ├── SplashScreen.scale-125.png ├── SplashScreen.scale-150.png ├── SplashScreen.scale-200.png ├── SplashScreen.scale-400.png ├── Square150x150Logo.scale-100.png ├── Square150x150Logo.scale-125.png ├── Square150x150Logo.scale-150.png ├── Square150x150Logo.scale-200.png ├── Square150x150Logo.scale-400.png ├── Square44x44Logo.altform-lightunplated_targetsize-16.png ├── Square44x44Logo.altform-lightunplated_targetsize-24.png ├── Square44x44Logo.altform-lightunplated_targetsize-256.png ├── Square44x44Logo.altform-lightunplated_targetsize-32.png ├── Square44x44Logo.altform-lightunplated_targetsize-48.png ├── Square44x44Logo.altform-unplated_targetsize-16.png ├── Square44x44Logo.altform-unplated_targetsize-256.png ├── Square44x44Logo.altform-unplated_targetsize-32.png ├── Square44x44Logo.altform-unplated_targetsize-48.png ├── Square44x44Logo.scale-100.png ├── Square44x44Logo.scale-125.png ├── Square44x44Logo.scale-150.png ├── Square44x44Logo.scale-200.png ├── Square44x44Logo.scale-400.png ├── Square44x44Logo.targetsize-16.png ├── Square44x44Logo.targetsize-16_altform-lightunplated.png ├── Square44x44Logo.targetsize-16_altform-unplated.png ├── Square44x44Logo.targetsize-24.png ├── Square44x44Logo.targetsize-24_altform-lightunplated.png ├── Square44x44Logo.targetsize-24_altform-unplated.png ├── Square44x44Logo.targetsize-256.png ├── Square44x44Logo.targetsize-256_altform-lightunplated.png ├── Square44x44Logo.targetsize-256_altform-unplated.png ├── Square44x44Logo.targetsize-32.png ├── Square44x44Logo.targetsize-32_altform-lightunplated.png ├── Square44x44Logo.targetsize-32_altform-unplated.png ├── Square44x44Logo.targetsize-48.png ├── Square44x44Logo.targetsize-48_altform-lightunplated.png ├── Square44x44Logo.targetsize-48_altform-unplated.png ├── StoreLogo.scale-100.png ├── StoreLogo.scale-125.png ├── StoreLogo.scale-150.png ├── StoreLogo.scale-200.png ├── StoreLogo.scale-400.png ├── Wide310x150Logo.scale-100.png ├── Wide310x150Logo.scale-125.png ├── Wide310x150Logo.scale-150.png ├── Wide310x150Logo.scale-200.png └── Wide310x150Logo.scale-400.png ├── Fluent Tic-tac-toe.csproj ├── Fluent Tic-tac-toe.sln ├── Game.cs ├── LICENSE.md ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── PRIVACY.md ├── Package.appxmanifest ├── Pages ├── MainPage.xaml ├── MainPage.xaml.cs ├── PlayingPage.xaml ├── PlayingPage.xaml.cs ├── SettingsPage.xaml └── SettingsPage.xaml.cs ├── Properties └── launchSettings.json ├── README.md ├── Settings.cs ├── Usings.cs └── app.manifest /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | false 16 | 17 | 18 | true 19 | 20 | 21 | false 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices.WindowsRuntime; 7 | using Fluent_Tic_tac_toe.Pages; 8 | using Microsoft.UI; 9 | using Microsoft.UI.Xaml; 10 | using Microsoft.UI.Xaml.Controls; 11 | using Microsoft.UI.Xaml.Controls.Primitives; 12 | using Microsoft.UI.Xaml.Data; 13 | using Microsoft.UI.Xaml.Input; 14 | using Microsoft.UI.Xaml.Media; 15 | using Microsoft.UI.Xaml.Navigation; 16 | using Microsoft.UI.Xaml.Shapes; 17 | using Windows.ApplicationModel; 18 | using Windows.ApplicationModel.Activation; 19 | using Windows.ApplicationModel.Core; 20 | using Windows.Foundation; 21 | using Windows.Foundation.Collections; 22 | using Windows.UI.ViewManagement; 23 | 24 | // To learn more about WinUI, the WinUI project structure, 25 | // and more about our project templates, see: http://aka.ms/winui-project-info. 26 | 27 | namespace Fluent_Tic_tac_toe; 28 | /// 29 | /// Provides application-specific behavior to supplement the default Application class. 30 | /// 31 | public partial class App : Application 32 | { 33 | /// 34 | /// Initializes the singleton application object. This is the first line of authored code 35 | /// executed, and as such is the logical equivalent of main() or WinMain(). 36 | /// 37 | /// 38 | 39 | public App() 40 | { 41 | this.InitializeComponent(); 42 | } 43 | 44 | /// 45 | /// Invoked when the application is launched normally by the end user. Other entry points 46 | /// will be used such as when the application is launched to open a specific file. 47 | /// 48 | /// Details about the launch request and process. 49 | protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) 50 | { 51 | m_window = new MainWindow(); 52 | m_window.Activate(); 53 | m_window.CenterOnScreen(); 54 | } 55 | 56 | private Window m_window; 57 | } 58 | -------------------------------------------------------------------------------- /Assets/AppIcon16x16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/AppIcon16x16.ico -------------------------------------------------------------------------------- /Assets/AppIcon32x32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/AppIcon32x32.ico -------------------------------------------------------------------------------- /Assets/AppIcon44x44.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/AppIcon44x44.ico -------------------------------------------------------------------------------- /Assets/AppIcon512x512.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/AppIcon512x512.ico -------------------------------------------------------------------------------- /Assets/BadgeLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/BadgeLogo.scale-100.png -------------------------------------------------------------------------------- /Assets/BadgeLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/BadgeLogo.scale-125.png -------------------------------------------------------------------------------- /Assets/BadgeLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/BadgeLogo.scale-150.png -------------------------------------------------------------------------------- /Assets/BadgeLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/BadgeLogo.scale-200.png -------------------------------------------------------------------------------- /Assets/BadgeLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/BadgeLogo.scale-400.png -------------------------------------------------------------------------------- /Assets/LargeTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/LargeTile.scale-100.png -------------------------------------------------------------------------------- /Assets/LargeTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/LargeTile.scale-125.png -------------------------------------------------------------------------------- /Assets/LargeTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/LargeTile.scale-150.png -------------------------------------------------------------------------------- /Assets/LargeTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/LargeTile.scale-200.png -------------------------------------------------------------------------------- /Assets/LargeTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/LargeTile.scale-400.png -------------------------------------------------------------------------------- /Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /Assets/Other/Github Banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Other/Github Banner.png -------------------------------------------------------------------------------- /Assets/Screenshots/DarkThemeWithPieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Screenshots/DarkThemeWithPieces.png -------------------------------------------------------------------------------- /Assets/Screenshots/LightThemeWithPieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Screenshots/LightThemeWithPieces.png -------------------------------------------------------------------------------- /Assets/Screenshots/ScreenshotDark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Screenshots/ScreenshotDark.png -------------------------------------------------------------------------------- /Assets/Screenshots/ScreenshotLight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Screenshots/ScreenshotLight.png -------------------------------------------------------------------------------- /Assets/SmallTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SmallTile.scale-100.png -------------------------------------------------------------------------------- /Assets/SmallTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SmallTile.scale-125.png -------------------------------------------------------------------------------- /Assets/SmallTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SmallTile.scale-150.png -------------------------------------------------------------------------------- /Assets/SmallTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SmallTile.scale-200.png -------------------------------------------------------------------------------- /Assets/SmallTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SmallTile.scale-400.png -------------------------------------------------------------------------------- /Assets/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /Assets/SplashScreen.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SplashScreen.scale-125.png -------------------------------------------------------------------------------- /Assets/SplashScreen.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SplashScreen.scale-150.png -------------------------------------------------------------------------------- /Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /Assets/SplashScreen.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/SplashScreen.scale-400.png -------------------------------------------------------------------------------- /Assets/Square150x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square150x150Logo.scale-100.png -------------------------------------------------------------------------------- /Assets/Square150x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square150x150Logo.scale-125.png -------------------------------------------------------------------------------- /Assets/Square150x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square150x150Logo.scale-150.png -------------------------------------------------------------------------------- /Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /Assets/Square150x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square150x150Logo.scale-400.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.altform-unplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.altform-unplated_targetsize-16.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.altform-unplated_targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.altform-unplated_targetsize-256.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.altform-unplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.altform-unplated_targetsize-32.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.altform-unplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.altform-unplated_targetsize-48.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.scale-100.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.scale-125.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.scale-150.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.scale-400.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-16.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-16_altform-lightunplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-16_altform-lightunplated.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-16_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-16_altform-unplated.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-24.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-24_altform-lightunplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-24_altform-lightunplated.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-256.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-256_altform-lightunplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-256_altform-lightunplated.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-256_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-256_altform-unplated.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-32.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-32_altform-lightunplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-32_altform-lightunplated.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-32_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-32_altform-unplated.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-48.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-48_altform-lightunplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-48_altform-lightunplated.png -------------------------------------------------------------------------------- /Assets/Square44x44Logo.targetsize-48_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Square44x44Logo.targetsize-48_altform-unplated.png -------------------------------------------------------------------------------- /Assets/StoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/StoreLogo.scale-100.png -------------------------------------------------------------------------------- /Assets/StoreLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/StoreLogo.scale-125.png -------------------------------------------------------------------------------- /Assets/StoreLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/StoreLogo.scale-150.png -------------------------------------------------------------------------------- /Assets/StoreLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/StoreLogo.scale-200.png -------------------------------------------------------------------------------- /Assets/StoreLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/StoreLogo.scale-400.png -------------------------------------------------------------------------------- /Assets/Wide310x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Wide310x150Logo.scale-100.png -------------------------------------------------------------------------------- /Assets/Wide310x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Wide310x150Logo.scale-125.png -------------------------------------------------------------------------------- /Assets/Wide310x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Wide310x150Logo.scale-150.png -------------------------------------------------------------------------------- /Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /Assets/Wide310x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfchang149/Fluent-Tic-Tac-Toe/050eaab45c5a42bd6484b1dd496fc00f05a45842/Assets/Wide310x150Logo.scale-400.png -------------------------------------------------------------------------------- /Fluent Tic-tac-toe.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net6.0-windows10.0.20348.0 5 | 10.0.17763.0 6 | Fluent_Tic_tac_toe 7 | app.manifest 8 | x86;x64;arm64 9 | win10-x86;win10-x64;win10-arm64 10 | win10-$(Platform).pubxml 11 | true 12 | true 13 | 14 | Assets\AppIcon512x512.ico 15 | Square150x150Logo.scale-100.png 16 | False 17 | False 18 | False 19 | True 20 | Always 21 | True 22 | 0 23 | README.md 24 | 10.0.17763.0 25 | x86|x64|arm64 26 | AnyCPU 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 130 | 131 | 132 | 133 | 134 | 135 | MSBuild:Compile 136 | 137 | 138 | 139 | 140 | MSBuild:Compile 141 | 142 | 143 | 144 | 145 | MSBuild:Compile 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | ResXFileCodeGenerator 154 | Resources.Designer.cs 155 | 156 | 157 | 158 | 159 | True 160 | \ 161 | 162 | 163 | True 164 | \ 165 | 166 | 167 | 168 | 173 | 174 | true 175 | 176 | 177 | True 178 | 179 | 180 | True 181 | 182 | 183 | True 184 | 185 | 186 | True 187 | 188 | 189 | True 190 | 191 | 192 | True 193 | 194 | 195 | -------------------------------------------------------------------------------- /Fluent Tic-tac-toe.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32825.248 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fluent Tic-tac-toe", "Fluent Tic-tac-toe.csproj", "{847F51DA-8568-4136-9919-3335903149CA}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|arm64 = Debug|arm64 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|arm64 = Release|arm64 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {847F51DA-8568-4136-9919-3335903149CA}.Debug|arm64.ActiveCfg = Debug|arm64 19 | {847F51DA-8568-4136-9919-3335903149CA}.Debug|arm64.Build.0 = Debug|arm64 20 | {847F51DA-8568-4136-9919-3335903149CA}.Debug|arm64.Deploy.0 = Debug|arm64 21 | {847F51DA-8568-4136-9919-3335903149CA}.Debug|x64.ActiveCfg = Debug|x64 22 | {847F51DA-8568-4136-9919-3335903149CA}.Debug|x64.Build.0 = Debug|x64 23 | {847F51DA-8568-4136-9919-3335903149CA}.Debug|x64.Deploy.0 = Debug|x64 24 | {847F51DA-8568-4136-9919-3335903149CA}.Debug|x86.ActiveCfg = Debug|x86 25 | {847F51DA-8568-4136-9919-3335903149CA}.Debug|x86.Build.0 = Debug|x86 26 | {847F51DA-8568-4136-9919-3335903149CA}.Debug|x86.Deploy.0 = Debug|x86 27 | {847F51DA-8568-4136-9919-3335903149CA}.Release|arm64.ActiveCfg = Release|arm64 28 | {847F51DA-8568-4136-9919-3335903149CA}.Release|arm64.Build.0 = Release|arm64 29 | {847F51DA-8568-4136-9919-3335903149CA}.Release|arm64.Deploy.0 = Release|arm64 30 | {847F51DA-8568-4136-9919-3335903149CA}.Release|x64.ActiveCfg = Release|x64 31 | {847F51DA-8568-4136-9919-3335903149CA}.Release|x64.Build.0 = Release|x64 32 | {847F51DA-8568-4136-9919-3335903149CA}.Release|x64.Deploy.0 = Release|x64 33 | {847F51DA-8568-4136-9919-3335903149CA}.Release|x86.ActiveCfg = Release|x86 34 | {847F51DA-8568-4136-9919-3335903149CA}.Release|x86.Build.0 = Release|x86 35 | {847F51DA-8568-4136-9919-3335903149CA}.Release|x86.Deploy.0 = Release|x86 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {FF160516-4CD6-410B-999D-9B86A3FEEA1E} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /Game.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Numerics; 6 | 7 | namespace Fluent_Tic_tac_toe; 8 | internal class Game 9 | { 10 | public int gamemode; 11 | public List players 12 | { 13 | get; 14 | } 15 | public List pieces 16 | { 17 | get; set; 18 | } 19 | public List winningPieces 20 | { 21 | get; set; 22 | } 23 | public Piece[,] board 24 | { 25 | get; set; 26 | } 27 | public Player winner 28 | { 29 | get; set; 30 | } 31 | public int turns 32 | { 33 | get; set; 34 | } 35 | public int time 36 | { 37 | get; set; 38 | } 39 | public bool started 40 | { 41 | get; set; 42 | } 43 | private bool timed 44 | { 45 | get; set; 46 | } 47 | 48 | public Game() 49 | { 50 | this.gamemode = Settings.gamemode; 51 | this.players = new List(); 52 | 53 | // add in players 54 | var numPlayers = 1; 55 | var numBots = 1; 56 | 57 | if (gamemode == 1) 58 | { 59 | numPlayers = Settings.numPlayers; 60 | Debug.WriteLine(numPlayers); 61 | numBots = Settings.numMultiplayerBots; 62 | } 63 | else if (gamemode == 2) 64 | { 65 | numBots = Settings.numSpectatorBots; 66 | numPlayers = 0; 67 | } 68 | 69 | for (var i = 0; i < numPlayers; i++) 70 | { 71 | Player player = new Player(false); 72 | player.SetSymbol(i); 73 | this.players.Add(player); 74 | } 75 | 76 | // add in bots 77 | 78 | for (var i = 0; i < numBots; i++) 79 | { 80 | Player bot = new Player(true); 81 | bot.SetSymbol(i + numPlayers); 82 | this.players.Add(bot); 83 | } 84 | 85 | // initialize other vars 86 | this.board = new Piece[(int)Settings.boardSize.Y, (int)Settings.boardSize.X]; 87 | this.winningPieces = new List(); 88 | this.pieces = new List(); 89 | this.winner = null; 90 | this.time = 0; 91 | this.started = false; 92 | } 93 | 94 | public void Start() 95 | { 96 | this.turns = 0; 97 | this.winner = null; 98 | this.time = 0; 99 | this.started = true; 100 | } 101 | 102 | public void Restart() 103 | { 104 | this.winner = null; 105 | this.winningPieces.Clear(); 106 | this.pieces.Clear(); 107 | this.turns = 0; 108 | this.board = new Piece[(int)Settings.boardSize.Y, (int)Settings.boardSize.X]; 109 | this.time = 0; 110 | this.started = false; 111 | AlternatePlayers(); 112 | } 113 | 114 | public void AlternatePlayers() // so the first player doesn't keep going first 115 | { 116 | Player FirstPlayer = this.players.First(); 117 | this.players.Remove(FirstPlayer); 118 | this.players.Add(FirstPlayer); 119 | 120 | /* Decided not to use this because it would confuse players and their symbols 121 | for (var i = 0; i < this.players.Count(); i++) 122 | { 123 | this.players[i].SetSymbol(i); 124 | } 125 | */ 126 | } 127 | 128 | public bool Won() 129 | { 130 | List selectedPieces = new(); 131 | bool won = false; 132 | int maxDiagonalPieces = (int)Math.Min(Settings.boardSize.X, Settings.boardSize.Y); 133 | 134 | void CheckSelectedPieces() 135 | { 136 | if (!won && selectedPieces.Count > 2) 137 | { 138 | if (Settings.winPattern == 0)// check for 3 in a row 139 | { 140 | won = selectedPieces.Count >= 3; 141 | } 142 | else // check for full row wins 143 | { 144 | if (selectedPieces[0].row.Equals(selectedPieces[1].row)) // check for horizontal win 145 | { 146 | won = selectedPieces.Count >= Settings.boardSize.X; 147 | } 148 | else if (selectedPieces[0].col.Equals(selectedPieces[1].col)) // check for vertical win 149 | { 150 | won = selectedPieces.Count >= Settings.boardSize.Y; 151 | } 152 | else // check diagonal wins 153 | { 154 | won = selectedPieces.Count >= maxDiagonalPieces; 155 | } 156 | } 157 | if (won) 158 | { 159 | this.winner = selectedPieces.First().player; 160 | this.winningPieces.Clear(); 161 | this.winningPieces.AddRange(selectedPieces); 162 | } 163 | } 164 | } 165 | void TryAddingSelectedPiece(Piece piece) 166 | { 167 | if (piece != null) 168 | { 169 | if (selectedPieces.Count > 0 && !selectedPieces.First().Matches(piece)) 170 | { 171 | CheckSelectedPieces(); 172 | selectedPieces.Clear(); 173 | } 174 | selectedPieces.Add(piece); 175 | } 176 | else 177 | { 178 | CheckSelectedPieces(); 179 | selectedPieces.Clear(); 180 | } 181 | } 182 | 183 | // Gather selected pieces 184 | for (var r = 0; r < Settings.boardSize.Y; r++) // Finds horizontal pieces 185 | { 186 | selectedPieces.Clear(); 187 | for (var c = 0; c < Settings.boardSize.X; c++) 188 | { 189 | TryAddingSelectedPiece(board[r, c]); 190 | } 191 | CheckSelectedPieces(); 192 | if (won) 193 | { 194 | return true; 195 | } 196 | } 197 | 198 | for (var c = 0; c < Settings.boardSize.X; c++) // Finds vertical pieces 199 | { 200 | selectedPieces.Clear(); 201 | for (var r = 0; r < Settings.boardSize.Y; r++) 202 | { 203 | TryAddingSelectedPiece(board[r, c]); 204 | } 205 | CheckSelectedPieces(); 206 | if (won) 207 | { 208 | return true; 209 | } 210 | } 211 | 212 | for (var r = 0; r < Settings.boardSize.Y - 2; r++) // Finds down-right diagonal pieces 213 | { 214 | for (var c = 0; c < Settings.boardSize.X - 2; c++) 215 | { 216 | selectedPieces.Clear(); 217 | for (var i = 0; i < Math.Min(Settings.boardSize.Y - r, Settings.boardSize.X - c); i++) 218 | { 219 | TryAddingSelectedPiece(board[r + i, c + i]); 220 | } 221 | CheckSelectedPieces(); 222 | if (won) 223 | { 224 | return true; 225 | } 226 | } 227 | } 228 | 229 | for (var r = 0; r < Settings.boardSize.Y - 2; r++) // Finds down-left diagonal pieces 230 | { 231 | for (var c = 2; c < Settings.boardSize.X; c++) 232 | { 233 | selectedPieces.Clear(); 234 | for (var i = 0; i < Math.Min(Settings.boardSize.Y - r, c + 1); i++) 235 | { 236 | TryAddingSelectedPiece(board[r + i, c - i]); 237 | } 238 | CheckSelectedPieces(); 239 | if (won) 240 | { 241 | return true; 242 | } 243 | } 244 | } 245 | 246 | return false; 247 | } 248 | 249 | private bool PlacePiece(Player player, int row, int col) 250 | { 251 | if (board[row, col] == null) 252 | { 253 | Piece piece = new Piece(player, row, col); 254 | board[row, col] = piece; 255 | this.pieces.Add(piece); 256 | this.turns++; 257 | return true; 258 | } 259 | return false; 260 | } 261 | 262 | public bool PlacePiece(int row, int col) 263 | { 264 | if (board[row, col] == null) 265 | { 266 | Piece piece = new Piece(GetCurrentPlayerTurn(), row, col); 267 | board[row, col] = piece; 268 | this.pieces.Add(piece); 269 | this.turns++; 270 | return true; 271 | } 272 | return false; 273 | } 274 | 275 | public bool ComputerTurn() 276 | { 277 | List spaces = GetEmptySpaces(); 278 | if (spaces.Count > 0) 279 | { 280 | bool isWithinBoard(Vector2 location) 281 | { 282 | int clampedX = (int)Math.Clamp(location.X, 0, Settings.boardSize.X - 1); 283 | int clampedY = (int)Math.Clamp(location.Y, 0, Settings.boardSize.Y - 1); 284 | 285 | return (clampedX == location.X && clampedY == location.Y); 286 | } 287 | 288 | List directions = new(){ 289 | new Vector2() {X=-1,Y=0}, 290 | new Vector2() {X=-1,Y=-1}, 291 | new Vector2() {X=0,Y=-1}, 292 | new Vector2() {X=1,Y=-1}, 293 | }; 294 | 295 | if (Settings.difficulty == 0) // easy 296 | { 297 | Vector2 selectedSpace = spaces[new Random().Next(spaces.Count)]; // pick random spot 298 | return PlacePiece((int)selectedSpace.Y, (int)selectedSpace.X); 299 | } 300 | else if (Settings.difficulty == 1) // medium 301 | { 302 | Vector2 selectedSpace = spaces.First(); 303 | int selectedSpotPriority = 0; 304 | int enemyPriority = 4; 305 | int allyPriority = 2; 306 | 307 | int evaluatePriority(Vector2 location) 308 | { 309 | if (isWithinBoard(location)) 310 | { 311 | Piece piece = board[(int)location.Y, (int)location.X]; 312 | if (piece != null) 313 | { 314 | if (piece.player == GetCurrentPlayerTurn()) 315 | { 316 | return allyPriority; 317 | } 318 | else 319 | { 320 | return enemyPriority; 321 | } 322 | } 323 | } 324 | return 0; 325 | } 326 | 327 | foreach (Vector2 space in spaces) 328 | { 329 | int priority = new Random().Next((int)(spaces.Count + Settings.boardSize.X + Settings.boardSize.Y)); 330 | foreach (Vector2 dir in directions) 331 | { 332 | Vector2 spot = space + dir; 333 | Vector2 oppositeSpot = space - dir; 334 | priority += evaluatePriority(spot) + evaluatePriority(oppositeSpot); 335 | } 336 | if (priority > selectedSpotPriority) 337 | { 338 | selectedSpace = space; 339 | selectedSpotPriority = priority; 340 | } 341 | } 342 | 343 | return PlacePiece((int)selectedSpace.Y, (int)selectedSpace.X); 344 | } 345 | else 346 | { // hard 347 | if(this.pieces.Count == 0) 348 | { 349 | if (new Random().Next(10) < 5){ 350 | double randomOffset = (new Random().NextDouble()-0.5)*2; 351 | int row = (int)((Settings.boardSize.Y - 1) / (2 + randomOffset)); 352 | int col = (int)((Settings.boardSize.X - 1) / (2 + randomOffset)); 353 | return PlacePiece(row,col); 354 | } 355 | } 356 | 357 | Vector2 selectedSpace = spaces[new Random().Next((int)spaces.Count)]; 358 | int selectedSpotPriority = 0; 359 | int enemyPriority = 2; 360 | int allyPriority = 3; 361 | 362 | int evaluatePriority(Vector2 location) 363 | { 364 | if (isWithinBoard(location)) 365 | { 366 | Piece piece = board[(int)location.Y, (int)location.X]; 367 | if (piece != null) 368 | { 369 | if (piece.player == GetCurrentPlayerTurn()) 370 | { 371 | return allyPriority; 372 | } 373 | else 374 | { 375 | return enemyPriority; 376 | } 377 | } 378 | } 379 | return 0; 380 | } 381 | 382 | foreach (Vector2 space in spaces) 383 | { 384 | foreach (Vector2 dir in directions) 385 | { 386 | Vector2 spot = space + dir; 387 | Vector2 oppositeSpot = space - dir; 388 | int priority = 0; 389 | 390 | void evaluateInDirection(Piece pieceToMatch) 391 | { 392 | int matches = 0; 393 | int addedPriority = 0; 394 | while (evaluatePriority(spot) > 0 && board[(int)spot.Y, (int)spot.X] != null && board[(int)spot.Y, (int)spot.X].Matches(pieceToMatch)) 395 | { 396 | matches++; 397 | addedPriority += evaluatePriority(spot); 398 | spot += dir; 399 | } 400 | if(matches < 2 && addedPriority < allyPriority*matches && new Random().Next(9) == 1) 401 | { 402 | addedPriority = 0; 403 | } 404 | priority += addedPriority; 405 | } 406 | 407 | void evaluateInOppositeDirection(Piece pieceToMatch) 408 | { 409 | int matches = 0; 410 | int addedPriority = 0; 411 | while (evaluatePriority(oppositeSpot) > 0 && board[(int)oppositeSpot.Y, (int)oppositeSpot.X] != null && board[(int)oppositeSpot.Y, (int)oppositeSpot.X].Matches(pieceToMatch)) 412 | { 413 | matches++; 414 | addedPriority += evaluatePriority(oppositeSpot); 415 | oppositeSpot -= dir; 416 | } 417 | if (matches < 2 && addedPriority < allyPriority * matches && new Random().Next(9) == 1) 418 | { 419 | addedPriority = 0; 420 | } 421 | priority += addedPriority; 422 | } 423 | 424 | if (isWithinBoard(spot) && isWithinBoard(oppositeSpot)) 425 | { 426 | Piece spotPiece = board[(int)spot.Y, (int)spot.X]; 427 | Piece oppositeSpotPiece = board[(int)oppositeSpot.Y, (int)oppositeSpot.X]; 428 | 429 | if (spotPiece != null && oppositeSpotPiece != null && !spotPiece.Matches(oppositeSpotPiece)) 430 | { 431 | continue; 432 | } 433 | else if (spotPiece == null && oppositeSpotPiece == null) 434 | { 435 | continue; 436 | } 437 | 438 | Piece mainPiece = spotPiece != null ? spotPiece : oppositeSpotPiece; 439 | 440 | evaluateInDirection(mainPiece); 441 | evaluateInOppositeDirection(mainPiece); 442 | } 443 | else if (isWithinBoard(spot)) 444 | { 445 | Piece spotPiece = board[(int)spot.Y, (int)spot.X]; 446 | if (spotPiece != null) 447 | { 448 | evaluateInDirection(spotPiece); 449 | } 450 | 451 | } 452 | else if (isWithinBoard(oppositeSpot)) 453 | { 454 | Piece oppositeSpotPiece = board[(int)oppositeSpot.Y, (int)oppositeSpot.X]; 455 | if (oppositeSpotPiece != null) 456 | { 457 | evaluateInOppositeDirection(oppositeSpotPiece); 458 | } 459 | } 460 | 461 | if (priority > selectedSpotPriority) 462 | { 463 | selectedSpace = space; 464 | selectedSpotPriority = priority; 465 | } 466 | } 467 | } 468 | 469 | return PlacePiece((int)selectedSpace.Y, (int)selectedSpace.X); 470 | } 471 | } 472 | 473 | return false; 474 | } 475 | 476 | public bool IsDraw() 477 | { 478 | return this.winner == null && this.board.Length == this.turns; 479 | } 480 | 481 | public List GetEmptySpaces() 482 | { 483 | List spaces = new List(); 484 | for (int r = 0; r < Settings.boardSize.Y; r++) 485 | { 486 | for (int c = 0; c < Settings.boardSize.X; c++) 487 | { 488 | if (board[r, c] == null) 489 | { 490 | spaces.Add(new Vector2(c, r)); 491 | } 492 | } 493 | } 494 | return spaces; 495 | } 496 | 497 | public Player GetCurrentPlayerTurn() 498 | { 499 | return players[turns % players.Count]; 500 | } 501 | 502 | public Player GetFirstRealPlayer() 503 | { 504 | foreach (Player player in players) 505 | { 506 | if (!player.isComputer) 507 | { 508 | return player; 509 | } 510 | } 511 | return null; 512 | } 513 | 514 | public string GetGridName(int row, int col) 515 | { 516 | return "square" + ((row * 3) + col); 517 | } 518 | 519 | public int GetNumberOfRealPlayers() // amount of players that aren't a computer 520 | { 521 | var result = 0; 522 | foreach (Player player in this.players) 523 | { 524 | if (player.isComputer == false) 525 | { 526 | result++; 527 | } 528 | } 529 | return result; 530 | } 531 | } 532 | 533 | public class Player 534 | { 535 | public static string[] symbols = { "x", "o" }; 536 | 537 | public string name 538 | { 539 | get; set; 540 | } 541 | public int number 542 | { 543 | get; 544 | } 545 | public bool isComputer 546 | { 547 | get; 548 | } 549 | public string symbol 550 | { 551 | get; set; 552 | } 553 | public int wins; 554 | 555 | public static int playerNumber = 1; 556 | public static int botNum = 1; 557 | 558 | public Player(string name, bool isComputer = false) 559 | { 560 | new Player(isComputer); 561 | this.name = name; 562 | } 563 | 564 | public Player(bool isComputer) 565 | { 566 | if (isComputer) 567 | { 568 | this.name = "Bot " + botNum; 569 | this.number = botNum; 570 | botNum++; 571 | } 572 | else 573 | { 574 | this.name = "Player " + playerNumber; 575 | this.number = playerNumber; 576 | playerNumber++; 577 | } 578 | this.isComputer = isComputer; 579 | this.wins = 0; 580 | } 581 | 582 | public void SetSymbol(int num) 583 | { 584 | this.symbol = num < symbols.Length ? symbols[num] : Convert.ToChar(63 + num).ToString(); 585 | } 586 | } 587 | 588 | public class Piece 589 | { 590 | public Player player 591 | { 592 | get; 593 | } 594 | public int row 595 | { 596 | get; 597 | } 598 | public int col 599 | { 600 | get; 601 | } 602 | 603 | public Piece(Player player, int row, int col) 604 | { 605 | this.player = player; 606 | this.row = row; 607 | this.col = col; 608 | } 609 | 610 | public bool Matches(Piece otherPiece) 611 | { 612 | return this.player.Equals(otherPiece.player); 613 | } 614 | 615 | public int GetIndex() 616 | { 617 | return (int)((this.row * Settings.boardSize.X) + this.col); 618 | } 619 | } 620 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Dustin Fu Chang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.UI.Xaml; 3 | using Microsoft.UI.Xaml.Media.Animation; 4 | using Microsoft.UI.Xaml.Navigation; 5 | using WinRT; 6 | 7 | // To learn more about WinUI, the WinUI project structure, 8 | // and more about our project templates, see: http://aka.ms/winui-project-info. 9 | 10 | namespace Fluent_Tic_tac_toe; 11 | /// 12 | /// An empty window that can be used on its own or navigated to within a Frame. 13 | /// 14 | public sealed partial class MainWindow : WinUIEx.WindowEx 15 | { 16 | public MainWindow() 17 | { 18 | this.InitializeComponent(); 19 | ExtendsContentIntoTitleBar = true; 20 | SetTitleBar(AppTitleBar); 21 | Navigate(); 22 | MainGrid.Children.Remove(BackButton); 23 | Settings.window = this; 24 | Settings.Load(); 25 | } 26 | 27 | private void BackButtonClick(object sender, RoutedEventArgs e) 28 | { 29 | if (ContentFrame.CanGoBack) 30 | { 31 | ContentFrame.GoBack(); 32 | } 33 | } 34 | 35 | private void OnNavigated(object sender, NavigationEventArgs e) 36 | { 37 | if (ContentFrame.CanGoBack) 38 | { 39 | MainGrid.Children.Add(BackButton); 40 | } 41 | else 42 | { 43 | MainGrid.Children.Remove(BackButton); 44 | } 45 | } 46 | 47 | private void WindowActivated(object sender, WindowActivatedEventArgs e) 48 | { 49 | if (e.WindowActivationState == WindowActivationState.Deactivated) 50 | { 51 | TitleBarFill.Visibility = Visibility.Collapsed; 52 | } 53 | else 54 | { 55 | TitleBarFill.Visibility = Visibility.Visible; 56 | } 57 | } 58 | 59 | public void Navigate() 60 | { 61 | ContentFrame.Navigate(typeof(Pages.MainPage), null, new SuppressNavigationTransitionInfo()); 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /PRIVACY.md: -------------------------------------------------------------------------------- 1 | # Privacy Policy 2 | 3 | No information on the user is tracked. The only data used is app data, which is used to save the current app settings. -------------------------------------------------------------------------------- /Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 15 | 16 | 17 | Fluent Tic-Tac-Toe 18 | Dustin Chang 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Pages/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Pages/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | using Microsoft.UI.Xaml.Controls; 3 | using Microsoft.UI.Xaml.Media.Animation; 4 | 5 | // To learn more about WinUI, the WinUI project structure, 6 | // and more about our project templates, see: http://aka.ms/winui-project-info. 7 | 8 | namespace Fluent_Tic_tac_toe.Pages; 9 | /// 10 | /// An empty page that can be used on its own or navigated to within a Frame. 11 | /// 12 | public sealed partial class MainPage : Page 13 | { 14 | public MainPage() 15 | { 16 | this.InitializeComponent(); 17 | } 18 | 19 | bool buttonsEnabled = true; 20 | 21 | public void PlayButtonClick(object sender, RoutedEventArgs e) 22 | { 23 | if (buttonsEnabled) 24 | { 25 | buttonsEnabled = false; 26 | Player.playerNumber = 1; 27 | Player.botNum = 1; 28 | this.Frame.Navigate(typeof(Pages.PlayingPage), null, new DrillInNavigationTransitionInfo()); 29 | } 30 | } 31 | 32 | private void SettingsButtonClick(object sender, RoutedEventArgs e) 33 | { 34 | if (buttonsEnabled) 35 | { 36 | buttonsEnabled = false; 37 | this.Frame.Navigate(typeof(Pages.SettingsPage), null, new DrillInNavigationTransitionInfo()); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Pages/PlayingPage.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 59 | 60 | 61 | 62 | 63 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Pages/PlayingPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Numerics; 6 | using ABI.Windows.UI; 7 | using Microsoft.UI.Xaml; 8 | using Microsoft.UI.Xaml.Controls; 9 | using Microsoft.UI.Xaml.Documents; 10 | using Microsoft.UI.Xaml.Media; 11 | using Microsoft.UI.Xaml.Media.Animation; 12 | using Windows.UI.ViewManagement; 13 | using WinRT; 14 | 15 | // To learn more about WinUI, the WinUI project structure, 16 | // and more about our project templates, see: http://aka.ms/winui-project-info. 17 | 18 | namespace Fluent_Tic_tac_toe.Pages; 19 | /// 20 | /// An empty page that can be used on its own or navigated to within a Frame. 21 | /// 22 | public sealed partial class PlayingPage : Page 23 | { 24 | Game game; 25 | DispatcherTimer matchTimer; 26 | bool canPress = true; 27 | 28 | public PlayingPage() 29 | { 30 | this.InitializeComponent(); 31 | this.SetUpGame(); 32 | this.InitializeTimer(); 33 | PageGrid.Children.Remove(AgainButton); 34 | } 35 | 36 | private void BoardGridSizeChanged(object sender, RoutedEventArgs e) 37 | { 38 | TurnTextBlock.FontSize = Math.Max(PageGrid.ActualHeight / 25,24); 39 | var aspectRatio = Settings.boardSize.X / Settings.boardSize.Y; 40 | 41 | if (aspectRatio > 1) 42 | { 43 | var minLength = Math.Min(BoardGrid.ActualHeight * aspectRatio, BoardGrid.ActualWidth); 44 | Board.Height = minLength / aspectRatio; 45 | Board.Width = minLength; 46 | } else if (aspectRatio < 1) 47 | { 48 | var minLength = Math.Min(BoardGrid.ActualHeight, BoardGrid.ActualWidth); 49 | Board.Height = minLength; 50 | Board.Width = minLength * aspectRatio; 51 | } else 52 | { 53 | var minLength = Math.Min(BoardGrid.ActualHeight, BoardGrid.ActualWidth); 54 | Board.Height = minLength; 55 | Board.Width = minLength; 56 | } 57 | if (game != null) 58 | { 59 | var spacing = 8 - (Math.Max(Settings.boardSize.X, Settings.boardSize.Y) / 2); 60 | int buttonLength = (int)((Board.Height / Settings.boardSize.Y) - (spacing)); 61 | for (var r = 0; r < Settings.boardSize.Y; r++) 62 | { 63 | for (var c = 0; c < Settings.boardSize.X; c++) 64 | { 65 | var index = (r * Settings.boardSize.X) + c; 66 | Button square = (Button)Board.FindName("square" + index); 67 | 68 | if (square != null) 69 | { 70 | square.Height = buttonLength; 71 | square.Width = buttonLength; 72 | square.CenterPoint = new Vector3((float)(buttonLength / 2)); 73 | square.CornerRadius = new CornerRadius(buttonLength / 16); 74 | 75 | Piece piece = game.board[r, c]; 76 | 77 | if (piece != null) 78 | { 79 | SetSquareText(square,piece.player.symbol); 80 | } 81 | } 82 | } 83 | } 84 | } 85 | } 86 | 87 | private void BoardLoaded(object sender, RoutedEventArgs e) 88 | { 89 | if (Settings.limitBoardSize) 90 | { 91 | BoardGrid.MaxHeight = 96 * Settings.boardSize.Y; 92 | } 93 | BoardGridSizeChanged(null,null); 94 | 95 | // Update Board 96 | var spacing = 8 - (Math.Max(Settings.boardSize.X, Settings.boardSize.Y) / 2); 97 | Board.RowSpacing = spacing; 98 | Board.ColumnSpacing = spacing; 99 | 100 | for (var r = 0; r < Settings.boardSize.Y; r++) 101 | { 102 | RowDefinition rowDef = new RowDefinition(); 103 | rowDef.Height = new GridLength(1, GridUnitType.Star); 104 | Board.RowDefinitions.Add(rowDef); 105 | } 106 | 107 | for (var c = 0; c < Settings.boardSize.X; c++) 108 | { 109 | ColumnDefinition columnDef = new ColumnDefinition(); 110 | columnDef.Width = new GridLength(1, GridUnitType.Star); 111 | Board.ColumnDefinitions.Add(columnDef); 112 | } 113 | 114 | // Add buttons 115 | for (var r = 0; r < Settings.boardSize.Y; r++) 116 | { 117 | for (var c = 0; c < Settings.boardSize.X; c++) 118 | { 119 | var index = (r * Settings.boardSize.X) + c; 120 | int buttonLength = (int)((Board.ActualHeight / Settings.boardSize.Y) - (spacing)); 121 | 122 | Vector3Transition vector3Transition = new Vector3Transition(); 123 | vector3Transition.Duration = System.TimeSpan.FromMilliseconds(100); 124 | 125 | var square = new Button() 126 | { 127 | Height = buttonLength, 128 | Width = buttonLength, 129 | Content = new TextBlock().Text = "", 130 | Name = "square" + index, 131 | FontSize = 24, 132 | VerticalAlignment = VerticalAlignment.Center, 133 | HorizontalAlignment = HorizontalAlignment.Center, 134 | VerticalContentAlignment = VerticalAlignment.Center, 135 | HorizontalContentAlignment = HorizontalAlignment.Center, 136 | CenterPoint = new Vector3((float)(buttonLength / 2)), 137 | Padding = new Thickness(0), 138 | CornerRadius = new CornerRadius(buttonLength / 16), 139 | 140 | // Add transitions 141 | ScaleTransition = vector3Transition, 142 | TranslationTransition = vector3Transition 143 | }; 144 | 145 | // Handle Events 146 | square.Click += OnSquarePressed; 147 | square.PointerEntered += OnSquareEntered; 148 | square.PointerExited += OnSquareLeft; 149 | square.PointerCanceled += OnSquareLeft; 150 | 151 | Grid.SetRow(square, r); 152 | Grid.SetColumn(square, c); 153 | Board.Children.Add(square); 154 | } 155 | } 156 | } 157 | 158 | private void SetUpGame() 159 | { 160 | game = new Game(); 161 | 162 | if (game.gamemode == 0) // singleplayer 163 | { 164 | PlayersIcon.Symbol = Symbol.Contact; 165 | } 166 | else if (game.gamemode == 1) // multiplayer 167 | { 168 | PlayersIcon.Symbol = Symbol.People; 169 | } 170 | else // spectator 171 | { 172 | InfosPanel.Children.Remove(PlayersInfo); 173 | PlayersIcon.Symbol = Symbol.People; 174 | } 175 | 176 | // Update Textblocks 177 | UpdateTurnText(); 178 | 179 | PlayersTextBlock.Text = game.GetNumberOfRealPlayers().ToString(); 180 | TimeTextBlock.Text = game.time.ToString(); 181 | TurnsTextBlock.Text = game.time.ToString(); 182 | 183 | var botPlayers = (game.players.Count - game.GetNumberOfRealPlayers()); 184 | 185 | if (botPlayers > 0) 186 | { 187 | BotsTextBlock.Text = botPlayers.ToString(); 188 | } 189 | else 190 | { 191 | InfosPanel.Children.Remove(BotsInfo); 192 | } 193 | 194 | 195 | if (!Settings.matchTimerEnabled && !Settings.boardInfoEnabled && !Settings.playerCounterEnabled) 196 | { 197 | InfosPanel.Visibility = Visibility.Collapsed; 198 | } 199 | else 200 | { 201 | if (!Settings.matchTimerEnabled) 202 | { 203 | InfosPanel.Children.Remove(TimerInfo); 204 | } 205 | 206 | if (!Settings.boardInfoEnabled) 207 | { 208 | InfosPanel.Children.Remove(BoardsInfo); 209 | } 210 | 211 | if (!Settings.playerCounterEnabled) 212 | { 213 | InfosPanel.Children.Remove(PlayersInfo); 214 | InfosPanel.Children.Remove(BotsInfo); 215 | } 216 | } 217 | } 218 | 219 | private void InitializeTimer() 220 | { 221 | if (Settings.matchTimerEnabled) 222 | { 223 | matchTimer = new DispatcherTimer(); 224 | matchTimer.Interval = TimeSpan.FromSeconds(1); 225 | EventHandler handler = new EventHandler((s, e) => 226 | { 227 | if (game.winner == null) 228 | { 229 | game.time++; 230 | TimeTextBlock.Text = game.time.ToString(); 231 | } 232 | else 233 | { 234 | matchTimer.Stop(); 235 | } 236 | }); 237 | matchTimer.Tick += handler; 238 | } 239 | } 240 | 241 | private void SetMatchTimerActive(bool value) 242 | { 243 | if(matchTimer != null) 244 | { 245 | if (value) 246 | { 247 | matchTimer.Start(); 248 | } 249 | else 250 | { 251 | matchTimer.Stop(); 252 | } 253 | } 254 | } 255 | 256 | private void UpdateTurnText() 257 | { 258 | if (game.GetCurrentPlayerTurn().isComputer && !game.started) 259 | { 260 | TurnTextBlock.Text = "Click a square to start the game."; 261 | } 262 | else if (game.gamemode == 0 && !game.GetCurrentPlayerTurn().isComputer) 263 | { 264 | TurnTextBlock.Text = "Your Turn"; 265 | } 266 | else 267 | { 268 | TurnTextBlock.Text = game.GetCurrentPlayerTurn().name + "'s Turn"; 269 | } 270 | } 271 | 272 | private void OnSquareEntered(object sender, RoutedEventArgs e) 273 | { 274 | if (game.winner == null && !game.GetCurrentPlayerTurn().isComputer) 275 | { 276 | ShrinkSquare(sender as Button); 277 | } 278 | } 279 | 280 | private void ShrinkSquare(Button square) 281 | { 282 | if (square.IsEnabled) 283 | { 284 | square.Scale = new Vector3(0.9f); 285 | } 286 | } 287 | 288 | private void OnSquareLeft(object sender, RoutedEventArgs e) 289 | { 290 | if (game.winner == null) 291 | { 292 | ResizeSquare(sender as Button); 293 | } 294 | } 295 | 296 | private void ResizeSquare(Button square) 297 | { 298 | square.Scale = new Vector3(1); 299 | } 300 | 301 | private void OnSquarePressed(object sender, RoutedEventArgs e) 302 | { 303 | if (!canPress) 304 | { 305 | return; 306 | } 307 | 308 | if (!game.started) 309 | { 310 | game.Start(); 311 | SetMatchTimerActive(true); 312 | if (game.GetCurrentPlayerTurn().isComputer) // if it's a computer's turn 313 | { 314 | OnBoardUpdated(); 315 | return; 316 | } 317 | } 318 | 319 | if (game.winner == null) 320 | { 321 | if (game.GetCurrentPlayerTurn().isComputer) // if it's a computer's turn 322 | { 323 | return; 324 | } 325 | 326 | Button square = sender as Button; 327 | // Add piece to board 328 | var name = square.Name.ToString().ToLower(); 329 | name = name.Substring("square".Length); 330 | var number = Int32.Parse(name); 331 | var row = number / Settings.boardSize.X; 332 | var col = number % Settings.boardSize.X; 333 | 334 | var wasPlaced = game.PlacePiece((int)row, (int)col); 335 | 336 | if (wasPlaced) 337 | { 338 | OnBoardUpdated(); 339 | } 340 | else 341 | { 342 | square.Opacity = 1; 343 | square.IsEnabled = true; 344 | } 345 | } 346 | //TimeTextBlock.Text = "Row: " + row + ", Col: " + col; 347 | } 348 | 349 | private void OnBoardUpdated() 350 | { 351 | if (game.pieces.Count > 0) 352 | { 353 | Piece recentPiece = game.pieces.Last(); 354 | Button square = GetSquareFromPiece(recentPiece); 355 | TurnsTextBlock.Text = game.turns.ToString(); 356 | square.IsEnabled = false; 357 | 358 | if (Settings.clearlyPressedSquares) 359 | { // ButtonRevealStyle could work too 360 | square.Style = Application.Current.Resources["AccentButtonStyle"] as Style; 361 | ResizeSquare(square); 362 | } 363 | 364 | SetSquareText(square, recentPiece.player.symbol); 365 | } 366 | 367 | // Check if won 368 | if (game.Won()) 369 | { 370 | if (game.gamemode == 0 && game.winner.isComputer) 371 | { 372 | TurnTextBlock.Text = "You lost!"; 373 | AgainButtonText.Text = "Try again"; 374 | } 375 | else 376 | { 377 | if (game.gamemode == 0 && !game.winner.isComputer) 378 | { 379 | TurnTextBlock.Text = "You won!"; 380 | } else { 381 | TurnTextBlock.Text = String.Concat(game.winner.name, " won!"); 382 | } 383 | 384 | if (game.gamemode == 2) 385 | { 386 | AgainButtonText.Text = "New round"; 387 | } else 388 | { 389 | AgainButtonText.Text = "Play again"; 390 | } 391 | } 392 | OnGameEnded(); 393 | } 394 | else if (game.IsDraw()) 395 | { 396 | TurnTextBlock.Text = "Draw!"; 397 | OnGameEnded(); 398 | } 399 | else 400 | { 401 | UpdateTurnText(); 402 | if (game.GetCurrentPlayerTurn().isComputer) 403 | { 404 | if(game.ComputerTurn()) // Computer's Turn 405 | { 406 | // Simulate button pressing 407 | canPress = false; 408 | Button buttonPressed = GetSquareFromPiece(game.pieces.Last()); 409 | ShrinkSquare(buttonPressed); 410 | buttonPressed.BorderThickness = new Microsoft.UI.Xaml.Thickness(1.5,1.5,1.5,1.5); 411 | 412 | DispatcherTimer timer = new DispatcherTimer(); 413 | timer.Interval = TimeSpan.FromSeconds(0.25*(1+Settings.botsSpeed)); 414 | EventHandler timerHandler = new EventHandler((s2, e2) => 415 | { 416 | timer.Stop(); 417 | buttonPressed.BorderThickness = new Microsoft.UI.Xaml.Thickness(1,1,1,1); 418 | buttonPressed.Scale = new Vector3(1); 419 | OnBoardUpdated(); 420 | canPress = true; 421 | }); 422 | timer.Tick += timerHandler; 423 | timer.Start(); 424 | } 425 | } 426 | } 427 | } 428 | 429 | private void OnGameEnded() 430 | { 431 | SetMatchTimerActive(false); 432 | if (game.winner != null) 433 | { 434 | var num = 0; 435 | foreach (Piece piece in game.winningPieces) 436 | { 437 | num++; 438 | Button square = (Button)Board.FindName("square" + piece.GetIndex()); 439 | 440 | 441 | // Animate button size 442 | TimeSpan savedDuration = square.ScaleTransition.Duration; 443 | square.ScaleTransition.Duration = savedDuration.Multiply(3); 444 | square.Scale = new Vector3(0.95f); 445 | 446 | // shrink first 447 | DispatcherTimer shrinkTimer = new DispatcherTimer(); 448 | shrinkTimer.Interval = savedDuration + TimeSpan.FromMilliseconds(50 * num); 449 | EventHandler shrinkHandler = new EventHandler((s1, e1) => 450 | { 451 | shrinkTimer.Stop(); 452 | square.Style = Application.Current.Resources["AccentButtonStyle"] as Style; 453 | square.IsEnabled = true; 454 | square.Scale = new Vector3(1); 455 | // grow back and reset ScaleTransition 456 | DispatcherTimer growTimer = new DispatcherTimer(); 457 | growTimer.Interval = savedDuration.Divide(2) + TimeSpan.FromMilliseconds(100 * num); 458 | EventHandler growHandler = new EventHandler((s2, e2) => 459 | { 460 | square.ScaleTransition.Duration = savedDuration; 461 | growTimer.Stop(); 462 | 463 | if (piece.Equals(game.winningPieces.Last())) 464 | { 465 | if (AgainButton.Parent != PageGrid) 466 | { 467 | PageGrid.Children.Add(AgainButton); 468 | } 469 | } 470 | }); 471 | growTimer.Tick += growHandler; 472 | growTimer.Start(); 473 | }); 474 | shrinkTimer.Tick += shrinkHandler; 475 | shrinkTimer.Start(); 476 | 477 | // Hopefully animate background color 478 | /*var uiSettings = new UISettings(); 479 | var accentColor = new UISettings().GetColorValue(UIColorType.Accent); 480 | Brush brush = new SolidColorBrush(accentColor); 481 | button.Background = brush; 482 | 483 | 484 | ColorAnimation colorAnim = new ColorAnimation() 485 | { 486 | To = accentColor, 487 | Duration = TimeSpan.FromSeconds(1), 488 | AutoReverse = true, 489 | }; 490 | 491 | DoubleAnimation widthAnimation = new DoubleAnimation(); 492 | 120, 300, TimeSpan.FromSeconds(5)); 493 | widthAnimation.RepeatBehavior = RepeatBehavior.Forever; 494 | widthAnimation.AutoReverse = true; 495 | grid.BeginAnimation(Button.WidthProperty, widthAnimation); 496 | OnGridLeft(grid, null); 497 | */ 498 | } 499 | } 500 | else 501 | { 502 | if (AgainButton.Parent != PageGrid) 503 | { 504 | PageGrid.Children.Add(AgainButton); 505 | } 506 | } 507 | } 508 | 509 | private void PlayAgainButtonPressed(object sender, RoutedEventArgs e) 510 | { 511 | PageGrid.Children.Remove(AgainButton); 512 | SetMatchTimerActive(false); 513 | 514 | foreach (Piece piece in game.pieces) 515 | { 516 | var index = (piece.row * Settings.boardSize.X) + piece.col; 517 | Button square = (Button)Board.FindName("square" + index); 518 | if (square != null) 519 | { 520 | SetSquareText(square, ""); 521 | square.IsEnabled = true; 522 | square.Style = Application.Current.Resources["DefaultButtonStyle"] as Style; 523 | } 524 | 525 | } 526 | 527 | game.Restart(); 528 | TimeTextBlock.Text = game.time.ToString(); 529 | TurnsTextBlock.Text = game.turns.ToString(); 530 | UpdateTurnText(); 531 | } 532 | 533 | 534 | private void SetSquareText(Button square,string text) 535 | { 536 | TextBlock textblock = new TextBlock(); 537 | textblock.Text = text; 538 | textblock.HorizontalAlignment = HorizontalAlignment.Center; 539 | textblock.VerticalAlignment = VerticalAlignment.Center; 540 | textblock.TextAlignment = TextAlignment.Center; 541 | textblock.FontSize = Math.Min(square.Height / 2.5,32); 542 | square.Padding = new Thickness(0,0,0, textblock.FontSize/4); 543 | square.Content = textblock; 544 | } 545 | 546 | private Button GetSquareFromPiece(Piece piece) 547 | { 548 | var index = (piece.row * Settings.boardSize.X) + piece.col; 549 | return (Button) Board.FindName("square" + index); 550 | } 551 | } 552 | -------------------------------------------------------------------------------- /Pages/SettingsPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | Light 39 | Dark 40 | System default 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 52 | 53 | 54 | 55 | 56 | 58 | 59 | 60 | 61 | 62 | 64 | 65 | 66 | 67 | 68 | 70 | 71 | 72 | 73 | 74 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | Singleplayer 94 | Multiplayer 95 | Spectator 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | Default 151 | Custom 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 3 in a row 194 | Full row 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 231 | Easy 232 | Medium 233 | Hard 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 243 | 244 | 245 | 247 | Short 248 | Default 249 | Long 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 260 | 261 | 262 | 263 | 264 | 266 | 267 | 268 | 269 | 270 | 272 | 273 | 274 | 275 | 276 | 278 | 279 | 280 | 281 | 282 | 284 | 285 | 286 | 287 | 288 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 314 | 315 | 316 | -------------------------------------------------------------------------------- /Pages/SettingsPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using Microsoft.UI.Xaml; 4 | using Microsoft.UI.Xaml.Controls; 5 | 6 | // To learn more about WinUI, the WinUI project structure, 7 | // and more about our project templates, see: http://aka.ms/winui-project-info. 8 | 9 | namespace Fluent_Tic_tac_toe.Pages; 10 | /// 11 | /// An empty page that can be used on its own or navigated to within a Frame. 12 | /// 13 | public sealed partial class SettingsPage : Page 14 | { 15 | public SettingsPage() 16 | { 17 | this.InitializeComponent(); 18 | LoadSettings(); 19 | } 20 | 21 | private void UpdateTheme() 22 | { 23 | FrameworkElement windowContent = (FrameworkElement)Settings.window.WindowContent; 24 | switch (ThemeSelectionBox.SelectedIndex) 25 | { 26 | case 0: 27 | windowContent.RequestedTheme = ElementTheme.Light; 28 | break; 29 | case 1: 30 | windowContent.RequestedTheme = ElementTheme.Dark; 31 | break; 32 | case 2: 33 | bool IsDarkTheme = (bool)Application.Current.Resources["IsDarkTheme"]; 34 | windowContent.RequestedTheme = IsDarkTheme ? ElementTheme.Dark : ElementTheme.Light; 35 | windowContent.RequestedTheme = ElementTheme.Default; 36 | break; 37 | default: 38 | ThemeSelectionBox.SelectedIndex = 2; 39 | windowContent.RequestedTheme = ElementTheme.Default; 40 | break; 41 | } 42 | } 43 | 44 | private void ThemeSelected(object sender, RoutedEventArgs e) 45 | { 46 | if (!this.IsLoaded) 47 | { 48 | return; 49 | } 50 | UpdateTheme(); 51 | Settings.SaveValue("theme", ThemeSelectionBox.SelectedIndex); 52 | } 53 | 54 | private void ClearGamemodeExpanderContent() 55 | { 56 | if (GamemodeExpanderContent.Children.Contains(PlayersCard)) 57 | { 58 | GamemodeExpanderContent.Children.Remove(PlayersCard); 59 | } 60 | if (GamemodeExpanderContent.Children.Contains(BotsCard)) 61 | { 62 | GamemodeExpanderContent.Children.Remove(BotsCard); 63 | } 64 | if (GamemodeExpanderContent.Children.Contains(MaxPlayersCard)) 65 | { 66 | GamemodeExpanderContent.Children.Remove(MaxPlayersCard); 67 | } 68 | } 69 | 70 | private void UpdateMaxPlayersText() 71 | { 72 | if(MaxPlayersText != null) 73 | { 74 | int maxPlayers = Settings.GetMaxPlayers(); 75 | MaxPlayersText.Text = maxPlayers.ToString(); 76 | BotsBox.Maximum = maxPlayers; 77 | PlayersBox.Maximum = maxPlayers; 78 | } 79 | } 80 | 81 | private void LoadPlayerBoxes() 82 | { 83 | if (GamemodeExpander.IsExpanded) 84 | { 85 | if (Settings.gamemode == 0) 86 | { 87 | PlayersBox.Value = 1; 88 | BotsBox.Value = 1; 89 | } 90 | else if (Settings.gamemode == 1) 91 | { 92 | BotsBox.Value = Settings.numMultiplayerBots; 93 | PlayersBox.Value = Settings.numPlayers; 94 | } 95 | else if (Settings.gamemode == 2) 96 | { 97 | BotsBox.Value = Settings.numSpectatorBots; 98 | } 99 | } 100 | 101 | } 102 | 103 | private void UpdatePlayerBoxesV2(bool bypass = false) 104 | { 105 | if (!this.IsLoaded) 106 | { 107 | return; 108 | } 109 | if (GamemodeSelectionBox.SelectedIndex == 1) 110 | { 111 | int maxPlayers = Settings.GetMaxPlayers(); 112 | BotsBox.Minimum = 0; 113 | PlayersBox.Minimum = 2; 114 | PlayersBox.Maximum = maxPlayers; 115 | BotsBox.Maximum = maxPlayers - PlayersBox.Value; 116 | PlayersBox.Maximum = maxPlayers - BotsBox.Value; 117 | 118 | Settings.SaveValue("numPlayers", (int)PlayersBox.Value); 119 | Settings.SaveValue("numMultiplayerBots", (int)BotsBox.Value); 120 | } 121 | else if (GamemodeSelectionBox.SelectedIndex == 2) 122 | { 123 | BotsBox.Minimum = 2; 124 | BotsBox.Maximum = Settings.GetMaxPlayers(); 125 | Settings.SaveValue("numSpectatorBots", (int)BotsBox.Value); 126 | } 127 | } 128 | 129 | private void UpdateGamemodeExpanderContent(bool wasSelected = false) 130 | { 131 | if (!this.IsLoaded) 132 | { 133 | return; 134 | } 135 | if (wasSelected) 136 | { 137 | Settings.SaveValue("gamemode", GamemodeSelectionBox.SelectedIndex); 138 | } 139 | if (GamemodeExpander.IsExpanded) 140 | { 141 | ClearGamemodeExpanderContent(); 142 | if (GamemodeSelectionBox.SelectedIndex == 0) 143 | { 144 | PlayersBox.Minimum = 0; 145 | BotsBox.Minimum = 0; 146 | 147 | GamemodeExpanderContent.Children.Add(PlayersCard); 148 | GamemodeExpanderContent.Children.Add(BotsCard); 149 | 150 | LoadPlayerBoxes(); 151 | 152 | PlayersBox.IsEnabled = false; 153 | BotsBox.IsEnabled = false; 154 | } 155 | else if (GamemodeSelectionBox.SelectedIndex == 1) 156 | { 157 | GamemodeExpanderContent.Children.Add(PlayersCard); 158 | GamemodeExpanderContent.Children.Add(BotsCard); 159 | GamemodeExpanderContent.Children.Add(MaxPlayersCard); 160 | 161 | UpdateMaxPlayersText(); 162 | LoadPlayerBoxes(); 163 | 164 | int maxPlayers = Settings.GetMaxPlayers(); 165 | BotsBox.Minimum = 0; 166 | PlayersBox.Minimum = 2; 167 | PlayersBox.Maximum = maxPlayers; 168 | BotsBox.Maximum = maxPlayers - PlayersBox.Value; 169 | PlayersBox.Maximum = maxPlayers - BotsBox.Value; 170 | 171 | 172 | PlayersBox.IsEnabled = true; 173 | BotsBox.IsEnabled = true; 174 | } 175 | else 176 | { 177 | GamemodeExpanderContent.Children.Add(BotsCard); 178 | GamemodeExpanderContent.Children.Add(MaxPlayersCard); 179 | 180 | UpdateMaxPlayersText(); 181 | 182 | BotsBox.IsEnabled = true; 183 | BotsBox.Minimum = 2; 184 | BotsBox.Maximum = Settings.GetMaxPlayers(); 185 | 186 | LoadPlayerBoxes(); 187 | } 188 | } 189 | } 190 | 191 | private void GamemodeExpanderExpanded(Expander sender, ExpanderExpandingEventArgs e) 192 | { 193 | UpdateGamemodeExpanderContent(); 194 | } 195 | 196 | private void GamemodeExpanderCollapsed(Expander sender, ExpanderCollapsedEventArgs e) 197 | { 198 | ClearGamemodeExpanderContent(); 199 | } 200 | 201 | private void GamemodeExpanderLoaded(object sender, RoutedEventArgs e) 202 | { 203 | ClearGamemodeExpanderContent(); 204 | } 205 | 206 | private void GamemodeSelected(object sender, RoutedEventArgs e) 207 | { 208 | LoadPlayerBoxes(); 209 | UpdateGamemodeExpanderContent(true); 210 | //UpdatePlayerBoxesV2(); 211 | } 212 | 213 | private void UpdateBoardExanderContent() 214 | { 215 | if (BoardExpander.IsExpanded) 216 | { 217 | BoardExpander.Content = BoardExpanderContent; 218 | if (BoardSelectionBox.SelectedIndex == 0) 219 | { 220 | BoardRowSelection.IsEnabled = false; 221 | BoardColumnSelection.IsEnabled = false; 222 | WinPatternSelectionBox.IsEnabled = false; 223 | } 224 | else 225 | { 226 | BoardRowSelection.IsEnabled = true; 227 | BoardColumnSelection.IsEnabled = true; 228 | WinPatternSelectionBox.IsEnabled = true; 229 | } 230 | 231 | BoardRowSelection.Value = Settings.boardSize.Y; 232 | BoardColumnSelection.Value = Settings.boardSize.X; 233 | WinPatternSelectionBox.SelectedIndex = Settings.winPattern; 234 | } 235 | } 236 | 237 | 238 | 239 | private void UpdateBotsExanderContent(bool wasSelected = false) 240 | { 241 | if (!this.IsLoaded) 242 | { 243 | return; 244 | } 245 | if (wasSelected) 246 | { 247 | Settings.SaveValue("botsSpeed", BotsSpeedSelectionBox.SelectedIndex); 248 | } 249 | } 250 | 251 | private void BotsExanderExpanded(Expander sender, ExpanderExpandingEventArgs e) 252 | { 253 | UpdateBotsExanderContent(); 254 | } 255 | 256 | private void BotsSpeedSelected(object sender, RoutedEventArgs e) 257 | { 258 | UpdateBotsExanderContent(true); 259 | } 260 | 261 | private void PlayerBoxChanged(NumberBox sender, NumberBoxValueChangedEventArgs e) 262 | { 263 | UpdatePlayerBoxesV2(); 264 | } 265 | 266 | private void BotsBoxChanged(NumberBox sender, NumberBoxValueChangedEventArgs e) 267 | { 268 | UpdatePlayerBoxesV2(); 269 | } 270 | 271 | private void DifficultySelected(object sender, RoutedEventArgs e) 272 | { 273 | if (this.IsLoaded) 274 | { 275 | Settings.SaveValue("difficulty", DifficultySelectionBox.SelectedIndex); 276 | } 277 | } 278 | 279 | private void BoardRowsChanged(NumberBox sender, NumberBoxValueChangedEventArgs e) 280 | { 281 | if (this.IsLoaded) 282 | { 283 | Settings.SaveValue("boardRows", (float)e.NewValue); 284 | UpdatePlayerBoxesV2(); 285 | } 286 | } 287 | 288 | private void BoardColumnsChanged(NumberBox sender, NumberBoxValueChangedEventArgs e) 289 | { 290 | if (this.IsLoaded) 291 | { 292 | Settings.SaveValue("boardCols", (float)e.NewValue); 293 | UpdatePlayerBoxesV2(); 294 | } 295 | } 296 | 297 | private void WinPatternChanged(object sender, RoutedEventArgs e) 298 | { 299 | if (this.IsLoaded) 300 | { 301 | Settings.SaveValue("winPattern", WinPatternSelectionBox.SelectedIndex); 302 | } 303 | } 304 | 305 | private void BoardExanderExpanded(Expander sender, ExpanderExpandingEventArgs e) 306 | { 307 | UpdateBoardExanderContent(); 308 | } 309 | 310 | private void BoardSelected(object sender, RoutedEventArgs e) 311 | { 312 | if (this.IsLoaded) 313 | { 314 | Settings.SaveValue("boardMode", BoardSelectionBox.SelectedIndex); 315 | 316 | if (BoardSelectionBox.SelectedIndex == 0) 317 | { 318 | Settings.boardSize.Y = Convert.ToInt32(Settings.GetValue("boardRows", true)); 319 | Settings.boardSize.X = Convert.ToInt32(Settings.GetValue("boardCols", true)); 320 | Settings.winPattern = (int)Settings.GetValue("winPattern", true); 321 | } 322 | else 323 | { 324 | Settings.boardSize.Y = Convert.ToInt32(Settings.GetValue("boardRows")); 325 | Settings.boardSize.X = Convert.ToInt32(Settings.GetValue("boardCols")); 326 | Settings.winPattern = (int)Settings.GetValue("winPattern"); 327 | } 328 | } 329 | BoardExpander.IsExpanded = BoardSelectionBox.SelectedIndex != 0; 330 | UpdateBoardExanderContent(); 331 | } 332 | 333 | private void OnTopToggled(object sender, RoutedEventArgs e) 334 | { 335 | if (this.IsLoaded) 336 | { 337 | Settings.SaveValue("alwaysOnTop", OnTopToggleSwitch.IsOn); 338 | } 339 | } 340 | 341 | private void OnClearSquaresToggled(object sender, RoutedEventArgs e) 342 | { 343 | if (this.IsLoaded) 344 | { 345 | Settings.SaveValue("clearlyPressedSquares", ClearlyUsedSquaresToggleSwitch.IsOn); 346 | } 347 | } 348 | 349 | private void OnLimitSizeToggled(object sender, RoutedEventArgs e) 350 | { 351 | if (this.IsLoaded) 352 | { 353 | Settings.SaveValue("limitBoardSize", LimitSizeToggleSwitch.IsOn); 354 | } 355 | } 356 | 357 | private void TimerToggled(object sender, RoutedEventArgs e) 358 | { 359 | if (this.IsLoaded) 360 | { 361 | Settings.SaveValue("matchTimerEnabled", TimerToggleSwitch.IsOn); 362 | } 363 | } 364 | 365 | private void SquaresInfoToggled(object sender, RoutedEventArgs e) 366 | { 367 | if (this.IsLoaded) 368 | { 369 | Settings.SaveValue("boardInfoEnabled", SquaresInfoToggleSwitch.IsOn); 370 | } 371 | } 372 | 373 | private void PlayerCounterToggled(object sender, RoutedEventArgs e) 374 | { 375 | if (this.IsLoaded) 376 | { 377 | Settings.SaveValue("playerCounterEnabled", PlayerCounterToggleSwitch.IsOn); 378 | } 379 | } 380 | 381 | private void LoadSettings() 382 | { 383 | try 384 | { 385 | ThemeSelectionBox.SelectedIndex = Settings.theme; 386 | OnTopToggleSwitch.IsOn = Settings.alwaysOnTop; 387 | ClearlyUsedSquaresToggleSwitch.IsOn = Settings.clearlyPressedSquares; 388 | LimitSizeToggleSwitch.IsOn = Settings.limitBoardSize; 389 | 390 | GamemodeSelectionBox.SelectedIndex = Settings.gamemode; 391 | BoardSelectionBox.SelectedIndex = Settings.boardMode; 392 | 393 | LoadPlayerBoxes(); 394 | //MultiplayerPlayersBox.Value = Settings.numPlayers; 395 | //MultiplayerBotsBox.Value = Settings.numMultiplayerBots; 396 | //SpectatorBotsBox.Value = Settings.numSpectatorBots; 397 | DifficultySelectionBox.SelectedIndex = Settings.difficulty; 398 | BotsSpeedSelectionBox.SelectedIndex = Settings.botsSpeed; 399 | 400 | if (Settings.boardMode == 0) 401 | { 402 | Settings.boardSize.Y = Convert.ToInt32(Settings.GetValue("boardRows", true)); 403 | Settings.boardSize.X = Convert.ToInt32(Settings.GetValue("boardCols", true)); 404 | Settings.winPattern = (int)Settings.GetValue("winPattern", true); 405 | } 406 | 407 | BoardRowSelection.Value = Settings.boardSize.Y; 408 | BoardColumnSelection.Value = Settings.boardSize.X; 409 | WinPatternSelectionBox.SelectedIndex = Settings.winPattern; 410 | 411 | TimerToggleSwitch.IsOn = Settings.matchTimerEnabled; 412 | SquaresInfoToggleSwitch.IsOn = Settings.boardInfoEnabled; 413 | PlayerCounterToggleSwitch.IsOn = Settings.playerCounterEnabled; 414 | 415 | UpdatePlayerBoxesV2(true); 416 | } 417 | catch (Exception e) 418 | { 419 | Console.WriteLine(e.Message); 420 | } 421 | } 422 | 423 | private void ResetGameSettingsClick(object sender, RoutedEventArgs e) 424 | { 425 | ResetGameSettingsButton.Flyout.Hide(); 426 | GamemodeExpander.IsExpanded = false; 427 | BoardExpander.IsExpanded = false; 428 | Settings.Load(true); 429 | LoadSettings(); 430 | } 431 | } 432 | -------------------------------------------------------------------------------- /Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Fluent Tic-tac-toe (Package)": { 4 | "commandName": "MsixPackage", 5 | "nativeDebugging": false 6 | }, 7 | "Fluent Tic-tac-toe (Unpackaged)": { 8 | "commandName": "Project" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 |

5 | Fluent Tic-Tac-Toe 6 |

7 | 8 |

9 | A Fluent-styled game of Tic-Tac-Toe for Windows. 10 |

11 |

12 | 13 | 14 | Platform 15 | 16 | 17 | GitHub last commit 18 |

19 | 20 | 21 | --- 22 | 23 | ## Installation 24 | 25 | 26 | 27 | 28 |
29 |
30 | 31 | 32 | ## Features 33 |

Like most tic-tac-toe games, it features:

34 |
    35 | Single-player: Play against a bot 36 |
37 |
    38 | Local Multiplayer: Play against friends on the same device 39 |
40 |

However, it also includes customization settings for:

41 |
    42 | Board Sizes: Play on a 4x4 board instead of a 3x3 43 |
44 |
    45 | Number of Bots: Play against 2 or more bots instead of just 1 46 |
47 |
    48 | Bot Difficulty: Too easy or hard? Just change the difficulty 49 |
50 | 51 |
52 | 53 | ## Screenshots 54 | 55 |
56 | 57 | 58 |
59 | 60 | ## Creator's note 61 | This app started as a way for me to learn C# and xaml in order to build a desktop application using WinUI 3 and the .NET framework. As such, there are many obvious signs of inexperience when it comes to the app's code and functionality. If there's any feedback or advice on the project, feel free to contribute by reporting an [issue](https://github.com/dfchang149/Fluent-Tic-Tac-Toe/issues) or submitting a [pull request](https://github.com/dfchang149/Fluent-Tic-Tac-Toe/pulls). 62 | 63 | ## License 64 | Copyright (c) 2022 Dustin Fu Chang 65 | 66 | Licensed under [MIT license](https://github.com/dfchang149/Fluent-Tic-Tac-Toe/blob/master/LICENSE.md) 67 | -------------------------------------------------------------------------------- /Settings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Numerics; 5 | using Microsoft.UI.Xaml; 6 | using Windows.Storage; 7 | 8 | namespace Fluent_Tic_tac_toe; 9 | internal class Settings 10 | { 11 | public static string[] gamemodes = { "Singleplayer", "Multiplayer", "Spectator" }; 12 | public static int gamemode; 13 | 14 | public static string[] difficulties = { "Easy", "Medium", "Hard" }; 15 | public static int difficulty; 16 | 17 | public static List players = new(); 18 | public static int numPlayers; 19 | public static int numSingleplayerBots; 20 | public static int numMultiplayerBots; 21 | public static int numSpectatorBots; 22 | 23 | public static string[] boardModes = { "Default", "Custom" }; 24 | public static int boardMode; 25 | public static Vector2 boardSize; 26 | 27 | public static string[] winPatterns = { "3 in a row", "Full row" }; 28 | public static int winPattern; 29 | 30 | public static string[] botsSpeeds = { "Short", "Default", "Long" }; 31 | public static int botsSpeed; 32 | 33 | public static bool matchTimerEnabled; 34 | public static bool boardInfoEnabled; 35 | public static bool playerCounterEnabled; 36 | 37 | public static string[] themes = { "Light", "Dark", "System default" }; 38 | public static int theme; 39 | 40 | public static bool alwaysOnTop; 41 | public static bool clearlyPressedSquares; 42 | public static bool limitBoardSize; 43 | 44 | public static MainWindow window; 45 | 46 | public static ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 47 | public static StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder; 48 | 49 | public static void Load(bool useDefault = false) 50 | { 51 | theme = (int)GetValue("theme", useDefault); 52 | alwaysOnTop = (bool)GetValue("alwaysOnTop", useDefault); 53 | clearlyPressedSquares = (bool)GetValue("clearlyPressedSquares", useDefault); 54 | limitBoardSize = (bool)GetValue("limitBoardSize", useDefault); 55 | 56 | gamemode = (int)GetValue("gamemode", useDefault); 57 | boardMode = (int)GetValue("boardMode", useDefault); 58 | numPlayers = Convert.ToInt32(GetValue("numPlayers", useDefault)); 59 | numSingleplayerBots = (int)GetValue("numSingleplayerBots", useDefault); 60 | numMultiplayerBots = Convert.ToInt32(GetValue("numMultiplayerBots", useDefault)); 61 | numSpectatorBots = Convert.ToInt32(GetValue("numSpectatorBots", useDefault)); 62 | 63 | difficulty = (int)GetValue("difficulty", useDefault); 64 | botsSpeed = (int)GetValue("botsSpeed", useDefault); 65 | 66 | var isDefaultBoardMode = boardMode == 0; 67 | var cols = Convert.ToInt32(GetValue("boardCols", isDefaultBoardMode)); 68 | var rows = Convert.ToInt32(GetValue("boardRows", isDefaultBoardMode)); 69 | boardSize = new Vector2(cols, rows); 70 | winPattern = (int)GetValue("winPattern", isDefaultBoardMode); 71 | 72 | matchTimerEnabled = (bool)GetValue("matchTimerEnabled", useDefault); 73 | boardInfoEnabled = (bool)GetValue("boardInfoEnabled", useDefault); 74 | playerCounterEnabled = (bool)GetValue("playerCounterEnabled", useDefault); 75 | 76 | Settings.window.SetIsAlwaysOnTop(alwaysOnTop); 77 | UpdateTheme(); 78 | } 79 | 80 | public static int GetMaxPlayers() // returns max amount of players for current board size 81 | { 82 | int maxPlayers = (int)Math.Round((boardSize.X * boardSize.Y) / 4.5f); 83 | return maxPlayers; 84 | } 85 | 86 | public static bool SaveValue(string key, Object value = null) 87 | { 88 | try 89 | { 90 | value ??= GetValue(key, true); 91 | localSettings.Values[key] = value; 92 | //Debug.WriteLine("Saved | " + key + " : " + value.ToString()); 93 | switch (key) 94 | { 95 | case "theme": 96 | theme = (int)value; 97 | UpdateTheme(); 98 | break; 99 | case "alwaysOnTop": 100 | alwaysOnTop = (bool)value; 101 | Settings.window.SetIsAlwaysOnTop(alwaysOnTop); 102 | break; 103 | case "clearlyPressedSquares": 104 | clearlyPressedSquares = (bool)value; 105 | break; 106 | case "limitBoardSize": 107 | limitBoardSize = (bool)value; 108 | break; 109 | case "gamemode": 110 | gamemode = (int)value; 111 | break; 112 | case "boardMode": 113 | boardMode = (int)value; 114 | break; 115 | case "numPlayers": 116 | numPlayers = (int)value; 117 | break; 118 | case "numSingleplayerBots": 119 | numSingleplayerBots = (int)value; 120 | break; 121 | case "numMultiplayerBots": 122 | numMultiplayerBots = (int)value; 123 | break; 124 | case "numSpectatorBots": 125 | numSpectatorBots = (int)value; 126 | break; 127 | case "difficulty": 128 | difficulty = (int)value; 129 | break; 130 | case "botsSpeed": 131 | botsSpeed = (int)value; 132 | break; 133 | case "boardRows": 134 | boardSize.Y = (float)value; 135 | break; 136 | case "boardCols": 137 | boardSize.X = (float)value; 138 | break; 139 | case "winPattern": 140 | winPattern = (int)value; 141 | break; 142 | case "matchTimerEnabled": 143 | matchTimerEnabled = (bool)value; 144 | break; 145 | case "boardInfoEnabled": 146 | boardInfoEnabled = (bool)value; 147 | break; 148 | case "playerCounterEnabled": 149 | playerCounterEnabled = (bool)value; 150 | break; 151 | default: 152 | break; 153 | } 154 | } 155 | catch (Exception) 156 | { 157 | return false; 158 | }; 159 | return true; 160 | } 161 | 162 | public static Object GetValue(string key, bool useDefault = false) 163 | { 164 | var value = localSettings.Values[key]; 165 | 166 | if (value != null && !useDefault) // retrieve saved data 167 | { 168 | return localSettings.Values[key]; 169 | } 170 | else 171 | { 172 | switch (key) 173 | { 174 | case "theme": 175 | return 2; 176 | case "alwaysOnTop": 177 | return false; 178 | case "clearlyPressedSquares": 179 | return false; 180 | case "limitBoardSize": 181 | return false; 182 | case "gamemode": 183 | return 0; 184 | case "boardMode": 185 | return 0; 186 | case "numPlayers": 187 | return 2; 188 | case "numSingleplayerBots": 189 | return 1; 190 | case "numMultiplayerBots": 191 | return 0; 192 | case "numSpectatorBots": 193 | return 2; 194 | case "difficulty": 195 | return 1; 196 | case "botsSpeed": 197 | return 1; 198 | case "boardRows": 199 | return 3; 200 | case "boardCols": 201 | return 3; 202 | case "winPattern": 203 | return 0; 204 | case "matchTimerEnabled": 205 | return true; 206 | case "boardInfoEnabled": 207 | return true; 208 | case "playerCounterEnabled": 209 | return true; 210 | default: 211 | return null; 212 | } 213 | } 214 | } 215 | 216 | private static void UpdateTheme() 217 | { 218 | FrameworkElement windowContent = (FrameworkElement)Settings.window.WindowContent; 219 | void RequestTheme(ElementTheme elementTheme) 220 | { 221 | if (windowContent.ActualTheme != elementTheme) 222 | { 223 | windowContent.RequestedTheme = elementTheme; 224 | } 225 | } 226 | switch (theme) 227 | { 228 | case 0: 229 | RequestTheme(ElementTheme.Light); 230 | break; 231 | case 1: 232 | RequestTheme(ElementTheme.Dark); 233 | break; 234 | case 2: 235 | bool IsDarkTheme = (bool)Application.Current.Resources["IsDarkTheme"]; 236 | RequestTheme(IsDarkTheme ? ElementTheme.Dark : ElementTheme.Light); 237 | RequestTheme(ElementTheme.Default); 238 | break; 239 | default: 240 | RequestTheme(ElementTheme.Default); 241 | break; 242 | } 243 | } 244 | } 245 | -------------------------------------------------------------------------------- /Usings.cs: -------------------------------------------------------------------------------- 1 | global using WinUIEx; -------------------------------------------------------------------------------- /app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | true/PM 12 | PerMonitorV2, PerMonitor 13 | 14 | 15 | 16 | --------------------------------------------------------------------------------