-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
675 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.cookieclicker"> | ||
package="com.example.cookieclicker"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.CookieClicker"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".UpgradesActivity"> | ||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.CookieClicker"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".UpgradesActivity"> | ||
|
||
</activity> | ||
</application> | ||
</activity> | ||
<activity android:name=".GadgetsActivity"> | ||
|
||
</activity> | ||
<activity android:name=".BakeryActivity"> | ||
|
||
</activity> | ||
<activity android:name=".SettingsActivity"> | ||
|
||
</activity> | ||
</application> | ||
|
||
</manifest> |
27 changes: 27 additions & 0 deletions
27
Cookie Clicker +/src/main/java/com/example/cookieclicker/BakeryActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.example.cookieclicker | ||
|
||
import android.app.Activity | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.util.Log | ||
import android.widget.Button | ||
import android.widget.ImageButton | ||
import android.widget.TextView | ||
import android.widget.Toast | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class BakeryActivity : AppCompatActivity(){ | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.bakery_activity) | ||
setBakeryExitButton() | ||
} | ||
|
||
fun setBakeryExitButton(){ | ||
var exitButton = findViewById<ImageButton>(R.id.BakeryExitButton) | ||
exitButton.setOnClickListener { | ||
setResult(Activity.RESULT_OK) | ||
finish() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
Cookie Clicker +/src/main/java/com/example/cookieclicker/GadgetsActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.example.cookieclicker | ||
|
||
import android.app.Activity | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.util.Log | ||
import android.widget.Button | ||
import android.widget.ImageButton | ||
import android.widget.TextView | ||
import android.widget.Toast | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class GadgetsActivity : AppCompatActivity(){ | ||
var cookieData = CookieData() | ||
lateinit var bombCostTextView: TextView | ||
lateinit var clickerKeyCostTextView: TextView | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.gadgets_activity) | ||
setGadgetsExitButton() | ||
setBuyBombButton() | ||
refreshTextViews() | ||
setBuyButtonClickerKey() | ||
bombCostTextView = findViewById(R.id.bombprice) | ||
clickerKeyCostTextView = findViewById(R.id.clickerkeyprice) | ||
} | ||
|
||
fun refreshTextViews(){ | ||
if(cookieData.BombGadgetActive) | ||
{ | ||
bombCostTextView.text = "Already purchased" | ||
} | ||
if(cookieData.KeyGadgetActive) | ||
{ | ||
clickerKeyCostTextView.text = "Already purchased" | ||
} | ||
} | ||
fun setGadgetsExitButton(){ | ||
var exitButton = findViewById<ImageButton>(R.id.GadgetsExitButton) | ||
exitButton.setOnClickListener { | ||
setResult(Activity.RESULT_OK) | ||
finish() | ||
} | ||
} | ||
|
||
fun setBuyBombButton(){ | ||
var button = findViewById<Button>(R.id.BombButton) | ||
button.setOnClickListener { | ||
if(cookieData.BombGadgetActive == false){ | ||
if(cookieData.cookiesCounter >= 70000) { | ||
cookieData.BombGadgetActive = true | ||
cookieData.cookiesCounter -= 70000 | ||
refreshTextViews() | ||
}else{ | ||
Toast.makeText(applicationContext, "You cannot buy this gadget", Toast.LENGTH_LONG).show() | ||
} | ||
}else{ | ||
Toast.makeText(applicationContext, "You already own this gadget", Toast.LENGTH_LONG).show() | ||
} | ||
} | ||
} | ||
|
||
fun setBuyButtonClickerKey(){ | ||
var button = findViewById<Button>(R.id.KeyGadgetBuy) | ||
button.setOnClickListener { | ||
if(cookieData.KeyGadgetActive == false) { | ||
if (cookieData.cookiesCounter >= 90000) { | ||
cookieData.BombGadgetActive = true | ||
cookieData.cookiesCounter -= 90000 | ||
refreshTextViews() | ||
}else{ | ||
Toast.makeText(applicationContext, "You cannot buy this gadget", Toast.LENGTH_LONG).show() | ||
} | ||
}else{ | ||
Toast.makeText(applicationContext, "You already own this gadget", Toast.LENGTH_LONG).show() | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.