Skip to content

Commit

Permalink
Finished hooks adaptation
Browse files Browse the repository at this point in the history
  • Loading branch information
Exund committed May 25, 2018
1 parent a8a896f commit ea59d51
Show file tree
Hide file tree
Showing 20 changed files with 1,646 additions and 2,011 deletions.
38 changes: 38 additions & 0 deletions Source/Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,47 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Apple, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Imports\Apple.dll</HintPath>
</Reference>
<Reference Include="ChannelPurchase, Version=0.0.9.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Imports\ChannelPurchase.dll</HintPath>
</Reference>
<Reference Include="FacebookStore, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Imports\FacebookStore.dll</HintPath>
</Reference>
<Reference Include="Mono.Security">
<HintPath>..\Imports\Mono.Security.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\Imports\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Purchasing.Common, Version=1.0.6633.147, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Imports\Purchasing.Common.dll</HintPath>
</Reference>
<Reference Include="Security, Version=1.0.6633.149, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Imports\Security.dll</HintPath>
</Reference>
<Reference Include="Sirenix.OdinInspector.Attributes">
<HintPath>..\Imports\Sirenix.OdinInspector.Attributes.dll</HintPath>
</Reference>
<Reference Include="Sirenix.Serialization.Config">
<HintPath>..\Imports\Sirenix.Serialization.Config.dll</HintPath>
</Reference>
<Reference Include="Stores">
<HintPath>..\Imports\Stores.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Tizen, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Imports\Tizen.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\Imports\UnityEngine.dll</HintPath>
</Reference>
Expand All @@ -52,6 +86,10 @@
<Reference Include="UnityStore">
<HintPath>..\Imports\UnityStore.dll</HintPath>
</Reference>
<Reference Include="winrt, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Imports\winrt.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<AppDesigner Include="Properties\" />
Expand Down
54 changes: 25 additions & 29 deletions Source/NewBuildSystem/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public float maxZoom
{
get
{
return (!Ref.hasPartsExpansion && !Ref.hasHackedExpansion) ? this.maxZoomBasic : this.maxZoomFull;
return (!Ref.hasPartsExpansion) ? this.maxZoomBasic : this.maxZoomFull;
}
}

Expand All @@ -25,36 +25,32 @@ private void Awake()
Build.main = this;
}

private void Start()
{
this.PositionCameraStart();
Ref.partShader.SetFloat("_Intensity", 1.35f);
if (Ref.lastScene == Ref.SceneType.Game && GameSaving.GameSave.LoadPersistant().mainVesselId != -1)
{
this.exitButton.text = "Resume";
}
this.pickGrid.LoadIcons();
this.buildGrid.LoadAllIcons();
this.pickGrid.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(0f, (float)Screen.height, this.pickMenuDistance)) + (Vector3)this.pickMenuPosition;
bool loadLaunchedRocket = Ref.loadLaunchedRocket;
if (loadLaunchedRocket)
{
Ref.loadLaunchedRocket = false;
this.LoadSave(JsonUtility.FromJson<Build.BuildSave>(Ref.LoadJsonString(Saving.SaveKey.ToLaunch)));
}
this.descriptionMoveModule.SetTargetTime((float)((!Saving.LoadSetting(Saving.SettingKey.hidePartDescription)) ? 1 : 0));
this.descriptionMoveModule.SetTime((float)((!Saving.LoadSetting(Saving.SettingKey.hidePartDescription)) ? 1 : 0));
bool flag2 = !Saving.LoadSetting(Saving.SettingKey.seenBuildInstructions);
if (flag2)
{
this.dragAndDropInstruction.gameObject.SetActive(true);
Saving.SaveSetting(Saving.SettingKey.seenBuildInstructions, true);
}
}
private void Start()
{
this.PositionCameraStart();
Ref.partShader.SetFloat("_Intensity", 1.35f);
if (Ref.lastScene == Ref.SceneType.Game && GameSaving.GameSave.LoadPersistant().mainVesselId != -1)
{
this.exitButton.text = "Resume";
}
this.pickGrid.LoadIcons();
this.buildGrid.LoadAllIcons();
this.pickGrid.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(0f, (float)Screen.height, this.pickMenuDistance)) + (Vector3)this.pickMenuPosition;
if (Ref.loadLaunchedRocket)
{
Ref.loadLaunchedRocket = false;
this.LoadSave(JsonUtility.FromJson<Build.BuildSave>(Ref.LoadJsonString(Saving.SaveKey.ToLaunch)));
}
if (!Saving.LoadSetting(Saving.SettingKey.seenBuildInstructions))
{
this.dragAndDropInstruction.gameObject.SetActive(true);
Saving.SaveSetting(Saving.SettingKey.seenBuildInstructions, true);
}
}

public void PositionCameraStart()
public void PositionCameraStart()
{
Ref.cam.transform.position = ((!Ref.hasPartsExpansion && !Ref.hasHackedExpansion) ? this.camPosBasic : this.camPosExtended);
Ref.cam.transform.position = ((!Ref.hasPartsExpansion) ? this.camPosBasic : this.camPosExtended);
}

private void LateUpdate()
Expand Down
20 changes: 10 additions & 10 deletions Source/Ref.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,16 @@ public static CelestialBodyData GetPlanetByName(string adress)
}

public static float GetSizeOfWord(TextMesh text, string word)
{
float num = 0f;
foreach (char ch in word)
{
CharacterInfo characterInfo;
text.font.GetCharacterInfo(ch, out characterInfo, text.fontSize);
num += (float)characterInfo.advance;
}
return num;
}
{
float num = 0f;
foreach (char ch in word)
{
CharacterInfo characterInfo;
text.font.GetCharacterInfo(ch, out characterInfo, text.fontSize);
num += (float)characterInfo.advance;
}
return num;
}

[BoxGroup("All Scenes", true, false, 0)]
[Space]
Expand Down
42 changes: 34 additions & 8 deletions Source/Resource.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
using System;
using UnityEngine;

public class Resource : MonoBehaviour
public class Resource
{
public Resource()
{
}
public static string GetResourceName(Resource.Type resourceType)
{
return (new string[]
{
"Fuel",
"Solid Fuel",
"Electric Power"
})[(int)resourceType];
}

public string resourceName;
public static string GetResourceUnit(Resource.Type resourceType)
{
return (new string[]
{
"t",
"t",
string.Empty
})[(int)resourceType];
}

public float resourceMass;
public static bool GrupsGlobally(Resource.Type resourceType)
{
return (new bool[]
{
default(bool),
default(bool),
true
})[(int)resourceType];
}

public string resourceUnit;
public enum Type
{
Fuel,
SolidFuel,
Power
}
}
3 changes: 2 additions & 1 deletion Source/ResourceGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
using SFSML.HookSystem.ReWork.BaseHooks.PartHooks;

public class ResourceGroup : MonoBehaviour
{
Expand Down Expand Up @@ -71,7 +72,7 @@ private void GetConnectedResourceModules(ResourceModule start)

public void TakeResource(double amount)
{
if (this.resourceAmount > amount)
if (this.resourceAmount > amount)
{
this.resourceAmount -= amount;
}
Expand Down

0 comments on commit ea59d51

Please sign in to comment.