1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-26 02:07:26 +00:00

Merge branch 'modsel-cleanup'

This commit is contained in:
fgenesis 2013-07-27 00:43:07 +02:00
commit 3c0de8227c
18 changed files with 69 additions and 69 deletions

View file

@ -286,7 +286,8 @@ bool ModDL::ParseModXML(const std::string& fn, bool allowChaining)
<Package url="localhost/aq/jukebox.aqmod" saveAs="jukebox" size="1234" /> // -- saveAs is optional, and ".aqmod" appended to it <Package url="localhost/aq/jukebox.aqmod" saveAs="jukebox" size="1234" /> // -- saveAs is optional, and ".aqmod" appended to it
<Author name="Dolphin's Cry" /> //-- optional tag <Author name="Dolphin's Cry" /> //-- optional tag
<Confirm text="" /> //-- optional tag, pops up confirm dialog <Confirm text="" /> //-- optional tag, pops up confirm dialog
<Properties type="patch" /> //-- optional tag, if not given, "mod" is assumed. <Properties type="patch" /> //-- optional tag, if not given, "mod" is assumed. Can be "mod", "patch", or "weblink".
// if type=="weblink", <Package url> will be opened with the default web browser.
</AquariaMod> </AquariaMod>
<AquariaMod> <AquariaMod>
@ -320,17 +321,18 @@ bool ModDL::ParseModXML(const std::string& fn, bool allowChaining)
while(modx) while(modx)
{ {
std::string namestr, descstr, iconurl, pkgurl, confirmStr, localname; std::string namestr, descstr, iconurl, pkgurl, confirmStr, localname;
std::string sizestr; std::string sizestr, weburl;
bool isPatch = false; ModPackageType pkgtype = MPT_MOD;
int serverSize = 0; int serverSize = 0;
int serverIconSize = 0; int serverIconSize = 0;
TiXmlElement *fullname, *desc, *icon, *pkg, *confirm, *props; TiXmlElement *fullname, *desc, *icon, *pkg, *confirm, *props, *web;
fullname = modx->FirstChildElement("Fullname"); fullname = modx->FirstChildElement("Fullname");
desc = modx->FirstChildElement("Description"); desc = modx->FirstChildElement("Description");
icon = modx->FirstChildElement("Icon"); icon = modx->FirstChildElement("Icon");
pkg = modx->FirstChildElement("Package"); pkg = modx->FirstChildElement("Package");
confirm = modx->FirstChildElement("Confirm"); confirm = modx->FirstChildElement("Confirm");
props = modx->FirstChildElement("Properties"); props = modx->FirstChildElement("Properties");
web = modx->FirstChildElement("Web");
if(fullname && fullname->Attribute("text")) if(fullname && fullname->Attribute("text"))
namestr = fullname->Attribute("text"); namestr = fullname->Attribute("text");
@ -347,7 +349,15 @@ bool ModDL::ParseModXML(const std::string& fn, bool allowChaining)
} }
if(props && props->Attribute("type")) if(props && props->Attribute("type"))
isPatch = !strcmp(props->Attribute("type"), "patch"); {
const char *ty = props->Attribute("type");
if(!strcmp(ty, "patch"))
pkgtype = MPT_PATCH;
else if(!strcmp(ty, "mod"))
pkgtype = MPT_MOD;
else if(!strcmp(ty, "weblink"))
pkgtype = MPT_WEBLINK;
}
if(pkg) if(pkg)
{ {
@ -394,7 +404,7 @@ bool ModDL::ParseModXML(const std::string& fn, bool allowChaining)
ico->confirmStr = confirmStr; ico->confirmStr = confirmStr;
ico->localname = localname; ico->localname = localname;
ico->label = "--[ " + namestr + " ]--\n" + descstr; ico->label = "--[ " + namestr + " ]--\n" + descstr;
ico->isPatch = isPatch; ico->pkgtype = pkgtype;
if(serverSize && dsq->modIsKnown(localname)) if(serverSize && dsq->modIsKnown(localname))
{ {

View file

@ -273,8 +273,6 @@ void ModSelectorScreen::init()
dsq->toggleVersionLabel(false); dsq->toggleVersionLabel(false);
modsIcon->setFocus(true); modsIcon->setFocus(true);
// TODO: keyboard/gamepad control
} }
void ModSelectorScreen::initModAndPatchPanel() void ModSelectorScreen::initModAndPatchPanel()
@ -359,7 +357,6 @@ void ModSelectorScreen::setSubText(const std::string& s)
static void _FadeOutAll(RenderObject *r, float t) static void _FadeOutAll(RenderObject *r, float t)
{ {
//r->shareAlphaWithChildren = true;
r->alpha.interpolateTo(0, t); r->alpha.interpolateTo(0, t);
for(RenderObject::Children::iterator it = r->children.begin(); it != r->children.end(); ++it) for(RenderObject::Children::iterator it = r->children.begin(); it != r->children.end(); ++it)
_FadeOutAll(*it, t); _FadeOutAll(*it, t);
@ -369,7 +366,6 @@ void ModSelectorScreen::close()
{ {
const float t = 0.5f; const float t = 0.5f;
_FadeOutAll(this, t); _FadeOutAll(this, t);
//panels[currentPanel]->scale.interpolateTo(Vector(0.9f, 0.9f), t); // HMM
dsq->user.save(); dsq->user.save();
dsq->toggleVersionLabel(true); dsq->toggleVersionLabel(true);
} }
@ -377,7 +373,6 @@ void ModSelectorScreen::close()
JuicyProgressBar::JuicyProgressBar() : Quad(), txt(&dsq->smallFont) JuicyProgressBar::JuicyProgressBar() : Quad(), txt(&dsq->smallFont)
{ {
setTexture("modselect/tube"); setTexture("modselect/tube");
//shareAlphaWithChildren = true;
followCamera = 1; followCamera = 1;
alpha = 1; alpha = 1;
@ -570,8 +565,6 @@ void ModIcon::loadEntry(const ModEntry& entry)
if (desc->Attribute("text")) if (desc->Attribute("text"))
{ {
ds = desc->Attribute("text"); ds = desc->Attribute("text");
//if (label.size() > 255)
// label.resize(255);
} }
} }
TiXmlElement *fullname = top->FirstChildElement("Fullname"); TiXmlElement *fullname = top->FirstChildElement("Fullname");
@ -618,7 +611,7 @@ void ModIcon::updateStatus()
ModIconOnline::ModIconOnline() ModIconOnline::ModIconOnline()
: SubtitleIcon(), pb(0), extraIcon(0), statusIcon(0), clickable(true), isPatch(false), hasUpdate(false) : SubtitleIcon(), pb(0), extraIcon(0), statusIcon(0), clickable(true), pkgtype(MPT_MOD), hasUpdate(false)
{ {
label = desc; label = desc;
} }
@ -660,7 +653,7 @@ bool ModIconOnline::fixIcon()
quad->setWidthHeight(MOD_ICON_SIZE, MOD_ICON_SIZE); quad->setWidthHeight(MOD_ICON_SIZE, MOD_ICON_SIZE);
quad->alpha.interpolateTo(1, 0.5f); quad->alpha.interpolateTo(1, 0.5f);
if(!extraIcon && isPatch) if(!extraIcon && pkgtype == MPT_PATCH)
{ {
Vector pos(-MOD_ICON_SIZE/2 + MINI_ICON_SIZE/2, MOD_ICON_SIZE/2 - MINI_ICON_SIZE/2); Vector pos(-MOD_ICON_SIZE/2 + MINI_ICON_SIZE/2, MOD_ICON_SIZE/2 - MINI_ICON_SIZE/2);
extraIcon = new Quad("modselect/ico_patch", pos); extraIcon = new Quad("modselect/ico_patch", pos);
@ -721,40 +714,53 @@ void ModIconOnline::onClick()
if(clickable && !packageUrl.empty()) if(clickable && !packageUrl.empty())
{ {
bool proceed = true; bool proceed = true;
if(dsq->modIsKnown(localname)) if(pkgtype == MPT_MOD || pkgtype == MPT_PATCH)
{ {
mouseDown = false; // HACK: do this here else stack overflow! if(dsq->modIsKnown(localname))
if(hasPkgOnDisk())
{ {
if(hasUpdate) mouseDown = false; // HACK: do this here else stack overflow!
proceed = dsq->confirm(dsq->continuity.stringBank.get(2024)); if(hasPkgOnDisk())
{
if(hasUpdate)
proceed = dsq->confirm(dsq->continuity.stringBank.get(2024));
else
proceed = dsq->confirm(dsq->continuity.stringBank.get(2025));
}
else else
proceed = dsq->confirm(dsq->continuity.stringBank.get(2025)); {
dsq->confirm(dsq->continuity.stringBank.get(2026), "", true);
proceed = false;
}
} }
else
if(proceed && confirmStr.length())
{ {
dsq->confirm(dsq->continuity.stringBank.get(2026), "", true); mouseDown = false; // HACK: do this here else stack overflow!
proceed = false; dsq->sound->playSfx("spirit-beacon");
proceed = dsq->confirm(confirmStr);
} }
if(proceed)
{
moddl.GetMod(packageUrl, localname);
setDownloadProgress(0);
success = true;
clickable = false;
}
else
success = true; // we didn't want, anyway
} }
else if(pkgtype == MPT_WEBLINK)
if(proceed && confirmStr.length())
{
mouseDown = false; // HACK: do this here else stack overflow!
dsq->sound->playSfx("spirit-beacon");
proceed = dsq->confirm(confirmStr);
}
if(proceed)
{ {
moddl.GetMod(packageUrl, localname); mouseDown = false;
setDownloadProgress(0); proceed = dsq->confirm(dsq->continuity.stringBank.get(2034));
success = true; if(proceed)
clickable = false; {
openURL(packageUrl);
success = true;
}
} }
else
success = true; // we didn't want, anyway
} }
if(!success) if(!success)
@ -816,7 +822,7 @@ void MenuIconBar::init()
ico = new MenuIcon(0); ico = new MenuIcon(0);
ico->label = dsq->continuity.stringBank.get(2027); ico->label = dsq->continuity.stringBank.get(2027);
ico->useQuad("modselect/hdd"); ico->useQuad("modselect/installed");
y += ico->quad->height; y += ico->quad->height;
ico->position = Vector(0, y); ico->position = Vector(0, y);
add(ico); add(ico);
@ -825,7 +831,7 @@ void MenuIconBar::init()
MenuIcon *prev = ico; MenuIcon *prev = ico;
ico = new MenuIcon(1); ico = new MenuIcon(1);
ico->label = dsq->continuity.stringBank.get(2028); ico->label = dsq->continuity.stringBank.get(2028);
ico->useQuad("modselect/patch"); ico->useQuad("modselect/patches");
y += ico->quad->height; y += ico->quad->height;
ico->position = Vector(0, y); ico->position = Vector(0, y);
ico->setDirMove(DIR_UP, prev); ico->setDirMove(DIR_UP, prev);
@ -835,7 +841,7 @@ void MenuIconBar::init()
prev = ico; prev = ico;
ico = new MenuIcon(2); ico = new MenuIcon(2);
ico->label = dsq->continuity.stringBank.get(2029); ico->label = dsq->continuity.stringBank.get(2029);
ico->useQuad("modselect/globe"); ico->useQuad("modselect/download");
y += ico->quad->height; y += ico->quad->height;
ico->position = Vector(0, y); ico->position = Vector(0, y);
ico->setDirMove(DIR_UP, prev); ico->setDirMove(DIR_UP, prev);
@ -846,7 +852,7 @@ void MenuIconBar::init()
prev = ico; prev = ico;
ico = new MenuIcon(3); ico = new MenuIcon(3);
ico->label = dsq->continuity.stringBank.get(2030); ico->label = dsq->continuity.stringBank.get(2030);
ico->useQuad("gui/wok-drop"); ico->useQuad("modselect/exit");
ico->repeatTextureToFill(false); ico->repeatTextureToFill(false);
y += ico->quad->height; y += ico->quad->height;
ico->position = Vector(0, y); ico->position = Vector(0, y);
@ -863,11 +869,6 @@ void MenuIconBar::add(MenuIcon *ico)
addChild(ico, PM_POINTER); addChild(ico, PM_POINTER);
} }
void MenuArrowBar::init()
{
// TODO: up/down arrow
}
IconGridPanel::IconGridPanel() IconGridPanel::IconGridPanel()
: spacing(0), y(0), x(0) : spacing(0), y(0), x(0)
{ {

View file

@ -4,6 +4,13 @@
#include "AquariaMenuItem.h" #include "AquariaMenuItem.h"
#include "DSQ.h" #include "DSQ.h"
enum ModPackageType
{
MPT_MOD,
MPT_PATCH,
MPT_WEBLINK,
};
class JuicyProgressBar : public Quad class JuicyProgressBar : public Quad
{ {
public: public:
@ -90,8 +97,8 @@ public:
JuicyProgressBar *pb; // visible if downloading JuicyProgressBar *pb; // visible if downloading
Quad *extraIcon; // installed or update available Quad *extraIcon; // installed or update available
Quad *statusIcon; Quad *statusIcon;
ModPackageType pkgtype;
bool clickable; bool clickable;
bool isPatch;
bool hasUpdate; bool hasUpdate;
protected: protected:
@ -118,13 +125,6 @@ protected:
void add(MenuIcon *ico); void add(MenuIcon *ico);
}; };
class MenuArrowBar : public MenuBasicBar
{
public:
virtual void init();
};
class IconGridPanel : public Quad class IconGridPanel : public Quad
{ {
public: public:
@ -168,7 +168,7 @@ public:
protected: protected:
virtual void onUpdate(float dt); virtual void onUpdate(float dt);
MenuIconBar leftbar; MenuIconBar leftbar;
MenuArrowBar rightbar; MenuBasicBar rightbar;
int currentPanel; int currentPanel;
BitmapText subtext; BitmapText subtext;
Quad subbox; Quad subbox;

View file

@ -207,6 +207,7 @@
2031 Any 2031 Any
2032 [Achievements] 2032 [Achievements]
2033 Retrieving online mod list... 2033 Retrieving online mod list...
2034 Open URL in web browser?
2100 === for options menu === 2100 === for options menu ===
2101 Action 2101 Action
2102 Key 1 2102 Key 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -1,12 +0,0 @@
http://www.mricons.com/icon/86682/128/text-patch-icon
http://www.mricons.com/icon/80837/128/drive-harddisk-icon
http://commons.wikimedia.org/wiki/File:Deer_Park_Globe.png
http://www.iconfinder.com/icondetails/3839/48/alert_arrow_download_exclamation_orange_update_icon
http://www.iconfinder.com/icondetails/52296/48/checkmark_tick_icon
http://www.mricons.com/icon/28252/32/patch-icon
http://www.iconfinder.com/icondetails/21179/32/cancel_dialog_error_gtk_icon

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB