├── .gitignore ├── Chip ├── Chip.cpp ├── Chip.h ├── Chip.qrc ├── Chip.vcxproj ├── Chip.vcxproj.filters ├── Resources │ ├── chips.json │ └── img │ │ ├── b12.png │ │ ├── b13.png │ │ ├── b14.png │ │ ├── b15.png │ │ ├── b16.png │ │ ├── b17.png │ │ ├── b18.png │ │ ├── b19.png │ │ ├── b20.png │ │ ├── b21.png │ │ ├── b22.png │ │ ├── b23.png │ │ ├── b24.png │ │ ├── b25.png │ │ ├── b26.png │ │ ├── b27.png │ │ ├── b28.png │ │ ├── b29.png │ │ ├── b30.png │ │ ├── b31.png │ │ ├── b32.png │ │ ├── b33.png │ │ ├── b34.png │ │ ├── b35.png │ │ ├── b36.png │ │ ├── b37.png │ │ ├── b38.png │ │ ├── b39.png │ │ ├── icon-acu.png │ │ ├── icon-dbk.png │ │ ├── icon-dmg.png │ │ ├── icon-fil.png │ │ ├── o12.png │ │ ├── o13.png │ │ ├── o14.png │ │ ├── o15.png │ │ ├── o16.png │ │ ├── o17.png │ │ ├── o18.png │ │ ├── o19.png │ │ ├── o20.png │ │ ├── o21.png │ │ ├── o22.png │ │ ├── o23.png │ │ ├── o24.png │ │ ├── o25.png │ │ ├── o26.png │ │ ├── o27.png │ │ ├── o28.png │ │ ├── o29.png │ │ ├── o30.png │ │ ├── o31.png │ │ ├── o32.png │ │ ├── o33.png │ │ ├── o34.png │ │ ├── o35.png │ │ ├── o36.png │ │ ├── o37.png │ │ ├── o38.png │ │ └── o39.png └── chip_global.h ├── ChipDataWindow ├── ChipDataWindow.cpp ├── ChipDataWindow.h ├── ChipDataWindow.ui ├── ChipDataWindow.vcxproj ├── ChipDataWindow.vcxproj.filters ├── GetChipWindow.cpp ├── GetChipWindow.h ├── GetChipWindow.ui ├── ManualInputWindow.cpp ├── ManualInputWindow.h ├── ManualInputWindow.ui ├── chipdatawindow_global.h ├── stdafx.cpp └── stdafx.h ├── ChipSolver ├── ChipSolver.cpp ├── ChipSolver.h ├── ChipSolver.qrc ├── ChipSolver.vcxproj ├── ChipSolver.vcxproj.filters ├── Resources │ ├── 2B14-52-result.json │ ├── 2B14-result.json │ ├── 2B14.json │ ├── AGS-30-result.json │ ├── AGS-30.json │ ├── AT4-5-result.json │ ├── AT4-6-result.json │ ├── AT4.json │ ├── BGM-71-result.json │ ├── BGM-71.json │ ├── M2-5-0-result.json │ ├── M2-5-2-result.json │ ├── M2-5-3-result.json │ ├── M2-6-2-result.json │ ├── M2.json │ ├── Mk-153-52-result.json │ ├── Mk-153-result.json │ ├── Mk-153.json │ ├── Mk-47-result.json │ ├── Mk-47.json │ ├── PP-93-2-result.json │ ├── PP-93-4-result.json │ ├── PP-93-result.json │ ├── PP-93.json │ ├── QLZ-04-result.json │ ├── QLZ-04.json │ └── squads.json └── chipsolver_global.h ├── ChipTableView ├── ChipTableView.cpp ├── ChipTableView.h ├── ChipTableView.vcxproj ├── ChipTableView.vcxproj.filters ├── SolutionTableModel.cpp ├── SolutionTableModel.h └── chiptableview_global.h ├── ChipView ├── ChipBlock.cpp ├── ChipBlock.h ├── ChipView.cpp ├── ChipView.h ├── ChipView.ui ├── ChipView.vcxproj ├── ChipView.vcxproj.filters └── chipview_global.h ├── CodeX.sln ├── CodeX ├── AboutDialog.cpp ├── AboutDialog.h ├── AboutDialog.ui ├── AltSolutionWindow.cpp ├── AltSolutionWindow.h ├── AltSolutionWindow.ui ├── CodeX.cpp ├── CodeX.h ├── CodeX.ico ├── CodeX.qrc ├── CodeX.rc ├── CodeX.ui ├── CodeX.vcxproj ├── CodeX.vcxproj.filters ├── GF_Tool_Server.exe ├── Resources │ └── pay.png ├── SettingWindow.cpp ├── SettingWindow.h ├── SettingWindow.ui ├── main.cpp ├── stdafx.cpp └── stdafx.h ├── LICENSE ├── README.md └── doc ├── img ├── 1.png ├── 10.png ├── 11.png ├── 2.png ├── 3.png ├── 4.jpg ├── 5.png ├── 6.png ├── 7.jpg ├── 8.png ├── 9.png └── firewall.png └── 使用说明.md /.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 | build/ 7 | *.exe 8 | 9 | # User-specific files 10 | *.rsuser 11 | *.suo 12 | *.user 13 | *.userosscache 14 | *.sln.docstates 15 | 16 | # User-specific files (MonoDevelop/Xamarin Studio) 17 | *.userprefs 18 | 19 | # Mono auto generated files 20 | mono_crash.* 21 | 22 | # Build results 23 | [Dd]ebug/ 24 | [Dd]ebugPublic/ 25 | [Rr]elease/ 26 | [Rr]eleases/ 27 | x64/ 28 | x86/ 29 | [Aa][Rr][Mm]/ 30 | [Aa][Rr][Mm]64/ 31 | bld/ 32 | [Bb]in/ 33 | [Oo]bj/ 34 | [Ll]og/ 35 | [Ll]ogs/ 36 | 37 | # Visual Studio 2015/2017 cache/options directory 38 | .vs/ 39 | # Uncomment if you have tasks that create the project's static files in wwwroot 40 | #wwwroot/ 41 | 42 | # Visual Studio 2017 auto generated files 43 | Generated\ Files/ 44 | 45 | # MSTest test Results 46 | [Tt]est[Rr]esult*/ 47 | [Bb]uild[Ll]og.* 48 | 49 | # NUnit 50 | *.VisualState.xml 51 | TestResult.xml 52 | nunit-*.xml 53 | 54 | # Build Results of an ATL Project 55 | [Dd]ebugPS/ 56 | [Rr]eleasePS/ 57 | dlldata.c 58 | 59 | # Benchmark Results 60 | BenchmarkDotNet.Artifacts/ 61 | 62 | # .NET Core 63 | project.lock.json 64 | project.fragment.lock.json 65 | artifacts/ 66 | 67 | # StyleCop 68 | StyleCopReport.xml 69 | 70 | # Files built by Visual Studio 71 | *_i.c 72 | *_p.c 73 | *_h.h 74 | *.ilk 75 | *.meta 76 | *.obj 77 | *.iobj 78 | *.pch 79 | *.pdb 80 | *.ipdb 81 | *.pgc 82 | *.pgd 83 | *.rsp 84 | *.sbr 85 | *.tlb 86 | *.tli 87 | *.tlh 88 | *.tmp 89 | *.tmp_proj 90 | *_wpftmp.csproj 91 | *.log 92 | *.vspscc 93 | *.vssscc 94 | .builds 95 | *.pidb 96 | *.svclog 97 | *.scc 98 | 99 | # Chutzpah Test files 100 | _Chutzpah* 101 | 102 | # Visual C++ cache files 103 | ipch/ 104 | *.aps 105 | *.ncb 106 | *.opendb 107 | *.opensdf 108 | *.sdf 109 | *.cachefile 110 | *.VC.db 111 | *.VC.VC.opendb 112 | 113 | # Visual Studio profiler 114 | *.psess 115 | *.vsp 116 | *.vspx 117 | *.sap 118 | 119 | # Visual Studio Trace Files 120 | *.e2e 121 | 122 | # TFS 2012 Local Workspace 123 | $tf/ 124 | 125 | # Guidance Automation Toolkit 126 | *.gpState 127 | 128 | # ReSharper is a .NET coding add-in 129 | _ReSharper*/ 130 | *.[Rr]e[Ss]harper 131 | *.DotSettings.user 132 | 133 | # TeamCity is a build add-in 134 | _TeamCity* 135 | 136 | # DotCover is a Code Coverage Tool 137 | *.dotCover 138 | 139 | # AxoCover is a Code Coverage Tool 140 | .axoCover/* 141 | !.axoCover/settings.json 142 | 143 | # Visual Studio code coverage results 144 | *.coverage 145 | *.coveragexml 146 | 147 | # NCrunch 148 | _NCrunch_* 149 | .*crunch*.local.xml 150 | nCrunchTemp_* 151 | 152 | # MightyMoose 153 | *.mm.* 154 | AutoTest.Net/ 155 | 156 | # Web workbench (sass) 157 | .sass-cache/ 158 | 159 | # Installshield output folder 160 | [Ee]xpress/ 161 | 162 | # DocProject is a documentation generator add-in 163 | DocProject/buildhelp/ 164 | DocProject/Help/*.HxT 165 | DocProject/Help/*.HxC 166 | DocProject/Help/*.hhc 167 | DocProject/Help/*.hhk 168 | DocProject/Help/*.hhp 169 | DocProject/Help/Html2 170 | DocProject/Help/html 171 | 172 | # Click-Once directory 173 | publish/ 174 | 175 | # Publish Web Output 176 | *.[Pp]ublish.xml 177 | *.azurePubxml 178 | # Note: Comment the next line if you want to checkin your web deploy settings, 179 | # but database connection strings (with potential passwords) will be unencrypted 180 | *.pubxml 181 | *.publishproj 182 | 183 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 184 | # checkin your Azure Web App publish settings, but sensitive information contained 185 | # in these scripts will be unencrypted 186 | PublishScripts/ 187 | 188 | # NuGet Packages 189 | *.nupkg 190 | # NuGet Symbol Packages 191 | *.snupkg 192 | # The packages folder can be ignored because of Package Restore 193 | **/[Pp]ackages/* 194 | # except build/, which is used as an MSBuild target. 195 | !**/[Pp]ackages/build/ 196 | # Uncomment if necessary however generally it will be regenerated when needed 197 | #!**/[Pp]ackages/repositories.config 198 | # NuGet v3's project.json files produces more ignorable files 199 | *.nuget.props 200 | *.nuget.targets 201 | 202 | # Microsoft Azure Build Output 203 | csx/ 204 | *.build.csdef 205 | 206 | # Microsoft Azure Emulator 207 | ecf/ 208 | rcf/ 209 | 210 | # Windows Store app package directories and files 211 | AppPackages/ 212 | BundleArtifacts/ 213 | Package.StoreAssociation.xml 214 | _pkginfo.txt 215 | *.appx 216 | *.appxbundle 217 | *.appxupload 218 | 219 | # Visual Studio cache files 220 | # files ending in .cache can be ignored 221 | *.[Cc]ache 222 | # but keep track of directories ending in .cache 223 | !?*.[Cc]ache/ 224 | 225 | # Others 226 | ClientBin/ 227 | ~$* 228 | *~ 229 | *.dbmdl 230 | *.dbproj.schemaview 231 | *.jfm 232 | *.pfx 233 | *.publishsettings 234 | orleans.codegen.cs 235 | 236 | # Including strong name files can present a security risk 237 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 238 | #*.snk 239 | 240 | # Since there are multiple workflows, uncomment next line to ignore bower_components 241 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 242 | #bower_components/ 243 | 244 | # RIA/Silverlight projects 245 | Generated_Code/ 246 | 247 | # Backup & report files from converting an old project file 248 | # to a newer Visual Studio version. Backup files are not needed, 249 | # because we have git ;-) 250 | _UpgradeReport_Files/ 251 | Backup*/ 252 | UpgradeLog*.XML 253 | UpgradeLog*.htm 254 | ServiceFabricBackup/ 255 | *.rptproj.bak 256 | 257 | # SQL Server files 258 | *.mdf 259 | *.ldf 260 | *.ndf 261 | 262 | # Business Intelligence projects 263 | *.rdl.data 264 | *.bim.layout 265 | *.bim_*.settings 266 | *.rptproj.rsuser 267 | *- [Bb]ackup.rdl 268 | *- [Bb]ackup ([0-9]).rdl 269 | *- [Bb]ackup ([0-9][0-9]).rdl 270 | 271 | # Microsoft Fakes 272 | FakesAssemblies/ 273 | 274 | # GhostDoc plugin setting file 275 | *.GhostDoc.xml 276 | 277 | # Node.js Tools for Visual Studio 278 | .ntvs_analysis.dat 279 | node_modules/ 280 | 281 | # Visual Studio 6 build log 282 | *.plg 283 | 284 | # Visual Studio 6 workspace options file 285 | *.opt 286 | 287 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 288 | *.vbw 289 | 290 | # Visual Studio LightSwitch build output 291 | **/*.HTMLClient/GeneratedArtifacts 292 | **/*.DesktopClient/GeneratedArtifacts 293 | **/*.DesktopClient/ModelManifest.xml 294 | **/*.Server/GeneratedArtifacts 295 | **/*.Server/ModelManifest.xml 296 | _Pvt_Extensions 297 | 298 | # Paket dependency manager 299 | .paket/paket.exe 300 | paket-files/ 301 | 302 | # FAKE - F# Make 303 | .fake/ 304 | 305 | # CodeRush personal settings 306 | .cr/personal 307 | 308 | # Python Tools for Visual Studio (PTVS) 309 | __pycache__/ 310 | *.pyc 311 | 312 | # Cake - Uncomment if you are using it 313 | # tools/** 314 | # !tools/packages.config 315 | 316 | # Tabs Studio 317 | *.tss 318 | 319 | # Telerik's JustMock configuration file 320 | *.jmconfig 321 | 322 | # BizTalk build output 323 | *.btp.cs 324 | *.btm.cs 325 | *.odx.cs 326 | *.xsd.cs 327 | 328 | # OpenCover UI analysis results 329 | OpenCover/ 330 | 331 | # Azure Stream Analytics local run output 332 | ASALocalRun/ 333 | 334 | # MSBuild Binary and Structured Log 335 | *.binlog 336 | 337 | # NVidia Nsight GPU debugger configuration file 338 | *.nvuser 339 | 340 | # MFractors (Xamarin productivity tool) working folder 341 | .mfractor/ 342 | 343 | # Local History for Visual Studio 344 | .localhistory/ 345 | 346 | # BeatPulse healthcheck temp database 347 | healthchecksdb 348 | 349 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 350 | MigrationBackup/ 351 | 352 | # Ionide (cross platform F# VS Code tools) working folder 353 | .ionide/ 354 | -------------------------------------------------------------------------------- /Chip/Chip.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma warning(disable:26812) 3 | #include "chip_global.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | // 游戏内的芯片数据 14 | class CHIP_EXPORT GFChip 15 | { 16 | public: 17 | explicit GFChip(const QJsonObject& object); 18 | GFChip(); 19 | static GFChip fromJsonObject(const QJsonObject& object); 20 | // 从乐章代码中解析单个芯片,如果解析失败,返回的chip.id为-1,否则保持为0 21 | static GFChip fromHycdesCode(const QString& code); 22 | QJsonObject toObject() const; 23 | QPixmap icon() const; 24 | QString name() const; 25 | QString squadName() const; 26 | 27 | enum ChipClass 28 | { 29 | Class56 = 5061, 30 | Class551 = 5051, 31 | Class552 = 5052, 32 | }; 33 | enum ChipColor 34 | { 35 | Orange = 1, 36 | Blue = 2, 37 | }; 38 | struct Point 39 | { 40 | int x, y; 41 | }; 42 | 43 | // 游戏内id 44 | int id; 45 | // 顺序编号 46 | int no; 47 | // 芯片类别,5061/5051/5052... 48 | int chipClass; 49 | // 芯片经验 50 | int exp; 51 | // 芯片等级 52 | int level; 53 | // 芯片颜色 54 | int color; 55 | // 芯片形状ID 56 | int gridID; 57 | // 小队装备信息,0未装备 58 | int squad; 59 | // 芯片位置 60 | Point position; 61 | // 芯片旋转,顺时针,90度为单位 62 | int rotate; 63 | // 伤害格数 64 | int damageBlock; 65 | // 装填格数 66 | int reloadBlock; 67 | // 命中格数 68 | int hitBlock; 69 | // 破防格数 70 | int defbreakBlock; 71 | // 伤害数值 72 | int damageValue; 73 | // 装填数值 74 | int reloadValue; 75 | // 命中数值 76 | int hitValue; 77 | // 破防数值 78 | int defbreakValue; 79 | // 锁定 80 | bool locked; 81 | 82 | void calcValue(); 83 | 84 | GFChip operator + (const GFChip& t) const; 85 | GFChip operator += (const GFChip& t); 86 | GFChip operator - (const GFChip& t) const; 87 | GFChip operator -= (const GFChip& t); 88 | }; 89 | 90 | typedef std::vector Chips; 91 | 92 | Chips CHIP_EXPORT getChips(const QJsonObject& obj); 93 | 94 | // 小队序号转为对应名称,需要先从squad_with_user_info中读取id并转换为1-6 95 | QString CHIP_EXPORT squadString(int i); 96 | 97 | // 每类芯片的基本参数 98 | class CHIP_EXPORT ChipConfig 99 | { 100 | public: 101 | typedef std::vector Map; 102 | 103 | ChipConfig() = default; 104 | 105 | // 芯片形状ID 106 | int gridID; 107 | // 芯片类别,5061/5051/5052... 108 | int chipClass; 109 | // 芯片宽度 110 | int width; 111 | // 芯片高度 112 | int height; 113 | // 芯片格数 114 | int blocks; 115 | // 旋转方向数 116 | int direction; 117 | 118 | // 芯片名字 119 | std::string name; 120 | // 芯片形状 121 | Map map; 122 | 123 | // 通过gridID获取芯片配置 124 | static const ChipConfig& getConfig(int id) { return configs_[id]; } 125 | static void initConfig(); 126 | 127 | ChipConfig rotate90(int n = 1) const; // clockwise 128 | 129 | private: 130 | explicit ChipConfig(const QJsonObject& object); 131 | // 目前编号最大不到40 132 | static std::array configs_; 133 | }; 134 | 135 | // 芯片在拼图解法中的参数 136 | struct CHIP_EXPORT ChipPuzzleOption 137 | { 138 | int no; 139 | uint8_t x, y; 140 | // 顺时针旋转90度的次数 141 | uint8_t rotate; 142 | explicit ChipPuzzleOption(int _x = 0, int _y = 0, int _r = 0, int _no = 0) :no(_no), x(_x), y(_y), rotate(_r) {} 143 | explicit ChipPuzzleOption(const QJsonObject& object); 144 | QJsonObject toObject() const; 145 | static ChipPuzzleOption fromJsonObject(const QJsonObject& object); 146 | }; 147 | 148 | // 芯片摆放信息,0为空,>0为芯片编号(下标+1),<0为无法使用 149 | struct CHIP_EXPORT ChipViewInfo 150 | { 151 | int width; 152 | int height; 153 | std::vector> map; 154 | }; 155 | 156 | // 一组可行解 157 | struct CHIP_EXPORT Solution 158 | { 159 | // 使用的芯片参数 160 | std::vector chips; 161 | // 得到的重装总属性,以level为总等级,id为属性偏差,no为旋转次数 162 | GFChip totalValue; 163 | // 重装小队名称 164 | QString squad; 165 | 166 | bool operator <(const Solution& r) const; 167 | bool operator >(const Solution& r) const; 168 | 169 | QJsonObject toObject() const; 170 | static Solution fromJsonObject(const QJsonObject& obj); 171 | }; 172 | 173 | // 一个重装的所有解 174 | typedef std::vector SquadSolution; 175 | -------------------------------------------------------------------------------- /Chip/Chip.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Resources/img/b12.png 4 | Resources/img/b13.png 5 | Resources/img/b14.png 6 | Resources/img/b15.png 7 | Resources/img/b16.png 8 | Resources/img/b17.png 9 | Resources/img/b18.png 10 | Resources/img/b19.png 11 | Resources/img/b20.png 12 | Resources/img/b21.png 13 | Resources/img/b22.png 14 | Resources/img/b23.png 15 | Resources/img/b24.png 16 | Resources/img/b25.png 17 | Resources/img/b26.png 18 | Resources/img/b27.png 19 | Resources/img/b28.png 20 | Resources/img/b29.png 21 | Resources/img/b30.png 22 | Resources/img/b31.png 23 | Resources/img/b32.png 24 | Resources/img/b33.png 25 | Resources/img/b34.png 26 | Resources/img/b35.png 27 | Resources/img/b36.png 28 | Resources/img/b37.png 29 | Resources/img/b38.png 30 | Resources/img/b39.png 31 | Resources/img/o12.png 32 | Resources/img/o13.png 33 | Resources/img/o14.png 34 | Resources/img/o15.png 35 | Resources/img/o16.png 36 | Resources/img/o17.png 37 | Resources/img/o18.png 38 | Resources/img/o19.png 39 | Resources/img/o20.png 40 | Resources/img/o21.png 41 | Resources/img/o22.png 42 | Resources/img/o23.png 43 | Resources/img/o24.png 44 | Resources/img/o25.png 45 | Resources/img/o26.png 46 | Resources/img/o27.png 47 | Resources/img/o28.png 48 | Resources/img/o29.png 49 | Resources/img/o30.png 50 | Resources/img/o31.png 51 | Resources/img/o32.png 52 | Resources/img/o33.png 53 | Resources/img/o34.png 54 | Resources/img/o35.png 55 | Resources/img/o36.png 56 | Resources/img/o37.png 57 | Resources/img/o38.png 58 | Resources/img/o39.png 59 | Resources/chips.json 60 | Resources/img/icon-acu.png 61 | Resources/img/icon-dbk.png 62 | Resources/img/icon-dmg.png 63 | Resources/img/icon-fil.png 64 | 65 | 66 | -------------------------------------------------------------------------------- /Chip/Chip.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | RelWithDebInfo 14 | x64 15 | 16 | 17 | 18 | {97F7BC82-D588-4012-95AE-7585053A8705} 19 | QtVS_v302 20 | 10.0 21 | $(MSBuildProjectDirectory)\QtMsBuild 22 | 23 | 24 | 25 | StaticLibrary 26 | v143 27 | 28 | 29 | StaticLibrary 30 | v143 31 | 32 | 33 | StaticLibrary 34 | v143 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | Qt 5.12.11 x64 57 | core 58 | 59 | 60 | Qt 5.12.11 x64 61 | core 62 | 63 | 64 | Qt 5.12.11 x64 65 | core 66 | 67 | 68 | 69 | 70 | 71 | 72 | true 73 | Disabled 74 | ProgramDatabase 75 | MultiThreadedDebugDLL 76 | true 77 | CHIP_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 78 | 79 | 80 | Windows 81 | $(OutDir)\$(ProjectName).lib 82 | true 83 | 84 | 85 | 86 | 87 | true 88 | None 89 | MultiThreadedDLL 90 | true 91 | CHIP_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 92 | true 93 | 94 | 95 | Windows 96 | $(OutDir)\$(ProjectName).lib 97 | false 98 | 99 | 100 | 101 | 102 | true 103 | ProgramDatabase 104 | MultiThreadedDLL 105 | true 106 | CHIP_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 107 | 108 | 109 | Windows 110 | $(OutDir)\$(ProjectName).lib 111 | false 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /Chip/Chip.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 14 | qrc;* 15 | false 16 | 17 | 18 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 19 | qrc;* 20 | false 21 | 22 | 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | 34 | 35 | Header Files 36 | 37 | 38 | 39 | 40 | Resource Files 41 | 42 | 43 | -------------------------------------------------------------------------------- /Chip/Resources/img/b12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b12.png -------------------------------------------------------------------------------- /Chip/Resources/img/b13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b13.png -------------------------------------------------------------------------------- /Chip/Resources/img/b14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b14.png -------------------------------------------------------------------------------- /Chip/Resources/img/b15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b15.png -------------------------------------------------------------------------------- /Chip/Resources/img/b16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b16.png -------------------------------------------------------------------------------- /Chip/Resources/img/b17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b17.png -------------------------------------------------------------------------------- /Chip/Resources/img/b18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b18.png -------------------------------------------------------------------------------- /Chip/Resources/img/b19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b19.png -------------------------------------------------------------------------------- /Chip/Resources/img/b20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b20.png -------------------------------------------------------------------------------- /Chip/Resources/img/b21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b21.png -------------------------------------------------------------------------------- /Chip/Resources/img/b22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b22.png -------------------------------------------------------------------------------- /Chip/Resources/img/b23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b23.png -------------------------------------------------------------------------------- /Chip/Resources/img/b24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b24.png -------------------------------------------------------------------------------- /Chip/Resources/img/b25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b25.png -------------------------------------------------------------------------------- /Chip/Resources/img/b26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b26.png -------------------------------------------------------------------------------- /Chip/Resources/img/b27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b27.png -------------------------------------------------------------------------------- /Chip/Resources/img/b28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b28.png -------------------------------------------------------------------------------- /Chip/Resources/img/b29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b29.png -------------------------------------------------------------------------------- /Chip/Resources/img/b30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b30.png -------------------------------------------------------------------------------- /Chip/Resources/img/b31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b31.png -------------------------------------------------------------------------------- /Chip/Resources/img/b32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b32.png -------------------------------------------------------------------------------- /Chip/Resources/img/b33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b33.png -------------------------------------------------------------------------------- /Chip/Resources/img/b34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b34.png -------------------------------------------------------------------------------- /Chip/Resources/img/b35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b35.png -------------------------------------------------------------------------------- /Chip/Resources/img/b36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b36.png -------------------------------------------------------------------------------- /Chip/Resources/img/b37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b37.png -------------------------------------------------------------------------------- /Chip/Resources/img/b38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b38.png -------------------------------------------------------------------------------- /Chip/Resources/img/b39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/b39.png -------------------------------------------------------------------------------- /Chip/Resources/img/icon-acu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/icon-acu.png -------------------------------------------------------------------------------- /Chip/Resources/img/icon-dbk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/icon-dbk.png -------------------------------------------------------------------------------- /Chip/Resources/img/icon-dmg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/icon-dmg.png -------------------------------------------------------------------------------- /Chip/Resources/img/icon-fil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/icon-fil.png -------------------------------------------------------------------------------- /Chip/Resources/img/o12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o12.png -------------------------------------------------------------------------------- /Chip/Resources/img/o13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o13.png -------------------------------------------------------------------------------- /Chip/Resources/img/o14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o14.png -------------------------------------------------------------------------------- /Chip/Resources/img/o15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o15.png -------------------------------------------------------------------------------- /Chip/Resources/img/o16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o16.png -------------------------------------------------------------------------------- /Chip/Resources/img/o17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o17.png -------------------------------------------------------------------------------- /Chip/Resources/img/o18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o18.png -------------------------------------------------------------------------------- /Chip/Resources/img/o19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o19.png -------------------------------------------------------------------------------- /Chip/Resources/img/o20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o20.png -------------------------------------------------------------------------------- /Chip/Resources/img/o21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o21.png -------------------------------------------------------------------------------- /Chip/Resources/img/o22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o22.png -------------------------------------------------------------------------------- /Chip/Resources/img/o23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o23.png -------------------------------------------------------------------------------- /Chip/Resources/img/o24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o24.png -------------------------------------------------------------------------------- /Chip/Resources/img/o25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o25.png -------------------------------------------------------------------------------- /Chip/Resources/img/o26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o26.png -------------------------------------------------------------------------------- /Chip/Resources/img/o27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o27.png -------------------------------------------------------------------------------- /Chip/Resources/img/o28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o28.png -------------------------------------------------------------------------------- /Chip/Resources/img/o29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o29.png -------------------------------------------------------------------------------- /Chip/Resources/img/o30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o30.png -------------------------------------------------------------------------------- /Chip/Resources/img/o31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o31.png -------------------------------------------------------------------------------- /Chip/Resources/img/o32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o32.png -------------------------------------------------------------------------------- /Chip/Resources/img/o33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o33.png -------------------------------------------------------------------------------- /Chip/Resources/img/o34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o34.png -------------------------------------------------------------------------------- /Chip/Resources/img/o35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o35.png -------------------------------------------------------------------------------- /Chip/Resources/img/o36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o36.png -------------------------------------------------------------------------------- /Chip/Resources/img/o37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o37.png -------------------------------------------------------------------------------- /Chip/Resources/img/o38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o38.png -------------------------------------------------------------------------------- /Chip/Resources/img/o39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/Chip/Resources/img/o39.png -------------------------------------------------------------------------------- /Chip/chip_global.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #ifndef BUILD_STATIC 6 | # if defined(CHIP_LIB) 7 | # define CHIP_EXPORT Q_DECL_EXPORT 8 | # else 9 | # define CHIP_EXPORT Q_DECL_IMPORT 10 | # endif 11 | #else 12 | # define CHIP_EXPORT 13 | #endif 14 | 15 | #pragma comment(lib,"Chip.lib") 16 | -------------------------------------------------------------------------------- /ChipDataWindow/ChipDataWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ChipDataWindow.h" 3 | #include "ui_ChipDataWindow.h" 4 | #include "GetChipWindow.h" 5 | #include "CodeX/CodeX.h" 6 | #include "ChipSolver/ChipSolver.h" 7 | #include "ManualInputWindow.h" 8 | 9 | ChipDataWindow::ChipDataWindow(QWidget* parent, Qt::WindowFlags f): 10 | QDialog(parent,f), 11 | ui(new Ui::ChipDataWindow), 12 | getChipWindow(new GetChipWindow(this)), 13 | manualInputWindow_(new ManualInputWindow(this)), 14 | tableModel_(new ChipTableModel(this)), 15 | squadModel_(new ChipTableModel(this)), 16 | tableDelegate_(new ChipTableDelegate(this)), 17 | squadDelegate_(new ChipTableDelegate(this)) 18 | { 19 | ui->setupUi(this); 20 | connect(); 21 | } 22 | 23 | ChipDataWindow::~ChipDataWindow() 24 | { 25 | } 26 | 27 | void ChipDataWindow::init() 28 | { 29 | getChipWindow->init(); 30 | this->ui->tableView->setModel(this->tableModel_); 31 | this->ui->tableView->setItemDelegate(this->tableDelegate_); 32 | this->ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); 33 | this->ui->tableView->verticalHeader()->hide(); 34 | this->ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); 35 | 36 | this->ui->squadTableView->setModel(this->squadModel_); 37 | this->ui->squadTableView->setItemDelegate(this->squadDelegate_); 38 | this->ui->squadTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); 39 | this->ui->squadTableView->verticalHeader()->hide(); 40 | this->ui->squadTableView->setSelectionBehavior(QAbstractItemView::SelectRows); 41 | this->ui->squadTableView->setColumnHidden(0, true); 42 | this->ui->squadTableView->setColumnHidden(2, true); 43 | this->ui->squadTableView->setColumnHidden(8, true); 44 | this->squadModel_->setShowStatus(false); 45 | } 46 | 47 | void ChipDataWindow::recvChipJsonObject(const QJsonObject& object) 48 | { 49 | std::map squadID; 50 | static bool first = true; 51 | if (object.contains("squad_with_user_info")) 52 | { 53 | auto squads = object["squad_with_user_info"].toObject(); 54 | for (const auto& it : squads) 55 | { 56 | auto obj = it.toObject(); 57 | squadID[obj["id"].toString().toInt()] = obj["squad_id"].toString().toInt(); 58 | } 59 | } 60 | 61 | auto& chips = CodeX::instance()->chips; 62 | auto& gridChips = CodeX::instance()->gridChips; 63 | auto& squadChips = CodeX::instance()->squadChips; 64 | squadChips.clear(); 65 | gridChips.clear(); 66 | chips = getChips(object["chip_with_user_info"].toObject()); 67 | for(auto i = 0;i < chips.size();++i) 68 | { 69 | auto& chip = chips[i]; 70 | chip.no = i + 1; 71 | if(chip.squad > 0) 72 | { 73 | chip.squad = squadID[chip.squad]; 74 | squadChips[chip.squad].push_back(chip); 75 | } 76 | // 拷贝一份+20 77 | auto t = chip; 78 | t.no = i; 79 | t.level = 20; 80 | t.calcValue(); 81 | gridChips[t.color][t.gridID].push_back(t); 82 | } 83 | this->tableModel_->setChips(chips); 84 | this->ui->squadComboBox->setCurrentIndex(1); 85 | this->ui->squadComboBox->setCurrentIndex(0); 86 | if (!first)// 第一次是从配置读取数据,不算修改芯片 87 | emit chipsChanged(); 88 | first = false; 89 | } 90 | 91 | void ChipDataWindow::squadChanged(int index) 92 | { 93 | const auto& chips = CodeX::instance()->squadChips[index + 1]; 94 | this->squadModel_->setChips(chips); 95 | GFChip sum, max; 96 | for(auto chip : chips) 97 | { 98 | sum += chip; 99 | chip.level = 20; 100 | chip.calcValue(); 101 | max += chip; 102 | } 103 | auto M = CodeX::instance()->solver_->squadMaxValue(this->ui->squadComboBox->currentText()); 104 | this->ui->damageLabel->setText(trUtf8(u8"杀伤:") + QString("%1/%2/%3/%4").arg(sum.damageValue).arg(max.damageValue).arg(std::min(0, max.damageValue - M.damageValue)).arg(sum.damageBlock)); 105 | this->ui->dbkLabel->setText(trUtf8(u8"破防:") + QString("%1/%2/%3/%4").arg(sum.defbreakValue).arg(max.defbreakValue).arg(std::min(0, max.defbreakValue - M.defbreakValue)).arg(sum.defbreakBlock)); 106 | this->ui->hitLabel->setText(trUtf8(u8"精度:") + QString("%1/%2/%3/%4").arg(sum.hitValue).arg(max.hitValue).arg(std::min(0, max.hitValue - M.hitValue)).arg(sum.hitBlock)); 107 | this->ui->reloadLabel->setText(trUtf8(u8"装填:") + QString("%1/%2/%3/%4").arg(sum.reloadValue).arg(max.reloadValue).arg(std::min(0, max.reloadValue - M.reloadValue)).arg(sum.reloadBlock)); 108 | } 109 | 110 | void ChipDataWindow::importChipJson() 111 | { 112 | auto filename = QFileDialog::getOpenFileName(this, u8"打开芯片数据JSON", "", "JSON (*.json)"); 113 | if(filename.isEmpty()) 114 | return; 115 | QFile file(filename); 116 | if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) 117 | { 118 | QMessageBox::warning(this, u8"错误", u8"打开文件失败"); 119 | return; 120 | } 121 | auto data = file.readAll(); 122 | for (auto i = 0; i < 2; ++i) 123 | { 124 | QJsonParseError jsonError; 125 | QJsonDocument doucment = QJsonDocument::fromJson(data, &jsonError); // 转化为 JSON 文档 126 | if (!doucment.isNull() && jsonError.error == QJsonParseError::NoError && doucment.isObject()) 127 | { // 解析未发生错误 JSON 文档为对象 128 | auto obj = doucment.object(); 129 | if (obj.contains("squad_with_user_info") && obj.contains("chip_with_user_info")) 130 | { 131 | try 132 | { 133 | recvChipJsonObject(obj); 134 | QSettings settings; 135 | settings.setValue("/User/Chip", data); 136 | } 137 | catch (const std::exception& e) 138 | { 139 | QMessageBox::warning(this, u8"错误", QString(u8"解析JSON失败!\n") + e.what()); 140 | return; 141 | } 142 | } 143 | QMessageBox::information(this, u8"成功", u8"导入芯片数据成功!"); 144 | } 145 | else if(jsonError.error == QJsonParseError::IllegalUTF8String) 146 | { 147 | data = QString::fromLocal8Bit(data).toUtf8(); 148 | } 149 | else 150 | { 151 | QMessageBox::warning(this, u8"错误", QString(u8"解析JSON失败!\n")); 152 | } 153 | } 154 | } 155 | 156 | void ChipDataWindow::connect() 157 | { 158 | QObject::connect( 159 | this->ui->getDataPushButton, 160 | &QPushButton::clicked, 161 | this->getChipWindow, 162 | &GetChipWindow::show 163 | ); 164 | QObject::connect( 165 | this->ui->importDataPushButton, 166 | &QPushButton::clicked, 167 | this, 168 | &ChipDataWindow::importChipJson 169 | ); 170 | QObject::connect( 171 | this->getChipWindow, 172 | &GetChipWindow::sendChipJsonObject, 173 | this, 174 | &ChipDataWindow::recvChipJsonObject 175 | ); 176 | QObject::connect( 177 | this->ui->squadComboBox, 178 | static_cast(&QComboBox::currentIndexChanged), 179 | this, 180 | &ChipDataWindow::squadChanged 181 | ); 182 | QObject::connect( 183 | this->ui->importCodePushButton, 184 | &QPushButton::clicked, 185 | this->manualInputWindow_, 186 | &ManualInputWindow::show 187 | ); 188 | QObject::connect( 189 | this->manualInputWindow_, 190 | &ManualInputWindow::sendChipJsonObject, 191 | this, 192 | &ChipDataWindow::recvChipJsonObject 193 | ); 194 | } 195 | -------------------------------------------------------------------------------- /ChipDataWindow/ChipDataWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "chipdatawindow_global.h" 4 | #include 5 | #include 6 | #include "ChipTableView/ChipTableView.h" 7 | 8 | namespace Ui { class ChipDataWindow; } 9 | class GetChipWindow; 10 | class ManualInputWindow; 11 | 12 | class CHIPDATAWINDOW_EXPORT ChipDataWindow : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit ChipDataWindow(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); 18 | ~ChipDataWindow(); 19 | 20 | void init(); 21 | 22 | signals: 23 | // 芯片数据更新了 24 | void chipsChanged(); 25 | 26 | public slots: 27 | void recvChipJsonObject(const QJsonObject& object); 28 | 29 | private slots: 30 | void squadChanged(int index); 31 | 32 | void importChipJson(); 33 | 34 | private: 35 | void connect(); 36 | 37 | Ui::ChipDataWindow* ui; 38 | GetChipWindow* getChipWindow; 39 | ManualInputWindow* manualInputWindow_; 40 | ChipTableModel* tableModel_; 41 | ChipTableModel* squadModel_; 42 | ChipTableDelegate* tableDelegate_; 43 | ChipTableDelegate* squadDelegate_; 44 | }; 45 | -------------------------------------------------------------------------------- /ChipDataWindow/ChipDataWindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ChipDataWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 955 10 | 450 11 | 12 | 13 | 14 | 15 | 等线 16 | 14 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 | BGM-71 58 | 59 | 60 | 61 | 62 | AGS-30 63 | 64 | 65 | 66 | 67 | 2B14 68 | 69 | 70 | 71 | 72 | M2 73 | 74 | 75 | 76 | 77 | AT4 78 | 79 | 80 | 81 | 82 | QLZ-04 83 | 84 | 85 | 86 | 87 | Mk-153 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 杀伤: 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 10 107 | 108 | 109 | 110 | 当前/满强/偏差/格数 111 | 112 | 113 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | Qt::Horizontal 126 | 127 | 128 | 129 | 40 130 | 20 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 0 140 | 0 141 | 142 | 143 | 144 | 145 | 等线 146 | 12 147 | 148 | 149 | 150 | 151 | 获取芯片数据 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | Qt::Horizontal 160 | 161 | 162 | 163 | 40 164 | 20 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 0 174 | 0 175 | 176 | 177 | 178 | 179 | 等线 180 | 12 181 | 182 | 183 | 184 | 185 | 从JSON导入 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | Qt::Horizontal 194 | 195 | 196 | 197 | 40 198 | 20 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 0 208 | 0 209 | 210 | 211 | 212 | 213 | 等线 214 | 12 215 | 216 | 217 | 218 | 219 | 手动输入 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | Qt::Horizontal 228 | 229 | 230 | 231 | 40 232 | 20 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | -------------------------------------------------------------------------------- /ChipDataWindow/ChipDataWindow.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 14 | qrc;* 15 | false 16 | 17 | 18 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 19 | qrc;* 20 | false 21 | 22 | 23 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3} 24 | ui 25 | true 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | 43 | 44 | Header Files 45 | 46 | 47 | 48 | 49 | Header Files 50 | 51 | 52 | 53 | 54 | Form Files 55 | 56 | 57 | Form Files 58 | 59 | 60 | Form Files 61 | 62 | 63 | 64 | 65 | Header Files 66 | 67 | 68 | Header Files 69 | 70 | 71 | Header Files 72 | 73 | 74 | -------------------------------------------------------------------------------- /ChipDataWindow/GetChipWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "chipdatawindow_global.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace Ui { class GetChipWindow; }; 11 | class ChipDataWindow; 12 | 13 | class CHIPDATAWINDOW_EXPORT GetChipWindow : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | GetChipWindow(QWidget *parent = Q_NULLPTR); 19 | ~GetChipWindow(); 20 | 21 | void init(); 22 | 23 | signals: 24 | void sendChipJsonObject(const QJsonObject& object); 25 | 26 | protected slots: 27 | // 设置本地代理,显示提示,开启代理程序 28 | void setLocalProxy(); 29 | // 设置网络代理,显示提示 30 | void setNetProxy(); 31 | // 获取数据,异步 32 | void getData(); 33 | 34 | // 从服务器接受到数据 35 | void recvData(QNetworkReply* reply); 36 | 37 | // 子线程错误 38 | void processError(QProcess::ProcessError error); 39 | void processExit(int code); 40 | // 子线程数据可读 41 | void processDataReady(); 42 | // 启动本地代理 43 | void startLocalProxy(); 44 | 45 | void closeEvent(QCloseEvent*) override; 46 | 47 | private: 48 | void connect(); 49 | // 解析从服务器或者保存的配置中读取的芯片信息 50 | bool parseChipData(const QByteArray& data); 51 | 52 | // 杀死已经存在的进程 53 | void killProcess(); 54 | 55 | Ui::GetChipWindow *ui; 56 | QNetworkRequest* request_; 57 | QNetworkAccessManager* accessManager_; 58 | QProcess* process_; 59 | QString localProxyAddr_, localProxyPort_; 60 | }; 61 | -------------------------------------------------------------------------------- /ChipDataWindow/GetChipWindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | GetChipWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 369 10 | 472 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 369 22 | 472 23 | 24 | 25 | 26 | 27 | 等线 28 | 12 29 | 30 | 31 | 32 | 获取芯片数据 33 | 34 | 35 | 36 | 37 | 38 | 39 | 0 40 | 0 41 | 42 | 43 | 44 | 用户信息 45 | 46 | 47 | 48 | 49 | 50 | UID 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 | 0 86 | 0 87 | 88 | 89 | 90 | 代理信息 91 | 92 | 93 | 94 | 95 | 96 | true 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 启动 106 | 107 | 108 | 109 | 110 | 111 | 112 | true 113 | 114 | 115 | 116 | 0 117 | 0 118 | 119 | 120 | 121 | 本地代理 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 0 130 | 0 131 | 132 | 133 | 134 | 网络代理 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 0 145 | 0 146 | 147 | 148 | 149 | 说明: 150 | 151 | 152 | 153 | 154 | 155 | true 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 代理端口: 165 | 166 | 167 | 168 | 169 | 170 | 171 | 10000 172 | 173 | 174 | 65535 175 | 176 | 177 | 18888 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 获取数据 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /ChipDataWindow/ManualInputWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ManualInputWindow.h" 3 | #include "ui_ManualInputWindow.h" 4 | 5 | ManualInputWindow::ManualInputWindow(QWidget *parent) 6 | : QDialog(parent), ui(new Ui::ManualInputWindow()) 7 | { 8 | ui->setupUi(this); 9 | QObject::connect(this->ui->buttonBox, &QDialogButtonBox::accepted, this, &ManualInputWindow::onConfirm); 10 | QObject::connect(this->ui->buttonBox, &QDialogButtonBox::rejected, this, &ManualInputWindow::onCancel); 11 | } 12 | 13 | ManualInputWindow::~ManualInputWindow() 14 | { 15 | delete ui; 16 | } 17 | 18 | void ManualInputWindow::onConfirm() 19 | { 20 | Chips chips; 21 | auto code = this->ui->inputTextEdit->toPlainText().trimmed(); 22 | if (code.isEmpty()) 23 | { 24 | this->accept(); 25 | return; 26 | } 27 | if (code2Chips(code, chips)) 28 | { 29 | QJsonObject obj; 30 | QJsonObject chipObj; 31 | for (auto& chip : chips) 32 | { 33 | chipObj[QString::number(chip.id)] = chip.toObject(); 34 | } 35 | obj["chip_with_user_info"] = chipObj; 36 | emit sendChipJsonObject(obj); 37 | QSettings settings; // 解析成功则保存数据 38 | settings.setValue("/User/Chip", QJsonDocument(obj).toJson()); 39 | this->accept(); 40 | } 41 | else 42 | { 43 | QMessageBox::warning(this, u8"错误", u8"错误的芯片代码!"); 44 | } 45 | } 46 | 47 | void ManualInputWindow::onCancel() 48 | { 49 | this->reject(); 50 | } 51 | 52 | bool ManualInputWindow::code2Chips(const QString& inputCode, Chips& outChips) 53 | { 54 | auto innerStr = inputCode.trimmed(); 55 | if (innerStr.isEmpty() || innerStr.length() < 10) 56 | return false; 57 | if (innerStr.front() != '[' || innerStr.back() != ']') 58 | return false; 59 | if (innerStr[2] != '!' || innerStr[innerStr.length() - 3] != '?') 60 | return false; 61 | innerStr = innerStr.split("!").back().split("?").front(); 62 | auto chipCodes = innerStr.split("&", QString::SkipEmptyParts); 63 | std::vector chips; 64 | chips.reserve(chipCodes.size()); 65 | for (auto& str : chipCodes) 66 | { 67 | auto chip = GFChip::fromHycdesCode(str); 68 | if(chip.id < 0) 69 | return false; 70 | chips.push_back(std::move(chip)); 71 | } 72 | outChips = std::move(chips); 73 | 74 | return true; 75 | } 76 | -------------------------------------------------------------------------------- /ChipDataWindow/ManualInputWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Chip/Chip.h" 5 | namespace Ui { class ManualInputWindow; }; 6 | 7 | class ManualInputWindow : public QDialog 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | ManualInputWindow(QWidget *parent = Q_NULLPTR); 13 | ~ManualInputWindow(); 14 | 15 | signals: 16 | void sendChipJsonObject(const QJsonObject& object); 17 | 18 | protected slots: 19 | void onConfirm(); 20 | void onCancel(); 21 | bool code2Chips(const QString& inputCode, Chips& outChips); 22 | 23 | private: 24 | Ui::ManualInputWindow *ui; 25 | }; 26 | -------------------------------------------------------------------------------- /ChipDataWindow/ManualInputWindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ManualInputWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 等线 16 | 12 17 | 18 | 19 | 20 | 手动输入芯片 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 0 31 | 0 32 | 33 | 34 | 35 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 36 | 37 | 38 | 39 | 40 | 41 | 42 | <html><head/><body><p>在<a href="https://hycdes.com/pages/GFT_ChipCal.html"><span style=" text-decoration: underline; color:#0000ff;">乐章工具站</span></a>手动录入芯片后,点击【存储数据】,将代码拷贝至下方输入框,点确定即可。</p></body></html> 43 | 44 | 45 | true 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /ChipDataWindow/chipdatawindow_global.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma warning(disable:26812) 3 | #include 4 | 5 | #ifndef BUILD_STATIC 6 | # if defined(CHIPDATAWINDOW_LIB) 7 | # define CHIPDATAWINDOW_EXPORT Q_DECL_EXPORT 8 | # else 9 | # define CHIPDATAWINDOW_EXPORT Q_DECL_IMPORT 10 | # endif 11 | #else 12 | # define CHIPDATAWINDOW_EXPORT 13 | #endif 14 | 15 | #pragma comment(lib,"ChipDataWindow.lib") 16 | -------------------------------------------------------------------------------- /ChipDataWindow/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | -------------------------------------------------------------------------------- /ChipDataWindow/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ChipView/ChipView.h" 3 | #include "gzip/decompress.hpp" 4 | #include "gzip/utils.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include -------------------------------------------------------------------------------- /ChipSolver/ChipSolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "chipsolver_global.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "Chip/Chip.h" 15 | 16 | struct CHIPSOLVER_EXPORT TargetBlock 17 | { 18 | // 伤害格数 19 | int damageBlock; 20 | // 破防格数 21 | int defbreakBlock; 22 | // 精度格数 23 | int hitBlock; 24 | // 装填格数 25 | int reloadBlock; 26 | // 偏差格数 27 | int error; 28 | // 最大显示方案数量 29 | int showNumber; 30 | // 最大计算方案数量 31 | int maxNumber; 32 | 33 | explicit TargetBlock(int dmg = 0, int dbk = 0, int hit = 0, int r = 0, int e = 0, int u = 1e3,int m = 1e9) : 34 | damageBlock(dmg), defbreakBlock(dbk), hitBlock(hit), reloadBlock(r), error(e), showNumber(u),maxNumber(m) 35 | {} 36 | }; 37 | template , class _Pr = std::less> 38 | class priority_queue:public std::priority_queue<_Ty, _Container, _Pr> 39 | { 40 | public: 41 | const _Container& getContainer() const 42 | { 43 | return this->c; 44 | } 45 | }; 46 | 47 | class CHIPSOLVER_EXPORT ChipSolver : public QThread 48 | { 49 | Q_OBJECT 50 | public: 51 | explicit ChipSolver(QObject* parent = nullptr); 52 | virtual ~ChipSolver() = default; 53 | 54 | SquadSolution solutions; 55 | 56 | // 重装列表 57 | QStringList squadList() const; 58 | // 该重装的方案列表,同时会设置成当前重装 59 | QStringList configList(const QString& squad); 60 | // 返回该重装的最大属性 61 | GFChip squadMaxValue(const QString& squad); 62 | 63 | // 将一个方案转为可显示的图形信息 64 | ChipViewInfo solution2ChipView(const Solution& solution, const QString& squad = ""); 65 | 66 | public slots: 67 | // 设置目标格数 68 | void setTargetBlock(const TargetBlock& block); 69 | // 设置目标的配置方案 70 | void setTargetConfig(const QString& name); 71 | void setUseEquipped(bool b); 72 | void setUseLocked(bool b); 73 | void setUseAlt(bool b); 74 | void stop(); 75 | 76 | signals: 77 | // 解决方案百分比 78 | void solvePercentChanged(int percent); 79 | // 总方案数 80 | void solveNumberChanged(long long number); 81 | 82 | protected: 83 | void run() override; 84 | 85 | private: 86 | // 一组配置 87 | typedef std::vector Config; 88 | // 一个重装的所有配置 89 | struct SquadConfig 90 | { 91 | std::vector configs; 92 | // 总格数 93 | int blocks = 38; 94 | // 可空格数 95 | int optional = 0; 96 | // 颜色 97 | int color; 98 | // 旋转对称,0为不对称,>0为需要旋转几次 99 | int palindrome; 100 | // 最大属性 101 | GFChip maxValue; 102 | }; 103 | // 所有配置方案,以名称为key 104 | std::map> configs_; 105 | // 所有重装的最大值 106 | std::map maxValues_; 107 | // 重装和配置方案记录信息 108 | QJsonObject configInfo_; 109 | // 重装的基本格子 110 | std::map squadView_; 111 | // 目标重装 112 | QString targetSquadName_; 113 | // 目标方案 114 | QString targetConfigName_; 115 | // 目标格数 116 | TargetBlock targetBlock_; 117 | // 临时记录目标 118 | TargetBlock tmpTarget_; 119 | // 临时记录方案 120 | Solution tmpSolution_; 121 | // 临时选择的方案 122 | Config tmpConfig_; 123 | // 临时选择的重装方案 124 | SquadConfig tmpSquadConfig_; 125 | // 去重用set 126 | std::set> solutionSet_; 127 | // 上一次上报的求解数量 128 | std::atomic_int64_t lastSolveNumber_{}; 129 | // 方案数 130 | std::atomic_int64_t tmpSolutionNumber_{}; 131 | // 百分比 132 | std::atomic_int percent; 133 | // 当前配置序号 134 | std::atomic_int configIndex_; 135 | // 锁 136 | //std::mutex configIndexLock_; 137 | // 使用已装备 138 | bool useEquipped_; 139 | // 使用已锁定 140 | bool useLocked_; 141 | // 使用备选 142 | bool useAlt_; 143 | // 运行标志,用于停止解算 144 | bool running_; 145 | bool solveRunning_; 146 | // 当前芯片 147 | std::vector tmpChips_; 148 | 149 | //检查当前芯片数量是否满足该拼法最低需要 150 | bool satisfyConfig(const Config& config); 151 | // 检查芯片方案是否满足目标的格数溢出要求,只计算上溢,溢出返回true 152 | bool checkOverflow(const TargetBlock& target, const GFChip& chips, const GFChip& add) const; 153 | 154 | struct SolverParam 155 | { 156 | int k; 157 | // 临时记录方案 158 | Solution solution; 159 | // 选择的方案 160 | Config config; 161 | // 当前芯片列表,用于去重 162 | std::vector curChips; 163 | // 去重用set 164 | std::set> solutionSet; 165 | // 芯片列表 166 | Chips chips; 167 | // 外层按颜色分类,内层按grid编号分类的芯片,保存强制+20的属性 168 | std::map>> gridChips; 169 | // 优先级队列 170 | std::shared_ptr> queue; 171 | 172 | SolverParam() 173 | { 174 | k = 0; 175 | } 176 | }; 177 | void findSolution(SolverParam& param); 178 | void startSolve(); 179 | // 各个线程给出的结果的队列 180 | std::queue>> thSolutionQueue_; 181 | // 锁 182 | std::mutex queueMutex_; 183 | std::condition_variable queueCV_; 184 | std::function chipUsedFunc; 185 | void merge(); 186 | std::vector threads_; 187 | }; 188 | -------------------------------------------------------------------------------- /ChipSolver/ChipSolver.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Resources/2B14.json 4 | Resources/2B14-result.json 5 | Resources/AGS-30.json 6 | Resources/AGS-30-result.json 7 | Resources/AT4.json 8 | Resources/AT4-5-result.json 9 | Resources/AT4-6-result.json 10 | Resources/BGM-71.json 11 | Resources/BGM-71-result.json 12 | Resources/M2.json 13 | Resources/M2-5-0-result.json 14 | Resources/M2-5-2-result.json 15 | Resources/M2-5-3-result.json 16 | Resources/M2-6-2-result.json 17 | Resources/QLZ-04.json 18 | Resources/QLZ-04-result.json 19 | Resources/squads.json 20 | Resources/2B14-52-result.json 21 | Resources/Mk-153.json 22 | Resources/Mk-153-52-result.json 23 | Resources/Mk-153-result.json 24 | Resources/PP-93.json 25 | Resources/PP-93-2-result.json 26 | Resources/PP-93-4-result.json 27 | Resources/PP-93-result.json 28 | Resources/Mk-47.json 29 | Resources/Mk-47-result.json 30 | 31 | 32 | -------------------------------------------------------------------------------- /ChipSolver/ChipSolver.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | RelWithDebInfo 14 | x64 15 | 16 | 17 | 18 | {70EF6B71-DBD0-4868-845B-F1690A5D671C} 19 | QtVS_v302 20 | 10.0 21 | $(MSBuildProjectDirectory)\QtMsBuild 22 | 23 | 24 | 25 | StaticLibrary 26 | v143 27 | 28 | 29 | StaticLibrary 30 | v143 31 | 32 | 33 | StaticLibrary 34 | v143 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | $(SolutionDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); 54 | 55 | 56 | $(SolutionDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); 57 | 58 | 59 | $(SolutionDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); 60 | 61 | 62 | 63 | 64 | 65 | Qt 5.12.11 x64 66 | core;gui 67 | 68 | 69 | Qt 5.12.11 x64 70 | core;gui 71 | 72 | 73 | Qt 5.12.11 x64 74 | core;gui 75 | 76 | 77 | 78 | 79 | 80 | 81 | true 82 | Disabled 83 | ProgramDatabase 84 | MultiThreadedDebugDLL 85 | true 86 | CHIPSOLVER_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 87 | 88 | 89 | Windows 90 | $(OutDir)\$(ProjectName).lib 91 | true 92 | 93 | 94 | 95 | 96 | true 97 | None 98 | MultiThreadedDLL 99 | true 100 | CHIPSOLVER_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 101 | true 102 | 103 | 104 | Windows 105 | $(OutDir)\$(ProjectName).lib 106 | false 107 | 108 | 109 | 110 | 111 | true 112 | 113 | 114 | MultiThreadedDLL 115 | true 116 | CHIPSOLVER_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 117 | 118 | 119 | Windows 120 | $(OutDir)\$(ProjectName).lib 121 | false 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /ChipSolver/ChipSolver.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 14 | qrc;* 15 | false 16 | 17 | 18 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 19 | qrc;* 20 | false 21 | 22 | 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | 34 | 35 | Resource Files 36 | 37 | 38 | 39 | 40 | Header Files 41 | 42 | 43 | -------------------------------------------------------------------------------- /ChipSolver/Resources/2B14.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "2B14", 3 | "optional": { 4 | "6格+5格1类": 0, 5 | "带5格2类": 0 6 | }, 7 | "width": 8, 8 | "height": 6, 9 | "blocks": 32, 10 | "color": 1, 11 | "palindrome": 2, 12 | "map": [ 13 | "11011011", 14 | "10000001", 15 | "00000000", 16 | "00000000", 17 | "10000001", 18 | "11011011" 19 | ], 20 | "MaxBlocks": { 21 | "damage": 20, 22 | "def_break": 2, 23 | "hit": 4, 24 | "reload": 6 25 | }, 26 | "MaxValues": { 27 | "damage": 227, 28 | "def_break": 58, 29 | "hit": 80, 30 | "reload": 90 31 | } 32 | } -------------------------------------------------------------------------------- /ChipSolver/Resources/AGS-30.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AGS-30", 3 | "optional": { 4 | "AGS-30": 0 5 | }, 6 | "width": 8, 7 | "height": 8, 8 | "blocks": 38, 9 | "color": 1, 10 | "palindrome" : 2, 11 | "map": [ 12 | "11001111", 13 | "10000111", 14 | "00000011", 15 | "00000001", 16 | "10000000", 17 | "11000000", 18 | "11100001", 19 | "11110011" 20 | ], 21 | "MaxBlocks": { 22 | "damage": 10, 23 | "def_break": 5, 24 | "hit": 7, 25 | "reload": 16 26 | }, 27 | "MaxValues": { 28 | "damage": 106, 29 | "def_break": 130, 30 | "hit": 120, 31 | "reload": 233 32 | } 33 | } -------------------------------------------------------------------------------- /ChipSolver/Resources/AT4-6-result.json: -------------------------------------------------------------------------------- 1 | [[{"ID":31,"rotate":3,"x":1,"y":0},{"ID":31,"rotate":0,"x":4,"y":0},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":31,"rotate":2,"x":1,"y":5},{"ID":31,"rotate":1,"x":4,"y":5}],[{"ID":32,"rotate":0,"x":2,"y":0},{"ID":37,"rotate":0,"x":1,"y":2},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":31,"rotate":2,"x":1,"y":5},{"ID":31,"rotate":1,"x":4,"y":5}],[{"ID":32,"rotate":0,"x":2,"y":0},{"ID":37,"rotate":0,"x":1,"y":2},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":37,"rotate":0,"x":1,"y":5},{"ID":32,"rotate":2,"x":2,"y":6}],[{"ID":33,"rotate":1,"x":2,"y":0},{"ID":31,"rotate":0,"x":4,"y":0},{"ID":32,"rotate":3,"x":0,"y":2},{"ID":34,"rotate":1,"x":2,"y":4},{"ID":31,"rotate":1,"x":4,"y":5},{"ID":30,"rotate":1,"x":5,"y":3}],[{"ID":32,"rotate":0,"x":2,"y":0},{"ID":38,"rotate":2,"x":2,"y":2},{"ID":32,"rotate":3,"x":0,"y":2},{"ID":32,"rotate":1,"x":6,"y":2},{"ID":38,"rotate":0,"x":2,"y":4},{"ID":32,"rotate":2,"x":2,"y":6}],[{"ID":33,"rotate":1,"x":2,"y":0},{"ID":34,"rotate":1,"x":4,"y":0},{"ID":32,"rotate":3,"x":0,"y":2},{"ID":32,"rotate":1,"x":6,"y":2},{"ID":38,"rotate":0,"x":2,"y":4},{"ID":32,"rotate":2,"x":2,"y":6}],[{"ID":33,"rotate":1,"x":2,"y":0},{"ID":34,"rotate":1,"x":4,"y":0},{"ID":32,"rotate":3,"x":0,"y":2},{"ID":32,"rotate":1,"x":6,"y":2},{"ID":34,"rotate":1,"x":2,"y":4},{"ID":33,"rotate":1,"x":4,"y":4}]] -------------------------------------------------------------------------------- /ChipSolver/Resources/AT4.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AT4", 3 | "optional": { 4 | "AT4": 0 5 | }, 6 | "width": 8, 7 | "height": 8, 8 | "blocks": 36, 9 | "color": 2, 10 | "palindrome" : 1, 11 | "map": [ 12 | "11100111", 13 | "11000011", 14 | "10000001", 15 | "00011000", 16 | "00011000", 17 | "10000001", 18 | "11000011", 19 | "11100111" 20 | ], 21 | "MaxBlocks": { 22 | "damage": 14, 23 | "def_break": 8, 24 | "hit": 9, 25 | "reload": 5 26 | }, 27 | "MaxValues": { 28 | "damage": 166, 29 | "def_break": 261, 30 | "hit": 174, 31 | "reload": 75 32 | } 33 | } -------------------------------------------------------------------------------- /ChipSolver/Resources/BGM-71.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BGM-71", 3 | "optional": { 4 | "BGM-71": 0 5 | }, 6 | "width": 6, 7 | "height": 6, 8 | "blocks": 36, 9 | "color": 2, 10 | "palindrome" : 1, 11 | "map": [ 12 | "000000", 13 | "000000", 14 | "000000", 15 | "000000", 16 | "000000", 17 | "000000" 18 | ], 19 | "MaxBlocks": { 20 | "damage": 16, 21 | "def_break": 10, 22 | "hit": 7, 23 | "reload": 3 24 | }, 25 | "MaxValues": { 26 | "damage": 189, 27 | "def_break": 328, 28 | "hit": 140, 29 | "reload": 45 30 | } 31 | } -------------------------------------------------------------------------------- /ChipSolver/Resources/M2-5-0-result.json: -------------------------------------------------------------------------------- 1 | [[{"ID":13,"rotate":3,"x":0,"y":0},{"ID":31,"rotate":3,"x":5,"y":0},{"ID":31,"rotate":1,"x":0,"y":5},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":29,"rotate":1,"x":2,"y":1},{"ID":24,"rotate":3,"x":1,"y":3},{"ID":17,"rotate":1,"x":4,"y":3}],[{"ID":13,"rotate":3,"x":0,"y":0},{"ID":31,"rotate":3,"x":5,"y":0},{"ID":31,"rotate":1,"x":0,"y":5},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":22,"rotate":2,"x":3,"y":1},{"ID":27,"rotate":0,"x":1,"y":2},{"ID":17,"rotate":1,"x":4,"y":3}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":31,"rotate":1,"x":0,"y":5},{"ID":31,"rotate":0,"x":5,"y":5},{"ID":22,"rotate":0,"x":3,"y":3},{"ID":17,"rotate":1,"x":1,"y":2},{"ID":26,"rotate":0,"x":4,"y":2}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":31,"rotate":3,"x":5,"y":0},{"ID":13,"rotate":2,"x":0,"y":5},{"ID":31,"rotate":0,"x":5,"y":5},{"ID":27,"rotate":2,"x":3,"y":4},{"ID":20,"rotate":1,"x":3,"y":2},{"ID":24,"rotate":2,"x":1,"y":2}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":31,"rotate":1,"x":0,"y":5},{"ID":31,"rotate":0,"x":5,"y":5},{"ID":27,"rotate":2,"x":3,"y":4},{"ID":25,"rotate":1,"x":3,"y":2},{"ID":17,"rotate":1,"x":1,"y":2}],[{"ID":13,"rotate":3,"x":0,"y":0},{"ID":31,"rotate":3,"x":5,"y":0},{"ID":33,"rotate":1,"x":0,"y":4},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":29,"rotate":1,"x":2,"y":1},{"ID":27,"rotate":1,"x":2,"y":3},{"ID":17,"rotate":1,"x":4,"y":3}],[{"ID":13,"rotate":3,"x":0,"y":0},{"ID":33,"rotate":1,"x":6,"y":0},{"ID":31,"rotate":1,"x":0,"y":5},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":29,"rotate":1,"x":2,"y":1},{"ID":20,"rotate":0,"x":4,"y":2},{"ID":24,"rotate":3,"x":1,"y":3}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":31,"rotate":1,"x":0,"y":5},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":27,"rotate":0,"x":1,"y":2},{"ID":22,"rotate":0,"x":3,"y":2},{"ID":24,"rotate":0,"x":5,"y":2}],[{"ID":13,"rotate":3,"x":0,"y":0},{"ID":33,"rotate":1,"x":6,"y":0},{"ID":31,"rotate":1,"x":0,"y":5},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":22,"rotate":2,"x":3,"y":1},{"ID":27,"rotate":0,"x":1,"y":2},{"ID":20,"rotate":0,"x":4,"y":2}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":33,"rotate":1,"x":0,"y":4},{"ID":31,"rotate":0,"x":5,"y":5},{"ID":22,"rotate":0,"x":3,"y":3},{"ID":20,"rotate":2,"x":2,"y":2},{"ID":26,"rotate":0,"x":4,"y":2}],[{"ID":13,"rotate":3,"x":0,"y":0},{"ID":31,"rotate":3,"x":5,"y":0},{"ID":33,"rotate":1,"x":0,"y":4},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":22,"rotate":2,"x":3,"y":1},{"ID":25,"rotate":2,"x":2,"y":2},{"ID":17,"rotate":1,"x":4,"y":3}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":33,"rotate":1,"x":6,"y":0},{"ID":13,"rotate":2,"x":0,"y":5},{"ID":31,"rotate":0,"x":5,"y":5},{"ID":27,"rotate":2,"x":3,"y":4},{"ID":15,"rotate":2,"x":3,"y":2},{"ID":24,"rotate":2,"x":1,"y":2}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":33,"rotate":1,"x":0,"y":4},{"ID":31,"rotate":0,"x":5,"y":5},{"ID":27,"rotate":2,"x":3,"y":4},{"ID":25,"rotate":1,"x":3,"y":2},{"ID":20,"rotate":2,"x":2,"y":2}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":31,"rotate":1,"x":0,"y":5},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":17,"rotate":1,"x":1,"y":2},{"ID":26,"rotate":0,"x":4,"y":2},{"ID":21,"rotate":3,"x":3,"y":3}],[{"ID":13,"rotate":3,"x":0,"y":0},{"ID":33,"rotate":1,"x":6,"y":0},{"ID":33,"rotate":1,"x":0,"y":4},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":29,"rotate":1,"x":2,"y":1},{"ID":20,"rotate":0,"x":4,"y":2},{"ID":27,"rotate":1,"x":2,"y":3}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":33,"rotate":1,"x":0,"y":4},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":25,"rotate":2,"x":2,"y":2},{"ID":22,"rotate":0,"x":3,"y":2},{"ID":24,"rotate":0,"x":5,"y":2}],[{"ID":13,"rotate":3,"x":0,"y":0},{"ID":33,"rotate":1,"x":6,"y":0},{"ID":33,"rotate":1,"x":0,"y":4},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":22,"rotate":2,"x":3,"y":1},{"ID":25,"rotate":2,"x":2,"y":2},{"ID":20,"rotate":0,"x":4,"y":2}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":33,"rotate":1,"x":0,"y":4},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":20,"rotate":2,"x":2,"y":2},{"ID":26,"rotate":0,"x":4,"y":2},{"ID":21,"rotate":3,"x":3,"y":3}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":13,"rotate":2,"x":0,"y":5},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":24,"rotate":2,"x":1,"y":2},{"ID":34,"rotate":1,"x":3,"y":2},{"ID":24,"rotate":0,"x":5,"y":2}],[{"ID":33,"rotate":0,"x":0,"y":0},{"ID":13,"rotate":0,"x":6,"y":0},{"ID":13,"rotate":2,"x":0,"y":5},{"ID":33,"rotate":0,"x":4,"y":6},{"ID":24,"rotate":2,"x":1,"y":2},{"ID":22,"rotate":2,"x":3,"y":2},{"ID":36,"rotate":3,"x":4,"y":2}]] -------------------------------------------------------------------------------- /ChipSolver/Resources/M2.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "M2", 3 | "optional": { 4 | "只用6格-空2格": 1, 5 | "使用5格-填满": 3, 6 | "使用5格-空2格": 1 7 | }, 8 | "width": 8, 9 | "height": 8, 10 | "blocks": 38, 11 | "color": 2, 12 | "palindrome" : 2, 13 | "map": [ 14 | "00011110", 15 | "10001100", 16 | "11001000", 17 | "11000001", 18 | "10000011", 19 | "00010011", 20 | "00110001", 21 | "01111000" 22 | ], 23 | "MaxBlocks": { 24 | "damage": 18, 25 | "def_break": 2, 26 | "hit": 5, 27 | "reload": 10 28 | }, 29 | "MaxValues": { 30 | "damage": 206, 31 | "def_break": 60, 32 | "hit": 97, 33 | "reload": 148 34 | } 35 | } -------------------------------------------------------------------------------- /ChipSolver/Resources/Mk-153-result.json: -------------------------------------------------------------------------------- 1 | [[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":30,"rotate":0,"x":5,"y":1},{"ID":23,"rotate":2,"x":3,"y":1},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":27,"rotate":3,"x":0,"y":3}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":30,"rotate":1,"x":4,"y":1},{"ID":22,"rotate":3,"x":3,"y":3},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":27,"rotate":2,"x":2,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":30,"rotate":0,"x":5,"y":1},{"ID":24,"rotate":2,"x":3,"y":1},{"ID":27,"rotate":3,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":24,"rotate":0,"x":3,"y":4}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":30,"rotate":1,"x":4,"y":1},{"ID":25,"rotate":3,"x":3,"y":3},{"ID":27,"rotate":3,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":24,"rotate":0,"x":3,"y":4}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":30,"rotate":1,"x":4,"y":1},{"ID":25,"rotate":3,"x":3,"y":3},{"ID":25,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":27,"rotate":2,"x":2,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":31,"rotate":2,"x":4,"y":1},{"ID":28,"rotate":3,"x":3,"y":2},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":27,"rotate":2,"x":2,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":31,"rotate":2,"x":4,"y":1},{"ID":29,"rotate":2,"x":3,"y":2},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":27,"rotate":3,"x":0,"y":3}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":23,"rotate":3,"x":4,"y":4},{"ID":23,"rotate":1,"x":4,"y":3},{"ID":30,"rotate":1,"x":4,"y":1},{"ID":24,"rotate":0,"x":3,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":31,"rotate":2,"x":0,"y":5}],[{"ID":22,"rotate":2,"x":2,"y":0},{"ID":22,"rotate":0,"x":3,"y":0},{"ID":30,"rotate":0,"x":5,"y":1},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":25,"rotate":1,"x":0,"y":3},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":31,"rotate":2,"x":0,"y":5}],[{"ID":21,"rotate":1,"x":2,"y":0},{"ID":31,"rotate":0,"x":2,"y":1},{"ID":30,"rotate":0,"x":5,"y":1},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":24,"rotate":1,"x":0,"y":4},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":21,"rotate":1,"x":2,"y":0},{"ID":21,"rotate":3,"x":2,"y":1},{"ID":30,"rotate":0,"x":5,"y":1},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":25,"rotate":1,"x":0,"y":3},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":31,"rotate":2,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":31,"rotate":2,"x":4,"y":1},{"ID":25,"rotate":1,"x":2,"y":2},{"ID":24,"rotate":1,"x":0,"y":4},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":21,"rotate":1,"x":5,"y":3},{"ID":30,"rotate":1,"x":4,"y":1},{"ID":21,"rotate":3,"x":4,"y":3},{"ID":24,"rotate":0,"x":3,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":31,"rotate":2,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":21,"rotate":1,"x":5,"y":3},{"ID":30,"rotate":1,"x":4,"y":1},{"ID":31,"rotate":0,"x":4,"y":3},{"ID":25,"rotate":0,"x":2,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":31,"rotate":2,"x":4,"y":1},{"ID":24,"rotate":0,"x":4,"y":2},{"ID":25,"rotate":0,"x":2,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":31,"rotate":2,"x":4,"y":1},{"ID":26,"rotate":0,"x":3,"y":2},{"ID":27,"rotate":3,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":24,"rotate":0,"x":3,"y":4}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":31,"rotate":2,"x":4,"y":1},{"ID":26,"rotate":0,"x":3,"y":2},{"ID":25,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":27,"rotate":2,"x":2,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":23,"rotate":3,"x":4,"y":4},{"ID":23,"rotate":1,"x":4,"y":3},{"ID":30,"rotate":1,"x":4,"y":1},{"ID":36,"rotate":3,"x":2,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":22,"rotate":2,"x":2,"y":0},{"ID":22,"rotate":0,"x":3,"y":0},{"ID":30,"rotate":0,"x":5,"y":1},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":36,"rotate":0,"x":0,"y":3},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":21,"rotate":1,"x":2,"y":0},{"ID":21,"rotate":3,"x":2,"y":1},{"ID":30,"rotate":0,"x":5,"y":1},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":36,"rotate":0,"x":0,"y":3},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":21,"rotate":1,"x":5,"y":3},{"ID":30,"rotate":1,"x":4,"y":1},{"ID":21,"rotate":3,"x":4,"y":3},{"ID":36,"rotate":3,"x":2,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":23,"rotate":3,"x":2,"y":0},{"ID":31,"rotate":3,"x":4,"y":1},{"ID":28,"rotate":0,"x":2,"y":1},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":25,"rotate":1,"x":0,"y":3},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":31,"rotate":2,"x":0,"y":5}],[{"ID":22,"rotate":2,"x":2,"y":0},{"ID":28,"rotate":0,"x":3,"y":0},{"ID":31,"rotate":3,"x":4,"y":1},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":25,"rotate":1,"x":0,"y":3},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":31,"rotate":2,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":23,"rotate":3,"x":4,"y":4},{"ID":29,"rotate":1,"x":5,"y":2},{"ID":31,"rotate":1,"x":4,"y":1},{"ID":24,"rotate":0,"x":3,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":31,"rotate":2,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":22,"rotate":2,"x":6,"y":2},{"ID":31,"rotate":1,"x":4,"y":1},{"ID":29,"rotate":1,"x":4,"y":3},{"ID":24,"rotate":0,"x":3,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":31,"rotate":2,"x":0,"y":5}],[{"ID":23,"rotate":3,"x":2,"y":0},{"ID":31,"rotate":3,"x":4,"y":1},{"ID":28,"rotate":0,"x":2,"y":1},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":36,"rotate":0,"x":0,"y":3},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":22,"rotate":2,"x":2,"y":0},{"ID":28,"rotate":0,"x":3,"y":0},{"ID":31,"rotate":3,"x":4,"y":1},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":36,"rotate":0,"x":0,"y":3},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":23,"rotate":3,"x":4,"y":4},{"ID":29,"rotate":1,"x":5,"y":2},{"ID":31,"rotate":1,"x":4,"y":1},{"ID":36,"rotate":3,"x":2,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":22,"rotate":2,"x":6,"y":2},{"ID":31,"rotate":1,"x":4,"y":1},{"ID":29,"rotate":1,"x":4,"y":3},{"ID":36,"rotate":3,"x":2,"y":4},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":21,"rotate":1,"x":0,"y":5}],[{"ID":38,"rotate":1,"x":2,"y":0},{"ID":24,"rotate":1,"x":0,"y":4},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":23,"rotate":0,"x":3,"y":4},{"ID":30,"rotate":1,"x":5,"y":4},{"ID":21,"rotate":3,"x":3,"y":1},{"ID":31,"rotate":2,"x":4,"y":1}],[{"ID":30,"rotate":0,"x":2,"y":0},{"ID":38,"rotate":0,"x":4,"y":4},{"ID":25,"rotate":0,"x":2,"y":4},{"ID":21,"rotate":1,"x":0,"y":5},{"ID":22,"rotate":1,"x":0,"y":3},{"ID":31,"rotate":2,"x":4,"y":1},{"ID":21,"rotate":3,"x":4,"y":2}]] -------------------------------------------------------------------------------- /ChipSolver/Resources/Mk-153.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Mk-153", 3 | "optional": { 4 | "6格+5格1类": 0, 5 | "带5格2类": 0 6 | }, 7 | "width": 8, 8 | "height": 8, 9 | "blocks": 38, 10 | "color": 2, 11 | "palindrome" : 0, 12 | "map": [ 13 | "11001111", 14 | "11000001", 15 | "11000001", 16 | "11000001", 17 | "00000000", 18 | "00000000", 19 | "10001111", 20 | "11001111" 21 | ], 22 | "MaxBlocks": { 23 | "damage": 16, 24 | "def_break": 8, 25 | "hit": 9, 26 | "reload": 5 27 | }, 28 | "MaxValues": { 29 | "damage": 195, 30 | "def_break": 273, 31 | "hit": 190, 32 | "reload": 64 33 | } 34 | } -------------------------------------------------------------------------------- /ChipSolver/Resources/Mk-47.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Mk-47", 3 | "optional": { 4 | "Mk-47" : 0 5 | }, 6 | "width": 8, 7 | "height": 8, 8 | "blocks": 38, 9 | "chips":[5061,5051], 10 | "map": [ 11 | "11100111", 12 | "11100111", 13 | "11000011", 14 | "10000001", 15 | "00000000", 16 | "00000000", 17 | "01100110", 18 | "11000011" 19 | ], 20 | "color": 2, 21 | "palindrome": 0, 22 | "MaxBlocks": { 23 | "damage": 10, 24 | "def_break": 5, 25 | "hit": 7, 26 | "reload": 14, 27 | "free": 2 28 | }, 29 | "MaxValues": { 30 | "damage": 120, 31 | "def_break": 142, 32 | "hit": 131, 33 | "reload": 209 34 | } 35 | } -------------------------------------------------------------------------------- /ChipSolver/Resources/PP-93-result.json: -------------------------------------------------------------------------------- 1 | [[{"ID":17,"rotate":1,"x":2,"y":0},{"ID":28,"rotate":3,"x":3,"y":1},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":17,"rotate":1,"x":3,"y":5},{"ID":28,"rotate":1,"x":2,"y":4}],[{"ID":17,"rotate":1,"x":2,"y":0},{"ID":28,"rotate":3,"x":3,"y":1},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":16,"rotate":1,"x":2,"y":5},{"ID":29,"rotate":3,"x":3,"y":4}],[{"ID":17,"rotate":1,"x":2,"y":0},{"ID":28,"rotate":3,"x":3,"y":1},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":24,"rotate":0,"x":4,"y":4},{"ID":25,"rotate":0,"x":2,"y":4}],[{"ID":16,"rotate":1,"x":3,"y":0},{"ID":29,"rotate":1,"x":2,"y":1},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":16,"rotate":1,"x":2,"y":5},{"ID":29,"rotate":3,"x":3,"y":4}],[{"ID":16,"rotate":1,"x":3,"y":0},{"ID":29,"rotate":1,"x":2,"y":1},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":24,"rotate":0,"x":4,"y":4},{"ID":25,"rotate":0,"x":2,"y":4}],[{"ID":25,"rotate":2,"x":4,"y":0},{"ID":24,"rotate":2,"x":2,"y":0},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":24,"rotate":0,"x":4,"y":4},{"ID":25,"rotate":0,"x":2,"y":4}],[{"ID":17,"rotate":1,"x":2,"y":0},{"ID":24,"rotate":0,"x":4,"y":1},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":17,"rotate":1,"x":3,"y":5},{"ID":24,"rotate":2,"x":2,"y":3},{"ID":30,"rotate":1,"x":0,"y":3}],[{"ID":16,"rotate":1,"x":3,"y":0},{"ID":25,"rotate":0,"x":2,"y":1},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":16,"rotate":1,"x":2,"y":5},{"ID":25,"rotate":2,"x":4,"y":3},{"ID":30,"rotate":1,"x":5,"y":3}],[{"ID":17,"rotate":1,"x":2,"y":0},{"ID":24,"rotate":0,"x":4,"y":1},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":17,"rotate":1,"x":3,"y":5},{"ID":21,"rotate":1,"x":1,"y":4},{"ID":38,"rotate":2,"x":0,"y":3}],[{"ID":16,"rotate":1,"x":3,"y":0},{"ID":25,"rotate":0,"x":2,"y":1},{"ID":30,"rotate":1,"x":0,"y":3},{"ID":16,"rotate":1,"x":2,"y":5},{"ID":21,"rotate":0,"x":4,"y":4},{"ID":38,"rotate":2,"x":4,"y":3}],[{"ID":13,"rotate":2,"x":3,"y":0},{"ID":25,"rotate":1,"x":0,"y":2},{"ID":24,"rotate":1,"x":0,"y":4},{"ID":12,"rotate":0,"x":3,"y":5},{"ID":30,"rotate":1,"x":5,"y":3},{"ID":38,"rotate":1,"x":4,"y":2}],[{"ID":16,"rotate":1,"x":3,"y":0},{"ID":21,"rotate":2,"x":1,"y":1},{"ID":38,"rotate":0,"x":0,"y":3},{"ID":16,"rotate":1,"x":2,"y":5},{"ID":21,"rotate":0,"x":4,"y":4},{"ID":38,"rotate":2,"x":4,"y":3}],[{"ID":17,"rotate":1,"x":2,"y":0},{"ID":21,"rotate":3,"x":4,"y":1},{"ID":38,"rotate":0,"x":4,"y":3},{"ID":17,"rotate":1,"x":3,"y":5},{"ID":21,"rotate":1,"x":1,"y":4},{"ID":38,"rotate":2,"x":0,"y":3}]] -------------------------------------------------------------------------------- /ChipSolver/Resources/PP-93.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PP-93", 3 | "optional": { 4 | "填满":1, 5 | "最多空2格":2, 6 | "最多空4格":4 7 | }, 8 | "width": 8, 9 | "height": 8, 10 | "blocks": 32, 11 | "color": 1, 12 | "palindrome": 1, 13 | "map": [ 14 | "11100111", 15 | "11100111", 16 | "11000011", 17 | "00000000", 18 | "00000000", 19 | "11000011", 20 | "11100111", 21 | "11100111" 22 | ], 23 | "MaxBlocks": { 24 | "damage": 16, 25 | "def_break": 2, 26 | "hit": 6, 27 | "reload": 7, 28 | "free": 2 29 | }, 30 | "MaxValues": { 31 | "damage": 169, 32 | "def_break": 55, 33 | "hit": 100, 34 | "reload": 91 35 | } 36 | } -------------------------------------------------------------------------------- /ChipSolver/Resources/QLZ-04.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "QLZ-04", 3 | "optional": { 4 | "QLZ-04": 0 5 | }, 6 | "width": 8, 7 | "height": 7, 8 | "blocks": 38, 9 | "color": 1, 10 | "palindrome" : 0, 11 | "map": [ 12 | "00111100", 13 | "00011000", 14 | "00000000", 15 | "00000000", 16 | "10000001", 17 | "11000011", 18 | "11100111" 19 | ], 20 | "MaxBlocks": { 21 | "damage": 10, 22 | "def_break": 5, 23 | "hit": 7, 24 | "reload": 16 25 | }, 26 | "MaxValues": { 27 | "damage": 122, 28 | "def_break": 143, 29 | "hit": 132, 30 | "reload": 233 31 | } 32 | } -------------------------------------------------------------------------------- /ChipSolver/Resources/squads.json: -------------------------------------------------------------------------------- 1 | { 2 | "2B14": { 3 | "6格+5格1类": "2B14-result.json", 4 | "带5格2类": "2B14-52-result.json" 5 | }, 6 | "AGS-30": { 7 | "AGS-30": "AGS-30-result.json" 8 | }, 9 | "AT4": { 10 | "只用6格": "AT4-6-result.json", 11 | "使用5格": "AT4-5-result.json" 12 | }, 13 | "BGM-71": { 14 | "BGM-71": "BGM-71-result.json" 15 | }, 16 | "M2": { 17 | "只用6格-空2格": "M2-6-2-result.json", 18 | "使用5格-填满": "M2-5-0-result.json", 19 | "使用5格-空2格": "M2-5-2-result.json" 20 | }, 21 | "QLZ-04": { 22 | "QLZ-04": "QLZ-04-result.json" 23 | }, 24 | "Mk-153": { 25 | "6格+5格1类": "Mk-153-result.json", 26 | "带5格2类": "Mk-153-52-result.json" 27 | }, 28 | "PP-93":{ 29 | "填满": "PP-93-result.json", 30 | "最多空2格": "PP-93-2-result.json", 31 | "最多空4格": "PP-93-4-result.json" 32 | }, 33 | "Mk-47": { 34 | "Mk-47": "Mk-47-result.json" 35 | } 36 | } -------------------------------------------------------------------------------- /ChipSolver/chipsolver_global.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #ifndef BUILD_STATIC 6 | # if defined(CHIPSOLVER_LIB) 7 | # define CHIPSOLVER_EXPORT Q_DECL_EXPORT 8 | # else 9 | # define CHIPSOLVER_EXPORT Q_DECL_IMPORT 10 | # endif 11 | #else 12 | # define CHIPSOLVER_EXPORT 13 | #endif 14 | 15 | #pragma comment(lib,"ChipSolver.lib") -------------------------------------------------------------------------------- /ChipTableView/ChipTableView.cpp: -------------------------------------------------------------------------------- 1 | #include "ChipTableView.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "ChipView/ChipView.h" 7 | 8 | ChipTableModel::ChipTableModel(QObject* parent): 9 | QAbstractItemModel(parent), 10 | showBlocks_(false), 11 | showStatus_(true), 12 | showColor_(false) 13 | { 14 | font_.setFamily(QString::fromUtf8("\347\255\211\347\272\277")); 15 | font_.setPointSize(12); 16 | } 17 | 18 | QModelIndex ChipTableModel::index(int row, int column, const QModelIndex& parent) const 19 | { 20 | return hasIndex(row, column, parent) ? createIndex(row, column, nullptr) : QModelIndex(); 21 | } 22 | 23 | QModelIndex ChipTableModel::parent(const QModelIndex& child) const 24 | { 25 | return QModelIndex(); 26 | } 27 | 28 | int ChipTableModel::rowCount(const QModelIndex& parent) const 29 | { 30 | return chips_.size(); 31 | } 32 | 33 | int ChipTableModel::columnCount(const QModelIndex& parent) const 34 | { 35 | return showStatus_ ? 10 : 8; 36 | } 37 | 38 | bool ChipTableModel::hasChildren(const QModelIndex& parent) const 39 | { 40 | return false; 41 | } 42 | 43 | QVariant ChipTableModel::data(const QModelIndex& index, int role) const 44 | { 45 | if (index.row() >= chips_.size()) 46 | return QVariant(); 47 | const auto& chip = chips_[index.row()]; 48 | switch (role) 49 | { 50 | case Qt::DisplayRole: 51 | case Qt::EditRole: 52 | switch (index.column()) 53 | { 54 | case 0: 55 | return QString::number(chip.no); 56 | case 1: 57 | return chip.icon(); 58 | //return QAbstractItemModel::data(index, role); 59 | case 2: 60 | return chip.name(); 61 | case 3: 62 | return QString("+%1").arg(chip.level); 63 | case 4: 64 | return QString::number(showBlocks_ ? chip.hitBlock : chip.hitValue); 65 | case 5: 66 | return QString::number(showBlocks_ ? chip.reloadBlock : chip.reloadValue); 67 | case 6: 68 | return QString::number(showBlocks_ ? chip.damageBlock : chip.damageValue); 69 | case 7: 70 | return QString::number(showBlocks_ ? chip.defbreakBlock : chip.defbreakValue); 71 | case 8: 72 | return QString(chip.locked ? u8"√" : ""); 73 | case 9: 74 | return chip.squadName(); 75 | default: 76 | return QVariant(); 77 | } 78 | case Qt::TextAlignmentRole: 79 | return int(Qt::AlignHCenter | Qt::AlignVCenter); 80 | case Qt::BackgroundRole: 81 | if (index.column() == 0 && showColor_) 82 | { 83 | return QColor::fromRgb(ChipView::index2color(index.row() + 1)); 84 | } 85 | if (index.row() % 2) 86 | { 87 | return QColor::fromRgb(ChipView::index2color(0)); 88 | } 89 | return QColor(Qt::white); 90 | case Qt::FontRole: 91 | return font_; 92 | case Qt::ForegroundRole: 93 | return QVariant(); 94 | default: 95 | return QVariant(); 96 | } 97 | } 98 | 99 | bool ChipTableModel::setData(const QModelIndex& index, const QVariant& value, int role) 100 | { 101 | return false; 102 | } 103 | 104 | void ChipTableModel::setChips(const Chips& chips) 105 | { 106 | chips_ = chips; 107 | refresh(); 108 | } 109 | 110 | const Chips& ChipTableModel::chips() const 111 | { 112 | return chips_; 113 | } 114 | 115 | void ChipTableModel::setShowBlocks(bool b) 116 | { 117 | showBlocks_ = b; 118 | refresh(); 119 | } 120 | 121 | void ChipTableModel::setShowStatus(bool b) 122 | { 123 | showStatus_ = b; 124 | refresh(); 125 | } 126 | 127 | void ChipTableModel::setShowColor(bool b) 128 | { 129 | showColor_ = b; 130 | refresh(); 131 | } 132 | 133 | ChipTableDelegate::ChipTableDelegate(QObject* parent): 134 | QItemDelegate(parent) 135 | { 136 | 137 | } 138 | 139 | void ChipTableDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const 140 | { 141 | if(index.column() != 1) 142 | { 143 | QItemDelegate::paint(painter, option, index); 144 | return; 145 | } 146 | auto model = dynamic_cast(index.model()); 147 | const auto& icon = model->chips()[index.row()].icon(); 148 | auto width = icon.width(); 149 | auto height = icon.height(); 150 | const auto& rect = option.rect; 151 | auto x = rect.x() + rect.width() / 2 - width / 2; 152 | auto y = rect.y() + rect.height() / 2 - height / 2; 153 | 154 | painter->drawPixmap(x, y, icon); 155 | } 156 | 157 | Qt::ItemFlags ChipTableModel::flags(const QModelIndex& index) const 158 | { 159 | if (!index.isValid()) 160 | return Qt::NoItemFlags; 161 | return QAbstractItemModel::flags(index) & ~Qt::ItemIsEditable; 162 | } 163 | 164 | QVariant ChipTableModel::headerData(int section, Qt::Orientation orientation, int role) const 165 | { 166 | if(role == Qt::FontRole) 167 | { 168 | return font_; 169 | } 170 | if (orientation == Qt::Vertical || role != Qt::DisplayRole) 171 | return QAbstractItemModel::headerData(section, orientation, role); 172 | switch (section) 173 | { 174 | case 0: 175 | return trUtf8(u8"编\n号"); 176 | case 1: 177 | return trUtf8(u8"形\n状"); 178 | case 2: 179 | return trUtf8(u8"名\n称"); 180 | case 3: 181 | return trUtf8(u8"强\n化"); 182 | case 4: 183 | return trUtf8(u8"精\n度"); 184 | case 5: 185 | return trUtf8(u8"装\n填"); 186 | case 6: 187 | return trUtf8(u8"伤\n害"); 188 | case 7: 189 | return trUtf8(u8"破\n防"); 190 | case 8: 191 | return trUtf8(u8"锁\n定"); 192 | case 9: 193 | return trUtf8(u8"装\n备"); 194 | default: 195 | return QAbstractItemModel::headerData(section, orientation, role); 196 | } 197 | } 198 | 199 | void ChipTableModel::sort(int column, Qt::SortOrder order) 200 | { 201 | static auto cmp = [&](int a, int b) -> bool 202 | { 203 | if (order == Qt::AscendingOrder) 204 | return a < b; 205 | return a > b; 206 | }; 207 | switch (column) 208 | { 209 | case 0: 210 | break; 211 | case 1: 212 | std::sort(chips_.begin(), chips_.end(), 213 | [&](const GFChip& a, const GFChip& b) 214 | { 215 | if (a.gridID != b.gridID) 216 | return cmp(a.gridID, b.gridID); 217 | if (a.level != b.level) 218 | return cmp(a.level, b.level); 219 | if (a.hitValue != b.hitValue) 220 | return cmp(a.hitValue, b.hitValue); 221 | if (a.reloadValue != b.reloadValue) 222 | return cmp(a.reloadValue, b.reloadValue); 223 | if (a.damageValue != b.damageValue) 224 | return cmp(a.damageValue, b.damageValue); 225 | if (a.defbreakValue != b.defbreakValue) 226 | return cmp(a.defbreakValue, b.defbreakValue); 227 | if (a.locked != b.locked) 228 | return cmp(a.locked, b.locked); 229 | return cmp(a.squad, b.squad); 230 | }); 231 | break; 232 | case 2: 233 | std::sort(chips_.begin(), chips_.end(), 234 | [&](const GFChip& a, const GFChip& b) 235 | { 236 | if (order == Qt::AscendingOrder) 237 | return a.name() < a.name(); 238 | return a.name() > a.name(); 239 | }); 240 | break; 241 | case 3: 242 | std::sort(chips_.begin(), chips_.end(), 243 | [&](const GFChip& a, const GFChip& b) 244 | {return cmp(a.level, b.level); }); 245 | break; 246 | case 4: 247 | std::sort(chips_.begin(), chips_.end(), 248 | [&](const GFChip& a, const GFChip& b) 249 | {return cmp(a.hitValue, b.hitValue); }); 250 | break; 251 | case 5: 252 | std::sort(chips_.begin(), chips_.end(), 253 | [&](const GFChip& a, const GFChip& b) 254 | {return cmp(a.reloadValue, b.reloadValue); }); 255 | break; 256 | case 6: 257 | std::sort(chips_.begin(), chips_.end(), 258 | [&](const GFChip& a, const GFChip& b) 259 | {return cmp(a.damageValue, b.damageValue); }); 260 | break; 261 | case 7: 262 | std::sort(chips_.begin(), chips_.end(), 263 | [&](const GFChip& a, const GFChip& b) 264 | {return cmp(a.defbreakValue, b.defbreakValue); }); 265 | break; 266 | case 8: 267 | std::sort(chips_.begin(), chips_.end(), 268 | [&](const GFChip& a, const GFChip& b) 269 | {return cmp(a.locked, b.locked); }); 270 | break; 271 | case 9: 272 | std::sort(chips_.begin(), chips_.end(), 273 | [&](const GFChip& a, const GFChip& b) 274 | {return cmp(a.squad, b.squad); }); 275 | break; 276 | default: 277 | return; 278 | } 279 | refresh(); 280 | } 281 | -------------------------------------------------------------------------------- /ChipTableView/ChipTableView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "chiptableview_global.h" 4 | #include 5 | #include 6 | #include "Chip/Chip.h" 7 | #include 8 | 9 | class CHIPTABLEVIEW_EXPORT ChipTableModel : public QAbstractItemModel 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit ChipTableModel(QObject* parent = nullptr); 14 | 15 | QModelIndex index(int row, int column, 16 | const QModelIndex& parent = QModelIndex()) const override; 17 | QModelIndex parent(const QModelIndex& child) const override; 18 | 19 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; 20 | int columnCount(const QModelIndex& parent = QModelIndex()) const override; 21 | bool hasChildren(const QModelIndex& parent = QModelIndex()) const override; 22 | 23 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; 24 | bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; 25 | 26 | Qt::ItemFlags flags(const QModelIndex& index) const; 27 | 28 | QVariant headerData(int section, Qt::Orientation orientation, 29 | int role = Qt::DisplayRole) const override; 30 | 31 | void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; 32 | 33 | void setChips(const Chips& chips); 34 | const Chips& chips() const; 35 | // true显示格数 false显示数值(默认) 36 | void setShowBlocks(bool b = false); 37 | // true显示锁定与装备状态(默认),false不显示 38 | void setShowStatus(bool b = true); 39 | // true则在编号处显示颜色 40 | void setShowColor(bool b = false); 41 | void refresh() 42 | { 43 | beginResetModel(); 44 | endResetModel(); 45 | } 46 | 47 | private: 48 | Chips chips_; 49 | bool showBlocks_; 50 | bool showStatus_; 51 | bool showColor_; 52 | QFont font_; 53 | }; 54 | 55 | class CHIPTABLEVIEW_EXPORT ChipTableDelegate : public QItemDelegate 56 | { 57 | Q_OBJECT 58 | public: 59 | explicit ChipTableDelegate(QObject* parent = nullptr); 60 | virtual ~ChipTableDelegate() = default; 61 | 62 | void paint(QPainter* painter, 63 | const QStyleOptionViewItem& option, 64 | const QModelIndex& index) const override; 65 | }; -------------------------------------------------------------------------------- /ChipTableView/ChipTableView.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | RelWithDebInfo 14 | x64 15 | 16 | 17 | 18 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514} 19 | QtVS_v302 20 | 10.0 21 | $(MSBuildProjectDirectory)\QtMsBuild 22 | 23 | 24 | 25 | StaticLibrary 26 | v143 27 | 28 | 29 | StaticLibrary 30 | v143 31 | 32 | 33 | StaticLibrary 34 | v143 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | $(SolutionDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); 54 | 55 | 56 | $(SolutionDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); 57 | 58 | 59 | $(SolutionDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); 60 | 61 | 62 | 63 | 64 | 65 | Qt 5.12.11 x64 66 | core;gui;widgets 67 | 68 | 69 | Qt 5.12.11 x64 70 | core;gui;widgets 71 | 72 | 73 | Qt 5.12.11 x64 74 | core;gui;widgets 75 | 76 | 77 | 78 | 79 | 80 | 81 | true 82 | Disabled 83 | ProgramDatabase 84 | MultiThreadedDebugDLL 85 | true 86 | CHIPTABLEVIEW_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 87 | 88 | 89 | Windows 90 | $(OutDir)\$(ProjectName).lib 91 | true 92 | 93 | 94 | 95 | 96 | true 97 | None 98 | MultiThreadedDLL 99 | true 100 | CHIPTABLEVIEW_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 101 | true 102 | 103 | 104 | Windows 105 | $(OutDir)\$(ProjectName).lib 106 | false 107 | 108 | 109 | 110 | 111 | true 112 | 113 | 114 | MultiThreadedDLL 115 | true 116 | CHIPTABLEVIEW_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 117 | 118 | 119 | Windows 120 | $(OutDir)\$(ProjectName).lib 121 | false 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /ChipTableView/ChipTableView.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 14 | qrc;* 15 | false 16 | 17 | 18 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 19 | qrc;* 20 | false 21 | 22 | 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | -------------------------------------------------------------------------------- /ChipTableView/SolutionTableModel.cpp: -------------------------------------------------------------------------------- 1 | #include "SolutionTableModel.h" 2 | #include "ChipSolver/ChipSolver.h" 3 | #include "Chip/Chip.h" 4 | #include 5 | #include "CodeX/CodeX.h" 6 | #include "ChipView/ChipView.h" 7 | #include 8 | 9 | SolutionTableModel::SolutionTableModel(QObject *parent) 10 | : QAbstractItemModel(parent), 11 | solution_(nullptr), 12 | showError_(true) 13 | { 14 | font_.setFamily(QString::fromUtf8("\347\255\211\347\272\277")); 15 | font_.setPointSize(12); 16 | } 17 | 18 | SolutionTableModel::~SolutionTableModel() 19 | { 20 | } 21 | 22 | QModelIndex SolutionTableModel::index(int row, int column, const QModelIndex& parent) const 23 | { 24 | return hasIndex(row, column, parent) ? createIndex(row, column, nullptr) : QModelIndex(); 25 | } 26 | 27 | QModelIndex SolutionTableModel::parent(const QModelIndex& child) const 28 | { 29 | return QModelIndex(); 30 | } 31 | 32 | int SolutionTableModel::rowCount(const QModelIndex& parent) const 33 | { 34 | if (!solution_) 35 | return 0; 36 | return solution_->size(); 37 | } 38 | 39 | int SolutionTableModel::columnCount(const QModelIndex& parent) const 40 | { 41 | return 9; 42 | } 43 | 44 | bool SolutionTableModel::hasChildren(const QModelIndex& parent) const 45 | { 46 | return false; 47 | } 48 | 49 | inline int min(int a,int b) 50 | { 51 | return a < b ? a : b; 52 | } 53 | 54 | QVariant SolutionTableModel::data(const QModelIndex& index, int role) const 55 | { 56 | if(!solution_) 57 | return QVariant(); 58 | if (index.row() >= solution_->size()) 59 | return QVariant(); 60 | const auto& solution = (*solution_)[index.row()]; 61 | switch (role) 62 | { 63 | case Qt::DisplayRole: 64 | case Qt::EditRole: 65 | switch (index.column()) 66 | { 67 | case 0: 68 | return index.row() + 1; 69 | case 1: 70 | if (showError_) 71 | return QString("%1 (%2)").arg(solution.totalValue.damageValue) 72 | .arg(min(0, solution.totalValue.damageValue - maxValue_.damageValue)); 73 | return solution.totalValue.damageValue; 74 | case 2: 75 | if (showError_) 76 | return QString("%1 (%2)").arg(solution.totalValue.defbreakValue) 77 | .arg(min(0, solution.totalValue.defbreakValue - maxValue_.defbreakValue)); 78 | return solution.totalValue.defbreakValue; 79 | case 3: 80 | if (showError_) 81 | return QString("%1 (%2)").arg(solution.totalValue.hitValue) 82 | .arg(min(0, solution.totalValue.hitValue - maxValue_.hitValue)); 83 | return solution.totalValue.hitValue; 84 | case 4: 85 | if (showError_) 86 | return QString("%1 (%2)").arg(solution.totalValue.reloadValue) 87 | .arg(min(0, solution.totalValue.reloadValue - maxValue_.reloadValue)); 88 | return solution.totalValue.reloadValue; 89 | case 5: 90 | return solution.totalValue.id; 91 | case 6: 92 | return solution.totalValue.exp; 93 | case 7: 94 | return solution.totalValue.no * 50; 95 | case 8: 96 | return solution.squad; 97 | default: 98 | return QVariant(); 99 | } 100 | case Qt::TextAlignmentRole: 101 | return int(Qt::AlignHCenter | Qt::AlignVCenter); 102 | case Qt::BackgroundRole: 103 | if (index.row() % 2) 104 | { 105 | return QColor::fromRgb(ChipView::index2color(0)); 106 | } 107 | else 108 | { 109 | return QColor(Qt::white); 110 | } 111 | case Qt::FontRole: 112 | return font_; 113 | default: 114 | return QVariant(); 115 | } 116 | } 117 | 118 | bool SolutionTableModel::setData(const QModelIndex& index, const QVariant& value, int role) 119 | { 120 | return false; 121 | } 122 | 123 | Qt::ItemFlags SolutionTableModel::flags(const QModelIndex& index) const 124 | { 125 | if (!index.isValid()) 126 | return Qt::NoItemFlags; 127 | return QAbstractItemModel::flags(index) & ~Qt::ItemIsEditable; 128 | } 129 | 130 | QVariant SolutionTableModel::headerData(int section, Qt::Orientation orientation, int role) const 131 | { 132 | if (role == Qt::FontRole) 133 | { 134 | return font_; 135 | } 136 | if (orientation == Qt::Vertical || role != Qt::DisplayRole) 137 | return QAbstractItemModel::headerData(section, orientation, role); 138 | switch (section) 139 | { 140 | case 0: 141 | return trUtf8(u8"编号"); 142 | case 1: 143 | return trUtf8(u8"杀伤"); 144 | case 2: 145 | return trUtf8(u8"破防"); 146 | case 3: 147 | return trUtf8(u8"精度"); 148 | case 4: 149 | return trUtf8(u8"装填"); 150 | case 5: 151 | return trUtf8(u8"总偏差"); 152 | case 6: 153 | return trUtf8(u8"总强化"); 154 | case 7: 155 | return trUtf8(u8"校准券"); 156 | case 8: 157 | return trUtf8(u8"重装"); 158 | default: 159 | return QAbstractItemModel::headerData(section, orientation, role); 160 | } 161 | } 162 | 163 | void SolutionTableModel::sort(int column, Qt::SortOrder order) 164 | { 165 | if (!solution_) 166 | return; 167 | auto cmp = [&](int a, int b) -> bool 168 | { 169 | if (order == Qt::AscendingOrder) 170 | return a < b; 171 | return a > b; 172 | }; 173 | switch (column) 174 | { 175 | case 0: 176 | break; 177 | case 1: 178 | std::sort(solution_->begin(), solution_->end(), 179 | [&](const Solution& a, const Solution& b) 180 | {return cmp(a.totalValue.damageValue, b.totalValue.damageValue); }); 181 | break; 182 | case 2: 183 | std::sort(solution_->begin(), solution_->end(), 184 | [&](const Solution& a, const Solution& b) 185 | {return cmp(a.totalValue.defbreakValue, b.totalValue.defbreakValue); }); 186 | break; 187 | case 3: 188 | std::sort(solution_->begin(), solution_->end(), 189 | [&](const Solution& a, const Solution& b) 190 | {return cmp(a.totalValue.hitValue, b.totalValue.hitValue); }); 191 | break; 192 | case 4: 193 | std::sort(solution_->begin(), solution_->end(), 194 | [&](const Solution& a, const Solution& b) 195 | {return cmp(a.totalValue.reloadValue, b.totalValue.reloadValue); }); 196 | break; 197 | case 5: 198 | std::sort(solution_->begin(), solution_->end(), 199 | [&](const Solution& a, const Solution& b) 200 | { 201 | if(a.totalValue.id != b.totalValue.id) 202 | return !cmp(a.totalValue.id, b.totalValue.id); 203 | if(a.totalValue.no != b.totalValue.no) 204 | return !cmp(a.totalValue.no, b.totalValue.no); 205 | return cmp(a.totalValue.exp, b.totalValue.exp); 206 | }); 207 | break; 208 | case 6: 209 | std::sort(solution_->begin(), solution_->end(), 210 | [&](const Solution& a, const Solution& b) 211 | {return cmp(a.totalValue.exp, b.totalValue.exp); }); 212 | break; 213 | case 7: 214 | std::sort(solution_->begin(), solution_->end(), 215 | [&](const Solution& a, const Solution& b) 216 | {return cmp(a.totalValue.no, b.totalValue.no); }); 217 | break; 218 | default: 219 | return; 220 | } 221 | refresh(); 222 | } 223 | 224 | void SolutionTableModel::setSolution(SquadSolution* ptr) 225 | { 226 | solution_ = ptr; 227 | refresh(); 228 | } 229 | 230 | void SolutionTableModel::setMaxValue(const GFChip& value) 231 | { 232 | maxValue_ = value; 233 | refresh(); 234 | } 235 | 236 | void SolutionTableModel::setShowError(bool en) 237 | { 238 | showError_ = en; 239 | refresh(); 240 | } 241 | -------------------------------------------------------------------------------- /ChipTableView/SolutionTableModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "chiptableview_global.h" 5 | #include "Chip/Chip.h" 6 | #include 7 | 8 | class CHIPTABLEVIEW_EXPORT SolutionTableModel : public QAbstractItemModel 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | SolutionTableModel(QObject *parent); 14 | virtual ~SolutionTableModel(); 15 | 16 | QModelIndex index(int row, int column, 17 | const QModelIndex& parent = QModelIndex()) const override; 18 | QModelIndex parent(const QModelIndex& child) const override; 19 | 20 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; 21 | int columnCount(const QModelIndex& parent = QModelIndex()) const override; 22 | bool hasChildren(const QModelIndex& parent = QModelIndex()) const override; 23 | 24 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; 25 | bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; 26 | 27 | Qt::ItemFlags flags(const QModelIndex& index) const; 28 | 29 | QVariant headerData(int section, Qt::Orientation orientation, 30 | int role = Qt::DisplayRole) const override; 31 | 32 | void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; 33 | 34 | void setSolution(std::vector* ptr); 35 | void setMaxValue(const GFChip& value); 36 | void setShowError(bool en = true); 37 | 38 | void refresh() 39 | { 40 | beginResetModel(); 41 | endResetModel(); 42 | } 43 | 44 | private: 45 | std::vector* solution_; 46 | GFChip maxValue_; 47 | QFont font_; 48 | bool showError_; 49 | }; 50 | -------------------------------------------------------------------------------- /ChipTableView/chiptableview_global.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #ifndef BUILD_STATIC 6 | # if defined(CHIPTABLEVIEW_LIB) 7 | # define CHIPTABLEVIEW_EXPORT Q_DECL_EXPORT 8 | # else 9 | # define CHIPTABLEVIEW_EXPORT Q_DECL_IMPORT 10 | # endif 11 | #else 12 | # define CHIPTABLEVIEW_EXPORT 13 | #endif 14 | 15 | #pragma comment(lib,"ChipTableView.lib") 16 | -------------------------------------------------------------------------------- /ChipView/ChipBlock.cpp: -------------------------------------------------------------------------------- 1 | #include "ChipBlock.h" 2 | #include "ChipView.h" 3 | #include 4 | 5 | ChipBlock::ChipBlock(QWidget *parent) 6 | : QLabel(parent) 7 | { 8 | auto sizePolicy = this->sizePolicy(); 9 | sizePolicy.setHeightForWidth(true); 10 | sizePolicy.setVerticalPolicy(QSizePolicy::Fixed); 11 | sizePolicy.setHorizontalPolicy(QSizePolicy::Preferred); 12 | this->setSizePolicy(sizePolicy); 13 | this->setMinimumSize(QSize(0, 0)); 14 | this->setEnabled(false); 15 | this->setColor(ChipView::Gray); 16 | this->setText(""); 17 | } 18 | 19 | ChipBlock::~ChipBlock() 20 | { 21 | } 22 | 23 | int ChipBlock::heightForWidth(int width) const 24 | { 25 | return width; 26 | } 27 | 28 | bool ChipBlock::hasHeightForWidth() const 29 | { 30 | return true; 31 | } 32 | 33 | void ChipBlock::setColor(uint32_t c) 34 | { 35 | this->setStyleSheet(QString("background-color: #%1;\nborder:none;").arg(c, 6, 16, QLatin1Char('0'))); 36 | } 37 | 38 | void ChipBlock::resizeEvent(QResizeEvent* event) 39 | { 40 | this->setFixedHeight(this->width()); 41 | QLabel::resizeEvent(event); 42 | } 43 | -------------------------------------------------------------------------------- /ChipView/ChipBlock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "chipview_global.h" 4 | #include 5 | 6 | class CHIPVIEW_EXPORT ChipBlock : public QLabel 7 | { 8 | Q_OBJECT 9 | 10 | Q_PROPERTY(int color READ color WRITE setColor) 11 | public: 12 | ChipBlock(QWidget *parent); 13 | ~ChipBlock(); 14 | 15 | int heightForWidth(int width) const override; 16 | bool hasHeightForWidth() const override; 17 | 18 | int color() { return colorHex; } 19 | void setColor(uint32_t c); 20 | 21 | protected: 22 | void resizeEvent(QResizeEvent* event) override; 23 | 24 | private: 25 | int colorHex; 26 | }; 27 | -------------------------------------------------------------------------------- /ChipView/ChipView.cpp: -------------------------------------------------------------------------------- 1 | #include "ChipView.h" 2 | #include "ui_ChipView.h" 3 | #include 4 | 5 | ChipView::ChipView(QWidget* parent) : 6 | QWidget(parent), 7 | ui(new Ui::ChipView), 8 | size(0, 0), 9 | spacing(2), 10 | marging(2) 11 | { 12 | ui->setupUi(this); 13 | 14 | this->ui->gridLayout->setSpacing(spacing); 15 | this->ui->gridLayout->setMargin(marging); 16 | } 17 | 18 | QSize ChipView::chipSize() 19 | { 20 | return size; 21 | } 22 | 23 | void ChipView::setChipSize(const QSize& s) 24 | { 25 | // clear items 26 | for (auto i = 0; i < size.height(); ++i) 27 | { 28 | for (auto j = 0; j < size.width(); ++j) 29 | { 30 | auto item = this->ui->gridLayout->itemAtPosition(i,j); 31 | if (!item) 32 | continue; 33 | this->ui->gridLayout->removeItem(item); 34 | auto widget = item->widget(); 35 | if (!widget) 36 | continue; 37 | this->ui->gridLayout->removeWidget(widget); 38 | delete item; 39 | delete widget; 40 | } 41 | } 42 | 43 | // add items 44 | size = s; 45 | for (auto i = 0; i < size.height(); ++i) 46 | { 47 | for (auto j = 0; j < size.width(); ++j) 48 | { 49 | this->ui->gridLayout->addWidget(createChip(this), i, j); 50 | } 51 | } 52 | resizeEvent(nullptr); 53 | } 54 | 55 | void ChipView::setChipColor(int i, int j, uint32_t color) 56 | { 57 | if (i >= size.height() || j >= size.width()) 58 | return; 59 | dynamic_cast(this->ui->gridLayout->itemAtPosition(i, j)->widget()) 60 | ->setColor(color); 61 | } 62 | 63 | void ChipView::setView(const ChipViewInfo& view) 64 | { 65 | auto x0 = (this->size.width() - view.width) / 2; 66 | auto y0 = (this->size.height() - view.height) / 2; 67 | for(auto i = 0;i < this->size.height();++i) 68 | { 69 | for(auto j = 0;j < this->size.width();++j) 70 | { 71 | this->setChipColor(i, j, Gray); 72 | } 73 | } 74 | for(auto y = 0;y < view.height;++y) 75 | { 76 | for(auto x = 0;x < view.width;++x) 77 | { 78 | if(view.map[y][x] >= 0) 79 | this->setChipColor(y + y0, x + x0, index2color(view.map[y][x])); 80 | } 81 | } 82 | } 83 | 84 | uint32_t ChipView::index2color(int i) 85 | { 86 | switch (i) 87 | { 88 | case 0: 89 | return 0xdfe4ea; 90 | case 1: 91 | return 0xeccc68; 92 | case 2: 93 | return 0xff7f50; 94 | case 3: 95 | return 0xff6b81; 96 | case 4: 97 | return 0xffa502; 98 | case 5: 99 | return 0x7bed9f; 100 | case 6: 101 | return 0x70a1ff; 102 | case 7: 103 | return 0x5352ed; 104 | case 8: 105 | return 0x3742fa; 106 | default: 107 | return 0xdfe4ea; 108 | } 109 | } 110 | 111 | void ChipView::resizeEvent(QResizeEvent* event) 112 | { 113 | if(this->size.height() == 0 || this->size.width() == 0) 114 | { 115 | QWidget::resizeEvent(event); 116 | return; 117 | } 118 | this->setFixedHeight(this->width()); 119 | int bHeight = (this->height() - marging * 2 - spacing * (this->size.height() - 1)) / this->size.height(); 120 | int bWidth = (this->width() - marging * 2 - spacing * (this->size.width() - 1)) / this->size.width(); 121 | int bSize = std::min(bHeight, bWidth); 122 | auto sHeight = bSize * size.height() + spacing * (size.height() - 1); 123 | auto sWidth = bSize * size.width() + spacing * (size.width() - 1); 124 | auto vLeft = this->height() - sHeight; // 垂直剩余 125 | auto hLeft = this->width() - sWidth; // 水平剩余 126 | this->ui->gridLayout->setContentsMargins(hLeft / 2, vLeft / 2, hLeft - hLeft / 2, vLeft - vLeft / 2); 127 | QWidget::resizeEvent(event); 128 | } 129 | 130 | ChipBlock* ChipView::createChip(QWidget* parent) 131 | { 132 | return new ChipBlock(parent); 133 | } 134 | -------------------------------------------------------------------------------- /ChipView/ChipView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "chipview_global.h" 4 | #include 5 | #include "ChipBlock.h" 6 | #include "Chip/Chip.h" 7 | 8 | namespace Ui 9 | { 10 | class ChipView; 11 | } 12 | class QPushButton; 13 | 14 | class CHIPVIEW_EXPORT ChipView : public QWidget 15 | { 16 | Q_OBJECT 17 | 18 | Q_PROPERTY(QSize chipSize READ chipSize WRITE setChipSize) 19 | public: 20 | ChipView(QWidget* parent = Q_NULLPTR); 21 | 22 | QSize chipSize(); 23 | void setChipSize(const QSize& s); 24 | 25 | enum ChipColor 26 | { 27 | Blue = 0x6699ff, 28 | Red = 0xff9900, 29 | Dodgerblue = 0x1e90ff, 30 | Deepskyblue = 0x00bfff, 31 | Greenyellow = 0xadff2f, 32 | Hotpink = 0xff69b4, 33 | Burlywood = 0xdeb887, 34 | Darkorchid = 0x9932cc, 35 | Lightpink = 0xffb6c1, 36 | Salmon = 0xfa8072, 37 | Gray = 0xdfe4ea, 38 | }; 39 | 40 | void setChipColor(int i, int j, uint32_t color); 41 | void setView(const ChipViewInfo& view); 42 | static uint32_t index2color(int i); 43 | 44 | protected: 45 | void resizeEvent(QResizeEvent* event) override; 46 | ChipBlock* createChip(QWidget* parent = Q_NULLPTR); 47 | 48 | Ui::ChipView* ui; 49 | QSize size; 50 | int spacing, marging; 51 | }; 52 | -------------------------------------------------------------------------------- /ChipView/ChipView.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ChipView 4 | 5 | 6 | 7 | 0 8 | 0 9 | 224 10 | 118 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ChipView/ChipView.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | RelWithDebInfo 14 | x64 15 | 16 | 17 | 18 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5} 19 | QtVS_v302 20 | 10.0 21 | $(MSBuildProjectDirectory)\QtMsBuild 22 | 23 | 24 | 25 | StaticLibrary 26 | v143 27 | 28 | 29 | StaticLibrary 30 | v143 31 | 32 | 33 | StaticLibrary 34 | v143 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | $(SolutionDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); 54 | 55 | 56 | $(SolutionDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); 57 | 58 | 59 | $(SolutionDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); 60 | 61 | 62 | 63 | 64 | 65 | Qt 5.12.11 x64 66 | core 67 | 68 | 69 | Qt 5.12.11 x64 70 | core 71 | 72 | 73 | Qt 5.12.11 x64 74 | core 75 | 76 | 77 | 78 | 79 | 80 | 81 | true 82 | Disabled 83 | ProgramDatabase 84 | MultiThreadedDebugDLL 85 | true 86 | CHIPVIEW_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 87 | 88 | 89 | Windows 90 | $(OutDir)\$(ProjectName).lib 91 | true 92 | 93 | 94 | 95 | 96 | true 97 | None 98 | MultiThreadedDLL 99 | true 100 | CHIPVIEW_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 101 | true 102 | 103 | 104 | Windows 105 | $(OutDir)\$(ProjectName).lib 106 | false 107 | 108 | 109 | 110 | 111 | true 112 | 113 | 114 | MultiThreadedDLL 115 | true 116 | CHIPVIEW_LIB;BUILD_STATIC;%(PreprocessorDefinitions) 117 | 118 | 119 | Windows 120 | $(OutDir)\$(ProjectName).lib 121 | false 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /ChipView/ChipView.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 14 | qrc;* 15 | false 16 | 17 | 18 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 19 | qrc;* 20 | false 21 | 22 | 23 | {942110d3-2828-46d2-aafd-3660b2ab5a86} 24 | 25 | 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | 40 | 41 | Form Files 42 | 43 | 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | -------------------------------------------------------------------------------- /ChipView/chipview_global.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma warning(disable:26812) 3 | #include 4 | 5 | #ifndef BUILD_STATIC 6 | # if defined(CHIPVIEW_LIB) 7 | # define CHIPVIEW_EXPORT Q_DECL_EXPORT 8 | # else 9 | # define CHIPVIEW_EXPORT Q_DECL_IMPORT 10 | # endif 11 | #else 12 | # define CHIPVIEW_EXPORT 13 | #endif 14 | 15 | #pragma comment(lib,"ChipView.lib") -------------------------------------------------------------------------------- /CodeX.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32407.343 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CodeX", "CodeX\CodeX.vcxproj", "{3741CE50-E243-41E2-B612-3A787E0F790C}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5} = {140A233F-BB61-43EB-96E5-EF3EAF84ECC5} 9 | {70EF6B71-DBD0-4868-845B-F1690A5D671C} = {70EF6B71-DBD0-4868-845B-F1690A5D671C} 10 | {97F7BC82-D588-4012-95AE-7585053A8705} = {97F7BC82-D588-4012-95AE-7585053A8705} 11 | {D75D77B9-58DA-4E72-B470-1DF5B86C6D63} = {D75D77B9-58DA-4E72-B470-1DF5B86C6D63} 12 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514} = {44D90FE0-3F67-4E4E-BD00-2F86038FF514} 13 | EndProjectSection 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChipView", "ChipView\ChipView.vcxproj", "{140A233F-BB61-43EB-96E5-EF3EAF84ECC5}" 16 | EndProject 17 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChipDataWindow", "ChipDataWindow\ChipDataWindow.vcxproj", "{D75D77B9-58DA-4E72-B470-1DF5B86C6D63}" 18 | ProjectSection(ProjectDependencies) = postProject 19 | {97F7BC82-D588-4012-95AE-7585053A8705} = {97F7BC82-D588-4012-95AE-7585053A8705} 20 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514} = {44D90FE0-3F67-4E4E-BD00-2F86038FF514} 21 | EndProjectSection 22 | EndProject 23 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chip", "Chip\Chip.vcxproj", "{97F7BC82-D588-4012-95AE-7585053A8705}" 24 | EndProject 25 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChipTableView", "ChipTableView\ChipTableView.vcxproj", "{44D90FE0-3F67-4E4E-BD00-2F86038FF514}" 26 | ProjectSection(ProjectDependencies) = postProject 27 | {97F7BC82-D588-4012-95AE-7585053A8705} = {97F7BC82-D588-4012-95AE-7585053A8705} 28 | EndProjectSection 29 | EndProject 30 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChipSolver", "ChipSolver\ChipSolver.vcxproj", "{70EF6B71-DBD0-4868-845B-F1690A5D671C}" 31 | ProjectSection(ProjectDependencies) = postProject 32 | {97F7BC82-D588-4012-95AE-7585053A8705} = {97F7BC82-D588-4012-95AE-7585053A8705} 33 | EndProjectSection 34 | EndProject 35 | Global 36 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 37 | Debug|x64 = Debug|x64 38 | MinSizeRel|x64 = MinSizeRel|x64 39 | Release|x64 = Release|x64 40 | RelWithDebInfo|x64 = RelWithDebInfo|x64 41 | EndGlobalSection 42 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 43 | {3741CE50-E243-41E2-B612-3A787E0F790C}.Debug|x64.ActiveCfg = Debug|x64 44 | {3741CE50-E243-41E2-B612-3A787E0F790C}.Debug|x64.Build.0 = Debug|x64 45 | {3741CE50-E243-41E2-B612-3A787E0F790C}.MinSizeRel|x64.ActiveCfg = Release|x64 46 | {3741CE50-E243-41E2-B612-3A787E0F790C}.MinSizeRel|x64.Build.0 = Release|x64 47 | {3741CE50-E243-41E2-B612-3A787E0F790C}.Release|x64.ActiveCfg = Release|x64 48 | {3741CE50-E243-41E2-B612-3A787E0F790C}.Release|x64.Build.0 = Release|x64 49 | {3741CE50-E243-41E2-B612-3A787E0F790C}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 50 | {3741CE50-E243-41E2-B612-3A787E0F790C}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 51 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5}.Debug|x64.ActiveCfg = Debug|x64 52 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5}.Debug|x64.Build.0 = Debug|x64 53 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5}.MinSizeRel|x64.ActiveCfg = Release|x64 54 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5}.MinSizeRel|x64.Build.0 = Release|x64 55 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5}.Release|x64.ActiveCfg = Release|x64 56 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5}.Release|x64.Build.0 = Release|x64 57 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 58 | {140A233F-BB61-43EB-96E5-EF3EAF84ECC5}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 59 | {D75D77B9-58DA-4E72-B470-1DF5B86C6D63}.Debug|x64.ActiveCfg = Debug|x64 60 | {D75D77B9-58DA-4E72-B470-1DF5B86C6D63}.Debug|x64.Build.0 = Debug|x64 61 | {D75D77B9-58DA-4E72-B470-1DF5B86C6D63}.MinSizeRel|x64.ActiveCfg = Release|x64 62 | {D75D77B9-58DA-4E72-B470-1DF5B86C6D63}.MinSizeRel|x64.Build.0 = Release|x64 63 | {D75D77B9-58DA-4E72-B470-1DF5B86C6D63}.Release|x64.ActiveCfg = Release|x64 64 | {D75D77B9-58DA-4E72-B470-1DF5B86C6D63}.Release|x64.Build.0 = Release|x64 65 | {D75D77B9-58DA-4E72-B470-1DF5B86C6D63}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 66 | {D75D77B9-58DA-4E72-B470-1DF5B86C6D63}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 67 | {97F7BC82-D588-4012-95AE-7585053A8705}.Debug|x64.ActiveCfg = Debug|x64 68 | {97F7BC82-D588-4012-95AE-7585053A8705}.Debug|x64.Build.0 = Debug|x64 69 | {97F7BC82-D588-4012-95AE-7585053A8705}.MinSizeRel|x64.ActiveCfg = Release|x64 70 | {97F7BC82-D588-4012-95AE-7585053A8705}.MinSizeRel|x64.Build.0 = Release|x64 71 | {97F7BC82-D588-4012-95AE-7585053A8705}.Release|x64.ActiveCfg = Release|x64 72 | {97F7BC82-D588-4012-95AE-7585053A8705}.Release|x64.Build.0 = Release|x64 73 | {97F7BC82-D588-4012-95AE-7585053A8705}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 74 | {97F7BC82-D588-4012-95AE-7585053A8705}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 75 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514}.Debug|x64.ActiveCfg = Debug|x64 76 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514}.Debug|x64.Build.0 = Debug|x64 77 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514}.MinSizeRel|x64.ActiveCfg = Release|x64 78 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514}.MinSizeRel|x64.Build.0 = Release|x64 79 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514}.Release|x64.ActiveCfg = Release|x64 80 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514}.Release|x64.Build.0 = Release|x64 81 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 82 | {44D90FE0-3F67-4E4E-BD00-2F86038FF514}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 83 | {70EF6B71-DBD0-4868-845B-F1690A5D671C}.Debug|x64.ActiveCfg = Debug|x64 84 | {70EF6B71-DBD0-4868-845B-F1690A5D671C}.Debug|x64.Build.0 = Debug|x64 85 | {70EF6B71-DBD0-4868-845B-F1690A5D671C}.MinSizeRel|x64.ActiveCfg = Release|x64 86 | {70EF6B71-DBD0-4868-845B-F1690A5D671C}.MinSizeRel|x64.Build.0 = Release|x64 87 | {70EF6B71-DBD0-4868-845B-F1690A5D671C}.Release|x64.ActiveCfg = Release|x64 88 | {70EF6B71-DBD0-4868-845B-F1690A5D671C}.Release|x64.Build.0 = Release|x64 89 | {70EF6B71-DBD0-4868-845B-F1690A5D671C}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 90 | {70EF6B71-DBD0-4868-845B-F1690A5D671C}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 91 | EndGlobalSection 92 | GlobalSection(SolutionProperties) = preSolution 93 | HideSolutionNode = FALSE 94 | EndGlobalSection 95 | GlobalSection(ExtensibilityGlobals) = postSolution 96 | SolutionGuid = {C3A7A5BC-ECAE-4D3A-891B-42496C40D214} 97 | Qt5Version = Qt 5.12.11 x64 98 | EndGlobalSection 99 | EndGlobal 100 | -------------------------------------------------------------------------------- /CodeX/AboutDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "AboutDialog.h" 3 | #include "ui_AboutDialog.h" 4 | 5 | AboutDialog::AboutDialog(QWidget *parent) 6 | : QDialog(parent), 7 | version(2,5,0), 8 | ui(new Ui::AboutDialog()), 9 | accessManager_(new QNetworkAccessManager(this)) 10 | { 11 | ui->setupUi(this); 12 | ui->nameLabel->setText(trUtf8(u8"CodeX重装芯片计算器 v") + version.toString()); 13 | QSettings settings; 14 | auto s = settings.value("/Sys/AboutShowOnStart", true).toBool(); 15 | this->ui->checkBox->setChecked(s); 16 | if (s) 17 | this->show(); 18 | QObject::connect(this->ui->checkBox, &QCheckBox::stateChanged, this, &AboutDialog::showOnStart); 19 | } 20 | 21 | AboutDialog::~AboutDialog() 22 | { 23 | delete ui; 24 | } 25 | 26 | void AboutDialog::checkUpdate() 27 | { 28 | request_.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded; charset=UTF-8"); 29 | QSslConfiguration config = request_.sslConfiguration(); 30 | config.setPeerVerifyMode(QSslSocket::VerifyNone); 31 | config.setProtocol(QSsl::SecureProtocols); 32 | request_.setSslConfiguration(config); 33 | request_.setUrl(QUrl("https://gitee.com/api/v5/repos/zaxs0130/CodeX/releases")); 34 | auto onReply = 35 | QObject::connect( 36 | accessManager_, 37 | &QNetworkAccessManager::finished, 38 | [&](QNetworkReply* reply) 39 | { 40 | try { 41 | if (reply->error() != QNetworkReply::NoError) 42 | { 43 | reply->deleteLater(); 44 | return; 45 | } 46 | auto json = QJsonDocument::fromJson(reply->readAll()).array()[0].toObject(); 47 | auto ver = json["tag_name"].toString("v1.0").toLower().split("v", QString::SkipEmptyParts); 48 | if (ver.empty()) 49 | { 50 | reply->deleteLater(); 51 | return; 52 | } 53 | auto newVersion = QVersionNumber::fromString(ver[0]); 54 | if (newVersion > version) 55 | { 56 | auto ret = QMessageBox::information(nullptr, u8"提示", u8"检测到新版本,是否下载?", 57 | QMessageBox::Yes | QMessageBox::No); 58 | if (ret == QMessageBox::Yes) 59 | { 60 | QDesktopServices::openUrl( 61 | QUrl(json["assets"].toArray()[0].toObject()["browser_download_url"].toString())); 62 | } 63 | } 64 | reply->deleteLater(); 65 | } 66 | catch (std::exception e) 67 | { 68 | reply->deleteLater(); 69 | } 70 | }); 71 | accessManager_->get(request_); 72 | } 73 | 74 | void AboutDialog::showOnStart(bool b) 75 | { 76 | QSettings settings; 77 | settings.setValue("/Sys/AboutShowOnStart", b); 78 | } 79 | -------------------------------------------------------------------------------- /CodeX/AboutDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | namespace Ui { class AboutDialog; }; 6 | 7 | class QNetworkAccessManager; 8 | class QNetworkRequest; 9 | 10 | class AboutDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | AboutDialog(QWidget *parent = Q_NULLPTR); 16 | ~AboutDialog(); 17 | 18 | void checkUpdate(); 19 | 20 | QVersionNumber version; 21 | 22 | private slots: 23 | void showOnStart(bool b); 24 | 25 | private: 26 | Ui::AboutDialog *ui; 27 | QNetworkAccessManager* accessManager_; 28 | QNetworkRequest request_; 29 | }; 30 | -------------------------------------------------------------------------------- /CodeX/AboutDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AboutDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 504 10 | 295 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 504 22 | 295 23 | 24 | 25 | 26 | 27 | 等线 28 | 14 29 | 30 | 31 | 32 | 关于 33 | 34 | 35 | 36 | 37 | 38 | <html><head/><body><p><a href="./CodeX.pdf"><span style=" text-decoration: underline; color:#0000ff;">说明书</span></a> | <a href="https://www.bilibili.com/video/BV1r7411N75u/"><span style=" text-decoration: underline; color:#0000ff;">视频教程</span></a> | <a href="https://bbs.nga.cn/read.php?tid=20284990"><span style=" text-decoration: underline; color:#0000ff;">NGA</span></a> | <a href="https://github.com/xxzl0130/CodeX"><span style=" text-decoration: underline; color:#0000ff;">GitHub</span></a></p></body></html> 39 | 40 | 41 | Qt::AlignCenter 42 | 43 | 44 | 45 | 46 | 47 | 48 | Copyright © 2022 轩轩醉了 49 | 50 | 51 | Qt::AlignCenter 52 | 53 | 54 | 55 | 56 | 57 | 58 | <html><head/><body><p><a href="https://github.com/xxzl0130/CodeX/blob/master/doc/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md"><span style=" text-decoration: underline; color:#0000ff;">说明书</span></a> | <a href="https://www.bilibili.com/video/BV1r7411N75u/"><span style=" text-decoration: underline; color:#0000ff;">视频教程</span></a> | <a href="https://bbs.nga.cn/read.php?tid=20284990"><span style=" text-decoration: underline; color:#0000ff;">NGA</span></a> | <a href="https://github.com/xxzl0130/CodeX"><span style=" text-decoration: underline; color:#0000ff;">GitHub</span></a></p></body></html> 59 | 60 | 61 | Qt::AutoText 62 | 63 | 64 | Qt::AlignCenter 65 | 66 | 67 | true 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 启动时显示此窗口 77 | 78 | 79 | 80 | 81 | 82 | 83 | Qt::Horizontal 84 | 85 | 86 | 87 | 40 88 | 20 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 关闭 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | <html><head/><body><p><a href="mailto:zaxs0130@gmail.com"><span style=" text-decoration: underline; color:#0000ff;">Mail: zaxs0130@gmail.com</span></a></p></body></html> 106 | 107 | 108 | Qt::AlignCenter 109 | 110 | 111 | true 112 | 113 | 114 | 115 | 116 | 117 | 118 | <html><head/><body><p>本程序遵循<a href="http://www.gnu.org/licenses/lgpl-3.0.html"><span style=" text-decoration: underline; color:#0000ff;">LGPL 3.0</span></a>开源</p></body></html> 119 | 120 | 121 | Qt::AlignCenter 122 | 123 | 124 | true 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 200 133 | 200 134 | 135 | 136 | 137 | 138 | 139 | 140 | :/CodeX/Resources/pay.png 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 12 149 | 150 | 151 | 152 | 觉得好就支持一下吧~ 153 | 154 | 155 | Qt::AlignCenter 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | pushButton 168 | clicked() 169 | AboutDialog 170 | close() 171 | 172 | 173 | 280 174 | 145 175 | 176 | 177 | 377 178 | 131 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /CodeX/AltSolutionWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "AltSolutionWindow.h" 3 | #include "ui_AltSolutionWindow.h" 4 | #include "CodeX.h" 5 | 6 | AltSolutionWindow::AltSolutionWindow(QWidget *parent) 7 | : QDialog(parent), 8 | ui(new Ui::AltSolutionWindow()), 9 | chipTableModel_(new ChipTableModel(this)), 10 | chipTableDelegate_(new ChipTableDelegate(this)), 11 | solutionTableModel_(new SolutionTableModel(this)) 12 | { 13 | ui->setupUi(this); 14 | } 15 | 16 | AltSolutionWindow::~AltSolutionWindow() 17 | { 18 | delete ui; 19 | } 20 | 21 | void AltSolutionWindow::addSolution(const Solution& s) 22 | { 23 | for(const auto& it : s.chips) 24 | { 25 | chipCount_[it.no]++; 26 | } 27 | this->solutions_.push_back(s); 28 | this->solutionTableModel_->refresh(); 29 | saveSolutions(); 30 | } 31 | 32 | void AltSolutionWindow::clearSolution() 33 | { 34 | this->solutions_.clear(); 35 | this->chipCount_.clear(); 36 | this->solutionTableModel_->refresh(); 37 | saveSolutions(); 38 | } 39 | 40 | void AltSolutionWindow::init() 41 | { 42 | this->ui->chipView->setChipSize(QSize(8, 8)); 43 | this->ui->chipsTable->setModel(chipTableModel_); 44 | this->ui->chipsTable->setSelectionBehavior(QAbstractItemView::SelectRows); 45 | this->ui->chipsTable->setItemDelegate(chipTableDelegate_); 46 | this->ui->chipsTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); 47 | this->ui->chipsTable->verticalHeader()->hide(); 48 | this->ui->chipsTable->setColumnHidden(2, true); 49 | this->chipTableModel_->setShowBlocks(false); 50 | this->chipTableModel_->setShowStatus(false); 51 | this->chipTableModel_->setShowColor(true); 52 | this->ui->solutionTable->setModel(solutionTableModel_); 53 | this->ui->solutionTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); 54 | this->ui->solutionTable->verticalHeader()->hide(); 55 | this->ui->solutionTable->setSelectionBehavior(QAbstractItemView::SelectRows); 56 | this->ui->solutionTable->setSelectionMode(QAbstractItemView::SingleSelection); 57 | this->ui->solutionTable->setSortingEnabled(true); 58 | this->solutionTableModel_->setSolution(&this->solutions_); 59 | this->solutionTableModel_->setShowError(false); 60 | connect(); 61 | QSettings settings; 62 | auto data = settings.value("/User/Solutions", "[]").toByteArray(); 63 | auto doc = QJsonDocument::fromJson(data); 64 | this->solutions_.clear(); 65 | for(const auto& it : doc.array()) 66 | { 67 | this->addSolution(Solution::fromJsonObject(it.toObject())); 68 | } 69 | this->solutionTableModel_->refresh(); 70 | } 71 | 72 | bool AltSolutionWindow::chipUsed(int no) 73 | { 74 | auto it = chipCount_.find(no); 75 | if (it != chipCount_.end() && it->second > 0) 76 | return true; 77 | return false; 78 | } 79 | 80 | void AltSolutionWindow::closeEvent(QCloseEvent* e) 81 | { 82 | saveSolutions(); 83 | QDialog::closeEvent(e); 84 | } 85 | 86 | void AltSolutionWindow::saveSolutions() 87 | { 88 | QJsonArray arr; 89 | for(const auto& it : solutions_) 90 | { 91 | arr.append(it.toObject()); 92 | } 93 | QSettings settings; 94 | QJsonDocument doc(arr); 95 | settings.setValue("/User/Solutions", doc.toJson(QJsonDocument::Compact)); 96 | } 97 | 98 | void AltSolutionWindow::connect() 99 | { 100 | QObject::connect( 101 | this->ui->solutionTable, 102 | &QTableView::clicked, 103 | [&](QModelIndex index) 104 | { 105 | this->selectSolution(index.row()); 106 | }); 107 | QObject::connect( 108 | this->ui->delButton, 109 | &QPushButton::clicked, 110 | this, 111 | &AltSolutionWindow::delSolution 112 | ); 113 | } 114 | 115 | void AltSolutionWindow::selectSolution(int index) 116 | { 117 | Chips solutionChips; 118 | const auto& solution = solutions_[index]; 119 | for (const auto& it : solution.chips) 120 | { 121 | solutionChips.push_back(CodeX::instance()->chips[it.no]); 122 | } 123 | this->chipTableModel_->setChips(solutionChips); 124 | this->ui->chipView->setView(CodeX::instance()->solver_->solution2ChipView(solution, solution.squad)); 125 | } 126 | 127 | void AltSolutionWindow::delSolution() 128 | { 129 | auto index = this->ui->solutionTable->currentIndex().row(); 130 | if (index < 0 || index >= solutions_.size()) 131 | return; 132 | for(const auto& it : solutions_[index].chips) 133 | { 134 | chipCount_[it.no]--; 135 | } 136 | solutions_.erase(solutions_.begin() + index); 137 | solutionTableModel_->refresh(); 138 | } 139 | -------------------------------------------------------------------------------- /CodeX/AltSolutionWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | namespace Ui { class AltSolutionWindow; }; 6 | class GFChip; 7 | class ChipSolver; 8 | class ChipTableModel; 9 | class ChipTableDelegate; 10 | class SolutionTableModel; 11 | 12 | class AltSolutionWindow : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | AltSolutionWindow(QWidget *parent = Q_NULLPTR); 18 | ~AltSolutionWindow(); 19 | 20 | void addSolution(const Solution& s); 21 | void clearSolution(); 22 | 23 | void init(); 24 | bool chipUsed(int no); 25 | 26 | protected: 27 | void closeEvent(QCloseEvent*) override; 28 | 29 | protected slots: 30 | void selectSolution(int index); 31 | void delSolution(); 32 | 33 | private: 34 | Ui::AltSolutionWindow *ui; 35 | ChipTableModel* chipTableModel_; 36 | ChipTableDelegate* chipTableDelegate_; 37 | SolutionTableModel* solutionTableModel_; 38 | std::vector solutions_; 39 | std::unordered_map chipCount_; 40 | 41 | void saveSolutions(); 42 | void connect(); 43 | }; 44 | -------------------------------------------------------------------------------- /CodeX/AltSolutionWindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AltSolutionWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1111 10 | 554 11 | 12 | 13 | 14 | 15 | 等线 16 | 14 17 | 18 | 19 | 20 | 候选方案窗口 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Qt::Horizontal 32 | 33 | 34 | 35 | 40 36 | 20 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 移除 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 0 59 | 0 60 | 61 | 62 | 63 | 64 | 250 65 | 250 66 | 67 | 68 | 69 | 70 | 250 71 | 250 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 0 83 | 0 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | ChipView 96 | QWidget 97 |
ChipView/ChipView.h
98 | 1 99 |
100 |
101 | 102 | 103 |
104 | -------------------------------------------------------------------------------- /CodeX/CodeX.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma warning(disable:26812) 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace Ui { class CodeX; } 10 | class GFChip; 11 | class ChipSolver; 12 | class ChipDataWindow; 13 | class QProgressBar; 14 | class QLabel; 15 | class ChipTableModel; 16 | class ChipTableDelegate; 17 | class SolutionTableModel; 18 | class SettingWindow; 19 | class AboutDialog; 20 | class AltSolutionWindow; 21 | 22 | class CodeX : public QMainWindow 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | static CodeX* instance(); 28 | 29 | // 芯片列表 30 | Chips chips; 31 | // 外层按颜色分类,内层按grid编号分类的芯片,保存强制+20的属性 32 | std::map>> gridChips; 33 | // 按小队分类的已装备的芯片 34 | std::map> squadChips; 35 | 36 | // 求解器 37 | ChipSolver* solver_; 38 | 39 | bool chipUsed(int no); 40 | 41 | std::function getChipUsedFunc(); 42 | 43 | protected slots: 44 | void solve(); 45 | void solveFinished(); 46 | void selectSolution(int index); 47 | void addAltSolution(); 48 | void chipsChanged(); 49 | void solutionNumberChanged(long long); 50 | 51 | private: 52 | CodeX(QWidget* parent = Q_NULLPTR); 53 | static CodeX* singleton; 54 | 55 | void connect(); 56 | 57 | Ui::CodeX *ui; 58 | ChipDataWindow* chipDataWindow_; 59 | SettingWindow* settingWindow_; 60 | 61 | QProgressBar* progressBar_; 62 | QLabel* solveNumberLabel_; 63 | QLabel* timeLabel_; 64 | // 保存解决方案 65 | std::map < QString, std::map > solutions_; 66 | 67 | ChipTableModel* chipTableModel_; 68 | ChipTableDelegate* chipTableDelegate_; 69 | SolutionTableModel* solutionTableModel_; 70 | AboutDialog* aboutDialog_; 71 | AltSolutionWindow* altSolutionWindow_; 72 | 73 | QTimer* timer_; 74 | QDateTime startTime_; 75 | }; 76 | -------------------------------------------------------------------------------- /CodeX/CodeX.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/CodeX/CodeX.ico -------------------------------------------------------------------------------- /CodeX/CodeX.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Resources/pay.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /CodeX/CodeX.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "CodeX.ico" 2 | 3 | -------------------------------------------------------------------------------- /CodeX/CodeX.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeX 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1125 10 | 694 11 | 12 | 13 | 14 | 15 | 等线 16 | 14 17 | 18 | 19 | 20 | CodeX重装芯片计算器 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 使用已锁定 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 0 40 | 0 41 | 42 | 43 | 44 | 小队: 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 0 56 | 0 57 | 58 | 59 | 60 | 方案: 61 | 62 | 63 | 64 | 65 | 66 | 67 | 开始计算 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 0 76 | 0 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 | 0 118 | 0 119 | 120 | 121 | 122 | 123 | 250 124 | 250 125 | 126 | 127 | 128 | 129 | 250 130 | 250 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 0 142 | 0 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 0 156 | 0 157 | 158 | 159 | 160 | CodeX重装芯片计算器 161 | 162 | 163 | 164 | 165 | 166 | 167 | 芯片 168 | 169 | 170 | 171 | 172 | 173 | 174 | 候选 175 | 176 | 177 | 178 | 179 | 180 | 181 | 设置 182 | 183 | 184 | 185 | 186 | 187 | 188 | 关于 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | ChipView 205 | QWidget 206 |
ChipView/ChipView.h
207 | 1 208 |
209 |
210 | 211 | 212 | 213 | 214 |
215 | -------------------------------------------------------------------------------- /CodeX/CodeX.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 14 | qrc;* 15 | false 16 | 17 | 18 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3} 19 | ui 20 | 21 | 22 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 23 | qrc;* 24 | false 25 | 26 | 27 | 28 | 29 | Source Files 30 | 31 | 32 | Source Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | Source Files 39 | 40 | 41 | Source Files 42 | 43 | 44 | Source Files 45 | 46 | 47 | 48 | 49 | Header Files 50 | 51 | 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | 67 | 68 | Form Files 69 | 70 | 71 | Form Files 72 | 73 | 74 | Form Files 75 | 76 | 77 | Form Files 78 | 79 | 80 | 81 | 82 | Resource Files 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /CodeX/GF_Tool_Server.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/CodeX/GF_Tool_Server.exe -------------------------------------------------------------------------------- /CodeX/Resources/pay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/CodeX/Resources/pay.png -------------------------------------------------------------------------------- /CodeX/SettingWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "SettingWindow.h" 3 | #include "ui_SettingWindow.h" 4 | #include "CodeX.h" 5 | 6 | SettingWindow::SettingWindow(QWidget *parent) 7 | : QDialog(parent), 8 | ui(new Ui::SettingWindow()) 9 | { 10 | ui->setupUi(this); 11 | connect(); 12 | this->ui->threadLabel->setText(u8"推荐值:" + QString::number(QThread::idealThreadCount())); 13 | } 14 | 15 | SettingWindow::~SettingWindow() 16 | { 17 | delete ui; 18 | } 19 | 20 | TargetBlock SettingWindow::getTargetBlock(const QString& squad) 21 | { 22 | TargetBlock target; 23 | for(auto i = 0;i < this->ui->gridLayout->rowCount();++i) 24 | { 25 | if(dynamic_cast(this->ui->gridLayout->itemAtPosition(i,0)->widget())->text() == squad) 26 | { 27 | target.damageBlock = dynamic_cast(this->ui->gridLayout->itemAtPosition(i, 1)->widget())->value(); 28 | target.defbreakBlock = dynamic_cast(this->ui->gridLayout->itemAtPosition(i, 2)->widget())->value(); 29 | target.hitBlock = dynamic_cast(this->ui->gridLayout->itemAtPosition(i, 3)->widget())->value(); 30 | target.reloadBlock = dynamic_cast(this->ui->gridLayout->itemAtPosition(i, 4)->widget())->value(); 31 | target.error = dynamic_cast(this->ui->gridLayout->itemAtPosition(i, 5)->widget())->value(); 32 | break; 33 | } 34 | } 35 | this->show(); 36 | target.showNumber = this->ui->numbersSpinBox->value(); 37 | target.maxNumber = this->ui->unlimitCheckBox->isChecked() ? -1 : this->ui->maxSpinBox->value(); 38 | this->hide(); 39 | return target; 40 | } 41 | 42 | void SettingWindow::reset() 43 | { 44 | auto squads = CodeX::instance()->solver_->squadList(); 45 | for(auto i = 0;i < squads.size();++i) 46 | { 47 | dynamic_cast(this->ui->gridLayout->itemAtPosition(i + 1, 0)->widget())->setText(squads[i]); 48 | auto value = CodeX::instance()->solver_->squadMaxValue(squads[i]); 49 | dynamic_cast(this->ui->gridLayout->itemAtPosition(i + 1, 1)->widget())->setValue(value.damageBlock); 50 | dynamic_cast(this->ui->gridLayout->itemAtPosition(i + 1, 2)->widget())->setValue(value.defbreakBlock); 51 | dynamic_cast(this->ui->gridLayout->itemAtPosition(i + 1, 3)->widget())->setValue(value.hitBlock); 52 | dynamic_cast(this->ui->gridLayout->itemAtPosition(i + 1, 4)->widget())->setValue(value.reloadBlock); 53 | dynamic_cast(this->ui->gridLayout->itemAtPosition(i + 1, 5)->widget())->setValue(value.squad); 54 | } 55 | this->ui->numbersSpinBox->setValue(1000); 56 | this->ui->maxSpinBox->setValue(10000); 57 | } 58 | 59 | void SettingWindow::show() 60 | { 61 | QSettings settings; 62 | this->ui->numbersSpinBox->setValue(settings.value(IniShowLimit, 1000).toInt()); 63 | this->ui->maxSpinBox->setValue(settings.value(IniCalcLimit, 10000).toInt()); 64 | this->ui->unlimitCheckBox->setChecked(settings.value(IniNoLimit, false).toBool()); 65 | this->ui->threadSpinBox->setValue(settings.value(IniThreads, 1).toInt()); 66 | this->ui->threadSpinBox->setMaximum(QThread::idealThreadCount() * 5); 67 | QDialog::show(); 68 | } 69 | 70 | void SettingWindow::accept() 71 | { 72 | QSettings settings; 73 | settings.setValue(IniShowLimit, this->ui->numbersSpinBox->value()); 74 | settings.setValue(IniCalcLimit, this->ui->maxSpinBox->value()); 75 | settings.setValue(IniNoLimit, this->ui->unlimitCheckBox->isChecked()); 76 | settings.setValue(IniThreads, this->ui->threadSpinBox->value()); 77 | QDialog::accept(); 78 | } 79 | 80 | void SettingWindow::connect() 81 | { 82 | QObject::connect( 83 | this->ui->resetButton, 84 | &QPushButton::clicked, 85 | this, 86 | &SettingWindow::reset 87 | ); 88 | QObject::connect( 89 | this->ui->okButton, 90 | &QPushButton::clicked, 91 | this, 92 | &SettingWindow::accept 93 | ); 94 | QObject::connect( 95 | this->ui->unlimitCheckBox, 96 | &QCheckBox::stateChanged, 97 | [&](int state) 98 | { 99 | this->ui->maxSpinBox->setEnabled(state != Qt::CheckState::Checked); 100 | } 101 | ); 102 | } 103 | -------------------------------------------------------------------------------- /CodeX/SettingWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | namespace Ui { class SettingWindow; }; 5 | struct TargetBlock; 6 | 7 | class SettingWindow : public QDialog 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | SettingWindow(QWidget *parent = Q_NULLPTR); 13 | ~SettingWindow(); 14 | 15 | TargetBlock getTargetBlock(const QString& squad); 16 | 17 | public slots: 18 | void reset(); 19 | void show(); 20 | void accept() override; 21 | 22 | private: 23 | void connect(); 24 | 25 | Ui::SettingWindow *ui; 26 | }; 27 | -------------------------------------------------------------------------------- /CodeX/main.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CodeX.h" 3 | #include 4 | 5 | CodeX* CodeX::singleton = nullptr; 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 10 | QApplication a(argc, argv); 11 | QApplication::setOrganizationName("xuanxuan.tech"); 12 | QApplication::setApplicationName("CodeX"); 13 | QSettings::setDefaultFormat(QSettings::IniFormat); 14 | CodeX::instance()->show(); 15 | return a.exec(); 16 | } 17 | -------------------------------------------------------------------------------- /CodeX/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | -------------------------------------------------------------------------------- /CodeX/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "ChipDataWindow/ChipDataWindow.h" 13 | #include "ChipView/ChipView.h" 14 | #include "Chip/Chip.h" 15 | #include "ChipSolver/ChipSolver.h" 16 | #include "ChipTableView/ChipTableView.h" 17 | #include "ChipTableView/SolutionTableModel.h" 18 | 19 | constexpr auto IniShowLimit = "/Sys/ShowLimit"; 20 | constexpr auto IniCalcLimit = "/Sys/CalcLimit"; 21 | constexpr auto IniNoLimit = "/Sys/NoLimit"; 22 | constexpr auto IniThreads = "/Sys/Threads"; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodeX 2 | 少女前线芯片计算器CodeX 3 | [使用说明](./doc/使用说明.md) 4 | 转载请注明出处,禁止用于商业。 5 | ![GitHub](https://img.shields.io/github/license/xxzl0130/CodeX) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/xxzl0130/CodeX) ![GitHub All Releases](https://img.shields.io/github/downloads/xxzl0130/CodeX/total) 6 | 7 | ## 目前功能: 8 | * 从本地代理/网络代理获取芯片数据 9 | * 配置各小队参数 10 | * 为各小队配置不同的芯片组合方案(例如用不用5格) 11 | * 按格数筛选方案 12 | * 在方案列表中直接对各属性排序 13 | * Top n 14 | * 计算并显示当前各小队的满强化属性 15 | * 保存为各小队选择的配置 16 | * 在计算中排除已经选择的配置中的芯片 17 | 18 | ## 依赖 19 | [zlib](https://github.com/madler/zlib) 20 | [gzip-hpp](https://github.com/mapbox/gzip-hpp) 21 | [openssl](https://github.com/openssl/openssl) 22 | 23 | 芯片图片素材来自[GFTool](https://github.com/hycdes/GFTool) 24 | 芯片解法数据来自[GFChipToolX](https://github.com/xxzl0130/GFChipToolX) 25 | 26 | ## 打赏 27 | 微信扫码支持一下~ 28 | ![微信打赏](https://raw.githubusercontent.com/xxzl0130/CodeX/master/CodeX/Resources/pay.png) 29 | -------------------------------------------------------------------------------- /doc/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/1.png -------------------------------------------------------------------------------- /doc/img/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/10.png -------------------------------------------------------------------------------- /doc/img/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/11.png -------------------------------------------------------------------------------- /doc/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/2.png -------------------------------------------------------------------------------- /doc/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/3.png -------------------------------------------------------------------------------- /doc/img/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/4.jpg -------------------------------------------------------------------------------- /doc/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/5.png -------------------------------------------------------------------------------- /doc/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/6.png -------------------------------------------------------------------------------- /doc/img/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/7.jpg -------------------------------------------------------------------------------- /doc/img/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/8.png -------------------------------------------------------------------------------- /doc/img/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/9.png -------------------------------------------------------------------------------- /doc/img/firewall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxzl0130/CodeX/c0c2e2f540a63f0b2c69fe3647a065944504b5cb/doc/img/firewall.png -------------------------------------------------------------------------------- /doc/使用说明.md: -------------------------------------------------------------------------------- 1 | # CodeX 重装芯片计算器使用说明 2 | 主程序为“CodeX.exe”。目录下会附带有其他支持文件以及“GF_Tool_Server.exe”,该程序来自于这个[芯片提取工具](https://bbs.nga.cn/read.php?tid=19277807),也可单独使用。 3 | [视频教程](https://www.bilibili.com/video/BV1r7411N75u/) 4 | 以下为详细使用步骤: 5 | ## 1. 打开主程序 6 | 双击“CodeX.exe”,将进入主界面如下: 7 | ![主界面](./img/1.png) 8 | ## 2. 获取芯片数据 9 | 单击右上角的“芯片”按钮,打开芯片数据窗口。 10 | ![芯片数据](./img/2.png) 11 | 如果之前已经读取好芯片数据,这里会显示芯片数据,以及当前各重装小队装备的芯片的参数。 12 | 如果没有,可以单击“获取芯片数据”打开新的窗口。 13 | ![获取芯片数据窗口](./img/3.png) 14 | 这里可以看到“本地代理”和“网络代理”两个选项,其中本地代理将启动附带的“GF_Tool_Server.exe”程序进行代理,而网络代理则将使用网络服务器进行代理。 15 | 两个代理的原理是完全一致的,只不过一个是部署在服务器上,一个是部署在用户本机电脑上。程序已开源(见前言)。 16 | 出于安全性考虑,使用网络代理**建议在使用前后修改密码**。 17 | 本地代理适合于部分没有自动代理的手机(ViVo),而本地代理出错或者没有WiFi的时候可以用网络代理。 18 | 19 | ### 2.1. 使用网络代理 20 | 选择网络代理时,下方的文本框会显示自动代理地址,地址为: 21 | `http://static.xuanxuan.tech/GF/GF.pac` 22 | 需要将该地址设置到手机中。以下说明以安卓手机为例: 23 | 打开手机,连接任意WiFi,长按选择修改网络,打开高级选项,代理模式为“自动”或“自动配置”,将该地址填入,例如: 24 | ![自动代理图](./img/4.jpg) 25 | 然后保存设置。 26 | 随后完全退出游戏并重新进入。为了避免滥用服务器,此时进入游戏后将卡死在基地界面无法操作,出现此情况也代表着代理设置正确。 27 | 此时在“获取芯片数据”窗口中,准确填写UID和昵称信息,单击“获取数据”,即可读取到芯片数据。如弹出错误请按错误说明重试。 28 | 29 | ### 2.2. 使用本地代理 30 | 选择本地代理时,“启动”按钮将亮起: 31 | ![“启动”按钮](./img/5.png) 32 | 单击“启动”按钮,程序启动时,防火墙可能会弹出提示,此时请选择允许其通信,注意勾选“专用网络”。 33 | ![防火墙](./img/firewall.png) 34 | 启动成功后将弹出成功提示,同时文本框会提示代理地址与端口: 35 | ![手动代理](./img/6.png) 36 | 例如,这里显示的代理地址为`192.168.3.31`,端口为`8081`。需要将该地址设置到手机中。以下说明以安卓手机为例: 37 | 打开手机,连接与电脑同一局域网的WiFi,长按选择修改网络,打开高级选项,选择代理模式为“手动”,将地址和端口分别填入,例如: 38 | ![手动代理图](./img/7.jpg) 39 | 然后保存设置。 40 | 随后完全退出游戏并重新进入。进入基地界面后,即可在“获取芯片数据”窗口中,准确填写UID和昵称信息,单击“获取数据”,即可读取到芯片数据。如弹出错误请按错误说明重试。 41 | 42 | ## 3. 设置重装小队参数 43 | 在主界面右上角,可以选择不同的重装小队以及对应的方案,例如AT4有“只用6格”和“使用5格”两种方案: 44 | ![AT4](./img/8.png) 45 | 另外也可以勾选“使用已锁定”按钮来在计算过程中使用游戏中锁定的芯片。 46 | 勾选“使用已装备”按钮会在计算过程中使用游戏中已经装备到重装小队上的芯片。 47 | 勾选“使用候选方案”则会在计算过程中使用已经添加到候选方案列表中的方案中使用到的芯片。 48 | 单击主界面右上角“设置”按钮,可以打开设置窗口。这里可以设置各个重装的目标属性格数以及要求解的方案数量。重装属性默认为公认的最优解,单击“重置”按钮可以恢复。 49 | “自由”一栏表示最终方案允许的格数偏差值。 50 | “计算方案数”表示整个计算过程中最多计算的方案数量,而程序会从中按属性总偏差值取出top n个显示在界面上,n由显示方案数指定。 51 | ![设置](./img/9.png) 52 | 设置完成后,单击“开始计算”即可执行计算过程。 53 | 54 | ## 4. 查看方案 55 | 计算完成后,主界面将显示芯片方案如下: 56 | ![方案](./img/10.png) 57 | 单击左侧任意方案,会在右侧显示拼法图解以及所用到的芯片。 58 | 在左侧的方案列表中,四项属性是当前方案所有芯片满强化后的总属性,而括号中的数值是与属性上限的差值,如果溢出则为0。总偏差也是计算的所有不足的属性之和,溢出部分不计入。 59 | 也就是说,括号中的数值越大越好,总偏差越大(绝对值越小)越好。 60 | 总等级一列是该方案中所有芯片的强化等级,以供参考当前方案能节省多少强化资源。 61 | 校准券一列提供了当前方案需要消耗的校准券的参考值。可能存在误差。 62 | 单击表头可以按各列属性分别排序。 63 | 64 | ## 5. 查看候选方案 65 | 在主界面的方案列表中单击选择任意方案后,可以单击右侧的“加入候选”按钮将该方案加入到候选方案列表中。 66 | 单击主界面的“候选”按钮可以打开候选方案窗口如下: 67 | ![候选窗口](./img/11.png) 68 | 在这里可以查看候选方案列表中的各个方案,包括拼法详情。 69 | 也可从这里将方案删除候选。 70 | 71 | ## 6. 关于台服 72 | 在使用代理过程中,无论是本地代理还是网络代理,操作一样如下: 73 | 将压缩包中的[ca.crt]传送到手机上安装,之后正常操作。 74 | 对于安卓7以上,app可以主动选择不认用户安装的证书,人工把装好的证书丢进系统证书目录里才能用 75 | 需要从把证书`/data/misc/user/0/cacerts-added/`挪到`/system/etc/security/cacerts/` 76 | 因此推荐使用模拟器读取数据,因为目前模拟器普遍在安卓5-6。 77 | 78 | # 最后 79 | 本程序(包括附带的GF_Tool_Server)均已开源(涉及直接解密游戏数据的部分除外),欢迎贡献代码。 80 | 转载请注明出处,禁止用于商业。 81 | 82 | # 联系我 83 | [GitHub](https://github.com/xxzl0130/CodeX) 84 | [NGA](https://bbs.nga.cn/read.php?tid=20284990) 85 | [Mail:zaxs0130@gmail.com](mailto:zaxs0130@gmail.com) 86 | --------------------------------------------------------------------------------