mrbot/auto_quest/property_editors/npc_dialog_properties.iss

100 lines
2.9 KiB
Plaintext

objectdef NPCDialogPropertiesController
{
variable string CurrentDialogOptions
variable string CurrentNPCName
variable jsonvalue ui ="{}"
variable string StepType = "npc_dialog"
member:jsonvalueref GetUI()
{
return ui
}
member:jsonvalueref GetDialogOptions()
{
variable jsonvalue dialogOptions
dialogOptions:SetValue[$$>"{
"type": "${This.StepType}",
"params": {
"npc_name": ${This.CurrentNPCName.AsJSON~},
"dialog_options": ${This.CurrentDialogOptions.AsJSON~}
}
}"<$$]
return dialogOptions
}
member:jsonvalueref GetDisplayForProperties(jsonvalueref step)
{
variable jsonvalue stepItem
variable string options
variable string npcName
options:Set["${step.Get["params","dialog_options"]}"]
npcName:Set["${step.Get["params","npc_name"]}"]
stepItem:SetValue[$$>"{
"type": "stackpanel",
"orientation": "vertical",
"horizontalAlignment": "left",
"children": [
{
"type": "textblock",
"horizontalAlignment": "stretch",
"font": {
"bold": true,
"heightFactor": 1.1
},
"text": "NPC Dialog"
},
{
"type": "stackpanel",
"orientation": "horizontal",
"horizontalAlignment": "stretch",
"padding": [5, 0, 0, 0],
"children": [
{
"type": "textblock",
"text": "NPC Name:",
"margin": [0, 0, 5, 0]
},
{
"type": "textblock",
"text": ${npcName.AsJSON~}
}
]
},
{
"type": "stackpanel",
"orientation": "horizontal",
"horizontalAlignment": "stretch",
"padding": [5, 0, 0, 0],
"children": [
{
"type": "textblock",
"text": "Options:",
"margin": [0, 0, 5, 0]
},
{
"type": "textblock",
"text": ${options.AsJSON~}
}
]
}
]
}"<$$]
return stepItem
}
method Initialize()
{
ui:ParseFile["${Script.CurrentDirectory}/property_editors/npc_dialog_properties.json"]
}
method OnSetNPCNameButtonClick()
{
This.CurrentNPCName:Set["${Me.Target.Name}"]
}
}