Exemple #1
0
 public void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Exemple #2
0
    public void Update()
    {
        // This is an item, on the floor, that has a collider. Yep.

        if (MouseOver)
        {
            if (AllowPickup && !Item.IsEquipped())
            {
                // Show the user that they can pick this item up.
                if (InputManager.Active)
                {
                    string key      = InputManager.GetInput("Pick up").ToString();
                    string itemName = RichText.InBold(RichText.InColour(Item.Name, ItemRarityUtils.GetColour(Item.Rarity)));
                    ActionHUD.DisplayAction("PickupPrompt".Translate(key, itemName));
                }
                if (InputManager.InputDown("Pick up"))
                {
                    // Check client-server situation...
                    if (isServer)
                    {
                        // Pick up manually.
                        Item.RequestDataUpdate();
                        PickupAccepted(Item.Data);
                        Destroy(this.gameObject);
                    }
                    else
                    {
                        // Pick up using the command.
                        Player.Local.NetUtils.CmdRequestPickup(Player.Local.gameObject, this.gameObject);
                    }
                }
            }
        }
    }
Exemple #3
0
 public void Awake()
 {
     // TODO WHY HERE :D
     BaseTile.LoadPrefabs();
     Item.LoadItems();
     Pawn.LoadAllPawns();
     Furniture.LoadAllFurniture();
     // TODO move both things to a better place.
     instance = this;
 }
Exemple #4
0
 public void Refresh()
 {
     if (Item == null)
     {
         Text.text     = "ERROR";
         Image.enabled = false;
     }
     else
     {
         Text.text = RichText.InColour(Item.Name, ItemRarityUtils.GetColour(Item.Rarity));
         if (Atlas == null)
         {
             Atlas = Resources.Load <SpriteAtlas>("Atlas/Game Point");
         }
         Sprite spr = Atlas.GetSprite(Item.ItemIcon.name);
         Image.sprite = spr == null ? Item.ItemIcon : spr;
     }
 }
Exemple #5
0
    public void Enter(Item item)
    {
        if (item == null)
        {
            return;
        }

        Debug.Log("Opening details for : " + item.Name);
        gameObject.SetActive(true);

        string desc = BuildDescription(item);

        Text.text  = desc;
        Title.text = RichText.InColour(item.Name, ItemRarityUtils.GetColour(item.Rarity));

        SetStats(BuildStats(item));

        Sprite spr = Atlas.GetSprite(item.ItemIcon.name);

        Image.sprite = spr == null ? item.ItemIcon : spr;
    }
Exemple #6
0
    public void SetText()
    {
        string quantity  = ItemData.Count > 1 ? " x" + ItemData.Count : "";
        string quickSlot = "";

        if (ItemData.Data != null && ItemData.Data.Get <int>("Quick Slot") != 0)
        {
            quickSlot = RichText.InColour(" (Slot #" + ItemData.Data.Get <int>("Quick Slot") + ")", Color.black);
        }
        Text.text  = ItemData.Item.Name + quantity + quickSlot;
        Text.color = Color.Lerp(ItemRarityUtils.GetColour(ItemData.Item.Rarity), Color.black, 0.2f);
        if (Details != null)
        {
            Details.text = (ItemData.Item.InventoryInfo.Weight * ItemData.Count) + "Kg";
        }
        if (Atlas == null)
        {
            Atlas = Resources.Load <SpriteAtlas>("Atlas/Game Point");
        }
        Sprite spr = Atlas.GetSprite(ItemData.Item.ItemIcon.name);

        Image.sprite = spr == null ? ItemData.Item.ItemIcon : spr;
    }
Exemple #7
0
 public void RefreshAmount()
 {
     Text.text = RichText.InBold(RichText.InColour(Item == null ? "---" : Item.Name, Item == null ? Color.black : ItemRarityUtils.GetColour(Item.Rarity))) + " x" + Amount;
 }
Exemple #8
0
 public Color GetColour()
 {
     return(ItemRarityUtils.GetColour(Rarity));
 }