Got property editing of run path working & displaying, next up is implementing the action

This commit is contained in:
Malcolm Roberts 2024-01-15 15:32:33 -06:00
parent c6e1330e17
commit e065094616
5 changed files with 34 additions and 54 deletions

View File

@ -36,12 +36,10 @@ objectdef NPCDialogPropertiesController
variable string npcName = "N/A"
variable jsonvalue theUi
theUi:SetValue["${this.listViewUi}"]
theUi:SetValue["${This.listViewUi.AsJSON~}"]
npcName:Set["${step.Get["params","npc_name"]}"]
options:Set["${step.Get["params","dialog_options"]}"]
theUi:ParseFile["${This.PropertyPath}/list_ui.json"]
theUi.Get["children", 2, "children", 2]:SetString["text", "${npcName}"]
theUi.Get["children", 3, "children", 2]:SetString["text", "${options}"]

View File

@ -12,6 +12,7 @@ objectdef PropertyEditors
{
static member GetPropertyEditor( string stepType )
{
echo "PropertyEditors::GetPropertyEditor[${stepType}]"
if ${stepType.Equal["${MRNPCDialogPropertiesController.StepType}"]}
{
return MRNPCDialogPropertiesController;

View File

@ -31,13 +31,12 @@ objectdef RunPathPropertiesController
{
variable jsonvalue dialogOptions
; dialogOptions:SetValue[$$>"{
; "type": "${This.StepType}",
; "params": {
; "npc_name": ${This.CurrentNPCName.AsJSON~},
; "dialog_options": ${This.CurrentDialogOptions.AsJSON~}
; }
; }"<$$]
dialogOptions:SetValue[$$>"{
"type": "${This.StepType}",
"params": {
"path": ${This.PathToRun.AsJSON~}
}
}"<$$]
return dialogOptions
}
@ -45,13 +44,22 @@ objectdef RunPathPropertiesController
member:jsonvalueref GetDisplayForProperties(jsonvalueref step)
{
variable jsonvalue theUi
variable jsoniterator pathIterator
variable string currentPoint
theUi:SetValue["${this.ListViewUi}"]
theUi:SetValue["${This.ListViewUi.AsJSON~}"]
step.Get["params", "path"]:GetIterator[pathIterator]
if ${pathIterator:First(exists)}
{
do
{
currentPoint:Set["x: ${pathIterator.Value.Get["x"]} y: ${pathIterator.Value.Get["y"]} z: ${pathIterator.Value.Get["z"]}"]
theUi.Get["children", 2, "items"]:Add["${currentPoint.AsJSON~}"]
}
while ${pathIterator:Next(exists)}
}
theUi:ParseFile["${This.PropertyPath}/list_ui.json"]
; theUi.Get["children", 2, "children", 2]:SetString["text", "${npcName}"]
; theUi.Get["children", 3, "children", 2]:SetString["text", "${options}"]
return theUi
}

View File

@ -11,41 +11,14 @@
"bold": true,
"heightFactor": 1.1
},
"text": "NPC Dialog"
"text": "Run Path"
},
{
"type": "stackpanel",
"orientation": "horizontal",
"type": "listbox",
"horizontalAlignment": "stretch",
"borderThickness": 0,
"padding": [5, 0, 0, 0],
"children": [
{
"type": "textblock",
"text": "NPC Name:",
"margin": [0, 0, 5, 0]
},
{
"type": "textblock",
"text": ""
}
]
},
{
"type": "stackpanel",
"orientation": "horizontal",
"horizontalAlignment": "stretch",
"padding": [5, 0, 0, 0],
"children": [
{
"type": "textblock",
"text": "Options:",
"margin": [0, 0, 5, 0]
},
{
"type": "textblock",
"text": ""
}
]
"items": []
}
]
}

View File

@ -12,16 +12,16 @@ objectdef QuestWriterController
member:jsonvalueref FormatPropertiesForDisplay(jsonvalue step)
{
echo "Formatting properties for ${step.Get["type"]}"
variable jsonvalue stepItem
if ${step.Get["type"].Equal["${MRNPCDialogPropertiesController.StepType}"]}
{
stepItem:SetValue["${MRNPCDialogPropertiesController.GetDisplayForProperties[step].AsJSON~}"]
return stepItem
}
else
{
return null
}
variable weakref stepProperties
stepProperties:SetReference[${PropertyEditors.GetPropertyEditor[${step.Get["type"]}]}]
stepItem:SetValue["${stepProperties.GetDisplayForProperties[step]}"]
return stepItem
}
member:string GetQuestStepsForDisplay()