issue-2-scriptAccounts #4
@ -1,9 +1,9 @@
|
|||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab *ngFor="let modelComponent of gameModelComponents">
|
<mat-tab *ngFor="let modelComponent of gameModelComponents">
|
||||||
<ng-template mat-tab-label>
|
<ng-template mat-tab-label>
|
||||||
<mat-icon class="example-tab-icon">inventory_2</mat-icon>
|
<mat-icon class="example-tab-icon unsaved" [ngClass]="modelComponent.unsaved? 'unsaved':'saved'">inventory_2</mat-icon>
|
||||||
<span>{{modelComponent.componentName}}</span>
|
<span [ngClass]="modelComponent.unsaved? 'unsaved':'saved'">{{modelComponent.componentName}}</span>
|
||||||
<button class="content-label" mat-icon-button (click)="closeGameModelComponent(modelComponent)"><mat-icon>close</mat-icon></button>
|
<button class="content-label close-btn" mat-icon-button (click)="closeGameModelComponent(modelComponent)"><mat-icon>close</mat-icon></button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<app-model-component-editor [modelComponent]="modelComponent"></app-model-component-editor>
|
<app-model-component-editor [modelComponent]="modelComponent"></app-model-component-editor>
|
||||||
<app-script-account-editor *ngIf="modelComponent.type === ModelComponentType.SCRIPTACCOUNT"
|
<app-script-account-editor *ngIf="modelComponent.type === ModelComponentType.SCRIPTACCOUNT"
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
.unsaved {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.saved {
|
||||||
|
color: #3c95f8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-btn {
|
||||||
|
color: white
|
||||||
|
}
|
@ -20,10 +20,12 @@ export class ModelComponentEditorComponent implements OnInit{
|
|||||||
|
|
||||||
onUpdateName() {
|
onUpdateName() {
|
||||||
this.modelComponent!.componentName = this.nameCtrl.value;
|
this.modelComponent!.componentName = this.nameCtrl.value;
|
||||||
|
this.modelComponent!.onModifyContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdateDescription() {
|
onUpdateDescription() {
|
||||||
this.modelComponent!.componentDescription = this.descriptionCtrl.value;
|
this.modelComponent!.componentDescription = this.descriptionCtrl.value;
|
||||||
|
this.modelComponent!.onModifyContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly name = name;
|
protected readonly name = name;
|
||||||
|
@ -39,9 +39,11 @@ export class ScriptAccountEditorComponent implements OnInit{
|
|||||||
|
|
||||||
onUpdateMinValue() {
|
onUpdateMinValue() {
|
||||||
this.scriptAccount!.minValue = Number(this.minCtrl.value);
|
this.scriptAccount!.minValue = Number(this.minCtrl.value);
|
||||||
|
this.scriptAccount!.onModifyContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdateMaxValue() {
|
onUpdateMaxValue() {
|
||||||
this.scriptAccount!.maxValue = Number(this.maxCtrl.value);
|
this.scriptAccount!.maxValue = Number(this.maxCtrl.value);
|
||||||
|
this.scriptAccount!.onModifyContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import {ModelComponentType} from "./ModelComponentType";
|
import {ModelComponentType} from "./ModelComponentType";
|
||||||
|
import {SaveComponent} from "./SaveComponent";
|
||||||
|
|
||||||
export abstract class ModelComponent {
|
export abstract class ModelComponent extends SaveComponent{
|
||||||
componentName: string
|
componentName: string
|
||||||
componentDescription: string
|
componentDescription: string
|
||||||
type: ModelComponentType
|
type: ModelComponentType
|
||||||
constructor(componentName: string, componentDescription: string, type: ModelComponentType) {
|
constructor(componentName: string, componentDescription: string, type: ModelComponentType) {
|
||||||
|
super();
|
||||||
this.componentName = componentName;
|
this.componentName = componentName;
|
||||||
this.componentDescription = componentDescription;
|
this.componentDescription = componentDescription;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
13
src/app/game-model/SaveComponent.ts
Normal file
13
src/app/game-model/SaveComponent.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
export abstract class SaveComponent {
|
||||||
|
unsaved: boolean = false;
|
||||||
|
|
||||||
|
onModifyContent() {
|
||||||
|
this.unsaved = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
onSaveContent() {
|
||||||
|
this.unsaved = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract save(): void;
|
||||||
|
}
|
@ -7,4 +7,8 @@ export class ScriptAccount extends ModelComponent{
|
|||||||
constructor(componentName: string, componentDescription: string) {
|
constructor(componentName: string, componentDescription: string) {
|
||||||
super(componentName, componentDescription, ModelComponentType.SCRIPTACCOUNT);
|
super(componentName, componentDescription, ModelComponentType.SCRIPTACCOUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
save(): void {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user