Tractor game category design

Source: Internet
Author: User

I don't know how to do this. I can only talk about the general card games. First, since we want to use the oo design method, we must design it from top to bottom.
Let's first analyze the process of the lianzhong game. First, we enter the game hall, select a card table, and people can join the game. We can have a lot of games, until this table is full
Department staff left. In this way, the class can be constructed from top to bottom:
1. Hall class)
This class is not complex and can be defined in this way
Public class Hall
{
// Private member variable
// Hall attributes
Private String m_strName; // Hall name
Private String m_strDescription; // Hall description
Private String m_strServerIP; // The Host ip address in the hall and the ip address for Internet access. The specific protocol is required.
...... // Other required attributes
// Objects contained in the hall
Private ArrayList m_arrUsers; // User Group
Private ArrayList m_arrConnections; // corresponding to the connection of each user, which can be udp or tcp.
Pirvate ArrayList m_arrTables; // table class Array
Private ArrayList m_arrMatchs; // each game class corresponds to each game.

// Attributes
Public String Name ....
....
// The method is as follows:
// Construction
Public Hall ()
{
Start server winservice...
}
/// Create a socket connection for each user
/// The main function is to obtain the user's ip address, establish a socket, and then add the user to the online user group.
/// <Parameter> a_objUser, a User object, </parameter>
Public void Connect (User a_objUser)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.