change mouse sequence to blocked whene map borders are reached
This commit is contained in:
committed by
Chris Forbes
parent
73017d3f5c
commit
669aaab6b4
@@ -56,6 +56,25 @@ namespace OpenRA.Graphics
|
||||
scrollPosition = newScrollPosition;
|
||||
}
|
||||
|
||||
public ScrollDirection GetBlockedDirections()
|
||||
{
|
||||
int2 topLeftBorder = (Game.CellSize* mapStart);
|
||||
int2 bottomRightBorder = (Game.CellSize* mapEnd);
|
||||
|
||||
ScrollDirection blockedDirections = ScrollDirection.None;
|
||||
|
||||
if(scrollPosition.Y <= topLeftBorder.Y)
|
||||
blockedDirections = blockedDirections.Set(ScrollDirection.Up, true);
|
||||
if(scrollPosition.X <= topLeftBorder.X)
|
||||
blockedDirections = blockedDirections.Set(ScrollDirection.Left, true);
|
||||
if(scrollPosition.Y >= bottomRightBorder.Y - screenSize.Y)
|
||||
blockedDirections = blockedDirections.Set(ScrollDirection.Down, true);
|
||||
if(scrollPosition.X >= bottomRightBorder.X - screenSize.X)
|
||||
blockedDirections = blockedDirections.Set(ScrollDirection.Right, true);
|
||||
|
||||
return blockedDirections;
|
||||
}
|
||||
|
||||
public Viewport(float2 screenSize, int2 mapStart, int2 mapEnd, Renderer renderer)
|
||||
{
|
||||
this.screenSize = screenSize;
|
||||
|
||||
@@ -51,22 +51,54 @@ namespace OpenRA.Widgets
|
||||
if (!Game.Settings.Game.ViewportEdgeScroll)
|
||||
return null;
|
||||
|
||||
if (Edge.Includes(ScrollDirection.Up) && Edge.Includes(ScrollDirection.Left))
|
||||
if (Edge.Includes(ScrollDirection.Up) && Edge.Includes(ScrollDirection.Left)){
|
||||
ScrollDirection BlockedDirections = Game.viewport.GetBlockedDirections();
|
||||
if(BlockedDirections.Includes(ScrollDirection.Up) && BlockedDirections.Includes(ScrollDirection.Left))
|
||||
return "scroll-tl-blocked";
|
||||
else
|
||||
return "scroll-tl";
|
||||
if (Edge.Includes(ScrollDirection.Up) && Edge.Includes(ScrollDirection.Right))
|
||||
}
|
||||
if (Edge.Includes(ScrollDirection.Up) && Edge.Includes(ScrollDirection.Right)){
|
||||
ScrollDirection BlockedDirections = Game.viewport.GetBlockedDirections();
|
||||
if (BlockedDirections.Includes(ScrollDirection.Up) && BlockedDirections.Includes(ScrollDirection.Right))
|
||||
return "scroll-tr-blocked";
|
||||
else
|
||||
return "scroll-tr";
|
||||
if (Edge.Includes(ScrollDirection.Down) && Edge.Includes(ScrollDirection.Left))
|
||||
}
|
||||
if (Edge.Includes(ScrollDirection.Down) && Edge.Includes(ScrollDirection.Left)){
|
||||
ScrollDirection BlockedDirections = Game.viewport.GetBlockedDirections();
|
||||
if (BlockedDirections.Includes(ScrollDirection.Down) && BlockedDirections.Includes(ScrollDirection.Left))
|
||||
return "scroll-bl-blocked";
|
||||
else
|
||||
return "scroll-bl";
|
||||
if (Edge.Includes(ScrollDirection.Down) && Edge.Includes(ScrollDirection.Right))
|
||||
}
|
||||
if (Edge.Includes(ScrollDirection.Down) && Edge.Includes(ScrollDirection.Right)){
|
||||
ScrollDirection BlockedDirections = Game.viewport.GetBlockedDirections();
|
||||
if (BlockedDirections.Includes(ScrollDirection.Down) && BlockedDirections.Includes(ScrollDirection.Right))
|
||||
return "scroll-br-blocked";
|
||||
else
|
||||
return "scroll-br";
|
||||
}
|
||||
|
||||
if (Edge.Includes(ScrollDirection.Up))
|
||||
if (Game.viewport.GetBlockedDirections().Includes(ScrollDirection.Up))
|
||||
return "scroll-t-blocked";
|
||||
else
|
||||
return "scroll-t";
|
||||
if (Edge.Includes(ScrollDirection.Down))
|
||||
if (Game.viewport.GetBlockedDirections().Includes(ScrollDirection.Down))
|
||||
return "scroll-b-blocked";
|
||||
else
|
||||
return "scroll-b";
|
||||
if (Edge.Includes(ScrollDirection.Left))
|
||||
if (Game.viewport.GetBlockedDirections().Includes(ScrollDirection.Left))
|
||||
return "scroll-l-blocked";
|
||||
else
|
||||
return "scroll-l";
|
||||
if (Edge.Includes(ScrollDirection.Right))
|
||||
if (Game.viewport.GetBlockedDirections().Includes(ScrollDirection.Right))
|
||||
return "scroll-r-blocked";
|
||||
else
|
||||
return "scroll-r";
|
||||
|
||||
return null;
|
||||
|
||||
@@ -335,7 +335,14 @@
|
||||
<sequence name="scroll-bl" start="6" x="12" y="12" />
|
||||
<sequence name="scroll-l" start="7" x="12" y="12" />
|
||||
<sequence name="scroll-tl" start="8" x="12" y="12" />
|
||||
<sequence name="scroll-blocked" start="124" length="8" />
|
||||
<sequence name="scroll-t-blocked" start="124" x="12" y="12" />
|
||||
<sequence name="scroll-tr-blocked" start="125" x="12" y="12" />
|
||||
<sequence name="scroll-r-blocked" start="126" x="12" y="12" />
|
||||
<sequence name="scroll-br-blocked" start="127" x="12" y="12" />
|
||||
<sequence name="scroll-b-blocked" start="128" x="12" y="12" />
|
||||
<sequence name="scroll-bl-blocked" start="129" x="12" y="12" />
|
||||
<sequence name="scroll-l-blocked" start="130" x="12" y="12" />
|
||||
<sequence name="scroll-lt-blocked" start="131" x="12" y="12" />
|
||||
<sequence name="select" start="15" length="6" x="12" y="12" />
|
||||
|
||||
<sequence name="default" start="0" />
|
||||
|
||||
Reference in New Issue
Block a user