Exemplo n.º 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
        }
Exemplo n.º 2
0
        public static void ShowInputNotCorrectlyConfiguredDialog()
        {
#if UNITY_EDITOR
            PathToAssetsFolder = Gaze_InputFileManager.GetAssetsFolderPath();
            string path = Gaze_InputFileManager.GetActualInputManagerPath();

            if (EditorUtility.DisplayDialog("Missing Inputs", "It seems that you don't have the Spatial Stories SDK input manager correctly configured", "Solve It Automatically", "Add them by hand"))
            {
                AddMissingInputsToPoject();
            }
            else
            {
                if (EditorUtility.DisplayDialog("Missing Inputs", "Replace the InputManager.asset file with our own (can be downloaded on www.spatialstories.net).", "Show me the file to replace", "Ok"))
                {
                    ShowExplorer(path);
                }
            }
            EditorApplication.ExecuteMenuItem("Edit/Play");
#endif
        }