Compare commits

..

25 Commits

Author SHA1 Message Date
Lucas DELANIER c2dd429e9c Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas DELANIER df73330ce4 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas DELANIER 945f0eeda5 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas DELANIER 1e46767d2b Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas DELANIER b47c4f4c88 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier af20aa2832 correct bugs
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 1dab25c89e livedata and observer on needed fragments
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 20df5325ab livedata and observer on needed fragments
2 years ago
Lucas Delanier 245ff1bffd working livedata on craft
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 043dd9ca4f fix problem string
2 years ago
Lucas DELANIER 37b8b0f95d Transférer les fichiers vers 'Documentations'
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas DELANIER ee76fcb954 Transférer les fichiers vers 'Documentations'
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier a851991274 little arrangements to make the code more kotlin spirit ⚗️
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 218e85d571 add max craft button 🎉
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 640950bc50 save the currentboss in tthe viewmodel 🎉
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 35fd67cbcf viewModel to save state
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier bf752264ef Merge branch 'OpenWeatherApi'
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier b04739859f merge api
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 509506ebb8 clean code smells
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 3b1bcc6fcf editText binding twoWay on pseudo of currentplayer
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 0d2d21832e adaptive homepage for landscape orientation
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 6635825713 add fishing event notification on home page
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier bb0b05ed91 fix forge responsive widget
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 2b44820d67 add retrofit call weatherapi
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier ab0f8a0462 clean master
continuous-integration/drone/push Build is passing Details
2 years ago

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

@ -34,12 +34,29 @@ 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)
## :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
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
<p align="center">

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

@ -33,19 +33,37 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
}
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
}
}
apply plugin: 'kotlin-kapt'
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.ar.sceneform:filament-android:1.17.1'
implementation 'androidx.navigation:navigation-fragment-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'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
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,6 +16,7 @@ import android.view.animation.ScaleAnimation
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -24,6 +25,7 @@ import com.example.shakecraft.model.Generator
import com.example.shakecraft.model.Item
import com.example.shakecraft.model.Player
import com.example.shakecraft.view.adapter.AdapterBossLoot
import com.example.shakecraft.viewmodel.MainViewModel
import kotlin.math.pow
import kotlin.math.sqrt
@ -37,7 +39,7 @@ class BossFragment() : Fragment() {
private lateinit var image: ImageView
private lateinit var buttonCollect: TextView
private lateinit var recyclerView: RecyclerView
private lateinit var boss: Boss
val viewModel : MainViewModel by activityViewModels<MainViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -47,21 +49,22 @@ class BossFragment() : Fragment() {
savedInstanceState: Bundle?
): View? {
val currentPlayer = (activity as MainActivity).currentPlayer
val view = inflater.inflate(R.layout.fragment_boss, container, false)
// Initialize views
initializeViews(view)
// Set up boss
boss = Generator.generateBoss()
setUpBoss(boss)
if(!viewModel.isBossInitialized)
viewModel.currentBoss = Generator.generateBoss()
setUpBoss(viewModel.currentBoss)
// Set up RecyclerView for boss loot
setUpRecyclerView(view)
// Set up accelerometer listener
setUpAccelerometerListener(view, currentPlayer)
viewModel.currentPlayer.value?.let { setUpAccelerometerListener(view, it) }
// Set up activity orientation
setUpActivityOrientation()
@ -102,7 +105,7 @@ class BossFragment() : Fragment() {
recyclerView = view.findViewById(R.id.recyclerviewBossLoot)
with(recyclerView) {
layoutManager = LinearLayoutManager(view.context)
adapter = AdapterBossLoot(boss.possibleLoot)
adapter = AdapterBossLoot(viewModel.currentBoss.possibleLoot)
}
}
private fun setUpActivityOrientation(){
@ -117,7 +120,7 @@ class BossFragment() : Fragment() {
toastView.visibility = View.VISIBLE
lootImage.setImageResource(item.type.image)
lootName.text = item.type.name
xpReward.text = boss.xpReward.toString()
xpReward.text = viewModel.currentBoss.xpReward.toString()
toastView.postDelayed({
toastView.visibility = View.GONE
}, 3000)
@ -131,35 +134,35 @@ class BossFragment() : Fragment() {
}
override fun onSensorChanged(event: SensorEvent?) {
val acceleration = sqrt(event!!.values[0].pow(2) + event.values[1].pow(2) + event.values[2].pow(2))
if (boss.life <= 0) {
if (viewModel.currentBoss.life <= 0) {
//Vibration to signal the death of the boss
val vibrator = context?.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
vibrator.vibrate(100)
// Generate a loot item and XP reward
val item = Generator.generateLootBoss(boss.possibleLoot)
val item = Generator.generateLootBoss(viewModel.currentBoss.possibleLoot)
currentPlayer.addItem(item)
currentPlayer.gainXp(boss.xpReward)
currentPlayer.gainXp(viewModel.currentBoss.xpReward)
// Show loot toast view for 3 seconds
displayToast(view,item)
// Spawn new boss and reset progress bar
boss = Generator.generateBoss()
setUpBoss(boss)
viewModel.currentBoss = Generator.generateBoss()
setUpBoss(viewModel.currentBoss)
//Update displayed information
setUpRecyclerView(view)
} else {
if(acceleration > 20){
boss.takeDamage(((acceleration / 80)+ currentPlayer.attack()/100).toDouble())
viewModel.currentBoss.takeDamage(((acceleration / 80)+ currentPlayer.attack()/100).toDouble())
}
else{
boss.takeDamage(currentPlayer.attack().toDouble()/100)
viewModel.currentBoss.takeDamage(currentPlayer.attack().toDouble()/100)
}
progressBar.progress = boss.life.toInt()
progressBar.progress = viewModel.currentBoss.life.toInt()
}
}

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

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

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

@ -1,22 +1,26 @@
package com.example.shakecraft
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.navigation.NavOptions
import androidx.navigation.fragment.findNavController
import com.example.shakecraft.model.Player
import com.example.shakecraft.viewmodel.MainViewModel
class HomeFragment : Fragment() {
private lateinit var pseudo : TextView
private lateinit var pseudoEditText : EditText
private lateinit var progressbar : ProgressBar
private lateinit var level : TextView
private lateinit var rank : TextView
@ -27,20 +31,27 @@ class HomeFragment : Fragment() {
private lateinit var buttonForge : ConstraintLayout
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?) {
super.onCreate(savedInstanceState)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val currentPlayer = (activity as MainActivity).currentPlayer
val isRaining = (activity as MainActivity).isRaining
val view = inflater.inflate(R.layout.fragment_home,container,false)
// Initialize views
initializeViews(view, currentPlayer)
viewModel.currentPlayer.observe(viewLifecycleOwner, Observer {
initializeViews(view, it, isRaining)
})
return view
}
@ -50,8 +61,7 @@ class HomeFragment : Fragment() {
val
}
}*/
private fun initializeViews(view: View, currentPlayer : Player) {
pseudo = view.findViewById(R.id.pseudoTextView)
private fun initializeViews(view: View, currentPlayer : Player, isRaining : Boolean) {
progressbar = view.findViewById(R.id.levelProgressBar)
level = view.findViewById(R.id.levelTextView)
rank = view.findViewById(R.id.rankTextView)
@ -60,6 +70,7 @@ class HomeFragment : Fragment() {
playermage = view.findViewById(R.id.playerImage)
buttonCollect = view.findViewById(R.id.buttonCollect)
equipeditem = view.findViewById(R.id.equipedItemAttack)
eventFishing = view.findViewById(R.id.buttonFishing)
buttonCollect.setOnClickListener{
findNavController().navigate(R.id.action_homeFragment_to_collectFragment, null, NavOptions.Builder().setPopUpTo(R.id.homeFragment, false).build())
}
@ -71,7 +82,6 @@ class HomeFragment : Fragment() {
buttonForge.setOnClickListener{
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()
rank.text = currentPlayer.rank
xp.text = currentPlayer.xp.toString()
@ -79,8 +89,35 @@ class HomeFragment : Fragment() {
progressbar.progress = currentPlayer.xp
progressbar.max = currentPlayer.level*100
playermage.setImageResource(currentPlayer.image)
if(currentPlayer.equipedItem?.type?.image != null) equipeditem.setImageResource(
currentPlayer.equipedItem!!.type.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()
}
})
}

@ -5,36 +5,31 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.shakecraft.model.Player
import com.example.shakecraft.model.Tool
import com.example.shakecraft.view.adapter.AdapterInventory
import com.example.shakecraft.viewmodel.MainViewModel
class InventoryFragment() : Fragment( ), AdapterInventory.OnItemLongClickListener {
private lateinit var currentPlayer: Player
private lateinit var recyclerView: RecyclerView
val viewModel : MainViewModel by activityViewModels<MainViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
override fun onItemLongClick(position: Int) {
if(currentPlayer.items[position] is Tool) {
if (currentPlayer.equipeItem(currentPlayer.items[position]) == true)
Toast.makeText(
context,
currentPlayer.items[position].type.name + " was well equipped",
Toast.LENGTH_SHORT
).show()
else
Toast.makeText(
context,
currentPlayer.items[position].type.name + " has been well unequipped",
Toast.LENGTH_SHORT
).show()
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)
}
}
@ -43,7 +38,6 @@ class InventoryFragment() : Fragment( ), AdapterInventory.OnItemLongClickListene
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
currentPlayer = (activity as MainActivity).currentPlayer
val view = inflater.inflate(R.layout.fragment_inventory, container, false)
// Initialize views
@ -55,9 +49,14 @@ class InventoryFragment() : Fragment( ), AdapterInventory.OnItemLongClickListene
recyclerView = view.findViewById(R.id.recyclerviewInventory)
with(recyclerView) {
layoutManager = LinearLayoutManager(view.context)
adapter = AdapterInventory(currentPlayer.items, listener , currentPlayer)
adapter = viewModel.currentPlayer.value?.let {
AdapterInventory(viewModel.currentPlayer.value!!.items, listener ,
it
)
}
}
}
}

@ -4,6 +4,7 @@ import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.activity.viewModels
import androidx.annotation.RequiresApi
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
@ -11,14 +12,18 @@ import androidx.core.view.WindowInsetsControllerCompat
import androidx.navigation.findNavController
import androidx.navigation.ui.NavigationUI
import androidx.navigation.ui.setupWithNavController
import com.example.shakecraft.data.Stub
import com.example.shakecraft.services.OpenWeatherMapService
import com.example.shakecraft.viewmodel.MainViewModel
import com.google.android.material.bottomnavigation.BottomNavigationView
import kotlinx.coroutines.*
import retrofit2.Retrofit
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)
private fun hideSystemUI() {
@ -39,7 +44,24 @@ class MainActivity: AppCompatActivity() {
super.onCreate(savedInstanceState)
hideSystemUI()
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)
val navController = findNavController(R.id.fragment)
@ -56,9 +78,12 @@ class MainActivity: AppCompatActivity() {
}
}
override fun onResume() {
super.onResume()
@ -71,4 +96,5 @@ class MainActivity: AppCompatActivity() {
}

@ -1,22 +1,16 @@
package com.example.shakecraft.data
import com.example.shakecraft.model.ItemManager.Companion.ITEMS
import com.example.shakecraft.model.Item
import com.example.shakecraft.model.Player
import com.example.shakecraft.model.Tool
import com.example.shakecraft.model.*
class Stub {
fun load() : Player{
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(Tool(type = ITEMS.BRONZE_SWORD.itemtype, stack = 1, damage = 4))
items.add(Tool(type = ITEMS.DIAMOND_AXE.itemtype, stack = 1, damage = 8))
currentPlayer.items = items
currentPlayer.addItem(Item(type = ITEMS.BEECH_LOG.itemtype, stack = 30))
currentPlayer.addItem(Item(type = ITEMS.BRONZE_INGOT.itemtype, stack = 30))
currentPlayer.addItem(Tool(type = ITEMS.DIAMOND_AXE.itemtype, stack = 1, damage = 8))
return currentPlayer
}

@ -0,0 +1,19 @@
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
)

@ -0,0 +1,15 @@
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)
}

@ -0,0 +1,16 @@
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)
}

@ -1,6 +1,5 @@
package com.example.shakecraft.model
import com.example.shakecraft.R
import com.example.shakecraft.model.ItemManager.Companion.ITEMS
import kotlin.random.Random
class Generator {

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

@ -1,34 +1,31 @@
package com.example.shakecraft.model
import com.example.shakecraft.R
class ItemManager {
companion object {
enum class ITEMS(val itemtype: ItemType){
// Craftable items and resources
BEECH_LOG(ItemType(name = "Beech Log", image = R.drawable.log2, rarity = 1, xpReward = 10)),
WOODEN_STICK(ItemType(name = "Wooden Stick", image = R.drawable.wooden_stick, rarity = 1, xpReward = 0)),
WOODEN_PLANK(ItemType(name = "Wooden Plank", image = R.drawable.wooden_plank, rarity = 1, xpReward = 0)),
WOODEN_BALL(ItemType(name = "Wooden Ball", image = R.drawable.wooden_ball, rarity = 1, xpReward = 0)),
WIZARD_STAFF(ItemType(name = "Wizard Staff", image = R.drawable.wizard_staff, rarity = 3, xpReward = 0)),
enum class ITEMS(val itemtype: ItemType){
DIAMOND(ItemType(name = "Diamond", image = R.drawable.diamond, rarity = 3, xpReward = 30)),
DIAMOND_AXE(ItemType(name = "Diamond Axe", image = R.drawable.diamond_axe, rarity = 3, xpReward = 0)),
// Craftable items and resources
BEECH_LOG(ItemType(name = "Beech Log", image = R.drawable.log2, rarity = 1, xpReward = 10)),
WOODEN_STICK(ItemType(name = "Wooden Stick", image = R.drawable.wooden_stick, rarity = 1, xpReward = 0)),
WOODEN_PLANK(ItemType(name = "Wooden Plank", image = R.drawable.wooden_plank, rarity = 1, xpReward = 0)),
WOODEN_BALL(ItemType(name = "Wooden Ball", image = R.drawable.wooden_ball, rarity = 1, xpReward = 0)),
WIZARD_STAFF(ItemType(name = "Wizard Staff", image = R.drawable.wizard_staff, rarity = 3, xpReward = 0)),
BRONZE_ORE(ItemType(name = "Bronze Ore", image = R.drawable.bronze_ore, rarity = 2, xpReward = 20)),
BRONZE_INGOT(ItemType(name = "Bronze Ingot", image = R.drawable.bronze_ingot, rarity = 1, xpReward = 0)),
BRONZE_SWORD(ItemType(name = "Bronze Sword", image = R.drawable.bronze_sword, rarity = 2, xpReward = 0)),
DIAMOND(ItemType(name = "Diamond", image = R.drawable.diamond, rarity = 3, xpReward = 30)),
DIAMOND_AXE(ItemType(name = "Diamond Axe", image = R.drawable.diamond_axe, rarity = 3, xpReward = 0)),
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)),
BRONZE_ORE(ItemType(name = "Bronze Ore", image = R.drawable.bronze_ore, rarity = 2, xpReward = 20)),
BRONZE_INGOT(ItemType(name = "Bronze Ingot", image = R.drawable.bronze_ingot, rarity = 1, xpReward = 0)),
BRONZE_SWORD(ItemType(name = "Bronze Sword", image = R.drawable.bronze_sword, rarity = 2, xpReward = 0)),
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)),
// Lootable items
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)),
TREASURE_KEY(ItemType(name = "Treasure Key", image = R.drawable.treasure_key, rarity = 2, xpReward = 20)),
// Lootable items
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)),
TREASURE_KEY(ItemType(name = "Treasure Key", image = R.drawable.treasure_key, rarity = 2, xpReward = 20)),
}
}
}

@ -2,12 +2,17 @@ package com.example.shakecraft.model
import com.example.shakecraft.R
class Player(val pseudo: String, var xp: Int = 0) {
class Player(var pseudo: String, var xp: Int = 0) {
var level: Int = 1
private set
val image: Int = R.drawable.player_image
var items: MutableList<Item> = mutableListOf()
private set
var rank: String = "Beginner"
private set
var equipedItem : Tool? = null
private set
fun changeRank(){
@ -28,7 +33,6 @@ class Player(val pseudo: String, var xp: Int = 0) {
val findItem = items.find { it.type.name == item.type.name }
if(findItem!= null){
println("findItem n: "+findItem.stack+" item nb:"+item.stack)
findItem.stack += item.stack
}
else{
@ -66,19 +70,21 @@ class Player(val pseudo: String, var xp: Int = 0) {
return false
}
fun craft(recipe: Recipe) : Boolean{
fun craft(recipe: Recipe, count: Int = 1) : Boolean{
println("test")
for (ingredient in recipe.ingredients) {
val searchedItem = items.find { it.type.name == ingredient.type.name }
if(searchedItem != null) {
searchedItem.stack -= ingredient.stack
if (searchedItem.stack == 0){
items.remove(searchedItem)
for (i in 1..count) {
for (ingredient in recipe.ingredients) {
val searchedItem = items.find { it.type == ingredient.type }
if (searchedItem != null) {
searchedItem.stack -= ingredient.stack
if (searchedItem.stack == 0) {
items.remove(searchedItem)
}
}
}
println("item:" + recipe.item.stack)
addItem(recipe.item)
}
println("item:"+recipe.item.stack)
addItem(recipe.item)
return true
}
@ -92,4 +98,5 @@ class Player(val pseudo: String, var xp: Int = 0) {
return true
}
}

@ -1,5 +1,4 @@
package com.example.shakecraft.model
import com.example.shakecraft.model.ItemManager.Companion.ITEMS
class RecipeManager {
@ -75,16 +74,14 @@ class RecipeManager {
fun HowManyCraftable(recipe: Recipe, player: Player): Int{
val divisedList = mutableListOf<Int>()
if(isCraftable(recipe,player)==false)
return 0
return if (!isCraftable(recipe,player)) 0
else{
for(element in recipe.ingredients){
println("cc")
val itemSearch = player.items.find { it.type.name == element.type.name }
if(itemSearch!= null)
divisedList.add(itemSearch.stack / element.stack)
}
return divisedList.min()
divisedList.min()
}
}

@ -0,0 +1,12 @@
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
}

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

@ -0,0 +1,39 @@
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.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

@ -0,0 +1,450 @@
<?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,7 +27,8 @@
android:id="@+id/fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="725dp"
android:layout_height="match_parent"
android:layout_marginBottom="63dp"
app:defaultNavHost="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

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

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

@ -66,12 +66,11 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:orientation="vertical">
<TextView
android:id="@+id/pseudoTextView"
<EditText
android:id="@+id/pseudoEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pseudo"
@ -301,7 +300,7 @@
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Craft ever more powerful tools."
android:text="Collect ressources to became powerfull."
android:textColor="@color/grey_300"
android:textSize="11sp" />
</LinearLayout>
@ -357,7 +356,7 @@
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Craft ever more powerful tools."
android:text="Defeat boss to gain Mystic rewards."
android:textColor="@color/grey_300"
android:textSize="11sp" />
</LinearLayout>
@ -365,6 +364,51 @@
</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>

@ -6,4 +6,7 @@
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="landscape">landscape</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>
Loading…
Cancel
Save