-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7479905
commit 1e87b8c
Showing
85 changed files
with
522 additions
and
471 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
...c/jsMain/kotlin/com/zegreatrob/coupling/client/memory/ClientPartyPlayerQueryDispatcher.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 30 additions & 5 deletions
35
client/src/jsMain/kotlin/com/zegreatrob/coupling/client/player/PlayerPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,46 @@ | ||
package com.zegreatrob.coupling.client.player | ||
|
||
import com.zegreatrob.coupling.action.player.callsign.FindCallSignAction | ||
import com.zegreatrob.coupling.client.components.player.PlayerConfig | ||
import com.zegreatrob.coupling.client.components.player.create | ||
import com.zegreatrob.coupling.client.partyPageFunction | ||
import com.zegreatrob.coupling.client.routing.CouplingQuery | ||
import com.zegreatrob.coupling.client.routing.PageProps | ||
import com.zegreatrob.coupling.client.routing.playerId | ||
import com.zegreatrob.coupling.model.elements | ||
import com.zegreatrob.coupling.model.party.PartyId | ||
import com.zegreatrob.coupling.sdk.PartyPlayerQuery | ||
import com.zegreatrob.coupling.model.player.Player | ||
import com.zegreatrob.coupling.model.player.callsign.CallSign | ||
import com.zegreatrob.coupling.sdk.gql.graphQuery | ||
|
||
val PlayerPage = partyPageFunction { props: PageProps, partyId: PartyId -> | ||
val playerId = props.playerId | ||
CouplingQuery( | ||
commander = props.commander, | ||
query = PartyPlayerQuery(partyId, props.playerId), | ||
toNode = { reload, commandFunc, (party, players, player) -> | ||
PlayerConfig.create(party, player, players, reload, commandFunc) | ||
query = graphQuery { party(partyId) { party(); playerList() } }, | ||
toNode = { reload, commandFunc, data -> | ||
val partyDetails = data.party?.details?.data ?: return@CouplingQuery null | ||
val playerList = data.party?.playerList?.elements ?: return@CouplingQuery null | ||
val player = playerList.find { it.id == playerId } | ||
?: playerList.defaultWithCallSign() | ||
PlayerConfig.create( | ||
party = partyDetails, | ||
player = player, | ||
players = playerList, | ||
reload = reload, | ||
dispatchFunc = commandFunc, | ||
) | ||
}, | ||
key = "${partyId.value}-${props.playerId}", | ||
key = "${partyId.value}-$playerId", | ||
) | ||
} | ||
|
||
private fun List<Player>.defaultWithCallSign() = object : FindCallSignAction.Dispatcher {} | ||
.perform(FindCallSignAction(this, "")) | ||
.let(::defaultPlayer) | ||
|
||
private fun defaultPlayer(callSign: CallSign) = Player( | ||
callSignAdjective = callSign.adjective, | ||
callSignNoun = callSign.noun, | ||
avatarType = null, | ||
) |
Oops, something went wrong.