Magic_Ling_Pixel_Dungeon/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AboutScene.java

170 lines
5.4 KiB
Java
Raw Normal View History

2014-07-27 13:39:07 +00:00
/*
* Pixel Dungeon
2015-06-12 20:44:04 +00:00
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2015 Evan Debenham
2014-07-27 13:39:07 +00:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.scenes;
2014-07-27 13:39:07 +00:00
import android.content.Intent;
import android.net.Uri;
2014-10-18 08:56:57 +00:00
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
2014-07-27 13:39:07 +00:00
import com.watabou.input.Touchscreen.Touch;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.TouchArea;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
2014-07-27 13:39:07 +00:00
public class AboutScene extends PixelScene {
private static final String TTL_SHPX = "Shattered Pixel Dungeon";
2014-09-09 05:05:53 +00:00
private static final String TXT_SHPX =
"Design, Code, & Graphics: Evan\n\n" +
"Shattered Pixel is Evan's online home, check it out:";
2014-09-09 05:05:53 +00:00
private static final String LNK_SHPX = "ShatteredPixel.com";
2014-09-09 05:05:53 +00:00
private static final String TTL_WATA = "Original Pixel Dungeon";
2014-09-09 05:05:53 +00:00
private static final String TXT_WATA =
"Code & Graphics: Watabou\n" +
"Music: Cube_Code\n\n" +
"Visit Watabou for more info:";
2014-07-27 13:39:07 +00:00
2014-09-09 05:05:53 +00:00
private static final String LNK_WATA = "pixeldungeon.watabou.ru";
2014-07-27 13:39:07 +00:00
@Override
public void create() {
super.create();
2014-09-09 05:05:53 +00:00
final float colWidth = Camera.main.width / (ShatteredPixelDungeon.landscape() ? 2 : 1);
final float colTop = (Camera.main.height / 2) - (ShatteredPixelDungeon.landscape() ? 30 : 90);
final float wataOffset = ShatteredPixelDungeon.landscape() ? colWidth : 0;
Image shpx = Icons.SHPX.get();
shpx.x = align( (colWidth - shpx.width()) / 2 );
shpx.y = align( colTop );
add( shpx );
new Flare( 7, 64 ).color( 0x225511, true ).show( shpx, 0 ).angularSpeed = +20;
BitmapTextMultiline shpxtitle = createMultiline( TTL_SHPX, 8 );
shpxtitle.maxWidth = (int) Math.min( colWidth, 120 );
shpxtitle.measure();
shpxtitle.hardlight( Window.SHPX_COLOR );
add( shpxtitle );
shpxtitle.x = align( (colWidth - shpxtitle.width()) / 2 );
shpxtitle.y = align( shpx.y + shpx.height + 5 );
BitmapTextMultiline shpxtext = createMultiline( TXT_SHPX, 8 );
shpxtext.maxWidth = shpxtitle.maxWidth;
shpxtext.measure();
add( shpxtext );
shpxtext.x = align( (colWidth - shpxtext.width()) / 2 );
shpxtext.y = align( shpxtitle.y + shpxtitle.height() + 12 );
BitmapTextMultiline shpxlink = createMultiline( LNK_SHPX, 8 );
shpxlink.maxWidth = shpxtitle.maxWidth;
shpxlink.measure();
shpxlink.hardlight( Window.SHPX_COLOR );
add( shpxlink );
shpxlink.x = shpxtext.x;
shpxlink.y = shpxtext.y + shpxtext.height();
TouchArea shpxhotArea = new TouchArea( shpxlink ) {
@Override
protected void onClick( Touch touch ) {
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://" + LNK_SHPX ) );
Game.instance.startActivity( intent );
}
};
add( shpxhotArea );
Image wata = Icons.WATA.get();
wata.x = align( wataOffset + (colWidth - wata.width()) / 2 );
wata.y = align( ShatteredPixelDungeon.landscape() ?
colTop:
shpxlink.y + wata.height + 20);
add( wata );
new Flare( 7, 64 ).color( 0x112233, true ).show( wata, 0 ).angularSpeed = +20;
BitmapTextMultiline wataTitle = createMultiline( TTL_WATA, 8 );
wataTitle.maxWidth = (int) Math.min( colWidth, 120 );
wataTitle.measure();
wataTitle.hardlight(Window.TITLE_COLOR);
add( wataTitle );
wataTitle.x = align( wataOffset + (colWidth - wataTitle.width()) / 2 );
wataTitle.y = align( wata.y + wata.height + 11 );
2014-09-09 05:05:53 +00:00
BitmapTextMultiline wataText = createMultiline( TXT_WATA, 8 );
wataText.maxWidth = wataTitle.maxWidth;
wataText.measure();
add( wataText );
2014-07-27 13:39:07 +00:00
wataText.x = align( wataOffset + (colWidth - wataText.width()) / 2 );
wataText.y = align( wataTitle.y + wataTitle.height() + 12 );
2014-07-27 13:39:07 +00:00
BitmapTextMultiline wataLink = createMultiline( LNK_WATA, 8 );
wataLink.maxWidth = wataTitle.maxWidth;
wataLink.measure();
wataLink.hardlight(Window.TITLE_COLOR);
add(wataLink);
2014-07-27 13:39:07 +00:00
wataLink.x = wataText.x;
wataLink.y = wataText.y + wataText.height();
2014-07-27 13:39:07 +00:00
TouchArea hotArea = new TouchArea( wataLink ) {
2014-07-27 13:39:07 +00:00
@Override
protected void onClick( Touch touch ) {
2014-09-09 05:05:53 +00:00
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://" + LNK_WATA ) );
2014-07-27 13:39:07 +00:00
Game.instance.startActivity( intent );
}
};
add( hotArea );
2014-09-09 05:05:53 +00:00
2014-07-27 13:39:07 +00:00
Archs archs = new Archs();
archs.setSize( Camera.main.width, Camera.main.height );
addToBack( archs );
2014-10-18 08:56:57 +00:00
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
2014-10-18 08:56:57 +00:00
2014-07-27 13:39:07 +00:00
fadeIn();
}
@Override
protected void onBackPressed() {
2014-10-18 08:56:57 +00:00
ShatteredPixelDungeon.switchNoFade(TitleScene.class);
2014-07-27 13:39:07 +00:00
}
}