Open Character Editor
All checks were successful
E2E Testing / test (push) Successful in 1m37s

This commit is contained in:
Sebastian Böckelmann 2024-03-22 09:35:13 +01:00
parent 13ea574fa3
commit 91ee3850d2
9 changed files with 61 additions and 14 deletions

View File

@ -27,7 +27,7 @@
</div> </div>
<app-script-account-overview *ngIf="openContent == ModelComponentType.SCRIPTACCOUNT" #scriptAccountOverview [gameModel]="gameModel" (onOpenScriptAccount)="openModelComponent($event)"></app-script-account-overview> <app-script-account-overview *ngIf="openContent == ModelComponentType.SCRIPTACCOUNT" #scriptAccountOverview [gameModel]="gameModel" (onOpenScriptAccount)="openModelComponent($event)"></app-script-account-overview>
<app-gamescript-overview *ngIf="openContent == ModelComponentType.GAMESYTEM" #gamesystemOverview [gameModel]="gameModel" (openGamesystemEditor)="openModelComponent($event)"></app-gamescript-overview> <app-gamescript-overview *ngIf="openContent == ModelComponentType.GAMESYTEM" #gamesystemOverview [gameModel]="gameModel" (openGamesystemEditor)="openModelComponent($event)"></app-gamescript-overview>
<app-character-overview *ngIf="openContent == ModelComponentType.CHARACTER" #characterOverview [gameModel]="gameModel"></app-character-overview> <app-character-overview *ngIf="openContent == ModelComponentType.CHARACTER" #characterOverview [gameModel]="gameModel" (onOpenCharacterEditor)="openModelComponent($event)"></app-character-overview>
</mat-drawer> </mat-drawer>
<div class="example-sidenav-content"> <div class="example-sidenav-content">

View File

@ -69,6 +69,7 @@ import {
ScriptaccountConditionEditorComponent ScriptaccountConditionEditorComponent
} from "./editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component"; } from "./editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component";
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component"; import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
import {CharacterEditorComponent} from "./editor/character-editor/character-editor.component";
// AoT requires an exported function for factories // AoT requires an exported function for factories
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
@ -90,7 +91,9 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
ProductStateEditorComponent, ProductStateEditorComponent,
ProductGamesystemEditorComponent, ProductGamesystemEditorComponent,
ScriptaccountActionEditorComponent, ScriptaccountActionEditorComponent,
ScriptaccountConditionEditorComponent ScriptaccountConditionEditorComponent,
CharacterOverviewComponent,
CharacterEditorComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@ -147,8 +150,7 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
MatHint, MatHint,
MatTooltip, MatTooltip,
MatCard, MatCard,
MatCardContent, MatCardContent
CharacterOverviewComponent
], ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]

View File

@ -0,0 +1 @@
<p>character-editor works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CharacterEditorComponent } from './character-editor.component';
describe('CharacterEditorComponent', () => {
let component: CharacterEditorComponent;
let fixture: ComponentFixture<CharacterEditorComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [CharacterEditorComponent]
})
.compileComponents();
fixture = TestBed.createComponent(CharacterEditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-character-editor',
templateUrl: './character-editor.component.html',
styleUrl: './character-editor.component.scss'
})
export class CharacterEditorComponent {
}

View File

@ -14,6 +14,8 @@
[gamesystem]="convertModelComponentToGamesystem(modelComponent)" [gamesystem]="convertModelComponentToGamesystem(modelComponent)"
(onOpenGamesystemEditor)="openGameModelComponent($event)" (onOpenGamesystemEditor)="openGameModelComponent($event)"
[scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor> [scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor>
<app-character-editor *ngIf="modelComponent.type === ModelComponentType.CHARACTER">
</app-character-editor>
</mat-tab> </mat-tab>
</mat-tab-group> </mat-tab-group>

View File

@ -1,5 +1,8 @@
<mat-action-list> <mat-action-list>
<mat-list-item class="scriptAccount-item" *ngFor="let character of gameModel!.characters"> <mat-list-item class="scriptAccount-item" *ngFor="let character of gameModel!.characters"
(dblclick)="onOpenCharacter(character)" (click)="selectCharacter(character)"
[ngClass]="selectedCharacter === character ?'selected-item':''"
(contextmenu)="selectCharacter(character)">
<mat-icon class="scriptAccount-icon">person</mat-icon>{{character.componentName}} <mat-icon class="scriptAccount-icon">person</mat-icon>{{character.componentName}}
</mat-list-item> </mat-list-item>
</mat-action-list> </mat-action-list>

View File

@ -1,22 +1,28 @@
import {Component, Input} from '@angular/core'; import {Component, EventEmitter, Input, Output} from '@angular/core';
import {GameModel} from "../../project/game-model/GameModel"; import {GameModel} from "../../project/game-model/GameModel";
import {MatActionList, MatListItem} from "@angular/material/list"; import {MatActionList, MatListItem} from "@angular/material/list";
import {MatIcon} from "@angular/material/icon"; import {MatIcon} from "@angular/material/icon";
import {NgForOf} from "@angular/common"; import {NgClass, NgForOf} from "@angular/common";
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
import {Character} from "../../project/game-model/characters/Character";
@Component({ @Component({
selector: 'app-character-overview', selector: 'app-character-overview',
standalone: true,
imports: [
MatActionList,
MatIcon,
MatListItem,
NgForOf
],
templateUrl: './character-overview.component.html', templateUrl: './character-overview.component.html',
styleUrl: './character-overview.component.scss' styleUrl: './character-overview.component.scss'
}) })
export class CharacterOverviewComponent { export class CharacterOverviewComponent {
@Input() gameModel: GameModel | undefined @Input() gameModel: GameModel | undefined
@Output("onOpenCharacterEditor") openCharacterEmitter: EventEmitter<Character> = new EventEmitter<Character>();
selectedCharacter: Character | undefined
onOpenCharacter(character: Character) {
this.openCharacterEmitter.emit(character);
}
selectCharacter(character: Character) {
this.selectedCharacter = character;
}
} }