string GetPluginPath() { string pluginId = this.storeId.Split('_')[0]; MVRPluginManager manager = containingAtom.GetStorableByID("PluginManager") as MVRPluginManager; string pathToScriptFile = manager.GetJSON(true, true)["plugins"][pluginId].Value; string pathToScriptFolder = pathToScriptFile.Substring(0, pathToScriptFile.LastIndexOfAny(new char[] { '/', '\\' })); return(pathToScriptFile); }
public void CheckPluginsHaveChanged() { _lastAtomPluginInfoTimer += Time.deltaTime; if (SuperController.singleton.isLoading) { // Don't loop through scene information looking for changes if it is in the process of loading. return; } // only poll for plugin changes once every 3 seconds for performance if (_lastAtomPluginInfoTimer < 3.0f) { return; } else { _lastAtomPluginInfoTimer = 0.0f; } var atomPluginInfo = new Dictionary <string, string>(); foreach (var atom in SuperController.singleton.GetAtoms()) { MVRPluginManager manager = atom.GetComponentInChildren <MVRPluginManager>(); if (manager != null) { var atomUid = atom.uid; var pluginInfo = manager.GetJSON(true, true).ToString(); atomPluginInfo[atomUid] = pluginInfo; } } if (_lastAtomPluginInfo != null) { // calculate which atom names have plugin changes var changedAtomUids = atomPluginInfo.Except(_lastAtomPluginInfo) .Concat(_lastAtomPluginInfo.Except(atomPluginInfo)) .Select((kvp) => kvp.Key) .Distinct(); if (changedAtomUids.Count() > 0) { Initialize(); } } _lastAtomPluginInfo = atomPluginInfo; }
public static IEnumerable <JSONStorable> GetPluginStorables(this Atom atom) { MVRPluginManager manager = atom.GetComponentInChildren <MVRPluginManager>(); if (manager != null) { var plugins = manager.GetJSON(true, true)["plugins"].AsObject; foreach (var pluginId in plugins.Keys) { var receivers = atom .GetStorableIDs() .Where((sid) => sid.StartsWith(pluginId)) .Select((sid) => atom.GetStorableByID(sid)); foreach (var r in receivers) { yield return(r); } } } }