private void _SelectInfo(byte[] data) { Info.Instance.Print("audioinfo parse", true); SelectInfo result = NetworkUtils.Deserialize <SelectInfo>(data); MajPrefab obj = GameObject.Find("Controller").GetComponent <ARController>().visualizer; obj.handleSelect(result.id); }
private void _CardInfo(byte[] data) { Info.Instance.Print("cardinfo parse", true); CardInfo result = NetworkUtils.Deserialize <CardInfo>(data); MajPrefab obj = GameObject.Find("Controller").GetComponent <ARController>().visualizer; obj.parse(result); }
public void Update() { GameObject.Find("Canvas/Connected/Text").GetComponent <Text>().text = "My id:" + myId.ToString(); // Exit the app when the 'back' button is pressed. if (Input.GetKey(KeyCode.Escape)) { Application.Quit(); } // Only allow the screen to sleep when not tracking. if (Session.Status != SessionStatus.Tracking) { Screen.sleepTimeout = SleepTimeout.SystemSetting; } else { Screen.sleepTimeout = SleepTimeout.NeverSleep; } // Get updated augmented images for this frame. Session.GetTrackables <AugmentedImage>( m_TempAugmentedImages, TrackableQueryFilter.Updated); // Create visualizers and anchors for updated augmented images that are tracking and do // not previously have a visualizer. Remove visualizers for stopped images. foreach (var image in m_TempAugmentedImages) { visualizer = null; m_Visualizers.TryGetValue(image.DatabaseIndex, out visualizer); if (image.TrackingState == TrackingState.Tracking && visualizer == null) { // Create an anchor to ensure that ARCore keeps tracking this augmented image. Anchor anchor = image.CreateAnchor(image.CenterPose); visualizer = (MajPrefab)Instantiate( AugmentedImageVisualizerPrefab, anchor.transform); visualizer.Image = image; visualizer.init(); m_Visualizers.Add(image.DatabaseIndex, visualizer); } else if (image.TrackingState == TrackingState.Stopped && visualizer != null) { m_Visualizers.Remove(image.DatabaseIndex); GameObject.Destroy(visualizer.gameObject); } } // Show the fit-to-scan overlay if there are no images that are Tracking. foreach (var visualizer in m_Visualizers.Values) { if (visualizer.Image.TrackingState == TrackingState.Tracking) { FitToScanOverlay.SetActive(false); return; } } FitToScanOverlay.SetActive(true); }
private void _AudioInfo(byte[] data) { Info.Instance.Print("audioinfo parse", true); AudioInfo result = NetworkUtils.Deserialize <AudioInfo>(data); if (result.player == -1) { MajPrefab obj = GameObject.Find("Controller").GetComponent <ARController>().visualizer; obj.table.transform.Find("audio").GetComponent <AudioSource>().Play(); } else { GameObject.Find("Controller").GetComponent <AudioManager>().PlaySound(result.type, GameObject.Find("Controller")); } }