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