Merge branch 'lunex'
This commit is contained in:
@@ -23,6 +23,11 @@ pub struct BuildingAsset {
|
||||
pub cost: Vec<ResourceIdentifier>,
|
||||
pub consumption: Vec<ResourceIdentifier>,
|
||||
pub production: Vec<ResourceIdentifier>,
|
||||
|
||||
pub health: u32,
|
||||
|
||||
pub building_type: BuildingType,
|
||||
pub animations: Vec<AnimationComponent>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, TypePath)]
|
||||
|
||||
6
game/buildings/src/buildings/factory_building.rs
Normal file
6
game/buildings/src/buildings/factory_building.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct FactoryBuildingInfo {
|
||||
pub units_to_build: Vec<()>
|
||||
}
|
||||
8
game/buildings/src/buildings/resource_gathering.rs
Normal file
8
game/buildings/src/buildings/resource_gathering.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use shared::identifiers::ResourceIdentifier;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ResourceGatheringBuildingInfo {
|
||||
pub resources_to_gather: Vec<ResourceIdentifier>,
|
||||
pub gather_range: usize,
|
||||
}
|
||||
9
game/buildings/src/buildings/tech_building.rs
Normal file
9
game/buildings/src/buildings/tech_building.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use shared::{building::BuildingIdentifier, StatusEffect};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct TechBuildingInfo {
|
||||
pub effect_range: usize,
|
||||
pub buildings_to_unlock: Vec<BuildingIdentifier>,
|
||||
pub buffs: Vec<StatusEffect>,
|
||||
}
|
||||
@@ -27,6 +27,7 @@ bevy_asset_loader = { version = "0.21.0", features = [
|
||||
] }
|
||||
ron = "0.8.1"
|
||||
image = "0.25.2"
|
||||
bevy_lunex = "0.2.4"
|
||||
|
||||
[features]
|
||||
tracing = [
|
||||
|
||||
@@ -2,7 +2,9 @@ use bevy::core_pipeline::experimental::taa::{TemporalAntiAliasBundle, TemporalAn
|
||||
use bevy::core_pipeline::prepass::DepthPrepass;
|
||||
use bevy::input::mouse::{MouseMotion, MouseScrollUnit, MouseWheel};
|
||||
use bevy::prelude::*;
|
||||
use bevy::render::view::RenderLayers;
|
||||
use bevy::window::{CursorGrabMode, PrimaryWindow};
|
||||
use bevy_lunex::prelude::MainUi;
|
||||
use shared::sets::GameplaySet;
|
||||
use shared::tags::MainCamera;
|
||||
use world_generation::hex_utils::HexCoord;
|
||||
@@ -59,6 +61,7 @@ fn setup(mut commands: Commands, mut msaa: ResMut<Msaa>) {
|
||||
MainCamera,
|
||||
DepthPrepass,
|
||||
PhosOrbitCamera::default(),
|
||||
MainUi,
|
||||
))
|
||||
// .insert(RenderLayers::layer(0))
|
||||
.insert(TemporalAntiAliasBundle::default());
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::env;
|
||||
|
||||
use bevy::pbr::wireframe::WireframePlugin;
|
||||
use bevy::prelude::*;
|
||||
use bevy::render::texture::{ImageAddressMode, ImageFilterMode, ImageSamplerDescriptor};
|
||||
@@ -10,8 +12,8 @@ mod map_rendering;
|
||||
mod phos;
|
||||
mod prelude;
|
||||
mod shader_extensions;
|
||||
mod utlis;
|
||||
mod ui;
|
||||
mod utlis;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::camera_system::components::PhosCamera;
|
||||
use crate::map_rendering::map_init::MapInitPlugin;
|
||||
use crate::map_rendering::render_distance_system::RenderDistancePlugin;
|
||||
use crate::ui::game::build_ui::BuildUiPlugin;
|
||||
use crate::utlis::editor_plugin::EditorPlugin;
|
||||
use crate::utlis::tile_selection_plugin::TileSelectionPlugin;
|
||||
use crate::{camera_system::camera_plugin::PhosCameraPlugin, utlis::debug_plugin::DebugPlugin};
|
||||
|
||||
@@ -1,11 +1,54 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy::{prelude::*, render::view::RenderLayers};
|
||||
use bevy_lunex::prelude::*;
|
||||
use shared::tags::MainCamera;
|
||||
|
||||
pub struct BuildUiPlugin;
|
||||
|
||||
impl Plugin for BuildUiPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(PostStartup, setup);
|
||||
// app.add_plugins(UiDefaultPlugins)
|
||||
// .add_plugins(UiDebugPlugin::<MainUi>::new());
|
||||
|
||||
app.add_systems(PostStartup, setup_ui);
|
||||
}
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands) {}
|
||||
fn setup_ui(mut commands: Commands, assets: Res<AssetServer>) {
|
||||
commands
|
||||
.spawn((
|
||||
Camera2dBundle {
|
||||
transform: Transform::from_xyz(0.0, 0.0, 1000.0),
|
||||
..default()
|
||||
},
|
||||
MainUi,
|
||||
))
|
||||
.insert(RenderLayers::layer(1));
|
||||
|
||||
commands
|
||||
.spawn((
|
||||
UiTreeBundle::<MainUi> {
|
||||
tree: UiTree::new2d("BuildUi"),
|
||||
..default()
|
||||
},
|
||||
Name::new("Build UI"),
|
||||
SourceFromCamera,
|
||||
RenderLayers::layer(1),
|
||||
))
|
||||
.with_children(|ui| {
|
||||
ui.spawn((
|
||||
UiLink::<MainUi>::path("Root"),
|
||||
UiLayout::boundary()
|
||||
.pos1(Ab(20.0))
|
||||
.pos2(Rl(100.0) - Ab(20.0))
|
||||
.pack::<Base>(),
|
||||
RenderLayers::layer(1),
|
||||
));
|
||||
|
||||
ui.spawn((
|
||||
UiLink::<MainUi>::path("Root/Rect"),
|
||||
UiLayout::solid().size((Ab(1920.0), Ab(1080.0))).pack::<Base>(),
|
||||
UiImage2dBundle::from(assets.load("textures/world/test2.png")),
|
||||
RenderLayers::layer(1),
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
|
||||
pub mod build_ui;
|
||||
pub mod build_ui;
|
||||
@@ -1,2 +1 @@
|
||||
|
||||
pub mod game;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use bevy::reflect::Reflect;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Default, Reflect, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct BuildingIdentifier(pub usize);
|
||||
|
||||
impl From<i32> for BuildingIdentifier {
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
use bevy::prelude::Resource;
|
||||
use bevy::reflect::Reflect;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use world_generation::hex_utils::HexCoord;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[derive(Serialize, Deserialize, Debug, Reflect)]
|
||||
pub struct ResourceIdentifier {
|
||||
pub id: u32,
|
||||
pub qty: u32,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Reflect)]
|
||||
pub struct UnitIdentifier(u32);
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Reflect)]
|
||||
pub struct TileIdentifier(u32);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use bevy::reflect::Reflect;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod building;
|
||||
@@ -17,3 +18,17 @@ pub enum Tier {
|
||||
Three,
|
||||
Superior,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Reflect)]
|
||||
pub enum StatusEffect {
|
||||
UnitRange(f32),
|
||||
UnitAttack(f32),
|
||||
UnitHealth(f32),
|
||||
StructureRange(f32),
|
||||
StructureAttack(f32),
|
||||
StructureHealth(f32),
|
||||
BuildSpeedMulti(f32),
|
||||
BuildCostMulti(f32),
|
||||
ConsumptionMulti(f32),
|
||||
ProductionMulti(f32),
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use bevy::reflect::Reflect;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod assets;
|
||||
pub mod components;
|
||||
|
||||
Reference in New Issue
Block a user