Compare commits
No commits in common. 'master' and 'OpenWeatherApi' have entirely different histories.
master
...
OpenWeathe
Before Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 44 KiB |
@ -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)
|
|
||||||
}
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue