• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版9ae73c42e14ddd7add72673032c93f75f4bf6fe0 (tree)
时间2022-04-07 22:55:42
作者sebastian_bugiu
Commitersebastian_bugiu

Log Message

Added buy menu when demo mode is enabled and score limit is reached.

更改概述

差异

diff -r 14a7c47a320b -r 9ae73c42e14d core/src/com/headwayent/spacerocket/FullAccessActivity.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/src/com/headwayent/spacerocket/FullAccessActivity.java Thu Apr 07 16:55:42 2022 +0300
@@ -0,0 +1,95 @@
1+package com.headwayent.spacerocket;
2+
3+import com.badlogic.gdx.Gdx;
4+import com.badlogic.gdx.ScreenAdapter;
5+import com.badlogic.gdx.scenes.scene2d.Actor;
6+import com.badlogic.gdx.scenes.scene2d.Stage;
7+import com.badlogic.gdx.scenes.scene2d.ui.Label;
8+import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
9+import com.badlogic.gdx.scenes.scene2d.ui.Skin;
10+import com.badlogic.gdx.scenes.scene2d.ui.Table;
11+import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
12+import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
13+import com.badlogic.gdx.utils.Align;
14+import com.badlogic.gdx.utils.ScreenUtils;
15+import com.badlogic.gdx.utils.viewport.ScreenViewport;
16+import com.headwayent.spacerocket.old.ExtendedCanvas;
17+
18+public class FullAccessActivity extends ScreenAdapter {
19+
20+ private final Stage stage;
21+ private Label titleLabel;
22+ private Label buyLabel;
23+
24+ public FullAccessActivity() {
25+ stage = new Stage(new ScreenViewport());
26+ }
27+
28+ @Override
29+ public void show() {
30+ super.show();
31+
32+ stage.clear();
33+ Table table = new Table();
34+// table.setFillParent(true);
35+ table.setWidth(ExtendedCanvas.getScreenWidth());
36+ table.setY(40.0f);
37+ table.setHeight(ExtendedCanvas.getScreenHeight() - 80.0f);
38+ //table.setDebug(true);
39+ stage.addActor(table);
40+
41+ Gdx.input.setInputProcessor(stage);
42+
43+ Skin skin = SpaceRocket.getGame().getSkin();
44+
45+ titleLabel = new Label("Options", skin);
46+ titleLabel.setAlignment(Align.center);
47+ buyLabel = new Label("Sound enabled", skin);
48+ String buyString = "You are playing the demo version.\n" +
49+ "If you want to bypass the score limitation " +
50+ "please buy the full version of the game.";
51+ titleLabel.setText("Buy full game");
52+ buyLabel.setText(buyString);
53+ buyLabel.setWrap(true);
54+
55+ ScrollPane scrollPane = new ScrollPane(buyLabel, skin);
56+ scrollPane.setScrollingDisabled(true, false);
57+
58+ TextButton buy = Utility.createTextButton("Buy full version", skin);
59+ final TextButton backButton = Utility.createTextButton("Done", skin); // the extra argument here "small" is used to set the button to the smaller version instead of the big default version
60+
61+ buy.addListener(new ChangeListener() {
62+ @Override
63+ public void changed(ChangeEvent event, Actor actor) {
64+ MainMenuActivity.buyFullGame(stage);
65+ }
66+ });
67+
68+ backButton.addListener(new ChangeListener() {
69+ @Override
70+ public void changed(ChangeEvent event, Actor actor) {
71+ SpaceRocket.getGame().changeScreen(SpaceRocket.Screen.HIGH_SCORE);
72+ }
73+ });
74+
75+ table.add(titleLabel).fillX().uniformX();
76+ table.row().pad(10, 20, 10, 20);
77+ table.add(scrollPane).expandX().fillX();
78+ if (SpaceRocket.getGame().getPurchaseManager() != null) {
79+ table.row().pad(10, 20, 0, 20);
80+ table.add(buy).fillX().uniformX();
81+ }
82+ table.row().pad(10, 20, 10, 20);
83+ table.add(backButton).fillX().uniformX();
84+ }
85+
86+ @Override
87+ public void render(float delta) {
88+ super.render(delta);
89+ ScreenUtils.clear(0, 0, 0, 1);
90+
91+ // tell our stage to do actions and draw itself
92+ stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
93+ stage.draw();
94+ }
95+}
diff -r 14a7c47a320b -r 9ae73c42e14d core/src/com/headwayent/spacerocket/MainMenuActivity.java
--- a/core/src/com/headwayent/spacerocket/MainMenuActivity.java Sun Jan 30 09:33:48 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/MainMenuActivity.java Thu Apr 07 16:55:42 2022 +0300
@@ -69,12 +69,12 @@
6969 table.add(help).fillX().uniformX();
7070 table.row().pad(10, 20, 0, 20);
7171 table.add(credits).fillX().uniformX();
72- table.row().pad(10, 20, 0, 20);
73- table.add(buy).fillX().uniformX();
7472 if (SpaceRocket.getGame().getPurchaseManager() != null) {
7573 table.row().pad(10, 20, 0, 20);
76- table.add(exit).fillX().uniformX();
74+ table.add(buy).fillX().uniformX();
7775 }
76+ table.row().pad(10, 20, 0, 20);
77+ table.add(exit).fillX().uniformX();
7878
7979 // create button listeners
8080 exit.addListener(new ChangeListener() {
@@ -130,13 +130,17 @@
130130 buy.addListener(new ChangeListener() {
131131 @Override
132132 public void changed(ChangeEvent event, Actor actor) {
133- new IAPShop(skin).show(stage);
133+ buyFullGame(stage);
134134 }
135135 });
136136
137137 // SpaceRocket.getGame().changeScreen(SpaceRocket.Screen.SELECT_DIFFICULTY);
138138 }
139139
140+ public static void buyFullGame(Stage stage) {
141+ new IAPShop(SpaceRocket.getGame().getSkin()).show(stage);
142+ }
143+
140144 @Override
141145 public void render(float delta) {
142146 super.render(delta);
diff -r 14a7c47a320b -r 9ae73c42e14d core/src/com/headwayent/spacerocket/SpaceRocket.java
--- a/core/src/com/headwayent/spacerocket/SpaceRocket.java Sun Jan 30 09:33:48 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/SpaceRocket.java Thu Apr 07 16:55:42 2022 +0300
@@ -46,6 +46,7 @@
4646 private MultiplayerJoinGameActivity multiplayerJoinGameActivity;
4747 private MultiplayerLobbyActivity multiplayerLobbyActivity;
4848 private FinalResultsActivity finalResultsActivity;
49+ private FullAccessActivity fullAccessActivity;
4950 private Skin skin;
5051 private AssetManager assetManager;
5152
@@ -65,7 +66,7 @@
6566 IN_GAME, MAIN_MENU, SELECT_DIFFICULTY, HIGH_SCORE,
6667 OPTIONS, HELP, CREDITS, MULTIPLAYER_LOGIN, MULTIPLAYER_LOGGED_IN,
6768 MULTIPLAYER_CREATE_GAME, MULTIPLAYER_JOIN_GAME, MULTIPLAYER_LOBBY,
68- MULTIPLAYER_ADD_FRIEND, FINAL_RESULTS
69+ MULTIPLAYER_ADD_FRIEND, FINAL_RESULTS, FULL_ACCESS
6970 }
7071
7172 public SpaceRocket(PurchaseManager purchaseManager) {
@@ -218,6 +219,12 @@
218219 }
219220 setScreen(finalResultsActivity);
220221 break;
222+ case FULL_ACCESS:
223+ if (fullAccessActivity == null) {
224+ fullAccessActivity = new FullAccessActivity();
225+ }
226+ setScreen(fullAccessActivity);
227+ break;
221228 }
222229 }
223230
diff -r 14a7c47a320b -r 9ae73c42e14d core/src/com/headwayent/spacerocket/old/ExtendedCanvas.java
--- a/core/src/com/headwayent/spacerocket/old/ExtendedCanvas.java Sun Jan 30 09:33:48 2022 +0200
+++ b/core/src/com/headwayent/spacerocket/old/ExtendedCanvas.java Thu Apr 07 16:55:42 2022 +0300
@@ -277,7 +277,10 @@
277277 if(System.currentTimeMillis() - gameOverTime > 3000) {
278278 setGameOver();
279279 getStatus().setShowHighScore(true);
280- SpaceRocket.getGame().changeScreen(SpaceRocket.Screen.HIGH_SCORE);
280+ SpaceRocket.getGame().changeScreen(
281+ Preferences.getInstance().isFullAccess() ?
282+ SpaceRocket.Screen.HIGH_SCORE :
283+ SpaceRocket.Screen.FULL_ACCESS);
281284 }
282285 }
283286 }
diff -r 14a7c47a320b -r 9ae73c42e14d ios/robovm.properties
--- a/ios/robovm.properties Sun Jan 30 09:33:48 2022 +0200
+++ b/ios/robovm.properties Thu Apr 07 16:55:42 2022 +0300
@@ -2,5 +2,5 @@
22 app.id=com.headwayent.spacerocket
33 app.mainclass=com.headwayent.spacerocket.IOSLauncher
44 app.executable=IOSLauncher
5-app.build=18
5+app.build=19
66 app.name=Hotshot 2D