updated search-a-card
This commit is contained in:
parent
f73775947d
commit
3f65d01731
@ -19,7 +19,7 @@
|
||||
},
|
||||
"ImageScalar": 1,
|
||||
"ImageSecondaryURL": "",
|
||||
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/2279451480490225490/B7CE3DF5D32ED5DA6C62A699CFA046553121EBC4/",
|
||||
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/2342503777976621188/4C119690DEF2B128E6EC309A880984E55D80350C/",
|
||||
"WidthScale": 0
|
||||
},
|
||||
"Description": "Allows searching for card(s) by name. Use the buttons to toggle the spawn / search mode.\n\nSee context menu for additional information.",
|
||||
@ -43,14 +43,14 @@
|
||||
"Tooltip": true,
|
||||
"Transform": {
|
||||
"posX": 60,
|
||||
"posY": 1.531,
|
||||
"posY": 1.481,
|
||||
"posZ": 56,
|
||||
"rotX": 0,
|
||||
"rotY": 270,
|
||||
"rotZ": 0,
|
||||
"scaleX": 5.5,
|
||||
"scaleX": 4,
|
||||
"scaleY": 1,
|
||||
"scaleZ": 5.5
|
||||
"scaleZ": 4
|
||||
},
|
||||
"Value": 0,
|
||||
"XmlUI": ""
|
||||
|
@ -2,14 +2,12 @@ require("playercards/PlayerCardSpawner")
|
||||
|
||||
local allCardsBagApi = require("playercards/AllCardsBagApi")
|
||||
|
||||
|
||||
|
||||
local BUTTON_LABELS = {}
|
||||
BUTTON_LABELS["spawn"] = {}
|
||||
BUTTON_LABELS["spawn"][true] = "Spawn all matching cards "
|
||||
BUTTON_LABELS["spawn"][false] = "Spawn first matching card"
|
||||
BUTTON_LABELS["spawn"][true] = "All matching cards"
|
||||
BUTTON_LABELS["spawn"][false] = "First matching card"
|
||||
BUTTON_LABELS["search"] = {}
|
||||
BUTTON_LABELS["search"][true] = "Name matches search term"
|
||||
BUTTON_LABELS["search"][true] = "Name equals search term"
|
||||
BUTTON_LABELS["search"][false] = "Name contains search term"
|
||||
|
||||
local inputParameters = {}
|
||||
@ -18,10 +16,10 @@ inputParameters.input_function = "input_func"
|
||||
inputParameters.function_owner = self
|
||||
inputParameters.alignment = 2
|
||||
inputParameters.position = { x = 0, y = 0.1, z = -0.62 }
|
||||
inputParameters.width = 1200
|
||||
inputParameters.height = 130
|
||||
inputParameters.font_size = 107
|
||||
inputParameters.scale = { 0.3, 1, 0.3 }
|
||||
inputParameters.width = 3750
|
||||
inputParameters.height = 380
|
||||
inputParameters.font_size = 350
|
||||
inputParameters.scale = { 0.1, 1, 0.1 }
|
||||
inputParameters.color = { 0.9, 0.7, 0.5 }
|
||||
inputParameters.font_color = { 0, 0, 0 }
|
||||
|
||||
@ -37,40 +35,40 @@ function onLoad(savedData)
|
||||
-- shared parameters
|
||||
local buttonParameters = {}
|
||||
buttonParameters.function_owner = self
|
||||
buttonParameters.font_size = 65
|
||||
buttonParameters.scale = { 0.3, 1, 0.3 }
|
||||
buttonParameters.font_size = 180
|
||||
buttonParameters.scale = { 0.1, 1, 0.1 }
|
||||
buttonParameters.hover_color = { 0.4, 0.6, 0.8 }
|
||||
buttonParameters.color = { 0.9, 0.7, 0.5 }
|
||||
|
||||
-- index 0: button for spawn mode
|
||||
buttonParameters.click_function = "spawnMode"
|
||||
buttonParameters.click_function = "toggleSpawnMode"
|
||||
buttonParameters.label = BUTTON_LABELS["spawn"][spawnAll]
|
||||
buttonParameters.position = { x = 0.18, y = 0.1, z = 0.555 }
|
||||
buttonParameters.height = 125
|
||||
buttonParameters.width = 800
|
||||
buttonParameters.position = { x = 0.16, y = 0.1, z = 0.565 }
|
||||
buttonParameters.height = 375
|
||||
buttonParameters.width = 2300
|
||||
self.createButton(buttonParameters)
|
||||
|
||||
-- index 1: button for search mode
|
||||
buttonParameters.click_function = "searchMode"
|
||||
buttonParameters.click_function = "toggleSearchMode"
|
||||
buttonParameters.label = BUTTON_LABELS["search"][searchExact]
|
||||
buttonParameters.position = { x = 0.18, y = 0.1, z = 0.63 }
|
||||
buttonParameters.position = { x = 0.16, y = 0.1, z = 0.652 }
|
||||
self.createButton(buttonParameters)
|
||||
|
||||
-- index 2: start search
|
||||
buttonParameters.click_function = "search"
|
||||
buttonParameters.click_function = "startSearch"
|
||||
buttonParameters.label = ""
|
||||
buttonParameters.position = { x = 0, y = 0, z = 0.8 }
|
||||
buttonParameters.height = 200
|
||||
buttonParameters.width = 1000
|
||||
buttonParameters.position = { x = 0, y = 0, z = 0.806 }
|
||||
buttonParameters.height = 600
|
||||
buttonParameters.width = 2800
|
||||
self.createButton(buttonParameters)
|
||||
end
|
||||
|
||||
function spawnMode()
|
||||
function toggleSpawnMode()
|
||||
spawnAll = not spawnAll
|
||||
self.editButton({ index = 0, label = BUTTON_LABELS["spawn"][spawnAll] })
|
||||
end
|
||||
|
||||
function searchMode()
|
||||
function toggleSearchMode()
|
||||
searchExact = not searchExact
|
||||
self.editButton({ index = 1, label = BUTTON_LABELS["search"][searchExact] })
|
||||
end
|
||||
@ -81,13 +79,13 @@ function input_func(_, _, input, stillEditing)
|
||||
inputParameters.value = input
|
||||
elseif string.find(input, "%\n") ~= nil then
|
||||
inputParameters.value = input.gsub(input, "%\n", "")
|
||||
search()
|
||||
startSearch()
|
||||
self.removeInput(0)
|
||||
self.createInput(inputParameters)
|
||||
end
|
||||
end
|
||||
|
||||
function search()
|
||||
function startSearch()
|
||||
if inputParameters.value == nil or string.len(inputParameters.value) == 0 then
|
||||
printToAll("Please enter a search string.", "Yellow")
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user