mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-02-01 08:26:54 +01:00
Last match pause.
This commit is contained in:
parent
dcbd2fa50d
commit
7042b3d781
@ -46,7 +46,7 @@ bygfoot_SOURCES = \
|
||||
treeview.c cup.h finance.h fixture.h free.h game.h league.h live_game.h maths.h misc.h player.h option.h support.h team.h transfer.h treeview.h treeview_helper.h user.h \
|
||||
treeview_helper.c cup.h file.h fixture.h free.h league.h misc.h option.h player.h support.h team.h treeview.h treeview_helper.h user.h variables.h \
|
||||
user.c cup.h fixture.h free.h game_gui.h league.h live_game.h maths.h misc.h option.h player.h team.h transfer.h treeview.h user.h window.h \
|
||||
window.c file.h finance.h free.h game_gui.h gui.h interface.h main.h misc_interface.h misc2_interface.h option.h support.h user.h window.h \
|
||||
window.c file.h finance.h free.h game_gui.h gui.h interface.h main.h misc_interface.h misc2_interface.h option.h support.h treeview.h treeview_helper.h user.h window.h \
|
||||
xml.c cup.h file.h free.h gui.h league.h misc.h option.h support.h table.h transfer_struct.h user.h variables.h xml.h xml_loadsave_cup.h xml_loadsave_league.h xml_loadsave_teams.h xml_loadsave_fixtures.h xml_loadsave_table.h xml_loadsave_transfers.h xml_loadsave_users.h \
|
||||
xml_loadsave_misc.c cup.h file.h misc.h variables.h xml.h xml_loadsave_misc.h xml_loadsave_cup.h xml_loadsave_league.h \
|
||||
xml_loadsave_cup.c cup.h file.h misc.h table.h team.h xml.h xml_loadsave_cup.h xml_loadsave_fixtures.h xml_loadsave_table.h xml_loadsave_teams.h \
|
||||
|
@ -116,26 +116,59 @@ callback_player_clicked(gint idx, GdkEventButton *event)
|
||||
setsav0;
|
||||
}
|
||||
|
||||
/** Show the last match of the current user. */
|
||||
/** Show the last match of the current user.
|
||||
@param start Whether we start the replay from the beginning or continue it. */
|
||||
void
|
||||
callback_show_last_match(void)
|
||||
callback_show_last_match(gboolean start)
|
||||
{
|
||||
gint i;
|
||||
|
||||
stat2 = cur_user;
|
||||
stat4 = -1;
|
||||
|
||||
window_create(WINDOW_LIVE);
|
||||
if(start)
|
||||
{
|
||||
stat2 = cur_user;
|
||||
|
||||
current_user.live_game.fix =
|
||||
&g_array_index(league_cup_get_fixtures(current_user.live_game.fix_clid),
|
||||
Fixture, current_user.live_game.fix_idx);
|
||||
window_create(WINDOW_LIVE);
|
||||
|
||||
treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.live, "treeview_stats")),
|
||||
¤t_user.live_game);
|
||||
live_game_set_match(¤t_user.live_game);
|
||||
current_user.live_game.fix =
|
||||
&g_array_index(league_cup_get_fixtures(current_user.live_game.fix_clid),
|
||||
Fixture, current_user.live_game.fix_idx);
|
||||
|
||||
for(i=0;i<current_user.live_game.units->len;i++)
|
||||
treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.live, "treeview_stats")),
|
||||
¤t_user.live_game);
|
||||
live_game_set_match(¤t_user.live_game);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive(lookup_widget(window.live, "button_pause"), TRUE);
|
||||
gtk_widget_set_sensitive(lookup_widget(window.live, "button_resume"), FALSE);
|
||||
}
|
||||
|
||||
for(i=stat3;i<current_user.live_game.units->len;i++)
|
||||
{
|
||||
game_gui_live_game_show_unit(&g_array_index(current_user.live_game.units, LiveGameUnit, i));
|
||||
|
||||
if(stat4 == STATUS_SHOW_LAST_MATCH_PAUSE ||
|
||||
stat4 == STATUS_SHOW_LAST_MATCH_ABORT)
|
||||
{
|
||||
stat3 = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(stat4 == STATUS_SHOW_LAST_MATCH_PAUSE)
|
||||
{
|
||||
gtk_widget_set_sensitive(lookup_widget(window.live, "button_pause"), FALSE);
|
||||
gtk_widget_set_sensitive(lookup_widget(window.live, "button_resume"), TRUE);
|
||||
}
|
||||
else if(stat4 == STATUS_SHOW_LAST_MATCH_ABORT)
|
||||
{
|
||||
window_destroy(&window.live, TRUE);
|
||||
stat1 = stat2 = stat3 = stat4 = -1;
|
||||
}
|
||||
else
|
||||
stat3 = -1;
|
||||
}
|
||||
|
||||
/** Show the last match stats of the current user. */
|
||||
|
@ -10,7 +10,7 @@ void
|
||||
callback_player_clicked(gint idx, GdkEventButton *event);
|
||||
|
||||
void
|
||||
callback_show_last_match(void);
|
||||
callback_show_last_match(gboolean start);
|
||||
|
||||
void
|
||||
callback_show_fixtures(gint type);
|
||||
|
@ -595,8 +595,9 @@ on_menu_user_show_last_match_activate (GtkMenuItem *menuitem,
|
||||
return;
|
||||
}
|
||||
|
||||
stat0 = STATUS_SHOW_LAST_MATCH;
|
||||
callback_show_last_match();
|
||||
stat1 = STATUS_SHOW_LAST_MATCH;
|
||||
stat3 = 0;
|
||||
callback_show_last_match(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,6 +66,8 @@ enum Status0Value
|
||||
STATUS_BROWSE_TEAMS,
|
||||
STATUS_TEAM_SELECTION,
|
||||
STATUS_SHOW_LAST_MATCH,
|
||||
STATUS_SHOW_LAST_MATCH_PAUSE,
|
||||
STATUS_SHOW_LAST_MATCH_ABORT,
|
||||
STATUS_SHOW_LAST_MATCH_STATS,
|
||||
STATUS_SHOW_FIXTURES,
|
||||
STATUS_SHOW_FIXTURES_WEEK,
|
||||
|
@ -62,8 +62,8 @@ game_gui_live_game_show_unit(const LiveGameUnit *unit)
|
||||
|
||||
if(unit->event.type == LIVE_GAME_EVENT_START_MATCH)
|
||||
{
|
||||
gtk_widget_set_sensitive(button_live_close, FALSE);
|
||||
gtk_widget_set_sensitive(button_pause, (stat0 != STATUS_SHOW_LAST_MATCH));
|
||||
gtk_widget_set_sensitive(button_live_close, (stat1 == STATUS_SHOW_LAST_MATCH));
|
||||
gtk_widget_set_sensitive(button_pause, TRUE);
|
||||
gtk_widget_set_sensitive(button_resume, FALSE);
|
||||
}
|
||||
else if(unit->event.type == LIVE_GAME_EVENT_END_MATCH)
|
||||
@ -76,7 +76,7 @@ game_gui_live_game_show_unit(const LiveGameUnit *unit)
|
||||
}
|
||||
else if(unit->event.type == LIVE_GAME_EVENT_PENALTIES)
|
||||
{
|
||||
gtk_widget_set_sensitive(button_pause, FALSE);
|
||||
gtk_widget_set_sensitive(button_pause, (stat1 == STATUS_SHOW_LAST_MATCH));
|
||||
gtk_widget_set_sensitive(button_resume, FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,12 @@ misc_callback_remove_user(GdkEventButton *event)
|
||||
void
|
||||
misc_callback_pause_live_game(void)
|
||||
{
|
||||
if(stat1 == STATUS_SHOW_LAST_MATCH)
|
||||
{
|
||||
stat4 = STATUS_SHOW_LAST_MATCH_PAUSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if(g_array_index(usr(stat2).live_game.units, LiveGameUnit,
|
||||
usr(stat2).live_game.units->len - 1).event.type ==
|
||||
LIVE_GAME_EVENT_END_MATCH)
|
||||
|
@ -168,11 +168,16 @@ void
|
||||
on_button_live_close_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
stat2 = -1;
|
||||
if(stat0 != STATUS_SHOW_LAST_MATCH)
|
||||
if(stat1 == STATUS_SHOW_LAST_MATCH && stat3 != -1 &&
|
||||
stat4 != STATUS_SHOW_LAST_MATCH_PAUSE)
|
||||
stat4 = STATUS_SHOW_LAST_MATCH_ABORT;
|
||||
else if(stat1 != STATUS_SHOW_LAST_MATCH)
|
||||
callback_show_next_live_game();
|
||||
else
|
||||
{
|
||||
window_destroy(&window.live, TRUE);
|
||||
stat1 = stat2 = stat3 = stat4 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -196,7 +201,12 @@ void
|
||||
on_button_resume_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
if(game_check_live_game_resume_state())
|
||||
if(stat1 == STATUS_SHOW_LAST_MATCH)
|
||||
{
|
||||
callback_show_last_match(FALSE);
|
||||
return;
|
||||
}
|
||||
else if(game_check_live_game_resume_state())
|
||||
{
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
|
||||
if(g_array_index(usr(stat2).live_game.units, LiveGameUnit,
|
||||
|
Loading…
x
Reference in New Issue
Block a user