This commit is contained in:
Michael Zhang 2024-11-11 17:35:17 -06:00
commit f617cc8e1c
16 changed files with 5842 additions and 0 deletions

2
.cargo/config.toml Normal file
View file

@ -0,0 +1,2 @@
[build]
rustflags = ["--cfg=web_sys_unstable_apis"]

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/target
/dist

1
.tokeignore Normal file
View file

@ -0,0 +1 @@
dist

5602
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

19
Cargo.toml Normal file
View file

@ -0,0 +1,19 @@
[package]
name = "tift"
version = "0.1.0"
edition = "2021"
[workspace]
members = ["common", "server"]
[profile.release]
lto = true
codegen-units = 1
[dependencies]
bevy = "0.14.2"
bevy_egui = "0.30.1"
bevy_math = "0.14.2"
common = { path = "common" }
lightyear = "0.17.1"

7
common/Cargo.toml Normal file
View file

@ -0,0 +1,7 @@
[package]
name = "common"
version = "0.1.0"
edition = "2021"
[dependencies]
bevy = "0.14.2"

92
common/src/lib.rs Normal file
View file

@ -0,0 +1,92 @@
pub mod proto;
pub mod state;
use bevy::prelude::*;
#[derive(Component)]
pub struct ChampionItems(Vec<ItemSlot>);
pub trait ChampionDefinition: Component + Send + Sync {
type Skill: SkillDefinition;
}
pub trait SkillDefinition {}
#[derive(Component)]
pub enum ItemSlot {
None,
ItemComponent,
CompletedItem,
Gloves,
}
pub enum ItemComponent {
Sword,
Vest,
Belt,
Rod,
Cloak,
Bow,
Fist,
Tear,
Spat,
Pan,
}
pub enum CompletedItem {
BastionEmblem,
EldritchEmblem,
FaerieEmblem,
FrostEmblem,
HoneymancyEmblem,
HunterEmblem,
MageEmblem,
MultistrikerEmblem,
PortalEmblem,
PreserverEmblem,
PyroEmblem,
ScholarEmblem,
ShapeshifterEmblem,
SugarcraftEmblem,
WarriorEmblem,
WitchcraftEmblem,
AdaptiveHelm,
ArchangelsStaff,
Bloodthirster,
BlueBuff,
BrambleVest,
Crownguard,
Deathblade,
DragonsClaw,
EdgeOfNight,
Evenshroud,
GargoyleStoneplate,
GiantSlayer,
Guardbreaker,
GuinsoosRageblade,
HandOfJustice,
HextechGunblade,
InfinityEdge,
IonicSpark,
JeweledGauntlet,
LastWhisper,
Morellonomicon,
NashorsTooth,
ProtectorsVow,
Quicksilver,
RabadonsDeathcap,
RedBuff,
Redemption,
RunaansHurricane,
SpearOfShojin,
StatikkShiv,
SteadfastHeart,
SteraksGage,
SunfireCape,
TacticiansCape,
TacticiansCrown,
TacticiansShield,
TitansResolve,
WarmogsArmor,
}

7
common/src/proto.rs Normal file
View file

@ -0,0 +1,7 @@
use bevy::app::{App, Plugin};
pub struct ProtocolPlugin {}
impl Plugin for ProtocolPlugin {
fn build(&self, app: &mut App) {}
}

21
common/src/state.rs Normal file
View file

@ -0,0 +1,21 @@
use bevy::prelude::*;
#[derive(Resource)]
pub struct GameState {
current_state: GameCurrentState,
}
impl Default for GameState {
fn default() -> Self {
Self {
current_state: GameCurrentState::PortalSelection,
}
}
}
pub enum GameCurrentState {
PortalSelection,
BoardSetup,
PveCombat,
PvpCombat,
}

15
index.html Normal file
View file

@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Tift</title>
<!-- <link data-trunk rel="copy-dir" href="assets" /> -->
<!-- <link data-trunk rel="copy-dir" href="credits" /> -->
<!-- <link data-trunk rel="copy-file" href="build/windows/icon.ico" /> -->
<!-- <link rel="icon" href="icon.ico" /> -->
<!-- <link data-trunk rel="inline" href="build/web/styles.css" /> -->
</head>
<body>
<!-- <link data-trunk rel="inline" href="build/web/sound.js" /> -->
</body>
</html>

1
rustfmt.toml Normal file
View file

@ -0,0 +1 @@
tab_spaces = 2

6
server/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "server"
version = "0.1.0"
edition = "2021"
[dependencies]

3
server/src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

6
src/board.rs Normal file
View file

@ -0,0 +1,6 @@
use bevy::prelude::*;
#[derive(Bundle)]
pub struct BoardBundle {}
pub fn setup_board() {}

19
src/champion.rs Normal file
View file

@ -0,0 +1,19 @@
use bevy::prelude::*;
use common::{ChampionDefinition, ChampionItems, ItemSlot};
#[derive(Bundle)]
pub struct ChampionInstance<Def: ChampionDefinition> {
def: Def,
hp: Hp,
items: ChampionItems,
}
#[derive(Component)]
pub struct Hp {
current: u64,
max: u64,
}
#[derive(Component)]
pub struct Mana {}

39
src/main.rs Normal file
View file

@ -0,0 +1,39 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
mod board;
mod champion;
use bevy::{
prelude::*,
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
};
use bevy_egui::EguiPlugin;
use common::state::GameState;
use crate::board::setup_board;
#[bevy_main]
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(EguiPlugin)
.insert_resource(GameState::default())
.add_systems(Startup, (setup, setup_board))
.run();
}
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
commands.spawn(Camera2dBundle::default());
let hex = Mesh2dHandle(meshes.add(RegularPolygon::new(50.0, 6)));
let material = materials.add(Color::linear_rgb(1.0, 1.0, 1.0));
commands.spawn(MaterialMesh2dBundle {
mesh: hex,
material,
..Default::default()
});
}