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 string npcName = "N/A"
variable jsonvalue theUi variable jsonvalue theUi
theUi:SetValue["${this.listViewUi}"] theUi:SetValue["${This.listViewUi.AsJSON~}"]
npcName:Set["${step.Get["params","npc_name"]}"] npcName:Set["${step.Get["params","npc_name"]}"]
options:Set["${step.Get["params","dialog_options"]}"] 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", 2, "children", 2]:SetString["text", "${npcName}"]
theUi.Get["children", 3, "children", 2]:SetString["text", "${options}"] theUi.Get["children", 3, "children", 2]:SetString["text", "${options}"]

View File

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

View File

@ -31,13 +31,12 @@ objectdef RunPathPropertiesController
{ {
variable jsonvalue dialogOptions variable jsonvalue dialogOptions
; dialogOptions:SetValue[$$>"{ dialogOptions:SetValue[$$>"{
; "type": "${This.StepType}", "type": "${This.StepType}",
; "params": { "params": {
; "npc_name": ${This.CurrentNPCName.AsJSON~}, "path": ${This.PathToRun.AsJSON~}
; "dialog_options": ${This.CurrentDialogOptions.AsJSON~} }
; } }"<$$]
; }"<$$]
return dialogOptions return dialogOptions
} }
@ -45,13 +44,22 @@ objectdef RunPathPropertiesController
member:jsonvalueref GetDisplayForProperties(jsonvalueref step) member:jsonvalueref GetDisplayForProperties(jsonvalueref step)
{ {
variable jsonvalue theUi 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 return theUi
} }

View File

@ -11,41 +11,14 @@
"bold": true, "bold": true,
"heightFactor": 1.1 "heightFactor": 1.1
}, },
"text": "NPC Dialog" "text": "Run Path"
}, },
{ {
"type": "stackpanel", "type": "listbox",
"orientation": "horizontal",
"horizontalAlignment": "stretch", "horizontalAlignment": "stretch",
"borderThickness": 0,
"padding": [5, 0, 0, 0], "padding": [5, 0, 0, 0],
"children": [ "items": []
{
"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": ""
}
]
} }
] ]
} }

View File

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