Implement basic version of characters #32
@ -20,6 +20,8 @@ import {ElectronService} from "./core/services";
 | 
			
		||||
import {ScriptAccountSerializer} from "./project/serializer/ScriptAccountSerializer";
 | 
			
		||||
import {StoreComponent} from "../../app/storage/StoreComponent";
 | 
			
		||||
import {GamesystemSerializer} from "./project/serializer/GamesystemSerializer";
 | 
			
		||||
import {Character} from "./project/game-model/characters/Character";
 | 
			
		||||
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'app-root',
 | 
			
		||||
@ -33,6 +35,7 @@ export class AppComponent implements OnInit{
 | 
			
		||||
  @ViewChild('editor') editor: EditorComponent|undefined
 | 
			
		||||
  @ViewChild('scriptAccountOverview') scriptAccountOverview: ScriptAccountOverviewComponent | undefined
 | 
			
		||||
  @ViewChild('gamesystemOverview') gamesystemOverview: GamescriptOverviewComponent | undefined
 | 
			
		||||
  @ViewChild('characterOverview') characterOverview: CharacterOverviewComponent | undefined
 | 
			
		||||
 | 
			
		||||
  gameModel: GameModel | undefined
 | 
			
		||||
 | 
			
		||||
@ -109,6 +112,8 @@ export class AppComponent implements OnInit{
 | 
			
		||||
          this.gameModel!.removeGamesystem(affectedModelComponent);
 | 
			
		||||
          //this.electronService.ipcRenderer.send('delete-component', new DeleteModel(affectedModelComponent.componentName, ModelComponentType.GAMESYTEM))
 | 
			
		||||
          this.gamesystemOverview!.refresh()
 | 
			
		||||
        } else if(affectedModelComponent instanceof Character) {
 | 
			
		||||
          this.gameModel!.removeCharacter(affectedModelComponent)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
@ -169,6 +174,12 @@ export class AppComponent implements OnInit{
 | 
			
		||||
      } else {
 | 
			
		||||
        console.log("[WARN] [App.component] GamesystemOverview is undefined")
 | 
			
		||||
      }
 | 
			
		||||
    } else if(this.openContent == ModelComponentType.CHARACTER) {
 | 
			
		||||
      if(this.characterOverview != undefined) {
 | 
			
		||||
        return this.characterOverview.selectedCharacter;
 | 
			
		||||
      } else {
 | 
			
		||||
        console.log("[WARN] [App.component] ScriptAccountOverview is undefined")
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return undefined;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -85,6 +85,12 @@ export class GameModel {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  removeCharacter(character: Character) {
 | 
			
		||||
    if(character != undefined) {
 | 
			
		||||
      this.characters = this.characters.filter(c => c.componentName !== character.componentName)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  findGamesystem(gamesystemName: string) {
 | 
			
		||||
    const gamesystemQueue : Gamesystem<State<any>, Transition<any>>[] = [];
 | 
			
		||||
    this.gamesystems.forEach(gamesystem => gamesystemQueue.push(gamesystem));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user