Skip to content

Commit

Permalink
added per-table rules in AboutActivity text
Browse files Browse the repository at this point in the history
  • Loading branch information
dozingcat committed Aug 1, 2011
1 parent 344e802 commit bdef361
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
1 change: 1 addition & 0 deletions res/layout/about.xml
Expand Up @@ -5,6 +5,7 @@
android:layout_height="fill_parent">

<TextView
android:id="@+id/aboutTextView"
android:text="@string/about_text"
android:autoLink="web|email"
android:layout_width="fill_parent"
Expand Down
6 changes: 5 additions & 1 deletion res/values/strings.xml
Expand Up @@ -19,6 +19,10 @@
<string name="zoom_pref_title">Zoom Playfield</string>
<string name="use_opengl_pref_title">OpenGL Rendering</string>

<string name="about_text">Vector Pinball 1.2.4\n© 2010-2011 Brian Nenninger\nMore info: www.dozingcatsoftware.com/VectorPinball\nComments and bug reports: bnenning@gmail.com\n\nTouch the screen to start a new game, launch a ball if one is not in play, and activate the flippers.\n\nGame Rules:\n- Light all the cyan rollovers in the top or bottom lanes to advance the score multiplier. All points you earn will be multiplied by this amount. Shooting the left ramp will also advance the multiplier.\n- The game starts with ball savers in the left and right outlanes, which disappear when used. Hit all drop targets on the left or right side to restore them.\n- Hitting any group of drop targets will activate the next light in the center of the field. When the large white central light is activated, shoot the left ramp to start multiball.\n\nSelecting Preferences from the menu button allows you to change the following settings:\n- Sound: Enables and disables sound effects\n- Background Music: Enables and disabled background music\n- Independent Flippers: When unchecked, any touch activates both flippers. When checked, you must touch the left side of the screen for the left flipper, and the right side for the right flipper. This option is only available in Android 2.2 (Froyo) or later.\n- Zoom: When checked, the view will be zoomed on the ball\'s location during game play.\n- Show FPS: When checked, shows frames drawn per second in the upper left.\n\nVector Pinball is open source; the code is at https://github.com/dozingcat/Vector-Pinball\n\nThanks to Mario at www.badlogicgames.com for code improvements and libgdx.\n\nsound, music, &amp; audio code, by pdx\nTwittering Machine\nhttp://www.twittering.com</string>
<string name="about_text">Vector Pinball 1.3\n© 2010-2011 Brian Nenninger\nMore info: www.dozingcatsoftware.com/VectorPinball\nComments and bug reports: bnenning@gmail.com\n\nTouch the screen to start a new game, launch a ball if one is not in play, and activate the flippers.\n\n[TABLE_RULES]\n\nSelecting the Preferences button or menu item allows you to change the following settings:\n- Sound: Enables and disables sound effects\n- Background Music: Enables and disabled background music\n- Independent Flippers: When unchecked, any touch activates both flippers. When checked, you must touch the left side of the screen for the left flipper, and the right side for the right flipper. This option is only available in Android 2.2 (Froyo) or later.\n- Zoom: When checked, the view will be zoomed on the ball\'s location during game play.\n- OpenGL Rendering: Uses OpenGL to draw graphics. This improves performance on many devices, but slows down some.\n- Show FPS: When checked, shows frames drawn per second in the upper left.\n\nVector Pinball is open source; the code is at https://github.com/dozingcat/Vector-Pinball\n\nThanks to Mario at www.badlogicgames.com for code improvements and libgdx.\n\nsound, music, &amp; audio code, by pdx\nTwittering Machine\nhttp://www.twittering.com</string>

<string name="table1_rules">Table Rules:\n- Light all the cyan rollovers in the top or bottom lanes to advance the score multiplier. All points you earn will be multiplied by this amount. Shooting the left ramp will also advance the multiplier.\n- The game starts with ball savers in the left and right outlanes, which disappear when used. Hit all drop targets on the left or right side to restore them.\n- Hitting any group of drop targets will activate the next light in the center of the field. When the large white central light is activated, shoot the left ramp to start multiball.</string>

<string name="table2_rules">Table Rules:\n- Light all the cyan rollovers in the bottom lanes to advance the score multiplier. All points you earn will be multiplied by this amount. \n- The game starts with ball savers in the left and right outlanes, which disappear when used. Hit all drop targets on the left or right side to restore them.\n- The circles in the middle of the field keep track of how many times you\'ve hit all the left, upper, and right drop targets. When all of them have been hit at least 3 times, shoot the red bumper in the upper right to start multiball.</string>

</resources>
27 changes: 27 additions & 0 deletions src/com/dozingcatsoftware/bouncy/AboutActivity.java
@@ -1,8 +1,11 @@
package com.dozingcatsoftware.bouncy;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.widget.TextView;

import com.dozingcatsoftware.bouncy.R;

Expand All @@ -13,6 +16,30 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.about);

// get text to display by replacing "[TABLE_RULES]" with contents of string resource table[level]_rules
String baseText = getString(R.string.about_text);
String tableRulesText = null;
try {
String fieldName = "table" + getIntent().getIntExtra("level", 1) + "_rules";
int tableRulesID = (Integer)R.string.class.getField(fieldName).get(null);
tableRulesText = getString(tableRulesID);
}
catch(Exception ex) {
tableRulesText = null;
}
if (tableRulesText==null) tableRulesText = "";
String displayText = baseText.replace("[TABLE_RULES]", tableRulesText);

TextView tv = (TextView)findViewById(R.id.aboutTextView);
tv.setText(displayText);
}

public static Intent startForLevel(Context context, int level) {
Intent aboutIntent = new Intent(context, AboutActivity.class);
aboutIntent.putExtra("level", level);
context.startActivity(aboutIntent);
return aboutIntent;
}

}
3 changes: 1 addition & 2 deletions src/com/dozingcatsoftware/bouncy/BouncyActivity.java
Expand Up @@ -103,8 +103,7 @@ void gotoPreferences() {
}

void gotoAbout() {
Intent aboutIntent = new Intent(getBaseContext(), AboutActivity.class);
this.startActivity(aboutIntent);
AboutActivity.startForLevel(this, this.level);
}

@Override
Expand Down

0 comments on commit bdef361

Please sign in to comment.