mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-19 22:43:32 +00:00
REMOVE: license verification and BuyGame btns/screens
This commit is contained in:
@@ -96,9 +96,6 @@ public:
|
||||
virtual std::string getDateString(int s) { return ""; }
|
||||
//virtual void createUserInputScreen(const char* types) {}
|
||||
|
||||
virtual int checkLicense() { return 0; }
|
||||
virtual bool hasBuyButtonWhenInvalidLicense() { return false; }
|
||||
|
||||
virtual void uploadPlatformDependentData(int id, void* data) {}
|
||||
virtual BinaryBlob readAssetFile(const std::string& filename) { return BinaryBlob(); }
|
||||
virtual void _tick() {}
|
||||
@@ -117,8 +114,6 @@ public:
|
||||
virtual bool isSuperFast() = 0;
|
||||
#endif
|
||||
|
||||
virtual void buyGame() {}
|
||||
|
||||
virtual void openURL(const std::string& url) {}
|
||||
|
||||
virtual void finish() {}
|
||||
|
||||
@@ -68,9 +68,6 @@ public:
|
||||
|
||||
_methodGetDateString(0),
|
||||
|
||||
_methodCheckLicense(0),
|
||||
_methodHasBuyButton(0),
|
||||
_methodBuyGame(0),
|
||||
_methodVibrate(0),
|
||||
_methodSupportsTouchscreen(0),
|
||||
_methodSetIsPowerVR(0),
|
||||
@@ -147,10 +144,6 @@ public:
|
||||
|
||||
_methodGetDateString = env->GetMethodID( _activityClass, "getDateString", "(I)Ljava/lang/String;");
|
||||
|
||||
_methodCheckLicense = env->GetMethodID( _activityClass, "checkLicense", "()I");
|
||||
_methodHasBuyButton = env->GetMethodID( _activityClass, "hasBuyButtonWhenInvalidLicense", "()Z");
|
||||
_methodBuyGame = env->GetMethodID( _activityClass, "buyGame", "()V");
|
||||
|
||||
_methodVibrate = env->GetMethodID( _activityClass, "vibrate", "(I)V");
|
||||
_methodSupportsTouchscreen = env->GetMethodID( _activityClass, "supportsTouchscreen", "()Z");
|
||||
_methodSetIsPowerVR = env->GetMethodID( _activityClass, "setIsPowerVR", "(Z)V");
|
||||
@@ -473,36 +466,6 @@ public:
|
||||
return out;
|
||||
}
|
||||
|
||||
int checkLicense() {
|
||||
if (!_isInited) return -2;
|
||||
if (!_methodCheckLicense) return -2;
|
||||
|
||||
JVMAttacher ta(_vm);
|
||||
JNIEnv* env = ta.getEnv();
|
||||
|
||||
return env->CallIntMethod(instance, _methodCheckLicense);
|
||||
}
|
||||
|
||||
bool hasBuyButtonWhenInvalidLicense() {
|
||||
if (!_isInited) return false;
|
||||
if (!_methodHasBuyButton) return false;
|
||||
|
||||
JVMAttacher ta(_vm);
|
||||
JNIEnv* env = ta.getEnv();
|
||||
|
||||
return JNI_TRUE == env->CallBooleanMethod(instance, _methodHasBuyButton);
|
||||
}
|
||||
|
||||
void buyGame() {
|
||||
if (!_isInited) return;
|
||||
if (!_methodBuyGame) return;
|
||||
|
||||
JVMAttacher ta(_vm);
|
||||
JNIEnv* env = ta.getEnv();
|
||||
|
||||
env->CallVoidMethod(instance, _methodBuyGame);
|
||||
}
|
||||
|
||||
virtual void finish() {
|
||||
if (!_isInited) return;
|
||||
if (!_methodFinish) return;
|
||||
@@ -644,10 +607,6 @@ private:
|
||||
|
||||
jmethodID _methodGetDateString;
|
||||
|
||||
jmethodID _methodCheckLicense;
|
||||
jmethodID _methodHasBuyButton;
|
||||
jmethodID _methodBuyGame;
|
||||
|
||||
jmethodID _getScreenWidth;
|
||||
jmethodID _getScreenHeight;
|
||||
jmethodID _methodGetPixelsPerMillimeter;
|
||||
|
||||
@@ -111,28 +111,19 @@ public:
|
||||
return std::string(mbstr);
|
||||
}
|
||||
|
||||
virtual int checkLicense() {
|
||||
static int _z = 0;//20;
|
||||
_z--;
|
||||
if (_z < 0) return 0;
|
||||
//if (_z < 0) return 107;
|
||||
return -2;
|
||||
}
|
||||
|
||||
virtual int getScreenWidth() { return 854; };
|
||||
virtual int getScreenHeight() { return 480; };
|
||||
|
||||
virtual float getPixelsPerMillimeter();
|
||||
|
||||
virtual bool supportsTouchscreen() { return true; }
|
||||
virtual bool hasBuyButtonWhenInvalidLicense() { return false; }
|
||||
|
||||
virtual void openURL(const std::string& url) {
|
||||
#ifdef _WIN32
|
||||
ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
#elif __linux__
|
||||
std::string command = "xdg-open " + url;
|
||||
system(command.c_str());
|
||||
std::string command = "xdg-open " + url;
|
||||
system(command.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -41,17 +41,6 @@ public:
|
||||
|
||||
std::string getDateString(int s);
|
||||
|
||||
virtual int checkLicense() {
|
||||
return 0;
|
||||
static int _z = 20;
|
||||
_z--;
|
||||
if (_z < 0) return 0;
|
||||
//if (_z < 0) return 107;
|
||||
return -2;
|
||||
}
|
||||
|
||||
virtual void buyGame();
|
||||
|
||||
virtual int getScreenWidth();
|
||||
virtual int getScreenHeight();
|
||||
virtual float getPixelsPerMillimeter();
|
||||
|
||||
@@ -175,10 +175,6 @@ BinaryBlob AppPlatform_iOS::readAssetFile(const std::string& filename_) {
|
||||
return BinaryBlob(bytes, numBytes);
|
||||
}
|
||||
|
||||
void AppPlatform_iOS::buyGame() {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=479516143&mt=8"]];
|
||||
}
|
||||
|
||||
std::string AppPlatform_iOS::getDateString(int s) {
|
||||
|
||||
NSDate* date = [NSDate dateWithTimeIntervalSince1970:s];
|
||||
|
||||
@@ -14,4 +14,3 @@ float AppPlatform_win32::getPixelsPerMillimeter() {
|
||||
}
|
||||
|
||||
bool AppPlatform_win32::supportsTouchscreen() { return true; }
|
||||
bool AppPlatform_win32::hasBuyButtonWhenInvalidLicense() { return true; }
|
||||
|
||||
@@ -111,21 +111,12 @@ public:
|
||||
return std::string(mbstr);
|
||||
}
|
||||
|
||||
virtual int checkLicense() {
|
||||
static int _z = 0;//20;
|
||||
_z--;
|
||||
if (_z < 0) return 0;
|
||||
//if (_z < 0) return 107;
|
||||
return -2;
|
||||
}
|
||||
|
||||
virtual int getScreenWidth();
|
||||
virtual int getScreenHeight();
|
||||
|
||||
virtual float getPixelsPerMillimeter();
|
||||
|
||||
virtual bool supportsTouchscreen();
|
||||
virtual bool hasBuyButtonWhenInvalidLicense();
|
||||
|
||||
virtual void openURL(const std::string& url) {
|
||||
ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
|
||||
@@ -1455,12 +1455,6 @@ LevelStorageSource* Minecraft::getLevelSource()
|
||||
return storageSource;
|
||||
}
|
||||
|
||||
int Minecraft::getLicenseId() {
|
||||
if (!LicenseCodes::isReady(_licenseId))
|
||||
_licenseId = platform()->checkLicense();
|
||||
return _licenseId;
|
||||
}
|
||||
|
||||
void Minecraft::audioEngineOn() {
|
||||
#ifndef STANDALONE_SERVER
|
||||
soundEngine->enable(true);
|
||||
|
||||
@@ -109,7 +109,6 @@ public:
|
||||
void onGraphicsReset();
|
||||
|
||||
bool isLevelGenerated();
|
||||
int getLicenseId();
|
||||
|
||||
void audioEngineOn();
|
||||
void audioEngineOff();
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
|
||||
class BuyGameScreen: public Screen
|
||||
{
|
||||
public:
|
||||
BuyGameScreen() {}
|
||||
virtual ~BuyGameScreen() {}
|
||||
|
||||
void init();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button) {
|
||||
//if (button->id == bQuit.id)
|
||||
}
|
||||
|
||||
private:
|
||||
//Button bQuit;
|
||||
//Button bBuyGame;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__*/
|
||||
@@ -1,107 +0,0 @@
|
||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__
|
||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include "../../../LicenseCodes.h"
|
||||
|
||||
class InvalidLicenseScreen: public Screen
|
||||
{
|
||||
public:
|
||||
InvalidLicenseScreen(int id, bool hasBuyButton)
|
||||
: _id(id),
|
||||
_hasBuyButton(hasBuyButton),
|
||||
_baseY(0),
|
||||
bOk(0),
|
||||
bBuy(0)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~InvalidLicenseScreen() {
|
||||
delete bOk;
|
||||
delete bBuy;
|
||||
}
|
||||
|
||||
void init() {
|
||||
if (minecraft->useTouchscreen()) {
|
||||
bOk = new Touch::TButton(1, "Ok");
|
||||
bBuy = new Touch::TButton(2, "Buy");
|
||||
} else {
|
||||
bOk = new Button(1, "Ok");
|
||||
bBuy = new Button(2, "Buy");
|
||||
}
|
||||
|
||||
if (_hasBuyButton)
|
||||
bOk->msg = "Quit";
|
||||
|
||||
if (!LicenseCodes::isOk(_id)) {
|
||||
char buf[20] = {0};
|
||||
sprintf(buf, "%d", _id);
|
||||
|
||||
desc1 = "License verification failed (error ";
|
||||
desc1 += buf;
|
||||
desc1 += ")";
|
||||
desc2 = "Try again later.";
|
||||
hint = "You need to be connected to the internet\n";
|
||||
hint += "once while you start the game.";
|
||||
}
|
||||
|
||||
buttons.push_back(bOk);
|
||||
tabButtons.push_back(bOk);
|
||||
|
||||
if (_hasBuyButton) {
|
||||
buttons.push_back(bBuy);
|
||||
tabButtons.push_back(bBuy);
|
||||
}
|
||||
}
|
||||
|
||||
void setupPositions() {
|
||||
_baseY = height/5 + 6;
|
||||
//if (_hasBuyButton)
|
||||
_baseY -= 24;
|
||||
|
||||
bOk->width = bBuy->width = 200;
|
||||
bOk->x = bBuy->x = (width - bOk->width) / 2;
|
||||
bBuy->y = _baseY + 84;
|
||||
bOk->y = bBuy->y + bBuy->height + 4;
|
||||
|
||||
if (!_hasBuyButton)
|
||||
bOk->y -= 24;
|
||||
}
|
||||
|
||||
void tick() {}
|
||||
|
||||
//void keyPressed(int eventKey) {}
|
||||
|
||||
void render(int xm, int ym, float a) {
|
||||
renderDirtBackground(0);
|
||||
drawCenteredString(minecraft->font, desc1, width/2, _baseY, 0xffffff);
|
||||
drawCenteredString(minecraft->font, desc2, width/2, _baseY + 24, 0xffffff);
|
||||
|
||||
drawCenteredString(minecraft->font, hint, width/2, _baseY + 60, 0xffffff);
|
||||
|
||||
Screen::render(xm, ym, a);
|
||||
}
|
||||
|
||||
void buttonClicked(Button* button) {
|
||||
if (button->id == bOk->id) {
|
||||
minecraft->quit();
|
||||
}
|
||||
if (button->id == bBuy->id) {
|
||||
minecraft->platform()->buyGame();
|
||||
}
|
||||
};
|
||||
private:
|
||||
int _id;
|
||||
std::string desc1;
|
||||
std::string desc2;
|
||||
std::string hint;
|
||||
|
||||
Button* bOk;
|
||||
Button* bBuy;
|
||||
bool _hasBuyButton;
|
||||
int _baseY;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__*/
|
||||
@@ -5,9 +5,7 @@
|
||||
#include "JoinGameScreen.h"
|
||||
#include "OptionsScreen.h"
|
||||
#include "PauseScreen.h"
|
||||
#include "InvalidLicenseScreen.h"
|
||||
#include "PrerenderTilesScreen.h" // test button
|
||||
//#include "BuyGameScreen.h"
|
||||
|
||||
#include "../../../util/Mth.h"
|
||||
|
||||
@@ -27,9 +25,7 @@
|
||||
StartMenuScreen::StartMenuScreen()
|
||||
: bHost( 2, 0, 0, 160, 24, "Start Game"),
|
||||
bJoin( 3, 0, 0, 160, 24, "Join Game"),
|
||||
bOptions( 4, 0, 0, 78, 22, "Options"),
|
||||
bBuy( 5, 0, 0, 78, 22, "Buy"),
|
||||
bTest( 999, 0, 0, 78, 22, "Create")
|
||||
bOptions( 4, 0, 0, 78, 22, "Options")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -39,6 +35,9 @@ StartMenuScreen::~StartMenuScreen()
|
||||
|
||||
void StartMenuScreen::init()
|
||||
{
|
||||
|
||||
bJoin.active = bHost.active = bOptions.active = true;
|
||||
|
||||
if (minecraft->options.username.empty()) {
|
||||
return; // tick() will redirect to UsernameScreen
|
||||
}
|
||||
@@ -94,14 +93,12 @@ void StartMenuScreen::setupPositions() {
|
||||
#endif
|
||||
|
||||
bOptions.y = yBase + 28 + 2;
|
||||
bTest.y = bBuy.y = bOptions.y;
|
||||
//#endif
|
||||
|
||||
// Center buttons
|
||||
bHost.x = (width - bHost.width) / 2;
|
||||
bJoin.x = (width - bJoin.width) / 2;
|
||||
bOptions.x = (width - bJoin.width) / 2;
|
||||
bTest.x = bBuy.x = bOptions.x + bOptions.width + 4;
|
||||
|
||||
copyrightPosX = width - minecraft->font->width(copyright) - 1;
|
||||
versionPosX = (width - minecraft->font->width(version)) / 2;// - minecraft->font->width(version) - 2;
|
||||
@@ -112,7 +109,6 @@ void StartMenuScreen::tick() {
|
||||
minecraft->setScreen(new UsernameScreen());
|
||||
return;
|
||||
}
|
||||
_updateLicense();
|
||||
}
|
||||
|
||||
void StartMenuScreen::buttonClicked(Button* button) {
|
||||
@@ -134,16 +130,6 @@ void StartMenuScreen::buttonClicked(Button* button) {
|
||||
{
|
||||
minecraft->setScreen(new OptionsScreen());
|
||||
}
|
||||
if (button->id == bTest.id)
|
||||
{
|
||||
//minecraft->setScreen(new PauseScreen());
|
||||
//minecraft->setScreen(new PrerenderTilesScreen());
|
||||
}
|
||||
if (button->id == bBuy.id)
|
||||
{
|
||||
minecraft->platform()->buyGame();
|
||||
//minecraft->setScreen(new BuyGameScreen());
|
||||
}
|
||||
}
|
||||
|
||||
bool StartMenuScreen::isInGameScreen() { return false; }
|
||||
@@ -202,23 +188,6 @@ void StartMenuScreen::render( int xm, int ym, float a )
|
||||
}
|
||||
}
|
||||
|
||||
void StartMenuScreen::_updateLicense()
|
||||
{
|
||||
int id = minecraft->getLicenseId();
|
||||
if (LicenseCodes::isReady(id))
|
||||
{
|
||||
if (LicenseCodes::isOk(id))
|
||||
bJoin.active = bHost.active = bOptions.active = true;
|
||||
else
|
||||
{
|
||||
bool hasBuyButton = minecraft->platform()->hasBuyButtonWhenInvalidLicense();
|
||||
minecraft->setScreen(new InvalidLicenseScreen(id, hasBuyButton));
|
||||
}
|
||||
} else {
|
||||
bJoin.active = bHost.active = bOptions.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
void StartMenuScreen::mouseClicked(int x, int y, int buttonNum) {
|
||||
const int logoX = 2;
|
||||
const int logoW = 8 + 2 + font->width("Kolyah35/minecraft-pe-0.6.1");
|
||||
|
||||
@@ -21,13 +21,10 @@ public:
|
||||
bool handleBackEvent(bool isDown);
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
void _updateLicense();
|
||||
|
||||
Button bHost;
|
||||
Button bJoin;
|
||||
Button bOptions;
|
||||
Button bTest;
|
||||
Button bBuy;
|
||||
|
||||
std::string copyright;
|
||||
int copyrightPosX;
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#include "../ProgressScreen.h"
|
||||
#include "../OptionsScreen.h"
|
||||
#include "../PauseScreen.h"
|
||||
#include "../InvalidLicenseScreen.h"
|
||||
//#include "BuyGameScreen.h"
|
||||
|
||||
#include "../../Font.h"
|
||||
#include "../../components/SmallButton.h"
|
||||
@@ -22,62 +20,6 @@
|
||||
#include "../DialogDefinitions.h"
|
||||
#include "../SimpleChooseLevelScreen.h"
|
||||
|
||||
//
|
||||
// Buy Button implementation
|
||||
//
|
||||
BuyButton::BuyButton(int id)
|
||||
: super(id, "")
|
||||
{
|
||||
ImageDef def;
|
||||
// Setup the source rectangle
|
||||
def.setSrc(IntRectangle(64, 182, 190, 55));
|
||||
def.width = 75;//rc.w / 3;
|
||||
def.height = 75 * (55.0f / 190.0f);//rc.h / 3;
|
||||
def.name = "gui/gui.png";
|
||||
|
||||
setImageDef(def, true);
|
||||
}
|
||||
|
||||
void BuyButton::render(Minecraft* minecraft, int xm, int ym) {
|
||||
glColor4f2(1, 1, 1, 1);
|
||||
bool hovered = active && (minecraft->useTouchscreen()? (xm >= x && ym >= y && xm < x + width && ym < y + height) : false);
|
||||
renderBg(minecraft, xm, ym);
|
||||
TextureId texId = (_imageDef.name.length() > 0)? minecraft->textures->loadAndBindTexture(_imageDef.name) : Textures::InvalidId;
|
||||
if ( Textures::isTextureIdValid(texId) ) {
|
||||
const ImageDef& d = _imageDef;
|
||||
Tesselator& t = Tesselator::instance;
|
||||
|
||||
t.begin();
|
||||
if (!active) t.color(0xff808080);
|
||||
else if (hovered||selected) t.color(0xffcccccc);
|
||||
//else t.color(0xffe0e0e0);
|
||||
else t.color(0xffffffff);
|
||||
|
||||
float hx = ((float) d.width) * 0.5f;
|
||||
float hy = ((float) d.height) * 0.5f;
|
||||
const float cx = ((float)x+d.x) + hx;
|
||||
const float cy = ((float)y+d.y) + hy;
|
||||
if (hovered) {
|
||||
hx *= 0.95f;
|
||||
hy *= 0.95f;
|
||||
}
|
||||
|
||||
const TextureData* td = minecraft->textures->getTemporaryTextureData(texId);
|
||||
const IntRectangle* src = _imageDef.getSrc();
|
||||
if (td != NULL && src != NULL) {
|
||||
float u0 = (src->x) / (float)td->w;
|
||||
float u1 = (src->x+src->w) / (float)td->w;
|
||||
float v0 = (src->y) / (float)td->h;
|
||||
float v1 = (src->y+src->h) / (float)td->h;
|
||||
t.vertexUV(cx-hx, cy-hy, blitOffset, u0, v0);
|
||||
t.vertexUV(cx-hx, cy+hy, blitOffset, u0, v1);
|
||||
t.vertexUV(cx+hx, cy+hy, blitOffset, u1, v1);
|
||||
t.vertexUV(cx+hx, cy-hy, blitOffset, u1, v0);
|
||||
}
|
||||
t.draw();
|
||||
}
|
||||
}
|
||||
|
||||
namespace Touch {
|
||||
|
||||
//
|
||||
@@ -88,8 +30,7 @@ namespace Touch {
|
||||
StartMenuScreen::StartMenuScreen()
|
||||
: bHost( 2, "Start Game"),
|
||||
bJoin( 3, "Join Game"),
|
||||
bOptions( 4, "Options"),
|
||||
bBuy( 5)
|
||||
bOptions( 4, "Options")
|
||||
{
|
||||
ImageDef def;
|
||||
bJoin.width = 75;
|
||||
@@ -148,7 +89,7 @@ void StartMenuScreen::init()
|
||||
version = versionString + " (Demo)";
|
||||
#endif
|
||||
|
||||
bJoin.active = bHost.active = bOptions.active = false;
|
||||
bJoin.active = bHost.active = bOptions.active = true;
|
||||
}
|
||||
|
||||
void StartMenuScreen::setupPositions() {
|
||||
@@ -166,20 +107,11 @@ void StartMenuScreen::setupPositions() {
|
||||
bJoin.x = 0*buttonWidth + (int)(1*spacing);
|
||||
bHost.x = 1*buttonWidth + (int)(2*spacing);
|
||||
bOptions.x = 2*buttonWidth + (int)(3*spacing);
|
||||
//bBuy.y = bOptions.y - bBuy.h - 6;
|
||||
//bBuy.x = bOptions.x + bOptions.w - bBuy.w;
|
||||
|
||||
bBuy.y = height - bBuy.height - 3;
|
||||
bBuy.x = (width - bBuy.width) / 2;
|
||||
|
||||
copyrightPosX = width - minecraft->font->width(copyright) - 1;
|
||||
versionPosX = (width - minecraft->font->width(version)) / 2;// - minecraft->font->width(version) - 2;
|
||||
}
|
||||
|
||||
void StartMenuScreen::tick() {
|
||||
_updateLicense();
|
||||
}
|
||||
|
||||
void StartMenuScreen::buttonClicked(::Button* button) {
|
||||
|
||||
if (button->id == bHost.id)
|
||||
@@ -203,11 +135,6 @@ void StartMenuScreen::buttonClicked(::Button* button) {
|
||||
{
|
||||
minecraft->setScreen(new OptionsScreen());
|
||||
}
|
||||
if (button->id == bBuy.id)
|
||||
{
|
||||
minecraft->platform()->buyGame();
|
||||
//minecraft->setScreen(new BuyGameScreen());
|
||||
}
|
||||
}
|
||||
|
||||
bool StartMenuScreen::isInGameScreen() { return false; }
|
||||
@@ -256,22 +183,6 @@ void StartMenuScreen::render( int xm, int ym, float a )
|
||||
glDisable2(GL_BLEND);
|
||||
}
|
||||
|
||||
void StartMenuScreen::_updateLicense()
|
||||
{
|
||||
int id = minecraft->getLicenseId();
|
||||
if (LicenseCodes::isReady(id))
|
||||
{
|
||||
if (LicenseCodes::isOk(id))
|
||||
bJoin.active = bHost.active = bOptions.active = true;
|
||||
else
|
||||
{
|
||||
bool hasBuyButton = minecraft->platform()->hasBuyButtonWhenInvalidLicense();
|
||||
minecraft->setScreen(new InvalidLicenseScreen(id, hasBuyButton));
|
||||
}
|
||||
} else {
|
||||
bJoin.active = bHost.active = bOptions.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
void StartMenuScreen::mouseClicked(int x, int y, int buttonNum) {
|
||||
const int logoX = 2;
|
||||
|
||||
@@ -5,14 +5,6 @@
|
||||
#include "../../components/LargeImageButton.h"
|
||||
#include "../../components/TextBox.h"
|
||||
|
||||
class BuyButton: public ImageButton {
|
||||
typedef ImageButton super;
|
||||
public:
|
||||
BuyButton(int id);
|
||||
void render(Minecraft* minecraft, int xm, int ym);
|
||||
};
|
||||
|
||||
|
||||
namespace Touch {
|
||||
|
||||
class StartMenuScreen: public Screen
|
||||
@@ -23,8 +15,7 @@ public:
|
||||
|
||||
void init();
|
||||
void setupPositions();
|
||||
|
||||
void tick();
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
void buttonClicked(Button* button);
|
||||
@@ -32,12 +23,10 @@ public:
|
||||
bool handleBackEvent(bool isDown);
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
void _updateLicense();
|
||||
|
||||
LargeImageButton bHost;
|
||||
LargeImageButton bJoin;
|
||||
LargeImageButton bOptions;
|
||||
BuyButton bBuy;
|
||||
|
||||
std::string copyright;
|
||||
int copyrightPosX;
|
||||
|
||||
Reference in New Issue
Block a user