1
0
forked from 0ad/0ad

New loading screen style (may need more polishing)

This was SVN commit r8699.
This commit is contained in:
WhiteTreePaladin 2010-11-27 03:07:48 +00:00
parent 6d51c3a751
commit db22548ecb
31 changed files with 366 additions and 133 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,16 +0,0 @@
<!--title of the tip goes here-->
TEMPLES
<!--body of the tip goes here-->
• Town Phase structure required
to upgrade to the City Phase.
• Recruit Healers to heal your
troops on the battlefield.
• Research healing and religious
devotion technologies.
• Its “aura” heals nearby units.
• Garrison damaged units inside
for quicker healing.

Binary file not shown.

View File

@ -11,38 +11,58 @@ function init(data)
// Set to "hourglass" cursor.
setCursor("cursor-wait");
// Choose random concept art for loading screen background (should depend on the selected civ later when this is specified).
// Get tip image and corresponding tip text
var sprite = "";
var loadingBkgArray = buildDirEntList("art/textures/ui/loading/", "*.dds", false);
if (loadingBkgArray.length == 0)
error("Failed to find any matching textures for the loading screen background.");
var tipText = "";
var tipImageLoadingArray = buildDirEntList("art/textures/ui/loading/tips/", "*.png", false);
var tipTextLoadingArray = buildDirEntList("gui/text/tips/", "*.txt", false);
if (tipImageLoadingArray.length == 0)
error("Failed to find any matching tip textures for the loading screen.");
else if (tipTextLoadingArray.length == 0)
error("Failed to find any matching tip text files for the loading screen.");
else if (tipImageLoadingArray.length != tipTextLoadingArray.length)
error("The there are different amounts of tip images and tip text files.");
else
{
// Get a random index from the list of loading screen backgrounds.
sprite = "stretched:" + loadingBkgArray[getRandom (0, loadingBkgArray.length-1)];
var randomIndex = getRandom (0, tipImageLoadingArray.length-1);
sprite = "stretched:" + tipImageLoadingArray[randomIndex];
sprite = sprite.replace("art/textures/ui/", "");
sprite = sprite.replace(".cached.dds", ""); // cope with pre-cached textures
tipText = readFile(tipTextLoadingArray[randomIndex]);
}
// Set tip image
getGUIObjectByName("loadingTipImage").sprite = sprite;
// Set tip text
if (tipText)
{
var index = tipText.indexOf("\n");
tipTextTitle = tipText.substring(0, index);
tipTextMessage = tipText.substring(index);
getGUIObjectByName("loadingTipTitle").caption = tipTextTitle? tipTextTitle : "";
getGUIObjectByName("loadingTipText").caption = tipTextMessage? tipTextMessage : "";
}
getGUIObjectByName ("ldConcept").sprite = sprite;
// janwas: main loop now sets progress / description, but that won't
// happen until the first timeslice completes, so set initial values.
var ldTitleBar = getGUIObjectByName ("ldTitleBar");
var ldText = getGUIObjectByName ("ldText");
var loadingMapName = getGUIObjectByName ("loadingMapName");
if (data)
{
switch (data.attribs.mapType)
{
case "scenario":
ldTitleBar.caption = "Loading Scenario";
ldText.caption = "Loading " + mapName + "\nPlease wait...";
//ldTitleBar.caption = "Loading Scenario";
loadingMapName.caption = "Loading \"" + mapName + "\"";
break;
case "random":
ldTitleBar.caption = "Loading Random Map";
ldText.caption = "Generating " + mapName + "\nPlease wait...";
//ldTitleBar.caption = "Loading Random Map";
loadingMapName.caption = "Generating \"" + mapName + "\"";
break;
default:
@ -50,17 +70,34 @@ function init(data)
}
}
getGUIObjectByName("ldProgressBarText").caption = "";
getGUIObjectByName("ldProgressBar").caption = 0;
getGUIObjectByName("progressText").caption = "";
getGUIObjectByName("progressBar").caption = 0;
// Pick a random tip of the day (each line is a separate tip).
var tipArray = readFileLines("gui/text/tips.txt");
// Set tip string.
getGUIObjectByName("ldTip").caption = tipArray[getRandom(0, tipArray.length-1)];
// Pick a random quote of the day (each line is a separate tip).
var quoteArray = readFileLines("gui/text/quotes.txt");
getGUIObjectByName("loadingQuoteText").caption = quoteArray[getRandom(0, quoteArray.length-1)];
}
// ====================================================================
function displayProgress()
{
getGUIObjectByName("progressBar").caption = g_Progress; // display current progress
getGUIObjectByName("progressText").caption = g_LoadDescription; // display current progess details
// Keep curved right edge of progress bar in sync with the rest of the progress bar
var middle = getGUIObjectByName("progressBar");
var rightSide = getGUIObjectByName("loadingProgressbar_right");
var middleLength = middle.size.right - middle.size.left;
var increment = Math.round(g_Progress*middleLength/100);
var size = rightSide.size;
size.left = increment;
size.right = increment+12;
rightSide.size = size;
}
// ====================================================================
function reallyStartGame()
{
// Stop the music

View File

@ -5,101 +5,48 @@
- LOADING SCREEN -
==========================================
-->
<objects>
<script file="gui/loading/loading.js"/>
<object name="ld"
type="image"
sprite="bkFillBlack"
>
<!--
==========================================
- LOADING SCREEN - WINDOW
==========================================
-->
<object name="ldWindow"
style="wheatWindowGranite"
type="image"
size="25 35 100%-25 100%-25"
>
<object name="ldTitleBar"
style="wheatWindowTitleBar"
type="button"
/>
<!--
==========================================
- LOADING SCREEN - TEXT
==========================================
-->
<object name="ldText"
type="text"
size="23.571428% 20 100%-25 100%-100"
font="serif-16"
/>
<!--
==========================================
- LOADING SCREEN - CONCEPT ART
==========================================
-->
<object name="ldConcept"
type="image"
size="30 20 33.3008%+30 88.9323%+20"
sprite="black_bkg"
aspectratio="0.5"
/>
<!--
==========================================
- LOADING SCREEN - PROGRESSBAR
==========================================
-->
<object name="ldProgressBarText"
type="text"
size="25 100%-190 100%-25 100%-175"
font="serif-14"
textcolor="0 0 0"
text_align="center"
text_valign="center"
clip="false"
>
<action on="Progress"><![CDATA[
this.caption = g_LoadDescription;
]]></action>
</object>
<object name="ldProgressBar"
style="wheatProgressBarBlue"
<!-- LOADING SCREEN BACKGROUND -->
<object type="image" sprite="loadingBackground"/>
<object size="50%-400 30 50%+400 150">
<object name="loadingMapName" size="0 0 100% 32" type="text" style="loadingPageTitleText"/>
<!-- LOADING SCREEN PROGRESSBAR -->
<object size="50%-256 48 50%+256 80" type="image" sprite="loadingBarBackground">
<object name="progressBar"
type="progressbar"
size="25 100%-160 100%-25 100%-145"
style="loadingProgressBar"
size="56 5 456 100%-5"
>
<action on="Progress"><![CDATA[
this.caption = g_Progress;
]]></action>
</object>
<!--
==========================================
- LOADING SCREEN - TIP
==========================================
-->
<object name="ldTip"
type="text"
size="25 100%-135 100%-25 100%-25"
textcolor="0 0 0"
font="serif-16"
text_align="left"
text_valign="center"
sprite="wheatIndentBorder"
/>
<object name="loadingProgressbar_left" size="0%-12 0 0 100%" type="image" sprite="loadingProgressbar_left"/>
<object name="loadingProgressbar_right" size="0 0 12 100%" type="image" sprite="loadingProgressbar_right"/>
<action on="Progress">displayProgress();</action>
</object>
</object>
<!-- LOADING SCREEN TEXT -->
<object name="progressText" size="0 64 100% 100%" type="text" style="loadingBarText"/>
</object>
<!-- LOADING SCREEN TIP IMAGE-->
<object size="50%-448 50%-192 50%+64 50%+192" type="image" sprite="loadingTipImage">
<object name="loadingTipImage" size="4 4 100%-4 100%-4" type="image" sprite="wheatIndentBorder"/>
</object>
<!-- LOADING SCREEN TIP TEXT-->
<object size="50%+128 50%-192 50%+448 50%+192" type="image" sprite="loadingTipText">
<object name="loadingTipTitle" size="30 30 100% 60" type="text" style="loadingTipTitleText"/>
<object name="loadingTipText" size="30 60 100%-30 100%" type="text" style="loadingTipText"/>
</object>
<!-- LOADING SCREEN QUOTE -->
<object size="64 50%+230 100% 100%">
<object name="loadingQuoteTitleText" size="0 0 100% 30" type="text" style="loadingTitleText">Quote of the Day:</object>
<object name="loadingQuoteText" size="0 30 100% 100%" type="text" style="loadingText"></object>
</object>
</objects>

View File

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<sprites>
<!-- BACKGROUND -->
<sprite name="loadingBackground">
<!-- background -->
<image
texture="loading/background-tile.png"
texture_size="0 0 512 512"
size="0 0 100% 100%"
/>
<!-- gradient -->
<image
texture="loading/gradient_wide.png"
size="0 0 100% 100%"
/>
<!-- sides -->
<image
texture="loading/border/border-top.png"
texture_size="0 0 128 16"
size="16 0 100%-16 16"
/>
<image
texture="loading/border/border-right.png"
texture_size="0 0 16 128"
size="100%-16 16 100% 100%-16"
/>
<image
texture="loading/border/border-bottom.png"
texture_size="0 0 128 16"
size="16 100%-16 100%-16 100%"
/>
<image
texture="loading/border/border-left.png"
texture_size="0 0 16 128"
size="0 16 16 100%-16"
/>
<!-- corners -->
<image
texture="loading/border/border-corner.png"
texture_size="0 0 16 16"
size="100%-16 0 100% 16"
/>
<image
texture="loading/border/border-corner.png"
texture_size="0 0 16 16"
size="100%-16 100%-16 100% 100%"
/>
<image
texture="loading/border/border-corner.png"
texture_size="0 0 16 16"
size="0 100%-16 16 100%"
/>
<image
texture="loading/border/border-corner.png"
texture_size="0 0 16 16"
size="0 0 16 16"
/>
</sprite>
<!-- PROGRESS BAR BACKGROUND-->
<sprite name="loadingBarBackground">
<image
texture="loading/progressbar/progressbar_background_left.png"
real_texture_placement="0 0 64 32"
size="0%+0 0% 64 0%+32"
/>
<image
texture="loading/progressbar/progressbar_background_middle.png"
real_texture_placement="0 0 64 32"
size="64 0% 100%-64 0%+32"
/>
<image
texture="loading/progressbar/progressbar_background_right.png"
real_texture_placement="0 0 64 32"
size="100%-64 0% 100%+0 0%+32"
/>
</sprite>
<!-- PROGRESS BAR -->
<sprite name="loadingProgressbar_left">
<image
texture="loading/progressbar/progressbar_left.png"
real_texture_placement="0 0 12 20"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="loadingProgressbar_middle">
<image
texture="loading/progressbar/progressbar_middle.png"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="loadingProgressbar_right">
<image
texture="loading/progressbar/progressbar_right.png"
real_texture_placement="4 0 16 20"
size="0 0 100% 100%"
/>
</sprite>
<!-- TIP IMAGE-->
<sprite name="loadingTipImage">
<image
texture="global/tile/tile_dark.png"
texture_size="0 0 100% 100%"
size="0 0 100% 100%"
/>
<!-- sides -->
<image
texture="global/border/line_horiz.png"
texture_size="0 0 64 4"
size="4 0 100%-4 4"
/>
<image
texture="global/border/line_vert.png"
texture_size="0 0 4 64"
size="100%-4 4 100% 100%-4"
/>
<image
texture="global/border/line_horiz.png"
texture_size="0 0 64 4"
size="4 100%-4 100%-4 100%"
/>
<image
texture="global/border/line_vert.png"
texture_size="0 0 4 64"
size="0 4 4 100%-4"
/>
<!-- corners -->
<image
texture="global/border/line_corner_top_right.png"
texture_size="0 0 4 4"
size="100%-4 0 100% 4"
/>
<image
texture="global/border/line_corner_bottom_right.png"
texture_size="0 0 4 4"
size="100%-4 100%-4 100% 100%"
/>
<image
texture="global/border/line_corner_bottom_left.png"
texture_size="0 0 4 4"
size="0 100%-4 4 100%"
/>
<image
texture="global/border/line_corner_top_left.png"
texture_size="0 0 4 4"
size="0 0 4 4"
/>
</sprite>
<!-- TIP TEXT -->
<sprite name="loadingTipText">
<image
texture="loading/parchment.png"
real_texture_placement="0 0 322 386"
/>
</sprite>
</sprites>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<styles>
<style name="loadingPageTitleText"
font="serif-bold-18"
textcolor="white"
text_align="center"
text_valign="center"
/>
<style name="loadingBarText"
font="serif-bold-stroke-14"
textcolor="white"
text_align="center"
text_valign="center"
/>
<style name="loadingTitleText"
font="serif-bold-18"
textcolor="white"
text_align="left"
text_valign="top"
/>
<style name="loadingText"
font="serif-bold-stroke-14"
textcolor="white"
text_align="left"
text_valign="top"
/>
<style name="loadingTipTitleText"
font="serif-bold-16"
textcolor="black"
text_align="left"
text_valign="top"
/>
<style name="loadingTipText"
font="serif-bold-14"
textcolor="black"
text_align="left"
text_valign="top"
/>
<style name="loadingProgressBar"
sprite_bar="loadingProgressbar_middle"
ghost="true"
tooltip_style="snToolTip"
tooltip="(TBA)"
/>
</styles>

View File

@ -4,6 +4,8 @@
<include>common/styles.xml</include>
<include>common/sprite1.xml</include>
<include>common/init.xml</include>
<include>loading/styles.xml</include>
<include>loading/sprites.xml</include>
<include>loading/loading.xml</include>
<include>common/global.xml</include>
</page>

View File

@ -0,0 +1,10 @@
TEMPLES
Town Phase structure required to upgrade to the City Phase.
Recruit Healers to heal your troops on the battlefield.
Research healing and religious devotion technologies.
Its "aura" heals nearby units.
Garrison damaged units inside for quicker healing.

View File

@ -0,0 +1,2 @@
Tip 2 Title
Tip 2 info goes here.