PHP web game learning-Xnova (ogame) source code explanation (12) _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
PHP web game learning-Xnova (ogame) source code explanation (12 ). 15. Research Page (ResearchBuildingPage. php) research is relatively simple because there is no queue, but there are some special things. Let's take a look at a previous article 15. Research Page (ResearchBuildingPage. php)

The study is relatively simple because there is no queue, but there are some special things. Let's first look at a previous processing function handlejavasiebuild ().

This function is used to deal with current scientific and technological research. the B _tech_planet field is the planet ID of the study, the B _tech field is the time point for completing the study, and the B _tech_id field is the specific technology field name of the study. The function logic is not difficult. I will not explain it carefully. let's take a look at it. now we will go to the research page:

First, check whether there are any research institutes on the current planet.

Then, check whether there is any research in the building queue of the current planet and use the CheckLabSettingsInQueue () function to check; this function is skipped.

Next we will look at the previous structure. let's first look at the following construction code, loop:

1. determine whether it is scientific research

2. determine whether this study can be performed, mainly by checking the preconditions in the vars. php file.

3. resources required for research

4. time required to obtain the study

5. then determine whether the study can be conducted.

6. The following is a branch: if there is no research in progress, the next level of html is constructed; if there is research in progress, the remaining time of the study is constructed.

7. final output page

Now let's go back to the previous step and explain the logic of the gamer click research. It is divided into two logical segments: one is research, and the other is to cancel research.

1. Research: perform some security checks first, then obtain the required resources and time, and construct statements for deducting resources.

2. cancel the study: obtain the required resources and construct statements for returning resources.

3. finally, submit it to the database to update resources and other information.

The logic of the research page is much simpler than that of the previous building page. the next chapter will be the shipbuilding page.

The ResearchBuildingPage. php study is relatively simple because there is no queue, but there are some special things. Let's take a look at a previous study...

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.