Consider TemplateType of Gamesystems to load and store
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				E2E Testing / test (push) Failing after 1m52s
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	E2E Testing / test (push) Failing after 1m52s
				
			This commit is contained in:
		
							parent
							
								
									9a51cb3a80
								
							
						
					
					
						commit
						61e3e90395
					
				@ -2,12 +2,17 @@ import {SimpleGamesystem} from "./SimpleGamesystem";
 | 
			
		||||
import {ProductGamesystem} from "./ProductGamesystem";
 | 
			
		||||
import {ModelComponent} from "../ModelComponent";
 | 
			
		||||
import {ModelComponentType} from "../ModelComponentType";
 | 
			
		||||
import {TemplateType} from "../TemplateType";
 | 
			
		||||
 | 
			
		||||
export abstract class Gamesystem<S, T> extends ModelComponent{
 | 
			
		||||
 | 
			
		||||
  states: S[] = [];
 | 
			
		||||
  transitions: T[] = [];
 | 
			
		||||
  parentGamesystem: ProductGamesystem | undefined
 | 
			
		||||
 | 
			
		||||
  templateType: TemplateType = TemplateType.NORMAL
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  constructor(gamesystemName: string, gamesystemDescription: string) {
 | 
			
		||||
   super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -1,14 +1,10 @@
 | 
			
		||||
import {SimpleGamesystem} from "./SimpleGamesystem";
 | 
			
		||||
import {SimpleTemplateState} from "./states/SimpleTemplateState";
 | 
			
		||||
import {Gamesystem} from "./Gamesystem";
 | 
			
		||||
import {SimpleTransition} from "./transitions/SimpleTransition";
 | 
			
		||||
import {SimpleState} from "./states/SimpleState";
 | 
			
		||||
import {SimpleTemplateTransition} from "./transitions/SimpleTemplateTransition";
 | 
			
		||||
import {TemplateType} from "../TemplateType";
 | 
			
		||||
import {state} from "@angular/animations";
 | 
			
		||||
 | 
			
		||||
export class SimpleTemplateGamesystem<ReferenceType> extends Gamesystem<SimpleTemplateState<ReferenceType>, SimpleTemplateTransition<ReferenceType>> {
 | 
			
		||||
 | 
			
		||||
  createState(label: string, description: string): SimpleState | undefined {
 | 
			
		||||
    if(label == null) {
 | 
			
		||||
      return undefined;
 | 
			
		||||
 | 
			
		||||
@ -6,6 +6,9 @@ import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
 | 
			
		||||
import {StateParser} from "./StateParser";
 | 
			
		||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
 | 
			
		||||
import {TransitionParser} from "./TransitionParser";
 | 
			
		||||
import {TemplateType} from "../../game-model/TemplateType";
 | 
			
		||||
import {SimpleTemplateGamesystem} from "../../game-model/gamesystems/SimpleTemplateGamesystem";
 | 
			
		||||
import {Character} from "../../game-model/characters/Character";
 | 
			
		||||
 | 
			
		||||
export class GamesystemParser {
 | 
			
		||||
 | 
			
		||||
@ -40,13 +43,19 @@ export class GamesystemParser {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  parseSimpleGamesystem(gamesystemData: any): SimpleGamesystem {
 | 
			
		||||
    const simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription)
 | 
			
		||||
    const templateType = gamesystemData.templateType
 | 
			
		||||
    let simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription)
 | 
			
		||||
    if(templateType == TemplateType.CHARACTER) {
 | 
			
		||||
      simpleGamesystem = new SimpleTemplateGamesystem<Character>(gamesystemData.componentName, gamesystemData.componentDescription)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const stateParser = new StateParser(this.scriptAccounts);
 | 
			
		||||
    simpleGamesystem.states = stateParser.parseStates(gamesystemData.states)
 | 
			
		||||
 | 
			
		||||
    const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts)
 | 
			
		||||
    simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return simpleGamesystem
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,10 +4,11 @@ import {SimpleGamesystem} from "../game-model/gamesystems/SimpleGamesystem";
 | 
			
		||||
import {ProductGamesystem} from "../game-model/gamesystems/ProductGamesystem";
 | 
			
		||||
import {SerializeConstants} from "./SerializeConstants";
 | 
			
		||||
import {ModelComponentType} from "../game-model/ModelComponentType";
 | 
			
		||||
import {SimpleTemplateGamesystem} from "../game-model/gamesystems/SimpleTemplateGamesystem";
 | 
			
		||||
 | 
			
		||||
export class GamesystemSerializer {
 | 
			
		||||
 | 
			
		||||
  private static IGNORED_SIMPLE_ATTRIBUTES  = ["parentGamesystem", 'incomingTransitions', "outgoingTransitions", "unsaved", "type"]
 | 
			
		||||
  private static IGNORED_SIMPLE_ATTRIBUTES  = ["parentGamesystem", 'incomingTransitions', "outgoingTransitions", "unsaved", "type", "conditionMap"]
 | 
			
		||||
 | 
			
		||||
  public static serializeGamesystems(gamesystems: Gamesystem<any, any>[]): StoreComponent[] {
 | 
			
		||||
    let storedGamesystems: StoreComponent[] = []
 | 
			
		||||
@ -16,7 +17,7 @@ export class GamesystemSerializer {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private static serializeSingleGamesystem(gamesystem: Gamesystem<any, any>): StoreComponent[] {
 | 
			
		||||
    if(gamesystem instanceof SimpleGamesystem) {
 | 
			
		||||
    if(gamesystem instanceof SimpleGamesystem || gamesystem instanceof SimpleTemplateGamesystem) {
 | 
			
		||||
      console.log("Simple Gamesystem")
 | 
			
		||||
      return [this.serializeSimpleGamesystem(gamesystem as SimpleGamesystem)]
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
    "componentName": "Astrid Hofferson",
 | 
			
		||||
    "componentDescription": ""
 | 
			
		||||
    "componentDescription": "",
 | 
			
		||||
    "characterSpecificGamesystems": []
 | 
			
		||||
}
 | 
			
		||||
@ -1,4 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
    "componentName": "Hicks Haddock",
 | 
			
		||||
    "componentDescription": ""
 | 
			
		||||
    "componentDescription": "",
 | 
			
		||||
    "characterSpecificGamesystems": []
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								testModel/gamesystems/Characterstimmung.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								testModel/gamesystems/Characterstimmung.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
{
 | 
			
		||||
    "componentName": "Characterstimmung",
 | 
			
		||||
    "componentDescription": "",
 | 
			
		||||
    "states": [
 | 
			
		||||
        {
 | 
			
		||||
            "initial": true,
 | 
			
		||||
            "conditions": [],
 | 
			
		||||
            "stateLabel": "Fröhlich",
 | 
			
		||||
            "stateDescription": ""
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "initial": false,
 | 
			
		||||
            "conditions": [],
 | 
			
		||||
            "stateLabel": "Wütend",
 | 
			
		||||
            "stateDescription": ""
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "transitions": [],
 | 
			
		||||
    "templateType": 1
 | 
			
		||||
}
 | 
			
		||||
@ -33,5 +33,6 @@
 | 
			
		||||
            "startingState": "A",
 | 
			
		||||
            "endingState": "B"
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
    ],
 | 
			
		||||
    "templateType": 0
 | 
			
		||||
}
 | 
			
		||||
@ -76,5 +76,6 @@
 | 
			
		||||
            "startingState": "Winter",
 | 
			
		||||
            "endingState": "Frühling"
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
    ],
 | 
			
		||||
    "templateType": 0
 | 
			
		||||
}
 | 
			
		||||
@ -76,5 +76,6 @@
 | 
			
		||||
            "startingState": "Schnee",
 | 
			
		||||
            "endingState": "Wolke"
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
    ],
 | 
			
		||||
    "templateType": 0
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user