Revisión | c2baf83f34a170431f5856b668721945f55cfd0d (tree) |
---|---|
Tiempo | 2022-01-15 00:32:15 |
Autor | sebastian_bugiu |
Commiter | sebastian_bugiu |
Added UIRequiresFullScreen. Full access IAP now should limit score if no purchase happened.
@@ -4,12 +4,13 @@ | ||
4 | 4 | |
5 | 5 | import com.badlogic.gdx.backends.android.AndroidApplication; |
6 | 6 | import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; |
7 | +import com.badlogic.gdx.pay.android.googlebilling.PurchaseManagerGoogleBilling; | |
7 | 8 | |
8 | 9 | public class AndroidLauncher extends AndroidApplication { |
9 | 10 | @Override |
10 | 11 | protected void onCreate (Bundle savedInstanceState) { |
11 | 12 | super.onCreate(savedInstanceState); |
12 | 13 | AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); |
13 | - initialize(new SpaceRocket(), config); | |
14 | + initialize(new SpaceRocket(new PurchaseManagerGoogleBilling(this)), config); | |
14 | 15 | } |
15 | 16 | } |
@@ -11,8 +11,8 @@ | ||
11 | 11 | private final String sku; |
12 | 12 | private final int usdCents; |
13 | 13 | |
14 | - public IAPButton(String sku, int usdCents, Skin skin) { | |
15 | - super(sku, skin); | |
14 | + public IAPButton(String text, String sku, int usdCents, Skin skin) { | |
15 | + super(text, skin); | |
16 | 16 | this.sku = sku; |
17 | 17 | this.usdCents = usdCents; |
18 | 18 |
@@ -64,6 +64,9 @@ | ||
64 | 64 | if (transaction.getIdentifier().equals(IAPShop.SKU_FULL_ACCESS)) { |
65 | 65 | shop.getBuyEntitlement().setBought(fromRestore); |
66 | 66 | Preferences.getInstance().setFullAccess(true); |
67 | + if (!fromRestore) { | |
68 | + shop.getCloseButton().toggle(); | |
69 | + } | |
67 | 70 | } |
68 | 71 | |
69 | 72 | else if (transaction.getIdentifier().equals(IAPShop.MY_CONSUMABLE)) { |
@@ -29,7 +29,7 @@ | ||
29 | 29 | closeButton = new TextButton("Close", skin); |
30 | 30 | button(closeButton); |
31 | 31 | |
32 | - restoreButton = new TextButton("Restore", skin); | |
32 | + restoreButton = new TextButton("Reclaim purchases", skin); | |
33 | 33 | restoreButton.setDisabled(true); |
34 | 34 | restoreButton.addListener(new ChangeListener() { |
35 | 35 | @Override |
@@ -56,11 +56,11 @@ | ||
56 | 56 | |
57 | 57 | Table iapTable = new Table(); |
58 | 58 | iapTable.defaults().fillX().uniform().expandX(); |
59 | - buyEntitlement = new IAPButton(SKU_FULL_ACCESS, 100, skin); | |
59 | + buyEntitlement = new IAPButton("Unlock Full Access", SKU_FULL_ACCESS, 100, skin); | |
60 | 60 | iapTable.add(buyEntitlement); |
61 | - buyConsumable = new IAPButton(MY_CONSUMABLE, 100, skin); | |
62 | - iapTable.row(); | |
63 | - iapTable.add(buyConsumable); | |
61 | +// buyConsumable = new IAPButton(MY_CONSUMABLE, 100, skin); | |
62 | +// iapTable.row(); | |
63 | +// iapTable.add(buyConsumable); | |
64 | 64 | |
65 | 65 | contentTable.add(iapTable); |
66 | 66 | } |
@@ -78,7 +78,7 @@ | ||
78 | 78 | |
79 | 79 | public void updateGuiWhenPurchaseManInstalled(String errorMessage) { |
80 | 80 | buyEntitlement.updateFromManager(); |
81 | - buyConsumable.updateFromManager(); | |
81 | +// buyConsumable.updateFromManager(); | |
82 | 82 | |
83 | 83 | if (SpaceRocket.getGame().getPurchaseManager().installed() && errorMessage == null) { |
84 | 84 | restoreButton.setDisabled(false); |
@@ -104,4 +104,8 @@ | ||
104 | 104 | public IAPButton getBuyConsumable() { |
105 | 105 | return buyConsumable; |
106 | 106 | } |
107 | + | |
108 | + public TextButton getCloseButton() { | |
109 | + return closeButton; | |
110 | + } | |
107 | 111 | } |
@@ -24,6 +24,7 @@ | ||
24 | 24 | |
25 | 25 | public class SpaceRocket extends Game { |
26 | 26 | |
27 | + public static final boolean DEBUG = true; | |
27 | 28 | private static final Random random = new Random(System.currentTimeMillis()); |
28 | 29 | private static SpaceRocket game; |
29 | 30 | private final PurchaseManager purchaseManager; |
@@ -112,8 +113,9 @@ | ||
112 | 113 | parameter.flip = true; |
113 | 114 | font = generator.generateFont(parameter); // For the in game flipped ttf. |
114 | 115 | generator.dispose(); |
115 | - // Disable after testing. | |
116 | - Preferences.getInstance().setFullAccess(false); | |
116 | + if (DEBUG) { | |
117 | + Preferences.getInstance().setFullAccess(false); | |
118 | + } | |
117 | 119 | canvas = new ExtendedCanvas(); |
118 | 120 | setScreen(new MainMenuActivity(this)); |
119 | 121 | } |
@@ -50,7 +50,7 @@ | ||
50 | 50 | private static final float CORNER_X = 0, CORNER_Y = 0; |
51 | 51 | public static final int NUM_LIVES = 10; |
52 | 52 | private static final int HIDDEN_KEY_NUM_PRESSES = 10; |
53 | - public static final int FULL_ACCESS_SCORE = 10; | |
53 | + public static final int FULL_ACCESS_SCORE = SpaceRocket.DEBUG ? 10 : 150; | |
54 | 54 | private static float FONT_HEIGHT; |
55 | 55 | private static float SCORE_WIDTH; |
56 | 56 | private static float OTHER_SHIP_SCORE_WIDTH; |
@@ -7,6 +7,6 @@ | ||
7 | 7 | public class DesktopLauncher { |
8 | 8 | public static void main (String[] arg) { |
9 | 9 | LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); |
10 | - new LwjglApplication(new SpaceRocket(), config); | |
10 | + new LwjglApplication(new SpaceRocket(null), config); | |
11 | 11 | } |
12 | 12 | } |
@@ -28,6 +28,8 @@ | ||
28 | 28 | <false/> |
29 | 29 | <key>UIStatusBarHidden</key> |
30 | 30 | <true/> |
31 | + <key>UIRequiresFullScreen</key> | |
32 | + <true/> | |
31 | 33 | <key>MinimumOSVersion</key> |
32 | 34 | <string>8.0</string> |
33 | 35 | <key>UIDeviceFamily</key> |
@@ -43,9 +45,6 @@ | ||
43 | 45 | <key>UISupportedInterfaceOrientations</key> |
44 | 46 | <array> |
45 | 47 | <string>UIInterfaceOrientationPortrait</string> |
46 | - <!-- <string>UIInterfaceOrientationPortraitUpsideDown</string> | |
47 | - <string>UIInterfaceOrientationLandscapeLeft</string> | |
48 | - <string>UIInterfaceOrientationLandscapeRight</string> --> | |
49 | 48 | </array> |
50 | 49 | <key>UILaunchStoryboardName</key> |
51 | 50 | <string>LaunchScreen</string> |
@@ -2,5 +2,5 @@ | ||
2 | 2 | app.id=com.headwayent.spacerocket |
3 | 3 | app.mainclass=com.headwayent.spacerocket.IOSLauncher |
4 | 4 | app.executable=IOSLauncher |
5 | -app.build=10 | |
5 | +app.build=12 | |
6 | 6 | app.name=Hotshot 2D |