As3+java+mysql (MyBatis) Data Automation tool (i)

Source: Internet
Author: User
Tags constant definition

In the page tour, most of the development patterns are: Client (AS3) + server Side (Java) + database (MySQL).

In these 3 sections there will be an identical part of the data structure. such as a user data, in the client using Class Uservo (AS3) to represent, on the server side using Uservo (Java) to represent, in the Database data table T_user (MySQL), when the server (Java) from the database (MySQL) to query the user data, needs to be converted to Uservo (Java) objects and then transferred to the client, which needs to be converted to Uservo (AS3) objects. If in development to write a Uservo class in the AS3, and then write a Uservo class in Java, and then write a MySQL table statement t_user, which is a huge amount of work in any application or game (the data class is super), and every time you want to change, add or delete In addition to a field name or type, believe that every programmer will crash into the computer.

In addition, there will be some common information in the client and server interaction, such as the login command (value 1, or the string "login"), when the servers receive the command (1), the server must be very clear that the 1 is a login request, and you certainly do not want to write directly in the program 1 To be the basis of judgment. At this point the client and server will have a constant definition of the same value, the game request command is absolutely a huge collection, so you do not want to maintain the same two sets of constants each time. In addition to the request command, there are some other constants, such as the player character gender with what value, the player each race with what value is expressed and so on.

To summarize, in game development, we always want to be able to focus on a set of data when it needs to be repeatedly defined and maintained, and then all (the client, server, and even database are automatically consistent). Use "User data" for example, such as defining a user-owned field: ID (Identity-integer type), name (nickname-string type, MySQL database also has length, assumed to be), sex (gender-integer, 0 for male, 1 for female), and then can automatically generate AS3 Userv Class O, Java's Uservo class, and MySQL's Build table script T_user. Then define the request command LOGIN (integer) to take a value of 1, and then also automatically generate AS3 constant login:int = 1,java constant int LOGIN = 1.

Then there is now the automatic tool Autoscript.jar, after the configuration of the required data objects and constants, you can directly generate the corresponding AS3, Java data classes and MySQL build table statements.

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.