async void IAciEventHandler <USBDevice> .OnEvent(USBDevice arg) { if (arg.drive == null) { return; } bool userLoaded = await m_UserManager.LoadUser(); m_USBService.active = false; if (userLoaded) { await m_NavigationService.PushAsync(skipIntro? "Workflow" : "Welcome01", AnimationOptions.Synchronous, false); m_MilestoneFacade.StartMilestoneQuests(); } else { await m_NavigationService.PushAsync("Registration", AnimationOptions.Synchronous, false); } }
public async void RegisterNewUser() { WebCamTexture tex = (targetImage.texture as WebCamTexture); Texture2D snap; Sprite targetSprite; if (!tex.isPlaying) { targetSprite = placeholder; snap = placeholder.texture; } else { await Countdown(); m_AudioService.PlayAudioClip(snapClip, AudioChannels.SFX); Rect snapRect = new Rect(tex.width * targetImage.uvRect.x , tex.height * targetImage.uvRect.y , tex.width * targetImage.uvRect.width , tex.height * targetImage.uvRect.height); snap = new Texture2D((int)snapRect.width, (int)snapRect.height); snap.SetPixels(tex.GetPixels((int)snapRect.x, (int)snapRect.y, (int)snapRect.width, (int)snapRect.height)); snap.Apply(); snap.Resize(100, 100, TextureFormat.ARGB32, false); snap.Apply(); targetSprite = Sprite.Create(snap, new Rect(0, 0, snap.width, snap.height), new Vector2(0.5f, 0.5f)); } m_UserManager.CreateNewUser(userName.text, targetSprite); await m_UserManager.SaveUser(); await m_NavigationService.PushAsync("Welcome01", AnimationOptions.Synchronous, false); m_MilestoneFacade.StartMilestoneQuests(); }