Skip to content

Commit

Permalink
feat: optimize UI for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
RuolinZheng08 committed Jan 16, 2022
1 parent 543e94b commit b07ab07
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 44 deletions.
12 changes: 6 additions & 6 deletions game/gui.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ define gui.file_slot_rows = 2
define gui.navigation_xpos = 60

## The vertical position of the skip indicator.
define gui.skip_ypos = 15
define gui.skip_ypos = 720

## The vertical position of the notify screen.
define gui.notify_ypos = 168
Expand Down Expand Up @@ -435,9 +435,10 @@ init python:

## Adjust the location of the textbox.
gui.textbox_height = 360
gui.name_xpos = 120
gui.dialogue_xpos = 135
gui.dialogue_width = 1650
## since we are using the player side image, these should be the same as PC
# gui.name_xpos = 120
# gui.dialogue_xpos = 135
gui.dialogue_width = 1400

## Change the size and spacing of various things.
gui.slider_size = 54
Expand Down Expand Up @@ -473,5 +474,4 @@ init python:
gui.nvl_button_width = 1860
gui.nvl_button_xpos = 30



gui.skip_ypos = 600
28 changes: 19 additions & 9 deletions game/screens.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ screen say(who, what):

## If there's a side image, display it above the text. Do not display on the
## phone variant - there's no room.
if not renpy.variant("small"):
add SideImage() xalign 0.0 yalign 1.0
# if not renpy.variant("small"):
add SideImage() xalign 0.0 yalign 1.0


## Make the namebox available for styling through the Character object.
Expand Down Expand Up @@ -1314,7 +1314,7 @@ screen skip_indicator():
frame:
# top right above textbox
xalign 1.0
ypos 720
ypos gui.skip_ypos
background white80

hbox:
Expand Down Expand Up @@ -1541,14 +1541,24 @@ screen quick_menu():
hbox:
style_prefix "quick"

xalign 0.5
yalign 1.0
xalign 0.55
yalign 0.98

textbutton _("Back") action Rollback()
textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
textbutton _("Auto") action Preference("auto-forward", "toggle")
textbutton _("Menu") action ShowMenu()
textbutton _("{icon=icon-skip-back} Back") action Rollback()
textbutton _("{icon=icon-fast-forward} Skip") action Skip() alternate Skip(fast=True, confirm=True)
textbutton _("{icon=icon-play-circle} Auto") action Preference("auto-forward", "toggle")
textbutton _("{icon=icon-menu} Menu") action ShowMenu()

# if stats is showing, hide it; else show it
if stats_unlocked:
textbutton _("{icon=icon-smartphone} Stats") action [
SensitiveIf(not renpy.get_screen('player_stats_todo_screen', layer='transient')),
If(
renpy.get_screen('player_stats_todo_screen'),
true=ToggleScreen('player_stats_todo_screen'),
false=ShowTransient('player_stats_todo_screen')
)
]

style window:
variant "small"
Expand Down
3 changes: 2 additions & 1 deletion game/script.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ label stage5:
player "Maybe I should go for some beginner topics?"
jump stage5_choose_curriculum

"Data Visualization":
# not enough space on small devices
"Data Visualization" if not renpy.variant("small"):
player pout "I know there's a lot of hype about big data, but can I really do that without a Ph.D.?"
player "This doesn't look like it's for me."
jump stage5_choose_curriculum
Expand Down
11 changes: 8 additions & 3 deletions game/scripts/bonus_screen.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ screen bonus_screen():
vbox:
spacing 15

label _('Minigames')
textbutton _("{icon=icon-music} Rhythm Game") action Start('rhythm_game_entry_label')
# TODO: more mini games, quiz speedrun survival mode etc.
if not renpy.mobile:
label _('Minigames')
textbutton _("{icon=icon-music} Rhythm Game") action Start('rhythm_game_entry_label')
# TODO: more mini games, quiz speedrun survival mode etc.
# some might be playable on mobile

null height 20
label _('Bonus Content')
Expand Down Expand Up @@ -47,6 +49,7 @@ screen bonus_screen():

screen achievements_screen():
tag menu

use game_menu(_("Achievements"), scroll="viewport"):
style_prefix "bonus"

Expand Down Expand Up @@ -79,6 +82,8 @@ screen achievements_screen():
$ tweet = achievement_to_tweet_map[achievement]
text '{icon=icon-unlock} [achievement!t]':
font gui.text_font
if renpy.variant("small"):
xsize 700
textbutton _("{icon=icon-twitter} Tweet this") action OpenURL(tweet)
else:
text _('{icon=icon-lock} ? ? ?'):
Expand Down
13 changes: 7 additions & 6 deletions game/scripts/click_to_continue.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ screen ctc(arg=None):
size 40
color gui.accent_color

text _("Click to continue"):
font gui.interface_text_font
size gui.notify_text_size
xalign 0.94
yalign 0.96
color gui.accent_color
if not renpy.variant("small"):
text _("Click to continue"):
font gui.interface_text_font
size gui.notify_text_size
xalign 0.94
yalign 0.96
color gui.accent_color


transform ctc_animation:
Expand Down
15 changes: 4 additions & 11 deletions game/scripts/labels/day_activity_choices.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,10 @@ label day_activity_relax:
$ day_activity = 'park'
player "Let's head out to the park. Too bad I can't take Mint out on a walk. Annika does that with her puppy sometimes and they both love it."
call day_activity_park from _call_day_activity_park
"Play some video games":
# NOTE
if renpy.mobile:
player "I'd love to play some games, but those are only available on my laptop."
"(You won't able to access mini-games when you are playing the mobile or the web version. Please download the desktop version instead.)"
player "Let's go take a walk in the park instead."
call day_activity_park from _call_day_activity_park_1
else:
$ day_activity = 'videogame'
player "Nothing beats some video games."
call day_activity_video_game from _call_day_activity_video_game
"Play some video games" if not renpy.mobile:
$ day_activity = 'videogame'
player "Nothing beats some video games."
call day_activity_video_game from _call_day_activity_video_game
"Listen to music":
$ day_activity = 'music'
player "Let's listen to some music."
Expand Down
2 changes: 1 addition & 1 deletion game/scripts/quiz_questions_from_csv.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -3816,7 +3816,7 @@ init python:
QuizQuestion(
question=_("Which of the following is the pipe symbol in Linux?"),
true=_("|"),
false=[_("/"), _(">"), _("[[]")],
false=[_("/"), _(">"), _("#")],
explanation=_("With the pipe symbol (|), the output of one command serves as the input to another."),
learn_more_url="https://www.freecodecamp.org/news/the-linux-commands-handbook/#the-linux-cd-command",
difficulty=1,
Expand Down
20 changes: 13 additions & 7 deletions game/scripts/variables.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ init python:
# story labels for hacker space and barista
hacker_space_event_labels = [
'hacker_space_tech_talk',
'hacker_space_playtest',
'hacker_space_project',
'hacker_space_open_source',
]
if not renpy.mobile:
hacker_space_event_labels.insert(1, 'hacker_space_playtest')

barista_event_labels = [
'barista_fullstack',
Expand Down Expand Up @@ -265,13 +266,7 @@ init python:
plot_hackerspace_all_events: generate_tweet_intent(tweet_hackerspace_all_events),
plot_trivia: generate_tweet_intent(tweet_trivia),
plot_cupcakecpu: generate_tweet_intent(tweet_cupcakecpu),
plot_win_pong: generate_tweet_intent(tweet_win_pong),
plot_lose_pong: generate_tweet_intent(tweet_lose_pong),
plot_music_discover: generate_tweet_intent(tweet_music_discover),
plot_rhythm_discover: generate_tweet_intent(tweet_rhythm_discover),
plot_rhythm_highscore: generate_tweet_intent(tweet_rhythm_highscore),
plot_rhythm_perfect: generate_tweet_intent(tweet_rhythm_perfect),
plot_rhythm_perfect_all: generate_tweet_intent(tweet_rhythm_perfect_all),
plot_park: generate_tweet_intent(tweet_park),
plot_skill_coffee: generate_tweet_intent(tweet_skill_coffee),
plot_skill_fax: generate_tweet_intent(tweet_skill_fax),
Expand All @@ -282,6 +277,17 @@ init python:
plot_double_check: generate_tweet_intent(tweet_double_check),
plot_rewind_time: generate_tweet_intent(tweet_rewind_time),
}
if not renpy.mobile:
# minigame achievements
plot_bonus_to_tweet_map.update({
plot_win_pong: generate_tweet_intent(tweet_win_pong),
plot_lose_pong: generate_tweet_intent(tweet_lose_pong),
plot_rhythm_discover: generate_tweet_intent(tweet_rhythm_discover),
plot_rhythm_highscore: generate_tweet_intent(tweet_rhythm_highscore),
plot_rhythm_perfect: generate_tweet_intent(tweet_rhythm_perfect),
plot_rhythm_perfect_all: generate_tweet_intent(tweet_rhythm_perfect_all),
})


## quiz
quiz_fcc_launch = _("The Launch of freeCodeCamp")
Expand Down

0 comments on commit b07ab07

Please sign in to comment.