예제 #1
0
    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();
    }
예제 #2
0
 void HandleVideoOpened(string _)
 {
     MainThreadRunner.Run(delegate
     {
         RecordButton.interactable = true;
         gameObject.SetActive(false);
     });
 }
예제 #3
0
 void DispatchLoginError(Error error)
 {
     MainThreadRunner.Run(delegate()
     {
         ErrorMessage.ClosedEvent += HandleErrorMessageClosed;
         gameObject.SetActive(false);
         LoginErrorEvent?.Invoke(error);
     });
 }
예제 #4
0
    public GameObject Load()
    {
        /* shedule asset loading on main thread */
        MainThreadRunner.Run(LoadAsset);

        /* block until it's done */
        AssetLoaded.WaitOne();
        return(Asset);
    }
예제 #5
0
 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();
         }
     });
 }
예제 #6
0
 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();
         }
     });
 }
예제 #7
0
 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));
     }
 }
예제 #8
0
 void Hide()
 {
     MainThreadRunner.Run(() => gameObject.SetActive(false));
 }