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"
objectdef KillMobsPropertiesController
@ -12,6 +15,7 @@ objectdef KillMobsPropertiesController
variable int KillQuantity
variable string CurrentTarget
variable jsonvalue QuestStepList = "[]"
member:jsonvalueref GetUI()
@ -68,34 +72,65 @@ objectdef KillMobsPropertiesController
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)}
{
do
{
"id": 1,
"name": "Kill Mobs Test 1",
"level": 65,
"category": "Pillar of Flames",
"currentZone": "Pillar of Flames"
},
{
"id": 2,
"name": "Kill Mobs Test 2",
"level": 65,
"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"
questList:Add["${questIterator.Value.Name.AsJSON~}"]
}
]<$$"]
while ${questIterator:Next(exists)}
}
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()
{
echo "GetQuestItemView: ${Context(type)} ${Context.Args}"
@ -135,4 +170,5 @@ objectdef KillMobsPropertiesController
z: ${Me.Loc.Z}
}"<$$]
}
}
}
#endif

View File

@ -84,7 +84,7 @@
"type": "button",
"content": "◎",
"tooltip": "Set the name to the currently targeted mob.",
"horizontalAlignment": "left",
"margin": [0, 0, 5, 0],
"eventHandlers": {
"onRelease": [
"method",
@ -95,39 +95,10 @@
},
{
"type": "textblock",
"horizontalAlignment": "left",
"widthFactor": 1,
"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",
"jsonTemplate": "property_group",
"horizontalContentAlignment": "left",
"children": [
{
"type": "textblock",
@ -190,41 +162,38 @@
{
"type": "stackpanel",
"orientation": "horizontal",
"margin": [0, 0, 0, 15],
"children": [
{
"type": "combobox",
"itemViewGenerators": {
"default": {
"type": "template",
"template": "mr.quest_writer.run_path_properties.quest_item"
}
"widthFactor": 0.8,
"eventHandlers": {
"onSelectionChanged": [
"method",
"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",
"content": "⟳",
"tooltip": "Refresh the quest steps.",
"horizontalAlignment": "left",
"margin": [5, 0, 0, 0],
"eventHandlers": {
"onRelease": [
"method",
"MRKillMobsPropertiesController",
"OnSetStepButtonClick"
"OnRefreshQuestList"
]
}
}
@ -232,7 +201,7 @@
},
{
"type": "combobox",
"widthFactor": 0.8,
"itemsBinding": {
"pullFormat": "${MRKillMobsPropertiesController.QuestStepList}",
"pullReplaceNull": "",
@ -240,6 +209,10 @@
"MRKillMobsPropertiesController.SelectedStep:Set[",
"]"
]
},
"popup": {
"jsonTemplate": "combobox.popup",
"maxSize": [250, 300]
}
}
]

View File

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

View File

@ -1,5 +1,25 @@
{
"$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": [
{
"type": "window",