fixed xml buttons
This commit is contained in:
parent
a74ced8c7f
commit
24bedfecac
@ -37,12 +37,12 @@
|
|||||||
{
|
{
|
||||||
"Name": "OverlayLarge",
|
"Name": "OverlayLarge",
|
||||||
"Type": 0,
|
"Type": 0,
|
||||||
"URL": "http://cloud-3.steamusercontent.com/ugc/1745699502804112656/A34D1F30E0DA0E283F300AE6D6B63F59FFC97730/"
|
"URL": "http://cloud-3.steamusercontent.com/ugc/2021591230441678995/7B413A821136969D8723687A2AD66773B3F8FEED/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "OverlaySmall",
|
"Name": "OverlaySmall",
|
||||||
"Type": 0,
|
"Type": 0,
|
||||||
"URL": "http://cloud-3.steamusercontent.com/ugc/1745699502804112719/CFFC89BF9FB8439204EE19CF94180EC99450CD38/"
|
"URL": "http://cloud-3.steamusercontent.com/ugc/2021591230447630077/18C86248B9BDAF1DE01B67791439A39EE4F97B60/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "option-gear",
|
"Name": "option-gear",
|
||||||
|
@ -18,22 +18,9 @@
|
|||||||
"Type": 0
|
"Type": 0
|
||||||
},
|
},
|
||||||
"ImageScalar": 1,
|
"ImageScalar": 1,
|
||||||
"ImageSecondaryURL": "http://cloud-3.steamusercontent.com/ugc/2021591230456185506/15AF790F0622B57C1F629DB3A8C38F2A99D0EB1B/",
|
|
||||||
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/2021591230456185506/15AF790F0622B57C1F629DB3A8C38F2A99D0EB1B/",
|
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/2021591230456185506/15AF790F0622B57C1F629DB3A8C38F2A99D0EB1B/",
|
||||||
"WidthScale": 0
|
"WidthScale": 0
|
||||||
},
|
},
|
||||||
"CustomUIAssets": [
|
|
||||||
{
|
|
||||||
"Name": "OverlayLarge",
|
|
||||||
"Type": 0,
|
|
||||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2021591230441678995/7B413A821136969D8723687A2AD66773B3F8FEED/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "OverlaySmall",
|
|
||||||
"Type": 0,
|
|
||||||
"URL": "http://cloud-3.steamusercontent.com/ugc/2021591230447630077/18C86248B9BDAF1DE01B67791439A39EE4F97B60/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Description": "",
|
"Description": "",
|
||||||
"DragSelectable": true,
|
"DragSelectable": true,
|
||||||
"GMNotes": "",
|
"GMNotes": "",
|
||||||
@ -45,7 +32,7 @@
|
|||||||
"IgnoreFoW": false,
|
"IgnoreFoW": false,
|
||||||
"LayoutGroupSortIndex": 0,
|
"LayoutGroupSortIndex": 0,
|
||||||
"Locked": false,
|
"Locked": false,
|
||||||
"LuaScript": "require(\"accessories/NavigationOverlay\")",
|
"LuaScript": "require(\"core/NavigationOverlay\")",
|
||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
"Name": "Custom_Tile",
|
"Name": "Custom_Tile",
|
||||||
@ -65,5 +52,5 @@
|
|||||||
"scaleZ": 3
|
"scaleZ": 3
|
||||||
},
|
},
|
||||||
"Value": 0,
|
"Value": 0,
|
||||||
"XmlUI_path": "OptionPanelSource.830bd0/NavigationOverlay.a8affa/NavigationOverlayTile.9f2481.xml"
|
"XmlUI": ""
|
||||||
}
|
}
|
||||||
|
@ -37,19 +37,6 @@ playButtonData = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
playermatData = {
|
playermatData = {
|
||||||
{
|
|
||||||
guid = '383d8b',
|
|
||||||
origin = { x = -25.00, y = 0, z = 26.20 },
|
|
||||||
scale = { x = 31.5, y = 5.10, z = 14.59 },
|
|
||||||
orientation = { x = 0, y = 0, z = 0 },
|
|
||||||
minX = -44.43,
|
|
||||||
maxX = -17.44,
|
|
||||||
minZ = 20.17,
|
|
||||||
maxZ = 32.97,
|
|
||||||
xOffset = -0.07,
|
|
||||||
zOffset = 0.00,
|
|
||||||
claims = { true, false, false, false }
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
guid = '8b081b',
|
guid = '8b081b',
|
||||||
origin = { x = -54.42, y = 0, z = 20.96 },
|
origin = { x = -54.42, y = 0, z = 20.96 },
|
||||||
@ -61,7 +48,7 @@ playermatData = {
|
|||||||
maxZ = 24.53,
|
maxZ = 24.53,
|
||||||
xOffset = 0.07,
|
xOffset = 0.07,
|
||||||
zOffset = 0.03,
|
zOffset = 0.03,
|
||||||
claims = { false, true, false, false }
|
claims = { true, false, false, false }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
guid = 'bd0ff4',
|
guid = 'bd0ff4',
|
||||||
@ -74,6 +61,19 @@ playermatData = {
|
|||||||
maxZ = 2.39,
|
maxZ = 2.39,
|
||||||
xOffset = 0.07,
|
xOffset = 0.07,
|
||||||
zOffset = 0.02,
|
zOffset = 0.02,
|
||||||
|
claims = { false, true, false, false }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
guid = '383d8b',
|
||||||
|
origin = { x = -25.00, y = 0, z = 26.20 },
|
||||||
|
scale = { x = 31.5, y = 5.10, z = 14.59 },
|
||||||
|
orientation = { x = 0, y = 0, z = 0 },
|
||||||
|
minX = -44.43,
|
||||||
|
maxX = -17.44,
|
||||||
|
minZ = 20.17,
|
||||||
|
maxZ = 32.97,
|
||||||
|
xOffset = -0.07,
|
||||||
|
zOffset = 0.00,
|
||||||
claims = { false, false, true, false }
|
claims = { false, false, true, false }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -233,9 +233,9 @@ function setVisibility(type, color)
|
|||||||
local visibility
|
local visibility
|
||||||
|
|
||||||
if type == "full" then
|
if type == "full" then
|
||||||
visibility = {full = true, play = false}
|
visibility = { full = true, play = false }
|
||||||
elseif type == "play" then
|
elseif type == "play" then
|
||||||
visibility = {full = false, play = true}
|
visibility = { full = false, play = true }
|
||||||
else
|
else
|
||||||
visibility = { full = false, play = false }
|
visibility = { full = false, play = false }
|
||||||
end
|
end
|
||||||
@ -316,27 +316,50 @@ function updateOverlay()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.UI.setAttribute("navPanelFull", "visibility", fullColors)
|
if fullColors then
|
||||||
self.UI.setAttribute("navPanelPlay", "visibility", playColors)
|
updateXMLbuttons("full")
|
||||||
|
UI.setAttribute("navPanelFull", "visibility", fullColors)
|
||||||
|
UI.show("navPanelFull")
|
||||||
|
else
|
||||||
|
UI.hide("navPanelFull")
|
||||||
|
end
|
||||||
|
|
||||||
updateXMLbuttons("full")
|
if playColors then
|
||||||
updateXMLbuttons("play")
|
updateXMLbuttons("play")
|
||||||
|
UI.setAttribute("navPanelPlay", "visibility", playColors)
|
||||||
|
UI.show("navPanelPlay")
|
||||||
|
else
|
||||||
|
UI.hide("navPanelPlay")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateXMLbuttons(type)
|
function updateXMLbuttons(type)
|
||||||
local data, id
|
local data, id, overlay, color
|
||||||
if type == "full" then
|
if type == "full" then
|
||||||
data = fullButtonData
|
data = fullButtonData
|
||||||
id = "navPanelFull"
|
id = "navPanelFull"
|
||||||
|
overlay = "OverlayLarge"
|
||||||
else
|
else
|
||||||
data = playButtonData
|
data = playButtonData
|
||||||
id = "navPanelPlay"
|
id = "navPanelPlay"
|
||||||
|
overlay = "OverlaySmall"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- XML button creation
|
-- XML button creation
|
||||||
local color
|
local guid = self.getGUID()
|
||||||
local xml = findTagWithId(self.UI.getXmlTable(), id)
|
local ui = UI.getXmlTable()
|
||||||
|
local xml = findTagWithId(ui, id)
|
||||||
|
|
||||||
|
-- add basic image
|
||||||
|
xml.children = { {
|
||||||
|
tag = "image",
|
||||||
|
attributes = {
|
||||||
|
id = "backgroundImage",
|
||||||
|
image = overlay
|
||||||
|
}
|
||||||
|
} }
|
||||||
|
|
||||||
|
-- add all buttons
|
||||||
for _, d in ipairs(data) do
|
for _, d in ipairs(data) do
|
||||||
local buttonID = tonumber(d.id)
|
local buttonID = tonumber(d.id)
|
||||||
|
|
||||||
@ -358,10 +381,10 @@ function updateXMLbuttons(type)
|
|||||||
color = "rgba(0,1,0,0)"
|
color = "rgba(0,1,0,0)"
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(xml, {
|
table.insert(xml.children, {
|
||||||
tag = "button",
|
tag = "button",
|
||||||
attributes = {
|
attributes = {
|
||||||
onClick = "buttonClicked",
|
onClick = guid .. "/buttonClicked",
|
||||||
id = d.id,
|
id = d.id,
|
||||||
height = d.height,
|
height = d.height,
|
||||||
width = d.width,
|
width = d.width,
|
||||||
@ -370,15 +393,15 @@ function updateXMLbuttons(type)
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
self.UI.setXmlTable(xml)
|
UI.setXmlTable(ui)
|
||||||
end
|
end
|
||||||
|
|
||||||
function findTagWithId(ui, id)
|
function findTagWithId(ui, id)
|
||||||
for _, obj in ipairs(ui) do
|
for _, obj in ipairs(ui) do
|
||||||
if obj.attributes and obj.attributes.id and obj.attributes.id == id then return obj end
|
if obj.attributes and obj.attributes.id and obj.attributes.id == id then return obj end
|
||||||
if obj.children then
|
if obj.children then
|
||||||
local result = find_tag_with_id(obj.children, id)
|
local result = findTagWithId(obj.children, id)
|
||||||
if result then return result end
|
if result then return result end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -489,7 +512,7 @@ function loadCamera(player, _, idValue)
|
|||||||
|
|
||||||
if minX < 100 then
|
if minX < 100 then
|
||||||
local dx = maxX - minX
|
local dx = maxX - minX
|
||||||
local dz = (maxZ - minZ) / (1.6) -- screen ratio * 1.2 (for my macbook pro, no idea how to generalize this)
|
local dz = (maxZ - minZ) / 1.6 -- screen ratio * 1.2 (for my macbook pro, no idea how to generalize this)
|
||||||
local centerX = (minX + maxX) / 2 -- offset is to move it a bit up, so the cards don't block anything
|
local centerX = (minX + maxX) / 2 -- offset is to move it a bit up, so the cards don't block anything
|
||||||
local centerZ = (minZ + maxZ) / 2
|
local centerZ = (minZ + maxZ) / 2
|
||||||
local scale = math.max(dx, dz)
|
local scale = math.max(dx, dz)
|
||||||
@ -561,8 +584,8 @@ function loadCamera(player, _, idValue)
|
|||||||
-- offset is to move it a bit up and right, so the cards/toolbar don't block anything
|
-- offset is to move it a bit up and right, so the cards/toolbar don't block anything
|
||||||
centerX = (minX + maxX) / 2 - dx * playermatData[newMatIndex].xOffset
|
centerX = (minX + maxX) / 2 - dx * playermatData[newMatIndex].xOffset
|
||||||
centerZ = (minZ + maxZ) / 2 + dz * playermatData[newMatIndex].zOffset
|
centerZ = (minZ + maxZ) / 2 + dz * playermatData[newMatIndex].zOffset
|
||||||
-- Green/Red
|
-- Green/Red
|
||||||
else
|
else
|
||||||
dx = (maxX - minX) / 1.6
|
dx = (maxX - minX) / 1.6
|
||||||
dz = maxZ - minZ
|
dz = maxZ - minZ
|
||||||
yaw = playermatData[newMatIndex].orientation.y + 180
|
yaw = playermatData[newMatIndex].orientation.y + 180
|
||||||
@ -622,6 +645,7 @@ function resetClaimColors(object, color)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- helper functions
|
||||||
function getPlayerCount()
|
function getPlayerCount()
|
||||||
local playerCount = 0
|
local playerCount = 0
|
||||||
local playerColors = {}
|
local playerColors = {}
|
||||||
@ -645,26 +669,16 @@ function getPlayerCount()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function getPlayerColorForIndex(index)
|
function getPlayerColorForIndex(index)
|
||||||
if index < 0 or index > 4 then
|
local color = { "White", "Orange", "Green", "Red" }
|
||||||
return nil
|
return color[index]
|
||||||
end
|
|
||||||
|
|
||||||
local guid = playermatData[index]['guid']
|
|
||||||
if guid ~= nil then
|
|
||||||
local mat = getObjectFromGUID(guid)
|
|
||||||
return mat.getVar("playerColor")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function getIndexForPlayerColor(color)
|
function getIndexForPlayerColor(color)
|
||||||
for i = 1, 4 do
|
local index = { White = 1, Orange = 2, Green = 3, Red = 4 }
|
||||||
local mat = getObjectFromGUID(playermatData[i].guid)
|
|
||||||
if mat ~= nil then
|
|
||||||
if mat.getVar('playerColor') == color then
|
|
||||||
return i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return -1
|
if index[color] then
|
||||||
|
return index[color]
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
end
|
||||||
end
|
end
|
@ -123,3 +123,4 @@
|
|||||||
|
|
||||||
<Include src="OptionPanel.xml"/>
|
<Include src="OptionPanel.xml"/>
|
||||||
<Include src="UpdateNotification.xml"/>
|
<Include src="UpdateNotification.xml"/>
|
||||||
|
<Include src="NavigationOverlay.xml"/>
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<!-- Defaults -->
|
<!-- Defaults -->
|
||||||
<Defaults>
|
<Defaults>
|
||||||
<Panel class="navPanel"
|
<Panel class="navPanel"
|
||||||
|
active="false"
|
||||||
allowDragging="true"
|
allowDragging="true"
|
||||||
returnToOriginalPositionWhenReleased="false"
|
|
||||||
rectAlignment="LowerRight"
|
rectAlignment="LowerRight"
|
||||||
|
returnToOriginalPositionWhenReleased="false"
|
||||||
offsetXY="-40 0">
|
offsetXY="-40 0">
|
||||||
</Panel>
|
</Panel>
|
||||||
</Defaults>
|
</Defaults>
|
||||||
@ -13,8 +14,6 @@
|
|||||||
height="358"
|
height="358"
|
||||||
width="455"
|
width="455"
|
||||||
class="navPanel">
|
class="navPanel">
|
||||||
<image id="backgroundImage"
|
|
||||||
image="OverlayLarge" />
|
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
||||||
<!-- Play Area only -->
|
<!-- Play Area only -->
|
||||||
@ -22,6 +21,4 @@
|
|||||||
height="208"
|
height="208"
|
||||||
width="205"
|
width="205"
|
||||||
class="navPanel">
|
class="navPanel">
|
||||||
<image id="backgroundImage"
|
|
||||||
image="OverlaySmall" />
|
|
||||||
</Panel>
|
</Panel>
|
Loading…
x
Reference in New Issue
Block a user