diff --git a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.html b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.html new file mode 100644 index 0000000..fc7f81b --- /dev/null +++ b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.html @@ -0,0 +1,8 @@ +
+
+ done + close +
+ + +
diff --git a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.scss b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.spec.ts b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.spec.ts new file mode 100644 index 0000000..fab76c6 --- /dev/null +++ b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StateInitialCellComponent } from './state-initial-cell.component'; + +describe('StateInitialCellComponent', () => { + let component: StateInitialCellComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [StateInitialCellComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(StateInitialCellComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.ts b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.ts new file mode 100644 index 0000000..0858bb4 --- /dev/null +++ b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/state-initial-cell/state-initial-cell.component.ts @@ -0,0 +1,33 @@ +import {Component, Input} from '@angular/core'; +import {SimpleState} from "../../../../../project/game-model/gamesystems/states/SimpleState"; +import {NgIf} from "@angular/common"; +import {TemplateElement} from "../../../../../project/game-model/templates/TemplateElement"; +import {SimpleTemplateState} from "../../../../../project/game-model/templates/simpleGamesystem/SimpleTemplateState"; + +@Component({ + selector: 'app-state-initial-cell', + templateUrl: './state-initial-cell.component.html', + styleUrl: './state-initial-cell.component.scss' +}) +export class StateInitialCellComponent { + + @Input() state: SimpleState | undefined + @Input() editedState: SimpleState | undefined | null + @Input() templateElement: TemplateElement | undefined + + get initialValue(): boolean { + if(this.templateElement != undefined && this.state instanceof SimpleTemplateState && this.state.initialMap.has(this.templateElement!)) { + return this.state!.initialMap.get(this.templateElement!)! + } else { + return this.state!.initial; + } + } + + set initialValue(value: boolean) { + if(this.templateElement != undefined && this.state instanceof SimpleTemplateState && this.state.initialMap.has(this.templateElement!)) { + this.state.initialMap.set(this.templateElement!, value) + } else { + this.state!.initial = value; + } + } +}