Skip to content
Snippets Groups Projects
Commit 2952ab02 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '42-normalize-game-architecture' into 'master'

Resolve "Normalize game architecture"

Closes #42

See merge request !42
parents 520e1b60 5b4999f0
No related branches found
No related tags found
1 merge request!42Resolve "Normalize game architecture"
Pipeline #5819 passed
Showing
with 591 additions and 62 deletions
Amélioration/normalisation de l'architecture du jeu.
<?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="matrix(.47655 0 0 .47655 27.173 27.173)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g></svg>
<?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="matrix(.47655 0 0 .47655 4.2858 6.7324)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g><g transform="matrix(.47655 0 0 .47655 50.06 6.7324)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g><g transform="matrix(.47655 0 0 .47655 27.173 47.615)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g></svg>
<?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="matrix(.47655 0 0 .47655 3.9408 27.173)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g><g transform="matrix(.47655 0 0 .47655 50.404 27.173)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g></svg>
<?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="matrix(.47655 0 0 .47655 5.1498 6.5734)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g><g transform="matrix(.47655 0 0 .47655 49.346 6.6426)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g><g transform="matrix(.47655 0 0 .47655 4.9988 47.703)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g><g transform="matrix(.47655 0 0 .47655 49.325 47.772)" fill="#fff" stroke="#000" stroke-width="4.1968"><path d="m92.148 55.869c-0.626-0.939-1.482-1.519-2.568-1.739l-6.792-1.242c0.368-5.669-0.727-11.035-3.286-16.096l5.853-4.224c0.939-0.663 1.491-1.574 1.657-2.733 0.202-1.086-0.037-2.071-0.718-2.954l-0.469-0.718c-0.626-0.883-1.537-1.427-2.733-1.629-1.031-0.166-2.016 0.092-2.954 0.773l-5.632 4.059c-3.81-4.215-8.347-7.206-13.611-8.973l1.27-7.731c0.202-1.104-0.037-2.126-0.718-3.065-0.626-0.883-1.482-1.427-2.568-1.629l-0.856-0.166c-1.104-0.147-2.126 0.092-3.065 0.718-0.884 0.681-1.427 1.565-1.629 2.65l-1.16 7.427c-2.503-0.221-4.951-0.175-7.344 0.138-1.362 0.055-2.641 0.294-3.838 0.718-0.626 0.147-1.224 0.331-1.795 0.552l-3.451-7.51c-0.46-0.994-1.215-1.693-2.264-2.098-1.031-0.423-2.043-0.405-3.037 0.055l-0.773 0.414c-0.994 0.405-1.73 1.16-2.209 2.264-0.368 1.031-0.313 2.043 0.166 3.037l3.506 7.648c-0.202 0.11-0.405 0.249-0.607 0.414-5.264 3.681-9.019 8.31-11.265 13.888l-6.958-1.546c-1.086-0.276-2.098-0.074-3.037 0.607-0.994 0.534-1.592 1.344-1.795 2.43l-0.246 0.772c-0.203 1.104-0.018 2.172 0.552 3.203 0.626 0.883 1.491 1.463 2.595 1.739l6.626 1.546c-0.736 5.835 0.101 11.329 2.512 16.483l-5.411 3.672c-0.939 0.626-1.537 1.491-1.795 2.595-0.147 1.086 0.092 2.098 0.718 3.037l0.469 0.635c0.626 0.939 1.454 1.537 2.485 1.795 1.16 0.147 2.209-0.092 3.147-0.718l5.135-3.424c3.7 4.583 8.255 7.887 13.667 9.912l-1.242 6.323c-0.202 1.104 9e-3 2.154 0.635 3.147 0.626 0.883 1.482 1.427 2.568 1.629l0.801 0.166c1.086 0.258 2.098 0.101 3.037-0.469 0.939-0.681 1.509-1.574 1.712-2.678l1.242-6.074c6 0.626 11.651-0.285 16.952-2.733l4.003 6.074c0.626 0.939 1.509 1.518 2.651 1.739 1.049 0.258 2.043 0.074 2.982-0.552l0.69-0.387c0.939-0.626 1.537-1.518 1.795-2.678 0.203-1.086-9e-3 -2.098-0.635-3.037l-3.81-5.936c4.583-3.7 7.841-8.255 9.774-13.667l6.875 1.242c1.086 0.202 2.098-9e-3 3.037-0.635 0.883-0.607 1.427-1.463 1.629-2.568l0.166-0.773c0.202-1.103-0.01-2.143-0.636-3.119z" fill="#fff" stroke="#000" stroke-width="4.1968"/></g></svg>
<?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="matrix(.61667 0 0 .61667 19.166 8.0878)"><rect x="27.579" y="45.549" width="43.928" height="43.924" fill="#fff"/><path d="m22.09 40.056v55.821h55.821v-55.821zm49.417 49.417h-19.218v-19.218h19.218zm-0.0022-24.706h-19.217v-19.218h19.218zm-43.926-19.218h19.218v19.218h-19.218zm0 24.71h19.218v19.218h-19.218z" stroke-width="2.7453"/></g></svg>
<?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(0 -19.83)"><rect x="25.631" y="45.406" width="48.427" height="48.427" fill="#fefdfd"/><path d="m21.909 41.68v56.301h56.182v-56.301zm35.388 20.489v14.901h-14.901v-14.901zm-14.901-3.7252v-13.038h14.901v13.038zm31.662 35.389h-13.038v-13.038h13.038zm0-16.762h-13.038v-14.901h13.038zm-16.762 3.7252v13.038h-14.901v-13.038zm16.762-22.352h-13.038v-13.038h13.038zm-48.427-13.038h13.038v13.038h-13.038zm0 16.762h13.038v14.901h-13.038zm0 18.627h13.038v13.038h-13.038z" stroke-width="1.8627"/></g></svg>
<?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="matrix(1.2319 0 0 1.2319 -11.595 -34.78)"><rect x="25.882" y="43.926" width="48" height="49.184" fill="#fff"/><path d="m23.09 41.131v55.377h53.819v-55.377zm25.359 15.368v11.176h-9.9925v-11.176zm-9.9925-2.794v-9.7789h9.9925v9.7789zm35.426 39.405h-9.7789v-9.7789h9.7789zm0-12.862h-9.7789v-9.7789h9.7789zm-12.862 0h-9.7789v-9.7789h9.7789zm0 3.0824v9.7789h-9.7789v-9.7789zm12.862-15.655h-9.7789v-11.176h9.7789zm-12.862 0h-9.7789v-11.176h9.7789zm-12.572 2.794v9.7789h-9.9925v-9.7789zm0 12.862v9.7789h-9.9925v-9.7789zm25.434-39.405v9.7789h-9.7789v-9.7789zm-12.862 9.7789h-9.7789v-9.7789h9.7789zm-35.138-9.7789h9.7789v9.7789h-9.7789zm0 12.572h9.7789v11.176h-9.7789zm0 13.971h9.7789v9.7789h-9.7789zm0 12.862h9.7789v9.7789h-9.7789z" stroke-width="1.3971"/></g></svg>
<?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="#a4a4a4" stroke="#000" stroke-width="2"/><rect x="-15.387" y="-20.515" width="100" height="100" ry="2" fill="none"/></svg>
import 'package:minehunter/utils/tools.dart';
class DefaultGameSettings {
// available game parameters codes
static const String parameterCodeLevel = 'level';
static const String parameterCodeSize = 'size';
static const List<String> availableParameters = [
parameterCodeLevel,
parameterCodeSize,
];
// level: available values
static const String levelValueEasy = 'easy';
static const String levelValueMedium = 'medium';
static const String levelValueHard = 'hard';
static const String levelValueNightmare = 'nightmare';
static const List<String> allowedLevelValues = [
levelValueEasy,
levelValueMedium,
levelValueHard,
levelValueNightmare,
];
// level: default value
static const String defaultLevelValue = levelValueMedium;
// size: available values
static const String sizeValueSmall = '10x10';
static const String sizeValueMedium = '15x15';
static const String sizeValueLarge = '20x20';
static const List<String> allowedSizeValues = [
sizeValueSmall,
sizeValueMedium,
sizeValueLarge,
];
// size: default value
static const String defaultSizeValue = sizeValueMedium;
// available values from parameter code
static List<String> getAvailableValues(String parameterCode) {
switch (parameterCode) {
case parameterCodeLevel:
return DefaultGameSettings.allowedLevelValues;
case parameterCodeSize:
return DefaultGameSettings.allowedSizeValues;
}
printlog('Did not find any available value for game parameter "$parameterCode".');
return [];
}
// parameters displayed with assets (instead of painter)
static List<String> displayedWithAssets = [
//
];
// how many mines? (per 100 tiles)
static const Map<String, int> minesCountRatios = {
DefaultGameSettings.levelValueEasy: 5,
DefaultGameSettings.levelValueMedium: 10,
DefaultGameSettings.levelValueHard: 15,
DefaultGameSettings.levelValueNightmare: 20,
};
}
import 'package:minehunter/utils/tools.dart';
class DefaultGlobalSettings {
// available global parameters codes
static const String parameterCodeSkin = 'skin';
static const List<String> availableParameters = [
parameterCodeSkin,
];
// skin: available values
static const String skinValueDefault = 'default';
static const List<String> allowedSkinValues = [
skinValueDefault,
];
// skin: default value
static const String defaultSkinValue = skinValueDefault;
// available values from parameter code
static List<String> getAvailableValues(String parameterCode) {
switch (parameterCode) {
case parameterCodeSkin:
return DefaultGlobalSettings.allowedSkinValues;
}
printlog('Did not find any available value for global parameter "$parameterCode".');
return [];
}
// parameters displayed with assets (instead of painter)
static List<String> displayedWithAssets = [
//
];
}
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:minehunter/ui/screens/about_page.dart';
import 'package:minehunter/ui/screens/game_page.dart';
import 'package:minehunter/ui/screens/settings_page.dart';
import 'package:unicons/unicons.dart'; import 'package:unicons/unicons.dart';
import 'package:minehunter/ui/screens/page_about.dart';
import 'package:minehunter/ui/screens/page_game.dart';
import 'package:minehunter/ui/screens/page_settings.dart';
class MenuItem { class MenuItem {
final String code;
final Icon icon; final Icon icon;
final Widget page; final Widget page;
const MenuItem({ const MenuItem({
required this.code,
required this.icon, required this.icon,
required this.page, required this.page,
}); });
} }
class Menu { class Menu {
static List<MenuItem> items = [ static const indexGame = 0;
const MenuItem( static const menuItemGame = MenuItem(
code: 'bottom_nav_home',
icon: Icon(UniconsLine.home), icon: Icon(UniconsLine.home),
page: GamePage(), page: PageGame(),
), );
const MenuItem(
code: 'bottom_nav_settings', static const indexSettings = 1;
static const menuItemSettings = MenuItem(
icon: Icon(UniconsLine.setting), icon: Icon(UniconsLine.setting),
page: SettingsPage(), page: PageSettings(),
), );
const MenuItem(
code: 'bottom_nav_about', static const indexAbout = 2;
static const menuItemAbout = MenuItem(
icon: Icon(UniconsLine.info_circle), icon: Icon(UniconsLine.info_circle),
page: AboutPage(), page: PageAbout(),
), );
];
static Widget getPageWidget(int pageIndex) { static Map<int, MenuItem> items = {
return Menu.items.elementAt(pageIndex).page; indexGame: menuItemGame,
indexSettings: menuItemSettings,
indexAbout: menuItemAbout,
};
static bool isIndexAllowed(int pageIndex) {
return items.keys.contains(pageIndex);
} }
static List<BottomNavigationBarItem> getMenuItems() { static Widget getPageWidget(int pageIndex) {
return Menu.items return items[pageIndex]?.page ?? menuItemGame.page;
.map((MenuItem item) => BottomNavigationBarItem(
icon: item.icon,
label: tr(item.code),
))
.toList();
} }
static int itemsCount = Menu.items.length; static int itemsCount = Menu.items.length;
......
...@@ -188,5 +188,3 @@ final ThemeData darkTheme = lightTheme.copyWith( ...@@ -188,5 +188,3 @@ final ThemeData darkTheme = lightTheme.copyWith(
), ),
), ),
); );
final ThemeData appTheme = darkTheme;
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:minehunter/models/game/cell.dart';
import 'package:minehunter/models/game/game.dart';
import 'package:minehunter/models/settings/settings_game.dart';
import 'package:minehunter/models/settings/settings_global.dart';
import 'package:minehunter/models/types.dart';
import 'package:minehunter/utils/tools.dart';
part 'game_state.dart';
class GameCubit extends HydratedCubit<GameState> {
GameCubit()
: super(GameState(
currentGame: Game.createEmpty(),
));
void updateState(Game game) {
emit(GameState(
currentGame: game,
));
}
void refresh() {
final Game game = Game(
// Settings
gameSettings: state.currentGame.gameSettings,
globalSettings: state.currentGame.globalSettings,
// State
isRunning: state.currentGame.isRunning,
isStarted: state.currentGame.isStarted,
isFinished: state.currentGame.isFinished,
animationInProgress: state.currentGame.animationInProgress,
// Base data
board: state.currentGame.board,
sizeHorizontal: state.currentGame.sizeHorizontal,
sizeVertical: state.currentGame.sizeVertical,
isBoardMined: state.currentGame.isBoardMined,
// Game data
minesCount: state.currentGame.minesCount,
reportMode: state.currentGame.reportMode,
gameWin: state.currentGame.gameWin,
gameFail: state.currentGame.gameFail,
);
// game.dump();
updateState(game);
}
void startNewGame({
required GameSettings gameSettings,
required GlobalSettings globalSettings,
}) {
final Game newGame = Game.createNew(
// Settings
gameSettings: gameSettings,
globalSettings: globalSettings,
);
newGame.dump();
updateState(newGame);
refresh();
}
void quitGame() {
state.currentGame.isRunning = false;
refresh();
}
void resumeSavedGame() {
state.currentGame.isRunning = true;
refresh();
}
void deleteSavedGame() {
state.currentGame.isRunning = false;
state.currentGame.isFinished = true;
refresh();
}
void updateBoard(Board board) {
state.currentGame.board = board;
refresh();
}
void addMines({
required int forbiddenRow,
required int forbiddenCol,
}) {
state.currentGame.isStarted = true;
state.currentGame.addMines(
forbiddenRow: forbiddenRow,
forbiddenCol: forbiddenCol,
);
state.currentGame.isBoardMined = true;
refresh();
}
void reportCell({
required int row,
required int col,
}) {
if (!state.currentGame.board[row][col].isExplored) {
toggleCellMark(row, col);
}
}
void walkOnCell({
required int row,
required int col,
}) {
setCellAsExplored(row, col);
if (state.currentGame.board[row][col].minesCountAround == 0) {
final List<List<int>> safeCells = getAllSafeCellsAround(row, col);
for (int safeCellIndex = 0; safeCellIndex < safeCells.length; safeCellIndex++) {
final int safeCellRow = safeCells[safeCellIndex][0];
final int safeCellCol = safeCells[safeCellIndex][1];
if (!state.currentGame.board[safeCellRow][safeCellCol].isExplored) {
walkOnCell(
row: safeCellRow,
col: safeCellCol,
);
}
}
}
}
List<List<int>> getAllSafeCellsAround(int row, int col) {
final List<List<Cell>> board = state.currentGame.board;
final int sizeHorizontal = board.length;
final int sizeVertical = board[0].length;
final List<List<int>> safeCellsCoordinates = [];
if (board[row][col].minesCountAround == 0) {
for (int deltaRow = -1; deltaRow <= 1; deltaRow++) {
for (int deltaCol = -1; deltaCol <= 1; deltaCol++) {
final int candidateRow = row + deltaRow;
final int candidateCol = col + deltaCol;
if ((candidateRow >= 0 && candidateRow < sizeVertical) &&
(candidateCol >= 0 && candidateCol < sizeHorizontal) &&
!board[candidateRow][candidateCol].isExplored) {
safeCellsCoordinates.add([candidateRow, candidateCol]);
}
}
}
}
return safeCellsCoordinates;
}
void setCellAsExplored(int row, int col) {
state.currentGame.board[row][col].isExplored = true;
state.currentGame.board[row][col].isMarked = false;
// Boom?
if (state.currentGame.board[row][col].isMined) {
// Boom!
state.currentGame.board[row][col].isExploded = true;
}
refresh();
}
void toggleCellMark(int row, int col) {
state.currentGame.board[row][col].isMarked = !state.currentGame.board[row][col].isMarked;
refresh();
}
void updateReportMode(bool reportMode) {
state.currentGame.reportMode = reportMode;
refresh();
}
bool checkGameIsFinished() {
final Game currentGame = state.currentGame;
final Board board = currentGame.board;
final int sizeHorizontal = board.length;
final int sizeVertical = board[0].length;
currentGame.printGrid();
updateGameWin(false);
updateGameFail(false);
for (int row = 0; row < sizeVertical; row++) {
for (int col = 0; col < sizeHorizontal; col++) {
// Walked on a mine
if (board[row][col].isExploded == true) {
updateGameFail(true);
return true;
}
}
}
for (int row = 0; row < sizeVertical; row++) {
for (int col = 0; col < sizeHorizontal; col++) {
if (
// Mine not already found
(board[row][col].isMined == true && board[row][col].isMarked == false) ||
// Safe cell marked as mined
(board[row][col].isMined == false && board[row][col].isMarked == true)) {
return false;
}
}
}
printlog('-> ok all mines found!');
updateGameWin(true);
return true;
}
void updateGameWin(bool value) {
state.currentGame.gameWin = value;
if (true == value) {
state.currentGame.isFinished = true;
}
refresh();
}
void updateGameFail(bool value) {
state.currentGame.gameFail = value;
if (true == value) {
state.currentGame.isFinished = true;
}
refresh();
}
void updateAnimationInProgress(bool animationInProgress) {
state.currentGame.animationInProgress = animationInProgress;
refresh();
}
void setAnimatedBackground(List animatedCellsPattern) {
for (int row = 0; row < state.currentGame.sizeVertical; row++) {
for (int col = 0; col < state.currentGame.sizeHorizontal; col++) {
state.currentGame.board[row][col].isAnimated = animatedCellsPattern[row][col];
}
}
refresh();
}
void resetAnimatedBackground() {
for (int row = 0; row < state.currentGame.sizeVertical; row++) {
for (int col = 0; col < state.currentGame.sizeHorizontal; col++) {
state.currentGame.board[row][col].isAnimated = false;
}
}
}
@override
GameState? fromJson(Map<String, dynamic> json) {
final Game currentGame = json['currentGame'] as Game;
return GameState(
currentGame: currentGame,
);
}
@override
Map<String, dynamic>? toJson(GameState state) {
return <String, dynamic>{
'currentGame': state.currentGame.toJson(),
};
}
}
part of 'game_cubit.dart';
@immutable
class GameState extends Equatable {
const GameState({
required this.currentGame,
});
final Game currentGame;
@override
List<dynamic> get props => <dynamic>[
currentGame,
];
}
...@@ -2,26 +2,32 @@ import 'package:hydrated_bloc/hydrated_bloc.dart'; ...@@ -2,26 +2,32 @@ import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:minehunter/config/menu.dart'; import 'package:minehunter/config/menu.dart';
class BottomNavCubit extends HydratedCubit<int> { class NavCubit extends HydratedCubit<int> {
BottomNavCubit() : super(0); NavCubit() : super(0);
void updateIndex(int index) { void updateIndex(int index) {
if (isIndexAllowed(index)) { if (Menu.isIndexAllowed(index)) {
emit(index); emit(index);
} else { } else {
goToHomePage(); goToGamePage();
} }
} }
bool isIndexAllowed(int index) { void goToGamePage() {
return (index >= 0) && (index < Menu.itemsCount); emit(Menu.indexGame);
} }
void goToHomePage() => emit(0); void goToSettingsPage() {
emit(Menu.indexSettings);
}
void goToAboutPage() {
emit(Menu.indexAbout);
}
@override @override
int fromJson(Map<String, dynamic> json) { int fromJson(Map<String, dynamic> json) {
return 0; return Menu.indexGame;
} }
@override @override
......
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:minehunter/config/default_game_settings.dart';
import 'package:minehunter/models/settings/settings_game.dart';
part 'settings_game_state.dart';
class GameSettingsCubit extends HydratedCubit<GameSettingsState> {
GameSettingsCubit() : super(GameSettingsState(settings: GameSettings.createDefault()));
void setValues({
String? itemsCount,
String? timerValue,
}) {
emit(
GameSettingsState(
settings: GameSettings(
level: itemsCount ?? state.settings.level,
size: timerValue ?? state.settings.size,
),
),
);
}
String getParameterValue(String code) {
switch (code) {
case DefaultGameSettings.parameterCodeLevel:
return GameSettings.getLevelValueFromUnsafe(state.settings.level);
case DefaultGameSettings.parameterCodeSize:
return GameSettings.getSizeValueFromUnsafe(state.settings.size);
}
return '';
}
void setParameterValue(String code, String value) {
final String itemsCount = code == DefaultGameSettings.parameterCodeLevel
? value
: getParameterValue(DefaultGameSettings.parameterCodeLevel);
final String timerValue = code == DefaultGameSettings.parameterCodeSize
? value
: getParameterValue(DefaultGameSettings.parameterCodeSize);
setValues(
itemsCount: itemsCount,
timerValue: timerValue,
);
}
@override
GameSettingsState? fromJson(Map<String, dynamic> json) {
final String itemsCount = json[DefaultGameSettings.parameterCodeLevel] as String;
final String timerValue = json[DefaultGameSettings.parameterCodeSize] as String;
return GameSettingsState(
settings: GameSettings(
level: itemsCount,
size: timerValue,
),
);
}
@override
Map<String, dynamic>? toJson(GameSettingsState state) {
return <String, dynamic>{
DefaultGameSettings.parameterCodeLevel: state.settings.level,
DefaultGameSettings.parameterCodeSize: state.settings.size,
};
}
}
part of 'settings_game_cubit.dart';
@immutable
class GameSettingsState extends Equatable {
const GameSettingsState({
required this.settings,
});
final GameSettings settings;
@override
List<dynamic> get props => <dynamic>[
settings,
];
}
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:minehunter/config/default_global_settings.dart';
import 'package:minehunter/models/settings/settings_global.dart';
part 'settings_global_state.dart';
class GlobalSettingsCubit extends HydratedCubit<GlobalSettingsState> {
GlobalSettingsCubit() : super(GlobalSettingsState(settings: GlobalSettings.createDefault()));
void setValues({
String? skin,
}) {
emit(
GlobalSettingsState(
settings: GlobalSettings(
skin: skin ?? state.settings.skin,
),
),
);
}
String getParameterValue(String code) {
switch (code) {
case DefaultGlobalSettings.parameterCodeSkin:
return GlobalSettings.getSkinValueFromUnsafe(state.settings.skin);
}
return '';
}
void setParameterValue(String code, String value) {
final String skin = (code == DefaultGlobalSettings.parameterCodeSkin)
? value
: getParameterValue(DefaultGlobalSettings.parameterCodeSkin);
setValues(
skin: skin,
);
}
@override
GlobalSettingsState? fromJson(Map<String, dynamic> json) {
final String skin = json[DefaultGlobalSettings.parameterCodeSkin] as String;
return GlobalSettingsState(
settings: GlobalSettings(
skin: skin,
),
);
}
@override
Map<String, dynamic>? toJson(GlobalSettingsState state) {
return <String, dynamic>{
DefaultGlobalSettings.parameterCodeSkin: state.settings.skin,
};
}
}
part of 'settings_global_cubit.dart';
@immutable
class GlobalSettingsState extends Equatable {
const GlobalSettingsState({
required this.settings,
});
final GlobalSettings settings;
@override
List<dynamic> get props => <dynamic>[
settings,
];
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment