Beispiel #1
0
        public override void Initialize()
        {
            _serviceIDs = TBDataManager.DeserializeFromFile <OculusServiceIDs>(TBSettings.settingsFolder + TBOculusService.serviceFilename, TBDataManager.PathType.ResourcesFolder);

            switch (TBCore.GetActivePlatform())
            {
            case VRPlatform.OculusMobile:
                switch (TButt.Settings.TBOculusSettings.GetOculusDeviceFamily())
                {
                case Settings.TBOculusSettings.OculusDeviceFamily.GearVR:
                case Settings.TBOculusSettings.OculusDeviceFamily.Go:
                    Core.AsyncInitialize(_serviceIDs.oculusMobile_ID).OnComplete((Message msg) => ContinueSetup(msg));
                    break;

                default:
                    Core.AsyncInitialize(_serviceIDs.oculusQuest_ID).OnComplete((Message msg) => ContinueSetup(msg));;
                    break;
                }
                break;

            case VRPlatform.OculusPC:
                Core.AsyncInitialize(_serviceIDs.oculusPC_ID).OnComplete((Message msg) => ContinueSetup(msg));
                break;

            default:
                Debug.LogError("Attempted to initialize Oculus Platform service while running on a non-Oculus platform. This shouldn't happen and will probably cause you to be sad.");
                break;
            }
        }
Beispiel #2
0
        static void ReadSettings()
        {
            editorSDKs = GetEditorSDKs();

            if (File.Exists(TBEditorDefines.settingsPath + TBSettings.settingsFolder + TBSettings.cameraSettingsFilename + ".json"))
            {
                camSettings = TBDataManager.DeserializeFromFile <TBSettings.TBCameraSettings>(TBSettings.settingsFolder + TBSettings.cameraSettingsFilename, TBDataManager.PathType.ResourcesFolder);
            }
        }
Beispiel #3
0
        static void ReadSettings()
        {
            if (!Directory.Exists(settingsPath + TBSettings.settingsFolder))
            {
                Directory.CreateDirectory(settingsPath + TBSettings.settingsFolder);
            }

            savedControlSettings = TBDataManager.DeserializeFromFile <TBSettings.TBControlSettings>(settingsPath + TBSettings.settingsFolder + TBSettings.controlSettingsFileName + ".json", TBDataManager.PathType.ProjectFolder);
            controlSettings      = savedControlSettings;
        }
Beispiel #4
0
        static TBEditorServiceDefines.Services GetServices()
        {
            FileInfo info = new FileInfo("TButtEditorServices.json");

            if (info.Exists)
            {
                return(TBDataManager.DeserializeFromFile <TBEditorServiceDefines.Services>("TButtEditorServices.json", TBDataManager.PathType.ProjectFolder));
            }
            else
            {
                return(new TBEditorServiceDefines.Services());
            }
        }
Beispiel #5
0
        public static SDKs GetEditorSDKs()
        {
            FileInfo info = new FileInfo("TButtEditorSDKs.json");

            if (info.Exists)
            {
                return(TBDataManager.DeserializeFromFile <SDKs>("TButtEditorSDKs.json", TBDataManager.PathType.ProjectFolder));
            }
            else
            {
                return(new SDKs());
            }
        }
Beispiel #6
0
        public static TBSettings.TBDisplaySettings LoadDisplaySettings(string filename)
        {
            TBSettings.TBDisplaySettings settings = TBDataManager.DeserializeFromFile <TBSettings.TBDisplaySettings>(TBSettings.settingsFolder + filename, TBDataManager.PathType.ResourcesFolder);

            if (settings.initialized)
            {
                return(settings);
            }
            else
            {
                TBLogging.LogMessage("No settings were found for Windows Mixed Reality. Loading default settings.");
                return(GetDefaultDisplaySettings(settings));
            }
        }
 public override void Initialize()
 {
     gameIDInt = TBDataManager.DeserializeFromFile <int>(TBSettings.settingsFolder + TBSteamService.serviceFilename, TBDataManager.PathType.ResourcesFolder);
     TBCore.instance.gameObject.AddComponent <SteamManager>();
     StartCoroutine(WaitForSteamworksInitialization());
 }
 protected override void LoadSettings()
 {
     _oculusIDs      = TBDataManager.DeserializeFromFile <OculusServiceIDs>(TBSettings.settingsFolder + TBOculusService.serviceFilename, TBDataManager.PathType.ResourcesFolder);
     _loadedSettings = true;
 }
Beispiel #9
0
        public static void CheckoutAndSaveJSONFile(string fileName, object obj, TBDataManager.PathType pathType = TBDataManager.PathType.PersistentDataPath, bool skipVersioning = false, bool isString = false)
        {
            bool addToVersionControl = false;

            if (Provider.isActive)               // Is version control enabled in the project?
            {
                if (Provider.hasCheckoutSupport) // Does the project's version control settings support auto-checkout?
                {
                    Asset targetAsset = Provider.GetAssetByPath(fileName);
                    if (targetAsset != null)                      // Does the thing we want to checkout exist?
                    {
                        if (!Provider.IsOpenForEdit(targetAsset)) // Is it already checked out?
                        {
                            Task checkoutTask = Provider.Checkout(targetAsset, CheckoutMode.Both);
                            checkoutTask.Wait();    // Wait for checkout to finish
                        }
                    }
                    else
                    {
                        addToVersionControl = true;
                    }
                }
            }

            if (!Directory.Exists("Assets/Resources/"))
            {
                Directory.CreateDirectory("Assets/Resources/");
            }

            if (!Directory.Exists("Assets/Resources/" + TBSettings.settingsFolder))
            {
                Directory.CreateDirectory("Assets/Resources/" + TBSettings.settingsFolder);
            }

            if (!isString)
            {
                TBDataManager.SerializeObjectToFile(obj, fileName, pathType);   // Save the file
            }
            else
            {
                TBDataManager.WriteStringToFile((string)obj, fileName, pathType);
            }

            AssetDatabase.Refresh();

            if (skipVersioning)
            {
                return;
            }

            if (addToVersionControl)
            {
                Asset asset = Provider.GetAssetByPath(fileName);
                if (asset == null)
                {
                    TBLogging.LogWarning("A new file was created but could not be automatically added to version control: " + fileName);
                    return;
                }
                if (Provider.AddIsValid(new AssetList()
                {
                    asset
                }))
                {
                    Task addTask = Provider.Add(asset, false);
                    addTask.Wait();
                }
                else
                {
                    TBLogging.LogWarning("A new file was created but could not be automatically added to version control: " + fileName);
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// Saves button settings to JSON.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="maps"></param>
        public static void SaveButtonMaps <T>(ButtonMapGroup <TBInput.ButtonDef <T> > maps)
        {
            TBLogging.LogMessage("Writing maps for " + maps.controllerName + " to " + settingsPath + TBSettings.settingsFolder + maps.fileName + ".json...", null, messageEnd);
            TBInput.SerializedButtonDef[] controllerDef = new TBInput.SerializedButtonDef[maps.defs.Count];
            for (int i = 0; i < maps.defs.Count; i++)
            {
                controllerDef[i] = new TBInput.SerializedButtonDef();
                controllerDef[i].virtualButtons = maps.defs[i].virtualButtons;
            }
            //string json = TBDataManager.ToJson<TBInput.SerializedButtonDef>(controllerDef);
            //TBDataManager.SerializeObjectToFile(TBDataManager.ToJsonWrapper<TBInput.SerializedButtonDef>(controllerDef), settingsPath + TBSettings.settingsFolder + maps.fileName + ".json", TBDataManager.PathType.ResourcesFolder);

            TBEditorHelper.CheckoutAndSaveJSONFile(settingsPath + TBSettings.settingsFolder + maps.fileName + ".json", TBDataManager.ToJsonWrapper <TBInput.SerializedButtonDef>(controllerDef), TBDataManager.PathType.ResourcesFolder);
            TBLogging.LogMessage("Finished writing maps for " + maps.controllerName + ". ", null, messageEnd);
        }
Beispiel #11
0
 protected override void LoadSettings()
 {
     _steamID        = TBDataManager.DeserializeFromFile <int>(TBSettings.settingsFolder + TBSteamService.serviceFilename, TBDataManager.PathType.ResourcesFolder);
     _loadedSettings = true;
 }