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.