main #48
@ -35,6 +35,7 @@ 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',
 | 
			
		||||
@ -108,6 +109,9 @@ export class AppComponent implements OnInit{
 | 
			
		||||
          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) {
 | 
			
		||||
@ -146,6 +150,7 @@ export class AppComponent implements OnInit{
 | 
			
		||||
        }
 | 
			
		||||
      }break
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -27,5 +27,4 @@ export abstract class Gamesystem<S, T> extends ModelComponent{
 | 
			
		||||
    this.transitions = updatedTransitions;
 | 
			
		||||
    return true;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,46 @@
 | 
			
		||||
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";
 | 
			
		||||
 | 
			
		||||
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**/ {
 | 
			
		||||
      let productParentsystem: ProductGamesystem;
 | 
			
		||||
      if(this.selectedComponent instanceof SimpleTemplateGamesystem) {
 | 
			
		||||
        productParentsystem = ProductTemplateCreator.constructTemplateFromSimpleGamesystem(this.selectedComponent, this.gameModel!, this.selectedComponent.templateType);
 | 
			
		||||
      } else if(this.selectedComponent instanceof SimpleGamesystem) {
 | 
			
		||||
        productParentsystem = ProductGamesystem.constructFromSimpleGamesystem(this.selectedComponent, this.gameModel);
 | 
			
		||||
      } else {
 | 
			
		||||
        productParentsystem = this.selectedComponent as ProductGamesystem;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      productParentsystem.addChildGamesystem(simpleGamesystem);
 | 
			
		||||
    } else {
 | 
			
		||||
      this.gameModel!.gamesystems.push(simpleGamesystem);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return simpleGamesystem;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user