Beispiel #1
0
        public static void AddMissingInputsToPoject()
        {
#if UNITY_EDITOR
            if (AreInputFixed)
            {
                return;
            }

            // Set that the inputs has been fixed (Multiple input managers can cause problems)
            AreInputFixed = true;

            // Find the actual assets folder on the machine
            PathToAssetsFolder = Gaze_InputFileManager.GetAssetsFolderPath();

            // Get the actual Input Manager.
            ActualInputManagerPath = Gaze_InputFileManager.GetActualInputManagerPath();

            // Get the folder with our input manager.
            SpatialStoriesInputMannagerPath = Gaze_InputFileManager.GetSpatialStoriesSDKInputManager();

            if (SpatialStoriesInputMannagerPath == null)
            {
                UnityEngine.Debug.LogError("Could not " + Gaze_InputConfigConstants.SSDK_INPUT_MANAGER + " file import the project again and import it.");
                return;
            }

            // Get the user's current input
            SerializationMode       actualSerializationMode = Gaze_InputParser.IsInBinaryFormat(ActualInputManagerPath) ? SerializationMode.ForceBinary : SerializationMode.ForceText;
            List <Gaze_InputConfig> actualInputConfig       = GetActualInputConfig(actualSerializationMode);

            // Get SSDK inputs
            List <Gaze_InputConfig> spatialStoriesInputs = Gaze_InputParser.ParseInputFile(SpatialStoriesInputMannagerPath);

            // Compare what inputs are missing
            List <Gaze_InputConfig> missingInputs = FindMissingInputsFromTo(actualInputConfig, spatialStoriesInputs);

            // Combine input lists
            List <Gaze_InputConfig> newInputConfig = new List <Gaze_InputConfig>();
            newInputConfig.AddRange(actualInputConfig);
            newInputConfig.AddRange(missingInputs);

            // Create the new input file
            string backupFile = Gaze_InputFileWritter.WriteFile(newInputConfig, ActualInputManagerPath, true);

            EditorUtility.DisplayDialog("Spatial Stories SDK", "Inputs Fixed," + Environment.NewLine + Environment.NewLine + "(A new input manager file has been added to the project. After clicking “OK” the location of the old input manager will appear in case you want to recover it)", "Ok");
            ShowExplorer(backupFile);
#endif
        }
Beispiel #2
0
 public static List <Gaze_InputConfig> GetActualInputConfig(SerializationMode _serializationMode)
 {
     return(_serializationMode == SerializationMode.ForceText ?
            Gaze_InputParser.ParseInputFile(ActualInputManagerPath) :
            Gaze_InputParser.ReadBinaryInputs(ActualInputManagerPath));
 }