-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update templates for version 1.1.2f1
- Loading branch information
Showing
27 changed files
with
7,735 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Colossal.Logging; | ||
using Game; | ||
using Game.Modding; | ||
using Game.SceneFlow; | ||
using Game.SceneFlow; | ||
using Colossal.IO.AssetDatabase; | ||
|
||
namespace StockMod | ||
{ | ||
public class Mod : IMod | ||
{ | ||
public static ILog log = LogManager.GetLogger($"{nameof(StockMod)}.{nameof(Mod)}").SetShowsErrorsInUI(false); | ||
private Setting m_Setting; | ||
|
||
public void OnLoad(UpdateSystem updateSystem) | ||
{ | ||
log.Info(nameof(OnLoad)); | ||
|
||
if (GameManager.instance.modManager.TryGetExecutableAsset(this, out var asset)) | ||
log.Info($"Current mod asset at {asset.path}"); | ||
|
||
m_Setting = new Setting(this); | ||
m_Setting.RegisterInOptionsUI(); | ||
GameManager.instance.localizationManager.AddSource("en-US", new LocaleEN(m_Setting)); | ||
|
||
AssetDatabase.global.LoadSettings(nameof(StockMod), m_Setting, new Setting(this)); | ||
} | ||
|
||
public void OnDispose() | ||
{ | ||
log.Info(nameof(OnDispose)); | ||
if (m_Setting != null) | ||
{ | ||
m_Setting.UnregisterInOptionsUI(); | ||
m_Setting = null; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<Publish> | ||
<!--Id must be set in order to update existed mod. it is not required for publishing mod for the first time--> | ||
<ModId Value="" /> | ||
<!--Name of the mod to display to players--> | ||
<DisplayName Value="StockMod" /> | ||
<!--Short description of the mod--> | ||
<ShortDescription Value="This is a short description" /> | ||
<!--Long description of the mod. Single line or multi line. Supports minimal markdown subset--> | ||
<!--LongDescription Value="This is a long description" /--> | ||
<LongDescription> | ||
This is a long description | ||
</LongDescription> | ||
<!--Thumbnail--> | ||
<Thumbnail Value="Properties/Thumbnail.png" /> | ||
<!--Screenshot, can be set multiple times--> | ||
<Screenshot Value="" /> | ||
<!--Tag, can be set multiple times--> | ||
<Tag Value="" /> | ||
<!--Link to the forum post where the mod can be discussed--> | ||
<ForumLink Value="" /> | ||
<!--Version of the mod--> | ||
<ModVersion Value="1.0" /> | ||
<!--Recommended version of the base game to use the mod--> | ||
<GameVersion Value="1.0.*" /> | ||
<!--Dependency for the mod, can be set multiple times--> | ||
<Dependency Id="" /> | ||
<!--Change log for new version. Single line or multi line. Supports minimal markdown subset--> | ||
<ChangeLog Value="" /> | ||
<!--ChangeLog> | ||
</ChangeLog--> | ||
<!--External link. supported types are discord, github, youtube, twitch, x, paypal, patreon--> | ||
<ExternalLink Type="" Url="" /> | ||
</Publish> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Release</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net472</TargetFramework> | ||
<PublishDir>bin\$(Configuration)\$(TargetFramework)\</PublishDir> | ||
<ModPublisherCommand>Publish</ModPublisherCommand> | ||
</PropertyGroup> | ||
</Project> |
12 changes: 12 additions & 0 deletions
12
dotnet/Properties/PublishProfiles/PublishNewVersion.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Release</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net472</TargetFramework> | ||
<PublishDir>bin\$(Configuration)\$(TargetFramework)\</PublishDir> | ||
<ModPublisherCommand>NewVersion</ModPublisherCommand> | ||
</PropertyGroup> | ||
</Project> |
12 changes: 12 additions & 0 deletions
12
dotnet/Properties/PublishProfiles/UpdatePublishedConfiguration.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Release</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net472</TargetFramework> | ||
<PublishDir>bin\$(Configuration)\$(TargetFramework)\</PublishDir> | ||
<ModPublisherCommand>Update</ModPublisherCommand> | ||
</PropertyGroup> | ||
</Project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
using Colossal; | ||
using Colossal.IO.AssetDatabase; | ||
using Game.Modding; | ||
using Game.Settings; | ||
using Game.UI; | ||
using Game.UI.Widgets; | ||
using System.Collections.Generic; | ||
|
||
namespace StockMod | ||
{ | ||
[FileLocation(nameof(StockMod))] | ||
[SettingsUIGroupOrder(kButtonGroup, kToggleGroup, kSliderGroup, kDropdownGroup)] | ||
[SettingsUIShowGroupName(kButtonGroup, kToggleGroup, kSliderGroup, kDropdownGroup)] | ||
public class Setting : ModSetting | ||
{ | ||
public const string kSection = "Main"; | ||
|
||
public const string kButtonGroup = "Button"; | ||
public const string kToggleGroup = "Toggle"; | ||
public const string kSliderGroup = "Slider"; | ||
public const string kDropdownGroup = "Dropdown"; | ||
|
||
public Setting(IMod mod) : base(mod) | ||
{ | ||
|
||
} | ||
|
||
[SettingsUISection(kSection, kButtonGroup)] | ||
public bool Button { set { Mod.log.Info("Button clicked"); } } | ||
|
||
[SettingsUIButton] | ||
[SettingsUIConfirmation] | ||
[SettingsUISection(kSection, kButtonGroup)] | ||
public bool ButtonWithConfirmation { set { Mod.log.Info("ButtonWithConfirmation clicked"); } } | ||
|
||
[SettingsUISection(kSection, kToggleGroup)] | ||
public bool Toggle { get; set; } | ||
|
||
[SettingsUISlider(min = 0, max = 100, step = 1, scalarMultiplier = 1, unit = Unit.kDataMegabytes)] | ||
[SettingsUISection(kSection, kSliderGroup)] | ||
public int IntSlider { get; set; } | ||
|
||
[SettingsUIDropdown(typeof(Setting), nameof(GetIntDropdownItems))] | ||
[SettingsUISection(kSection, kDropdownGroup)] | ||
public int IntDropdown { get; set; } | ||
|
||
[SettingsUISection(kSection, kDropdownGroup)] | ||
public SomeEnum EnumDropdown { get; set; } = SomeEnum.Value1; | ||
|
||
public DropdownItem<int>[] GetIntDropdownItems() | ||
{ | ||
var items = new List<DropdownItem<int>>(); | ||
|
||
for (var i = 0; i < 3; i += 1) | ||
{ | ||
items.Add(new DropdownItem<int>() | ||
{ | ||
value = i, | ||
displayName = i.ToString(), | ||
}); | ||
} | ||
|
||
return items.ToArray(); | ||
} | ||
|
||
public override void SetDefaults() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public enum SomeEnum | ||
{ | ||
Value1, | ||
Value2, | ||
Value3, | ||
} | ||
} | ||
|
||
public class LocaleEN : IDictionarySource | ||
{ | ||
private readonly Setting m_Setting; | ||
public LocaleEN(Setting setting) | ||
{ | ||
m_Setting = setting; | ||
} | ||
public IEnumerable<KeyValuePair<string, string>> ReadEntries(IList<IDictionaryEntryError> errors, Dictionary<string, int> indexCounts) | ||
{ | ||
return new Dictionary<string, string> | ||
{ | ||
{ m_Setting.GetSettingsLocaleID(), "Mod settings sample" }, | ||
{ m_Setting.GetOptionTabLocaleID(Setting.kSection), "Main" }, | ||
|
||
{ m_Setting.GetOptionGroupLocaleID(Setting.kButtonGroup), "Buttons" }, | ||
{ m_Setting.GetOptionGroupLocaleID(Setting.kToggleGroup), "Toggle" }, | ||
{ m_Setting.GetOptionGroupLocaleID(Setting.kSliderGroup), "Sliders" }, | ||
{ m_Setting.GetOptionGroupLocaleID(Setting.kDropdownGroup), "Dropdowns" }, | ||
|
||
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.Button)), "Button" }, | ||
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.Button)), $"Simple single button. It should be bool property with only setter or use [{nameof(SettingsUIButtonAttribute)}] to make button from bool property with setter and getter" }, | ||
|
||
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.ButtonWithConfirmation)), "Button with confirmation" }, | ||
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.ButtonWithConfirmation)), $"Button can show confirmation message. Use [{nameof(SettingsUIConfirmationAttribute)}]" }, | ||
{ m_Setting.GetOptionWarningLocaleID(nameof(Setting.ButtonWithConfirmation)), "is it confirmation text which you want to show here?" }, | ||
|
||
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.Toggle)), "Toggle" }, | ||
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.Toggle)), $"Use bool property with setter and getter to get toggable option" }, | ||
|
||
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.IntSlider)), "Int slider" }, | ||
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.IntSlider)), $"Use int property with getter and setter and [{nameof(SettingsUISliderAttribute)}] to get int slider" }, | ||
|
||
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.IntDropdown)), "Int dropdown" }, | ||
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.IntDropdown)), $"Use int property with getter and setter and [{nameof(SettingsUIDropdownAttribute)}(typeof(SomeType), nameof(SomeMethod))] to get int dropdown: Method must be static or instance of your setting class with 0 parameters and returns {typeof(DropdownItem<int>).Name}" }, | ||
|
||
{ m_Setting.GetOptionLabelLocaleID(nameof(Setting.EnumDropdown)), "Simple enum dropdown" }, | ||
{ m_Setting.GetOptionDescLocaleID(nameof(Setting.EnumDropdown)), $"Use any enum property with getter and setter to get enum dropdown" }, | ||
|
||
{ m_Setting.GetEnumValueLocaleID(Setting.SomeEnum.Value1), "Value 1" }, | ||
{ m_Setting.GetEnumValueLocaleID(Setting.SomeEnum.Value2), "Value 2" }, | ||
{ m_Setting.GetEnumValueLocaleID(Setting.SomeEnum.Value3), "Value 3" }, | ||
}; | ||
} | ||
|
||
public void Unload() | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Library</OutputType> | ||
<TargetFramework>net472</TargetFramework> | ||
<Configurations>Debug;Release</Configurations> | ||
|
||
<!--The folder where Game.dll is located. Set it only if the game is not installed in the default location, otherwise keep it empty--> | ||
<CustomManagedPath></CustomManagedPath> | ||
|
||
<!--Path to the text file where PDX account data is stored which is required to publish the mod--> | ||
<!--Keep it outside of project in order to not commit it or share accidentally--> | ||
<!--The file should contain 2 lines:--> | ||
<!--Your.PDX@Account.login--> | ||
<!--Your-PDX-Account-Pa$$word--> | ||
<PDXAccountDataPath>$(USERPROFILE)\Desktop\pdx_account.txt</PDXAccountDataPath> | ||
|
||
<!--The file where mod information which is required for publishing mod on PDX mods are stored--> | ||
<PublishConfigurationPath>Properties\PublishConfiguration.xml</PublishConfigurationPath> | ||
</PropertyGroup> | ||
|
||
<!--Imports must be after PropertyGroup block--> | ||
<Import Project="$([System.Environment]::GetEnvironmentVariable('CSII_TOOLPATH', 'EnvironmentVariableTarget.User'))\Mod.props" /> | ||
<Import Project="$([System.Environment]::GetEnvironmentVariable('CSII_TOOLPATH', 'EnvironmentVariableTarget.User'))\Mod.targets" /> | ||
|
||
<ItemGroup> | ||
<Reference Include="Game"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Colossal.Core"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Colossal.Logging"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Colossal.IO.AssetDatabase"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Colossal.UI"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Colossal.UI.Binding"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Colossal.Localization"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Unity.Burst"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Unity.Collections"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Unity.Entities"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Unity.Mathematics"> | ||
<Private>false</Private> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Update="System"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Update="System.Core"> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Update="System.Data"> | ||
<Private>false</Private> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="$(ModPropsFile)" Link="Properties\Mod.props" /> | ||
<None Include="$(ModTargetsFile)" Link="Properties\Mod.targets" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"id": "StockMod", | ||
"author": "AuthorName", | ||
"version": "1.0.0", | ||
"dependencies": [] | ||
} |
Oops, something went wrong.