Loadscreen progress bar
This commit is contained in:
@@ -20,10 +20,12 @@ namespace OpenRA.Mods.Cnc
|
|||||||
public class CncLoadScreen : ILoadScreen
|
public class CncLoadScreen : ILoadScreen
|
||||||
{
|
{
|
||||||
Dictionary<string,string> Info;
|
Dictionary<string,string> Info;
|
||||||
Stopwatch lastLoadScreen = new Stopwatch();
|
Stopwatch loadTimer = new Stopwatch();
|
||||||
Sprite[] ss;
|
Sprite[] ss;
|
||||||
float2 nodPos, gdiPos, evaPos;
|
string text;
|
||||||
Sprite nodLogo, gdiLogo, evaLogo;
|
int loadTick;
|
||||||
|
float2 nodPos, gdiPos, evaPos, textPos;
|
||||||
|
Sprite nodLogo, gdiLogo, evaLogo, brightBlock, dimBlock;
|
||||||
Rectangle Bounds;
|
Rectangle Bounds;
|
||||||
Renderer r;
|
Renderer r;
|
||||||
NullInputHandler nih = new NullInputHandler();
|
NullInputHandler nih = new NullInputHandler();
|
||||||
@@ -55,27 +57,39 @@ namespace OpenRA.Mods.Cnc
|
|||||||
nodPos = new float2(Renderer.Resolution.Width/3 - 256, Renderer.Resolution.Height/2 - 128);
|
nodPos = new float2(Renderer.Resolution.Width/3 - 256, Renderer.Resolution.Height/2 - 128);
|
||||||
gdiPos = new float2(Renderer.Resolution.Width*2/3, Renderer.Resolution.Height/2 - 128);
|
gdiPos = new float2(Renderer.Resolution.Width*2/3, Renderer.Resolution.Height/2 - 128);
|
||||||
evaPos = new float2(Renderer.Resolution.Width-43-128, 43);
|
evaPos = new float2(Renderer.Resolution.Width-43-128, 43);
|
||||||
|
|
||||||
|
brightBlock = new Sprite(s, new Rectangle(320,0,16,35), TextureChannel.Alpha);
|
||||||
|
dimBlock = new Sprite(s, new Rectangle(336,0,16,35), TextureChannel.Alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Display()
|
public void Display()
|
||||||
{
|
{
|
||||||
if (r == null)
|
if (r == null || loadTimer.ElapsedTime() < 0.25)
|
||||||
return;
|
return;
|
||||||
|
loadTimer.Reset();
|
||||||
|
|
||||||
// Update text at most every 0.5 seconds
|
loadTick = ++loadTick % 8;
|
||||||
if (lastLoadScreen.ElapsedTime() < 0.5)
|
|
||||||
return;
|
|
||||||
var font = r.Fonts["BigBold"];
|
|
||||||
var text = "Connecting to EVA...";
|
|
||||||
lastLoadScreen.Reset();
|
|
||||||
var textSize = font.Measure(text);
|
|
||||||
|
|
||||||
r.BeginFrame(float2.Zero);
|
r.BeginFrame(float2.Zero);
|
||||||
r.RgbaSpriteRenderer.DrawSprite(gdiLogo, gdiPos);
|
r.RgbaSpriteRenderer.DrawSprite(gdiLogo, gdiPos);
|
||||||
r.RgbaSpriteRenderer.DrawSprite(nodLogo, nodPos);
|
r.RgbaSpriteRenderer.DrawSprite(nodLogo, nodPos);
|
||||||
r.RgbaSpriteRenderer.DrawSprite(evaLogo, evaPos);
|
r.RgbaSpriteRenderer.DrawSprite(evaLogo, evaPos);
|
||||||
DrawBorder();
|
DrawBorder();
|
||||||
font.DrawText(text, new float2((Renderer.Resolution.Width - textSize.X) / 2, (Renderer.Resolution.Height - textSize.Y) / 2), Color.White);
|
|
||||||
|
var barY = Renderer.Resolution.Height-78;
|
||||||
|
text = "Loading";
|
||||||
|
var textSize = r.Fonts["BigBold"].Measure(text);
|
||||||
|
textPos = new float2((Renderer.Resolution.Width - textSize.X) / 2, barY);
|
||||||
|
r.Fonts["BigBold"].DrawText(text, textPos, Color.DarkRed);
|
||||||
|
|
||||||
|
for (var i = 0; i <= 8; i++)
|
||||||
|
{
|
||||||
|
var block = loadTick == i ? brightBlock : dimBlock;
|
||||||
|
r.RgbaSpriteRenderer.DrawSprite(block,
|
||||||
|
new float2(Renderer.Resolution.Width/2 - 114 - i*32, barY));
|
||||||
|
r.RgbaSpriteRenderer.DrawSprite(block,
|
||||||
|
new float2(Renderer.Resolution.Width/2 + 114 + i*32-16, barY));
|
||||||
|
}
|
||||||
|
|
||||||
r.EndFrame( nih );
|
r.EndFrame( nih );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,9 +54,9 @@
|
|||||||
borderopacity="1.0"
|
borderopacity="1.0"
|
||||||
inkscape:pageopacity="0.0"
|
inkscape:pageopacity="0.0"
|
||||||
inkscape:pageshadow="2"
|
inkscape:pageshadow="2"
|
||||||
inkscape:zoom="2.8284271"
|
inkscape:zoom="4"
|
||||||
inkscape:cx="280.3593"
|
inkscape:cx="293.08008"
|
||||||
inkscape:cy="454.1963"
|
inkscape:cy="512.48057"
|
||||||
inkscape:document-units="px"
|
inkscape:document-units="px"
|
||||||
inkscape:current-layer="layer1"
|
inkscape:current-layer="layer1"
|
||||||
showgrid="false"
|
showgrid="false"
|
||||||
@@ -101,51 +101,46 @@
|
|||||||
inkscape:groupmode="layer"
|
inkscape:groupmode="layer"
|
||||||
id="layer1"
|
id="layer1"
|
||||||
transform="translate(0,-540.3622)">
|
transform="translate(0,-540.3622)">
|
||||||
<g
|
<rect
|
||||||
transform="translate(0,-255.99998)"
|
style="fill:#2b0000;fill-opacity:0.87843137;stroke:#800000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none"
|
||||||
id="layer1-3"
|
id="rect3776-3"
|
||||||
inkscape:label="Layer 1">
|
width="63"
|
||||||
<rect
|
height="63"
|
||||||
inkscape:export-ydpi="90"
|
x="0.5"
|
||||||
inkscape:export-xdpi="90"
|
y="732.86218"
|
||||||
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
||||||
y="988.86218"
|
inkscape:export-xdpi="90"
|
||||||
x="0.5"
|
inkscape:export-ydpi="90" />
|
||||||
height="63"
|
<rect
|
||||||
width="63"
|
inkscape:export-ydpi="90"
|
||||||
id="rect3776-3"
|
inkscape:export-xdpi="90"
|
||||||
style="fill:#2b0000;fill-opacity:0.87843137;stroke:#800000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none" />
|
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
||||||
<rect
|
y="668.86218"
|
||||||
style="fill:#560000;fill-opacity:0.87843137;stroke:#c00000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
x="0.5"
|
||||||
id="rect3759"
|
height="63"
|
||||||
width="63"
|
width="63"
|
||||||
height="63"
|
id="rect3759"
|
||||||
x="0.5"
|
style="fill:#560000;fill-opacity:0.87843137;stroke:#c00000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
y="924.86218"
|
<rect
|
||||||
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
inkscape:export-ydpi="90"
|
||||||
inkscape:export-xdpi="90"
|
inkscape:export-xdpi="90"
|
||||||
inkscape:export-ydpi="90" />
|
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
||||||
<rect
|
y="668.86218"
|
||||||
style="fill:#2b2b2b;fill-opacity:0.87843137;stroke:#800000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
x="64.5"
|
||||||
id="rect2984-3"
|
height="63"
|
||||||
width="63"
|
width="63"
|
||||||
height="63"
|
id="rect2984-3"
|
||||||
x="64.5"
|
style="fill:#2b2b2b;fill-opacity:0.87843137;stroke:#800000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
y="924.86218"
|
<rect
|
||||||
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
inkscape:export-ydpi="90"
|
||||||
inkscape:export-xdpi="90"
|
inkscape:export-xdpi="90"
|
||||||
inkscape:export-ydpi="90" />
|
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
||||||
<rect
|
y="732.86218"
|
||||||
style="fill:#0f0000;fill-opacity:0.87843137;stroke:#c00000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
x="64.5"
|
||||||
id="rect3753"
|
height="63"
|
||||||
width="63"
|
width="63"
|
||||||
height="63"
|
id="rect3753"
|
||||||
x="64.5"
|
style="fill:#0f0000;fill-opacity:0.87843137;stroke:#c00000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
y="988.86218"
|
|
||||||
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
|
||||||
inkscape:export-xdpi="90"
|
|
||||||
inkscape:export-ydpi="90" />
|
|
||||||
</g>
|
|
||||||
<rect
|
<rect
|
||||||
style="fill:#2b0000;fill-opacity:0.87843137;stroke:#800000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none"
|
style="fill:#2b0000;fill-opacity:0.87843137;stroke:#800000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none"
|
||||||
id="rect3776"
|
id="rect3776"
|
||||||
@@ -499,7 +494,7 @@
|
|||||||
inkscape:connector-curvature="0"
|
inkscape:connector-curvature="0"
|
||||||
sodipodi:nodetypes="ccccccccccsccccccccccccccccccccccscsssscs" />
|
sodipodi:nodetypes="ccccccccccsccccccccccccccccccccccscsssscs" />
|
||||||
<g
|
<g
|
||||||
transform="translate(128,-372.30568)"
|
transform="translate(128,-382.30568)"
|
||||||
id="layer1-36"
|
id="layer1-36"
|
||||||
inkscape:label="Layer 1">
|
inkscape:label="Layer 1">
|
||||||
<path
|
<path
|
||||||
@@ -658,5 +653,27 @@
|
|||||||
sodipodi:start="0.00014815468"
|
sodipodi:start="0.00014815468"
|
||||||
sodipodi:end="6.2831853"
|
sodipodi:end="6.2831853"
|
||||||
sodipodi:open="true" />
|
sodipodi:open="true" />
|
||||||
|
<rect
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
||||||
|
y="540.86218"
|
||||||
|
x="336.5"
|
||||||
|
height="34"
|
||||||
|
width="15"
|
||||||
|
id="rect3999"
|
||||||
|
style="fill:#0f0000;fill-opacity:0.87843138;stroke:#800000;stroke-width:0.99999987999999995;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||||
|
<rect
|
||||||
|
style="fill:#560000;fill-opacity:0.87843137;stroke:#c00000;stroke-width:0.99999988;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
id="rect4001"
|
||||||
|
width="15"
|
||||||
|
height="34"
|
||||||
|
x="320.5"
|
||||||
|
y="540.86218"
|
||||||
|
inkscape:export-filename="/Users/paul/src/OpenRA/mods/cnc/uibits/rect3776.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:transform-center-x="1.4142136"
|
||||||
|
inkscape:transform-center-y="40.134013" />
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Reference in New Issue
Block a user