-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
38 changed files
with
741 additions
and
238 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
<script lang="ts"> | ||
import cx from 'classnames'; | ||
import type { PlayerPieceElement } from './type'; | ||
import { type GameSpaceSyn } from '~/store'; | ||
import AgentAvatar from '~/shared/AgentAvatar.svelte'; | ||
export let el: Pick<PlayerPieceElement, 'width' | 'height' | 'agent' | 'colorRing'>; | ||
// export let gameSpace: any = null; | ||
export let el: Pick<PlayerPieceElement, 'width' | 'height' | 'playerSlot'>; | ||
export let gameSpace: GameSpaceSyn; | ||
let klass: string = ''; | ||
export { klass as class }; | ||
export let style = ''; | ||
$$restProps; // This prevents Svelte warnings from unused props | ||
$: size = Math.min(el.width, el.height) - (el.colorRing ? 6 : 0); | ||
$: state = gameSpace.state; | ||
$: playerInfo = $state ? $state.playersSlots[el.playerSlot] : null; | ||
$: color = playerInfo?.color || '#000'; | ||
$: contrastColor = '#fff'; | ||
$: size = Math.min(el.width, el.height) - (playerInfo.color ? 6 : 0); | ||
$: { | ||
console.log(el); | ||
} | ||
</script> | ||
|
||
<AgentAvatar | ||
pubKey={el.agent} | ||
{size} | ||
class={cx(klass, 'w-full h-full', { | ||
'inline-block outline-solid outline-red outline-3 m[3px]': !!el.colorRing, | ||
})} | ||
style={`${style} ${el.colorRing ? `outline-color: ${el.colorRing}` : ''}`} | ||
/> | ||
<div | ||
class={`relative flexcc rounded-full text-white b-2 b-black/10 shadow-md ${klass}`} | ||
style={`width: ${size}px; height: ${size}px; background-color: ${color}; color: ${contrastColor}; ${style}`} | ||
> | ||
{#if playerInfo?.pubKey} | ||
<AgentAvatar pubKey={playerInfo.pubKey} size={size - 4} class="relative z-20" /> | ||
{/if} | ||
<div class="absolute z-10 inset-0 flexcc mix-blend-difference opacity-50">{el.playerSlot + 1}</div | ||
> | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export { default as ConfigMenu } from './ConfigMenu.svelte'; | ||
export { default as Element } from './Element.svelte'; | ||
export { default as config } from './config'; | ||
|
||
export type { PlayerPieceElement as ElType } from './type.ts'; |
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,8 +1,9 @@ | ||
import { type GElementBase } from '~/store'; | ||
|
||
export const VERSION = 3; | ||
|
||
export type PlayerPieceElement = GElementBase & { | ||
type: 'PlayerPiece'; | ||
version: number; | ||
agent: string; | ||
colorRing: string; | ||
version: 3; | ||
playerSlot: number; | ||
}; |
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
Oops, something went wrong.