template-systems #41
@ -79,6 +79,9 @@ import {
 | 
			
		||||
import {
 | 
			
		||||
  TemplateSpecificatorComponent
 | 
			
		||||
} from "./editor/gamesystem-editor/template-specificator/template-specificator.component";
 | 
			
		||||
import {
 | 
			
		||||
    StateInitialCellComponent
 | 
			
		||||
} from "./editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component";
 | 
			
		||||
 | 
			
		||||
// AoT requires an exported function for factories
 | 
			
		||||
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader =>  new TranslateHttpLoader(http, './assets/i18n/', '.json');
 | 
			
		||||
@ -103,7 +106,8 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader =>  new Transl
 | 
			
		||||
    ScriptaccountConditionEditorComponent,
 | 
			
		||||
    CharacterOverviewComponent,
 | 
			
		||||
    CharacterEditorComponent,
 | 
			
		||||
    TemplateSpecificatorComponent
 | 
			
		||||
    TemplateSpecificatorComponent,
 | 
			
		||||
    StateInitialCellComponent
 | 
			
		||||
  ],
 | 
			
		||||
    imports: [
 | 
			
		||||
        BrowserModule,
 | 
			
		||||
 | 
			
		||||
@ -39,12 +39,7 @@
 | 
			
		||||
      <ng-container matColumnDef="initial">
 | 
			
		||||
        <th mat-header-cell *matHeaderCellDef>Initial</th>
 | 
			
		||||
        <td mat-cell *matCellDef="let state">
 | 
			
		||||
          <div *ngIf="editedElement !== state">
 | 
			
		||||
            <mat-icon *ngIf="state.initial">done</mat-icon>
 | 
			
		||||
            <mat-icon *ngIf="!state.initial">close</mat-icon>
 | 
			
		||||
          </div>
 | 
			
		||||
          <mat-checkbox *ngIf="editedElement === state" [(ngModel)]="state.initial" (ngModelChange)="onStateChange()"></mat-checkbox>
 | 
			
		||||
 | 
			
		||||
          <app-state-initial-cell [templateElement]="templateElement" [editedState]="editedElement" [state]="state"></app-state-initial-cell>
 | 
			
		||||
        </td>
 | 
			
		||||
      </ng-container>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -35,11 +35,14 @@ export class SimpleStateEditorComponent implements OnInit{
 | 
			
		||||
 | 
			
		||||
  editedStateLabelError: boolean = false;
 | 
			
		||||
 | 
			
		||||
  testState: SimpleState | undefined = undefined
 | 
			
		||||
 | 
			
		||||
  constructor(private snackbar: MatSnackBar) {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnInit() {
 | 
			
		||||
    this.dataSource.data = this.states;
 | 
			
		||||
    this.testState = this.states[0]
 | 
			
		||||
    this.dataSource.filterPredicate = (data: SimpleState, filter: string) => {
 | 
			
		||||
      return data.stateLabel.toLowerCase().includes(filter);
 | 
			
		||||
    }
 | 
			
		||||
@ -127,4 +130,6 @@ export class SimpleStateEditorComponent implements OnInit{
 | 
			
		||||
      return [];
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,10 +5,12 @@ import {ScriptAccountCondition} from "../../gamesystems/conditions/ScriptAccount
 | 
			
		||||
export class SimpleTemplateState extends SimpleState {
 | 
			
		||||
 | 
			
		||||
  conditionMap: Map<TemplateElement, ScriptAccountCondition[]> = new Map();
 | 
			
		||||
  initialMap: Map<TemplateElement, boolean> = new Map<TemplateElement, boolean>();
 | 
			
		||||
 | 
			
		||||
  addTemplateElement(templateElement: TemplateElement) {
 | 
			
		||||
    if(!this.conditionMap.has(templateElement)) {
 | 
			
		||||
      this.conditionMap.set(templateElement, this.conditions)
 | 
			
		||||
      this.initialMap.set(templateElement, this.initial);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user