PHP web game learning-Explanation of Xnova (ogame) source code (11)

Source: Internet
Author: User
This article mainly introduces the building page part of PHP Web Game Xnova (ogame) source code. If you need it, refer

This article mainly introduces the building page part of PHP Web Game Xnova (ogame) source code. If you need it, refer

14. Architecture page (BatimentBuildingPage. php)

Now I am going to parse the real building page. There are a lot of functions in it, but it is not difficult. Let's take a look at it.

First, check the space used by the planet and update it. Use the CheckPlanetUsedFields function. As mentioned earlier, it is not difficult to implement this function.

Next, we will focus on the structure we mentioned earlier, that is, to determine whether to input data. So we will jump to the end of this code, but here are several functions that process some building queues.


1. SetNextQueueElementOnTop: As we mentioned, process the next building in the queue

2. ShowBuildingQueue

3. BuildingSavePlanetRecord: Save the building queue constructed by the previous code to the database

4. BuildingSaveUserRecord: saves resource points (transaction Officers) to the database.

Then I want to construct the building page. I will make a text description. Most of the UI structures are not written:

1. determine the maximum queue Value

2. Calculate the maximum space of the current planet.

3. Determine whether the current building can be built

4. If possible, the construction time and required resources should be obtained.

5. If the research institute is built, it is necessary to determine whether or not the research is being conducted.

The last step is to construct an html page based on the prepared content. Next, we will skip some user input code, with a clear structure:

1. Obtain the parameters entered by the user (actually click)

2. Determine whether the building to be built is on the planet or on the moon.

3. There is also a judgment on the validity of the link. If it is illegal, the user will be punished ()

4. Access different queue functions based on user operations

5. CancelBuildingFromQueue: cancel construction in progress

6. RemoveBuildingFromQueue: Remove a building from the queue

7. AddBuildingToQueue (true): Insert a building in the queue

8. AddBuildingToQueue (false): Insert a canceled building in the queue

9. ResetThisFuckingCheater: Punish user functions. Let's take a look.

The specific functions of the above functions can be viewed on your own. They all perform queue operations.

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.