-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from Vivero/version-3
Bug fix for missing VR hands (gloves)
- Loading branch information
Showing
25 changed files
with
481 additions
and
240 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
KerbalVR/Assets/Props/Misc/Primitives/Primitive_BOX_Beveled_Black.cfg
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,10 @@ | ||
PROP | ||
{ | ||
name = Primitive_BOX_Beveled_Black | ||
|
||
MODEL | ||
{ | ||
model = KerbalVR/Assets/Props/Misc/Primitives/Primitive_BOX_Beveled | ||
texture = Primitive_Black,KerbalVR/Assets/Props/Misc/Primitives/Primitive_Black | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
KerbalVR/Assets/Props/Misc/Primitives/Primitive_BOX_Beveled_BrushedMetal.cfg
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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,4 @@ | ||
{ | ||
"initOpenVrAtStartup": true, | ||
"swapYawRollControls": false | ||
} |
File renamed without changes
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
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
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
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
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
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,126 @@ | ||
using System; | ||
using System.IO; | ||
using UnityEngine; | ||
|
||
namespace KerbalVR | ||
{ | ||
/// <summary> | ||
/// A class to manage global configuration settings for KerbalVR. | ||
/// </summary> | ||
public class Configuration : MonoBehaviour | ||
{ | ||
#region Constants | ||
/// <summary> | ||
/// Full path to the KerbalVR configuration settings file. | ||
/// </summary> | ||
public static string KERBALVR_SETTINGS_PATH { | ||
get { | ||
string gameDataPath = Path.Combine(KSPUtil.ApplicationRootPath, "GameData"); | ||
string kvrAssetsPath = Path.Combine(gameDataPath, Globals.KERBALVR_ASSETS_DIR); | ||
return Path.Combine(kvrAssetsPath, "Settings.json"); | ||
} | ||
} | ||
#endregion | ||
|
||
|
||
#region Properties | ||
/// <summary> | ||
/// If true, initializes OpenVR as soon as KSP starts. Otherwise, OpenVR | ||
/// initializes on the first time VR is enabled. | ||
/// </summary> | ||
private bool _initOpenVrAtStartup; | ||
public bool InitOpenVrAtStartup { | ||
get { | ||
return _initOpenVrAtStartup; | ||
} | ||
set { | ||
_initOpenVrAtStartup = value; | ||
SaveSettings(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// If true, the control stick controls craft pitch and yaw, instead of | ||
/// pitch and roll. | ||
/// </summary> | ||
private bool _swapYawRollControls; | ||
public bool SwapYawRollControls { | ||
get { | ||
return _swapYawRollControls; | ||
} | ||
set { | ||
_swapYawRollControls = value; | ||
SaveSettings(); | ||
} | ||
} | ||
#endregion | ||
|
||
|
||
#region Private Members | ||
#endregion | ||
|
||
|
||
#region Singleton | ||
// this is a singleton class, and there must be one Configuration in the scene | ||
private static Configuration _instance; | ||
public static Configuration Instance { | ||
get { | ||
if (_instance == null) { | ||
_instance = FindObjectOfType<Configuration>(); | ||
if (_instance == null) { | ||
Utils.LogError("The scene needs to have one active GameObject with a Configuration script attached!"); | ||
} else { | ||
_instance.Initialize(); | ||
} | ||
} | ||
return _instance; | ||
} | ||
} | ||
#endregion | ||
|
||
// first-time initialization for this singleton class | ||
private void Initialize() { | ||
|
||
if (File.Exists(KERBALVR_SETTINGS_PATH)) { | ||
// load the settings file if it exists | ||
string kvrSettingsText = File.ReadAllText(KERBALVR_SETTINGS_PATH); | ||
Settings kvrSettings = JsonUtility.FromJson<Settings>(kvrSettingsText); | ||
|
||
// store the settings | ||
this._initOpenVrAtStartup = kvrSettings.initOpenVrAtStartup; | ||
|
||
#if DEBUG | ||
Utils.Log("Loaded Configuration:"); | ||
Utils.Log("initOpenVrAtStartup = " + kvrSettings.initOpenVrAtStartup); | ||
#endif | ||
|
||
} else { | ||
// if no settings file exists, create a default one | ||
Settings kvrSettings = new Settings(); | ||
string kvrSettingsText = JsonUtility.ToJson(kvrSettings, true); | ||
|
||
// write to file | ||
File.WriteAllText(KERBALVR_SETTINGS_PATH, kvrSettingsText); | ||
} | ||
} | ||
|
||
private void SaveSettings() { | ||
Settings kvrSettings = new Settings(); | ||
kvrSettings.initOpenVrAtStartup = this.InitOpenVrAtStartup; | ||
kvrSettings.swapYawRollControls = this.SwapYawRollControls; | ||
|
||
// write to file | ||
string kvrSettingsText = JsonUtility.ToJson(kvrSettings, true); | ||
File.WriteAllText(KERBALVR_SETTINGS_PATH, kvrSettingsText); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// A serializable class to contain KerbalVR settings. | ||
/// </summary> | ||
[Serializable] | ||
public class Settings { | ||
public bool initOpenVrAtStartup = true; | ||
public bool swapYawRollControls = false; | ||
} | ||
} |
Oops, something went wrong.