Browse Source

fix(Database) Fixed refresh bug. Fixed wrong data in database

main
Jonathan McCaffrey 4 years ago
parent
commit
8584570a1e
  1. 12
      Components/Inputs/EntityLabelComponent.razor
  2. BIN
      IGP/Database.db
  3. 46
      IGP/Dialog/EntityDialogComponent.razor
  4. 5
      IGP/Index.razor
  5. 4
      IGP/Pages/Database/DatabasePage.razor
  6. 36
      IGP/Pages/Database/Entity/EntityViewComponent.razor
  7. 5
      IGP/Pages/Database/Entity/Parts/EntityAbilitiesComponent.razor
  8. 4
      IGP/Pages/Database/Entity/Parts/EntityHeaderComponent.razor
  9. 11
      IGP/Pages/Database/Entity/Parts/EntityInfoComponent.razor
  10. 4
      IGP/Pages/Database/Entity/Parts/EntityMechanicsComponent.razor
  11. 4
      IGP/Pages/Database/Entity/Parts/EntityPassivesComponent.razor
  12. 78
      IGP/Pages/Database/Entity/Parts/EntityProductionComponent.razor
  13. 6
      IGP/Pages/Database/Entity/Parts/EntityPyreSpellsComponent.razor
  14. 45
      IGP/Pages/Database/Entity/Parts/EntityStatsComponent.razor
  15. 4
      IGP/Pages/Database/Entity/Parts/EntityUpgradesComponent.razor
  16. 6
      IGP/Pages/Database/Entity/Parts/EntityVanguardAddedComponent.razor
  17. 6
      IGP/Pages/Database/Entity/Parts/EntityVanguardsComponent.razor
  18. 6
      IGP/Pages/Database/Entity/Parts/EntityWeaponsComponent.razor
  19. 2
      IGP/wwwroot/generated/SprintModels.json
  20. 2
      IGP/wwwroot/generated/TaskModels.json
  21. 558
      Model/Entity/Data/DATA.cs
  22. 10
      Model/Entity/Data/Ids_Entity.cs
  23. 1
      Model/Entity/Parts/EntityRequirementModel.cs
  24. 3
      Services/Website/EntityDialogService.cs

12
Components/Inputs/EntityLabelComponent.razor

@ -7,26 +7,24 @@
@inject IEntityDialogService entityDialogService
@if (entity == null)
@if (EntityId == null)
{
<div>Add a entity</div>
}
else
{
<button class="entityLabel @entity.Descriptive.ToLower()" @onclick="EntityLabelClicked">@entity.Info().Name</button>
<button class="entityLabel @Entity.Descriptive.ToLower()" @onclick="EntityLabelClicked">@Entity.Info().Name</button>
}
@code {
[Parameter] public string EntityId { get; set; }
private EntityModel entity = null;
private EntityModel Entity => DATA.Get()[EntityId];
protected override void OnInitialized()
{
entity = DATA.Get()[EntityId];
Console.Write(entity.Info().Name);
Console.Write(Entity.Info().Name);
}
void EntityLabelClicked()

BIN
IGP/Database.db

Binary file not shown.

46
IGP/Dialog/EntityDialogComponent.razor

@ -1,14 +1,8 @@
@implements IDisposable;
@inject IEntityDialogService entityDialogService
<div class="dialogBackground" onclick="@CloseDialog">
@{
var entity = DATA.Get()[entityDialogService.GetEntityId()];
}
<div class="dialogContainer"
@onclick:preventDefault="true"
@onclick:stopPropagation="true">
@ -22,7 +16,6 @@
@if (entityDialogService.HasHistory())
{
<button class="backButton" @onclick="entityDialogService.BackDialog">
<div class="backButtonIcon"> </div>
</button>
}
@ -33,19 +26,21 @@
</div>
<div class="dialogContent">
<div>
<EntityVanguardAddedComponent Entity=@entity></EntityVanguardAddedComponent>
<EntityInfoComponent Entity=@entity></EntityInfoComponent>
<EntityVanguardsComponent Entity=@entity></EntityVanguardsComponent>
<EntityProductionComponent Entity=@entity></EntityProductionComponent>
<EntityStatsComponent Entity=@entity></EntityStatsComponent>
<EntityMechanicsComponent Entity=@entity></EntityMechanicsComponent>
<EntityPassivesComponent Entity=@entity></EntityPassivesComponent>
<EntityPyreSpellsComponent Entity=@entity></EntityPyreSpellsComponent>
<EntityUpgradesComponent Entity=@entity></EntityUpgradesComponent>
<EntityWeaponsComponent Entity=@entity></EntityWeaponsComponent>
<EntityAbilitiesComponent Entity=@entity></EntityAbilitiesComponent>
</div>
<CascadingValue Value="@entity">
<CascadingValue Value="@refresh">
<EntityVanguardAddedComponent ></EntityVanguardAddedComponent>
<EntityInfoComponent ></EntityInfoComponent>
<EntityVanguardsComponent ></EntityVanguardsComponent>
<EntityProductionComponent ></EntityProductionComponent>
<EntityStatsComponent ></EntityStatsComponent>
<EntityMechanicsComponent ></EntityMechanicsComponent>
<EntityPassivesComponent ></EntityPassivesComponent>
<EntityPyreSpellsComponent ></EntityPyreSpellsComponent>
<EntityUpgradesComponent ></EntityUpgradesComponent>
<EntityWeaponsComponent ></EntityWeaponsComponent>
<EntityAbilitiesComponent ></EntityAbilitiesComponent>
</CascadingValue>
</CascadingValue>
</div>
<div class="dialogFooter"></div>
@ -140,9 +135,15 @@
</style>
@code {
EntityModel entity = null;
private int refresh = 0;
protected override void OnInitialized()
{
entity = DATA.Get()[entityDialogService.GetEntityId()];
entityDialogService.Subscribe(OnUpdate);
}
@ -152,10 +153,13 @@
void OnUpdate()
{
entity = DATA.Get()[entityDialogService.GetEntityId()];
refresh++;
Console.WriteLine("OnUpdate()");
StateHasChanged();
}
public void CloseDialog()
{
entityDialogService.CloseDialog();

5
IGP/Index.razor

@ -2,7 +2,4 @@
@layout PageLayout
<HomePage></HomePage>
<HomePage></HomePage>

4
IGP/Pages/Database/DatabasePage.razor

@ -21,7 +21,9 @@
@if (searches != null) {
<div class="databaseItems">
@foreach (var entity in searches) {
<EntityViewComponent Entity=entity></EntityViewComponent>
<CascadingValue Value="entity">
<EntityViewComponent></EntityViewComponent>
</CascadingValue>
}
</div>
}

36
IGP/Pages/Database/Entity/EntityViewComponent.razor

@ -2,21 +2,23 @@
var isVanguard = Entity.VanguardAdded() != null ? " vanguard" : "";
<div class="enititiesContainer @isVanguard">
<EntityHeaderComponent Entity=Entity></EntityHeaderComponent>
<EntityHeaderComponent></EntityHeaderComponent>
<div class="entityPartsContainer">
<EntityVanguardAddedComponent Entity=Entity></EntityVanguardAddedComponent>
<EntityInfoComponent Entity=Entity></EntityInfoComponent>
<EntityVanguardsComponent Entity=Entity></EntityVanguardsComponent>
<EntityProductionComponent Entity=Entity></EntityProductionComponent>
<EntityStatsComponent Entity=Entity></EntityStatsComponent>
<EntityMechanicsComponent Entity=Entity></EntityMechanicsComponent>
<EntityPassivesComponent Entity=Entity></EntityPassivesComponent>
<EntityPyreSpellsComponent Entity=Entity></EntityPyreSpellsComponent>
<EntityUpgradesComponent Entity=Entity></EntityUpgradesComponent>
<EntityWeaponsComponent Entity=Entity></EntityWeaponsComponent>
<EntityAbilitiesComponent Entity=Entity></EntityAbilitiesComponent>
</div>
<CascadingValue Value="@Entity">
<div class="entityPartsContainer">
<EntityVanguardAddedComponent></EntityVanguardAddedComponent>
<EntityInfoComponent></EntityInfoComponent>
<EntityVanguardsComponent></EntityVanguardsComponent>
<EntityProductionComponent></EntityProductionComponent>
<EntityStatsComponent></EntityStatsComponent>
<EntityMechanicsComponent></EntityMechanicsComponent>
<EntityPassivesComponent></EntityPassivesComponent>
<EntityPyreSpellsComponent></EntityPyreSpellsComponent>
<EntityUpgradesComponent></EntityUpgradesComponent>
<EntityWeaponsComponent></EntityWeaponsComponent>
<EntityAbilitiesComponent></EntityAbilitiesComponent>
</div>
</CascadingValue>
</div>
}
@ -48,8 +50,6 @@
</style>
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

5
IGP/Pages/Database/Entity/Parts/EntityAbilitiesComponent.razor

@ -47,7 +47,8 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

4
IGP/Pages/Database/Entity/Parts/EntityHeaderComponent.razor

@ -40,7 +40,7 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

11
IGP/Pages/Database/Entity/Parts/EntityInfoComponent.razor

@ -5,6 +5,13 @@
</div>
}
@if (Entity.Info().Notes != "") {
<div>
<b>Notes:</b> @((MarkupString)Entity.Info().Notes)
</div>
}
<div class="infoDisplayContainer">
<div>
@if (Entity.Faction() != null) {
@ -51,7 +58,7 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

4
IGP/Pages/Database/Entity/Parts/EntityMechanicsComponent.razor

@ -21,7 +21,7 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

4
IGP/Pages/Database/Entity/Parts/EntityPassivesComponent.razor

@ -44,7 +44,7 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

78
IGP/Pages/Database/Entity/Parts/EntityProductionComponent.razor

@ -1,76 +1,70 @@
@{
var production = Entity.Production();
var supply = Entity.Supply();
var requirements = Entity.Requirements();
}
@if (production != null || supply != null || requirements.Count > 0) {
@if (@Production != null || Supply != null || Requirements.Count > 0) {
<EntityDisplayComponent Title="Production">
<div class="productionContainer">
@if (requirements.Count() > 0) {
<div class="ProductionContainer">
@if (Requirements.Count() > 0) {
<div>
@foreach (var requirement in requirements) {
@foreach (var requirement in Requirements) {
<div>
<span>
<b>@requirement.Requirement.Replace("_", " "):</b> <EntityLabelComponent EntityId="@requirement.DataType"/>
<b>@requirement.Requirement.Replace("_", " "):</b> <EntityLabelComponent EntityId="@requirement.DataType"/>
</span>
</div>
}
</div>
}
@if (production != null && (!production.Alloy.Equals(0)
|| !production.Ether.Equals(0)
|| !production.BuildTime.Equals(0)
|| !production.Cooldown.Equals(0))) {
@if (Production != null && (!Production.Alloy.Equals(0)
|| !Production.Ether.Equals(0)
|| !Production.BuildTime.Equals(0)
|| !Production.Cooldown.Equals(0))) {
<div>
@if (!production.Alloy.Equals(0)) {
@if (!Production.Alloy.Equals(0)) {
<div>
<b>Alloy:</b> @production.Alloy
<b>Alloy:</b> @Production.Alloy
</div>
}
@if (!production.Ether.Equals(0)) {
@if (!Production.Ether.Equals(0)) {
<div>
<b>Ether:</b> @production.Ether
<b>Ether:</b> @Production.Ether
</div>
}
@if (!production.Pyre.Equals(0)) {
@if (!Production.Pyre.Equals(0)) {
<div>
<b>Pyre:</b> @production.Pyre
<b>Pyre:</b> @Production.Pyre
</div>
}
@if (!production.BuildTime.Equals(0)) {
@if (!Production.BuildTime.Equals(0)) {
<div>
<b>Build Time:</b> @production.BuildTime.ToString()s
<b>Build Time:</b> @Production.BuildTime.ToString()s
</div>
}
@if (!production.Energy.Equals(0)) {
@if (!Production.Energy.Equals(0)) {
<div>
<b>Energy:</b> @production.Energy
<b>Energy:</b> @Production.Energy
</div>
}
@if (!production.Cooldown.Equals(0)) {
@if (!Production.Cooldown.Equals(0)) {
<div>
<b>Cooldown:</b> @production.Cooldown.ToString()s
<b>Cooldown:</b> @Production.Cooldown.ToString()s
</div>
}
</div>
}
@if (supply != null) {
@if (Supply != null) {
<div>
@if (!supply.Grants.Equals(0)) {
@if (!Supply.Grants.Equals(0)) {
<div>
<b>Grants:</b> @supply.Grants
<b>Grants:</b> @Supply.Grants
</div>
}
@if (!supply.Takes.Equals(0)) {
@if (!Supply.Takes.Equals(0)) {
<div>
<b>Takes:</b> @supply.Takes Supply
<b>Takes:</b> @Supply.Takes Supply
</div>
}
</div>
@ -80,13 +74,13 @@
}
<style>
.productionContainer {
.ProductionContainer {
display: flex;
gap: 32px;
}
@@media only screen and (max-width: 1025px) {
.productionContainer {
.ProductionContainer {
flex-direction: column;
gap: 4px;
}
@ -95,7 +89,19 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
private EntityProductionModel Production => Entity.Production();
private List<EntityRequirementModel> Requirements => Entity.Requirements();
private EntitySupplyModel Supply => Entity.Supply();
protected override void OnParametersSet()
{
StateHasChanged();
}
}

6
IGP/Pages/Database/Entity/Parts/EntityPyreSpellsComponent.razor

@ -37,7 +37,7 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

45
IGP/Pages/Database/Entity/Parts/EntityStatsComponent.razor

@ -1,40 +1,36 @@
@{
var vitality = Entity.Vitality();
var movement = Entity.Movement();
}
@if (vitality != null || movement != null) {

@if (Vitality != null || Movement != null) {
<EntityDisplayComponent Title="Stats">
<div class="statContainer">
@if (vitality != null) {
@if (Vitality != null) {
<div>
@if (!vitality.DefenseLayer.Equals(0)) {
@if (!Vitality.DefenseLayer.Equals(0)) {
<div>
<b>Shield:</b> @vitality.DefenseLayer
<b>Shield:</b> @Vitality.DefenseLayer
</div>
}
@if (!vitality.Health.Equals(0)) {
@if (!Vitality.Health.Equals(0)) {
<div>
<b>Health:</b> @vitality.Health
<b>Health:</b> @Vitality.Health
</div>
}
@if (!vitality.Energy.Equals(0)) {
@if (!Vitality.Energy.Equals(0)) {
<div>
<b>Energy:</b> @vitality.Energy
<b>Energy:</b> @Vitality.Energy
</div>
}
@if (vitality.Armor != "") {
@if (Vitality.Armor != "") {
<div>
<b>Armor:</b> @vitality.Armor
<b>Armor:</b> @Vitality.Armor
</div>
}
@if (vitality.IsEtheric) {
@if (Vitality.IsEtheric) {
<div>
<b> + Etheric</b>
</div>
}
@if (vitality.IsStructure) {
@if (Vitality.IsStructure) {
<div>
<b> + Structure</b>
</div>
@ -43,11 +39,11 @@
}
@if (movement != null) {
@if (Movement != null) {
<div>
@if (!movement.Speed.Equals(0)) {
@if (!Movement.Speed.Equals(0)) {
<div>
<b>Speed:</b> @movement.Speed
<b>Speed:</b> @Movement.Speed
</div>
}
else {
@ -56,7 +52,7 @@
</div>
}
<div>
<b>Move Type:</b> @movement.Movement
<b>Move Type:</b> @Movement.Movement
</div>
</div>
}
@ -79,8 +75,9 @@
</style>
@code {
[CascadingParameter]
public EntityModel? Entity { get; set; }
[Parameter]
public EntityModel Entity { get; set; }
private EntityVitalityModel Vitality => Entity.Vitality();
private EntityMovementModel Movement => Entity.Movement();
}

4
IGP/Pages/Database/Entity/Parts/EntityUpgradesComponent.razor

@ -32,7 +32,7 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

6
IGP/Pages/Database/Entity/Parts/EntityVanguardAddedComponent.razor

@ -24,8 +24,8 @@
}
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

6
IGP/Pages/Database/Entity/Parts/EntityVanguardsComponent.razor

@ -26,7 +26,7 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

6
IGP/Pages/Database/Entity/Parts/EntityWeaponsComponent.razor

@ -108,7 +108,7 @@
@code {
[Parameter]
public EntityModel Entity { get; set; }
[CascadingParameter]
public EntityModel? Entity { get; set; }
}

2
IGP/wwwroot/generated/SprintModels.json

@ -1 +1 @@
[{"Id":1,"Name":"Agile Sprint","Description":"Changelogs and sprint views were going to be pushed till later, but I am feeling inspired by the IGP Content Creators\u0027 minimum weekly lifecycle requirement. So I am going to focus on agile-related tasks, and handle roadmap tasks after this initial sprint. All weekly sprints will release on Sunday, starting next Sunday.","StartDate":"2022-02-14T00:00:00","EndDate":"2022-02-20T00:00:00","Notes":null},{"Id":2,"Name":"SQL Update","Description":"The SQL update is big enough to be a full sprint in of itself, and I spent less time this week for development. Will just extend sprint by 2 week, and remove all non SQL tasks from the sprint.","StartDate":"2022-02-20T00:00:00","EndDate":"2022-03-27T00:00:00","Notes":null},{"Id":3,"Name":"Database Page","Description":"Improvements to the Database page","StartDate":"2022-03-27T00:00:00","EndDate":"2022-04-03T00:00:00","Notes":null}]
[{"Id":1,"Name":"Agile Sprint","Description":"Changelogs and sprint views were going to be pushed till later, but I am feeling inspired by the IGP Content Creators\u0027 minimum weekly lifecycle requirement. So I am going to focus on agile-related tasks, and handle roadmap tasks after this initial sprint. All weekly sprints will release on Sunday, starting next Sunday.","StartDate":"2022-02-14T00:00:00","EndDate":"2022-02-20T00:00:00","Notes":null},{"Id":2,"Name":"SQL Update","Description":"The SQL update is big enough to be a full sprint in of itself, and I spent less time this week for development. Will just extend sprint by 2 week, and remove all non SQL tasks from the sprint.","StartDate":"2022-02-20T00:00:00","EndDate":"2022-03-27T00:00:00","Notes":null},{"Id":3,"Name":"Database Page","Description":"Improvements to the Database page","StartDate":"2022-03-27T00:00:00","EndDate":"2022-04-03T00:00:00","Notes":null},{"Id":4,"Name":"Branding","Description":"Improve streaming branding around the website","StartDate":"2022-04-03T00:00:00","EndDate":"2022-04-10T00:00:00","Notes":null}]

2
IGP/wwwroot/generated/TaskModels.json

File diff suppressed because one or more lines are too long

558
Model/Entity/Data/DATA.cs

File diff suppressed because it is too large Load Diff

10
Model/Entity/Data/Ids_Entity.cs

@ -23,7 +23,6 @@ public static class DataType {
public static string FACTION_YRiah = "c7537d12-a536-4ef5-99b9-d7ad704716fe";
public static string FACTION_ArkShai = "ffe82eea-b8c6-4933-9230-cd019fd1c259";
public static string FACTION_Herlesh = "e6c09f4a-ae7d-4bfd-b5d4-a63445d59498";
public static string FACTION_EntralledRae = "9316a2a1-a8e6-47ae-a4c6-411ff54f949a";
public static string FACTION_Khardu = "a1764de6-8178-4775-819a-59d23677dd76";
public static string COMMAND_Attack = "168486ff-581e-46da-a308-74f1d7d615fd";
public static string COMMAND_StandGround = "cb9ee44f-7293-4a82-826c-a3829491006b";
@ -76,6 +75,10 @@ public static class DataType {
public static string BUILDING_DeepNest = "3076ae6e-89bf-4ea1-a66c-ea45ffcb4046";
public static string BUILDING_Neurocyte = "90c6e53f-0430-4992-a1eb-4f91699292cb";
public static string DEFENSE_FireSinger = "c7a90286-6977-4d92-91e0-2a0a46eb13ea";
public static string BUILDING_KeeperOfTheHardenedFlames = "db784823-5199-4bae-bc5e-96174490cd00";
public static string DEFENSE_Aerovore = "b68307b7-4759-43a3-8679-d844ac3aa73f";
public static string UPGRADE_FaithCastBlades = "32087a66-900e-4f25-95f7-de56d5b424c7";
public static string UPGRADE_RelicOfTheWrathfulGaze = "e6fa5ded-53f5-4914-85bb-1fdff5f32b64";
@ -91,11 +94,14 @@ public static class DataType {
public static string UPGRADE_PursuitLigaments = "51a4e848-ae67-4182-9c1f-27cb24e9c531";
public static string UPGRADE_XacalDamage = "f10b8f7a-0c52-4e78-8d7d-002ac14e8862";
public static string UPGRADE_ResinantDeploy = "29f49353-8fdf-4c5d-b034-37f96447dedb";
public static string UPGRADE_WraithBow = "80c09dc3-28a5-48cf-886e-c7f5a52f6b47";
public static string UPGRADE_WraithBowRange = "80c09dc3-28a5-48cf-886e-c7f5a52f6b47";
public static string UPGRADE_BehemothCapacity = "d0390dd2-d9a5-4b20-9d8b-f554f4c52143";
public static string UPGRADE_BloodPlague = "9c207e21-f595-49d0-967d-f30ca8cc3745";
public static string UPGRADE_BirthingStorm = "0cb2f1a4-03b3-491b-9db3-d2d4590ede3a";
public static string PASSIVE_Respite = "607c39f4-a957-4a7a-8fc6-a239f9e570ec";
public static string PASSIVE_OssifyingSwarm = "b8897247-8393-416e-b246-409a6b3263c2";

1
Model/Entity/Parts/EntityRequirementModel.cs

@ -4,7 +4,6 @@ namespace Model.Immortal.Entity.Parts;
public class EntityRequirementModel : IEntityPartInterface {
public string Type { get; set; } = "EntityRequirementModel";
public string Name { get; set; } = "";
public string DataType { get; set; }
public string Requirement { get; set; } = RequirementType.Production_Building;
}

3
Services/Website/EntityDialogService.cs

@ -1,4 +1,5 @@
using Model.Immortal.Entity;
using System.ComponentModel.DataAnnotations;
using DataType = Model.Immortal.Entity.Data.DataType;
namespace Services.Website;

Loading…
Cancel
Save