Compare commits

..

4 Commits

Author SHA1 Message Date
Théo RENAUD 2901716ed2 .
continuous-integration/drone/push Build is passing Details
2 years ago
Théo RENAUD 510dd0d2a7 Key dont delete after craft
continuous-integration/drone/push Build is passing Details
2 years ago
Théo RENAUD 7514a5168d Key dont delete after craft
2 years ago
Théo RENAUD e0db3f5eb9 tresure png need to be change and drop open treasure in inventory
2 years ago

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

@ -34,29 +34,12 @@ La page "Dungeon" est une page de jeu dans laquelle le joueur doit secouer son t
![](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png) ![](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png)
## :bar_chart: distribution of work
- ✅ Fragment Home : Lucas Delanier <img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ Fragment Craft : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ Fragment Forge : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ Fragment Boss : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ Fragment Collect : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ Gestion de la rotation de l'écran Home fragment : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ Gestion du capteur Accélérometre : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ RecyclerView, Adapter, viewholder : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ ViewModel : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ LiveData : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ Model, Player, Item, Tool, Boss, ItemManager, Generator : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- ✅ Requete API, retrofit : Lucas Delanier<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"></br>
- 👷 Persistence profonde : Lucas Delanier, Theo Renaud<img src ="https://codefirst.iut.uca.fr/git/avatars/6a3835d734392fccff3949f7c82a63b9?size=870" height="20px"><img src ="https://codefirst.iut.uca.fr/git/avatars/af9299d66a9a0bf7be17f8dc156f67b9?size=870" height="20px"></br>
## :dizzy: Getting Started ## :dizzy: Getting Started
Une fois le dépot cloné, vous pouvez lancer le code sur votre téléphone Android grace a l'outil Android studio ou grace a un émulateur android. Une fois le dépot cloné, vous pouvez lancer le code sur votre téléphone Android grace a l'outil Android studio ou grace a un émulateur android.
## :gift: OverView ## :gift: OverView
<p align="center"> <p align="center">

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

@ -33,37 +33,19 @@ android {
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = '1.8'
} }
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
}
} }
apply plugin: 'kotlin-kapt'
dependencies { dependencies {
implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.8.0' implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.ar.sceneform:filament-android:1.17.1' implementation 'com.google.ar.sceneform:filament-android:1.17.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3' implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3' implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation 'androidx.fragment:fragment-ktx:1.5.6'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0' implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation "androidx.room:room-runtime:2.5.1"
kapt "androidx.room:room-compiler:2.5.1"
implementation "androidx.room:room-ktx:2.5.1"
//Retrofit
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
//Coroutine
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
} }

@ -16,7 +16,6 @@ import android.view.animation.ScaleAnimation
import android.widget.ImageView import android.widget.ImageView
import android.widget.ProgressBar import android.widget.ProgressBar
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -25,7 +24,6 @@ import com.example.shakecraft.model.Generator
import com.example.shakecraft.model.Item import com.example.shakecraft.model.Item
import com.example.shakecraft.model.Player import com.example.shakecraft.model.Player
import com.example.shakecraft.view.adapter.AdapterBossLoot import com.example.shakecraft.view.adapter.AdapterBossLoot
import com.example.shakecraft.viewmodel.MainViewModel
import kotlin.math.pow import kotlin.math.pow
import kotlin.math.sqrt import kotlin.math.sqrt
@ -39,7 +37,7 @@ class BossFragment() : Fragment() {
private lateinit var image: ImageView private lateinit var image: ImageView
private lateinit var buttonCollect: TextView private lateinit var buttonCollect: TextView
private lateinit var recyclerView: RecyclerView private lateinit var recyclerView: RecyclerView
val viewModel : MainViewModel by activityViewModels<MainViewModel>() private lateinit var boss: Boss
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -49,22 +47,21 @@ class BossFragment() : Fragment() {
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View? { ): View? {
val currentPlayer = (activity as MainActivity).currentPlayer
val view = inflater.inflate(R.layout.fragment_boss, container, false) val view = inflater.inflate(R.layout.fragment_boss, container, false)
// Initialize views // Initialize views
initializeViews(view) initializeViews(view)
// Set up boss // Set up boss
if(!viewModel.isBossInitialized) boss = Generator.generateBoss()
viewModel.currentBoss = Generator.generateBoss() setUpBoss(boss)
setUpBoss(viewModel.currentBoss)
// Set up RecyclerView for boss loot // Set up RecyclerView for boss loot
setUpRecyclerView(view) setUpRecyclerView(view)
// Set up accelerometer listener // Set up accelerometer listener
viewModel.currentPlayer.value?.let { setUpAccelerometerListener(view, it) } setUpAccelerometerListener(view, currentPlayer)
// Set up activity orientation // Set up activity orientation
setUpActivityOrientation() setUpActivityOrientation()
@ -82,7 +79,7 @@ class BossFragment() : Fragment() {
} }
private fun setUpBoss(boss: Boss) { private fun setUpBoss(boss: Boss) {
progressBar.max = boss.maxlife progressBar.max = boss.maxlife
progressBar.progress = boss.life.toInt() progressBar.progress = boss.life
image.setImageResource(boss.image) image.setImageResource(boss.image)
// Create scale animation for boss image // Create scale animation for boss image
@ -105,7 +102,7 @@ class BossFragment() : Fragment() {
recyclerView = view.findViewById(R.id.recyclerviewBossLoot) recyclerView = view.findViewById(R.id.recyclerviewBossLoot)
with(recyclerView) { with(recyclerView) {
layoutManager = LinearLayoutManager(view.context) layoutManager = LinearLayoutManager(view.context)
adapter = AdapterBossLoot(viewModel.currentBoss.possibleLoot) adapter = AdapterBossLoot(boss.possibleLoot)
} }
} }
private fun setUpActivityOrientation(){ private fun setUpActivityOrientation(){
@ -120,7 +117,7 @@ class BossFragment() : Fragment() {
toastView.visibility = View.VISIBLE toastView.visibility = View.VISIBLE
lootImage.setImageResource(item.type.image) lootImage.setImageResource(item.type.image)
lootName.text = item.type.name lootName.text = item.type.name
xpReward.text = viewModel.currentBoss.xpReward.toString() xpReward.text = boss.xpReward.toString()
toastView.postDelayed({ toastView.postDelayed({
toastView.visibility = View.GONE toastView.visibility = View.GONE
}, 3000) }, 3000)
@ -134,36 +131,31 @@ class BossFragment() : Fragment() {
} }
override fun onSensorChanged(event: SensorEvent?) { override fun onSensorChanged(event: SensorEvent?) {
val acceleration = sqrt(event!!.values[0].pow(2) + event.values[1].pow(2) + event.values[2].pow(2)) val acceleration = sqrt(event!!.values[0].pow(2) + event.values[1].pow(2) + event.values[2].pow(2))
if (viewModel.currentBoss.life <= 0) { if (boss.life <= 0) {
//Vibration to signal the death of the boss //Vibration to signal the death of the boss
val vibrator = context?.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator val vibrator = context?.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
vibrator.vibrate(100) vibrator.vibrate(100)
// Generate a loot item and XP reward // Generate a loot item and XP reward
val item = Generator.generateLootBoss(viewModel.currentBoss.possibleLoot) val item = Generator.generateLootBoss(boss.possibleLoot)
currentPlayer.addItem(item) currentPlayer.addItem(item)
currentPlayer.gainXp(viewModel.currentBoss.xpReward) currentPlayer.gainXp(boss.xpReward)
// Show loot toast view for 3 seconds // Show loot toast view for 3 seconds
displayToast(view,item) displayToast(view,item)
// Spawn new boss and reset progress bar // Spawn new boss and reset progress bar
viewModel.currentBoss = Generator.generateBoss() boss = Generator.generateBoss()
setUpBoss(viewModel.currentBoss) setUpBoss(boss)
//Update displayed information //Update displayed information
setUpRecyclerView(view) setUpRecyclerView(view)
} else { } else {
if(acceleration > 20){ // Reduce boss life based on acceleration value
viewModel.currentBoss.takeDamage(((acceleration / 80)+ currentPlayer.attack()/100).toDouble()) boss.takeDamage((acceleration / 80).toInt())
} progressBar.progress = boss.life
else{
viewModel.currentBoss.takeDamage(currentPlayer.attack().toDouble()/100)
}
progressBar.progress = viewModel.currentBoss.life.toInt()
} }
} }
} }

@ -16,14 +16,12 @@ import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.ProgressBar import android.widget.ProgressBar
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import com.example.shakecraft.model.Generator import com.example.shakecraft.model.Generator
import com.example.shakecraft.model.Item import com.example.shakecraft.model.Item
import com.example.shakecraft.model.Player import com.example.shakecraft.model.Player
import com.example.shakecraft.viewmodel.MainViewModel
import kotlin.math.pow import kotlin.math.pow
@ -36,7 +34,6 @@ class CollectFragment() : Fragment() {
private lateinit var accelerometerEventListener: SensorEventListener private lateinit var accelerometerEventListener: SensorEventListener
private lateinit var progressBar: ProgressBar private lateinit var progressBar: ProgressBar
private lateinit var buttonBack: TextView private lateinit var buttonBack: TextView
val viewModel : MainViewModel by activityViewModels<MainViewModel>()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -47,13 +44,14 @@ class CollectFragment() : Fragment() {
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View? { ): View? {
val currentPlayer = (activity as MainActivity).currentPlayer
val view = inflater.inflate(R.layout.fragment_collect, container, false) val view = inflater.inflate(R.layout.fragment_collect, container, false)
// Initialize views // Initialize views
initializeViews(view) initializeViews(view)
// Set up accelerometer listener // Set up accelerometer listener
viewModel.currentPlayer.value?.let { setUpAccelerometerListener(view, it) } setUpAccelerometerListener(view,currentPlayer)
// Set up activity orientation // Set up activity orientation
setUpActivityOrientation() setUpActivityOrientation()
@ -103,7 +101,7 @@ class CollectFragment() : Fragment() {
// Generate a resource item and XP reward // Generate a resource item and XP reward
val item = Generator.generateLootCollection() val item = Generator.generateLootCollection()
viewModel.addItem(item) currentPlayer.addItem(item)
currentPlayer.gainXp(item.type.xpReward) currentPlayer.gainXp(item.type.xpReward)
//reset to 0 the progress bar //reset to 0 the progress bar

@ -8,8 +8,6 @@ import android.view.ViewGroup
import android.widget.Button import android.widget.Button
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -17,7 +15,7 @@ import com.example.shakecraft.model.Player
import com.example.shakecraft.model.Recipe import com.example.shakecraft.model.Recipe
import com.example.shakecraft.model.RecipeManager import com.example.shakecraft.model.RecipeManager
import com.example.shakecraft.view.adapter.AdapterMaterials import com.example.shakecraft.view.adapter.AdapterMaterials
import com.example.shakecraft.viewmodel.MainViewModel
class CraftFragment : Fragment() { class CraftFragment : Fragment() {
@ -27,10 +25,7 @@ class CraftFragment : Fragment() {
private lateinit var image: ImageView private lateinit var image: ImageView
private lateinit var name: TextView private lateinit var name: TextView
private lateinit var buttonForge: Button private lateinit var buttonForge: Button
private lateinit var buttonForgeMax: Button
private lateinit var numberCraftable: TextView private lateinit var numberCraftable: TextView
private lateinit var craftValue : TextView
private val viewModel : MainViewModel by activityViewModels()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -43,15 +38,12 @@ class CraftFragment : Fragment() {
): View? { ): View? {
val currentPlayer = (activity as MainActivity).currentPlayer
val view = inflater.inflate(R.layout.fragment_craft, container, false) val view = inflater.inflate(R.layout.fragment_craft, container, false)
recipe = arguments?.getParcelable("recipe")!! recipe = arguments?.getParcelable("recipe")!!
initializeViews(view, currentPlayer)
viewModel.currentPlayer.observe(this.viewLifecycleOwner, Observer {player -> setUpRecyclerView(view,currentPlayer)
initializeViews(view, player)
setUpRecyclerView(view, player)
})
return view return view
} }
@ -73,9 +65,7 @@ class CraftFragment : Fragment() {
private fun initializeViews(view: View, currentPlayer: Player) { private fun initializeViews(view: View, currentPlayer: Player) {
buttonBack = view.findViewById(R.id.backbutton) buttonBack = view.findViewById(R.id.backbutton)
buttonForge = view.findViewById(R.id.buttonForge) buttonForge = view.findViewById(R.id.buttonForge)
buttonForgeMax = view.findViewById(R.id.buttonForgeMax)
numberCraftable = view.findViewById(R.id.craftableNumber) numberCraftable = view.findViewById(R.id.craftableNumber)
craftValue = view.findViewById(R.id.craftValue)
buttonBack.setOnClickListener{ buttonBack.setOnClickListener{
findNavController().navigate(R.id.action_craftFragment_to_forgeFragment) findNavController().navigate(R.id.action_craftFragment_to_forgeFragment)
@ -85,15 +75,12 @@ class CraftFragment : Fragment() {
image.setImageResource(recipe.item.type.image) image.setImageResource(recipe.item.type.image)
name.text = recipe.item.type.name name.text = recipe.item.type.name
buttonForge.isEnabled = RecipeManager.isCraftable(recipe,currentPlayer) buttonForge.isEnabled = RecipeManager.isCraftable(recipe,currentPlayer)
buttonForgeMax.isEnabled = RecipeManager.isCraftable(recipe,currentPlayer)
numberCraftable.text = RecipeManager.HowManyCraftable(recipe,currentPlayer).toString() numberCraftable.text = RecipeManager.HowManyCraftable(recipe,currentPlayer).toString()
craftValue.text = recipe.item.stack.toString()
buttonForge.setOnClickListener{ buttonForge.setOnClickListener{
viewModel.craft(recipe) currentPlayer.craft(recipe)
} initializeViews(view, currentPlayer)
buttonForgeMax.setOnClickListener{ setUpRecyclerView(view, currentPlayer)
viewModel.craft(recipe, RecipeManager.HowManyCraftable(recipe, currentPlayer))
} }

@ -15,7 +15,6 @@ import com.example.shakecraft.model.RecipeManager
import com.example.shakecraft.view.adapter.AdapterRecipe import com.example.shakecraft.view.adapter.AdapterRecipe
class ForgeFragment : Fragment(), AdapterRecipe.OnItemClickListener { class ForgeFragment : Fragment(), AdapterRecipe.OnItemClickListener {
private lateinit var buttonBack: TextView private lateinit var buttonBack: TextView
private lateinit var recyclerViewObjects: RecyclerView private lateinit var recyclerViewObjects: RecyclerView

@ -1,26 +1,21 @@
package com.example.shakecraft package com.example.shakecraft
import android.os.Bundle import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.EditText
import android.widget.ImageView import android.widget.ImageView
import android.widget.ProgressBar import android.widget.ProgressBar
import android.widget.TextView import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.navigation.NavOptions import androidx.navigation.NavOptions
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import com.example.shakecraft.model.Player import com.example.shakecraft.model.Player
import com.example.shakecraft.viewmodel.MainViewModel
class HomeFragment : Fragment() { class HomeFragment : Fragment() {
private lateinit var pseudoEditText : EditText private lateinit var pseudo : TextView
private lateinit var progressbar : ProgressBar private lateinit var progressbar : ProgressBar
private lateinit var level : TextView private lateinit var level : TextView
private lateinit var rank : TextView private lateinit var rank : TextView
@ -30,38 +25,25 @@ class HomeFragment : Fragment() {
private lateinit var buttonBoss : ConstraintLayout private lateinit var buttonBoss : ConstraintLayout
private lateinit var buttonForge : ConstraintLayout private lateinit var buttonForge : ConstraintLayout
private lateinit var playermage : ImageView private lateinit var playermage : ImageView
private lateinit var equipeditem: ImageView
private lateinit var eventFishing: ImageView
val viewModel : MainViewModel by activityViewModels<MainViewModel>()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View? { ): View? {
val isRaining = (activity as MainActivity).isRaining val currentPlayer = (activity as MainActivity).currentPlayer
val view = inflater.inflate(R.layout.fragment_home,container,false) val view = inflater.inflate(R.layout.fragment_home,container,false)
// Initialize views // Initialize views
initializeViews(view, currentPlayer)
viewModel.currentPlayer.observe(viewLifecycleOwner, Observer {
initializeViews(view, it, isRaining)
})
return view return view
} }
private fun initializeViews(view: View, currentPlayer : Player) {
/*fun loadWeatherDate(){ pseudo = view.findViewById(R.id.pseudoTextView)
CoroutineScope(Dispatchers.IO).launch {
val
}
}*/
private fun initializeViews(view: View, currentPlayer : Player, isRaining : Boolean) {
progressbar = view.findViewById(R.id.levelProgressBar) progressbar = view.findViewById(R.id.levelProgressBar)
level = view.findViewById(R.id.levelTextView) level = view.findViewById(R.id.levelTextView)
rank = view.findViewById(R.id.rankTextView) rank = view.findViewById(R.id.rankTextView)
@ -69,8 +51,6 @@ class HomeFragment : Fragment() {
xp = view.findViewById(R.id.xpTextView) xp = view.findViewById(R.id.xpTextView)
playermage = view.findViewById(R.id.playerImage) playermage = view.findViewById(R.id.playerImage)
buttonCollect = view.findViewById(R.id.buttonCollect) buttonCollect = view.findViewById(R.id.buttonCollect)
equipeditem = view.findViewById(R.id.equipedItemAttack)
eventFishing = view.findViewById(R.id.buttonFishing)
buttonCollect.setOnClickListener{ buttonCollect.setOnClickListener{
findNavController().navigate(R.id.action_homeFragment_to_collectFragment, null, NavOptions.Builder().setPopUpTo(R.id.homeFragment, false).build()) findNavController().navigate(R.id.action_homeFragment_to_collectFragment, null, NavOptions.Builder().setPopUpTo(R.id.homeFragment, false).build())
} }
@ -82,6 +62,7 @@ class HomeFragment : Fragment() {
buttonForge.setOnClickListener{ buttonForge.setOnClickListener{
findNavController().navigate(R.id.action_homeFragment_to_forgeFragment, null, NavOptions.Builder().setPopUpTo(R.id.homeFragment, false).build()) findNavController().navigate(R.id.action_homeFragment_to_forgeFragment, null, NavOptions.Builder().setPopUpTo(R.id.homeFragment, false).build())
} }
pseudo.text = currentPlayer.pseudo
level.text = currentPlayer.level.toString() level.text = currentPlayer.level.toString()
rank.text = currentPlayer.rank rank.text = currentPlayer.rank
xp.text = currentPlayer.xp.toString() xp.text = currentPlayer.xp.toString()
@ -89,35 +70,6 @@ class HomeFragment : Fragment() {
progressbar.progress = currentPlayer.xp progressbar.progress = currentPlayer.xp
progressbar.max = currentPlayer.level*100 progressbar.max = currentPlayer.level*100
playermage.setImageResource(currentPlayer.image) playermage.setImageResource(currentPlayer.image)
if(currentPlayer.equipedItem?.type?.image != null) {
equipeditem.setImageResource(currentPlayer.equipedItem!!.type.image)
}
if(isRaining){
eventFishing.visibility = View.VISIBLE
}
pseudoEditText = view.findViewById(R.id.pseudoEditText)
pseudoEditText.setText(currentPlayer.pseudo)
pseudoEditText.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
/*
do nothing
*/
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
/*
do nothing
*/
}
override fun afterTextChanged(s: Editable?) {
currentPlayer.pseudo = s.toString()
}
})
} }

@ -1,62 +1,42 @@
package com.example.shakecraft package com.example.shakecraft
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.example.shakecraft.model.Tool import com.example.shakecraft.model.Player
import com.example.shakecraft.view.adapter.AdapterInventory import com.example.shakecraft.view.adapter.AdapterInventory
import com.example.shakecraft.viewmodel.MainViewModel
class InventoryFragment() : Fragment( ), AdapterInventory.OnItemLongClickListener { class InventoryFragment() : Fragment( ) {
private lateinit var recyclerView: RecyclerView
val viewModel : MainViewModel by activityViewModels<MainViewModel>()
private lateinit var recyclerView: RecyclerView
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
override fun onItemLongClick(position: Int) {
if (viewModel.currentPlayer.value!!.items[position] is Tool) {
val text = if (viewModel.equipeItem(viewModel.currentPlayer.value!!.items[position]) ) " was well equipped" else " has been well unequipped"
Toast.makeText(
context,
viewModel.currentPlayer.value!!.items[position].type.name + text,
Toast.LENGTH_SHORT
).show()
setUpRecyclerView(view?.parent as ViewGroup, this)
}
}
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View? { ): View? {
val currentPlayer = (activity as MainActivity).currentPlayer
val view = inflater.inflate(R.layout.fragment_inventory, container, false) val view = inflater.inflate(R.layout.fragment_inventory, container, false)
// Initialize views // Initialize views
setUpRecyclerView(view, this) setUpRecyclerView(view, currentPlayer)
return view return view
} }
private fun setUpRecyclerView(view: View,listener: AdapterInventory.OnItemLongClickListener ) { private fun setUpRecyclerView(view: View, currentPlayer: Player) {
recyclerView = view.findViewById(R.id.recyclerviewInventory) recyclerView = view.findViewById(R.id.recyclerviewInventory)
with(recyclerView) { with(recyclerView) {
layoutManager = LinearLayoutManager(view.context) layoutManager = LinearLayoutManager(view.context)
adapter = viewModel.currentPlayer.value?.let { adapter = AdapterInventory(currentPlayer.items)
AdapterInventory(viewModel.currentPlayer.value!!.items, listener ,
it
)
}
} }
} }
} }

@ -4,26 +4,21 @@ import android.os.Build
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.activity.viewModels
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.core.view.WindowCompat import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat import androidx.core.view.WindowInsetsControllerCompat
import androidx.navigation.findNavController import androidx.navigation.findNavController
import androidx.navigation.ui.NavigationUI
import androidx.navigation.ui.setupWithNavController import androidx.navigation.ui.setupWithNavController
import com.example.shakecraft.services.OpenWeatherMapService import com.example.shakecraft.data.Stub
import com.example.shakecraft.viewmodel.MainViewModel
import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.bottomnavigation.BottomNavigationView
import kotlinx.coroutines.*
import retrofit2.Retrofit class MainActivity : AppCompatActivity() {
import retrofit2.converter.gson.GsonConverterFactory
class MainActivity: AppCompatActivity() { var currentPlayer = Stub().load()
var isRaining = false
private val model: MainViewModel by viewModels()
@RequiresApi(Build.VERSION_CODES.R) @RequiresApi(Build.VERSION_CODES.R)
private fun hideSystemUI() { private fun hideSystemUI() {
@ -44,46 +39,14 @@ class MainActivity: AppCompatActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
hideSystemUI() hideSystemUI()
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
val apiKey = "85a2724ad38b3994c2b7ebe1d239bbff"
val cityName = "Clermont-Ferrand"
val retrofit = Retrofit.Builder()
.baseUrl("https://api.openweathermap.org/data/2.5/")
.addConverterFactory(GsonConverterFactory.create())
.build()
val openWeatherMapService = retrofit.create(OpenWeatherMapService::class.java)
CoroutineScope(Dispatchers.IO).launch {
val weatherResponse = openWeatherMapService.getCurrentWeather(cityName, apiKey)
isRaining =
weatherResponse.weather.any { it.main.contains("rain", ignoreCase = true) }
println(isRaining)
}
bottomNav = findViewById(R.id.bottomNavigationView) bottomNav = findViewById(R.id.bottomNavigationView)
val navController = findNavController(R.id.fragment) val navController = findNavController(R.id.fragment)
navController.popBackStack(R.id.fragment, false)
bottomNav.setupWithNavController(navController) bottomNav.setupWithNavController(navController)
bottomNav.setOnItemReselectedListener { item ->
// Pop everything up to the reselected item
val reselectedDestinationId = item.itemId
navController.popBackStack(reselectedDestinationId, inclusive = false)
}
bottomNav.setOnItemSelectedListener { item ->
NavigationUI.onNavDestinationSelected(item, navController)
true
}
} }
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
@ -96,5 +59,4 @@ class MainActivity: AppCompatActivity() {
} }

@ -1,16 +1,21 @@
package com.example.shakecraft.data package com.example.shakecraft.data
import com.example.shakecraft.model.* import com.example.shakecraft.model.ItemManager.Companion.ITEMS
import com.example.shakecraft.model.Item
import com.example.shakecraft.model.Player
class Stub { class Stub {
fun load() : Player{ fun load() : Player{
val currentPlayer = Player("Winker",0) val currentPlayer = Player("Winker",0)
val items : MutableList<Item> = mutableListOf()
items.add(Item(type = ITEMS.BEECH_LOG.itemtype, stack = 30))
items.add(Item(type = ITEMS.BRONZE_INGOT.itemtype, stack = 30))
items.add(Item(type = ITEMS.TREASURE.itemtype, stack = 2))
items.add(Item(type = ITEMS.TREASURE_KEY.itemtype, stack = 1))
currentPlayer.addItem(Item(type = ITEMS.BEECH_LOG.itemtype, stack = 30)) currentPlayer.items = items
currentPlayer.addItem(Item(type = ITEMS.BRONZE_INGOT.itemtype, stack = 30))
currentPlayer.addItem(Tool(type = ITEMS.DIAMOND_AXE.itemtype, stack = 1, damage = 8))
return currentPlayer return currentPlayer
} }

@ -1,19 +0,0 @@
package com.example.shakecraft.data
data class WeatherResponse(
val weather: List<Weather>,
val info: Info
)
data class Weather(
val id: Int,
val main: String,
val description: String,
val icon: String
)
data class Info(
val temp: Double,
val feelsLike: Double,
val humidity: Int
)

@ -1,15 +0,0 @@
package com.example.shakecraft.data.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.example.shakecraft.model.Item
@Dao
interface ItemDao {
@Query("SELECT * FROM item")
suspend fun getAllItems(): List<Item>
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertItem(item: Item)
}

@ -1,16 +0,0 @@
package com.example.shakecraft.data.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.example.shakecraft.model.Player
@Dao
interface PlayerDao {
@Query("SELECT * FROM player")
suspend fun getAllPlayers(): List<Player>
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertPlayer(player: Player)
}

@ -3,14 +3,14 @@ package com.example.shakecraft.model
class Boss ( class Boss (
var name: String, var name: String,
var life: Double, var life: Int,
var maxlife: Int, var maxlife: Int,
var image: Int, var image: Int,
var xpReward: Int, var xpReward: Int,
val possibleLoot: List<Pair<Item, Double>>, val possibleLoot: List<Pair<Item, Double>>,
){ ){
fun takeDamage(strength: Double) { fun takeDamage(strength: Int) {
this.life -= strength this.life -= strength
} }
} }

@ -1,5 +1,6 @@
package com.example.shakecraft.model package com.example.shakecraft.model
import com.example.shakecraft.R import com.example.shakecraft.R
import com.example.shakecraft.model.ItemManager.Companion.ITEMS
import kotlin.random.Random import kotlin.random.Random
class Generator { class Generator {
@ -42,26 +43,26 @@ class Generator {
fun generateBoss(): Boss { fun generateBoss(): Boss {
val possibleBoss: List<Pair<Boss, Double>> = listOf( val possibleBoss: List<Pair<Boss, Double>> = listOf(
Pair(Boss(name = "Margit the Fell Omen", life = 150.0, maxlife = 150, image = R.drawable.boss, xpReward = 100, possibleLoot = listOf( Pair(Boss(name = "Margit the Fell Omen", life = 150, maxlife = 150, image = R.drawable.boss, xpReward = 100, possibleLoot = listOf(
Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.7), Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.7),
Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.3), Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.3),
)), 0.5), )), 0.5),
Pair(Boss(name = "Godrick the Grafted", life = 200.0, maxlife = 200, image = R.drawable.skeleton, xpReward = 130, possibleLoot = listOf( Pair(Boss(name = "Godrick the Grafted", life = 200, maxlife = 200, image = R.drawable.skeleton, xpReward = 130, possibleLoot = listOf(
Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.6), Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.6),
Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.3), Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.3),
Pair(Item(type = ITEMS.TREASURE_KEY.itemtype), 0.1), Pair(Item(type = ITEMS.TREASURE_KEY.itemtype), 0.1),
)), 0.2), )), 0.2),
Pair(Boss(name = "Red Wolf of Radagon", life = 250.0, maxlife = 250, image = R.drawable.halberdier, xpReward = 210, possibleLoot = listOf( Pair(Boss(name = "Red Wolf of Radagon", life = 250, maxlife = 250, image = R.drawable.halberdier, xpReward = 210, possibleLoot = listOf(
Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.6), Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.6),
Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.3), Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.3),
Pair(Item(type = ITEMS.TREASURE_KEY.itemtype), 0.1), Pair(Item(type = ITEMS.TREASURE_KEY.itemtype), 0.1),
)), 0.15), )), 0.15),
Pair(Boss(name = "Old Banshee", life = 300.0, maxlife = 300, image = R.drawable.banshee, xpReward = 300, possibleLoot = listOf( Pair(Boss(name = "Old Banshee", life = 300, maxlife = 300, image = R.drawable.banshee, xpReward = 300, possibleLoot = listOf(
Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.4), Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.4),
Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.4), Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.4),
Pair(Item(type = ITEMS.TREASURE_KEY.itemtype), 0.2), Pair(Item(type = ITEMS.TREASURE_KEY.itemtype), 0.2),
)), 0.10), )), 0.10),
Pair(Boss(name = "Margit the Fell Omen", life = 500.0, maxlife = 500, image = R.drawable.lich, xpReward = 500, possibleLoot = listOf( Pair(Boss(name = "Margit the Fell Omen", life = 500, maxlife = 500, image = R.drawable.lich, xpReward = 500, possibleLoot = listOf(
Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.4), Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.4),
Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.3), Pair(Item(type = ITEMS.MONSTER_EYE.itemtype), 0.3),
Pair(Item(type = ITEMS.TREASURE_KEY.itemtype), 0.3), Pair(Item(type = ITEMS.TREASURE_KEY.itemtype), 0.3),
@ -79,5 +80,22 @@ class Generator {
// Si aucun élément n'a été choisi, retourner le dernier élément de la liste // Si aucun élément n'a été choisi, retourner le dernier élément de la liste
return possibleBoss.last().first return possibleBoss.last().first
} }
fun generateTreasure(): Item{
val possibleTreasure: List<Pair<Item,Double>> = listOf(
Pair(Item(type = ITEMS.MONSTER_BONES.itemtype), 0.9),
)
val rand = Random.nextDouble()
var cumulativeProb = 0.0
for (element in possibleTreasure) {
cumulativeProb += element.second
if (rand < cumulativeProb) {
return element.first
}
}
// Si aucun élément n'a été choisi, retourner le dernier élément de la liste
return possibleTreasure.last().first
}
} }
} }

@ -2,15 +2,12 @@ package com.example.shakecraft.model
import android.os.Parcel import android.os.Parcel
import android.os.Parcelable import android.os.Parcelable
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "items")
open class Item(
val type: ItemType,
class Item(
val type: ItemType,
var stack: Int = 1, var stack: Int = 1,
) : Parcelable { ) : Parcelable {
@PrimaryKey(autoGenerate = true) val id: String = type.name
override fun describeContents(): Int { override fun describeContents(): Int {

@ -1,8 +1,9 @@
package com.example.shakecraft.model package com.example.shakecraft.model
import com.example.shakecraft.R import com.example.shakecraft.R
class ItemManager {
enum class ITEMS(val itemtype: ItemType){ companion object {
enum class ITEMS(val itemtype: ItemType){
// Craftable items and resources // Craftable items and resources
BEECH_LOG(ItemType(name = "Beech Log", image = R.drawable.log2, rarity = 1, xpReward = 10)), BEECH_LOG(ItemType(name = "Beech Log", image = R.drawable.log2, rarity = 1, xpReward = 10)),
@ -20,12 +21,15 @@ enum class ITEMS(val itemtype: ItemType){
IRON_ORE(ItemType(name = "Iron Ore", image = R.drawable.iron_ore, rarity = 2, xpReward = 25)), IRON_ORE(ItemType(name = "Iron Ore", image = R.drawable.iron_ore, rarity = 2, xpReward = 25)),
IRON_INGOT(ItemType(name = "Iron Ingot", image = R.drawable.iron_ingot, rarity = 1, xpReward = 0)), IRON_INGOT(ItemType(name = "Iron Ingot", image = R.drawable.iron_ingot, rarity = 1, xpReward = 0)),
OPEN_TREASURE(ItemType(name = "Open Treasure", image = R.drawable.open_treasure, rarity = 3, xpReward = 50)),
// Lootable items // Lootable items
MONSTER_BONES(ItemType(name = "Monster Bones", image = R.drawable.monster_bones, rarity = 1, xpReward = 10)), MONSTER_BONES(ItemType(name = "Monster Bones", image = R.drawable.monster_bones, rarity = 1, xpReward = 10)),
MONSTER_EYE(ItemType(name = "Monster Eye", image = R.drawable.monster_eyes, rarity = 2, xpReward = 20)), MONSTER_EYE(ItemType(name = "Monster Eye", image = R.drawable.monster_eyes, rarity = 2, xpReward = 20)),
TREASURE_KEY(ItemType(name = "Treasure Key", image = R.drawable.treasure_key, rarity = 2, xpReward = 20)), TREASURE_KEY(ItemType(name = "Treasure Key", image = R.drawable.treasure_key, rarity = 2, xpReward = 20)),
TREASURE(ItemType(name = "Treasure", image = R.drawable.treasure, rarity = 3, xpReward = 20)),
}
}
} }

@ -1,18 +1,13 @@
package com.example.shakecraft.model package com.example.shakecraft.model
import com.example.shakecraft.R import com.example.shakecraft.R
import com.example.shakecraft.model.Generator.Companion.generateTreasure
class Player(var pseudo: String, var xp: Int = 0) { class Player(val pseudo: String, var xp: Int = 0) {
var level: Int = 1 var level: Int = 1
private set
val image: Int = R.drawable.player_image val image: Int = R.drawable.player_image
var items: MutableList<Item> = mutableListOf() var items: MutableList<Item> = mutableListOf()
private set
var rank: String = "Beginner" var rank: String = "Beginner"
private set
var equipedItem : Tool? = null
private set
fun changeRank(){ fun changeRank(){
@ -33,16 +28,10 @@ class Player(var pseudo: String, var xp: Int = 0) {
val findItem = items.find { it.type.name == item.type.name } val findItem = items.find { it.type.name == item.type.name }
if(findItem!= null){ if(findItem!= null){
println("findItem n: "+findItem.stack+" item nb:"+item.stack)
findItem.stack += item.stack findItem.stack += item.stack
} }
else{ else{items.add(Item(type = item.type, stack = item.stack))}
if(item is Tool){
items.add(Tool(type = item.type, stack = item.stack, 4))
}
else{
items.add(Item(type = item.type, stack = item.stack))
}
}
} }
fun gainXp(xp: Int) { fun gainXp(xp: Int) {
@ -54,12 +43,6 @@ class Player(var pseudo: String, var xp: Int = 0) {
} }
} }
fun attack() : Int{
if(equipedItem == null)
return 0
return equipedItem!!.damage
}
fun hasItem(item: Item) : Boolean{ fun hasItem(item: Item) : Boolean{
for (playeritem in items){ for (playeritem in items){
@ -70,33 +53,25 @@ class Player(var pseudo: String, var xp: Int = 0) {
return false return false
} }
fun craft(recipe: Recipe, count: Int = 1) : Boolean{ fun craft(recipe: Recipe) : Boolean{
println("test") println("test")
for (i in 1..count) {
for (ingredient in recipe.ingredients) { for (ingredient in recipe.ingredients) {
val searchedItem = items.find { it.type == ingredient.type } val searchedItem = items.find { it.type.name == ingredient.type.name }
if (searchedItem != null) { if(searchedItem != null) {
searchedItem.stack -= ingredient.stack searchedItem.stack -= ingredient.stack
if (searchedItem.stack == 0) { if (searchedItem.stack == 0){
items.remove(searchedItem) items.remove(searchedItem)
} }
} println(ingredient.type.name)
} if (recipe.item.type.name == "Open Treasure"){
println("item:" + recipe.item.stack) addItem(generateTreasure())
addItem(recipe.item)
}
return true return true
} }
fun equipeItem(item : Item) : Boolean{
if(equipedItem == item) {
println("ca jarte")
equipedItem = null
return false
} }
equipedItem = item as Tool }
println("item:"+recipe.item.stack)
addItem(recipe.item)
return true return true
} }
} }

@ -1,4 +1,5 @@
package com.example.shakecraft.model package com.example.shakecraft.model
import com.example.shakecraft.model.ItemManager.Companion.ITEMS
class RecipeManager { class RecipeManager {
@ -20,24 +21,28 @@ class RecipeManager {
Item(type = ITEMS.WOODEN_STICK.itemtype, stack = 2), Item(type = ITEMS.WOODEN_STICK.itemtype, stack = 2),
Item(type = ITEMS.WOODEN_PLANK.itemtype, stack = 2) Item(type = ITEMS.WOODEN_PLANK.itemtype, stack = 2)
), "Objects"), ), "Objects"),
Recipe(
Item(type = ITEMS.OPEN_TREASURE.itemtype, stack = 1),listOf(
Item(type = ITEMS.TREASURE.itemtype, stack = 1),
Item(type = ITEMS.TREASURE_KEY.itemtype, stack = 1)
), "Objects"),
) )
val recipeListTools : List<Recipe> = listOf( val recipeListTools : List<Recipe> = listOf(
Recipe( Recipe(
Tool(type = ITEMS.BRONZE_SWORD.itemtype, stack = 1, damage = 4),listOf( Item(type = ITEMS.BRONZE_SWORD.itemtype, stack = 1),listOf(
Item(type = ITEMS.WOODEN_STICK.itemtype, stack = 5), Item(type = ITEMS.WOODEN_STICK.itemtype, stack = 5),
Item(type = ITEMS.BRONZE_INGOT.itemtype, stack = 10) Item(type = ITEMS.BRONZE_INGOT.itemtype, stack = 10)
), "Tools"), ), "Tools"),
Recipe( Recipe(
Tool(type = ITEMS.WIZARD_STAFF.itemtype, stack = 1, damage = 6),listOf( Item(type = ITEMS.WIZARD_STAFF.itemtype, stack = 1),listOf(
Item(type = ITEMS.WOODEN_STICK.itemtype, stack = 10), Item(type = ITEMS.WOODEN_STICK.itemtype, stack = 10),
Item(type = ITEMS.MONSTER_EYE.itemtype, stack = 20), Item(type = ITEMS.MONSTER_EYE.itemtype, stack = 20),
), "Tools"), ), "Tools"),
Recipe( Recipe(
Tool(type = ITEMS.DIAMOND_AXE.itemtype, stack = 1, damage = 8),listOf( Item(type = ITEMS.DIAMOND_AXE.itemtype, stack = 1),listOf(
Item(type = ITEMS.WOODEN_STICK.itemtype, stack = 5), Item(type = ITEMS.WOODEN_STICK.itemtype, stack = 5),
Item(type = ITEMS.DIAMOND.itemtype, stack = 10), Item(type = ITEMS.DIAMOND.itemtype, stack = 10),
@ -74,14 +79,16 @@ class RecipeManager {
fun HowManyCraftable(recipe: Recipe, player: Player): Int{ fun HowManyCraftable(recipe: Recipe, player: Player): Int{
val divisedList = mutableListOf<Int>() val divisedList = mutableListOf<Int>()
return if (!isCraftable(recipe,player)) 0 if(isCraftable(recipe,player)==false)
return 0
else{ else{
for(element in recipe.ingredients){ for(element in recipe.ingredients){
println("cc")
val itemSearch = player.items.find { it.type.name == element.type.name } val itemSearch = player.items.find { it.type.name == element.type.name }
if(itemSearch!= null) if(itemSearch!= null)
divisedList.add(itemSearch.stack / element.stack) divisedList.add(itemSearch.stack / element.stack)
} }
divisedList.min() return divisedList.min()
} }
} }

@ -1,4 +0,0 @@
package com.example.shakecraft.model
class Tool(type : ItemType, stack: Int,val damage : Int) : Item(type, stack) {
}

@ -1,12 +0,0 @@
package com.example.shakecraft.services
import com.example.shakecraft.data.WeatherResponse
import retrofit2.http.GET
import retrofit2.http.Query
interface OpenWeatherMapService {
@GET("weather")
suspend fun getCurrentWeather(
@Query("q") cityName: String,
@Query("appid") apiKey: String
): WeatherResponse
}

@ -8,56 +8,29 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.example.shakecraft.R import com.example.shakecraft.R
import com.example.shakecraft.model.Item import com.example.shakecraft.model.Item
import com.example.shakecraft.model.Player
import com.example.shakecraft.model.Tool
class AdapterInventory(
private val inventory: List<Item>,
private val listener: OnItemLongClickListener,
private val currentPlayer : Player
) :
RecyclerView.Adapter<AdapterInventory.ViewHolder>() {
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view), View.OnLongClickListener { class AdapterInventory(private val inventory: List<Item>) : RecyclerView.Adapter<AdapterInventory.ViewHolder>() {
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val textView: TextView val textView: TextView
val textViewNumber: TextView val textViewNumber: TextView
var imageView: ImageView var imageView: ImageView
var armorIndicator : ImageView
init { init {
// Define click listener for the ViewHolder's View // Define click listener for the ViewHolder's View
itemView.setOnLongClickListener(this)
textView = view.findViewById(R.id.item_name) textView = view.findViewById(R.id.item_name)
textViewNumber = view.findViewById(R.id.item_stock) textViewNumber = view.findViewById(R.id.item_stock)
imageView = view.findViewById(R.id.item_image) imageView = view.findViewById(R.id.item_image)
armorIndicator = view.findViewById(R.id.armor_indicator)
}
override fun onLongClick(v: View?): Boolean {
val position = adapterPosition
if(position != RecyclerView.NO_POSITION) {
listener.onItemLongClick(position)
}
return true
} }
fun bind(item: Item) { fun bind(item: Item) {
textView.text = item.type.name textView.text = item.type.name
textViewNumber.text = item.stack.toString() textViewNumber.text = item.stack.toString()
imageView.setImageResource(item.type.image) imageView.setImageResource(item.type.image)
if (item is Tool) {
println("tool")
armorIndicator.visibility = View.VISIBLE
if(currentPlayer.equipedItem == item) armorIndicator.setImageResource(R.drawable.armor_equiped_icon) else armorIndicator.setImageResource(R.drawable.armor_icon)
}
} }
}
interface OnItemLongClickListener{
fun onItemLongClick(position: Int)
} }
override fun getItemCount() = inventory.size override fun getItemCount() = inventory.size

@ -0,0 +1,3 @@
package com.example.shakecraft.view.viewholder
class ViewHolderInventory(inflate: Any?) {
}

@ -1,39 +0,0 @@
package com.example.shakecraft.viewmodel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.example.shakecraft.data.Stub
import com.example.shakecraft.model.Boss
import com.example.shakecraft.model.Item
import com.example.shakecraft.model.Recipe
class MainViewModel : ViewModel() {
var currentPlayer = MutableLiveData(Stub().load())
lateinit var currentBoss : Boss
val isBossInitialized get() = this::currentBoss.isInitialized
fun craft(recipe : Recipe, count : Int = 1){
currentPlayer.value?.craft(recipe, count)
this.currentPlayer.value = currentPlayer.value
}
fun addItem(item: Item) {
currentPlayer.value?.addItem(item)
this.currentPlayer.value = currentPlayer.value
}
fun gainXp(xpReward: Int) {
currentPlayer.value?.gainXp(xpReward)
this.currentPlayer.value = currentPlayer.value
}
fun equipeItem(item: Item): Boolean {
currentPlayer.value?.equipeItem(item)
this.currentPlayer.value = currentPlayer.value
return true
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 929 B

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/black_800"/>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"/>
<stroke android:width="1dp"
android:color="@color/grey_100" />
</shape>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

@ -1,450 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black_800"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:paddingBottom="10dp"
android:text="@string/home_title"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:background="@drawable/rounded_border_button"
android:paddingLeft="15dp"
android:paddingRight="15dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2">
<LinearLayout
android:id="@+id/profil_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="10dp">
<ImageView
android:id="@+id/imageView2"
android:layout_width="60dp"
android:layout_height="95dp"
android:layout_gravity="bottom"
android:contentDescription="@string/landscape"
android:src="@drawable/background" />
<ImageView
android:id="@+id/playerImage"
android:layout_width="50dp"
android:layout_height="80dp"
android:layout_gravity="bottom"
android:contentDescription="Landscape" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<EditText
android:id="@+id/pseudoEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pseudo"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lvl."
android:textColor="@color/grey_300" />
<TextView
android:id="@+id/levelTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2"
android:textColor="@color/grey_300" />
<ProgressBar
android:id="@+id/levelProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="5dp"
android:layout_marginHorizontal="10dp"
android:layout_weight="1"
android:max="100"
android:progress="20"
android:progressDrawable="@drawable/custom_level_progressbar" />
<TextView
android:id="@+id/xpTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="349"
android:textColor="@color/white" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/"
android:textColor="@color/white" />
<TextView
android:id="@+id/maxXpTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="10dp"
android:text="Rank"
android:textColor="@color/grey_300" />
<TextView
android:id="@+id/rankTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Beginner"
android:textColor="@color/white"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingBottom="15dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/profil_container"
tools:layout_editor_absoluteX="15dp">
<ImageView
android:id="@+id/equipedItemAttack"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="bottom"
android:layout_marginRight="10dp"
android:background="@drawable/background_equiped_item"
android:contentDescription="Landscape"
android:tooltipText="Equiped Weapon" />
<ImageView
android:id="@+id/equipedItemFishing"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="bottom"
android:layout_marginRight="10dp"
android:background="@drawable/background_equiped_item"
android:contentDescription="Landscape"
android:tooltipText="Equiped Fishing Rod" />
<ImageView
android:id="@+id/equipedItemCollect"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="bottom"
android:layout_marginRight="10dp"
android:background="@drawable/background_equiped_item"
android:contentDescription="Landscape"
android:tooltipText="Equiped Tool" />
<ImageView
android:id="@+id/equipedItemArmor"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="bottom"
android:layout_marginRight="10dp"
android:background="@drawable/background_equiped_item"
android:contentDescription="Landscape"
android:tooltipText="Equiped Armor" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:id="@+id/scroll_activties"
android:layout_width="220dp"
android:layout_height="200dp"
android:layout_marginStart="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/constraintLayout"
app:layout_constraintTop_toBottomOf="@+id/textView2">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/buttonForge"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="10dp"
android:background="@drawable/rounded_border_button"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/imageView2"
android:layout_width="40dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/ic_anvil" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ancient Forge"
android:textColor="@color/white"
android:textStyle="bold" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Craft ever more powerful tools."
android:textColor="@color/grey_300"
android:textSize="11sp" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/buttonCollect"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="10dp"
android:background="@drawable/rounded_border_button"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonForge">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/imageView2"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/ic_tree" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pleasant Forest"
android:textColor="@color/white"
android:textStyle="bold" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Collect ressources to became powerfull."
android:textColor="@color/grey_300"
android:textSize="11sp" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/buttonBoss"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="10dp"
android:background="@drawable/rounded_border_button"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonCollect">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/imageView2"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/ic_key" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dungeon"
android:textColor="@color/white"
android:textStyle="bold" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Defeat boss to gain Mystic rewards."
android:textColor="@color/grey_300"
android:textSize="11sp" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<LinearLayout
android:id="@+id/event_container"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="20dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/scroll_activties"
app:layout_constraintTop_toBottomOf="@+id/textView2">
<ImageView
android:id="@+id/event_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:clickable="true"
android:maxWidth="200dip"
android:scaleType="centerCrop"
android:src="@drawable/event_message"
android:visibility="visible">
</ImageView>
<ImageView
android:id="@+id/buttonFishing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:clickable="true"
android:visibility="gone"
android:maxWidth="200dip"
android:scaleType="centerCrop"
android:src="@drawable/fishing_event">
</ImageView>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -27,8 +27,7 @@
android:id="@+id/fragment" android:id="@+id/fragment"
android:name="androidx.navigation.fragment.NavHostFragment" android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="725dp"
android:layout_marginBottom="63dp"
app:defaultNavHost="true" app:defaultNavHost="true"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

@ -24,24 +24,24 @@
android:id="@+id/backbutton" android:id="@+id/backbutton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical" android:layout_gravity="left|center_vertical"
android:focusable="true" android:focusable="true"
android:text="@string/ancient_forge" android:drawableStart="@drawable/back"
android:drawableTint="@color/blue"
android:text="Ancient Forge"
android:textColor="@color/blue" android:textColor="@color/blue"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent" />
app:drawableStartCompat="@drawable/back"
app:drawableTint="@color/blue" />
<TextView <TextView
android:id="@+id/textView2" android:id="@+id/textView2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/recipe" android:text="Recipe"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
@ -63,7 +63,6 @@
app:layout_constraintTop_toBottomOf="@+id/frameLayout"> app:layout_constraintTop_toBottomOf="@+id/frameLayout">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -72,33 +71,15 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView <ImageView
android:id="@+id/item_image" android:id="@+id/item_image"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:background="@drawable/item_recipe_background" android:background="@drawable/item_recipe_background"
android:contentDescription="@string/image_of_item" android:contentDescription="image of item"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/wooden_stick" /> app:srcCompat="@drawable/wooden_stick" />
<TextView
android:id="@+id/craftValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:text="1"
android:paddingRight="2dp"
android:textColor="@color/white" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView <TextView
android:id="@+id/item_name" android:id="@+id/item_name"
@ -149,34 +130,19 @@
</LinearLayout> </LinearLayout>
<Button
android:id="@+id/buttonForgeMax"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:layout_marginBottom="5dp"
android:backgroundTint="@color/button_background_color"
android:text="FORGE MAX"
android:textColor="@color/white"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/buttonForge"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.473"
app:layout_constraintStart_toStartOf="parent" />
<Button <Button
android:id="@+id/buttonForge" android:id="@+id/buttonForge"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp" android:layout_marginHorizontal="10dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:backgroundTint="@color/button_background_color"
android:text="Forge" android:text="Forge"
android:textColor="@color/white"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent"
android:backgroundTint="@color/button_background_color"
android:textColor="@color/white"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -184,7 +150,7 @@
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/buttonForgeMax" app:layout_constraintBottom_toTopOf="@+id/buttonForge"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
android:background="@drawable/craftable_background" android:background="@drawable/craftable_background"

@ -14,20 +14,20 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:paddingTop="50dp" android:paddingTop="50dp"
android:paddingBottom="30dp" android:paddingBottom="20dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/RecipeScroll"> android:layout_marginBottom="20dp">
<TextView <TextView
android:id="@+id/backbutton" android:id="@+id/backbutton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical" android:layout_gravity="left|center_vertical"
android:focusable="true" android:focusable="true"
app:drawableStartCompat="@drawable/back" android:drawableStart="@drawable/back"
app:drawableTint="@color/blue" android:drawableTint="@color/blue"
android:text="Home" android:text="Home"
android:textColor="@color/blue" android:textColor="@color/blue"
android:textSize="16sp" android:textSize="16sp"
@ -51,108 +51,96 @@
</FrameLayout> </FrameLayout>
<androidx.core.widget.NestedScrollView <ScrollView
android:id="@+id/RecipeScroll" android:id="@+id/RecipeScroll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="4294967294dp" android:layout_height="635dp"
android:paddingHorizontal="10dp" android:paddingHorizontal="10dp"
app:layout_constraintTop_toBottomOf="@id/frameLayout"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@+id/frameLayout">
>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:background="@drawable/recipelistcard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginVertical="10dp"
android:background="@drawable/recipelistcard"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginVertical="10dp"
android:paddingBottom="10dp"> android:paddingBottom="10dp">
<TextView <TextView
android:paddingTop="20dp"
android:paddingLeft="20dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="20dp" android:textSize="17dp"
android:paddingTop="20dp"
android:text="Objects"
android:textColor="@color/grey_400" android:textColor="@color/grey_400"
android:textSize="17sp" android:textStyle="bold"
android:textStyle="bold" /> android:text="Objects"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:overScrollMode="never"
android:id="@+id/RecyclerviewObjects" android:id="@+id/RecyclerviewObjects"
android:layout_marginHorizontal="20dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp" tools:listitem="@layout/list_recipe"
android:overScrollMode="never" tools:itemCount="3"/>
tools:itemCount="3"
tools:listitem="@layout/list_recipe" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:background="@drawable/recipelistcard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginVertical="10dp"
android:background="@drawable/recipelistcard"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginVertical="10dp"
android:paddingBottom="10dp"> android:paddingBottom="10dp">
<TextView <TextView
android:paddingTop="20dp"
android:paddingLeft="20dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="20dp" android:textSize="17dp"
android:paddingTop="20dp"
android:text="Tools"
android:textColor="@color/grey_400" android:textColor="@color/grey_400"
android:textSize="17sp" android:textStyle="bold"
android:textStyle="bold" /> android:text="Tools"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:overScrollMode="never"
android:id="@+id/RecyclerviewTools" android:id="@+id/RecyclerviewTools"
android:layout_marginHorizontal="20dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp" tools:listitem="@layout/list_recipe"
android:overScrollMode="never" tools:itemCount="3"/>
tools:itemCount="3"
tools:listitem="@layout/list_recipe" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:background="@drawable/recipelistcard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginVertical="10dp"
android:background="@drawable/recipelistcard"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginVertical="10dp"
android:paddingBottom="10dp"> android:paddingBottom="10dp">
<TextView <TextView
android:paddingTop="20dp"
android:paddingLeft="20dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="20dp" android:textSize="17dp"
android:paddingTop="20dp"
android:text="Blacksmithing"
android:textColor="@color/grey_400" android:textColor="@color/grey_400"
android:textSize="17sp" android:textStyle="bold"
android:textStyle="bold" /> android:text="Blacksmithing"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/RecyclerviewBlacksmithing" android:id="@+id/RecyclerviewBlacksmithing"
android:overScrollMode="never"
android:layout_marginHorizontal="20dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp" tools:listitem="@layout/list_recipe"
android:overScrollMode="never" tools:itemCount="3"/>
tools:itemCount="3"
tools:listitem="@layout/list_recipe"/>
</LinearLayout> </LinearLayout>
@ -161,6 +149,7 @@
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

@ -66,11 +66,11 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="15dp" android:layout_margin="15dp"
android:orientation="vertical"> android:orientation="vertical">
<EditText <TextView
android:id="@+id/pseudoEditText" android:id="@+id/pseudoTextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Pseudo" android:text="Pseudo"
@ -149,48 +149,6 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textStyle="bold"/> android:textStyle="bold"/>
</LinearLayout> </LinearLayout>
<LinearLayout
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/equipedItemAttack"
android:tooltipText="Equiped Weapon"
android:layout_gravity="bottom"
android:background="@drawable/background_equiped_item"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="Landscape"
android:layout_marginRight="10dp"/>
<ImageView
android:tooltipText="Equiped Fishing Rod"
android:id="@+id/equipedItemFishing"
android:layout_gravity="bottom"
android:background="@drawable/background_equiped_item"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="Landscape"
android:layout_marginRight="10dp"/>
<ImageView
android:id="@+id/equipedItemCollect"
android:tooltipText="Equiped Tool"
android:layout_gravity="bottom"
android:background="@drawable/background_equiped_item"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="Landscape"
android:layout_marginRight="10dp"/>
<ImageView
android:id="@+id/equipedItemArmor"
android:tooltipText="Equiped Armor"
android:layout_gravity="bottom"
android:background="@drawable/background_equiped_item"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="Landscape"
android:layout_marginRight="10dp"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -300,7 +258,7 @@
android:id="@+id/textView5" android:id="@+id/textView5"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Collect ressources to became powerfull." android:text="Craft ever more powerful tools."
android:textColor="@color/grey_300" android:textColor="@color/grey_300"
android:textSize="11sp" /> android:textSize="11sp" />
</LinearLayout> </LinearLayout>
@ -356,7 +314,7 @@
android:id="@+id/textView5" android:id="@+id/textView5"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Defeat boss to gain Mystic rewards." android:text="Craft ever more powerful tools."
android:textColor="@color/grey_300" android:textColor="@color/grey_300"
android:textSize="11sp" /> android:textSize="11sp" />
</LinearLayout> </LinearLayout>
@ -364,51 +322,6 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:orientation="vertical"
android:id="@+id/event_container"
android:layout_height="200dp"
android:gravity="center_horizontal"
android:visibility="visible"
android:layout_width="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:paddingBottom="20dp">
<ImageView
android:id="@+id/event_message"
android:visibility="visible"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="300dip"
android:src="@drawable/event_message"
android:scaleType="centerCrop"
android:adjustViewBounds ="true">
</ImageView>
<ImageView
android:id="@+id/buttonFishing"
android:visibility="gone"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="380dip"
android:src="@drawable/fishing_event"
android:scaleType="centerCrop"
android:adjustViewBounds ="true">
</ImageView>
</LinearLayout>

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
@ -8,7 +9,7 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginVertical="5dp"> android:layout_marginTop="10dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -19,7 +20,6 @@
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:contentDescription="@string/lib_name"
android:id="@+id/item_image" android:id="@+id/item_image"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
@ -28,7 +28,6 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -40,13 +39,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/white" android:textColor="@color/white"
android:textStyle="bold" /> android:textStyle="bold" />
<ImageView
android:id="@+id/armor_indicator"
android:visibility="gone"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginLeft="5dp" />
<View <View
android:layout_width="wrap_content" android:layout_width="wrap_content"

@ -48,11 +48,7 @@
<action <action
android:id="@+id/action_homeFragment_to_collectFragment" android:id="@+id/action_homeFragment_to_collectFragment"
app:destination="@id/collectFragment" app:destination="@id/collectFragment"
app:enterAnim="@android:anim/fade_in" app:enterAnim="@android:anim/fade_in" />
app:popUpTo="@id/homeFragment"
app:popUpToInclusive="true"
app:popUpToSaveState="true"
app:restoreState="true" />
<action <action
android:id="@+id/action_homeFragment_to_bossFragment" android:id="@+id/action_homeFragment_to_bossFragment"
app:destination="@id/bossFragment" app:destination="@id/bossFragment"

@ -6,7 +6,4 @@
<string name="hello_blank_fragment">Hello blank fragment</string> <string name="hello_blank_fragment">Hello blank fragment</string>
<string name="landscape">landscape</string> <string name="landscape">landscape</string>
<string name="wikiImage">Wiki image</string> <string name="wikiImage">Wiki image</string>
<string name="ancient_forge">Ancient Forge</string>
<string name="recipe">Recipe</string>
<string name="image_of_item">Image</string>
</resources> </resources>
Loading…
Cancel
Save