public void UpdateInventoryGui()
 {
     Debug.Log ("Refreshing Inventory Gui: " + Time.time);
     Clear ();
     for (int i = 0; i < MyInventory.MyItems.Count; i++) {
         TooltipData MyData = new TooltipData();
         MyData.LabelText = MyInventory.MyItems[i].Name;
         MyData.DescriptionText = MyInventory.MyItems[i].Description;
         for (int j = 0; j < MyInventory.MyItems[i].MyStats.Data.Count; j++) {
             Stat MyStat = MyInventory.MyItems[i].MyStats.Data[j];
             MyData.DescriptionText += "\n   " + MyStat.Name;
             if (MyStat.Value > 0) {
                 MyData.DescriptionText += ": +" + MyStat.Value;
             }
             else if (MyStat.Value < 0) {
                 MyData.DescriptionText += ": -" + Mathf.Abs(MyStat.Value).ToString();
             }
         }
         AddGui("x" + MyInventory.MyItems[i].Quantity, MyData);
         MyGuis[MyGuis.Count-1].transform.GetChild(0).GetComponent<RawImage>().texture = MyInventory.MyItems[i].MyTexture;
     }
 }
Exemplo n.º 2
0
        public void AddGui(string GuiLabel, TooltipData MyTooltipData)
        {
            if (GuiPrefab == null) {
                GuiPrefab = new GameObject();
            }
            string NewName = GuiLabel;

            GameObject NewGuiCell = (GameObject)Instantiate (GuiPrefab,
                                                              GetCellPosition(MyGuis.Count),
                                                              Quaternion.identity);
            NewGuiCell.name = MyTooltipData.LabelText;
            if (IsLabels)
                NewGuiCell.transform.GetChild(0).gameObject.GetComponent<Text>().text = NewName;
            if (TooltipGui) {
                GuiTooltip MyGuiToolTip = NewGuiCell.AddComponent<GuiTooltip> ();
                MyGuiToolTip.ToolTipGui = TooltipGui;
                MyGuiToolTip.MyTooltipData = MyTooltipData;
            }

            NewGuiCell.transform.SetParent (gameObject.transform, false);
            MyGuis.Add (NewGuiCell);
            MyGuiTooltipDatas.Add (MyTooltipData);
        }
 public void UpdateQuestGuis()
 {
     Debug.Log ("Refreshing Inventory Gui: " + Time.time);
     Clear ();
     for (int i = 0; i < MyCharacter.MyQuests.Count; i++) {
         if (IsRenderQuest(MyCharacter.MyQuests[i]))
         {
             TooltipData MyData = new TooltipData();
             MyData.LabelText = MyCharacter.MyQuests[i].Name;
             MyData.DescriptionText = MyCharacter.MyQuests[i].Description;
             AddGui(MyCharacter.MyQuests[i].Name, MyData);
         }
     }
 }
Exemplo n.º 4
0
 public void AddGui(string GuiLabel)
 {
     TooltipData NewTooltip = new TooltipData ();
     NewTooltip.LabelText = GuiLabel;
     AddGui (GuiLabel, NewTooltip);
 }