Exemplo n.º 1
0
        public void LoadExamineData(IExamineData[] data)
        {
            // If there's no data, can't load anything.
            if (data.Length == 0)
            {
                return;
            }

            // The highest Examinable listed in the target's Inspector will decide the UI to use.
            ExamineType dataType = data[0].GetExamineType();

            // If the UI is not set, set the appropriate one.
            if (!CurrentUI)
            {
                CurrentUI = UIElements[(int)dataType];
            }

            // If the current UI isn't the appropriate one, change it.
            if (CurrentUI.GetExamineType() != dataType)
            {
                CurrentUI.DisableElement();
                CurrentUI = UIElements[(int)dataType];
                CurrentUI.gameObject.SetActive(true);
            }

            // Load the new data to the UI.
            CurrentUI.LoadExamineData(data);
            CurrentUI.RefreshDisplay();
        }
Exemplo n.º 2
0
 public void ClearData()
 {
     if (CurrentUI)
     {
         CurrentUI.DisableElement();
         CurrentUI = null;
     }
 }
Exemplo n.º 3
0
        public void ClearData(bool preserveHoverName)
        {
            if (CurrentUI)
            {
                CurrentUI.DisableElement();
                CurrentUI = null;
            }

            if (!preserveHoverName)
            {
                UpdateHoverName("");
            }
        }
Exemplo n.º 4
0
        public void LoadExamineData(IExamineData[] data)
        {
            // If there's no data, can't load anything.
            if (data.Length == 0)
            {
                return;
            }

            // We only want the Hover Name to work when another UI is not displayed.
            if (!Input.GetButton("Examine"))
            {
                UpdateHoverName(data[0].GetName());
                //ClearData(true);
                return;
            }
            else
            {
                UpdateHoverName("");
            }

            // The highest Examinable listed in the target's Inspector will decide the UI to use.
            ExamineType dataType = data[0].GetExamineType();

            // If the UI is not set, set the appropriate one.
            if (!CurrentUI)
            {
                CurrentUI = UIElements[(int)dataType];
            }

            // If the current UI isn't the appropriate one, change it.
            if (CurrentUI.GetExamineType() != dataType)
            {
                CurrentUI.DisableElement();
                CurrentUI = UIElements[(int)dataType];
                CurrentUI.gameObject.SetActive(true);
            }

            // Load the new data to the UI.
            CurrentUI.LoadExamineData(data);
            CurrentUI.RefreshDisplay();
        }