change mouse sequence to blocked whene map borders are reached
This commit is contained in:
committed by
Chris Forbes
parent
73017d3f5c
commit
669aaab6b4
@@ -55,6 +55,25 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
scrollPosition = newScrollPosition;
|
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)
|
public Viewport(float2 screenSize, int2 mapStart, int2 mapEnd, Renderer renderer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,23 +51,55 @@ namespace OpenRA.Widgets
|
|||||||
if (!Game.Settings.Game.ViewportEdgeScroll)
|
if (!Game.Settings.Game.ViewportEdgeScroll)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (Edge.Includes(ScrollDirection.Up) && Edge.Includes(ScrollDirection.Left))
|
if (Edge.Includes(ScrollDirection.Up) && Edge.Includes(ScrollDirection.Left)){
|
||||||
return "scroll-tl";
|
ScrollDirection BlockedDirections = Game.viewport.GetBlockedDirections();
|
||||||
if (Edge.Includes(ScrollDirection.Up) && Edge.Includes(ScrollDirection.Right))
|
if(BlockedDirections.Includes(ScrollDirection.Up) && BlockedDirections.Includes(ScrollDirection.Left))
|
||||||
return "scroll-tr";
|
return "scroll-tl-blocked";
|
||||||
if (Edge.Includes(ScrollDirection.Down) && Edge.Includes(ScrollDirection.Left))
|
else
|
||||||
return "scroll-bl";
|
return "scroll-tl";
|
||||||
if (Edge.Includes(ScrollDirection.Down) && Edge.Includes(ScrollDirection.Right))
|
}
|
||||||
return "scroll-br";
|
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)){
|
||||||
|
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)){
|
||||||
|
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 (Edge.Includes(ScrollDirection.Up))
|
||||||
return "scroll-t";
|
if (Game.viewport.GetBlockedDirections().Includes(ScrollDirection.Up))
|
||||||
|
return "scroll-t-blocked";
|
||||||
|
else
|
||||||
|
return "scroll-t";
|
||||||
if (Edge.Includes(ScrollDirection.Down))
|
if (Edge.Includes(ScrollDirection.Down))
|
||||||
return "scroll-b";
|
if (Game.viewport.GetBlockedDirections().Includes(ScrollDirection.Down))
|
||||||
|
return "scroll-b-blocked";
|
||||||
|
else
|
||||||
|
return "scroll-b";
|
||||||
if (Edge.Includes(ScrollDirection.Left))
|
if (Edge.Includes(ScrollDirection.Left))
|
||||||
return "scroll-l";
|
if (Game.viewport.GetBlockedDirections().Includes(ScrollDirection.Left))
|
||||||
|
return "scroll-l-blocked";
|
||||||
|
else
|
||||||
|
return "scroll-l";
|
||||||
if (Edge.Includes(ScrollDirection.Right))
|
if (Edge.Includes(ScrollDirection.Right))
|
||||||
return "scroll-r";
|
if (Game.viewport.GetBlockedDirections().Includes(ScrollDirection.Right))
|
||||||
|
return "scroll-r-blocked";
|
||||||
|
else
|
||||||
|
return "scroll-r";
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,18 +327,25 @@
|
|||||||
<sequence name="idle" start="0" length="*" />
|
<sequence name="idle" start="0" length="*" />
|
||||||
</unit>
|
</unit>
|
||||||
<cursor src="mouse" palette="cursor">
|
<cursor src="mouse" palette="cursor">
|
||||||
<sequence name="scroll-t" start="1" x="12" y="12" />
|
<sequence name="scroll-t" start="1" x="12" y="12" />
|
||||||
<sequence name="scroll-tr" start="2" x="12" y="12" />
|
<sequence name="scroll-tr" start="2" x="12" y="12" />
|
||||||
<sequence name="scroll-r" start="3" x="12" y="12" />
|
<sequence name="scroll-r" start="3" x="12" y="12" />
|
||||||
<sequence name="scroll-br" start="4" x="12" y="12" />
|
<sequence name="scroll-br" start="4" x="12" y="12" />
|
||||||
<sequence name="scroll-b" start="5" x="12" y="12" />
|
<sequence name="scroll-b" start="5" x="12" y="12" />
|
||||||
<sequence name="scroll-bl" start="6" x="12" y="12" />
|
<sequence name="scroll-bl" start="6" x="12" y="12" />
|
||||||
<sequence name="scroll-l" start="7" 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-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="select" start="15" length="6" x="12" y="12" />
|
||||||
|
|
||||||
<sequence name="default" start="0" />
|
<sequence name="default" start="0" />
|
||||||
<sequence name="default-minimap" start="80" />
|
<sequence name="default-minimap" start="80" />
|
||||||
<sequence name="generic-blocked" start="9" />
|
<sequence name="generic-blocked" start="9" />
|
||||||
<sequence name="generic-blocked-minimap" start="33" />
|
<sequence name="generic-blocked-minimap" start="33" />
|
||||||
|
|||||||
Reference in New Issue
Block a user