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.