Ejemplo n.º 1
0
 protected virtual void OnValidate()
 {
     if (Image == null)
     {
         if (IsEquipmentSlot)
         {
             Image = GetComponent <Image>();
         }
         else
         {
             Image = gameObject.transform.Find("Slot2").GetComponent <Image>();
         }
     }
     if (toolTip == null)
     {
         toolTip = FindObjectOfType <ItemToolTip>();
     }
     AmountText = GetComponentInChildren <Text>();
     if (!GetComponent <EquipmentSlots>())
     {
         ItemNameText        = transform.Find("ItemNameText").GetComponent <Text>();
         ItemStatText        = transform.Find("ItemStatText").GetComponent <Text>();
         ItemDescriptionText = transform.Find("ItemDescriptionText").GetComponent <Text>();
     }
 }
Ejemplo n.º 2
0
    public override void PopulateInfoWindow(ItemToolTip infoWindow, IInventoryItem tipItem)
    {
        infoWindow.AddItemTitle(this, tipItem, 0f);
        infoWindow.AddConditionInfo(tipItem);
        infoWindow.AddSectionTitle("Protection", 0f);
        for (int i = 0; i < 6; i++)
        {
            if (this.armorValues[i] != 0f)
            {
                float      contentHeight = infoWindow.GetContentHeight();
                GameObject obj2          = infoWindow.AddBasicLabel(TakeDamage.DamageIndexToString((DamageTypeIndex)i), 0f);
                GameObject obj3          = infoWindow.AddBasicLabel("+" + ((int)this.armorValues[i]).ToString("N0"), 0f);
                obj3.transform.SetLocalPositionX(145f);
                obj3.GetComponentInChildren <UILabel>().color = Color.green;
                obj2.transform.SetLocalPositionY(-(contentHeight + 10f));
                obj3.transform.SetLocalPositionY(-(contentHeight + 10f));
            }
        }
        infoWindow.AddSectionTitle("Equipment Slot", 20f);
        string text = "Head, Chest, Legs, Feet";

        if ((base._itemFlags & Inventory.SlotFlags.Head) == Inventory.SlotFlags.Head)
        {
            text = "Head";
        }
        else if ((base._itemFlags & Inventory.SlotFlags.Chest) == Inventory.SlotFlags.Chest)
        {
            text = "Chest";
        }
        infoWindow.AddBasicLabel(text, 10f);
        infoWindow.AddItemDescription(this, 15f);
        infoWindow.FinishPopulating();
    }
Ejemplo n.º 3
0
    private void OnTooltip(bool show)
    {
        IInventoryItem item   = (!show || (this._myDisplayItem == null)) ? null : this._myDisplayItem;
        ItemDataBlock  itemdb = (!show || (this._myDisplayItem == null)) ? null : this._myDisplayItem.datablock;

        ItemToolTip.SetToolTip(itemdb, item);
    }
Ejemplo n.º 4
0
 private void Awake()
 {
     if (_toolTip == null)
     {
         _toolTip = ItemToolTip.ToolTip;
     }
 }
Ejemplo n.º 5
0
    private void OnTooltip(bool show)
    {
        IInventoryItem inventoryItem;
        ItemDataBlock  itemDataBlock;

        if (!show || this._myDisplayItem == null)
        {
            inventoryItem = null;
        }
        else
        {
            inventoryItem = this._myDisplayItem;
        }
        IInventoryItem inventoryItem1 = inventoryItem;

        if (!show || this._myDisplayItem == null)
        {
            itemDataBlock = null;
        }
        else
        {
            itemDataBlock = this._myDisplayItem.datablock;
        }
        ItemToolTip.SetToolTip(itemDataBlock, inventoryItem1);
    }
 private void OnValidate()
 {
     if (itemToolTip == null)
     {
         itemToolTip = FindObjectOfType <ItemToolTip>();
     }
 }
Ejemplo n.º 7
0
 void Awake()
 {
     if (inventory == null)
     {
         var inventoryManager = GameObject.FindWithTag("InventoryManager");
         inventory = inventoryManager.GetComponent <PlayerInventory>();
     }
     if (isInventoryPanel)
     {
         // Find the DropButton inside the slotpanel only if its inventory panel slot
         dropItemButton = gameObject.transform.GetChild(1).gameObject;
         dropItemButton.SetActive(false);
     }
     //Debug.Log("object we foudn was: " + dropItemButton);
     eventTrigger    = this.gameObject.GetComponent <EventTrigger>();
     playerCharacter = GameObject.FindGameObjectWithTag("MyPlayer");
     playerAttack    = playerCharacter.GetComponent <Attack>();
     playerHealth    = playerCharacter.GetComponent <PlayerHealth>();
     slotIcon        = this.gameObject.GetComponent <Image>();
     if (guiScreenManager == null)
     {
         guiScreenManager = GameObject.Find("Canvas/Screens").GetComponent <GuiScreenManager>();
     }
     itemToolTip = transform.Find("ToolTipHoverCanvas").GetComponent <ItemToolTip>();
 }
Ejemplo n.º 8
0
 public virtual void PopulateInfoWindow(ItemToolTip infoWindow, IInventoryItem item)
 {
     infoWindow.AddItemTitle(this, item, 0f);
     infoWindow.AddConditionInfo(item);
     infoWindow.AddItemDescription(this, 15f);
     infoWindow.FinishPopulating();
 }
Ejemplo n.º 9
0
 public override void PopulateInfoWindow(ItemToolTip infoWindow, IInventoryItem tipItem)
 {
     infoWindow.AddItemTitle(this, tipItem, 0f);
     infoWindow.AddSectionTitle("Medical", 15f);
     infoWindow.AddBasicLabel("Instantly heals " + amountToHeal + " health and stops bleeding.", 15f);
     infoWindow.FinishPopulating();
 }
Ejemplo n.º 10
0
 private void Awake()
 {
     itemImage     = this.gameObject.GetComponent <Image>();
     selectedItem  = GameObject.Find("SelectedItem").GetComponent <UIItem>();
     toolTipObject = GameObject.Find("ItemToolTip");
     toolTip       = GameObject.Find("ItemToolTipText").GetComponent <ItemToolTip>();
     ui            = GameObject.Find("InventoryPanel").GetComponent <UIInventory>();
 }
Ejemplo n.º 11
0
 private void Awake()
 {
     if (ToolTip != null)
     {
         return;
     }
     ToolTip = this;
 }
Ejemplo n.º 12
0
 private void Awake()
 {
     itemImage     = this.gameObject.GetComponent <Image>();
     selectedItem  = GameObject.Find("SelectedItem").GetComponent <UIItem>();
     playerEquip   = GameObject.Find("Player").GetComponent <PlayerEquip>();
     toolTipObject = GameObject.Find("ItemToolTip");
     toolTip       = GameObject.Find("ItemToolTipText").GetComponent <ItemToolTip>();
 }
Ejemplo n.º 13
0
        protected override void OnEditorMouseDown(object sender, MouseEventArgs e)
        {
            IsMouseDown = true;
            if (!GetXyPosition(e, out _, out _, out var index))
            {
                return;
            }
            var selectedItem = Items[index];

            switch (e.Button)
            {
            case MouseButtons.Left:
                var newItem = new Furniture(MainFormReference.GetCurrentItem());

                if (selectedItem != newItem)
                {
                    // Save Old Item
                    PushNewItemChange(selectedItem, index, UndoStack);

                    // Clear Redo Stack
                    NewChange(null);

                    // Set New Item
                    Items[index] = newItem;

                    // Redraw Item Image
                    var img = EditorPictureBox.Image;
                    EditorPictureBox.Image = ImageGeneration.DrawFurnitureArrows((Bitmap)Inventory.GetItemPic(ItemCellSize,
                                                                                                              ItemsPerRow, Items, MainForm.SaveFile.SaveType, EditorPictureBox.Size), (Furniture[])Items, ItemsPerRow);
                    img?.Dispose();

                    // Update ToolTip
                    ItemToolTip.Show(
                        string.Format(HoverText, newItem.Name, newItem.ItemId.ToString("X4"),
                                      newItem.ItemFlag.ToString()), this, e.X + 10, e.Y + 10, int.MaxValue);

                    // Fire ItemChanged Event
                    OnItemChanged(selectedItem, newItem, index);
                    MainForm.SaveFile.ChangesMade = true;

                    Modified = true;
                }

                break;

            case MouseButtons.Right:
                MainFormReference.SetCurrentItem(selectedItem);
                break;

            case MouseButtons.Middle:
                var tempItems = (Furniture[])Items;
                Utilities.Utility.FloodFillFurnitureArray(ref tempItems, ItemsPerRow, index,
                                                          (Furniture)Items[index], new Furniture(MainFormReference.GetCurrentItem()));
                Items = tempItems;
                break;
            }
        }
Ejemplo n.º 14
0
 private void Awake()
 {
     _globalToolTip = this;
     if (this.uiCamera == null)
     {
         this.uiCamera = NGUITools.FindCameraForLayer(base.gameObject.layer);
     }
     this.planeTest = new Plane((Vector3)(this.uiCamera.transform.forward * 1f), new Vector3(0f, 0f, 2f));
 }
Ejemplo n.º 15
0
 private void Start()
 {
     if (_toolTip == null)
     {
         _toolTip = ItemToolTip.ToolTip;
     }
     color_icon = icon.color;
     coord      = icon.transform.position;
 }
Ejemplo n.º 16
0
    public override void PopulateInfoWindow(ItemToolTip infoWindow, IInventoryItem tipItem)
    {
        infoWindow.AddItemTitle(this, tipItem, 0f);
        infoWindow.AddSectionTitle("Medical", 15f);
        string empty = string.Empty;

        empty = (this.healthAddMin != this.healthAddMax ? string.Concat(new object[] { "Heals ", this.healthAddMin, " to ", this.healthAddMax, " health." }) : string.Concat("Heals ", this.healthAddMin, " health."));
        infoWindow.AddBasicLabel(empty, 15f);
        infoWindow.FinishPopulating();
    }
Ejemplo n.º 17
0
 protected virtual void OnValidate()
 {
     if (Image == null)
     {
         Image = GetComponent <Image>();
     }
     if (toolTip == null)
     {
         toolTip = FindObjectOfType <ItemToolTip>();
     }
 }
Ejemplo n.º 18
0
 protected virtual void OnValidate()
 {
     if (Image == null)
     {
         Image = GetComponent <Image>();
     }
     if (toolTip == null)
     {
         toolTip = FindObjectOfType <ItemToolTip>();
     }
     AmountText = GetComponentInChildren <Text>();
 }
Ejemplo n.º 19
0
    protected virtual void OnValidate()
    {
        if (icon == null)
        {
            icon = GetComponent <Image>();
        }

        if (_toolTip == null)
        {
            _toolTip = ItemToolTip.ToolTip;
        }
    }
Ejemplo n.º 20
0
    protected virtual void OnValidate()
    {
        //Only called on editor and triggers when script is loaded or change one of its values on the editor
        //used this to fill the image variable for each slot
        if (image == null)
        {
            image = GetComponent <Image>();
        }

        if (tooltip == null)
        {
            tooltip = FindObjectOfType <ItemToolTip>();
        }
    }
Ejemplo n.º 21
0
    public void OnTooltip(bool show)
    {
        ItemDataBlock itemDataBlock;

        if (!show || !(this.actualItemDataBlock != null))
        {
            itemDataBlock = null;
        }
        else
        {
            itemDataBlock = this.actualItemDataBlock;
        }
        ItemToolTip.SetToolTip(itemDataBlock, null);
    }
Ejemplo n.º 22
0
    // Load unit inventory
    // turnscheduler has event invoke sent Unit/UnitInventory on unit selected;

    public void Awake()
    {
        if (itemTooltip == null)
        {
            itemTooltip = FindObjectOfType <ItemToolTip>();
        }
        // setup Events
        // Pointer Enter
        unitPersonalInventory.OnPointerEnterEvent += ShowTooltip;

        // Pointer Exit
        unitPersonalInventory.OnPointerExitEvent += HideTooltip;

        // Left Click
        unitPersonalInventory.OnLeftClickEvent += PersonalInventoryLeftClick;
    }
Ejemplo n.º 23
0
    public override void PopulateInfoWindow(ItemToolTip infoWindow, IInventoryItem tipItem)
    {
        infoWindow.AddItemTitle(this, tipItem, 0f);
        infoWindow.AddSectionTitle("Medical", 15f);
        string text = string.Empty;

        if (this.healthAddMin == this.healthAddMax)
        {
            text = "Heals " + this.healthAddMin + " health.";
        }
        else
        {
            object[] objArray1 = new object[] { "Heals ", this.healthAddMin, " to ", this.healthAddMax, " health." };
            text = string.Concat(objArray1);
        }
        infoWindow.AddBasicLabel(text, 15f);
        infoWindow.FinishPopulating();
    }
Ejemplo n.º 24
0
 public override void PopulateInfoWindow(ItemToolTip infoWindow, IInventoryItem tipItem)
 {
     infoWindow.AddItemTitle(this, tipItem, 0f);
     infoWindow.AddSectionTitle("Ingredients", 15f);
     for (int i = 0; i < this.ingredients.Length; i++)
     {
         string name = this.ingredients[i].Ingredient.name;
         if (this.ingredients[i].amount > 1)
         {
             name = name + " x" + this.ingredients[i].amount;
         }
         infoWindow.AddBasicLabel(name, 15f);
     }
     infoWindow.AddSectionTitle("Result Item", 15f);
     infoWindow.AddBasicLabel(this.resultItem.name, 15f);
     infoWindow.AddItemDescription(this, 15f);
     infoWindow.FinishPopulating();
 }
Ejemplo n.º 25
0
 public override void PopulateInfoWindow(ItemToolTip infoWindow, IInventoryItem tipItem)
 {
     infoWindow.AddItemTitle(this, tipItem, 0f);
     infoWindow.AddSectionTitle("Consumable", 15f);
     if (this.calories > 0f)
     {
         infoWindow.AddBasicLabel(this.calories + " Calories", 15f);
     }
     if (this.litresOfWater > 0f)
     {
         infoWindow.AddBasicLabel(this.litresOfWater + "L Water", 15f);
     }
     if (this.antiRads > 0f)
     {
         infoWindow.AddBasicLabel("-" + this.antiRads + " Rads", 15f);
     }
     if (this.healthToHeal != 0f)
     {
         infoWindow.AddBasicLabel(((this.healthToHeal <= 0f) ? string.Empty : "+") + this.healthToHeal + " Health", 15f);
     }
     infoWindow.AddItemDescription(this, 15f);
     infoWindow.FinishPopulating();
 }
Ejemplo n.º 26
0
    public override void PopulateInfoWindow(ItemToolTip infoWindow, IInventoryItem tipItem)
    {
        infoWindow.AddItemTitle(this, tipItem, 0f);
        infoWindow.AddConditionInfo(tipItem);
        infoWindow.AddSectionTitle("Weapon Stats", 20f);
        float single  = this.recoilPitchMax + this.recoilYawMax;
        float single1 = 60f;
        float single2 = 1f / this.fireRate;

        if (!this.isSemiAuto)
        {
            infoWindow.AddProgressStat("Fire Rate", single2, 12f, 15f);
        }
        else
        {
            infoWindow.AddBasicLabel("Semi Automatic Weapon", 15f);
        }
        infoWindow.AddProgressStat("Damage", this.GetGUIDamage(), 100f, 15f);
        infoWindow.AddProgressStat("Recoil", single, single1, 15f);
        infoWindow.AddProgressStat("Range", this.GetBulletRange(null), 200f, 15f);
        infoWindow.AddItemDescription(this, 15f);
        infoWindow.FinishPopulating();
    }
    /*private void OnValidate()
     * {
     *
     * }*/

    public void Awake()
    {
        if (itemTooltip == null)
        {
            itemTooltip = FindObjectOfType <ItemToolTip>();
        }
        commonInventory.SetStartingItems(unitSaveManager.LoadInventory());

        // commonInventory.SetStartingItems(unitSaveManager.LoadInventory());

        // Setup Events
        // Pointer Enter
        commonInventory.OnPointerEnterEvent       += ShowTooltip;
        unitPersonalInventory.OnPointerEnterEvent += ShowTooltip;

        // Pointer Exit
        commonInventory.OnPointerExitEvent       += HideTooltip;
        unitPersonalInventory.OnPointerExitEvent += HideTooltip;

        // Left Click
        commonInventory.OnLeftClickEvent       += InventoryLeftClick;
        unitPersonalInventory.OnLeftClickEvent += UnitPersonalInventoryLeftClick;
    }
Ejemplo n.º 28
0
 public override void PopulateInfoWindow(ItemToolTip infoWindow, IInventoryItem tipItem)
 {
 }
Ejemplo n.º 29
0
 private void Start()
 {
     ToolTip = this;
     HideToolTip();
 }
Ejemplo n.º 30
0
 public void OnTooltip(bool show)
 {
     ItemToolTip.SetToolTip((!show || (this.actualItemDataBlock == null)) ? null : this.actualItemDataBlock, null);
 }
Ejemplo n.º 31
0
 private void Awake()
 {
     ItemToolTip._globalToolTip = this;
     if (this.uiCamera == null)
     {
         this.uiCamera = NGUITools.FindCameraForLayer(base.gameObject.layer);
     }
     this.planeTest = new Plane(this.uiCamera.transform.forward * 1f, new Vector3(0f, 0f, 2f));
 }