Skip to content

Commit

Permalink
Updated modloader to 1.0.0.R2
Browse files Browse the repository at this point in the history
  • Loading branch information
JMteam09 committed Mar 10, 2018
1 parent dc9593b commit 5dfa04c
Show file tree
Hide file tree
Showing 31 changed files with 1,114 additions and 93 deletions.
Binary file added Builds/Managed/1.0.0.R2/Assembly-CSharp.dll
Binary file not shown.
126 changes: 126 additions & 0 deletions Source/Assembly-CSharp.csproj
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{9AE3EB35-37E3-4DF8-B859-C0B29D6851C6}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<AssemblyName>Assembly-CSharp</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="UnityEngine">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.UIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.AudioModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Physics2DModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.Physics2DModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ParticleSystemModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.ParticleSystemModule.dll</HintPath>
</Reference>
<Reference Include="Sirenix.OdinInspector.Attributes">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\Sirenix.OdinInspector.Attributes.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.JSONSerializeModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.JSONSerializeModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ScreenCaptureModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.ScreenCaptureModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.GameCenterModule">
<HintPath>..\Spaceflight Simulator Pc v1.2\spaceflight simulator pc 1.2_data\Managed\UnityEngine.GameCenterModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Blur.cs" />
<Compile Include="BoolValueHolder.cs" />
<Compile Include="CelestialBodyData.cs" />
<Compile Include="Controller.cs" />
<Compile Include="ControlModule.cs" />
<Compile Include="CreateRocket.cs" />
<Compile Include="CustomEvent.cs" />
<Compile Include="Double3.cs" />
<Compile Include="Ellipse.cs" />
<Compile Include="EngineModule.cs" />
<Compile Include="FloatValueHolder.cs" />
<Compile Include="GameEvent.cs" />
<Compile Include="GameEventListener.cs" />
<Compile Include="GameSaving.cs" />
<Compile Include="GPGSIds.cs" />
<Compile Include="HeightMap.cs" />
<Compile Include="InputController.cs" />
<Compile Include="Kepler.cs" />
<Compile Include="LandingLegModule.cs" />
<Compile Include="LinkModule.cs" />
<Compile Include="MainMenu.cs" />
<Compile Include="Map.cs" />
<Compile Include="Module.cs" />
<Compile Include="MoveModule.cs" />
<Compile Include="NewBuildSystem\Build.cs" />
<Compile Include="NewBuildSystem\Orientation.cs" />
<Compile Include="NewBuildSystem\PartData.cs" />
<Compile Include="NewBuildSystem\PartGrid.cs" />
<Compile Include="NewBuildSystem\PickPartGrid.cs" />
<Compile Include="NewBuildSystem\PlacedPart.cs" />
<Compile Include="NewBuildSystem\Utility.cs" />
<Compile Include="Orbit.cs" />
<Compile Include="ParachuteModule.cs" />
<Compile Include="Part.cs" />
<Compile Include="PartChildCollider.cs" />
<Compile Include="PartDatabase.cs" />
<Compile Include="PartsManager.cs" />
<Compile Include="PlanetManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Ref.cs" />
<Compile Include="ReorderableList.cs" />
<Compile Include="Resource.cs" />
<Compile Include="ResourceModule.cs" />
<Compile Include="Saving.cs" />
<Compile Include="SeparatorModule.cs" />
<Compile Include="SimpleReorderableList.cs" />
<Compile Include="SortingLayerExposer.cs" />
<Compile Include="Soundtrack.cs" />
<Compile Include="TextData.cs" />
<Compile Include="TipsData.cs" />
<Compile Include="TorqueModule.cs" />
<Compile Include="Touch.cs" />
<Compile Include="ValuesModule.cs" />
<Compile Include="Vessel.cs" />
<Compile Include="Warning.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
25 changes: 25 additions & 0 deletions Source/Assembly-CSharp.sln
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{9AE3EB35-37E3-4DF8-B859-C0B29D6851C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9AE3EB35-37E3-4DF8-B859-C0B29D6851C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AE3EB35-37E3-4DF8-B859-C0B29D6851C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AE3EB35-37E3-4DF8-B859-C0B29D6851C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AE3EB35-37E3-4DF8-B859-C0B29D6851C6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3A3D0368-D060-40E0-81F0-36EC8D1C5B60}
EndGlobalSection
EndGlobal
68 changes: 34 additions & 34 deletions Source/Blur.cs
Expand Up @@ -5,40 +5,40 @@

public class Blur : MonoBehaviour
{
public Texture2D shade;
public Texture2D shade;

public Texture2D blur;
public Texture2D blur;

public float blurStreght;
public float blurStreght;

[Button("Generate Shade Texture", ButtonSizes.Small)]
public void Generate()
{
Texture2D texture2D = new Texture2D(this.shade.width, this.shade.height, TextureFormat.Alpha8, false);
MonoBehaviour.print(texture2D.width + " " + texture2D.height);
texture2D.filterMode = FilterMode.Point;
for (int i = 0; i < this.shade.width; i++)
{
for (int j = 0; j < this.shade.height; j++)
{
if (this.blur.GetPixel(i, j).a > 0f)
{
int num = (int)(this.blur.GetPixel(i, j).a * 12f);
float num2 = 0f;
for (int k = 0; k < num * 2 + 1; k++)
{
num2 += this.shade.GetPixel(Mathf.Clamp(i - num + k, 0, this.shade.width), j).a;
}
num2 = Mathf.Lerp(this.shade.GetPixel(i, j).a, num2 / (float)(num * 2 + 1), this.blurStreght);
texture2D.SetPixel(i, j, new Color(1f, 1f, 1f, num2));
}
else
{
texture2D.SetPixel(i, j, this.shade.GetPixel(i, j));
}
}
}
texture2D.Apply();
File.WriteAllBytes(Application.dataPath + "/Textures/Combined.png", texture2D.EncodeToPNG());
}
}
[Button("Generate Shade Texture", ButtonSizes.Small)]
public void Generate()
{
Texture2D texture2D = new Texture2D(this.shade.width, this.shade.height, TextureFormat.Alpha8, false);
MonoBehaviour.print(texture2D.width + " " + texture2D.height);
texture2D.filterMode = FilterMode.Point;
for (int i = 0; i < this.shade.width; i++)
{
for (int j = 0; j < this.shade.height; j++)
{
if (this.blur.GetPixel(i, j).a > 0f)
{
int num = (int)(this.blur.GetPixel(i, j).a * 12f);
float num2 = 0f;
for (int k = 0; k < num * 2 + 1; k++)
{
num2 += this.shade.GetPixel(Mathf.Clamp(i - num + k, 0, this.shade.width), j).a;
}
num2 = Mathf.Lerp(this.shade.GetPixel(i, j).a, num2 / (float)(num * 2 + 1), this.blurStreght);
texture2D.SetPixel(i, j, new Color(1f, 1f, 1f, num2));
}
else
{
texture2D.SetPixel(i, j, this.shade.GetPixel(i, j));
}
}
}
texture2D.Apply();
File.WriteAllBytes(Application.dataPath + "/Textures/Combined.png", texture2D.EncodeToPNG());
}
}
29 changes: 16 additions & 13 deletions Source/NewBuildSystem/Build.cs
@@ -1,7 +1,7 @@
using SFSML;
using SFSML.GameManager.Hooks.BuildRelated;
using SFSML.GameManager.Hooks.FrameRelated;
using SFSML.GameManager.Hooks.UnityRelated;
using SFSML.HookSystem.ReWork;
using SFSML.HookSystem.ReWork.BaseHooks;
using SFSML.HookSystem.ReWork.BaseHooks.BuildHooks;
using Sirenix.OdinInspector;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -238,7 +238,6 @@ private void Start()
this.dragAndDropInstruction.gameObject.SetActive(true);
Saving.SaveSetting(Saving.SettingKey.seenBuildInstructions, true);
}
ModLoader.manager.castHook<MyBuildMenuStartedHook>(new MyBuildMenuStartedHook());
}

public void MoveCamera(Vector3 delta)
Expand Down Expand Up @@ -288,7 +287,11 @@ public void OnTouchStay(int fingerId, Vector2 touchPosWorld, Vector2 deltaPixel)
Vector2 autoCorrect = this.GetAutoCorrect(vector, fingerId);
if (this.holdingParts[fingerId].part.partIcon != null)
{
this.holdingParts[fingerId].part.partIcon.position = Vector3.Lerp(vector, autoCorrect, 1f - this.roundStrength);
PlacedPart tgtPart = this.holdingParts[fingerId].part;
Vector3 tgtPos = Vector3.Lerp(vector, autoCorrect, 1f - this.roundStrength);
MyPartStartDragHook hook = new MyPartStartDragHook(tgtPart, tgtPos);
if (hook.isCanceled()) { return; }
this.holdingParts[fingerId].part.partIcon.position = hook.pos;
}
}

Expand All @@ -306,8 +309,12 @@ public void OnTouchEnd(int fingerId, Vector2 touchPosWorld)
bool flag2 = this.pickGrid.IsInsideDropArea(Utility.ToDepth(v, this.pickMenuDistance));
if (flag && !flag2)
{
this.dragAndDropInstruction.InvokeEvenets();
this.buildGrid.PlacePart(new PlacedPart(null, (Vector3)autoCorrect - this.buildGrid.transform.position, this.holdingParts[fingerId].part.orientation.DeepCopy(), this.holdingParts[fingerId].part.partData));
PlacedPart newPart = new PlacedPart(null, (Vector3)autoCorrect - this.buildGrid.transform.position, this.holdingParts[fingerId].part.orientation.DeepCopy(), this.holdingParts[fingerId].part.partData);
MyPartCreatedHook hook = new MyPartCreatedHook(newPart);
hook = MyHookSystem.executeHook<MyPartCreatedHook>(hook);
if (hook.isCanceled()) { return; }
this.dragAndDropInstruction.InvokeEvenets();
this.buildGrid.PlacePart(hook.target);
}
if (this.holdingParts[fingerId].part.partIcon != null)
{
Expand Down Expand Up @@ -507,8 +514,8 @@ private void TryLaunch()

private void GoForLaunch()
{
MyRocketLaunchHook result = ModLoader.manager.castHook<MyRocketLaunchHook>(new MyRocketLaunchHook(this.buildGrid.parts));
if (result.isCanceled()) return;
MyRocketToLaunchpadHook res = MyHookSystem.executeHook<MyRocketToLaunchpadHook>(new MyRocketToLaunchpadHook());
if (res.isCanceled()) return;
string jsonString = JsonUtility.ToJson(new Build.BuildSave("To Launch", Ref.cam.transform.position, this.buildGrid.parts));
Ref.SaveJsonString(jsonString, Saving.SaveKey.ToLaunch);
Ref.LoadScene(Ref.SceneType.Game);
Expand All @@ -535,9 +542,5 @@ public void EnableDescription()
{
}

public void OnGUI()
{
ModLoader.manager.castHook<MyBuildMenuOnGuiHook>(new MyBuildMenuOnGuiHook());
}
}
}
9 changes: 5 additions & 4 deletions Source/Part.cs
@@ -1,6 +1,7 @@
using NewBuildSystem;
using SFSML;
using SFSML.GameManager.Hooks.PartRelated;
using SFSML.HookSystem.ReWork;
using SFSML.HookSystem.ReWork.BaseHooks.PartHooks;
using Sirenix.OdinInspector;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -198,7 +199,7 @@ public void UsePart()
{
try
{
MyOnUseHook result = ModLoader.manager.castHook<MyOnUseHook>(new MyOnUseHook(this));
MyPartUsedHook result = MyHookSystem.executeHook<MyPartUsedHook>(new MyPartUsedHook(this));
if (result.isCanceled()) { return; }
}
catch (Exception e)
Expand Down Expand Up @@ -230,8 +231,8 @@ public void Collision(Collision2D collision)

public void DestroyPart(bool createExplosion, bool disablePartToPartDamage)
{
MyBeforeDestroyHook hook = new MyBeforeDestroyHook(this);
hook = ModLoader.manager.castHook<MyBeforeDestroyHook>(hook);
MyPartUsedHook hook = new MyPartUsedHook(this);
hook = MyHookSystem.executeHook<MyPartUsedHook>(hook);
if (hook.isCanceled()) return;
while (this.joints.Count > 0)
{
Expand Down
14 changes: 7 additions & 7 deletions Source/Ref.cs
Expand Up @@ -9,8 +9,9 @@
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
using SFSML.GameManager.Hooks.UnityRelated;
using SFSML.GameManager.Hooks.FrameRelated;
using SFSML.HookSystem.ReWork;
using SFSML.HookSystem.ReWork.BaseHooks;
using SFSML.HookSystem.ReWork.BaseHooks.FrameHooks;

public class Ref : MonoBehaviour
{
Expand Down Expand Up @@ -230,13 +231,13 @@ private Double3 VelocityOffset

public static void LoadScene(Ref.SceneType sceneToLoad)
{
MySceneChangeHook res = ModLoader.manager.castHook<MySceneChangeHook>(new MySceneChangeHook(Ref.lastScene, sceneToLoad));
MySceneChangeHook res = MyHookSystem.executeHook<MySceneChangeHook>(new MySceneChangeHook(Ref.lastScene, sceneToLoad));
if (res.isCanceled()) return;
sceneToLoad = res.targetScene;
sceneToLoad = res.newScene;
Ref.SceneType oldScene = Ref.lastScene;
Ref.lastScene = Ref.currentScene;
SceneManager.LoadScene(sceneToLoad.ToString(), LoadSceneMode.Single);
ModLoader.manager.castHook<MySceneChangedHook>(new MySceneChangedHook(oldScene, sceneToLoad));
MyHookSystem.executeHook<MySceneChangedHook>(new MySceneChangedHook(oldScene, sceneToLoad));
}

public static int GetFigure(double value)
Expand Down Expand Up @@ -379,8 +380,7 @@ public static CelestialBodyData GetPlanetByName(string adress)

private void OnGUI()
{
if (ModLoader.manager != null)
ModLoader.manager.castHook<MyGeneralOnGuiHook>(new MyGeneralOnGuiHook(this.CurrentScene));
MyHookSystem.executeHook<MyOnGuiHook>(new MyOnGuiHook(Ref.currentScene));
}

public static float GetSizeOfWord(TextMesh text, string word)
Expand Down
17 changes: 6 additions & 11 deletions Source/ResourceModule.cs
@@ -1,5 +1,6 @@
using SFSML;
using SFSML.GameManager.Hooks.ModuleRelated;
using SFSML.HookSystem.ReWork;
using SFSML.HookSystem.ReWork.BaseHooks.PartHooks;
using Sirenix.OdinInspector;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -91,16 +92,10 @@ public Grup(ResourceModule start)

public void TakeResource(float removeAmount)
{
MyResourceOnTakeHook hook = new MyResourceOnTakeHook(this, removeAmount);
try
{
hook = ModLoader.manager.castHook<MyResourceOnTakeHook>(hook);
if (hook.isCanceled()) return;
} catch (Exception e)
{
ModLoader.mainConsole.logError(e);
}
this.resourceAmount = Mathf.Max(this.resourceAmount - hook.amount, 0f);
float newAmount = this.resourceAmount - removeAmount;
MyDrainResourceHook hook = new MyDrainResourceHook(removeAmount, newAmount, this);
hook = MyHookSystem.executeHook<MyDrainResourceHook>(hook);
this.resourceAmount = Mathf.Max(this.resourceAmount - hook.amountToTake, 0f);
this.SetTanks();
}

Expand Down

0 comments on commit 5dfa04c

Please sign in to comment.