Created
December 7, 2012 06:39
-
-
Save RoyCurtis/4231249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Event handlers | |
static void onEnter(IInstance sender) | |
{ | |
var name = sender.Attributes.AvatarName; | |
var session = sender.Attributes.AvatarSession; | |
if (name == "Roy2") | |
{ | |
Console.WriteLine("Generating HUD for Roy2 (session {0})", session); | |
awBot.HudClear(session); | |
var result = awBot.HudCreate(new Hud | |
{ | |
Id = 60, | |
Type = HudType.Image, | |
Text = "ab1.jpg", | |
Flags = HudFlag.Stretch, | |
SizeX = 200, | |
X = 0, | |
SizeY = 200, | |
Y = 0, | |
ZOrder = 1, | |
Color = new Color(0x0F, 0xFF, 0xFF), | |
Origin = HudOrigin.TopLeft, | |
Opacity = 1.0f, | |
Session = session, | |
TexOffsetX = 0, | |
TexOffsetY = 0, | |
}); | |
if (result != Result.Success) | |
Console.WriteLine("Error creating HUD: {0}", result); | |
} | |
} | |
public class Hud | |
{ | |
public const int AllUsers = 0; | |
public HudType Type; | |
/// <summary> | |
/// For text element types, sets the string. For image element types, sets the | |
/// texture and mask in the following format: | |
/// texture.jpg|texture1m.bmp | |
/// </summary> | |
public string Text; | |
public int Id; | |
/// <summary> | |
/// Who the HUD element is targeted to; use 0 for all users | |
/// </summary> | |
public int Session; | |
public HudOrigin Origin; | |
public float Opacity; | |
public int X; | |
public int Y; | |
public int SizeX; | |
public int SizeY; | |
public int TexOffsetX; | |
public int TexOffsetY; | |
public int ZOrder; | |
public HudFlag Flags; | |
public Color Color; | |
public void ToInstance(Instance i) | |
{ | |
i.Attributes.HudElementText = Text; | |
i.Attributes.HudElementId = Id; | |
i.Attributes.HudElementSession = Session; | |
i.Attributes.HudElementOrigin = Origin; | |
i.Attributes.HudElementOpacity = Opacity; | |
i.Attributes.HudElementX = X; | |
i.Attributes.HudElementY = Y; | |
i.Attributes.HudElementSizeX = SizeX; | |
i.Attributes.HudElementSizeY = SizeY; | |
i.Attributes.HudElementTextureOffsetX = TexOffsetX; | |
i.Attributes.HudElementTextureOffsetY = TexOffsetY; | |
i.Attributes.HudElementZ = ZOrder; | |
i.Attributes.HudElementFlags = Flags; | |
i.Attributes.HudElementColor = Color; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment