Beispiel #1
0
            private bool IsMerged()
            {
                VIUSteamVRActionFile mainFile;
                VIUSteamVRActionFile partialFile;

                if (!VIUSteamVRActionFile.TryLoad(m_mainDirPath, mainFileName, out mainFile))
                {
                    return(false);
                }
#if VIU_STEAMVR_2_1_0_OR_NEWER
                if (SteamVR_Input.actions == null || SteamVR_Input.actions.Length == 0)
                {
                    return(false);
                }
#endif
                if (!VIUSteamVRActionFile.TryLoad(m_partialDirPath, m_partialFileName, out partialFile))
                {
                    return(true);
                }

                if (m_mainFileVersion != mainFile.lastWriteTime || m_partialFileVersion != partialFile.lastWriteTime)
                {
                    m_mainFileVersion       = mainFile.lastWriteTime;
                    m_partialFileVersion    = partialFile.lastWriteTime;
                    m_lastCheckMergedResult = mainFile.IsMerged(partialFile);
                }

                return(m_lastCheckMergedResult);
            }
Beispiel #2
0
            private void Merge(bool value)
            {
                if (!value)
                {
                    return;
                }

                if (!Directory.Exists(m_mainDirPath))
                {
                    Directory.CreateDirectory(m_mainDirPath);
                }

                VIUSteamVRActionFile mainFile;
                VIUSteamVRActionFile exampleFile;
                VIUSteamVRActionFile partialFile;

                if (SteamVR_Input.actionFile != null)
                {
                    EditorWindow.GetWindow <SteamVR_Input_EditorWindow>(false, "SteamVR Input", true).Close();
                }

                if (!VIUSteamVRActionFile.TryLoad(m_partialDirPath, m_partialFileName, out partialFile))
                {
                    return;
                }

                VIUSteamVRActionFile.TryLoad(m_mainDirPath, mainFileName, out mainFile);
                VIUSteamVRActionFile.TryLoad(exampleDirPath, mainFileName, out exampleFile);

                if (exampleFile != null && (mainFile == null || !mainFile.IsMerged(exampleFile)))
                {
                    if (EditorUtility.DisplayDialog("Import SteamVR Example Inputs", "Would you also like to import SteamVR Example Input File? Click yes if you want SteamVR plugin example scene to work.", "Yes", "No"))
                    {
                        if (mainFile == null)
                        {
                            mainFile = exampleFile;
                        }
                        else
                        {
                            mainFile.Merge(exampleFile);
                        }

                        EditorPrefs.SetBool(SteamVR_CopyExampleInputFiles.steamVRInputExampleJSONCopiedKey, true);
                    }
                }

                mainFile.Merge(partialFile);
                mainFile.Save(m_mainDirPath);

                m_mainFileVersion = m_partialFileVersion = default(DateTime);

                EditorApplication.delayCall += () =>
                {
                    EditorWindow.GetWindow <SteamVR_Input_EditorWindow>(false, "SteamVR Input", true);
                    SteamVR_Input_Generator.BeginGeneration();
                };
            }
            private bool IsMerged()
            {
                VIUSteamVRActionFile mainFile;
                VIUSteamVRActionFile partialFile;

                if (!VIUSteamVRActionFile.TryLoad(m_mainDirPath, mainFileName, out mainFile))
                {
                    return(false);
                }
                if (!VIUSteamVRActionFile.TryLoad(m_partialDirPath, m_partialFileName, out partialFile))
                {
                    return(true);
                }

                if (m_mainFileVersion != mainFile.lastWriteTime || m_partialFileVersion != partialFile.lastWriteTime)
                {
                    m_mainFileVersion       = mainFile.lastWriteTime;
                    m_partialFileVersion    = partialFile.lastWriteTime;
                    m_lastCheckMergedResult = mainFile.IsMerged(partialFile);
                }

                return(m_lastCheckMergedResult);
            }