PHP Web Game Learning Xnova (ogame) Source code interpretation (12) _php instance

Source: Internet
Author: User

XV, Research page (researchbuildingpage.php)

The study is relatively simple because there are no queues, but there are some more special things. Let's look at one of the processing functions Handletechnologiebuild () before the study.

This function is to deal with the current scientific research, where the b_tech_planet field is the study of the Planet Id,b_tech field is the point of completion of the study, b_tech_id field is the study of the specific technical field name. Function logic is not difficult, I will not carefully explained, we look at the following formal entry into the research page:

The first is to check whether the current planet has a research institute.

Then check whether there is a research institute in the building queue of the current planet, use the function checklabsettingsinqueue () check;

Next to the previous structure, we'll look at the following construction code, loop:

1. Judge whether science and technology research

2. To determine whether this study could be carried out, mainly in the context of the vars.php examination of documents

3. Resources needed to obtain research

4. Time required to obtain research

5. Then judge whether such studies can be carried out

6. The following is a branch: if there is no research in progress, then construct the next level of HTML; If a study is in progress, construct the remaining time of the study.

7. Final Output page

Now go back to the front and explain the logic of the player click Study. Divided into two paragraphs of logic, one is research, the other is to cancel the study.

1. Research: First, some security checks, and then obtain the required resources and time, construction deduction of resources and other statements

2. Cancellation of research: acquisition of required resources, construction of return resources and other statements

3. Finally submit to the database, update resources and some other information

The logic of the study page is much simpler than the previous building page, and the next chapter will be the shipyard page.

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.