Beispiel #1
0
void LayerComInfoPlayer::update_data(const msg::Processor_530_PokerGetTourmentStatus_DOWN&tourment_status)
{
    player_cell_datas_.clear();
    for (int i = 0; i < tourment_status.tableinfo().size(); i++)
    {
        std::shared_ptr<msg::TourmentTableInfo> player_data(new msg::TourmentTableInfo);
        *player_data = tourment_status.tableinfo(i);
        
        player_cell_datas_.push_back(player_data);
    }
    
    tableview_->reloadData();
    
    if (player_cell_datas_.size() != 0)
    {
        roomid = tourment_status.roomid();
        
        LayerComInfoTable* layer_table = dynamic_cast<LayerComInfoTable*>(this->getChildByName("LayerComInfoTable"));
        if (layer_table == nullptr)
        {
            layer_table = LayerComInfoTable::create();
            this->addChild(layer_table, 10, "LayerComInfoTable");
        }
        layer_table->set_roomid(roomid);
        layer_table->update_data(player_cell_datas_[0]);
        select_table_id_ = player_cell_datas_[0]->tableid();
    }
}
void game_exit(void)
{
    char choose;

    printf("\t\t\t:::::::::::::::::::\n");
    printf("\t\t\t:: You are dead! ::\n");
    printf("\t\t\t:::::::::::::::::::\n");
    delay_time(1);

    while(1)
    {
        printf("\n\t\tYou wanna play other time? (y/n):");
        scanf("%c", &choose);
        fflush(stdin);

        switch(choose)
        {
        case 'y':
            remove_garbage();
            player_data();
            game_start();
            break;
        case 'n':
            printf("\n\t\tThanks for play the game!\n");
            delay_time(1);
            clean_console();
            exit(1);

            break;
        default:
            printf("\n\t\tPlease input a valid option! (y/n)\n");
            break;
        }
    }
}
/* Game Start */
void game_start(void)
{
    clean_console();
    player_data();
    printf("\n\t\t%s\n\t\t\t%s\n", game_name, author);
    delay_time(2);

    while(1)
    {
        /* Check if snake is dead */
        if(config.snake_status == 1) game_exit();

        game_modules();
        printf("\n");
    }
}