issue-5-gamesystems #6
@ -27,7 +27,7 @@
 | 
				
			|||||||
    </mat-drawer>
 | 
					    </mat-drawer>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div class="example-sidenav-content">
 | 
					    <div class="example-sidenav-content">
 | 
				
			||||||
      <app-editor #editor></app-editor>
 | 
					      <app-editor #editor (onModelNameUpdate)="onModelNameUpdate()"></app-editor>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  </mat-drawer-container>
 | 
					  </mat-drawer-container>
 | 
				
			||||||
 | 
				
			|||||||
@ -116,6 +116,11 @@ export class AppComponent implements OnInit{
 | 
				
			|||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      console.log("[WARN] [App.Component] Editor is undefined")
 | 
					      console.log("[WARN] [App.Component] Editor is undefined")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  onModelNameUpdate() {
 | 
				
			||||||
 | 
					    if(this.openContent == ModelComponentType.GAMESYTEM) {
 | 
				
			||||||
 | 
					      this.gamesystemOverview!.onUpdateModelName();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@
 | 
				
			|||||||
      <span [ngClass]="modelComponent.unsaved? 'unsaved':'saved'">{{modelComponent.componentName}}</span>
 | 
					      <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>
 | 
					      <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" (onModelNameUpdated)="onModelNameUpdate()"></app-model-component-editor>
 | 
				
			||||||
    <app-script-account-editor *ngIf="modelComponent.type === ModelComponentType.SCRIPTACCOUNT"
 | 
					    <app-script-account-editor *ngIf="modelComponent.type === ModelComponentType.SCRIPTACCOUNT"
 | 
				
			||||||
                               [scriptAccount]="convertModelComponentToScriptAccount(modelComponent)"></app-script-account-editor>
 | 
					                               [scriptAccount]="convertModelComponentToScriptAccount(modelComponent)"></app-script-account-editor>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
import {Component, Input} from '@angular/core';
 | 
					import {Component, EventEmitter, Input, Output} from '@angular/core';
 | 
				
			||||||
import {GameModel} from "../game-model/GameModel";
 | 
					import {GameModel} from "../game-model/GameModel";
 | 
				
			||||||
import {ModelComponent} from "../game-model/ModelComponent";
 | 
					import {ModelComponent} from "../game-model/ModelComponent";
 | 
				
			||||||
import {ModelComponentType} from "../game-model/ModelComponentType";
 | 
					import {ModelComponentType} from "../game-model/ModelComponentType";
 | 
				
			||||||
@ -11,6 +11,7 @@ import {ScriptAccount} from "../game-model/scriptAccounts/ScriptAccount";
 | 
				
			|||||||
})
 | 
					})
 | 
				
			||||||
export class EditorComponent {
 | 
					export class EditorComponent {
 | 
				
			||||||
  gameModelComponents: ModelComponent[] = [];
 | 
					  gameModelComponents: ModelComponent[] = [];
 | 
				
			||||||
 | 
					  @Output("onModelNameUpdate") onModelNameUpdateEmitter = new EventEmitter<boolean>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  openGameModelComponent(gameModelComponent: ModelComponent) {
 | 
					  openGameModelComponent(gameModelComponent: ModelComponent) {
 | 
				
			||||||
    if(!this.gameModelComponents.includes(gameModelComponent)) {
 | 
					    if(!this.gameModelComponents.includes(gameModelComponent)) {
 | 
				
			||||||
@ -29,4 +30,8 @@ export class EditorComponent {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected readonly ModelComponentType = ModelComponentType;
 | 
					  protected readonly ModelComponentType = ModelComponentType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  onModelNameUpdate() {
 | 
				
			||||||
 | 
					    this.onModelNameUpdateEmitter.emit(true);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
import {Component, Input, OnInit} from '@angular/core';
 | 
					import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
 | 
				
			||||||
import {ModelComponent} from "../../game-model/ModelComponent";
 | 
					import {ModelComponent} from "../../game-model/ModelComponent";
 | 
				
			||||||
import {FormControl, Validators} from "@angular/forms";
 | 
					import {FormControl, Validators} from "@angular/forms";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -9,6 +9,7 @@ import {FormControl, Validators} from "@angular/forms";
 | 
				
			|||||||
})
 | 
					})
 | 
				
			||||||
export class ModelComponentEditorComponent implements OnInit{
 | 
					export class ModelComponentEditorComponent implements OnInit{
 | 
				
			||||||
  @Input('modelComponent') modelComponent: ModelComponent | undefined
 | 
					  @Input('modelComponent') modelComponent: ModelComponent | undefined
 | 
				
			||||||
 | 
					  @Output("onModelNameUpdated") onModelNameUpdateEmitter = new EventEmitter<boolean>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  nameCtrl: FormControl = new FormControl('', [Validators.required]);
 | 
					  nameCtrl: FormControl = new FormControl('', [Validators.required]);
 | 
				
			||||||
  descriptionCtrl: FormControl = new FormControl('' );
 | 
					  descriptionCtrl: FormControl = new FormControl('' );
 | 
				
			||||||
@ -21,6 +22,7 @@ export class ModelComponentEditorComponent implements OnInit{
 | 
				
			|||||||
  onUpdateName() {
 | 
					  onUpdateName() {
 | 
				
			||||||
    this.modelComponent!.componentName = this.nameCtrl.value;
 | 
					    this.modelComponent!.componentName = this.nameCtrl.value;
 | 
				
			||||||
    this.modelComponent!.onModifyContent();
 | 
					    this.modelComponent!.onModifyContent();
 | 
				
			||||||
 | 
					    this.onModelNameUpdateEmitter.emit(true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onUpdateDescription() {
 | 
					  onUpdateDescription() {
 | 
				
			||||||
 | 
				
			|||||||
@ -91,4 +91,8 @@ export class GamescriptOverviewComponent implements OnInit {
 | 
				
			|||||||
      this.openGamesystemEmitter.emit(gamesystem);
 | 
					      this.openGamesystemEmitter.emit(gamesystem);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  onUpdateModelName() {
 | 
				
			||||||
 | 
					    this.dataSource.data = this.gameModel!.gamesystems;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user