public void ShowOnGUI(Rect r, SpriteAlignment alignment, bool useCloseButton) { if (observer == null) { observer = GameObject.Instantiate(Resources.Load <GameObject>("UIPrefs/artifactPanel"), UIController.current.mainCanvas).GetComponent <UIArtifactPanel>(); } observer.gameObject.SetActive(true); observer.SetPosition(r, alignment); observer.ShowArtifact(this, useCloseButton); }
public static UIArtifactPanel GetObserver() { if (_currentObserver == null) { var mc = UIController.GetCurrent().GetMainCanvasController(); _currentObserver = Instantiate(Resources.Load <GameObject>("UIPrefs/artifactPanel"), mc.GetMainCanvasTransform()).GetComponent <UIArtifactPanel>(); _currentObserver.myCanvas = mc; } return(_currentObserver); }
public void SelectItem(int index) { switch (mode) { case InfoMode.Expeditions: { UIExpeditionObserver.Show(observerPanel.GetComponent<RectTransform>(), SpriteAlignment.TopLeft, Expedition.expeditionsList[index], false); activeObserver = UIExpeditionObserver.GetObserver().gameObject; break; } case InfoMode.Crews: { UICrewObserver.Show(observerPanel.GetComponent<RectTransform>(), SpriteAlignment.TopLeft, Crew.crewsList[index], false); activeObserver = UICrewObserver.GetObserver().gameObject; break; } case InfoMode.Artifacts: UIArtifactPanel.Show(observerPanel.GetComponent<RectTransform>(), SpriteAlignment.TopLeft, Artifact.artifactsList[index], false); activeObserver = UIArtifactPanel.GetObserver().gameObject; break; } if (activeObserver != null) activeObserver.transform.SetAsLastSibling(); }