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); } }