public void OnMouseDownAt(Vector3 position, bool isNewInteraction, int touchId) { if (infoPanel.GetComponent <RectTransform>().localScale != Vector3.zero || completionPanel.isShow == true) { return; } Ray ray = Camera.main.ScreenPointToRay(position); RaycastHit[] raycastHit = Physics.RaycastAll(ray, 5000f, locationMask); if (isNewInteraction) { touchDownLocations.Clear(); int raycastHitLength = raycastHit.Length; if (raycastHitLength > 0) { for (int i = 0; i < raycastHitLength; i++) { Location location = raycastHit[i].transform.GetComponent <Location>(); if (location != null && touchDownLocations.ContainsKey(location) == false) { touchDownLocations.Add(location, true); } } } } }
protected override void InitUI(IUIData uiData = null) { mData = uiData as UIThirdPageData ?? new UIThirdPageData(); InfoPanel.GetComponent <InfoPanelControl>().Init(mData.pdata); FillGuideMap(); ChoisePanel(UserGuide); }
/** * PaperInfo Button EventHandler. * Activates/Deactivates InfoPanel. */ public void PaperInfoHandler() { // Resets the InfoPanel to page 1, if it is being currently deactivated. if (InfoPanel.activeSelf) { InfoPanel.GetComponent <IInfoPanel>().reset(); } InfoPanel.SetActive(!InfoPanel.activeSelf); }
public void ChangePanelPosition() { Vector3 screenPos = Manager.StaticManager.ActiveCamera.WorldToScreenPoint(transform.position); Vector3 rect = new Vector3(InfoPanel.GetComponent <RectTransform>().rect.width, InfoPanel.GetComponent <RectTransform>().rect.height, 0); Manager.PrintToPanel("pos", screenPos); Manager.PrintToPanel("rect", rect); InfoPanel.GetComponent <RectTransform>().position = new Vector2(screenPos.x + rect.x / 2, screenPos.y + rect.y / 2); }
/** * Deserializes the xml file from the URL given in the Config into the WalkableGraph Object "Graph" */ private IEnumerator DeserializeXmlFromURL() { using (UnityWebRequest www = UnityWebRequest.Get(Config.URL + Config.XMLNAME)) { yield return(www.SendWebRequest()); // XML deserialize into the WalkableGraph object "graph". var memStream = new MemoryStream(www.downloadHandler.data); var serializer = new XmlSerializer(typeof(WalkableGraph)); Graph = (WalkableGraph)serializer.Deserialize(memStream); // Compute the right Distances from pov to groupd and from group to their respective nodes. ComputeDistances(); // Load global value from Config. Distance = Config.POV_GROUP_DISTANCE; // Pass the PaperInfo/SciGraph data to the InfoPanel/ImageHolder. InfoPanel.GetComponent <IInfoPanel>().Paper = Graph.PaperInfo.Paper; InfoPanel.SetActive(true); InfoPanel.GetComponent <IInfoPanel>().createContent(); InfoPanel.SetActive(false); // If the sciGraph file does not exist, or is even null, hide the button. if (string.IsNullOrEmpty(Graph.PaperInfo.Paper.SciGraph)) { transform.Find("Menu/SciGraph").gameObject.SetActive(false); } else { ImageHolder.SetActive(true); ImageHolder.GetComponent <IImageHolder>().SciGraph = Graph.PaperInfo.Paper.SciGraph; StartCoroutine(ImageHolder.GetComponent <IImageHolder>().createContentFromURL()); } deserializationIsDone = true; } }
/** * Deserializes the .xml file ("Path") and stores the WalkableGraph in "Graph". */ void Start() { DeserializeXml(); if (Config.URLUSED) { return; } // Compute the right Distances from pov to groupd and from group to their respective nodes. ComputeDistances(); // Load global value from Config. Distance = Config.POV_GROUP_DISTANCE; // Pass the PaperInfo/SciGraph data to the InfoPanel/ImageHolder. InfoPanel.GetComponent <IInfoPanel>().Paper = Graph.PaperInfo.Paper; // If the sciGraph file does not exist, or is even null, hide the button. if (string.IsNullOrEmpty(Graph.PaperInfo.Paper.SciGraph) || !File.Exists(GetFilePath(Graph.PaperInfo.Paper.SciGraph.Trim()))) { transform.Find("Menu/SciGraph").gameObject.SetActive(false); } else { ImageHolder.SetActive(true); ImageHolder.GetComponent <IImageHolder>().SciGraph = Graph.PaperInfo.Paper.SciGraph; ImageHolder.GetComponent <IImageHolder>().createContent(); ImageHolder.SetActive(false); } InfoPanel.SetActive(true); InfoPanel.GetComponent <IInfoPanel>().createContent(); InfoPanel.SetActive(false); deserializationIsDone = true; }