summaryrefslogtreecommitdiffstats
path: root/gamechesttuidialog
blob: 9689f468e935347f6df0976ca815c0a2da66430a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
#!/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