public static Tuple <int, int> SerializeNetAnchor(WorldUIAnchor anch) { WorldUIAnchor.AnchorType type = anch.type; if (type == WorldUIAnchor.AnchorType.Entity) { int item = 0; if (anch.entity is NPC) { item = 0; } else if (anch.entity is Player) { item = 1; } else if (anch.entity is Projectile) { item = 2; } return(Tuple.Create <int, int>(item, anch.entity.whoAmI)); } return(Tuple.Create <int, int>(0, 0)); }
public WorldUIAnchor(int topLeftX, int topLeftY, int width, int height) { this.type = WorldUIAnchor.AnchorType.Tile; this.pos = new Vector2((float)topLeftX + (float)width / 2f, (float)topLeftY + (float)height / 2f) * 16f; this.size = new Vector2((float)width, (float)height) * 16f; }
public WorldUIAnchor(Vector2 anchor) { this.type = WorldUIAnchor.AnchorType.Pos; this.pos = anchor; }
public WorldUIAnchor(Entity anchor) { this.type = WorldUIAnchor.AnchorType.Entity; this.entity = anchor; }
public WorldUIAnchor() { this.type = WorldUIAnchor.AnchorType.None; }
public WorldUIAnchor(int topLeftX, int topLeftY, int width, int height) { this.type = WorldUIAnchor.AnchorType.Tile; this.pos = Vector2.op_Multiply(new Vector2((float)topLeftX + (float)width / 2f, (float)topLeftY + (float)height / 2f), 16f); this.size = Vector2.op_Multiply(new Vector2((float)width, (float)height), 16f); }