public JoinHandler(Join join, int tileSize, int height, int width, string name)
{
JoinInfo = join;
this.height = height;
this.width = width;
this.tileSize = tileSize;
size = join.Size * tileSize;
ticks = ((JoinInfo.type == JoinType.Vertical) ? Game.CurrentGame.PixelsAcross : Game.CurrentGame.PixelsDown) / Const.ScrollSpeed;
if (join.screenOne == name)
{
NextScreenName = join.screenTwo;
if (join.type == JoinType.Horizontal) // bottom edge
{
direction = Direction.Down;
threshXmin = join.offsetOne * tileSize;
threshYmin = height - Const.PlayerScrollTrigger;
threshXmax = threshXmin + size;
threshYmax = height + 100;
NextScreenX = (join.offsetTwo - join.offsetOne) * tileSize;
}
else // right edge
{
direction = Direction.Right;
threshXmin = width - Const.PlayerScrollTrigger;
threshYmin = join.offsetOne * tileSize;
threshXmax = width + 100;
threshYmax = threshYmin + size;
NextScreenY = (join.offsetTwo - join.offsetOne) * tileSize;
}
}
else
{
NextScreenName = join.screenOne;
if (join.type == JoinType.Horizontal) // top edge
{
direction = Direction.Up;
threshXmin = join.offsetTwo * tileSize;
threshYmin = -100;
threshXmax = threshXmin + size;
threshYmax = Const.PlayerScrollTrigger;
NextScreenX = (join.offsetOne - join.offsetTwo) * tileSize;
}
else // left edge
{
direction = Direction.Left;
threshXmin = -100;
threshYmin = join.offsetTwo * tileSize;
threshXmax = Const.PlayerScrollTrigger;
threshYmax = threshYmin + size;
NextScreenY = (join.offsetOne - join.offsetTwo) * tileSize;
}
}
}