Got the UI working shitty-ly

This commit is contained in:
Malcolm Roberts 2024-02-07 21:51:04 -06:00
parent 59c496305a
commit 62cfbd3dbe
4 changed files with 105 additions and 77 deletions

View File

@ -1,3 +1,6 @@
#ifndef _MR_KILL_MOBS_PROPERTIES_CONTROLLER_
#define _MR_KILL_MOBS_PROPERTIES_CONTROLLER_
#include "${LavishScript.HomeDirectory}/scripts/mr/common/file_helpers.iss" #include "${LavishScript.HomeDirectory}/scripts/mr/common/file_helpers.iss"
objectdef KillMobsPropertiesController objectdef KillMobsPropertiesController
@ -12,6 +15,7 @@ objectdef KillMobsPropertiesController
variable int KillQuantity variable int KillQuantity
variable string CurrentTarget variable string CurrentTarget
variable jsonvalue QuestStepList = "[]"
member:jsonvalueref GetUI() member:jsonvalueref GetUI()
@ -68,34 +72,65 @@ objectdef KillMobsPropertiesController
member:jsonvalueref QuestList() member:jsonvalueref QuestList()
{ {
variable jsonvalue questList variable jsonvalue questList = "[]"
variable index:quest questIndex
variable iterator questIterator
questList:SetValue[$$>"[ QuestJournalWindow:GetActiveQuests[questIndex]
questIndex:GetIterator[questIterator]
if ${questIterator:First(exists)}
{ {
"id": 1, do
"name": "Kill Mobs Test 1",
"level": 65,
"category": "Pillar of Flames",
"currentZone": "Pillar of Flames"
},
{ {
"id": 2, questList:Add["${questIterator.Value.Name.AsJSON~}"]
"name": "Kill Mobs Test 2", }
"level": 65, while ${questIterator:Next(exists)}
"category": "Pillar of Flames",
"currentZone": "Pillar of Flames"
},
{
"id": 3,
"name": "Kill Mobs Test 3",
"level": 65,
"category": "Pillar of Flames",
"currentZone": "Pillar of Flames"
} }
]<$$"]
return questList return questList
} }
method OnQuestSelectionChanged()
{
variable index:collection:string questDetails
variable iterator questDetailsIterator
QuestJournalWindow.ActiveQuest["${Context.Source.SelectedItem.Data}"]:MakeCurrentActiveQuest
QuestJournalWindow.CurrentQuest:GetDetails[questDetails]
questDetails:GetIterator[questDetailsIterator]
variable int counter = 0
This.QuestStepList:Clear
if ${questDetailsIterator:First(exists)}
{
do
{
echo "value: ${questDetailsIterator.Value.Element["Text"].AsJSON~}"
This.QuestStepList:Add["${questDetailsIterator.Value.Element["Text"].AsJSON~}"]
if ${questDetailsIterator.Value.FirstKey(exists)}
{
do
{
echo "-- ${counter}: ${questDetailsIterator.Value.CurrentKey} => ${questDetailsIterator.Value.CurrentValue}"
}
while ${questDetailsIterator.Value.NextKey(exists)}
echo "-----------------"
}
counter:Inc
}
while ${questDetailsIterator:Next(exists)}
}
echo "QuestStepList: ${this.QuestStepList.AsJSON~}"
}
method OnRefreshQuestList()
{
echo "OnRefreshQuestList"
}
method GetQuestItemView() method GetQuestItemView()
{ {
echo "GetQuestItemView: ${Context(type)} ${Context.Args}" echo "GetQuestItemView: ${Context(type)} ${Context.Args}"
@ -136,3 +171,4 @@ objectdef KillMobsPropertiesController
}"<$$] }"<$$]
} }
} }
#endif

View File

@ -84,7 +84,7 @@
"type": "button", "type": "button",
"content": "◎", "content": "◎",
"tooltip": "Set the name to the currently targeted mob.", "tooltip": "Set the name to the currently targeted mob.",
"horizontalAlignment": "left", "margin": [0, 0, 5, 0],
"eventHandlers": { "eventHandlers": {
"onRelease": [ "onRelease": [
"method", "method",
@ -95,39 +95,10 @@
}, },
{ {
"type": "textblock", "type": "textblock",
"horizontalAlignment": "left",
"widthFactor": 1, "widthFactor": 1,
"text": "${MRKillMobsPropertiesController.CurrentTarget}" "text": "${MRKillMobsPropertiesController.CurrentTarget}"
} }
] ]
},
{
"type": "stackpanel",
"orientation": "horizontal",
"children": [
{
"type": "textblock",
"text": "Quantity:",
"widthFactor": 0.4,
"horizontalAlignment": "left",
"font": {
"heightFactor": 0.9
}
},
{
"type": "textblock",
"widthFactor": 0.6,
"horizontalAlignment": "left",
"textBinding": {
"pullFormat": "${MRKillMobsPropertiesController.KillQuantity}",
"pullReplaceNull": "0",
"pushFormat": [
"MRKillMobsPropertiesController.KillQuantity:Set[",
"]"
]
}
}
]
} }
] ]
}, },
@ -181,6 +152,7 @@
{ {
"type": "stackpanel", "type": "stackpanel",
"jsonTemplate": "property_group", "jsonTemplate": "property_group",
"horizontalContentAlignment": "left",
"children": [ "children": [
{ {
"type": "textblock", "type": "textblock",
@ -190,41 +162,38 @@
{ {
"type": "stackpanel", "type": "stackpanel",
"orientation": "horizontal", "orientation": "horizontal",
"margin": [0, 0, 0, 15],
"children": [ "children": [
{ {
"type": "combobox", "type": "combobox",
"widthFactor": 0.8,
"itemViewGenerators": { "eventHandlers": {
"default": { "onSelectionChanged": [
"type": "template", "method",
"template": "mr.quest_writer.run_path_properties.quest_item" "MRKillMobsPropertiesController",
} "OnQuestSelectionChanged"
},
"items": [
{
"name": "abc"
},
{
"name": "123"
},
{
"name": "def"
},
{
"name": "456"
}
] ]
}, },
"itemsBinding": {
"pullFormat": "${MRKillMobsPropertiesController.QuestList}",
"pullReplaceNull": "",
"pullOnce": true
},
"popup": {
"jsonTemplate": "combobox.popup",
"maxSize": [250, 300]
}
},
{ {
"type": "button", "type": "button",
"content": "⟳", "content": "⟳",
"tooltip": "Refresh the quest steps.", "tooltip": "Refresh the quest steps.",
"horizontalAlignment": "left", "margin": [5, 0, 0, 0],
"eventHandlers": { "eventHandlers": {
"onRelease": [ "onRelease": [
"method", "method",
"MRKillMobsPropertiesController", "MRKillMobsPropertiesController",
"OnSetStepButtonClick" "OnRefreshQuestList"
] ]
} }
} }
@ -232,7 +201,7 @@
}, },
{ {
"type": "combobox", "type": "combobox",
"widthFactor": 0.8,
"itemsBinding": { "itemsBinding": {
"pullFormat": "${MRKillMobsPropertiesController.QuestStepList}", "pullFormat": "${MRKillMobsPropertiesController.QuestStepList}",
"pullReplaceNull": "", "pullReplaceNull": "",
@ -240,6 +209,10 @@
"MRKillMobsPropertiesController.SelectedStep:Set[", "MRKillMobsPropertiesController.SelectedStep:Set[",
"]" "]"
] ]
},
"popup": {
"jsonTemplate": "combobox.popup",
"maxSize": [250, 300]
} }
} }
] ]

View File

@ -14,7 +14,6 @@ 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

@ -1,5 +1,25 @@
{ {
"$schema": "http://www.lavishsoft.com/schema/lgui2Package.json", "$schema": "http://www.lavishsoft.com/schema/lgui2Package.json",
"templates": {
"property_header": {
"type": "panel",
"borderBrush": {
"color": "#f4f3ee"
},
"borderThickness": [0, 0, 0, 1],
"margin": [0, 0, 0, 15]
},
"property_group": {
"type": "stackpanel",
"orientation": "vertical",
"borderBrush": {
"color": "#f4f3ee"
},
"borderThickness": [1, 1, 1, 1],
"padding": [5, 5, 5, 5],
"margin": [5, 5, 5, 5]
}
},
"elements": [ "elements": [
{ {
"type": "window", "type": "window",