diff options
| author | vg <vgm+dev@devys.org> | 2026-02-28 18:25:21 +0100 |
|---|---|---|
| committer | vg <vgm+dev@devys.org> | 2026-02-28 18:25:21 +0100 |
| commit | 0ef02be28917667225f519f2b1fe91d952759560 (patch) | |
| tree | 3d7b2036853d68cb064bde4a720dd100256e3e90 /gamechesttuidialog | |
| parent | 2c5a6d5f6ab4e7a9731b543c82830118221bc3b5 (diff) | |
| download | gamechest-0ef02be28917667225f519f2b1fe91d952759560.tar.gz gamechest-0ef02be28917667225f519f2b1fe91d952759560.tar.bz2 gamechest-0ef02be28917667225f519f2b1fe91d952759560.zip | |
git-sync on dita
Diffstat (limited to 'gamechesttuidialog')
| -rwxr-xr-x | gamechesttuidialog | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/gamechesttuidialog b/gamechesttuidialog new file mode 100755 index 0000000..9689f46 --- /dev/null +++ b/gamechesttuidialog @@ -0,0 +1,93 @@ +#!/bin/bash + +set -e + +declare -a games + +GAME_INSTALLED=$(gamechest list | grep -i true | cut -d ":" -f 1 | cut -d " " -f 1) + +populate_games() +{ + for game in "${GAME_INSTALLED}"; do + games+=($game) + done +} + +choose_game() +{ + local choice_array=() + local shortcut_count=0 + for game in "${games[@]}"; do + shortcut_count=$(( $shortcut_count + 1 )) + choice_array+=( "$game" "[$shortcut_count] $game" ) + done + + local dialog_args=( + --stdout + --clear + --backtitle "Games selection" + --title "List of installed games" + #--default-item "${games[-1]}" + --menu "Choose one of the following game:" 0 0 0 + "${choice_array[@]}" + ) + + dialog "${dialog_args[@]}" +} + +populate_profiles() +{ + for profile in "dragoncat blackmoor calendros guest malice loudivine airi adetess"; do + profiles+=($profile) + done +} + +choose_profile() +{ + local choice_array=() + local shortcut_count=0 + for profile in "${profiles[@]}"; do + shortcut_count=$(( $shortcut_count + 1 )) + choice_array+=( "$profile" "[$shortcut_count] $profile" ) + done + + local dialog_args=( + --stdout + --clear + --backtitle "Profiles selection" + --title "List of avalaible profiles" + #--default-item "${profiles[-1]}" + --menu "Choose one of the following profile:" 0 0 0 + "${choice_array[@]}" + ) + + dialog "${dialog_args[@]}" +} + + +main() +{ + # Game + + populate_games + if [ ${#games[*]} -eq 0 ]; then echo "No game installed, bye."; exit 0; fi + if [ ${#games[*]} -eq 1 ]; then + game=${games[0]} + else + game=$(choose_game) + fi + + # Profile + populate_profiles + if [ ${#profiles[*]} -eq 0 ]; then echo "No profile available, bye."; exit 0; fi + if [ ${#profiles[*]} -eq 1 ]; then + profile=${profiles[0]} + else + profile=$(choose_profile) + fi + + echo "Running $game with $profile profile" + exec gamechest run --profile_id=$profile $game +} + +main |
