Skip to content

Commit

Permalink
Merge branch 'developing'
Browse files Browse the repository at this point in the history
  • Loading branch information
will258012 committed Dec 21, 2024
2 parents 5c96d9a + 9d86002 commit 4507037
Show file tree
Hide file tree
Showing 24 changed files with 937 additions and 139 deletions.
21 changes: 0 additions & 21 deletions FPSCamera.API/Detector.cs

This file was deleted.

41 changes: 23 additions & 18 deletions FPSCamera.API/FPSCamera.API.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\IOperateItRevisited\packages\InjectModuleInitializer.2.0.3\build\InjectModuleInitializer.props" Condition="Exists('..\..\IOperateItRevisited\packages\InjectModuleInitializer.2.0.3\build\InjectModuleInitializer.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{92F27C26-188D-4CEB-9CA1-82872A545995}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FPSCamera.API</RootNamespace>
<RootNamespace>FPSCameraAPI</RootNamespace>
<AssemblyName>FPSCamera.API</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<LangVersion>latest</LangVersion>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -23,41 +27,42 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CitiesHarmony.API, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\FPSCamera\packages\CitiesHarmony.API.2.2.0\lib\net35\CitiesHarmony.API.dll</HintPath>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\Cities_Skylines\Cities_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CitiesHarmony.Harmony, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\FPSCamera\packages\CitiesHarmony.Harmony.2.2.2\lib\net35\CitiesHarmony.Harmony.dll</HintPath>
<Reference Include="ICities">
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\Cities_Skylines\Cities_Data\Managed\ICities.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="ColossalManaged">
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\Cities_Skylines\Cities_Data\Managed\ColossalManaged.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\Cities_Skylines\Cities_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Detector.cs" />
<Compile Include="ModSettings.cs" />
<Compile Include="Helper.cs" />
<Compile Include="L10n.cs" />
<Compile Include="Notification.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FPSCamera\FPSCamera.csproj">
<Project>{72c99e7c-c11b-4669-90ed-0944de5b9085}</Project>
<Name>FPSCamera</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\AlgernonCommons\AlgernonCommonsPatchingShared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
14 changes: 0 additions & 14 deletions FPSCamera.API/FPSCamera.API.projitems

This file was deleted.

13 changes: 0 additions & 13 deletions FPSCamera.API/FPSCamera.API.shproj

This file was deleted.

62 changes: 62 additions & 0 deletions FPSCamera.API/Helper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using ColossalFramework.PlatformServices;
using ColossalFramework.Plugins;
using System;
using System.Reflection;
using static ColossalFramework.Plugins.PluginManager;

namespace FPSCameraAPI
{
/// <summary>
/// Based on boformer's CitiesHarmony.API.HarmonyHelper. Many thanks!
/// </summary>
public static class Helper
{
internal const ulong WorkshopId = 3198388677uL;
public static void CheckFPSCamera()
{
Notification.InstallNotification();
}

public static void GetFPSCameraStatus(out bool isInstalled, out bool isEnabled)
{
isInstalled = isEnabled = false;
if (Type.GetType("FPSCamera.Utils.ModSupport, FPSCamera") != null) isInstalled = true;
foreach (PluginInfo plugin in PluginManager.instance.GetPluginsInfo())
{
if (plugin.isEnabled)
{
foreach (Assembly assembly in plugin.GetAssemblies())
{
if (assembly.GetName().Name.Equals("FPSCamera") && assembly.GetType("FPSCamera.Utils.ModSupport") != null)
{
isEnabled = true;
}
}
}
}
}
public static bool IsFPSCameraInstalledAndEnabled
{
get
{
GetFPSCameraStatus(out var isInstalled, out var isEnabled);
return isInstalled && isEnabled;
}
}
public static bool IsWorkshopItemSubscribed
{
get
{
var subscribedIds = PlatformService.workshop.GetSubscribedItems();
if (subscribedIds == null) return false;

foreach (var id in subscribedIds)
{
if (id.AsUInt64 == WorkshopId) return true;
}

return false;
}
}
}
}
70 changes: 70 additions & 0 deletions FPSCamera.API/L10n.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using ColossalFramework.Globalization;
using System.Collections.Generic;
namespace FPSCameraAPI
{
internal static class L10n
{
private static bool IsZh => LocaleManager.exists && LocaleManager.instance.language == "zh";

private static readonly Dictionary<string, string> EnTranslations = new()
{
["MissingDependencyTitle"] = "Missing dependency: First Person Camera - Continued",
["MissingDependencyMessage"] = "The dependency 'First Person Camera - Continued' is required for some mod(s) to work correctly.\n Do you want to subscribe to it right now?",
["DependencyNotEnabledTitle"] = "Dependency not enabled: First Person Camera - Continued",
["DependencyNotEnabledMessage"] = "The dependency 'First Person Camera - Continued' is not enabled.\n Do you want to enable it right now?",
["SuccessSub"] = "First Person Camera - Continued has been installed successfully. It is recommended to restart the game now!",
["ErrorSub"] = "An error occured while attempting to automatically subscribe to First Person Camera - Continued (no network connection?)",
["ManualDownload"] = "You can manually download the First Person Camera - Continued mod from github.com/will258012/FPSCamera-Continued/releases",
["ThenManualDownload"] = "then manually download the First Person Camera - Continued mod from github.com/will258012/FPSCamera-Continued/releases",
["RejectSub"] = "You have rejected to automatically subscribe to First Person Camera - Continued :(",
["RejectSubSln"] = "Either unsubscribe those mods or subscribe to the First Person Camera - Continued mod, then restart the game!",
["SuccessEnabled"] = "First Person Camera - Continued has been enabled successfully.",
["ErrorEnable"] = "An error occured while attempting to enable First Person Camera - Continued",
["ManualEnable"] = "You could manually enable it in Content Manager",
["RejectEnable"] = "You have rejected to enable First Person Camera - Continued :(",
["RejectEnableSln"] = "Either unsubscribe those mods or enable the First Person Camera - Continued mod",
["ShowError"] = "The mod(s):\n{0}require the dependency 'First Person Camera - Continued' to work correctly!\n\n{1}\n\nClose the game, {2}",
["NotOnSteam"] = "First Person Camera - Continued could not be installed automatically because you are using a platform other than Steam.",
["NoWorkShop"] = "First Person Camera - Continued could not be auto-subscribed because you are playing in --noWorkshop mode!",
["NoWorkShopSln"] = "then restart without --noWorkshop \n or manually download and install the First Person Camera - Continued mod from github.com/will258012/FPSCamera-Continued/releases",
["WorkShopNotAvailable"] = "First Person Camera - Continued could not be installed automatically because the Steam workshop is not available (no network connection?)",
["AssemblyNotLoad"] = "It seems that First Person Camera - Continued has already been subscribed, \nbut Steam failed to download the files correctly or they were deleted,\nor the mod is not loaded in Skyve",
["AssemblyNotLoadSln"] = "check your network connections \nOr (re)subscribe to the First Person Camera - Continued workshop item\nOr check the status in Skyve (if you have)",
};

private static readonly Dictionary<string, string> ZhTranslations = new()
{
["MissingDependencyTitle"] = "缺少前置:First Person Camera - Continued",
["MissingDependencyMessage"] = "前置 First Person Camera - Continued 是某些模组正常运行所必需的。\n是否立即订阅?",
["DependencyNotEnabledTitle"] = "前置未启用:First Person Camera - Continued",
["DependencyNotEnabledMessage"] = "前置 First Person Camera - Continued 尚未启用。\n是否立即启用?",
["SuccessSub"] = "已成功订阅!建议立即重启游戏",
["ErrorSub"] = "尝试自动订阅 First Person Camera - Continued 时发生错误(无网络连接?)",
["ManualDownload"] = "你可以手动从 github.com/will258012/FPSCamera-Continued/releases 下载该模组。",
["ThenManualDownload"] = "随后手动下载 (github.com/will258012/FPSCamera-Continued/releases) \n并安装 First Person Camera - Continued 模组",
["RejectSub"] = "已拒绝自动订阅 First Person Camera - Continued……",
["RejectSubSln"] = "请退订以下模组或订阅 First Person Camera - Continued,并重启游戏",
["SuccessEnabled"] = "已成功启用!",
["ErrorEnable"] = "尝试启用 First Person Camera - Continued 时发生错误",
["ManualEnable"] = "可在内容管理器中手动启用它",
["RejectEnable"] = "已拒绝启用 First Person Camera - Continued……",
["RejectEnableSln"] = "请退订以下模组或在内容管理器中启用 First Person Camera - Continued",
["ShowError"] = "以下模组:\n{0}需要前置 First Person Camera - Continued 才能正常工作!\n{1}\n请关闭游戏,{2}",
["NotOnSteam"] = "由于你使用的是 Steam 以外的平台,无法自动订阅 First Person Camera - Continued。",
["NoWorkShop"] = "由于游戏在 --noWorkshop 模式下,无法自动订阅 First Person Camera - Continued。",
["NoWorkShopSln"] = "请重启游戏并不带 --noWorkshop 参数,\n或者手动下载 (github.com/will258012/FPSCamera-Continued/releases) 并安装 First Person Camera - Continued。",
["WorkShopNotAvailable"] = "由于创意工坊不可用,无法自动安装 First Person Camera - Continued (无网络连接?)",
["AssemblyNotLoad"] = "似乎已经订阅了 First Person Camera - Continued,\n但 Steam 未能下载文件或文件被删除,\n或是模组未在 Skyve 中加载",
["AssemblyNotLoadSln"] = "随后检查网络连接\n或者重新订阅 First Person Camera - Continued\n或者检查 Skyve 的状态(如有)",
};

internal static string Translate(string key)
{
if (IsZh && ZhTranslations.TryGetValue(key, out var value))
return value;
else if (EnTranslations.TryGetValue(key, out var value2))
return value2;
else return key;
}
}
}
Loading

0 comments on commit 4507037

Please sign in to comment.