void LoadModels(string VideoFile) { StartedLoadingPrefabsEvent?.Invoke(); int total = CloudModels.Length; int cntr = 0; SceneModels = new List <SceneModel>(); var modelInstances = ModelInstances.Load(VideoFile); foreach (var cloudModel in CloudModels) { cntr += 1; var model = CloudAPI.Instance.GetModel(cloudModel.model); if (model.defaultPosition == null) { Log.Wrn($"no position for {cloudModel}, ignoring"); continue; } var pos = model.defaultPosition.GpsPos; var prefab = ModelAssets.LoadAsset(cloudModel.model); /* set trackable name to aid in debugging */ MainThreadRunner.Run(() => prefab.name = cloudModel.ToString()); var sceneModel = modelInstances.GetModel(cloudModel.model, cloudModel.name, prefab, pos); SceneModels.Add(sceneModel); PrefabLoadedEvent?.Invoke(cntr, total); } FinishedLoadingPrefabsEvent?.Invoke(); }
void HandleVideoOpened(string _) { MainThreadRunner.Run(delegate { RecordButton.interactable = true; gameObject.SetActive(false); }); }
void DispatchLoginError(Error error) { MainThreadRunner.Run(delegate() { ErrorMessage.ClosedEvent += HandleErrorMessageClosed; gameObject.SetActive(false); LoginErrorEvent?.Invoke(error); }); }
public GameObject Load() { /* shedule asset loading on main thread */ MainThreadRunner.Run(LoadAsset); /* block until it's done */ AssetLoaded.WaitOne(); return(Asset); }
public void Register() { _runner.Run(async() => { var login = Login.text; var password = Password.text; var user = new UserState(login, password, login); var success = await _register.TryRegister(user); if (success) { _scene.GoToLogin(); } }); }
public void Login() { _runner.Run(async() => { var login = LoginInput.text; var password = PasswordInput.text; var user = new UserState(login, password, login); var success = await _auth.TryLogin(user); if (success) { _scene.GoToWorld(); } }); }
void Login() { try { CloudAPI.Instance.SetUserCredentials(Username.text, Password.text); var mods = CloudAPI.Instance.GetModels(); MainThreadRunner.Run(() => LoginSucessfull(mods)); } catch (AuthenticationError) { DispatchLoginError(Error.Authentication); } catch (ConnectionError) { DispatchLoginError(Error.Connection); } finally { MainThreadRunner.Run(() => SetWidgetsInteractable(true)); } }
void Hide() { MainThreadRunner.Run(() => gameObject.SetActive(false)); }