本文整理汇总了C#中Screen.DrawString方法的典型用法代码示例。如果您正苦于以下问题:C# Screen.DrawString方法的具体用法?C# Screen.DrawString怎么用?C# Screen.DrawString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Screen
的用法示例。
在下文中一共展示了Screen.DrawString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawParty
/*public void LoadTextures()
{
//Texture = M.game.Content.Load<Texture2D>("other/player");
Texture = NamedTexture.Get("other/player");
}*/
public void DrawParty(ZPoint position)
{
Screen screen = new Screen(position, new ZPoint(1, 1));
int vOffset = 0, iOffset = 0, hiOffset = 40, vStep = 40;
MouseTrigger.Clear<MouseTriggerObject<LocalObject>>();
foreach (var c in party)
{
Screen icon = new Screen(position + new ZPoint(0, vOffset), new ZPoint(32, 32));
icon.Fill(Stuff.MyColor("Very Dark Grey"));
icon.Draw(c.GetTexture, ZPoint.Zero);
if (c.xp != null) icon.DrawRectangle(new ZPoint(-2, 32), new ZPoint(2, (int)(-32 * ((float)(c.xp.value % c.xp.Max)/c.xp.Max))), Color.Yellow);
MouseTriggerObject<LocalObject>.Set(c, icon.position, icon.size);
float hpMissing = 1 - (float)c.hp.value / c.hp.Max;
float staminaMissing = 1 - (float)c.hp.stamina / c.hp.Max;
icon.DrawRectangle(new ZPoint(0, 32), new ZPoint(32, -(int)(staminaMissing * 32)), new Color(0.2f, 0.0f, 0.0f, 0.2f));
icon.DrawRectangle(new ZPoint(0, 32), new ZPoint(32, -(int)(hpMissing * 32)), new Color(0.2f, 0.0f, 0.0f, 0.2f));
if (c.inventory != null) c.inventory.Draw(position + new ZPoint(hiOffset, iOffset));
vOffset += vStep;
if (c.inventory != null) iOffset += vStep;
}
var mtc = MouseTrigger.GetUnderMouse<MouseTriggerObject<LocalObject>>();
if (mtc != null)
{
LocalObject c = mtc.t;
Screen icon = new Screen(position + new ZPoint(0, vStep * party.IndexOf(c)), new ZPoint(32, 32));
icon.DrawString(M.fonts.verySmall, c.hp.stamina.ToString() + "/" + c.hp.value + "/" + c.hp.Max, 27, Color.White);
c.DrawInfo(position + new ZPoint(6 * 32 + 48, 40));
}
Action<Inventory> draw = i =>
{
i.Draw(position + new ZPoint(hiOffset, iOffset));
iOffset += i.Height * 32 + 8;
};
draw(inventory);
if (!crafting.IsEmpty) DrawCrafting(screen.position + new ZPoint(240, iOffset));
draw(crafting);
if (!ground.IsEmpty) draw(ground);
if (barter != null) DrawBarter(new ZPoint(hiOffset + 6 * 32 + 16, 8));
}
示例2: DrawInfo
public void DrawInfo(ZPoint position)
{
int length = 288, height = 124 + 48;
Screen screen = new Screen(position, new ZPoint(length, height));
screen.Fill(Color.Black);
if (t.hp != null)
{
float hpFraction = (float)t.hp.value / t.hp.Max;
float staminaFraction = (float)t.hp.stamina / t.hp.Max;
screen.DrawRectangle(new ZPoint(0, 0), new ZPoint((int)(hpFraction * length), 20), new Color(0.2f, 0, 0));
screen.DrawRectangle(new ZPoint(0, 0), new ZPoint((int)(staminaFraction * length), 20), new Color(0.4f, 0, 0));
for (int i = 1; i <= t.hp.Max; i++) screen.DrawRectangle(new ZPoint((int)(i * (float)length / t.hp.Max), 0),
new ZPoint(1, 20), Color.Black);
}
SpriteFont font = M.fonts.verdanaBold;
screen.DrawString(font, t.FullName, 23, Color.White);
if (t.attack != null)
{
screen.Draw(NamedTexture.Get("other/damage"), new ZPoint(0, 40));
screen.DrawString(font, t.attack.Damage.ToString(), new ZPoint(22, 43), Color.White);
screen.DrawString(font, t.attack.Value.ToString() + "/" + t.defence.Value, 43, Color.White);
}
if (t.hp != null)
{
screen.DrawString(font, t.hp.Armor.ToString(), new ZPoint(length - 32, 43), Color.White);
screen.Draw(NamedTexture.Get("other/armor"), new ZPoint(length - 20, 40));
}
if (t.effects != null) t.effects.Draw(screen.position + new ZPoint(0, 60), screen.position + new ZPoint(24, 180));
if (t.inventory != null) t.inventory.Draw(screen.position + new ZPoint(0, 92));
if (t.abilities != null) t.abilities.Draw(screen, new ZPoint(0, 124));
Ground.Draw(screen.position + new ZPoint(192, 92));
}
示例3: 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);
}
}
}
}
}
示例4: Draw
public void Draw()
{
Screen screen = new Screen(Position, new ZPoint(Length, Height));
screen.Fill(new Color(0, 0, 0, 0.6f));
int vOffset = 3 + LineHeight * (MaxLines - data.Count);
foreach (var line in data)
{
int hOffset = 3;
foreach (var part in line)
{
screen.DrawString(Font, part.Item1, new ZPoint(hOffset, vOffset), part.Item2);
hOffset += (int)Font.MeasureString(part.Item1).X;
}
vOffset += LineHeight;
}
}
示例5: DrawInfo
public void DrawInfo(ZPoint position)
{
MainScreen M = MainScreen.Instance;
Screen screen = new Screen(position, new ZPoint(192, 1));
screen.DrawString(M.fonts.verdanaBold, FullName, ZPoint.Zero, Color.White);
if (cclass != null)
{
screen.DrawString(M.fonts.small, "(" + background.name + ", " + origin.name + ")", new ZPoint(0, screen.offset), Color.White);
screen.offset += 8;
foreach (Skill skill in BigBase.Instance.skills.data)
{
int previousOffset = screen.offset;
screen.DrawString(M.fonts.small, skill.name, new ZPoint(0, screen.offset), Color.White);
int trueOffset = screen.offset;
screen.DrawString(M.fonts.small, skills[skill].ToString(), new ZPoint(100, previousOffset), Color.White);
screen.offset = trueOffset;
}
}
}
示例6: DrawEndButton
private void DrawEndButton()
{
int length = 128, height = 32;
Screen screen = new Screen(new ZPoint(M.size.x - 8 - 144 - length / 2, M.size.y - 8 - height), new ZPoint(length, height));
MouseTriggerKeyword.Clear("End Battle");
Resolution resolution = GetResolution();
if (resolution != Resolution.Not) MouseTriggerKeyword.Set("End Battle", screen.position, screen.size);
MouseTriggerKeyword mt = MouseTriggerKeyword.GetUnderMouse("End Battle");
screen.Fill(Stuff.MyColor("Dark Grey"));
string text = resolution == Resolution.Victory ? "Victory!" : resolution == Resolution.Retreat ? "Run!" : "End Battle";
screen.DrawString(M.fonts.verdanaBold, text, 9,
resolution == Resolution.Not ? Color.Gray : mt != null ? Color.Red : Color.White);
}
示例7: DrawDescription
public void DrawDescription(ZPoint position)
{
Screen screen = new Screen(position, new ZPoint(MyGame.Instance.battle ? 240 : 192, 1));
screen.DrawString(M.fonts.verdanaBold, name, new ZPoint(0, 0), Color.White);
SpriteFont font = M.fonts.small;
int previousOffset = 0, hOffset = 0;
Action<int> skip = step =>
{
if (screen.offset > previousOffset) screen.offset += step;
previousOffset = screen.offset;
};
Action<string> draw = s => screen.DrawString(font, s, new ZPoint(hOffset, screen.offset), Color.White);
Action<string, int> drawInt = (s, n) => { if (n != 0) draw(s + " " + Stuff.ShowSgn(n)); };
skip(8);
if (ability != null) draw("ABILITY: " + ability.name);
skip(8);
if (hands > 0) draw(hands == 1 ? "One-handed" : "Two-handed");
drawInt("Damage", bonus.damage);
drawInt("Armor", bonus.armor);
drawInt("Attack", bonus.attack);
drawInt("Defence", bonus.defence);
drawInt("HP", bonus.hp);
if (bonus.mtm != 1) draw("Movement time x" + bonus.mtm);
if (bonus.atm != 1) draw("Attack time x" + bonus.atm);
skip(8);
screen.DrawString(font, description, new ZPoint(0, screen.offset), Color.White, screen.size.x);
if (MyGame.Instance.debug)
{
skip(8);
draw("WEIGHT: " + Weight);
draw("CMPLXTY: " + CraftingComplexity);
draw("VALUE: " + Value);
}
skip(8);
draw("COMPONENTS:");
hOffset += 16;
foreach (var t in components) draw(t.Item1.name + (t.Item2 > 1 ? " x" + t.Item2 : ""));
}
示例8: DrawDescription
public void DrawDescription(ZPoint position)
{
Screen screen = new Screen(position, new ZPoint(240, 190));
screen.DrawString(M.fonts.verdanaBold, name, new ZPoint(3, 3), Color.White);
screen.DrawString(M.fonts.small, description, new ZPoint(3, screen.offset + 8), Color.White, screen.size.x - 3);
}
示例9: DrawDescription
public void DrawDescription(ZPoint position)
{
Screen screen = new Screen(position, new ZPoint(240, 190));
screen.DrawString(M.fonts.verdanaBold, name, new ZPoint(0, 0), Color.White);
SpriteFont font = M.fonts.small;
if (range != 0 || targetType != TargetType.Passive) screen.offset += 8;
if (range != 0) screen.DrawString(font, "RANGE: " + range, new ZPoint(0, screen.offset), Color.White);
if (targetType != TargetType.Passive)
{
screen.DrawString(font, "COST: " + cost, new ZPoint(0, screen.offset), Color.White);
screen.DrawString(font, "CAST TIME: " + castTime, new ZPoint(0, screen.offset), Color.White);
screen.DrawString(font, "COOLDOWN: " + cooldownTime, new ZPoint(0, screen.offset), Color.White);
}
screen.offset += 8;
screen.DrawString(font, description, new ZPoint(0, screen.offset), Color.White, screen.size.x);
}