当前位置: 首页>>代码示例>>C#>>正文


C# Screen.DrawStringWithShading方法代码示例

本文整理汇总了C#中Screen.DrawStringWithShading方法的典型用法代码示例。如果您正苦于以下问题:C# Screen.DrawStringWithShading方法的具体用法?C# Screen.DrawStringWithShading怎么用?C# Screen.DrawStringWithShading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Screen的用法示例。


在下文中一共展示了Screen.DrawStringWithShading方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

    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);
                    }
                }
            }
        }
    }
开发者ID:mxgmn,项目名称:GENW,代码行数:53,代码来源:Inventory.cs

示例2: Draw

    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);
    }
开发者ID:mxgmn,项目名称:GENW,代码行数:18,代码来源:Effect.cs


注:本文中的Screen.DrawStringWithShading方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。