Esempio n. 1
0
int access_init()
{
	g_send_package_socket = tcp_get_socket (TCP_TYPE_CLIENT, 0, 10, tcp_callback);
	set_main_page();
	show_main_page();
	return 0;
}
Esempio n. 2
0
/**************************************************************************
  Sets the "page" that the client should show.  See documentation in
  pages_g.h.
**************************************************************************/
void real_set_client_page(enum client_pages page)
{
    switch (old_page) {
    case PAGE_MAIN:
        popdown_start_menu();
        break;
    case PAGE_LOAD:
        popdown_load_game_dialog();
        break;
    case PAGE_NETWORK:
        close_connection_dialog();
        break;
    case PAGE_START:
        popdown_conn_list_dialog();
        break;
    case PAGE_GAME:
        close_game_page();
        break;
    default:
        break;
    }

    switch (page) {
    case PAGE_MAIN:
        show_main_page();
        break;
    case PAGE_LOAD:
        client_start_server();
        break;
    case PAGE_NETWORK:
        popup_join_game_dialog();
        break;
    case PAGE_START:
        conn_list_dialog_update();
        break;
    case PAGE_GAME:
        show_game_page();
        enable_main_widgets();
        update_info_label();
        unit_focus_update();
        update_unit_info_label(get_units_in_focus());
        update_turn_done_button_state();
        refresh_overview();
        menus_update();
        break;
    default:
        break;
    }

    old_page = page;
}
Esempio n. 3
0
int access_loop()
{
	//int rel;
	int ok_cam_flag;
	int ok_send_flag;
	u32 time, tick;
	char record_buf[64];
	if( check_card_action() > 0 ){
		g_deal_card_no = g_card_no;
		g_card_no = 0;

		ok_cam_flag = do_cam();
		if( ok_cam_flag <= -2 ){
			// invailed card
			set_illegal_card_page();
			set_page_keep_second( 5 );
		}
		else if( ok_cam_flag == -1 ){
			// disable enter
			set_forbid_enter_page();
			set_page_keep_second( 5 );
		}
		else if( ok_cam_flag == 1 ){
			set_allow_enter_page();
			set_page_keep_second( 5 );
		}
		time = RTC_Get();
		tick = get_sys_tick();
		// make send record buf
		gen_record_string( record_buf, time, tick, g_record_id, g_deal_card_no, ok_cam_flag );
		ok_send_flag = system_send_buf_to_host( record_buf, strlen( record_buf ) );
		// make save file record buf
		sprintf( &record_buf[ strlen( record_buf ) ], "%d", ok_send_flag );
		save_card_info( g_record_id, record_buf, ok_send_flag );
		show_main_page();
		g_record_id ++;
	}
	timer_process();
	access_command_deal();
	return 0;
}
Esempio n. 4
0
int timer_process()
{
	static unsigned second = 0;
	static unsigned beat_second = 0;
	unsigned val = RTC_Get();
	if( val - second >= 2 || (int)val - (int)second < 0 ){
		if( g_page_keep_second > 0 ){
			g_page_keep_second -= val - second;
			if( g_page_keep_second <= 0 ){
				set_main_page();
				g_page_keep_second = 0;
			}
		}
		second = val;
		show_main_page();
	}
	if( val - beat_second >= 10 || (int)val - (int)beat_second < 0 ){
		char *buf = "beats ";
		system_send_buf_to_host( buf, strlen( buf ) );
		beat_second = val;
	}
	return 0;
}