In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to interpret the Xnova source code in PHP web games". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to interpret the Xnova source code in PHP web games.
VI. Game main interface (frames.php)
The frames.php file function is to display the main interface of the game. Take a look at the following code first:
$InLogin = false;$XNova_Host = $_ SERVER ['HTTP_HOST']; $XNova_Script = $_ SERVER [' SCRIPT_NAME']; $Uri_Array = explode ('/', $XNova_Script); / / On vire le scriptarray_pop ($Uri_Array); $XNova_URI = implode ('/', $Uri_Array); $XNovaRootURL = "http://". $XNova_Host. "/" XNova_URI. "/"
The above code is mainly to spell out the URL of the server, which is relatively simple; the previous variable $InLogin will not be talked about for the time being. When we specifically explain common.php, we will focus on it.
Then include takes two of the files we talked about earlier, and finally outputs a large piece of HTML code. It should be noted that there are two frame constructed in the HTML code, leftmenu.php and overview.php, which I will analyze below.
7. Left navigation bar (leftmenu.php)
This file is actually very simple, except for the previous common code, just declare the ShowLeftMenu () function, and finally use display () to output the page. The function ShowLeftMenu () is not difficult either. The code is nothing more than a gettemplate template file, getting the parameters set by the server, and the user level of the login, and then constructing the page. One thing to note is the user level variable $Level, which displays an administrator link when the value of $level is greater than 0. The level represented by the value of $level is defined in the system.mo file, where 0 is the average player, 1 is the game operator, 2 is the game administrator, and 3 is the administrator.
VIII. General situation (overview.php)
This file is actually the "overview" of the corresponding link in the left navigation bar, and its main function is to display the general information of the current planet and the information of the user, including the current status of other planets. The amount of code is very large, in fact, the organization is very clear, we slowly look, we skip the first few lines of code.
$lunarow = doquery ("SELECT * FROM {{table}} WHERE 'id_owner' ='". $planetrow ['id_owner']. "'AND' galaxy' ='". $planetrow ['galaxy']. "'AND' system' ='". $planetrow ['system']. "'AND' lunapos' ='". $planetrow ['planet']. "';", 'lunas', true); CheckPlanetUsedFields ($lunarow)
The function of this code is to get the moon of the current planet and to check and correct the use space of the moon. The CheckPlanetUsedFields function not only works on the moon, it can also be used to check the planet, without looking at the code, let's move on.
Next is a period of security verification, you need to set in the parameters to enable this function, you can see for yourself, there are many such code, I generally do not analyze, it does not have much to do with the game process. Then there is a switch, two branches, one renaming the planet (abandoning the planet), and the other default branch, which is the process to be carried out after login, as follows
1. Check the user's message and display a message link if there is a new message
two。 I have removed this logic from the process of the expert system, so I am not going to analyze it.
3. Check whether the user has fleet activity, if so, construct the fleet activity information table, use the BuildFleetEventTable function to construct it, and introduce it later.
4. If the user has other planets, construct a list of other planets and display the current activity of each planet
5. Display information about interstellar missile activities launched by yourself and attacks from other players
6. Other information shows, such as announcements, google ads, etc.
7. If there is a moon, display lunar information
8. The following is some cluttered information such as star name, star space, user ranking and so on.
The above process code, there are comments, it is not difficult to understand, the following code we want to introduce.
'('. ($CurrBuild [1]). )'; $Build. = ". Pretty_time ($RestTime). "; $Build. ="\ n\ n "; $parse ['building'] = $Build;} else {$parse [' building'] = $lang ['Free'];}} else {$parse [' building'] = $lang ['Free'];}
$planetrow stores the current planet information, where b_building is the building queue. The above code first determines whether there is a construction queue, and then updates the building information according to the current time; if there is still a building that has not been completed, it shows the building unit and the remaining time of the building. The function of the building queue will be introduced in detail in the future, which will be skipped for now.
Let's briefly introduce the previous branch, in which there are three processes:
1. Renaming the planet, the code is not difficult, and I won't say much about it.
two。 Abandon the colonial planet and display the page where the user wants to enter the password
3. The user enters the password, and if the password is correct, update the information of the planet and the user's default planet ID (the moon is not judged)
At this point, I believe you have a deeper understanding of "how to interpret the Xnova source code in PHP web games". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.