add a button to show the save uploading rules inside the save upload dialog

This commit is contained in:
jacob1 2013-03-15 20:32:39 -04:00
parent cd8ea8ad0e
commit 2267f34386
6 changed files with 82 additions and 11 deletions

View File

@ -1632,7 +1632,8 @@ int luatpt_message_box(lua_State* l)
{
std::string title = std::string(luaL_optstring(l, 1, "Title"));
std::string message = std::string(luaL_optstring(l, 2, "Message"));
new InformationMessage(title, message);
int large = luaL_optint(l, 1, 0);
new InformationMessage(title, message, large);
return 0;
}
int luatpt_get_numOfParts(lua_State* l)

View File

@ -2,21 +2,44 @@
#include "InformationMessage.h"
#include "interface/Button.h"
#include "interface/Label.h"
#include "interface/ScrollPanel.h"
InformationMessage::InformationMessage(std::string title, std::string message):
InformationMessage::InformationMessage(std::string title, std::string message, bool large):
ui::Window(ui::Point(-1, -1), ui::Point(200, 75))
{
if (large) //Maybe also use this large mode for changelogs eventually, or have it as a customizable size?
{
Size.X += 200;
Size.Y += 175;
}
if (large)
{
ui::ScrollPanel *messagePanel = new ui::ScrollPanel(ui::Point(4, 24), ui::Point(Size.X-8, 206));
AddComponent(messagePanel);
ui::Label * messageLabel = new ui::Label(ui::Point(4, 0), ui::Point(Size.X-28, -1), message);
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
messageLabel->SetMultiline(true);
messagePanel->AddChild(messageLabel);
messagePanel->InnerSize = ui::Point(messagePanel->Size.X, messageLabel->Size.Y+4);
}
else
{
ui::Label * messageLabel = new ui::Label(ui::Point(4, 24), ui::Point(Size.X-8, 60), message);
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
AddComponent(messageLabel);
}
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 16), title);
titleLabel->SetTextColour(style::Colour::InformationTitle);
titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
AddComponent(titleLabel);
ui::Label * messageLabel = new ui::Label(ui::Point(4, 24), ui::Point(Size.X-8, 60), message);
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
AddComponent(messageLabel);
class DismissAction: public ui::ButtonAction
{
InformationMessage * message;

View File

@ -5,7 +5,7 @@
class InformationMessage: public ui::Window {
public:
InformationMessage(std::string title, std::string message);
InformationMessage(std::string title, std::string message, bool large);
virtual void OnDraw();
virtual ~InformationMessage();
};

View File

@ -267,7 +267,7 @@ void GameController::PlaceSave(ui::Point position)
void GameController::Install()
{
#if defined(MACOSX)
new InformationMessage("No Installation necessary", "You don't need to install The Powder Toy on Mac OS X");
new InformationMessage("No Installation necessary", "You don't need to install The Powder Toy on Mac OS X", false);
#elif defined(WIN) || defined(LIN)
class InstallConfirmation: public ConfirmDialogueCallback {
public:
@ -278,7 +278,7 @@ void GameController::Install()
{
if(Client::Ref().DoInstallation())
{
new InformationMessage("Install Success", "The installation completed!");
new InformationMessage("Install Success", "The installation completed!", false);
}
else
{

View File

@ -6,6 +6,7 @@
#include "client/requestbroker/RequestBroker.h"
#include "dialogues/ErrorMessage.h"
#include "dialogues/ConfirmPrompt.h"
#include "dialogues/InformationMessage.h"
#include "client/Client.h"
#include "tasks/Task.h"
#include "Style.h"
@ -33,6 +34,17 @@ public:
}
};
class ServerSaveActivity::RulesAction: public ui::ButtonAction
{
ServerSaveActivity * a;
public:
RulesAction(ServerSaveActivity * a) : a(a) {}
virtual void ActionCallback(ui::Button * sender)
{
a->ShowRules();
}
};
class SaveUploadTask: public Task
{
SaveInfo save;
@ -130,6 +142,14 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
AddComponent(okayButton);
SetOkayButton(okayButton);
//Position.X+(Size.X/2)+((Size.X/2)-thumbnail->Width)/2, Position.Y+25, thumbnail->Width, thumbnail->Height
ui::Button * RulesButton = new ui::Button(ui::Point((Size.X*3/4)-75, Size.Y-20), ui::Point(150, 16), "Save Uploading Rules");
RulesButton->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
RulesButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
RulesButton->Appearance.TextInactive = style::Colour::InformationTitle;
RulesButton->SetActionCallback(new RulesAction(this));
AddComponent(RulesButton);
if(save.GetGameSave())
RequestBroker::Ref().RenderThumbnail(save.GetGameSave(), false, true, (Size.X/2)-16, -1, this);
}
@ -189,7 +209,7 @@ void ServerSaveActivity::Save()
{
if(Client::Ref().GetAuthUser().Username != save.GetUserName() && publishedCheckbox->GetChecked())
{
new ConfirmPrompt("Publish", "This save was created by " + save.GetUserName() + ", you're about to publish this under your own name; If you haven't been given permission by the author to do so, please untick the publish box, otherwise continue", new PublishConfirmation(this));
new ConfirmPrompt("Publish", "This save was created by " + save.GetUserName() + ", you're about to publish this under your own name; If you haven't been given permission by the author to do so, please uncheck the publish box, otherwise continue", new PublishConfirmation(this));
}
else
{
@ -227,6 +247,30 @@ void ServerSaveActivity::Exit()
WindowActivity::Exit();
}
void ServerSaveActivity::ShowRules()
{
const char *rules =
"These are the rules you should follow when uploading saves. They may change at any time as new problems arise, and how each rule is handled changes depending on the situation.\n"
"\n"
"\bt1. No image plotting.\bw If you use a program to draw out pixels from an image outside of TPT without drawing it by hand, then don't be surprised when it gets deleted and you get banned.\n"
"\bt2. No self voting.\bw This means making more than one account, and then using that account to vote on any save multiple times. We can see this stuff, and people get banned for doing this. Don't do it.\n"
"\bt3. No hate saves.\bw This means things like shooting Jews or killing Beiber, these will not be allowed.\n"
"\bt4. No penis drawings.\bw Or any other explicit or non-explicit sex please. We like to think this is a game that kids can play, don't post anything too inappropriate for children.\n"
"\bt5. Don't ask people to vote.\bw If your stuff is awesome, you shouldn't have to beg for popularity to make it so. People tend to downvote when they see a lot of vote begging anyway.\n"
"- This includes vote signs in the game, drawings of vote arrows, and comments on the save telling people to vote up.\n"
"- Gimmicks for getting votes like '100 votes and I'll make a better version' are similarly frowned upon.\n"
"\bt6. Keep the number of logos and signs to a minimum.\bw They not only slow the game down, but it makes saves unappealing for people to use. \n"
"\bt7. Please don't swear excessively.\bw Saves containing excessive swearing or rude language will be unpublished. Don't make rude or offensive comments either.\n"
"\bt8. Don't make text only saves.\bw Saves are much better when they actually use some of the features in the game. Text only saves will be removed from the front page if they should get there.\n"
"- This also relates to art on the front page. Art saves that rely only on the deco layer are generally removed. Other art using elements may stay longer if they are more impressive.\n"
"\bt9. Don't claim other's work as your own.\bw If you didn't make it, don't resave it for yourself. You can fav. a save if you want to see it later instead of publishing a copy.\n"
"- This doesn't mean you can't modify or improve saves, building on the works of others in encouraged. If you give credit to the original author, it is usually ok to do resave unless the author specifically prohibits it.\n"
"\n"
"You can report a save breaking any one of these rules, the moderators are busy in real life too and don't always have the time to search through all the saves for these kinds of things. If reporting a copied save, just give the id of the original, but if not an id isn't needed.";
new InformationMessage("Save Uploading Rules", rules, true);
}
void ServerSaveActivity::OnTick(float dt)
{
if(saveUploadTask)

View File

@ -28,6 +28,7 @@ public:
void saveUpload();
virtual void Save();
virtual void Exit();
virtual void ShowRules();
virtual void OnDraw();
virtual void OnRequestReady(void * imagePtr);
virtual void OnTick(float dt);
@ -44,6 +45,8 @@ protected:
ui::Checkbox * pausedCheckbox;
class CancelAction;
class SaveAction;
class RulesAction;
friend class CancelAction;
friend class SaveAction;
friend class RulesAction;
};