protected override void OnPropertiesSet() { NetworkManager.singleton.StopHost(); foreach (var entry in guideProfileListContainer.GetComponentsInChildren <GuideProfileListEntry>()) { Destroy(entry.gameObject); } foreach (var tour in TourHelpers.LoadTours()) { var newEntry = Instantiate(guideProfileListEntryPrefab); newEntry.transform.SetParent(guideProfileListContainer.transform, false); newEntry.transform.SetAsFirstSibling(); // it is important to set as first sibling because of unity ui restrictions // ie having dynamically sized children of a layout group is very buggy if working at all // and we want a new profile button as last entry newEntry.SetName(tour.profileName); newEntry.startWithProfileButton.onClick.AddListener(() => StartTour(tour)); newEntry.editProfileButton.onClick.AddListener(() => EditProfile(tour)); newEntry.deleteProfileButton.onClick.AddListener(() => DeleteProfile(tour, newEntry)); } }
public void CreateNewTour() { var newTour = TourHelpers.NewTour(); newTour.profileName = "Your Name"; App.uiFrame.OpenWindow(ScreenList.profileNameWindow, new ProfileNameWindowControllerProperties(newTour)); }
void Connect(long serverId) { var info = discoveredServers[serverId]; App.activeTour = TourHelpers.NewTour(); // important to do this before StartClient, as StartClient synchronises state with server! (NetworkManager.singleton as CustomNetworkManager).SetUri(info.uri); // hack, as NetworkManager does not save whole uri which we need to reconnect NetworkManager.singleton.StartClient(info.uri); StartCoroutine(WaitForConnection()); }
public ActionResult Index() { ViewBag.promotion = TourHelpers.GetListRecentTourPromotions(); ViewBag.tourtypetrongnuoc = TourHelpers.GetListRecentTourbyType(0);//0 là trong nước 1 là quốc tế 2 là tour gia đình ViewBag.tourtypequocte = TourHelpers.GetListRecentTourbyType(1); ViewBag.tourtypegiadinh = TourHelpers.GetListRecentTourbyType(2); ViewBag.placepout = PlaceHelpers.Getplacepopular(); ViewBag.placetop = PlaceHelpers.GetplacepopularTop(); return(View()); }
void DeleteProfile(Tour tour, GuideProfileListEntry entry) { Destroy(entry.gameObject); try { TourHelpers.DeleteTour(tour); } catch { Debug.Log("Could not delete tour with uniqueId: " + tour.uniqueId); } }
void LoadCache() { var fullTour = TourHelpers.NewTour(); var allFiles = fullTour.root.GetAllDescendantFiles(true); //var allImageUrls = allFiles.OfType<ImageFile>();//.Select(file => file.url); //var allVideoUrls = allFiles.OfType<VideoFile>();//.Select(file => file.url); //var allUrls = allImageUrls.Concat(allVideoUrls); var allImageUrls = allFiles.Where(f => f is ImageFile);//.OfType<ImageFile>(); var allVideoUrls = allFiles.Where(f => f is VideoFile); var allUrls = allImageUrls.Concat(allVideoUrls); StartCoroutine(App.cache.CacheOnly(allUrls) .Then(() => OnCacheDone(App.cache.errorWhileCacheOnly))); }
void OnImportDone(Folder data, bool errorOnWebRequest) { if (errorOnWebRequest) { errorMessage += "Could not connect to the server to load the Tour content csv file!"; } else if (data.children.Count == 0) { errorMessage += "The CSV import encountered an error or the CSV contained no themes. Make sure its content is properly formatted and its fields contain no double quotes!"; Debug.Log("CSV import failed or CSV contained no themes."); } else { var localData = TourHelpers.NewTour().root; // This is my favourite hack so far // localData has been serialized, deserialized, serialized // but data has not // BUT that process changes the newline characters of some string values // in order to be able to compare the two, apply that process to both // TODO low prio proper equality comparison of FileAndFolder var localDataString = XmlOperation.Serialize( XmlOperation.TryDeserializeFromString <Folder>( XmlOperation.Serialize(localData))); var dataString = XmlOperation.Serialize( XmlOperation.TryDeserializeFromString <Folder>( XmlOperation.Serialize(data))); // since we have not implemented Equals in FileOrFolder, serialize and compare strings if (localDataString != dataString) { TourHelpers.DeleteCustomTours(); var defaultTour = new Tour() { root = data, profileName = "Default Tour" }; TourHelpers.SaveDefaultTour(defaultTour); } } LoadCache(); }