Skip to content

Commit

Permalink
Merge pull request #39 from cvusmo/dev
Browse files Browse the repository at this point in the history
v0.3.0.1 fully functional
  • Loading branch information
blacksheepcosmo authored Sep 2, 2023
2 parents eb30c39 + 13e747f commit d982a98
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
6 changes: 4 additions & 2 deletions Toggle NotificationsProject/TNTools/UI/AssetsLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ internal class AssetsLoader
{
internal static Texture2D LoadIcon(string path)
{
Texture2D imageTexture = AssetManager.GetAsset<Texture2D>("togglenotifications/images/" + path + ".png");
string fullPath = "com.github.cvusmo.togglenotifications/images/" + path + ".png";
Debug.Log("Trying to load asset from path: " + fullPath);
Texture2D imageTexture = AssetManager.GetAsset<Texture2D>(fullPath);

if (imageTexture == null)
{
Debug.LogError("Failed to load image texture from path: " + path);
Debug.Log("Full resource path: " + Application.dataPath + "/" + path);
Debug.Log("Expected resource type: Texture2D");
Debug.Log("Full path: " + Application.dataPath + "/togglenotifications/images/" + path + ".png");
Debug.Log("Full path: " + Application.dataPath + "com.github.cvusmo.togglenotifications/images/" + path + ".png");
}
return imageTexture;
}
Expand Down
4 changes: 3 additions & 1 deletion Toggle NotificationsProject/ToggleNotificationsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public override void OnInitialized()
TNBaseSettings.Init(SettingsPath);

base.OnInitialized();
Debug.Log("SpaceWarpMetadata.ModID value: " + SpaceWarpMetadata.ModID);

Instance = this;
Logger = base.Logger;
Expand All @@ -68,12 +69,13 @@ public override void OnInitialized()
messageCenter = game.Messages;

MainUI = new ToggleNotificationsUI(this, _isGUIenabled, messageCenter);
Debug.Log("SpaceWarpMetadata.ModID value: " + SpaceWarpMetadata.ModID);

// Register Flight AppBar button
Appbar.RegisterAppButton(
"Toggle Notifications",
ToolbarFlightButtonID,
AssetManager.GetAsset<Texture2D>($"{SpaceWarpMetadata.ModID}/images/icon.png"),
AssetManager.GetAsset<Texture2D>($"{SpaceWarpMetadata.ModID}/images/icon.png"), //changed
isOpen =>
{
ToggleButton(isOpen, isOpen);
Expand Down
31 changes: 12 additions & 19 deletions Toggle NotificationsProject/toggle_notifications.csproj
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -16,7 +17,11 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
<PackageProjectUrl>https://github.com/cvusmo/Toggle-Notifications</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/cvusmo/Toggle-Notifications</RepositoryUrl>
<RepositoryUrl></RepositoryUrl>
<PackageTags>KSP2-mods</PackageTags>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Remove="assets\**" />
Expand All @@ -31,30 +36,18 @@
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" />
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
<PackageReference Include="HarmonyX" Version="2.10.1" />
<PackageReference Include="Lib.Harmony" Version="2.2.2" />
<PackageReference Include="HarmonyX" Version="2.10.2" />
<PackageReference Include="SpaceWarp" Version="1.4.*" />
</ItemGroup>
<PackageReference Include="UnityEngine.Modules" Version="2020.3.33.1" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program 2\KSP2_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Publicize>true</Publicize>
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="rm -rf &quot;$(ProjectDir)..\$(ConfigurationName)\&quot;&#xA;echo d | xcopy /y /s &quot;$(ProjectDir)..\$(ModId)\&quot; &quot;$(ProjectDir)..\$(ConfigurationName)\BepInEx\plugins\$(ModId)\&quot;&#xA;echo f | xcopy /y &quot;$(TargetPath)&quot; &quot;$(ProjectDir)..\$(ConfigurationName)\BepInEx\plugins\$(ModId)\$(ModId).dll&quot;&#xA;if $(ConfigurationName) == Debug echo f | xcopy /y &quot;$(TargetDir)$(TargetName).pdb&quot; &quot;$(ProjectDir)..\$(ConfigurationName)\BepInEx\plugins\$(ModId)\$(ModId).pdb&quot;&#xA;xcopy /y &quot;$(ProjectDir)..\LICENSE&quot; &quot;$(ProjectDir)..\$(ConfigurationName)\BepInEx\plugins\$(ModId)\&quot;&#xA;echo f | xcopy /y &quot;$(ProjectDir)..\README.md&quot; &quot;$(ProjectDir)..\$(ConfigurationName)\BepInEx\plugins\$(ModId)\README.txt&quot;" />
</Target>
</Project>
</Project>
6 changes: 2 additions & 4 deletions toggle_notifications/swinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@
"description": "Toggle Notifications on and off",
"license": "MIT",
"source": "https://github.com/cvusmo/Toggle-Notifications",
"version": "0.2.5",
"spec": "1.3",
"version": "0.3.0",
"spec": "1.3",
"version_check": "https://raw.githubusercontent.com/cvusmo/Toggle-Notifications/master/toggle_notifications/swinfo.json",
"dependencies": [
{
"id": "com.github.x606.spacewarp",
"version": {
"min": "1.1.1",
"min": "1.4.*",
"max": "*"
}
}
],
"ksp2_version": {
"min": "0.1.0",
"min": "0.1.4",
"max": "*"
}
}

0 comments on commit d982a98

Please sign in to comment.