Assign template Transition to template gamesystem
All checks were successful
E2E Testing / test (push) Successful in 1m50s
All checks were successful
E2E Testing / test (push) Successful in 1m50s
This commit is contained in:
parent
f7eadfa04d
commit
a3639969e3
@ -8,6 +8,10 @@ import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/Scrip
|
|||||||
import {SimpleTransition} from "../../../../project/game-model/gamesystems/transitions/SimpleTransition";
|
import {SimpleTransition} from "../../../../project/game-model/gamesystems/transitions/SimpleTransition";
|
||||||
import {SimpleState} from "../../../../project/game-model/gamesystems/states/SimpleState";
|
import {SimpleState} from "../../../../project/game-model/gamesystems/states/SimpleState";
|
||||||
import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
|
import {SimpleTemplateGamesystem} from "../../../../project/game-model/gamesystems/SimpleTemplateGamesystem";
|
||||||
|
import {
|
||||||
|
SimpleTemplateTransition
|
||||||
|
} from "../../../../project/game-model/gamesystems/transitions/SimpleTemplateTransition";
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-simple-transition-editor',
|
selector: 'app-simple-transition-editor',
|
||||||
templateUrl: './simple-transition-editor.component.html',
|
templateUrl: './simple-transition-editor.component.html',
|
||||||
@ -53,7 +57,11 @@ export class SimpleTransitionEditorComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addTransition() {
|
addTransition() {
|
||||||
this.editedTransition = new SimpleTransition(this.defaultStartingState, this.defaultEndingState);
|
if(this.gamesystem instanceof SimpleTemplateGamesystem) {
|
||||||
|
this.editedTransition = new SimpleTemplateTransition(this.defaultStartingState, this.defaultEndingState);
|
||||||
|
} else {
|
||||||
|
this.editedTransition = new SimpleTransition(this.defaultStartingState, this.defaultEndingState);
|
||||||
|
}
|
||||||
const updatedData = this.dataSource.data;
|
const updatedData = this.dataSource.data;
|
||||||
updatedData.push(this.editedTransition);
|
updatedData.push(this.editedTransition);
|
||||||
this.dataSource.data = updatedData;
|
this.dataSource.data = updatedData;
|
||||||
@ -79,6 +87,7 @@ export class SimpleTransitionEditorComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.gamesystem?.createTransition(this.editedTransition!.startingState, this.editedTransition!.endingState);
|
this.gamesystem?.createTransition(this.editedTransition!.startingState, this.editedTransition!.endingState);
|
||||||
|
console.log("Edited Gamesystem: ", this.gamesystem!)
|
||||||
this.dataSource.data = this.gamesystem!.transitions;
|
this.dataSource.data = this.gamesystem!.transitions;
|
||||||
this.editedTransition = undefined;
|
this.editedTransition = undefined;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ export class SimpleTemplateGamesystem<ReferenceType> extends Gamesystem<SimpleTe
|
|||||||
if((startingState == null || endingState == null) || startingState === endingState) {
|
if((startingState == null || endingState == null) || startingState === endingState) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const transition = new SimpleTemplateTransition<ReferenceType>(startingState, endingState);
|
const transition = new SimpleTemplateTransition<ReferenceType>(startingState, endingState);
|
||||||
if(this.transitions.find(t => t.startingState === startingState && t.endingState === endingState) == undefined) {
|
if(this.transitions.find(t => t.startingState === startingState && t.endingState === endingState) == undefined) {
|
||||||
this.transitions.push(transition)
|
this.transitions.push(transition)
|
||||||
|
@ -17,6 +17,7 @@ export class CharacterSerializer {
|
|||||||
|
|
||||||
private static serializeSingleCharacter(character: Character): StoreComponent{
|
private static serializeSingleCharacter(character: Character): StoreComponent{
|
||||||
const fileName = character.componentName
|
const fileName = character.componentName
|
||||||
|
console.log("Templatesystem: ", character.characterSpecificGamesystems)
|
||||||
const jsonString = JSON.stringify(character, (key, value) => {
|
const jsonString = JSON.stringify(character, (key, value) => {
|
||||||
if(value instanceof Gamesystem) {
|
if(value instanceof Gamesystem) {
|
||||||
return {
|
return {
|
||||||
|
@ -20,7 +20,27 @@
|
|||||||
"conditionMap": []
|
"conditionMap": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transitions": []
|
"transitions": [
|
||||||
|
{
|
||||||
|
"scriptAccountActions": [],
|
||||||
|
"scriptAccountConditions": [],
|
||||||
|
"startingState": {
|
||||||
|
"stateLabel": "Fröhlich",
|
||||||
|
"conditionMap": [
|
||||||
|
{
|
||||||
|
"scriptAccount": "Luftfeuchtigkeit",
|
||||||
|
"minValue": 0,
|
||||||
|
"maxValue": "10"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"endingState": {
|
||||||
|
"stateLabel": "Wütend",
|
||||||
|
"conditionMap": []
|
||||||
|
},
|
||||||
|
"actions": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -15,6 +15,15 @@
|
|||||||
"stateDescription": ""
|
"stateDescription": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transitions": [],
|
"transitions": [
|
||||||
|
{
|
||||||
|
"scriptAccountActions": [],
|
||||||
|
"scriptAccountConditions": [],
|
||||||
|
"startingState": "Fröhlich",
|
||||||
|
"endingState": "Wütend",
|
||||||
|
"conditions": {},
|
||||||
|
"actions": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
"templateType": 1
|
"templateType": 1
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user