public bool TrySafeRegisterApp(ROSApp app) { if (app.IsDialogue()) { if (dialogues.ContainsValue(app)) { return(false); } dialogues.Add(app.GetType(), app); app.AppInit(); Debug.Log("Dialogue registered: " + app); return(true); } else { if (apps.ContainsValue(app)) { return(false); } apps.Add(app.GetType(), app); app.AppInit(); Debug.Log("App registered: " + app); return(true); } }
public ROSApp ShowApp(ROSApp app) { if (app.IsSingleton()) { if (openSingletonApps.ContainsKey(app.GetType())) { ROSApp singletonApp = openSingletonApps[app.GetType()]; singletonApp.Open(); return(singletonApp); } else { // move to display area (to make sure we don't duplicate app.transform.SetParent(appDisplayArea, true); app.Open(); openSingletonApps.Add(app.GetType(), app); return(app); } } // duplicate gameobject and put under working area GameObject appObj = Instantiate(app.gameObject, appDisplayArea); ROSApp newApp = appObj.GetComponent <ROSApp>(); newApp.Open(); return(newApp); }
/// <summary> /// Called from ROSApp no matter how the app is closed /// </summary> /// <param name="app"></param> public void AppClosed(ROSApp app) { if (app.IsSingleton() && openSingletonApps.ContainsKey(app.GetType())) { openSingletonApps.Remove(app.GetType()); app.transform.SetParent(appBuildArea, true); } }