黑客網(wǎng)絡Hacknet怎么制作MOD?很多玩家還不是很了解MOD怎么制作,接下來小編就為大家?guī)怼逗诳途W(wǎng)絡》mod開發(fā)教程翻譯大全,mod制作教程,感興趣的一起來看看吧。 黑客網(wǎng)絡mod開發(fā)教程翻譯...

黑客網(wǎng)絡Hacknet怎么制作MOD?很多玩家還不是很了解MOD怎么制作,接下來小編就為大家?guī)怼逗诳途W(wǎng)絡》mod開發(fā)教程翻譯大全,mod制作教程,感興趣的一起來看看吧。

黑客網(wǎng)絡mod開發(fā)教程翻譯大全:

Introduction介紹

So. You want to create your own mod for Hacknet.

First, you'll need some knowlege of Hackmore.

當你想要創(chuàng)建自己的mod 。

首先,你需要一些Hackmore的知識。

Hackmore is a .dll file placed next to Hacknet.exe, that loads every mod in the .dll form in the folder /Mods, next to Hacknet.exe.

Hackmore是Hacknet.exe旁的一個.dll文件,這個文件加載所有以.dll文件存儲在/Mod目錄下的Mod.

Here's what you'll need.

A C# development environment

Basic knowledge of C#

The latest release of Hackmore.dll

Of course, the game Hacknet and a patched Hacknet.exe

以下是你所需要的。

一個c#開發(fā)環(huán)境

c#的基本知識

Hackmore.dll的最新版本

當然,還有hacknet和打了補丁的Hacknet.exe(譯者注:即原作者提供的“Kernel Upgrade”中修改過的Hacknet.exe文件。)

The latest release of Hackmore.dll and the patched Hacknet.exe can be found in my mods (Kernel Upgrade).

最新版本的Hackmore.dll和hacknet.exe補丁可以在我開發(fā)的Mod,Kernel Upgrade里找到

For this tutorial, I'll use Visual Studio Community on Windows 7, but it should be working on every platform and on every C# IDE.

在這次教程中,我將在Windows 7上使用Visual Studio社區(qū)版開發(fā)平臺,但它應該工作在每一個平臺的每一個C# IDE上。

Setting files up, preparing the project 設置文件,準備項目

First, I'm going to open Visual Studio and set up a new project.

I'm using the french version, since I'm french, but you'll be able to find out what I'm doing pretty easily.

First, create a new class library project inside the folder you want and I'll call it "GuideMod".

首先,我要打開Visual Studio,然后建立一個新項目。

在這里我使用的是法語的版本,因為我是一個法國人(譯者注:原作者為法國人。),但你可以很容易發(fā)現(xiàn)我在做什么。

首先,在項目文件夾創(chuàng)建一個新的類庫,我命名它為“GuideMod”。

黑客網(wǎng)絡怎么制作MOD 黑客網(wǎng)絡mod開發(fā)教程翻譯大全

Press OK and your project is created.

You should see this screen :

點擊ok并創(chuàng)建你的項目。

您應該會看到一下畫面:

黑客網(wǎng)絡怎么制作MOD 黑客網(wǎng)絡mod開發(fā)教程翻譯大全

I'm going to rename Class1.cs to GuideMod.cs, and rename the public class Class1 to public class GuideMod

Now, you have to add as reference Hacknet.exe and Hackmore.dll like this :

我將要去重命名Class1為GuideMod .cs,并重命名公共類Class1 為 公共類GuideMod

現(xiàn)在,你必須添加Hacknet.exe和hackmore.dll作為參考,就像這樣:

黑客網(wǎng)絡怎么制作MOD 黑客網(wǎng)絡mod開發(fā)教程翻譯大全

Once that's done, make GuideMod extends HackmoreMod and implement all functions, like this :

只要你完成了這一步,GuideMod ,作為HackmoreMod的擴展就可以實現(xiàn)Hackmore所有功能,像這樣:

黑客網(wǎng)絡怎么制作MOD 黑客網(wǎng)絡mod開發(fā)教程翻譯大全

Now you're good to go ! We're going to make our mod.

現(xiàn)在!我們可以開始制作我們的mod了。

Making the basics 基礎知識

Here are the four basic functions you'll have to write :

string getModName() : This function returns the ID of the mod. It is used for identifying your mod in the Mod Manager.

bool onInitialize() : This function is called when the game starts.

bool onLoadContent() : This function is called when the game loads the content.

bool onLoadOS() : This function is called when the game has finished loading a save, and gives you an instance of the player, allowing for all types of modifications.

這是你將要實現(xiàn)的四個基本函數(shù):

string getModName() : 此函數(shù)返回mod的ID。 它用于在Mod Manager中識別您的mod。

bool onInitialize() : 游戲開始時,會調(diào)用此函數(shù)

bool onLoadContent() : 當游戲加載這個mod內(nèi)容的時候,會被調(diào)用此函數(shù)

bool onLoadOS() : 這個函數(shù)在游戲完成加載并保存時調(diào)用,并為您提供玩家的權利,允 許所有類型的修改。

So, first, let's code the first function : getModName().

public override string getModName()

{

return "GuideMod";

}

所以,首先,讓我們編寫第一個函數(shù):getModName()。

public override string getModName()

{

return "GuideMod";

}

With that, the ID of our mod will be GuideMod.

有了這一個函數(shù),我們的mod的名稱將會是GuideMod。

Our first command - Introduction 我們的第一個命令-介紹

We'll start doing our first commands.

First, make sure you've replaced "throw new NotImplementedException();" by "return true;"

我們將要開始做我們的第一個命令.

首先,確保你已經(jīng)用 "return true;"更換 "throw new NotImplementedException();"

We're going to start working inside onLoadContent().

Let's type "ModManager." to open autocompletion menu and see what we can write.

我們將要開始在”onLoadContent().”里工作.

讓我們輸入“ModManager”。 打開自動完成菜單,看看自動補全會為我們寫什么。

The functions Hackmore lets us use are :

ModManager.addCommand()

ModManager.hasCommand()

ModManager.addCustomComputerXml()

ModManager.addExeProgram()

ModManager.getModType()

ModManager.isModLoaded()

Hackmore讓我們使用的方程有:

ModManager.addCommand()

ModManager.hasCommand()

ModManager.addCustomComputerXml()

ModManager.addExeProgram()

ModManager.getModType()

ModManager.isModLoaded()

To create a command, we'll need to use ModManager.addCommand().

When we type it, we see that it has three declarations.

要創(chuàng)建命令,我們需要使用命令 ModManager.addCommand().

當我們輸入它之后,我們將會看到它有三個聲明。

黑客網(wǎng)絡怎么制作MOD 黑客網(wǎng)絡mod開發(fā)教程翻譯大全

The first argument is always the name of the command.

The second argument is always the function of the command, we'll get to that later on.

第一個參數(shù)總會是是命令的名稱。

第二個參數(shù)總會是命令的函數(shù),在后面我們會提到。

If you use the second declaration, the last argument is a boolean "true"/"false" that indicates if the command should be in autocompletion. The first declaration doesn't do autocompletion.

如果使用第二個聲明,最后一個參數(shù)是一個boolean“true”/“false”,該參數(shù)若被實現(xiàn)則表示命令是否應該自動完成狀態(tài)。(true表示自動完成,false則否) .而第一個聲明將不會做自動完成。

(譯者注:我們猜測原作者意思如下:

眾所周知,Hacknet原有的指令可用Tab補全,而這一命令則會控制新加的命令是否也可用Tab。這一“開關”也許是為了防止某些沖突。)

The third declaration has four arguments. The third one is the description of the command, that appears in the command help, and the last one is the same as above, autocompletion.

第三個聲明有四個參數(shù)。第三個參數(shù)是命令的描述,在命令幫助中將會出現(xiàn),最后一個參數(shù)與前面的相同,都是自動完成開關。

Our first command - Implementation 我們的第一個命令-實現(xiàn)

Now, we're going to code our command.

Let's create a new static function like so :

現(xiàn)在,我們將要編寫我們的命令。

讓我們用以下代碼創(chuàng)建一個新的靜態(tài)函數(shù):

public static bool testCommand(OS os, string[] args)

{

return true;

}

Make sure to use Hacknet's OS class, and not the system OS class.

Now, let's make so that our command prints out "Hello World" on the terminal.

If you see the autocompletion for os., you'll see that you can use os.write(string text);

So let's write :

確保使用的是Hacknet的OS類,而不是電腦操作系統(tǒng)的OS類。

現(xiàn)在,讓我們用命令在終端上打印出“Hello World”。

如果你想用os類自動完成這個命令,你可以使用os.write(string text);

所以,讓我們寫一段以下代碼:

public static bool testCommand(OS os, string[] args)

{

os.write("Hello World");

return true;

}

Our first command is done. But it won't work in game ! We need to register it.

Let's change : "public override bool onLoadContent()"

我們的第一個命令完成了。但它不會在游戲中打印出來.我們需要注冊它。

讓我們改寫一下代碼:"public override bool onLoadContent()"

public override bool onLoadContent()

{

ModManager.addCommand("test", testCommand);

return true;

}

Launching the mod 啟動Mod

You have to compile the mod into a .dll if you want it to be launched by Hackmore !

Click on "Generate Solution" (Ctrl-Maj-B or Generate > Generate Solution) to compile your mod and all dependencies.

PS : Debug is on by default, it's not an issue.

Then go to your project's folder, bin folder, and you'll see two folders: Debug and Release.

Go inside Debug (if you compiled in Debug mode) or Release (if you compiled in Release mode), and copy your GuideMod.dll to the Mods folder of your Hacknet installation.

You might have to unblock your .dll by going into properties and uncheck "Block".

If Hackmore is well installed, you should be able to go inside the terminal, and type "test" inside the terminal !

Thanks for following this tutorial !

為了啟動Mod,你要把它編成.dll文件。

點擊“生成解決方案”(按ctrl-maj-b或生成>生成解決方案)來編譯你的插件和所有的依賴文件。

PS::調(diào)試模式是默認啟用的,這不是一個錯誤。

然后轉(zhuǎn)到你的項目文件夾下的bin文件夾,你會看到兩個文件夾:Debug文件夾和 Release文件夾。

進入Debug文件夾(如果你是在調(diào)試模式下編譯的)或Release文件夾(如果你是在發(fā)布模式下編譯的),并復制你的guidemod.dll到你hacknet安裝文件夾下的Mods文件夾里。

你也許需要允許你的dll文件運行,通過進入屬性頁面并取消勾選“Block”屬性。

(譯者注:我不是很確定,但這可能是針對某些安全軟件的。)

如果Hackmore是安裝好的,你應該能夠進入終端,然后在終端輸入“測試”!

感謝您閱讀這個教程!

看了上文九游小編帶來的黑客網(wǎng)絡怎么制作MOD,你是否了解了相關內(nèi)容信息,知道了呢!更多最新最好玩的手機游戲就來九游下載吧!

如轉(zhuǎn)載涉及版權等問題,請作者與我司聯(lián)系,我司將在第一時間刪除或支付稿酬。