refactor-component-creation #47
@ -104,13 +104,13 @@ function createWindow(): BrowserWindow {
 | 
			
		||||
            {
 | 
			
		||||
              label: "Abstract Itemgroup",
 | 
			
		||||
              click: () => {
 | 
			
		||||
                win!.webContents.send('context-menu', "new-itemgroup_abstract")
 | 
			
		||||
                win!.webContents.send('context-menu', "new-itemgroup-abstract")
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
              label: "Concrete Itemgroup",
 | 
			
		||||
              click: () => {
 | 
			
		||||
                win!.webContents.send('context-menu', "new-itemgroup_concrete")
 | 
			
		||||
                win!.webContents.send('context-menu', "new-itemgroup-concrete")
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
@ -1,44 +0,0 @@
 | 
			
		||||
import { test, expect } from '@playwright/test';
 | 
			
		||||
import {GamesystemTrainer} from "./GamesystemTrainer";
 | 
			
		||||
import {ProductGamesystem} from "../../../src/app/project/game-model/gamesystems/ProductGamesystem";
 | 
			
		||||
test.describe('Test Create Gamesystems', () => {
 | 
			
		||||
 | 
			
		||||
  test('Test creating gamesystem with invalid name', async => {
 | 
			
		||||
    const gameModel = GamesystemTrainer.givenEmptyGameModel();
 | 
			
		||||
    let result = gameModel.createGamesystem(undefined, undefined);
 | 
			
		||||
    expect(result).toBeUndefined();
 | 
			
		||||
 | 
			
		||||
    result = gameModel.createGamesystem(null, undefined);
 | 
			
		||||
    expect(result).toBeUndefined();
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  test("Test creating gamesystem with valid name but without parent", async => {
 | 
			
		||||
    const gameModel = GamesystemTrainer.givenEmptyGameModel();
 | 
			
		||||
    let result = gameModel.createGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEMNAME, undefined);
 | 
			
		||||
    expect(result).toBeDefined();
 | 
			
		||||
    expect(gameModel.gamesystems.length).toEqual(1);
 | 
			
		||||
    expect(gameModel.findGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEMNAME)).toBeDefined();
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  test("Test creating Gamesystem with valid name but with Product Parent", async => {
 | 
			
		||||
    const gameModel = GamesystemTrainer.givenGameModelWithProductGamesytemOnTopLayer();
 | 
			
		||||
    let result = gameModel.createGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEM_LEAF_LEFT, GamesystemTrainer.TOP_PRODUCT_GAMESYSTEM_NAME);
 | 
			
		||||
    expect(result).toBeDefined();
 | 
			
		||||
    expect(result.parentGamesystem!.componentName).toEqual(GamesystemTrainer.TOP_PRODUCT_GAMESYSTEM_NAME);
 | 
			
		||||
    expect(result.parentGamesystem!.innerGamesystems.length).toEqual(3);
 | 
			
		||||
    expect(result.parentGamesystem!.innerGamesystems.includes(result)).toBeTruthy();
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  test("Test creating Gamesystem with valid name but with Simple Parent", async() => {
 | 
			
		||||
    const gameModel = GamesystemTrainer.givenGameModelWithSimpleGamesystemOnTopLayer();
 | 
			
		||||
    let result = gameModel.createGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEM_LEAF_LEFT, GamesystemTrainer.SIMPLEGAMESYSTEMNAME);
 | 
			
		||||
    expect(result).toBeDefined();
 | 
			
		||||
    expect(gameModel.gamesystems.length).toEqual(1);
 | 
			
		||||
    expect(gameModel.gamesystems[0]).toBeInstanceOf(ProductGamesystem);
 | 
			
		||||
    expect(gameModel.gamesystems[0]).toEqual(result.parentGamesystem);
 | 
			
		||||
    expect((gameModel.gamesystems[0] as ProductGamesystem).innerGamesystems.length).toEqual(1);
 | 
			
		||||
    expect((gameModel.gamesystems[0] as ProductGamesystem).innerGamesystems.includes(result)).toBeTruthy();
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
@ -1,71 +0,0 @@
 | 
			
		||||
import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
 | 
			
		||||
import { test, expect } from '@playwright/test';
 | 
			
		||||
import * as PATH from 'path';
 | 
			
		||||
import {GameModel} from "../../../src/app/project/game-model/GameModel";
 | 
			
		||||
import {Gamesystem} from "../../src/app/project/game-model/gamesystems/Gamesystem";
 | 
			
		||||
import {ScriptAccount} from "../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
 | 
			
		||||
import {ModelComponentType} from "../../../src/app/project/game-model/ModelComponentType";
 | 
			
		||||
 | 
			
		||||
test.describe('Test ScriptAccounts', () => {
 | 
			
		||||
 | 
			
		||||
  test("Test ScriptAccount Creation", async () => {
 | 
			
		||||
    const scriptAccunt = new ScriptAccount("ScriptAccount", "Description");
 | 
			
		||||
 | 
			
		||||
    expect(scriptAccunt.componentName).toEqual("ScriptAccount");
 | 
			
		||||
    expect(scriptAccunt.componentDescription).toEqual("Description");
 | 
			
		||||
    expect(scriptAccunt.type).toEqual(ModelComponentType.SCRIPTACCOUNT);
 | 
			
		||||
    expect(scriptAccunt.minValue).toEqual(0);
 | 
			
		||||
    expect(scriptAccunt.maxValue).toEqual(100);
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  test("Test Adding ScriptAccounts", async () => {
 | 
			
		||||
    const gameModel: GameModel = new GameModel("GameModel");
 | 
			
		||||
 | 
			
		||||
    let scriptAccount =gameModel.createScriptAccount("ScriptAccount");
 | 
			
		||||
    expect(scriptAccount).toBeDefined();
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(1);
 | 
			
		||||
    expect(gameModel.scriptAccounts.includes(scriptAccount)).toBeTruthy();
 | 
			
		||||
 | 
			
		||||
    //Test adding scriptAccount with already existing name
 | 
			
		||||
    const scriptAccount2 = gameModel.createScriptAccount("ScriptAccount")
 | 
			
		||||
    expect(scriptAccount2).toBeUndefined();
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(1);
 | 
			
		||||
 | 
			
		||||
    //Test for adding invalid names as scriptaccount names (null/undefined/empty)
 | 
			
		||||
    let result = gameModel.createScriptAccount(null);
 | 
			
		||||
    expect(result).toBeUndefined();
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(1);
 | 
			
		||||
    result = gameModel.createScriptAccount(undefined);
 | 
			
		||||
    expect(result).toBeUndefined();
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(1);
 | 
			
		||||
    result = gameModel.createScriptAccount("");
 | 
			
		||||
    expect(result).toBeUndefined();
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(1);
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  test("test Removing ScriptAccounts", async () => {
 | 
			
		||||
    const gameModel: GameModel = new GameModel("GameModel");
 | 
			
		||||
    let scriptAccount = new ScriptAccount("test", "")
 | 
			
		||||
 | 
			
		||||
    gameModel.removeScriptAccount(scriptAccount);
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(0);
 | 
			
		||||
 | 
			
		||||
    scriptAccount = gameModel.createScriptAccount("ScriptAccount");
 | 
			
		||||
    gameModel.removeScriptAccount(scriptAccount);
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(0);
 | 
			
		||||
 | 
			
		||||
    gameModel.removeScriptAccount(undefined);
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(0);
 | 
			
		||||
 | 
			
		||||
    gameModel.removeScriptAccount(null);
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(0);
 | 
			
		||||
 | 
			
		||||
    scriptAccount = gameModel.createScriptAccount(scriptAccount);
 | 
			
		||||
    let scriptAccount2 = gameModel.createScriptAccount("ScriptAccount 2");
 | 
			
		||||
 | 
			
		||||
    gameModel.removeScriptAccount(scriptAccount);
 | 
			
		||||
    expect(gameModel.scriptAccounts.length).toEqual(1);
 | 
			
		||||
    expect(gameModel.scriptAccounts.includes(scriptAccount2)).toBeTruthy();
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
@ -25,11 +25,17 @@ import {CharacterOverviewComponent} from "./side-overviews/character-overview/ch
 | 
			
		||||
import {CharacterSerializer} from "./project/serializer/CharacterSerializer";
 | 
			
		||||
import {CharacterParser} from "./project/parser/characterParser/CharacterParser";
 | 
			
		||||
import {TemplateType} from "./project/game-model/templates/TemplateType";
 | 
			
		||||
import {TemplateTypeUtilities} from "./project/game-model/templates/TemplateTypeUtilities";
 | 
			
		||||
import {SimpleTemplateGamesystem} from "./project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem";
 | 
			
		||||
import {ItemSerializer} from "./project/serializer/ItemSerializer";
 | 
			
		||||
import {ItemgroupParser} from "./project/parser/itemParser/ItemgroupParser";
 | 
			
		||||
import {ItemParser} from "./project/parser/itemParser/ItemParser";
 | 
			
		||||
import {ItemgroupCreator} from "./project/game-model/utils/creator/ItemgroupCreator";
 | 
			
		||||
import {ItemOverviewComponent} from "./side-overviews/item-overview/item-overview.component";
 | 
			
		||||
import {Overview} from "./side-overviews/Overview";
 | 
			
		||||
import {ItemCreator} from "./project/game-model/utils/creator/ItemCreator";
 | 
			
		||||
import {ScriptAccountCreator} from "./project/game-model/utils/creator/ScriptAccountCreator";
 | 
			
		||||
import {CharacterCreator} from "./project/game-model/utils/creator/CharacterCreator";
 | 
			
		||||
import {GamesystemCreator} from "./project/game-model/utils/creator/GamesystemCreator";
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'app-root',
 | 
			
		||||
@ -44,6 +50,7 @@ export class AppComponent implements OnInit{
 | 
			
		||||
  @ViewChild('scriptAccountOverview') scriptAccountOverview: ScriptAccountOverviewComponent | undefined
 | 
			
		||||
  @ViewChild('gamesystemOverview') gamesystemOverview: GamescriptOverviewComponent | undefined
 | 
			
		||||
  @ViewChild('characterOverview') characterOverview: CharacterOverviewComponent | undefined
 | 
			
		||||
  @ViewChild('itemOverview') itemOverview: ItemOverviewComponent | undefined
 | 
			
		||||
 | 
			
		||||
  gameModel: GameModel | undefined
 | 
			
		||||
 | 
			
		||||
@ -82,12 +89,45 @@ export class AppComponent implements OnInit{
 | 
			
		||||
    } else if(message.startsWith("new")) {
 | 
			
		||||
      const splittedMessage = message.split("-");
 | 
			
		||||
      const modelComponentType = ModelComponentTypeUtillities.fromString(splittedMessage[1]);
 | 
			
		||||
      const templateType = TemplateTypeUtilities.fromString(splittedMessage[2]);
 | 
			
		||||
      if(modelComponentType != undefined) {
 | 
			
		||||
        this.onCreateModelComponent(modelComponentType, templateType);
 | 
			
		||||
      } else {
 | 
			
		||||
        console.log("[ERROR] [App-Component] Unknown Context-Menu Command!")
 | 
			
		||||
      if(modelComponentType !== undefined) {
 | 
			
		||||
        let creationContext = "";
 | 
			
		||||
        if(splittedMessage.length > 2) {
 | 
			
		||||
          creationContext = splittedMessage[2];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let componentCreator;
 | 
			
		||||
        switch (modelComponentType) {
 | 
			
		||||
          case ModelComponentType.ITEMGROUP: {
 | 
			
		||||
            componentCreator = new ItemgroupCreator(creationContext, this.gameModel!, this.selectedModelComponent);
 | 
			
		||||
          } break
 | 
			
		||||
          case ModelComponentType.ITEM: {
 | 
			
		||||
            componentCreator = new ItemCreator(creationContext, this.gameModel!, this.selectedModelComponent);
 | 
			
		||||
          } break
 | 
			
		||||
          case ModelComponentType.SCRIPTACCOUNT: {
 | 
			
		||||
            componentCreator = new ScriptAccountCreator(creationContext, this.gameModel!, this.selectedModelComponent);
 | 
			
		||||
          } break
 | 
			
		||||
          case ModelComponentType.CHARACTER: {
 | 
			
		||||
            componentCreator = new CharacterCreator(creationContext, this.gameModel!, this.selectedModelComponent);
 | 
			
		||||
          } break
 | 
			
		||||
          case ModelComponentType.GAMESYTEM: {
 | 
			
		||||
            componentCreator = new GamesystemCreator(creationContext, this.gameModel!, this.selectedModelComponent);
 | 
			
		||||
          } break
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(componentCreator) {
 | 
			
		||||
          const createdModel = componentCreator.createModelComponent();
 | 
			
		||||
          this.openModelComponent(createdModel!)
 | 
			
		||||
 | 
			
		||||
          const openedOverview = this.openedOverview;
 | 
			
		||||
          if(openedOverview) {
 | 
			
		||||
            openedOverview.refresh()
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
          console.log("[ERROR] Unknown Creation Command: ", message)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -110,6 +150,7 @@ export class AppComponent implements OnInit{
 | 
			
		||||
        }
 | 
			
		||||
      }break
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -134,53 +175,6 @@ export class AppComponent implements OnInit{
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private onCreateModelComponent(modelComponentType: ModelComponentType, templateType: TemplateType | undefined) {
 | 
			
		||||
    switch (modelComponentType) {
 | 
			
		||||
      case ModelComponentType.SCRIPTACCOUNT: this.onCreateNewScriptAccount(); break
 | 
			
		||||
      case ModelComponentType.GAMESYTEM: this.onCreateNewGamesystem(templateType); break
 | 
			
		||||
      case ModelComponentType.CHARACTER: this.onCreateNewCharacter(); break
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private onCreateNewScriptAccount() {
 | 
			
		||||
    const createdScriptAccount = this.gameModel!.createScriptAccount("New ScriptAccount");
 | 
			
		||||
    if(createdScriptAccount != undefined) {
 | 
			
		||||
      this.editor?.openGameModelComponent(createdScriptAccount);
 | 
			
		||||
    } else {
 | 
			
		||||
      console.log("[DEBUG] [App-Component] ScriptAccount could not be created (Name not unique)");
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private onCreateNewGamesystem(templateType: TemplateType | undefined) {
 | 
			
		||||
    let parentGamesystemName = undefined
 | 
			
		||||
    if(this.openContent != ModelComponentType.GAMESYTEM) {
 | 
			
		||||
      this.openGamesystemsOverview();
 | 
			
		||||
    } else {
 | 
			
		||||
      parentGamesystemName = this.gamesystemOverview!.selectedGamesystemName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    let createdGamesystem;
 | 
			
		||||
    if(parentGamesystemName == undefined) {
 | 
			
		||||
      createdGamesystem = this.gameModel?.createSimpleGamesystem("New Gamesystem", templateType);
 | 
			
		||||
    } else {
 | 
			
		||||
      createdGamesystem = this.gameModel!.createSimpleGamesystemWithParent("New Gamesystem", parentGamesystemName, templateType)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(createdGamesystem != undefined) {
 | 
			
		||||
      this.gamesystemOverview!.refresh();
 | 
			
		||||
      this.editor?.openGameModelComponent(createdGamesystem);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private onCreateNewCharacter() {
 | 
			
		||||
    const createdCharacter = this.gameModel!.createCharacter("New Character")
 | 
			
		||||
    if(createdCharacter != undefined) {
 | 
			
		||||
      this.editor?.openGameModelComponent(createdCharacter);
 | 
			
		||||
    } else {
 | 
			
		||||
      console.log("[DEBUG] [App-Component] ScriptAccount could not be created (Name not unique)");
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private getSelectedModelComponent(): ModelComponent | undefined {
 | 
			
		||||
    if(this.openContent == ModelComponentType.SCRIPTACCOUNT) {
 | 
			
		||||
@ -303,6 +297,26 @@ export class AppComponent implements OnInit{
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  get selectedModelComponent(): ModelComponent | undefined {
 | 
			
		||||
    switch (this.openContent) {
 | 
			
		||||
      case ModelComponentType.GAMESYTEM: return this.gamesystemOverview!.getSelectedGamesystem();
 | 
			
		||||
      case ModelComponentType.CHARACTER: return this.characterOverview!.selectedCharacter;
 | 
			
		||||
      case ModelComponentType.SCRIPTACCOUNT: return this.scriptAccountOverview!.selectedScriptAccount;
 | 
			
		||||
      case ModelComponentType.ITEMGROUP: return this.itemOverview!.selectedModelComponent;
 | 
			
		||||
      case ModelComponentType.ITEM: return this.itemOverview!.selectedModelComponent;
 | 
			
		||||
      default: return undefined
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected readonly open = open;
 | 
			
		||||
  get openedOverview(): Overview | undefined {
 | 
			
		||||
    if(this.openContent === ModelComponentType.ITEMGROUP || this.openContent === ModelComponentType.ITEM) {
 | 
			
		||||
      return this.itemOverview;
 | 
			
		||||
    } else if(this.openContent === ModelComponentType.SCRIPTACCOUNT) {
 | 
			
		||||
      return this.scriptAccountOverview;
 | 
			
		||||
    } else if(this.openContent === ModelComponentType.CHARACTER) {
 | 
			
		||||
      return this.characterOverview;
 | 
			
		||||
    } else if(this.openContent === ModelComponentType.GAMESYTEM) {
 | 
			
		||||
      return this.gamesystemOverview;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -30,47 +30,6 @@ export class GameModel {
 | 
			
		||||
    this.gameModelName = gameModelName;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  addAbstractItemgroup(groupName: string, parentgroup: AbstractItemGroup | undefined) {
 | 
			
		||||
    //Ensure that Itemgroup does not exist
 | 
			
		||||
    if(parentgroup == undefined) {
 | 
			
		||||
      if(GameModel.findItemgroupByName(groupName, this.itemgroups) == undefined) {
 | 
			
		||||
        const itemgroup = new AbstractItemGroup(groupName, "", ModelComponentType.ITEMGROUP)
 | 
			
		||||
        this.itemgroups.push(itemgroup);
 | 
			
		||||
        itemgroup.addItemgroupCharacteristic(new ItemGroupCharacteristic("Test0", "", itemgroup));
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      if(GameModel.findItemgroupByName(groupName, parentgroup.children) == undefined) {
 | 
			
		||||
        parentgroup.addChildItemgroup(new AbstractItemGroup(groupName, "", ModelComponentType.ITEMGROUP));
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  addConcreteItemgroup(groupName: string, parentgroup: AbstractItemGroup | undefined) {
 | 
			
		||||
    //Ensure that Itemgroup does not exist
 | 
			
		||||
    if(parentgroup == undefined) {
 | 
			
		||||
      if(GameModel.findItemgroupByName(groupName, this.itemgroups) == undefined) {
 | 
			
		||||
        this.itemgroups.push(new ConcreteItemGroup(groupName, "", ModelComponentType.ITEMGROUP));
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      if(GameModel.findItemgroupByName(groupName, parentgroup.children) == undefined) {
 | 
			
		||||
        parentgroup.addChildItemgroup(new ConcreteItemGroup(groupName, "", ModelComponentType.ITEMGROUP));
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  addItem(itemName: string, conceteItemgroupName: string) {
 | 
			
		||||
    const itemgroup = GameModel.findItemgroupByName(conceteItemgroupName, this.itemgroups);
 | 
			
		||||
    if(itemgroup instanceof ConcreteItemGroup) {
 | 
			
		||||
      const itemgroups: ItemGroup[] = ItemgroupUtilities.findItemgroupPathToItemgroup(conceteItemgroupName, this.itemgroups);
 | 
			
		||||
 | 
			
		||||
      if(itemgroups.length > 0) {
 | 
			
		||||
        const item = new Item(itemName, "", ModelComponentType.ITEM )
 | 
			
		||||
        itemgroup.addItem(item, itemgroups)
 | 
			
		||||
        return item;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  public static findItemgroupByName(name: string, itemgroups: ItemGroup[]) {
 | 
			
		||||
    const itemgroupQueue: ItemGroup[] = itemgroups.concat();
 | 
			
		||||
@ -102,16 +61,12 @@ export class GameModel {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createScriptAccount(scriptAccountName: string) {
 | 
			
		||||
    if(scriptAccountName != undefined && scriptAccountName.length > 0) {
 | 
			
		||||
      const scriptAccount = new ScriptAccount(scriptAccountName, "");
 | 
			
		||||
      const searchedScriptAccount = this.scriptAccounts.find(s => s.componentName === scriptAccount.componentName);
 | 
			
		||||
      if(searchedScriptAccount == undefined) {
 | 
			
		||||
        this.scriptAccounts.push(scriptAccount);
 | 
			
		||||
        return scriptAccount;
 | 
			
		||||
      }
 | 
			
		||||
  addScriptAccount(scriptAccount: ScriptAccount) {
 | 
			
		||||
    if(!this.scriptAccounts.find(sA => sA.componentName === scriptAccount.componentName)) {
 | 
			
		||||
      this.scriptAccounts.push(scriptAccount)
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    return undefined;
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createSimpleGamesystem(gamesystemName: string, templateType: TemplateType | undefined, pushToTop: boolean = true) {
 | 
			
		||||
@ -235,10 +190,6 @@ export class GameModel {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  addScriptAccount(scriptAccount: ScriptAccount) {
 | 
			
		||||
    this.scriptAccounts.push(scriptAccount);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  generateProductSystemContents() {
 | 
			
		||||
    this.gamesystems.forEach(gamesystem => {
 | 
			
		||||
      if(gamesystem instanceof ProductGamesystem) {
 | 
			
		||||
@ -281,4 +232,12 @@ export class GameModel {
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  addCharacter(character: Character) {
 | 
			
		||||
    if(this.characters.find(c => c.componentName === character.componentName) === undefined) {
 | 
			
		||||
      this.characters.push(character)
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -27,5 +27,4 @@ export abstract class Gamesystem<S, T> extends ModelComponent{
 | 
			
		||||
    this.transitions = updatedTransitions;
 | 
			
		||||
    return true;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -32,14 +32,12 @@ export class ProductGamesystem extends Gamesystem<ProductState, ProductTransitio
 | 
			
		||||
      simpleGamesystem.parentGamesystem = this
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if(parentGamesystem != undefined) {
 | 
			
		||||
    if(parentGamesystem == undefined || parentGamesystem.componentName === this.componentName) {
 | 
			
		||||
      gameModel.removeGamesystem(simpleGamesystem);
 | 
			
		||||
      this.addChildGamesystem(simpleGamesystem);
 | 
			
		||||
    } else {
 | 
			
		||||
      parentGamesystem.removeChildGamesystem(simpleGamesystem);
 | 
			
		||||
      parentGamesystem.addChildGamesystem(this);
 | 
			
		||||
      this.parentGamesystem = parentGamesystem
 | 
			
		||||
    } else {
 | 
			
		||||
      gameModel.removeGamesystem(simpleGamesystem);
 | 
			
		||||
      gameModel.addGamesystem(this);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										22
									
								
								src/app/project/game-model/utils/creator/CharacterCreator.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/app/project/game-model/utils/creator/CharacterCreator.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
import {ModelComponentCreator} from "./ModelComponentCreator";
 | 
			
		||||
import {GameModel} from "../../GameModel";
 | 
			
		||||
import {ModelComponent} from "../../ModelComponent";
 | 
			
		||||
import {Character} from "../../characters/Character";
 | 
			
		||||
 | 
			
		||||
export class CharacterCreator extends ModelComponentCreator{
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  constructor(context: string, gameModel: GameModel, selectedComponent: ModelComponent | undefined) {
 | 
			
		||||
    super(context, gameModel, selectedComponent);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createModelComponent(): ModelComponent | undefined {
 | 
			
		||||
    const character = new Character("New Character", "");
 | 
			
		||||
    if(this.gameModel.addCharacter(character)) {
 | 
			
		||||
      return character;
 | 
			
		||||
    }
 | 
			
		||||
    return undefined;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,86 @@
 | 
			
		||||
import {ModelComponentCreator} from "./ModelComponentCreator";
 | 
			
		||||
import {GameModel} from "../../GameModel";
 | 
			
		||||
import {ModelComponent} from "../../ModelComponent";
 | 
			
		||||
import {TemplateTypeUtilities} from "../../templates/TemplateTypeUtilities";
 | 
			
		||||
import {Gamesystem} from "../../gamesystems/Gamesystem";
 | 
			
		||||
import {SimpleGamesystem} from "../../gamesystems/SimpleGamesystem";
 | 
			
		||||
import {ProductGamesystem} from "../../gamesystems/ProductGamesystem";
 | 
			
		||||
import {SimpleTemplateGamesystem} from "../../templates/simpleGamesystem/SimpleTemplateGamesystem";
 | 
			
		||||
import {ProductTemplateCreator} from "../../templates/productGamesystem/ProductTemplateCreator";
 | 
			
		||||
import {ProductTemplateSystem} from "../../templates/productGamesystem/ProductTemplateSystem";
 | 
			
		||||
import {TemplateType} from "../../templates/TemplateType";
 | 
			
		||||
 | 
			
		||||
export class GamesystemCreator extends ModelComponentCreator{
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  constructor(context: string, gameModel: GameModel, selectedComponent: ModelComponent | undefined) {
 | 
			
		||||
    super(context, gameModel, selectedComponent);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createModelComponent(): ModelComponent | undefined {
 | 
			
		||||
    const templateType = TemplateTypeUtilities.fromString(this.context);
 | 
			
		||||
    let simpleGamesystem;
 | 
			
		||||
    if(templateType == undefined) /**Aka normal**/{
 | 
			
		||||
      simpleGamesystem = new SimpleGamesystem("New Simple Gamesystem", "");
 | 
			
		||||
    } else {
 | 
			
		||||
      simpleGamesystem = new SimpleTemplateGamesystem("New Simple Gamesystem", "", templateType)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(this.selectedComponent !== undefined && this.selectedComponent instanceof Gamesystem)/**Aka productGamesystem**/ {
 | 
			
		||||
      const productParentsystem: ProductGamesystem = this.constructProductFromSimple(this.selectedComponent, undefined)!
 | 
			
		||||
      productParentsystem.addChildGamesystem(simpleGamesystem);
 | 
			
		||||
    } else {
 | 
			
		||||
      this.gameModel!.gamesystems.push(simpleGamesystem);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return simpleGamesystem;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private constructProductFromSimple(simpleGamesystem: Gamesystem<any, any>, producttemplateType: TemplateType | undefined): ProductGamesystem | undefined {
 | 
			
		||||
    if(!(simpleGamesystem instanceof ProductTemplateSystem) && producttemplateType != undefined) {
 | 
			
		||||
      console.log("Wierd, Debug")
 | 
			
		||||
      return ProductTemplateCreator.convertProductToTemplate(simpleGamesystem as ProductGamesystem, this.gameModel, producttemplateType);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(simpleGamesystem instanceof ProductGamesystem) {
 | 
			
		||||
      console.log("Wierder Debug")
 | 
			
		||||
      return simpleGamesystem;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    let productGamesystem: ProductGamesystem
 | 
			
		||||
    if(producttemplateType != undefined) {
 | 
			
		||||
      productGamesystem = new ProductTemplateSystem(simpleGamesystem.componentName, simpleGamesystem.componentDescription, producttemplateType);
 | 
			
		||||
    } else {
 | 
			
		||||
      productGamesystem = new ProductGamesystem(simpleGamesystem.componentName, simpleGamesystem.componentDescription);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.constructGamesystemHierarchy(productGamesystem, simpleGamesystem as SimpleGamesystem)
 | 
			
		||||
    return productGamesystem;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private constructGamesystemHierarchy(productGamesystem: ProductGamesystem, simpleGamesystem: SimpleGamesystem) {
 | 
			
		||||
    const simpleParentGamesystem = simpleGamesystem.parentGamesystem;
 | 
			
		||||
 | 
			
		||||
    if(simpleGamesystem.states.length > 0) {
 | 
			
		||||
      simpleGamesystem.componentName += "(Child)";
 | 
			
		||||
      if(simpleParentGamesystem == undefined) {
 | 
			
		||||
        this.gameModel.removeGamesystem(simpleGamesystem);
 | 
			
		||||
        productGamesystem.addChildGamesystem(simpleGamesystem);
 | 
			
		||||
        this.gameModel.addGamesystem(productGamesystem);
 | 
			
		||||
      } else {
 | 
			
		||||
        simpleParentGamesystem.removeChildGamesystem(simpleGamesystem);
 | 
			
		||||
        productGamesystem.addChildGamesystem(simpleGamesystem);
 | 
			
		||||
        simpleParentGamesystem.addChildGamesystem(productGamesystem);
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      if(simpleParentGamesystem == undefined) {
 | 
			
		||||
        this.gameModel.removeGamesystem(simpleGamesystem);
 | 
			
		||||
        this.gameModel.addGamesystem(productGamesystem);
 | 
			
		||||
      } else {
 | 
			
		||||
        simpleParentGamesystem.removeChildGamesystem(simpleGamesystem);
 | 
			
		||||
        simpleParentGamesystem.addChildGamesystem(productGamesystem);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								src/app/project/game-model/utils/creator/ItemCreator.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/app/project/game-model/utils/creator/ItemCreator.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
			
		||||
import {ModelComponentCreator} from "./ModelComponentCreator";
 | 
			
		||||
import {GameModel} from "../../GameModel";
 | 
			
		||||
import {ModelComponent} from "../../ModelComponent";
 | 
			
		||||
import {Item} from "../../inventory/Item";
 | 
			
		||||
import {ModelComponentType} from "../../ModelComponentType";
 | 
			
		||||
import {ConcreteItemGroup} from "../../inventory/ConcreteItemGroup";
 | 
			
		||||
import {ItemGroup} from "../../inventory/ItemGroup";
 | 
			
		||||
 | 
			
		||||
export class ItemCreator extends ModelComponentCreator {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  constructor(context: string, gameModel: GameModel, selectedComponent: ModelComponent | undefined) {
 | 
			
		||||
    super(context, gameModel, selectedComponent);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createModelComponent(): ModelComponent | undefined {
 | 
			
		||||
    if(this.selectedComponent != undefined && this.selectedComponent instanceof ConcreteItemGroup) {
 | 
			
		||||
      const item =  new Item("New Item", "", ModelComponentType.ITEM);
 | 
			
		||||
      this.selectedComponent.addItem(item, this.getInheritedGroups(this.selectedComponent))
 | 
			
		||||
      return item;
 | 
			
		||||
    } else {
 | 
			
		||||
      return undefined
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private getInheritedGroups(baseGroup: ItemGroup): ItemGroup[] {
 | 
			
		||||
    const itemgroups: ItemGroup[] = []
 | 
			
		||||
    let currentGroup: ItemGroup | undefined = baseGroup;
 | 
			
		||||
    while(currentGroup != undefined) {
 | 
			
		||||
      itemgroups.push(currentGroup);
 | 
			
		||||
      currentGroup = currentGroup.parentGroup;
 | 
			
		||||
    }
 | 
			
		||||
    return itemgroups;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										36
									
								
								src/app/project/game-model/utils/creator/ItemgroupCreator.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/app/project/game-model/utils/creator/ItemgroupCreator.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,36 @@
 | 
			
		||||
import {ModelComponentCreator} from "./ModelComponentCreator";
 | 
			
		||||
import {ModelComponent} from "../../ModelComponent";
 | 
			
		||||
import {GameModel} from "../../GameModel";
 | 
			
		||||
import {AbstractItemGroup} from "../../inventory/AbstractItemGroup";
 | 
			
		||||
import {ModelComponentType} from "../../ModelComponentType";
 | 
			
		||||
import {ConcreteItemGroup} from "../../inventory/ConcreteItemGroup";
 | 
			
		||||
 | 
			
		||||
export class ItemgroupCreator extends ModelComponentCreator {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  constructor(context: string, gameModel: GameModel, selectedComponent: ModelComponent | undefined) {
 | 
			
		||||
    super(context, gameModel, selectedComponent);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createModelComponent(): ModelComponent | undefined{
 | 
			
		||||
    let itemgroup;
 | 
			
		||||
    if(this.context === 'abstract') {
 | 
			
		||||
      itemgroup = new AbstractItemGroup("New Abstract Itemgroup", "", ModelComponentType.ITEMGROUP);
 | 
			
		||||
    } else if(this.context === 'concrete') {
 | 
			
		||||
      itemgroup = new ConcreteItemGroup("New Concrete Itemgroup", "", ModelComponentType.ITEMGROUP);
 | 
			
		||||
    } else {
 | 
			
		||||
      return undefined
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(this.selectedComponent != null && this.selectedComponent instanceof AbstractItemGroup) {
 | 
			
		||||
      this.selectedComponent.addChildItemgroup(itemgroup);
 | 
			
		||||
    } else {
 | 
			
		||||
      this.gameModel.itemgroups.push(itemgroup);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return itemgroup;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,18 @@
 | 
			
		||||
import {ModelComponent} from "../../ModelComponent";
 | 
			
		||||
import {GameModel} from "../../GameModel";
 | 
			
		||||
import {Overview} from "../../../../side-overviews/Overview";
 | 
			
		||||
 | 
			
		||||
export abstract class ModelComponentCreator {
 | 
			
		||||
  context: string;
 | 
			
		||||
  gameModel: GameModel
 | 
			
		||||
  selectedComponent: ModelComponent | undefined
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  protected constructor(context: string, gameModel: GameModel, selectedComponent: ModelComponent | undefined) {
 | 
			
		||||
    this.context = context;
 | 
			
		||||
    this.gameModel = gameModel;
 | 
			
		||||
    this.selectedComponent = selectedComponent;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  abstract createModelComponent(): ModelComponent | undefined;
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,22 @@
 | 
			
		||||
import {ModelComponentCreator} from "./ModelComponentCreator";
 | 
			
		||||
import {GameModel} from "../../GameModel";
 | 
			
		||||
import {ModelComponent} from "../../ModelComponent";
 | 
			
		||||
import {ScriptAccount} from "../../scriptAccounts/ScriptAccount";
 | 
			
		||||
 | 
			
		||||
export class ScriptAccountCreator extends ModelComponentCreator {
 | 
			
		||||
 | 
			
		||||
  constructor(context: string, gameModel: GameModel, selectedComponent: ModelComponent | undefined) {
 | 
			
		||||
    super(context, gameModel, selectedComponent);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createModelComponent(): ModelComponent | undefined {
 | 
			
		||||
    const scriptAccount = new ScriptAccount("New ScriptAccount", "");
 | 
			
		||||
    if(this.gameModel.addScriptAccount(scriptAccount)) {
 | 
			
		||||
      return scriptAccount;
 | 
			
		||||
    } else {
 | 
			
		||||
      return undefined;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								src/app/side-overviews/Overview.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/app/side-overviews/Overview.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
export interface Overview {
 | 
			
		||||
 refresh(): void
 | 
			
		||||
}
 | 
			
		||||
@ -5,13 +5,17 @@ import {MatIcon} from "@angular/material/icon";
 | 
			
		||||
import {NgClass, NgForOf} from "@angular/common";
 | 
			
		||||
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
 | 
			
		||||
import {Character} from "../../project/game-model/characters/Character";
 | 
			
		||||
import {Overview} from "../Overview";
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'app-character-overview',
 | 
			
		||||
  templateUrl: './character-overview.component.html',
 | 
			
		||||
  styleUrl: './character-overview.component.scss'
 | 
			
		||||
})
 | 
			
		||||
export class CharacterOverviewComponent {
 | 
			
		||||
export class CharacterOverviewComponent implements Overview{
 | 
			
		||||
  refresh(): void {
 | 
			
		||||
    //Nothing to-do
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Input() gameModel: GameModel | undefined
 | 
			
		||||
  @Output("onOpenCharacterEditor") openCharacterEmitter: EventEmitter<Character> = new EventEmitter<Character>();
 | 
			
		||||
 | 
			
		||||
@ -8,6 +8,7 @@ import {State} from "../../project/game-model/gamesystems/states/State";
 | 
			
		||||
import {Transition} from "../../project/game-model/gamesystems/transitions/Transition";
 | 
			
		||||
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
 | 
			
		||||
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
 | 
			
		||||
import {Overview} from "../Overview";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
interface FlatNode {
 | 
			
		||||
@ -20,7 +21,7 @@ interface FlatNode {
 | 
			
		||||
  templateUrl: './gamescript-overview.component.html',
 | 
			
		||||
  styleUrl: './gamescript-overview.component.scss'
 | 
			
		||||
})
 | 
			
		||||
export class GamescriptOverviewComponent implements OnInit {
 | 
			
		||||
export class GamescriptOverviewComponent implements OnInit, Overview {
 | 
			
		||||
 | 
			
		||||
  @Input('gameModel') gameModel: GameModel | undefined
 | 
			
		||||
  @Output('openGamesystemEditor') openGamesystemEmitter : EventEmitter<Gamesystem<State<any>, Transition<any>>> = new EventEmitter<Gamesystem<State<any>, Transition<any>>>();
 | 
			
		||||
 | 
			
		||||
@ -8,6 +8,7 @@ import {ModelComponent} from "../../project/game-model/ModelComponent";
 | 
			
		||||
import {ModelComponentType} from "../../project/game-model/ModelComponentType";
 | 
			
		||||
import {ItemGroup} from "../../project/game-model/inventory/ItemGroup";
 | 
			
		||||
import {Item} from "../../project/game-model/inventory/Item";
 | 
			
		||||
import {Overview} from "../Overview";
 | 
			
		||||
 | 
			
		||||
interface FlatNode {
 | 
			
		||||
  expandable: boolean,
 | 
			
		||||
@ -21,7 +22,7 @@ interface FlatNode {
 | 
			
		||||
  templateUrl: './item-overview.component.html',
 | 
			
		||||
  styleUrl: './item-overview.component.scss'
 | 
			
		||||
})
 | 
			
		||||
export class ItemOverviewComponent implements OnInit{
 | 
			
		||||
export class ItemOverviewComponent implements OnInit, Overview{
 | 
			
		||||
 | 
			
		||||
  @Input() gameModel: GameModel | undefined
 | 
			
		||||
  @Output() openItemgroupEmitter: EventEmitter<ItemGroup> = new EventEmitter();
 | 
			
		||||
@ -120,4 +121,33 @@ export class ItemOverviewComponent implements OnInit{
 | 
			
		||||
    }
 | 
			
		||||
    return undefined;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  get selectedModelComponent() {
 | 
			
		||||
    if(this.selectedItem) {
 | 
			
		||||
      if(this.selectedItem.type === ModelComponentType.ITEMGROUP) {
 | 
			
		||||
        let groupQueue: ItemGroup[] = this.gameModel!.itemgroups.concat();
 | 
			
		||||
        while(groupQueue.length > 0) {
 | 
			
		||||
          const currentGroup = groupQueue.shift()!;
 | 
			
		||||
 | 
			
		||||
          if(currentGroup.componentName === this.selectedItem.name) {
 | 
			
		||||
            return currentGroup;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          if(currentGroup instanceof AbstractItemGroup) {
 | 
			
		||||
            groupQueue = groupQueue.concat(currentGroup.children);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        return this.searchItemByName(this.selectedItem!.name)
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      return undefined
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  refresh(): void {
 | 
			
		||||
    this.dataSource.data = this.gameModel!.itemgroups;
 | 
			
		||||
    console.log("Opened Refreshed")
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -2,13 +2,14 @@ import {Component, EventEmitter, Input, NgZone, Output} from '@angular/core';
 | 
			
		||||
import {ElectronService} from "../../core/services";
 | 
			
		||||
import {GameModel} from "../../project/game-model/GameModel";
 | 
			
		||||
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
 | 
			
		||||
import {Overview} from "../Overview";
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'app-script-account-overview',
 | 
			
		||||
  templateUrl: './script-account-overview.component.html',
 | 
			
		||||
  styleUrl: './script-account-overview.component.css'
 | 
			
		||||
})
 | 
			
		||||
export class ScriptAccountOverviewComponent {
 | 
			
		||||
export class ScriptAccountOverviewComponent implements Overview{
 | 
			
		||||
  @Input("gameModel") gameModel: GameModel | undefined
 | 
			
		||||
  @Output("onOpenScriptAccount") openScriptAccountEmitter: EventEmitter<ScriptAccount> = new EventEmitter<ScriptAccount>();
 | 
			
		||||
 | 
			
		||||
@ -17,6 +18,10 @@ export class ScriptAccountOverviewComponent {
 | 
			
		||||
  constructor() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  refresh(): void {
 | 
			
		||||
    //Nothing to do
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  onOpenScriptAccount(scriptAccount: ScriptAccount) {
 | 
			
		||||
    console.log("onOpenScriptAccount (overview)")
 | 
			
		||||
    this.openScriptAccountEmitter.emit(scriptAccount);
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										7
									
								
								testModel/gamesystems/Parentgamesystem.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								testModel/gamesystems/Parentgamesystem.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
    "componentName": "Parentgamesystem",
 | 
			
		||||
    "componentDescription": "",
 | 
			
		||||
    "states": [],
 | 
			
		||||
    "transitions": [],
 | 
			
		||||
    "generateIsolatedStates": false
 | 
			
		||||
}
 | 
			
		||||
@ -7,5 +7,5 @@
 | 
			
		||||
            "characteristicDescription": ""
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "itemgroupType": 1
 | 
			
		||||
    "itemgroupType": 0
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user