Ejemplo n.º 1
0
    public void Draw(ZPoint position)
    {
        Screen screen = new Screen(position, new ZPoint(width * 32, height * 32));

        if (G.battle) MouseTrigger.Clear<MouseTriggerInventory>();
        for (int i = 0; i < Size; i++) MouseTriggerInventory.Set(this, i, screen.position + CellPosition(i), new ZPoint(32, 32));
        var mti = MouseTrigger.GetUnderMouse<MouseTriggerInventory>();

        if (((mti != null && mti.inventory == this) || !IsEmpty) && name != "" && !G.battle) screen.DrawString(M.fonts.superSmall, name, Color.White);
        screen.Fill(name == "ground" ? Stuff.MyColor("Very Dark Blue") : Stuff.MyColor("Very Dark Grey"));
        if (globalOwner == World.Instance.player) screen.DrawRectangle(ZPoint.Zero, new ZPoint(screen.size.x,
            (int)(Weight * screen.size.y / globalOwner.WeightLimit)), new Color(0.2f, 0.2f, 0.2f, 0.5f));

        for (int i = 0; i < Size; i++)
        {
            ZPoint p = CellPosition(i);
            if (data[i] != null)
            {
                screen.Draw(data[i].data.texture, p);
                if (data[i].numberOfStacks > 1)
                    screen.DrawStringWithShading(M.fonts.small, data[i].numberOfStacks.ToString(), p + new ZPoint(24, 18), Color.White);
                if (G.battle && localOwner == B.current && name == "" && data[i].data.ability != null)
                    screen.DrawStringWithShading(M.fonts.small, data[i].cooldown > 0 ? "(" + (int)data[i].cooldown + ")"
                        : Stuff.ItemHotkeys[i].ToString(), p, Color.White);
            }
        }

        if (mti != null && mti.inventory == this)
        {
            screen.Draw(NamedTexture.Get("other/zSelection"), CellPosition(mti.cell));
            Item item = mti.GetItem();
            if (item != null)
            {
                item.data.DrawDescription(G.battle ? name == "ground" ? position + new ZPoint(-168, 88) : position +
                    new ZPoint(24, 88) : new ZPoint(248, 48));

                if (G.battle && G.RightMouseButtonClicked && B.current.inventory != null)
                {
                    Inventory inventory = B.current.inventory;
                    if (this == inventory)
                    {
                        B.Add(new LocalObject(item), B.current.p.value);
                        Remove(mti.cell);
                    }
                    else if (name == "ground" && inventory.CanAdd(item))
                    {
                        inventory.Add(item);
                        B.RemoveItem(item);
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
Archivo: Effect.cs Proyecto: mxgmn/GENW
    public void Draw(ZPoint p, ZPoint descriptionP)
    {
        Screen screen = new Screen(p, new ZPoint(1, 32));
        MouseTriggerKeyword.Clear("effect");

        int i = 0;
        foreach (Effect e in data)
        {
            screen.Draw(e.data.texture, new ZPoint(32 * i, 0), e.data.SgnColor);
            screen.DrawStringWithShading(M.fonts.small, ((int)e.timeLeft).ToString(), new ZPoint(32 * i + 26, 20), Color.White);

            MouseTriggerKeyword.Set("effect", i.ToString(), p + new ZPoint(32 * i, 0), new ZPoint(32, 32));
            i++;
        }

        var mtk = MouseTriggerKeyword.GetUnderMouse("effect");
        if (mtk != null) data[int.Parse(mtk.parameter)].data.DrawDescription(descriptionP);
    }