diff --git a/android/gradle.properties b/android/gradle.properties index 30298b3b3f04073678e48519b8c043edba635df8..6c1d873456149a8611e43a05ae56e4f50c73274f 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=0.0.18 -app.versionCode=18 +app.versionName=0.0.19 +app.versionCode=19 diff --git a/assets/icons/boardSize_10.png b/assets/icons/boardSize_10.png deleted file mode 100644 index 4b4f7754fb46de7cf2ddfc265da900bf77cc0d3e..0000000000000000000000000000000000000000 Binary files a/assets/icons/boardSize_10.png and /dev/null differ diff --git a/assets/icons/boardSize_14.png b/assets/icons/boardSize_14.png deleted file mode 100644 index 18b3420564654a9adf32e5a91d0d41f82fd4e2ce..0000000000000000000000000000000000000000 Binary files a/assets/icons/boardSize_14.png and /dev/null differ diff --git a/assets/icons/boardSize_20.png b/assets/icons/boardSize_20.png deleted file mode 100644 index d3401d9dd4df7a871eb7ac88592707f63480d0dc..0000000000000000000000000000000000000000 Binary files a/assets/icons/boardSize_20.png and /dev/null differ diff --git a/assets/icons/boardSize_6.png b/assets/icons/boardSize_6.png deleted file mode 100644 index 2c72840d2dfe2dfb36791973a159869a325de758..0000000000000000000000000000000000000000 Binary files a/assets/icons/boardSize_6.png and /dev/null differ diff --git a/assets/icons/colorsCount_5.png b/assets/icons/colorsCount_5.png deleted file mode 100644 index dd0a276e105a79aa25ca36f6cc4d2f69c77df81f..0000000000000000000000000000000000000000 Binary files a/assets/icons/colorsCount_5.png and /dev/null differ diff --git a/assets/icons/colorsCount_6.png b/assets/icons/colorsCount_6.png deleted file mode 100644 index 2a63916ed00f0570bedd1647e34706d041fbec44..0000000000000000000000000000000000000000 Binary files a/assets/icons/colorsCount_6.png and /dev/null differ diff --git a/assets/icons/colorsCount_7.png b/assets/icons/colorsCount_7.png deleted file mode 100644 index fdc1669a1d89ed225cc4624319ff01558ab987b4..0000000000000000000000000000000000000000 Binary files a/assets/icons/colorsCount_7.png and /dev/null differ diff --git a/assets/icons/colorsCount_8.png b/assets/icons/colorsCount_8.png deleted file mode 100644 index b660ef3e29aefc5c940a327aaf7a22d76a73bb23..0000000000000000000000000000000000000000 Binary files a/assets/icons/colorsCount_8.png and /dev/null differ diff --git a/fastlane/metadata/android/en-US/changelogs/19.txt b/fastlane/metadata/android/en-US/changelogs/19.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad92c1909de2491bfe965250c3f4915a47051788 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/19.txt @@ -0,0 +1 @@ +Use painters to draw game parameters selector items. diff --git a/fastlane/metadata/android/fr-FR/changelogs/19.txt b/fastlane/metadata/android/fr-FR/changelogs/19.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4c146bee7a29e29a95904ef077ca2dd54194e0e --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/19.txt @@ -0,0 +1 @@ +Utilisation de painters pour dessiner les items de sélection des paramètres de jeu. diff --git a/icons/boardSize_10.svg b/icons/boardSize_10.svg deleted file mode 100644 index bcc2fbaa18cd06829e8f6cfd8ab460c699929e9a..0000000000000000000000000000000000000000 --- a/icons/boardSize_10.svg +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 100 100" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" ry="0" fill="#f29c38" stroke="#000" stroke-width="2"/> - <g transform="translate(11.967 8.1117)" fill="#fff" stroke="#282828" stroke-linecap="round" stroke-width="3"><rect x="18.962" y="22.818" width="12.714" height="12.714"/><rect x="31.676" y="22.818" width="12.714" height="12.714"/><rect x="44.389" y="22.818" width="12.714" height="12.714"/><rect x="18.962" y="35.531" width="12.714" height="12.714"/><rect x="31.676" y="35.531" width="12.714" height="12.714"/><rect x="44.389" y="35.531" width="12.714" height="12.714"/><rect x="18.962" y="48.245" width="12.714" height="12.714"/><rect x="31.676" y="48.245" width="12.714" height="12.714"/><rect x="44.389" y="48.245" width="12.714" height="12.714"/></g></svg> diff --git a/icons/boardSize_14.svg b/icons/boardSize_14.svg deleted file mode 100644 index 174a5301a12bf2137b6e5de4cb2431d56ee4f660..0000000000000000000000000000000000000000 --- a/icons/boardSize_14.svg +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 100 100" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" ry="0" fill="#cd5542" stroke="#000" stroke-width="2"/> - <g transform="translate(6.2763 8.2075)" fill="#fff" stroke="#282828" stroke-linecap="round" stroke-width="3"><rect x="18.296" y="16.365" width="12.714" height="12.714"/><rect x="31.01" y="16.365" width="12.714" height="12.714"/><rect x="43.724" y="16.365" width="12.714" height="12.714"/><rect x="56.437" y="16.365" width="12.714" height="12.714"/><rect x="18.296" y="29.079" width="12.714" height="12.714"/><rect x="31.01" y="29.079" width="12.714" height="12.714"/><rect x="43.724" y="29.079" width="12.714" height="12.714"/><rect x="56.437" y="29.079" width="12.714" height="12.714"/><rect x="18.296" y="41.792" width="12.714" height="12.714"/><rect x="31.01" y="41.792" width="12.714" height="12.714"/><rect x="43.724" y="41.792" width="12.714" height="12.714"/><rect x="56.437" y="41.792" width="12.714" height="12.714"/><rect x="18.296" y="54.506" width="12.714" height="12.714"/><rect x="31.01" y="54.506" width="12.714" height="12.714"/><rect x="43.724" y="54.506" width="12.714" height="12.714"/><rect x="56.437" y="54.506" width="12.714" height="12.714"/></g></svg> diff --git a/icons/boardSize_20.svg b/icons/boardSize_20.svg deleted file mode 100644 index fe07dfb952480afa9c7c9e0ab2af9879f9b2ad6a..0000000000000000000000000000000000000000 --- a/icons/boardSize_20.svg +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 100 100" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" ry="0" fill="#5f41af" stroke="#000" stroke-width="2"/> - <g transform="translate(4.4197 1.4084)" fill="#fff" stroke="#282828" stroke-linecap="round" stroke-width="3"><rect x="13.796" y="16.807" width="12.714" height="12.714"/><rect x="26.51" y="16.807" width="12.714" height="12.714"/><rect x="39.223" y="16.807" width="12.714" height="12.714"/><rect x="51.937" y="16.807" width="12.714" height="12.714"/><rect x="64.651" y="16.807" width="12.714" height="12.714"/><rect x="13.796" y="29.521" width="12.714" height="12.714"/><rect x="26.51" y="29.521" width="12.714" height="12.714"/><rect x="39.223" y="29.521" width="12.714" height="12.714"/><rect x="51.937" y="29.521" width="12.714" height="12.714"/><rect x="64.651" y="29.521" width="12.714" height="12.714"/><rect x="13.796" y="42.235" width="12.714" height="12.714"/><rect x="26.51" y="42.235" width="12.714" height="12.714"/><rect x="39.223" y="42.235" width="12.714" height="12.714"/><rect x="51.937" y="42.235" width="12.714" height="12.714"/><rect x="64.651" y="42.235" width="12.714" height="12.714"/><rect x="13.796" y="54.948" width="12.714" height="12.714"/><rect x="26.51" y="54.948" width="12.714" height="12.714"/><rect x="39.223" y="54.948" width="12.714" height="12.714"/><rect x="51.937" y="54.948" width="12.714" height="12.714"/><rect x="64.651" y="54.948" width="12.714" height="12.714"/><rect x="13.796" y="67.662" width="12.714" height="12.714"/><rect x="26.51" y="67.662" width="12.714" height="12.714"/><rect x="39.223" y="67.662" width="12.714" height="12.714"/><rect x="51.937" y="67.662" width="12.714" height="12.714"/><rect x="64.651" y="67.662" width="12.714" height="12.714"/></g></svg> diff --git a/icons/boardSize_6.svg b/icons/boardSize_6.svg deleted file mode 100644 index 1ccb6e958123c30999e47b54e784a398205c55d0..0000000000000000000000000000000000000000 --- a/icons/boardSize_6.svg +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 100 100" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" ry="0" fill="#97c05c" stroke="#000" stroke-width="2"/> - <g transform="translate(8.8715 12.603)" fill="#fff" stroke="#282828" stroke-linecap="round" stroke-width="3"><rect x="28.415" y="24.683" width="12.714" height="12.714"/><rect x="41.128" y="24.683" width="12.714" height="12.714"/><rect x="28.415" y="37.397" width="12.714" height="12.714"/><rect x="41.128" y="37.397" width="12.714" height="12.714"/></g></svg> diff --git a/icons/build_game_icons.sh b/icons/build_game_icons.sh index f86f10bce481975d4de944ff92c06a1d04d5773f..57b8c1350cd34b6f93131df7102c27b8df8d8768 100755 --- a/icons/build_game_icons.sh +++ b/icons/build_game_icons.sh @@ -25,12 +25,6 @@ AVAILABLE_GAME_IMAGES=" placeholder " -# Settings images -AVAILABLES_GAME_SETTINGS=" - boardSize:6,10,14,20 - colorsCount:5,6,7,8 -" - ####################################################### # optimize svg @@ -73,19 +67,6 @@ function build_icon() { optipng ${OPTIPNG_OPTIONS} ${TARGET} } -function build_settings_icons() { - INPUT_STRING="$1" - - SETTING_NAME="$(echo "${INPUT_STRING}" | cut -d":" -f1)" - SETTING_VALUES="$(echo "${INPUT_STRING}" | cut -d":" -f2 | tr "," " ")" - - for SETTING_VALUE in ${SETTING_VALUES} - do - SETTING_CODE="${SETTING_NAME}_${SETTING_VALUE}" - build_icon ${CURRENT_DIR}/${SETTING_CODE}.svg ${ASSETS_DIR}/icons/${SETTING_CODE}.png - done -} - ####################################################### # Create output folders @@ -101,9 +82,3 @@ for GAME_IMAGE in ${AVAILABLE_GAME_IMAGES} do build_icon ${CURRENT_DIR}/${GAME_IMAGE}.svg ${ASSETS_DIR}/icons/${GAME_IMAGE}.png done - -# build settings images -for GAME_SETTING in ${AVAILABLES_GAME_SETTINGS} -do - build_settings_icons "${GAME_SETTING}" -done diff --git a/icons/colorsCount_5.svg b/icons/colorsCount_5.svg deleted file mode 100644 index 2f218e9986906d5f873c0ff7dbfce088b3a102bf..0000000000000000000000000000000000000000 --- a/icons/colorsCount_5.svg +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 102 102" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="1" y="1" width="100" height="100" ry="0" fill="#97c05c" stroke="#000" stroke-width="2"/><g transform="translate(-1.0061 .33115)" aria-label="5"><path d="m63.315 55.063q0 2.2656-0.85938 4.2188-0.83984 1.9336-2.4609 3.3203-1.7969 1.4844-4.1406 2.207-2.3242 0.70312-5.3125 0.70312-3.4961-0.01953-5.918-0.56641-2.4023-0.52734-3.9258-1.1914v-6.4258h0.82031q1.7773 1.0547 3.8281 1.7578t4.082 0.70312q1.2305 0 2.6562-0.27344 1.4453-0.29297 2.2852-1.0352 0.66406-0.60547 0.99609-1.2305 0.35156-0.625 0.35156-1.9336 0-1.0156-0.46875-1.7383-0.44922-0.74219-1.1719-1.1914-1.0547-0.64453-2.5391-0.83984-1.4844-0.21484-2.6953-0.21484-1.7578 0-3.3789 0.3125-1.6016 0.29297-2.8125 0.58594h-0.85938v-16.406h20.684v5.5664h-13.633v4.7461q0.60547-0.03906 1.5234-0.05859 0.9375-0.03906 1.6406-0.03906 2.4023 0 4.2773 0.46875 1.8945 0.44922 3.2617 1.2695 1.7773 1.0742 2.7734 2.8516 0.99609 1.7578 0.99609 4.4336z"/></g><rect x="67.01" y="67.01" width="29.323" height="29.323" fill="#ff6f43" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="36.339" width="29.323" height="29.323" fill="#ffce2c" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="5.6672" width="29.323" height="29.323" fill="#359c35" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="36.339" y="5.6672" width="29.323" height="29.323" fill="#708cfd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="5.6671" y="5.6672" width="29.323" height="29.323" fill="#e63a3f" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/></svg> diff --git a/icons/colorsCount_6.svg b/icons/colorsCount_6.svg deleted file mode 100644 index 6df1641a1ea326ff73fc5de9229f6722ac9acd11..0000000000000000000000000000000000000000 --- a/icons/colorsCount_6.svg +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 102 102" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="1" y="1" width="100" height="100" ry="0" fill="#f29c38" stroke="#000" stroke-width="2"/><g transform="translate(3.8694 .21001)" aria-label="6"><path d="m59.025 55.399q0 2.2461-0.82031 4.2188t-2.3047 3.3203q-1.582 1.4453-3.6719 2.207-2.0703 0.76172-4.8633 0.76172-2.6172 0-4.7852-0.70312-2.1484-0.72266-3.6914-2.1875-1.7773-1.6797-2.7148-4.3359t-0.9375-6.3477q0-3.8281 0.87891-6.7969t2.8711-5.2539q1.9141-2.1875 4.9609-3.3984 3.0664-1.2109 7.2852-1.2109 1.4258 0 3.125 0.19531t2.207 0.29297v5.7227h-0.74219q-0.52734-0.25391-1.7969-0.56641-1.25-0.33203-2.8516-0.33203-3.75 0-5.8398 1.8359t-2.5195 5.1172q1.5039-0.89844 3.1641-1.4453 1.6797-0.56641 3.6133-0.56641 1.6992 0 3.1445 0.39062 1.4648 0.39062 2.7148 1.25 1.6211 1.1328 2.5977 3.0469 0.97656 1.9141 0.97656 4.7852zm-8.8867 4.3945q0.60547-0.66406 0.95703-1.5625 0.37109-0.91797 0.37109-2.4805 0-1.4258-0.41016-2.3242-0.41016-0.91797-1.1328-1.4648-0.70312-0.54688-1.6602-0.74219-0.95703-0.21484-1.9727-0.21484-0.85938 0-1.7969 0.19531-0.9375 0.19531-1.7188 0.48828 0 0.19531-0.01953 0.64453t-0.01953 1.1328q0 2.4023 0.46875 3.9648 0.48828 1.543 1.2891 2.3633 0.54688 0.60547 1.2891 0.89844 0.74219 0.27344 1.6016 0.27344 0.64453 0 1.4258-0.29297t1.3281-0.87891z"/></g><rect x="36.339" y="67.01" width="29.323" height="29.323" fill="#a13cb1" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="67.01" width="29.323" height="29.323" fill="#ff6f43" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="36.339" width="29.323" height="29.323" fill="#ffce2c" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="5.6672" width="29.323" height="29.323" fill="#359c35" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="36.339" y="5.6672" width="29.323" height="29.323" fill="#708cfd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="5.6671" y="5.6672" width="29.323" height="29.323" fill="#e63a3f" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/></svg> diff --git a/icons/colorsCount_7.svg b/icons/colorsCount_7.svg deleted file mode 100644 index 7870bc74ae13133a080de2f02397413b9d611458..0000000000000000000000000000000000000000 --- a/icons/colorsCount_7.svg +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 102 102" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="1" y="1" width="100" height="100" ry="0" fill="#cd5542" stroke="#000" stroke-width="2"/><g transform="translate(3.9378 .2393)" aria-label="7"><path d="m58.459 42.001-13.164 23.301h-8.3594l13.672-23.516h-14.941v-5.5664h22.793z"/></g><rect x="5.6671" y="67.01" width="29.323" height="29.323" fill="#38ffff" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="36.339" y="67.01" width="29.323" height="29.323" fill="#a13cb1" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="67.01" width="29.323" height="29.323" fill="#ff6f43" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="36.339" width="29.323" height="29.323" fill="#ffce2c" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="5.6672" width="29.323" height="29.323" fill="#359c35" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="36.339" y="5.6672" width="29.323" height="29.323" fill="#708cfd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="5.6671" y="5.6672" width="29.323" height="29.323" fill="#e63a3f" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/></svg> diff --git a/icons/colorsCount_8.svg b/icons/colorsCount_8.svg deleted file mode 100644 index 37f394909f7ecc1b5e53a34c304d99742ce6c149..0000000000000000000000000000000000000000 --- a/icons/colorsCount_8.svg +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 102 102" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="1" y="1" width="100" height="100" ry="0" fill="#6041b0" stroke="#000" stroke-width="2"/><g transform="translate(4.1624 .2393)" aria-label="8"><path d="m59.123 57.177q0 3.8672-3.3008 6.3281-3.2812 2.4609-9.0234 2.4609-3.2227 0-5.5273-0.66406-2.3047-0.66406-3.8086-1.8359-1.4844-1.1523-2.207-2.6953-0.70312-1.543-0.70312-3.3203 0-2.1875 1.2695-3.8672 1.2891-1.6992 4.4336-2.9688v-0.11719q-2.5391-1.1719-3.7305-2.9492t-1.1914-4.1211q0-3.457 3.2031-5.6641 3.2031-2.207 8.3398-2.207 5.3906 0 8.4375 2.0117 3.0664 1.9922 3.0664 5.332 0 2.0703-1.2891 3.6914t-3.9453 2.7539v0.11719q3.0469 1.1523 4.5117 3.1055t1.4648 4.6094zm-8.0664-13.438q0-1.4844-1.1523-2.3633-1.1328-0.87891-3.0273-0.87891-0.70312 0-1.4453 0.17578-0.72266 0.17578-1.3281 0.50781-0.56641 0.33203-0.9375 0.87891-0.37109 0.52734-0.37109 1.2109 0 1.1523 0.64453 1.7969 0.66406 0.64453 2.1484 1.2891 0.54688 0.23438 1.4844 0.58594 0.95703 0.33203 2.3047 0.76172 0.89844-1.0547 1.2891-1.8945 0.39062-0.83984 0.39062-2.0703zm0.60547 13.77q0-1.4062-0.70312-2.1289t-2.8906-1.6602q-0.64453-0.29297-1.875-0.72266-1.2305-0.42969-2.0703-0.74219-0.83984 0.76172-1.5234 1.8555-0.66406 1.0742-0.66406 2.4219 0 2.0312 1.4453 3.2422 1.4648 1.1914 3.8086 1.1914 0.625 0 1.4648-0.17578 0.83984-0.19531 1.4453-0.58594 0.70312-0.44922 1.1328-1.0547 0.42969-0.60547 0.42969-1.6406z"/></g><rect x="5.6671" y="36.339" width="29.323" height="29.323" fill="#f2739d" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="5.6671" y="67.01" width="29.323" height="29.323" fill="#38ffff" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="36.339" y="67.01" width="29.323" height="29.323" fill="#a13cb1" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="67.01" width="29.323" height="29.323" fill="#ff6f43" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="36.339" width="29.323" height="29.323" fill="#ffce2c" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="67.01" y="5.6672" width="29.323" height="29.323" fill="#359c35" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="36.339" y="5.6672" width="29.323" height="29.323" fill="#708cfd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/><rect x="5.6671" y="5.6672" width="29.323" height="29.323" fill="#e63a3f" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".5" stroke-width=".76239"/></svg> diff --git a/lib/config/default_game_settings.dart b/lib/config/default_game_settings.dart index 7c9e2c8fb6d44b8361afa1cf8a3030985aa09166..f57c9587708d3692fb9f1b27d0efbec02c8b749b 100644 --- a/lib/config/default_game_settings.dart +++ b/lib/config/default_game_settings.dart @@ -4,20 +4,30 @@ class DefaultGameSettings { 'colorsCount', ]; - static const int defaultBoardSizeValue = 10; + static const int boardSizeValueSmall = 6; + static const int boardSizeValueMedium = 10; + static const int boardSizeValueLarge = 14; + static const int boardSizeValueExtraLarge = 20; + + static const int defaultBoardSizeValue = boardSizeValueMedium; static const List<int> allowedBoardSizeValues = [ - 6, - 10, - 14, - 20, + boardSizeValueSmall, + boardSizeValueMedium, + boardSizeValueLarge, + boardSizeValueExtraLarge, ]; - static const int defaultColorsCountValue = 6; + static const int colorsCountValueLow = 5; + static const int colorsCountValueMedium = 6; + static const int colorsCountValueHigh = 7; + static const int colorsCountValueVeryHigh = 8; + + static const int defaultColorsCountValue = colorsCountValueMedium; static const List<int> allowedColorsCountValues = [ - 5, - 6, - 7, - 8, + colorsCountValueLow, + colorsCountValueMedium, + colorsCountValueHigh, + colorsCountValueVeryHigh, ]; static List<int> getAvailableValues(String parameterCode) { diff --git a/lib/ui/painters/parameter_painter.dart b/lib/ui/painters/parameter_painter.dart new file mode 100644 index 0000000000000000000000000000000000000000..35ff29acaf991469a073e76e47878bdaf2ef00e5 --- /dev/null +++ b/lib/ui/painters/parameter_painter.dart @@ -0,0 +1,223 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; + +import 'package:jeweled/config/default_game_settings.dart'; +import 'package:jeweled/utils/color_extensions.dart'; +import 'package:jeweled/utils/color_theme.dart'; + +class ParameterPainter extends CustomPainter { + const ParameterPainter({ + required this.code, + required this.value, + required this.isSelected, + }); + + final String code; + final int value; + final bool isSelected; + + @override + void paint(Canvas canvas, Size size) { + // force square + final double canvasSize = min(size.width, size.height); + + const Color borderColorEnabled = Colors.blue; + const Color borderColorDisabled = Colors.white; + + // "enabled/disabled" border + final paint = Paint(); + paint.style = PaintingStyle.stroke; + paint.color = this.isSelected ? borderColorEnabled : borderColorDisabled; + paint.strokeJoin = StrokeJoin.round; + paint.strokeWidth = 20 / 100 * canvasSize; + canvas.drawRect(Rect.fromPoints(Offset(0, 0), Offset(canvasSize, canvasSize)), paint); + + // content + switch (code) { + case 'colorsCount': + paintColorsCountParameterItem(value, canvas, canvasSize); + break; + case 'boardSize': + paintBoardSizeParameterItem(value, canvas, canvasSize); + break; + default: + print('Unknown parameter: ' + code + '/' + value.toString()); + paintUnknownParameterItem(value, canvas, canvasSize); + } + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + return false; + } + + // "unknown" parameter -> simple bock with text + void paintUnknownParameterItem(final int value, final Canvas canvas, final double size) { + final textSpan = TextSpan( + text: '?' + '\n' + value.toString(), + style: const TextStyle( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ); + final textPainter = TextPainter( + text: textSpan, + textDirection: TextDirection.ltr, + ); + textPainter.layout(); + textPainter.paint( + canvas, + Offset( + (size - textPainter.width) * 0.5, + (size - textPainter.height) * 0.5, + ), + ); + } + + void paintBoardSizeParameterItem(final int value, final Canvas canvas, final double size) { + Color backgroundColor = Colors.grey; + int gridWidth = 1; + + switch (value) { + case DefaultGameSettings.boardSizeValueSmall: + backgroundColor = Colors.green; + gridWidth = 2; + break; + case DefaultGameSettings.boardSizeValueMedium: + backgroundColor = Colors.orange; + gridWidth = 3; + break; + case DefaultGameSettings.boardSizeValueLarge: + backgroundColor = Colors.red; + gridWidth = 4; + break; + case DefaultGameSettings.boardSizeValueExtraLarge: + backgroundColor = Colors.purple; + gridWidth = 5; + break; + default: + print('Wrong value for boardSize parameter value: ' + value.toString()); + } + + final paint = Paint(); + paint.strokeJoin = StrokeJoin.round; + paint.strokeWidth = 3 / 100 * size; + + // Colored background + paint.color = backgroundColor; + paint.style = PaintingStyle.fill; + canvas.drawRect(Rect.fromPoints(Offset(0, 0), Offset(size, size)), paint); + + // Mini grid + final borderColor = Colors.grey.shade800; + + final double cellSize = size / 7; + final double origin = (size - gridWidth * cellSize) / 2; + + for (int row = 0; row < gridWidth; row++) { + for (int col = 0; col < gridWidth; col++) { + final Offset topLeft = Offset(origin + col * cellSize, origin + row * cellSize); + final Offset bottomRight = topLeft + Offset(cellSize, cellSize); + + final squareColor = Color(ColorTheme.getColorCode(col + row * gridWidth)); + + paint.color = squareColor; + paint.style = PaintingStyle.fill; + canvas.drawRect(Rect.fromPoints(topLeft, bottomRight), paint); + + paint.color = borderColor; + paint.style = PaintingStyle.stroke; + canvas.drawRect(Rect.fromPoints(topLeft, bottomRight), paint); + } + } + } + + void paintColorsCountParameterItem(final int value, final Canvas canvas, final double size) { + Color backgroundColor = Colors.grey; + + switch (value) { + case DefaultGameSettings.colorsCountValueLow: + backgroundColor = Colors.green; + break; + case DefaultGameSettings.colorsCountValueMedium: + backgroundColor = Colors.orange; + break; + case DefaultGameSettings.colorsCountValueHigh: + backgroundColor = Colors.red; + break; + case DefaultGameSettings.colorsCountValueVeryHigh: + backgroundColor = Colors.purple; + break; + default: + print('Wrong value for colorsCount parameter value: ' + value.toString()); + } + + final paint = Paint(); + paint.strokeJoin = StrokeJoin.round; + paint.strokeWidth = 3 / 100 * size; + + // Colored background + paint.color = backgroundColor; + paint.style = PaintingStyle.fill; + canvas.drawRect(Rect.fromPoints(Offset(0, 0), Offset(size, size)), paint); + + // Colors preview + const List<Offset> positions = [ + Offset(0, 0), + Offset(1, 0), + Offset(2, 0), + Offset(2, 1), + Offset(2, 2), + Offset(1, 2), + Offset(0, 2), + Offset(0, 1), + ]; + + final double padding = 4 / 100 * size; + final double margin = 3 / 100 * size; + final double width = ((size - 2 * padding) / 3) - 2 * margin; + + for (int colorIndex = 0; colorIndex < value; colorIndex++) { + final Offset position = positions[colorIndex]; + + final Offset topLeft = Offset(padding + margin + position.dx * (width + 2 * margin), + padding + margin + position.dy * (width + 2 * margin)); + + final Offset bottomRight = topLeft + Offset(width, width); + + final squareColor = Color(ColorTheme.getColorCode(colorIndex)); + paint.color = squareColor; + paint.style = PaintingStyle.fill; + canvas.drawRect(Rect.fromPoints(topLeft, bottomRight), paint); + + final borderColor = squareColor.darken(20); + paint.color = borderColor; + paint.style = PaintingStyle.stroke; + canvas.drawRect(Rect.fromPoints(topLeft, bottomRight), paint); + } + + // centered text value + final textSpan = TextSpan( + text: value.toString(), + style: TextStyle( + color: Colors.black, + fontSize: size / 4, + fontWeight: FontWeight.bold, + ), + ); + final textPainter = TextPainter( + text: textSpan, + textDirection: TextDirection.ltr, + ); + textPainter.layout(); + textPainter.paint( + canvas, + Offset( + (size - textPainter.width) * 0.5, + (size - textPainter.height) * 0.5, + ), + ); + } +} diff --git a/lib/ui/widgets/parameters.dart b/lib/ui/widgets/parameters.dart index 6ee9a475c856ea78eddffd6295ade21f9d255dd3..15d1ccca2695420e26d7b027308a591e0103b60d 100644 --- a/lib/ui/widgets/parameters.dart +++ b/lib/ui/widgets/parameters.dart @@ -5,55 +5,53 @@ import 'package:jeweled/config/default_game_settings.dart'; import 'package:jeweled/cubit/game_cubit.dart'; import 'package:jeweled/cubit/settings_cubit.dart'; import 'package:jeweled/models/game_settings.dart'; +import 'package:jeweled/ui/painters/parameter_painter.dart'; class Parameters extends StatelessWidget { const Parameters({super.key}); - static const double separatorHeight = 2.0; - static const double blockMargin = 3.0; - static const double blockPadding = 2.0; - static const Color buttonBackgroundColor = Colors.white; - static const Color buttonBorderColorActive = Colors.blue; - static const Color buttonBorderColorInactive = Colors.white; - static const double buttonBorderWidth = 10.0; - static const double buttonBorderRadius = 8.0; - static const double buttonPadding = 0.0; - static const double buttonMargin = 0.0; - @override Widget build(BuildContext context) { + final double displayWidth = MediaQuery.of(context).size.width; + + final double separatorHeight = 8.0; + return BlocBuilder<SettingsCubit, SettingsState>( builder: (BuildContext context, SettingsState settingsState) { final GameCubit gameCubit = BlocProvider.of<GameCubit>(context); final SettingsCubit settingsCubit = BlocProvider.of<SettingsCubit>(context); - final List<Widget> lines = []; + final List<Widget> lines = [ + SizedBox(height: separatorHeight), + ]; DefaultGameSettings.availableParameters.forEach((code) { - final List<dynamic> availableValues = DefaultGameSettings.getAvailableValues(code); + final List<int> availableValues = DefaultGameSettings.getAvailableValues(code); if (availableValues.length > 1) { - final List<Widget> parameterButtons = []; + final int currentValue = settingsCubit.getParameterValue(code); - final dynamic currentValue = settingsCubit.getParameterValue(code); + final double itemWidth = displayWidth / availableValues.length - 25; + + final List<Widget> parameterButtons = []; availableValues.forEach((value) { final bool isActive = (value == currentValue); - final String imageAsset = code + '_' + value.toString(); final Widget parameterButton = TextButton( child: Container( - margin: EdgeInsets.all(buttonMargin), - padding: EdgeInsets.all(buttonPadding), - decoration: BoxDecoration( - color: buttonBackgroundColor, - borderRadius: BorderRadius.circular(buttonBorderRadius), - border: Border.all( - color: isActive ? buttonBorderColorActive : buttonBorderColorInactive, - width: buttonBorderWidth, + margin: EdgeInsets.all(0), + padding: EdgeInsets.all(0), + child: CustomPaint( + size: Size(itemWidth, itemWidth), + willChange: false, + painter: ParameterPainter( + code: code, + value: value, + isSelected: isActive, ), + isComplex: true, ), - child: buildImageWidget(imageAsset), ), onPressed: () => settingsCubit.setParameterValue(code, value), ); @@ -61,30 +59,20 @@ class Parameters extends StatelessWidget { parameterButtons.add(parameterButton); }); - lines.add(Table( - defaultColumnWidth: IntrinsicColumnWidth(), - children: [ - TableRow( - children: parameterButtons, - ), - ], + lines.add(Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: parameterButtons, )); lines.add(SizedBox(height: separatorHeight)); } }); - return Container( - child: Column( - children: [ - SizedBox(height: separatorHeight), - Column( - children: lines, - ), - SizedBox(height: separatorHeight), - buildStartNewGameButton(gameCubit, settingsState.settings), - ], - ), + lines.add(SizedBox(height: separatorHeight)); + lines.add(buildStartNewGameButton(gameCubit, settingsState.settings)); + + return Column( + children: lines, ); }, ); @@ -115,6 +103,9 @@ class Parameters extends StatelessWidget { } static Container buildStartNewGameButton(GameCubit gameCubit, GameSettings settings) { + const double blockMargin = 3.0; + const double blockPadding = 2.0; + return Container( margin: EdgeInsets.all(blockMargin), padding: EdgeInsets.all(blockPadding), diff --git a/lib/utils/color_theme.dart b/lib/utils/color_theme.dart index c6172db55c6a28ea7610c19d0c2572022239bb69..9152f0d809e176885e22022b58ea75c10c0c4275 100644 --- a/lib/utils/color_theme.dart +++ b/lib/utils/color_theme.dart @@ -40,9 +40,7 @@ class ColorTheme { if (value != null && itemColors.containsKey(skin) && null != itemColors[skin]) { List<int> skinColors = itemColors[skin] ?? []; - if (skinColors.length > value) { - return (skinColors[value % getColorsCount()]) | 0xFF000000; - } + return (skinColors[value % getColorsCount()]) | 0xFF000000; } return defaultItemColor | 0xFF000000; } diff --git a/pubspec.yaml b/pubspec.yaml index 52d05e3352e55724d745512f3a174cbf7fca9962..c32d629f5bc5d8afbc6a28e3b030b1662752b701 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Jeweled Game publish_to: 'none' -version: 0.0.18+18 +version: 0.0.19+19 environment: sdk: '^3.0.0'