|
|
@ -1,11 +1,11 @@
|
|
|
|
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.ImageView
|
|
|
|
import android.widget.ImageView
|
|
|
|
|
|
|
|
import android.widget.LinearLayout
|
|
|
|
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
|
|
|
@ -26,6 +26,7 @@ class HomeFragment : Fragment() {
|
|
|
|
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 equipeditem: ImageView
|
|
|
|
|
|
|
|
private lateinit var event: LinearLayout
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
@ -37,10 +38,11 @@ class HomeFragment : Fragment() {
|
|
|
|
savedInstanceState: Bundle?
|
|
|
|
savedInstanceState: Bundle?
|
|
|
|
): View? {
|
|
|
|
): View? {
|
|
|
|
val currentPlayer = (activity as MainActivity).currentPlayer
|
|
|
|
val currentPlayer = (activity as MainActivity).currentPlayer
|
|
|
|
|
|
|
|
val isRaining = (activity as MainActivity).isRaining
|
|
|
|
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)
|
|
|
|
initializeViews(view, currentPlayer, isRaining)
|
|
|
|
|
|
|
|
|
|
|
|
return view
|
|
|
|
return view
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -50,7 +52,7 @@ class HomeFragment : Fragment() {
|
|
|
|
val
|
|
|
|
val
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
}*/
|
|
|
|
private fun initializeViews(view: View, currentPlayer : Player) {
|
|
|
|
private fun initializeViews(view: View, currentPlayer : Player, isRaining : Boolean) {
|
|
|
|
pseudo = view.findViewById(R.id.pseudoTextView)
|
|
|
|
pseudo = view.findViewById(R.id.pseudoTextView)
|
|
|
|
progressbar = view.findViewById(R.id.levelProgressBar)
|
|
|
|
progressbar = view.findViewById(R.id.levelProgressBar)
|
|
|
|
level = view.findViewById(R.id.levelTextView)
|
|
|
|
level = view.findViewById(R.id.levelTextView)
|
|
|
@ -60,6 +62,7 @@ class HomeFragment : Fragment() {
|
|
|
|
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)
|
|
|
|
equipeditem = view.findViewById(R.id.equipedItemAttack)
|
|
|
|
|
|
|
|
event = view.findViewById(R.id.event_container)
|
|
|
|
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())
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -81,6 +84,10 @@ class HomeFragment : Fragment() {
|
|
|
|
playermage.setImageResource(currentPlayer.image)
|
|
|
|
playermage.setImageResource(currentPlayer.image)
|
|
|
|
if(currentPlayer.equipedItem?.type?.image != null) equipeditem.setImageResource(
|
|
|
|
if(currentPlayer.equipedItem?.type?.image != null) equipeditem.setImageResource(
|
|
|
|
currentPlayer.equipedItem!!.type.image)
|
|
|
|
currentPlayer.equipedItem!!.type.image)
|
|
|
|
|
|
|
|
if(isRaining == false){
|
|
|
|
|
|
|
|
event.visibility = View.VISIBLE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|