全站通知:

基本模组设置

阅读

    

2023-11-30更新

    

最新编辑:Lu_23333

阅读:

  

更新日期:2023-11-30

  

最新编辑:Lu_23333

来自城市:天际线WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索
页面贡献者 :
xl123071
Lu_23333
施工中:欢迎协助编辑本页,请参考帮助:编辑帮助帮助:编辑规范。请从以下方面协助编辑:
  • 需要翻译

This guide is for setting up a project for a basic mods that use the ICities API.

Basic Mods

Basic mods are compiled from c# source files when the game starts into a dll.
This means that creating a basic mod is much easier and setting up is as simple as creating a folder and a file.
There are obviously some limitations to basic mods, it's a good starting point to create mods but at some point you will probably find out that you want to do more.
If that's the case you can start creating advanced mods by following this setup guide.

Possibilities

Here are some examples you could do and things you can't do with basic mods.
Not everything is listed here so make sure to look at the ICities Modding API page to see exactly what you can do.

  • ILoading - Callbacks when maps are loaded, change theme of maps.
  • IAreas - Unlock areas, change price of areas, change how areas are unlocked.
  • IChirper - Remove chirper messages, change position, hide.
  • IDemand - Change demand of residents, commercial and industry.
  • IEconomy - Set/give money, Change the cost of anything (construction, relocation, maintenance, refunds)
  • ILevelUp - Modify how buildings (resedential,commercial,industry,office) are leveled up, modify eduction, land value, wealth, service progress.
  • IMilestones - Unlock milestones, change population target of the next milestone.
  • ITerrain - Heightmap management, change heights.
  • IThreading - Update loop, simulation time stuff, add action to simulation/main thread,
  • Mod settings UI|Mod Options Panel - Create a UI page for your mod with custom settings.
  • And more...

Setup

To get started on your first mod all you have to do is create a folder for your mod in the mods folder.
See Folder Structure basically it's located in %LOCALAPPDATA%\Colossal Order\Cities_Skylines\Addons\Mods.
Create a folder with the name of your mod in there, then create a Source folder within that, and then create a C# file within the Source folder.

It should look like this: /Mods/YourModName/Source/YourModName.cs

  • Mods
    • YourModName
      • YourModName.dll (your automatically compiled dll is placed here)
      • Source
        • YourModName.cs

Creating mods

To create mods you basically just write C# code with classes (or 1 class) that implement the ICities interfaces.
You can use any text editor to do this such as Notepad, Notepad++, Sublime, Atom. VSCode, etc..
However, if you wish to have intellisense (autocompletion and such) then you should use Visual Studio and add a reference to ICities.dll.
Please follow the Advanced Mod Setup page to do so.

Next step: Modding Basics

See also

说明

本文内容长期有效,适用任何游戏版本。

本页内容最初译自官方Wiki:Basic Mod Setup,经双方编辑后内容可能与来源不同。