xml split, code cleanup (WIP)
This commit is contained in:
parent
71bd43baf7
commit
3c6d890b16
@ -22,6 +22,18 @@
|
|||||||
"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": "",
|
||||||
@ -53,5 +65,5 @@
|
|||||||
"scaleZ": 3
|
"scaleZ": 3
|
||||||
},
|
},
|
||||||
"Value": 0,
|
"Value": 0,
|
||||||
"XmlUI": ""
|
"XmlUI_path": "OptionPanelSource.830bd0/NavigationOverlayTile.9f2481.xml"
|
||||||
}
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
<!-- Defaults -->
|
||||||
|
<Defaults>
|
||||||
|
<Panel class="navPanel"
|
||||||
|
allowDragging="true"
|
||||||
|
returnToOriginalPositionWhenReleased="false"
|
||||||
|
rectAlignment="LowerRight"
|
||||||
|
offsetXY="-40 0">
|
||||||
|
</Panel>
|
||||||
|
</Defaults>
|
||||||
|
|
||||||
|
<!-- full Panel -->
|
||||||
|
<Panel id="navPanelFull"
|
||||||
|
height="358"
|
||||||
|
width="455"
|
||||||
|
class="navPanel">
|
||||||
|
<image id="backgroundImage"
|
||||||
|
image="OverlayLarge" />
|
||||||
|
</Panel>
|
||||||
|
|
||||||
|
<!-- Play Area only -->
|
||||||
|
<Panel id="navPanelPlay"
|
||||||
|
height="208"
|
||||||
|
width="205"
|
||||||
|
class="navPanel">
|
||||||
|
<image id="backgroundImage"
|
||||||
|
image="OverlaySmall" />
|
||||||
|
</Panel>
|
@ -1,228 +1,196 @@
|
|||||||
local buttonCount = 20
|
local playAreaApi = require("core/PlayAreaApi")
|
||||||
local cameraCount = 18
|
local playmatApi = require("playermat/PlaymatApi")
|
||||||
|
|
||||||
function onLoad(saved_data)
|
fullButtonData = {
|
||||||
self.createButton({
|
{ id = "1", width = "84", height = "33", offsetX = "1", offsetY = "2" }, -- Act/Agenda
|
||||||
label = "",
|
{ id = "2", width = "78", height = "69", offsetX = "1", offsetY = "-62" }, -- Map
|
||||||
tooltip = "Display full overlay",
|
{ id = "3", width = "36", height = "70", offsetX = "-62", offsetY = "-66" }, -- Green
|
||||||
click_function = "displayFull",
|
{ id = "4", width = "70", height = "36", offsetX = "-36", offsetY = "-126" }, -- White
|
||||||
function_owner = self,
|
{ id = "5", width = "70", height = "36", offsetX = "39", offsetY = "-126" }, -- Orange
|
||||||
position = { 0.0, 0.1, -0.63 },
|
{ id = "6", width = "36", height = "70", offsetX = "64", offsetY = "-66" }, -- Red
|
||||||
height = 70,
|
{ id = "7", width = "38", height = "38", offsetX = "-64", offsetY = "-3" }, -- Victory
|
||||||
width = 700,
|
{ id = "8", width = "40", height = "40", offsetX = "66", offsetY = "-3" }, -- Guide
|
||||||
scale = { x = 1, y = 1, z = 1 },
|
{ id = "9", width = "56", height = "16", offsetX = "1", offsetY = "-20" }, -- Player count
|
||||||
color = { 1, 0, 0, 0 }
|
{ id = "10", width = "36", height = "16", offsetX = "1", offsetY = "-102" }, -- Bless/Curse
|
||||||
})
|
{ id = "11", width = "168", height = "56", offsetX = "1", offsetY = "47" }, -- Scenarios
|
||||||
self.createButton({
|
{ id = "12", width = "52", height = "53", offsetX = "-154", offsetY = "134" }, -- Player card panel
|
||||||
label = "",
|
{ id = "13", width = "22", height = "22", offsetX = "-116", offsetY = "132" }, -- Search card panel
|
||||||
tooltip = "Display only play area",
|
{ id = "14", width = "120", height = "75", offsetX = "-152", offsetY = "70" }, -- Player card display
|
||||||
click_function = "displayPlayArea",
|
{ id = "15", width = "40", height = "54", offsetX = "-150", offsetY = "-38" }, -- Deck builder
|
||||||
function_owner = self,
|
{ id = "16", width = "104", height = "84", offsetX = "-154", offsetY = "-114" }, -- Rules area
|
||||||
position = { 0.0, 0.1, -0.39 },
|
{ id = "17", width = "100", height = "170", offsetX = "152", offsetY = "72" }, -- Cycle area
|
||||||
height = 70,
|
{ id = "18", width = "56", height = "60", offsetX = "182", offsetY = "-124" }, -- Additions
|
||||||
width = 700,
|
{ id = "19", width = "20", height = "20", offsetX = "-8", offsetY = "150" }, -- Shrink
|
||||||
scale = { x = 1, y = 1, z = 1 },
|
{ id = "20", width = "20", height = "20", offsetX = "12", offsetY = "150" } -- Close
|
||||||
color = { 1, 0, 0, 0 }
|
}
|
||||||
})
|
|
||||||
self.createButton({
|
|
||||||
label = "",
|
|
||||||
tooltip = "Close overlay",
|
|
||||||
click_function = "closeOverlay",
|
|
||||||
function_owner = self,
|
|
||||||
position = { 0.0, 0.1, -0.16 },
|
|
||||||
height = 70,
|
|
||||||
width = 700,
|
|
||||||
scale = { x = 1, y = 1, z = 1 },
|
|
||||||
color = { 1, 0, 0, 0 }
|
|
||||||
})
|
|
||||||
self.createButton({
|
|
||||||
label = "",
|
|
||||||
tooltip = "Modify a camera position",
|
|
||||||
click_function = "beginSetCamera",
|
|
||||||
function_owner = self,
|
|
||||||
position = { 0.0, 0.1, 0.19 },
|
|
||||||
height = 70,
|
|
||||||
width = 700,
|
|
||||||
scale = { x = 1, y = 1, z = 1 },
|
|
||||||
color = { 1, 0, 0, 0 }
|
|
||||||
})
|
|
||||||
self.createButton({
|
|
||||||
label = "",
|
|
||||||
tooltip = "Claim a color (you will switch to this color when clicking in the overlay)",
|
|
||||||
click_function = "beginClaimColor",
|
|
||||||
function_owner = self,
|
|
||||||
position = { -0.22, 0.1, 0.42 },
|
|
||||||
height = 70,
|
|
||||||
width = 475,
|
|
||||||
scale = { x = 1, y = 1, z = 1 },
|
|
||||||
color = { 1, 0, 0, 0 }
|
|
||||||
})
|
|
||||||
self.createButton({
|
|
||||||
label = "",
|
|
||||||
tooltip = "Reset all color claims",
|
|
||||||
click_function = "resetClaimColors",
|
|
||||||
function_owner = self,
|
|
||||||
position = { 0.48, 0.1, 0.42 },
|
|
||||||
height = 70,
|
|
||||||
width = 230,
|
|
||||||
scale = { x = 1, y = 1, z = 1 },
|
|
||||||
color = { 1, 0, 0, 0 }
|
|
||||||
})
|
|
||||||
self.createButton({
|
|
||||||
label = "",
|
|
||||||
tooltip = "Reset camera positions to default",
|
|
||||||
click_function = "resetCameras",
|
|
||||||
function_owner = self,
|
|
||||||
position = { 0.0, 0.1, 0.78 },
|
|
||||||
height = 70,
|
|
||||||
width = 700,
|
|
||||||
scale = { x = 1, y = 1, z = 1 },
|
|
||||||
color = { 1, 0, 0, 0 }
|
|
||||||
})
|
|
||||||
|
|
||||||
defaultCameraParams = {
|
playButtonData = {
|
||||||
{ position = { -1.626, -2.5, 0 }, pitch = 74, yaw = 90, distance = 17.844 }, -- 1. ActAgenda
|
{ id = "1", width = "80", height = "33", offsetX = "0", offsetY = "55" },
|
||||||
{ position = { -27.822, -2.5, 0.424 }, pitch = 74, yaw = 90, distance = -1 }, -- 2. Map
|
{ id = "2", width = "78", height = "70", offsetX = "0", offsetY = "-8" },
|
||||||
{ position = { -31.592, -2.5, 26.392 }, pitch = 74, yaw = 180, distance = -1 }, -- 3. Green playmat
|
{ id = "3", width = "35", height = "66", offsetX = "-65", offsetY = "-10" },
|
||||||
{ position = { -55.026, -2.5, 12.052 }, pitch = 74, yaw = 90, distance = -1 }, -- 4. White playmat
|
{ id = "4", width = "68", height = "32", offsetX = "-36", offsetY = "-71" },
|
||||||
{ position = { -55.026, -2.5, -11.479 }, pitch = 74, yaw = 90, distance = -1 }, -- 5. Orange playmat
|
{ id = "5", width = "68", height = "32", offsetX = "36", offsetY = "-71" },
|
||||||
{ position = { -31.592, -2.5, -26.392 }, pitch = 74, yaw = 0, distance = -1 }, -- 6. Red playmat
|
{ id = "6", width = "35", height = "66", offsetX = "65", offsetY = "-10" },
|
||||||
{ position = { -3.029, 1.652, 24.296 }, pitch = 74, yaw = 90, distance = 16 }, -- 7. Victory / SetAside
|
{ id = "7", width = "38", height = "38", offsetX = "-66", offsetY = "52" },
|
||||||
{ position = { -2.936, 1.552, -26.757 }, pitch = 74, yaw = 90, distance = 16 }, -- 8. Guide
|
{ id = "8", width = "38", height = "38", offsetX = "66", offsetY = "52" },
|
||||||
{ position = { -11.833, 1.491, -0.145 }, pitch = 74, yaw = 90, distance = 10 }, -- 9. Player count
|
{ id = "9", width = "50", height = "12", offsetX = "0", offsetY = "33" },
|
||||||
{ position = { -48.352, 1.552, -0.055 }, pitch = 74, yaw = 90, distance = 10 }, -- 10. Bless/Curse
|
{ id = "10", width = "32", height = "12", offsetX = "0", offsetY = "-48" },
|
||||||
{ position = { 12.560, 1.912, 0.458 }, pitch = 74, yaw = 90, distance = 35 }, -- 11. Scenarios
|
{ id = "19", width = "20", height = "20", offsetX = "-10", offsetY = "80" },
|
||||||
{ position = { 57.835, 1.552, 75.385 }, pitch = 74, yaw = 90, distance = 22 }, -- 12. Player card panel
|
{ id = "20", width = "20", height = "20", offsetX = "10", offsetY = "80" }
|
||||||
{ position = { 60.377, 1.552, 55.941 }, pitch = 74, yaw = 90, distance = 10 }, -- 13. Card search panel
|
}
|
||||||
{ position = { 27.482, 1.480, 71.057 }, pitch = 74, yaw = 90, distance = 35 }, -- 14. Player card area
|
|
||||||
{ position = { -19.481, 1.552, 70.880 }, pitch = 74, yaw = 90, distance = 22 }, -- 15. Deck builder
|
playermatData = {
|
||||||
{ position = { -52.918, 1.478, 70.899 }, pitch = 74, yaw = 90, distance = 42 }, -- 16. Rules area
|
{
|
||||||
{ position = { 24.551, 2.222, -71.284 }, pitch = 60, yaw = 90, distance = 60 }, -- 17. Cycle area
|
guid = '383d8b',
|
||||||
{ position = { -59.077, 1.462, -85.472 }, pitch = 74, yaw = 90, distance = 27 } -- 18. Additions
|
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',
|
||||||
|
origin = { x = -54.42, y = 0, z = 20.96 },
|
||||||
|
scale = { x = 36.63, y = 5.10, z = 14.59 },
|
||||||
|
orientation = { x = 0, y = 270, z = 0 },
|
||||||
|
minX = -61.4,
|
||||||
|
maxX = -48.6,
|
||||||
|
minZ = -2.39,
|
||||||
|
maxZ = 24.53,
|
||||||
|
xOffset = 0.07,
|
||||||
|
zOffset = 0.03,
|
||||||
|
claims = { false, true, false, false }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
guid = 'bd0ff4',
|
||||||
|
origin = { x = -54.42, y = 0, z = -20.96 },
|
||||||
|
scale = { x = 36.63, y = 5.10, z = 14.59 },
|
||||||
|
orientation = { x = 0, y = 270, z = 0 },
|
||||||
|
minX = -61.4,
|
||||||
|
maxX = -48.6,
|
||||||
|
minZ = -24.53,
|
||||||
|
maxZ = 2.39,
|
||||||
|
xOffset = 0.07,
|
||||||
|
zOffset = 0.02,
|
||||||
|
claims = { false, false, true, false }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
guid = '0840d5',
|
||||||
|
origin = { x = -25.00, y = 0, z = -26.60 },
|
||||||
|
scale = { x = 31.5, y = 5.10, z = 14.59 },
|
||||||
|
orientation = { x = 0, y = 180, z = 0 },
|
||||||
|
minX = -44.43,
|
||||||
|
maxX = -17.44,
|
||||||
|
minZ = -32.97,
|
||||||
|
maxZ = -20.17,
|
||||||
|
xOffset = 0.07,
|
||||||
|
zOffset = -0.06,
|
||||||
|
claims = { false, false, false, true }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fullButtonData = {
|
defaultCameraParams = {
|
||||||
{ id = "1", width = "84", height = "33", offsetX = "1", offsetY = "2" }, -- Act/Agenda
|
{ position = { -1.626, -2.5, 0 }, pitch = 74, yaw = 90, distance = 18 }, -- 1. ActAgenda
|
||||||
{ id = "2", width = "78", height = "69", offsetX = "1", offsetY = "-62" }, -- Map
|
{ position = { -27.822, -2.5, 0.424 }, pitch = 74, yaw = 90, distance = -1 }, -- 2. Map
|
||||||
{ id = "3", width = "36", height = "70", offsetX = "-62", offsetY = "-66" }, -- Green
|
{ position = { -31.592, -2.5, 26.392 }, pitch = 74, yaw = 180, distance = -1 }, -- 3. Green playmat
|
||||||
{ id = "4", width = "70", height = "36", offsetX = "-36", offsetY = "-126" }, -- White
|
{ position = { -55.026, -2.5, 12.052 }, pitch = 74, yaw = 90, distance = -1 }, -- 4. White playmat
|
||||||
{ id = "5", width = "70", height = "36", offsetX = "39", offsetY = "-126" }, -- Orange
|
{ position = { -55.026, -2.5, -11.479 }, pitch = 74, yaw = 90, distance = -1 }, -- 5. Orange playmat
|
||||||
{ id = "6", width = "36", height = "70", offsetX = "64", offsetY = "-66" }, -- Red
|
{ position = { -31.592, -2.5, -26.392 }, pitch = 74, yaw = 0, distance = -1 }, -- 6. Red playmat
|
||||||
{ id = "7", width = "38", height = "38", offsetX = "-64", offsetY = "-3" }, -- Victory
|
{ position = { -3.029, 1.652, 24.296 }, pitch = 74, yaw = 90, distance = 16 }, -- 7. Victory / SetAside
|
||||||
{ id = "8", width = "40", height = "40", offsetX = "66", offsetY = "-3" }, -- Guide
|
{ position = { -2.936, 1.552, -26.757 }, pitch = 74, yaw = 90, distance = 16 }, -- 8. Guide
|
||||||
{ id = "9", width = "56", height = "16", offsetX = "1", offsetY = "-20" }, -- Player count
|
{ position = { -11.833, 1.491, -0.145 }, pitch = 74, yaw = 90, distance = 10 }, -- 9. Player count
|
||||||
{ id = "10", width = "36", height = "16", offsetX = "1", offsetY = "-102" }, -- Bless/Curse
|
{ position = { -48.352, 1.552, -0.055 }, pitch = 74, yaw = 90, distance = 10 }, -- 10. Bless/Curse
|
||||||
{ id = "11", width = "168", height = "56", offsetX = "1", offsetY = "47" }, -- Scenarios
|
{ position = { 12.560, 1.912, 0.458 }, pitch = 74, yaw = 90, distance = 35 }, -- 11. Scenarios
|
||||||
{ id = "12", width = "52", height = "53", offsetX = "-154", offsetY = "134" }, -- Player card panel
|
{ position = { 57.835, 1.552, 75.385 }, pitch = 74, yaw = 90, distance = 22 }, -- 12. Player card panel
|
||||||
{ id = "13", width = "22", height = "22", offsetX = "-116", offsetY = "132" }, -- Search card panel
|
{ position = { 60.377, 1.552, 55.941 }, pitch = 74, yaw = 90, distance = 10 }, -- 13. Card search panel
|
||||||
{ id = "14", width = "120", height = "75", offsetX = "-152", offsetY = "70" }, -- Player card display
|
{ position = { 27.482, 1.480, 71.057 }, pitch = 74, yaw = 90, distance = 35 }, -- 14. Player card area
|
||||||
{ id = "15", width = "40", height = "54", offsetX = "-150", offsetY = "-38" }, -- Deck builder
|
{ position = { -19.481, 1.552, 70.880 }, pitch = 74, yaw = 90, distance = 22 }, -- 15. Deck builder
|
||||||
{ id = "16", width = "104", height = "84", offsetX = "-154", offsetY = "-114" }, -- Rules area
|
{ position = { -52.918, 1.478, 70.899 }, pitch = 74, yaw = 90, distance = 42 }, -- 16. Rules area
|
||||||
{ id = "17", width = "100", height = "170", offsetX = "152", offsetY = "72" }, -- Cycle area
|
{ position = { 24.551, 2.222, -71.284 }, pitch = 60, yaw = 90, distance = 60 }, -- 17. Cycle area
|
||||||
{ id = "18", width = "56", height = "60", offsetX = "182", offsetY = "-124" }, -- Additions
|
{ position = { -59.077, 1.462, -85.472 }, pitch = 74, yaw = 90, distance = 27 } -- 18. Additions
|
||||||
{ id = "19", width = "20", height = "20", offsetX = "-8", offsetY = "150" }, -- Shrink
|
}
|
||||||
{ id = "20", width = "20", height = "20", offsetX = "12", offsetY = "150" } -- Close
|
|
||||||
}
|
|
||||||
|
|
||||||
playButtonData = {
|
editing = false
|
||||||
{ id = "1", width = "80", height = "33", offsetX = "0", offsetY = "55" },
|
claiming = false
|
||||||
{ id = "2", width = "78", height = "70", offsetX = "0", offsetY = "-8" },
|
selectedEditButton = -1
|
||||||
{ id = "3", width = "35", height = "66", offsetX = "-65", offsetY = "-10" },
|
editPos = { 0, 0, 0 }
|
||||||
{ id = "4", width = "68", height = "32", offsetX = "-36", offsetY = "-71" },
|
editPitch = 0
|
||||||
{ id = "5", width = "68", height = "32", offsetX = "36", offsetY = "-71" },
|
editYaw = 0
|
||||||
{ id = "6", width = "35", height = "66", offsetX = "65", offsetY = "-10" },
|
editDistance = 0
|
||||||
{ id = "7", width = "38", height = "38", offsetX = "-66", offsetY = "52" },
|
|
||||||
{ id = "8", width = "38", height = "38", offsetX = "66", offsetY = "52" },
|
|
||||||
{ id = "9", width = "50", height = "12", offsetX = "0", offsetY = "33" },
|
|
||||||
{ id = "10", width = "32", height = "12", offsetX = "0", offsetY = "-48" },
|
|
||||||
{ id = "19", width = "20", height = "20", offsetX = "-10", offsetY = "80" },
|
|
||||||
{ id = "20", width = "20", height = "20", offsetX = "10", offsetY = "80" }
|
|
||||||
}
|
|
||||||
|
|
||||||
playermatData = {
|
function onLoad(savedData)
|
||||||
{
|
local buttonParameters = {}
|
||||||
guid = '383d8b',
|
buttonParameters.function_owner = self
|
||||||
origin = { x = -25.00, y = 0, z = 26.20 },
|
buttonParameters.label = ""
|
||||||
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',
|
|
||||||
origin = { x = -54.42, y = 0, z = 20.96 },
|
|
||||||
scale = { x = 36.63, y = 5.10, z = 14.59 },
|
|
||||||
orientation = { x = 0, y = 270, z = 0 },
|
|
||||||
minX = -61.4,
|
|
||||||
maxX = -48.6,
|
|
||||||
minZ = -2.39,
|
|
||||||
maxZ = 24.53,
|
|
||||||
xOffset = 0.07,
|
|
||||||
zOffset = 0.03,
|
|
||||||
claims = { false, true, false, false }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
guid = 'bd0ff4',
|
|
||||||
origin = { x = -54.42, y = 0, z = -20.96 },
|
|
||||||
scale = { x = 36.63, y = 5.10, z = 14.59 },
|
|
||||||
orientation = { x = 0, y = 270, z = 0 },
|
|
||||||
minX = -61.4,
|
|
||||||
maxX = -48.6,
|
|
||||||
minZ = -24.53,
|
|
||||||
maxZ = 2.39,
|
|
||||||
xOffset = 0.07,
|
|
||||||
zOffset = 0.02,
|
|
||||||
claims = { false, false, true, false }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
guid = '0840d5',
|
|
||||||
origin = { x = -25.00, y = 0, z = -26.60 },
|
|
||||||
scale = { x = 31.5, y = 5.10, z = 14.59 },
|
|
||||||
orientation = { x = 0, y = 180, z = 0 },
|
|
||||||
minX = -44.43,
|
|
||||||
maxX = -17.44,
|
|
||||||
minZ = -32.97,
|
|
||||||
maxZ = -20.17,
|
|
||||||
xOffset = 0.07,
|
|
||||||
zOffset = -0.06,
|
|
||||||
claims = { false, false, false, true }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
editing = false
|
-- index 0: Full Area
|
||||||
claiming = false
|
buttonParameters.tooltip = "Display full overlay"
|
||||||
selectedEditButton = -1
|
buttonParameters.click_function = "displayFull"
|
||||||
editPos = { 0, 0, 0 }
|
buttonParameters.position = { x = 0, y = 0.1, z = -0.63 }
|
||||||
editPitch = 0
|
buttonParameters.height = 70
|
||||||
editYaw = 0
|
buttonParameters.width = 700
|
||||||
editDistance = 0
|
buttonParameters.color = { 1, 0, 0, 0 }
|
||||||
|
self.createButton(buttonParameters)
|
||||||
|
|
||||||
if saved_data ~= "" then
|
-- index 1: Play Area
|
||||||
local loaded_data = JSON.decode(saved_data)
|
buttonParameters.tooltip = "Display only play area"
|
||||||
cameraParams = loaded_data.cameras
|
buttonParameters.click_function = "displayPlayArea"
|
||||||
fullVisibility = loaded_data.fullVis
|
buttonParameters.position = { x = 0, y = 0.1, z = -0.39 }
|
||||||
playVisibility = loaded_data.playVis
|
self.createButton(buttonParameters)
|
||||||
|
|
||||||
|
-- index 2: Close Overlay
|
||||||
|
buttonParameters.tooltip = "Close overlay"
|
||||||
|
buttonParameters.click_function = "closeOverlay"
|
||||||
|
buttonParameters.position = { x = 0, y = 0.1, z = -0.16 }
|
||||||
|
self.createButton(buttonParameters)
|
||||||
|
|
||||||
|
-- index 3: Modify Camera
|
||||||
|
buttonParameters.tooltip = "Modify a camera position"
|
||||||
|
buttonParameters.click_function = "beginSetCamera"
|
||||||
|
buttonParameters.position = { x = 0, y = 0.1, z = 0.19 }
|
||||||
|
self.createButton(buttonParameters)
|
||||||
|
|
||||||
|
-- index 4: Claim a color
|
||||||
|
buttonParameters.tooltip = "Claim a color (you will switch to this color when clicking in the overlay)"
|
||||||
|
buttonParameters.click_function = "beginClaimColor"
|
||||||
|
buttonParameters.width = 475
|
||||||
|
buttonParameters.position = { x = -0.22, y = 0.1, z = 0.42 }
|
||||||
|
self.createButton(buttonParameters)
|
||||||
|
|
||||||
|
-- index 4: Reset color claims
|
||||||
|
buttonParameters.tooltip = "Reset all color claims"
|
||||||
|
buttonParameters.click_function = "resetClaimColors"
|
||||||
|
buttonParameters.width = 230
|
||||||
|
buttonParameters.position = { x = 0.48, y = 0.1, z = 0.42 }
|
||||||
|
self.createButton(buttonParameters)
|
||||||
|
|
||||||
|
-- index 5: Reset camera positions
|
||||||
|
buttonParameters.tooltip = "Reset camera positions to default"
|
||||||
|
buttonParameters.click_function = "resetCameras"
|
||||||
|
buttonParameters.width = 700
|
||||||
|
buttonParameters.position = { x = 0, y = 0.1, z = 0.78 }
|
||||||
|
self.createButton(buttonParameters)
|
||||||
|
|
||||||
|
if savedData ~= "" then
|
||||||
|
local loadedData = JSON.decode(savedData)
|
||||||
|
cameraParams = loadedData.cameras
|
||||||
|
fullVisibility = loadedData.fullVis
|
||||||
|
playVisibility = loadedData.playVis
|
||||||
|
|
||||||
for i = 1, 4 do
|
for i = 1, 4 do
|
||||||
playermatData[i].claims = loaded_data.claims[i]
|
playermatData[i].claims = loadedData.claims[i]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
cameraParams = { {}, {}, {}, {} }
|
cameraParams = { {}, {}, {}, {} }
|
||||||
|
|
||||||
for cam = 1, 4 do
|
for i = 1, 4 do
|
||||||
cameraParams[cam] = {}
|
for j = 1, #defaultCameraParams do
|
||||||
|
cameraParams[i][j] = defaultCameraParams[j]
|
||||||
for i = 1, cameraCount do
|
|
||||||
cameraParams[cam][i] = {}
|
|
||||||
cameraParams[cam][i].position = defaultCameraParams[i].position
|
|
||||||
cameraParams[cam][i].pitch = defaultCameraParams[i].pitch
|
|
||||||
cameraParams[cam][i].yaw = defaultCameraParams[i].yaw
|
|
||||||
cameraParams[cam][i].distance = defaultCameraParams[i].distance
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -230,7 +198,7 @@ function onLoad(saved_data)
|
|||||||
playVisibility = { false, false, false, false }
|
playVisibility = { false, false, false, false }
|
||||||
end
|
end
|
||||||
|
|
||||||
resetOverlay()
|
updateOverlay()
|
||||||
end
|
end
|
||||||
|
|
||||||
function onSave()
|
function onSave()
|
||||||
@ -244,55 +212,39 @@ function onSave()
|
|||||||
cameras = cameraParams,
|
cameras = cameraParams,
|
||||||
fullVis = fullVisibility,
|
fullVis = fullVisibility,
|
||||||
playVis = playVisibility,
|
playVis = playVisibility,
|
||||||
claims = allclaims
|
claims = allclaims
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function displayFull(object, color)
|
function displayFull(_, color)
|
||||||
local playerCount = getPlayerCount()
|
setVisibility("full", color)
|
||||||
local colors
|
|
||||||
|
|
||||||
if playerCount == 0 then
|
|
||||||
return
|
|
||||||
elseif playerCount == 1 then
|
|
||||||
colors = { 1, 2, 3, 4 }
|
|
||||||
else
|
|
||||||
colors = { getIndexForPlayerColor(color) }
|
|
||||||
end
|
|
||||||
|
|
||||||
for i, v in ipairs(colors) do
|
|
||||||
if v > 0 then
|
|
||||||
fullVisibility[v] = true
|
|
||||||
playVisibility[v] = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
resetOverlay()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function displayPlayArea(object, color)
|
function displayPlayArea(_, color)
|
||||||
local playerCount = getPlayerCount()
|
setVisibility("play", color)
|
||||||
local colors
|
end
|
||||||
|
|
||||||
if playerCount == 0 then
|
function setVisibility(type, color)
|
||||||
return
|
local colors = getColors(color)
|
||||||
elseif playerCount == 1 then
|
local visibility
|
||||||
colors = { 1, 2, 3, 4 }
|
|
||||||
|
if type == "full" then
|
||||||
|
visibility = {full = true, play = false}
|
||||||
else
|
else
|
||||||
colors = { getIndexForPlayerColor(color) }
|
visibility = {full = false, play = true}
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, v in ipairs(colors) do
|
for _, v in ipairs(colors) do
|
||||||
if v > 0 then
|
if v > 0 then
|
||||||
fullVisibility[v] = false
|
fullVisibility[v] = visibility.full
|
||||||
playVisibility[v] = true
|
playVisibility[v] = visibility.play
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resetOverlay()
|
updateOverlay()
|
||||||
end
|
end
|
||||||
|
|
||||||
function resetCameras(object, color)
|
function getColors(color)
|
||||||
local playerCount = getPlayerCount()
|
local playerCount = getPlayerCount()
|
||||||
local colors
|
local colors
|
||||||
|
|
||||||
@ -303,6 +255,11 @@ function resetCameras(object, color)
|
|||||||
else
|
else
|
||||||
colors = { getIndexForPlayerColor(color) }
|
colors = { getIndexForPlayerColor(color) }
|
||||||
end
|
end
|
||||||
|
return colors
|
||||||
|
end
|
||||||
|
|
||||||
|
function resetCameras(_, color)
|
||||||
|
local colors = getColors(color)
|
||||||
|
|
||||||
for iv, v in ipairs(colors) do
|
for iv, v in ipairs(colors) do
|
||||||
if v > 0 then
|
if v > 0 then
|
||||||
@ -317,19 +274,7 @@ function resetCameras(object, color)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function closeOverlay(object, color)
|
function closeOverlay(object, color)
|
||||||
local playerCount = getPlayerCount()
|
local colors = getColors(color)
|
||||||
local colors
|
|
||||||
|
|
||||||
editing = false
|
|
||||||
claiming = false
|
|
||||||
|
|
||||||
if playerCount == 0 then
|
|
||||||
return
|
|
||||||
elseif playerCount == 1 then
|
|
||||||
colors = { 1, 2, 3, 4 }
|
|
||||||
else
|
|
||||||
colors = { getIndexForPlayerColor(color) }
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, v in ipairs(colors) do
|
for _, v in ipairs(colors) do
|
||||||
if v > 0 then
|
if v > 0 then
|
||||||
@ -338,20 +283,11 @@ function closeOverlay(object, color)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resetOverlay()
|
updateOverlay()
|
||||||
end
|
end
|
||||||
|
|
||||||
function resizeOverlay(object, color)
|
function resizeOverlay(object, color)
|
||||||
local playerCount = getPlayerCount()
|
local colors = getColors(color)
|
||||||
local colors
|
|
||||||
|
|
||||||
if playerCount == 0 then
|
|
||||||
return
|
|
||||||
elseif playerCount == 1 then
|
|
||||||
colors = { 1, 2, 3, 4 }
|
|
||||||
else
|
|
||||||
colors = { getIndexForPlayerColor(color) }
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, v in ipairs(colors) do
|
for _, v in ipairs(colors) do
|
||||||
if v > 0 then
|
if v > 0 then
|
||||||
@ -361,37 +297,12 @@ function resizeOverlay(object, color)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resetOverlay()
|
updateOverlay()
|
||||||
end
|
end
|
||||||
|
|
||||||
function resetOverlay()
|
function updateOverlay()
|
||||||
local guid = self.getGUID()
|
local color, panel
|
||||||
local color
|
local xml = self.UI.getXml()
|
||||||
local panel
|
|
||||||
local existingXml = UI.getXml()
|
|
||||||
local openingXml = ''
|
|
||||||
|
|
||||||
-- try to only remove our panels
|
|
||||||
for p = 1, 2 do
|
|
||||||
i, j = string.find(existingXml, '<Panel id="navPanel')
|
|
||||||
|
|
||||||
if i and i > 1 and string.len(openingXml) == 0 then
|
|
||||||
openingXml = string.sub(existingXml, 1, i - 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
if i then
|
|
||||||
local panelXml = string.sub(existingXml, i)
|
|
||||||
k, m = string.find(panelXml, '</Panel>')
|
|
||||||
|
|
||||||
existingXml = string.sub(panelXml, m + 1)
|
|
||||||
else
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local xml = openingXml .. [[
|
|
||||||
]] .. existingXml
|
|
||||||
|
|
||||||
local fullColors = ''
|
local fullColors = ''
|
||||||
local playColors = ''
|
local playColors = ''
|
||||||
|
|
||||||
@ -418,15 +329,12 @@ function resetOverlay()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if string.len(fullColors) > 0 then
|
if string.len(fullColors) > 0 then
|
||||||
data = fullButtonData
|
-- TODO update visibility
|
||||||
|
xml = xml .. [[<Panel id="navPanelFull" height="358" width="455" visibility="]] .. fullColors ..
|
||||||
xml = xml ..
|
|
||||||
[[<Panel id="navPanelFull" height="358" width="455" visibility="]] ..
|
|
||||||
fullColors ..
|
|
||||||
[[" allowDragging="true" returnToOriginalPositionWhenReleased="false" rectAlignment="LowerRight" offsetXY="-40 0">
|
[[" allowDragging="true" returnToOriginalPositionWhenReleased="false" rectAlignment="LowerRight" offsetXY="-40 0">
|
||||||
<image id="backgroundImage" image="OverlayLarge" />]]
|
<image id="backgroundImage" image="OverlayLarge" />]]
|
||||||
|
|
||||||
for _, d in ipairs(data) do
|
for _, d in ipairs(fullButtonData) do
|
||||||
local buttonID = tonumber(d.id)
|
local buttonID = tonumber(d.id)
|
||||||
|
|
||||||
if editing and buttonID < 19 then
|
if editing and buttonID < 19 then
|
||||||
@ -447,27 +355,21 @@ function resetOverlay()
|
|||||||
color = "rgba(0,1,0,0)"
|
color = "rgba(0,1,0,0)"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- TODO button creation
|
||||||
xml = xml .. [[<button
|
xml = xml .. [[<button
|
||||||
onClick="]] .. guid .. [[/buttonClicked"
|
onClick="buttonClicked" id="]] .. d.id .. [["
|
||||||
id="]] .. d.id .. [["
|
|
||||||
height="]] .. d.height .. [["
|
height="]] .. d.height .. [["
|
||||||
width="]] .. d.width .. [["
|
width="]] .. d.width .. [["
|
||||||
offsetXY="]] .. d.offsetX .. " " .. d.offsetY .. [["
|
offsetXY="]] .. d.offsetX .. " " .. d.offsetY .. [["
|
||||||
color="]] .. color .. [["
|
color="]] .. color .. [["></button>]]
|
||||||
>
|
|
||||||
</button>
|
|
||||||
]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
xml = xml .. [[ </Panel>]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if string.len(playColors) > 0 then
|
if string.len(playColors) > 0 then
|
||||||
data = playButtonData
|
data = playButtonData
|
||||||
|
|
||||||
xml = xml .. [[
|
-- TODO update visibility
|
||||||
<Panel id="navPanelPlay" height="208" width="205" visibility="]] ..
|
xml = xml .. [[<Panel id="navPanelPlay" height="208" width="205" visibility="]] .. playColors ..
|
||||||
playColors ..
|
|
||||||
[[" allowDragging="true" returnToOriginalPositionWhenReleased="false" rectAlignment="LowerRight" offsetXY="-40 0">
|
[[" allowDragging="true" returnToOriginalPositionWhenReleased="false" rectAlignment="LowerRight" offsetXY="-40 0">
|
||||||
<image id="backgroundImage" image="OverlaySmall" />]]
|
<image id="backgroundImage" image="OverlaySmall" />]]
|
||||||
|
|
||||||
@ -492,56 +394,19 @@ function resetOverlay()
|
|||||||
color = "rgba(0,1,0,0)"
|
color = "rgba(0,1,0,0)"
|
||||||
end
|
end
|
||||||
|
|
||||||
xml = xml .. [[<button
|
-- TODO button creation
|
||||||
onClick="]] .. guid .. [[/buttonClicked"
|
xml = xml .. [[<button onClick="buttonClicked" id="]] .. d.id .. [["
|
||||||
id="]] .. d.id .. [["
|
|
||||||
height="]] .. d.height .. [["
|
height="]] .. d.height .. [["
|
||||||
width="]] .. d.width .. [["
|
width="]] .. d.width .. [["
|
||||||
offsetXY="]] .. d.offsetX .. " " .. d.offsetY .. [["
|
offsetXY="]] .. d.offsetX .. " " .. d.offsetY .. [["
|
||||||
color="]] .. color .. [["
|
color="]] .. color .. [["></button>]]
|
||||||
>
|
|
||||||
</button>
|
|
||||||
]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
xml = xml .. [[ </Panel>]]
|
xml = xml .. [[ </Panel>]]
|
||||||
end
|
end
|
||||||
|
|
||||||
local existingAssets = UI.getCustomAssets()
|
|
||||||
local largeOverlay = nil
|
|
||||||
local smallOverlay = nil
|
|
||||||
|
|
||||||
for _, v in pairs(existingAssets) do
|
|
||||||
for _, vv in pairs(v) do
|
|
||||||
if vv == 'OverlayLarge' then
|
|
||||||
largeOverlay = v
|
|
||||||
end
|
|
||||||
if vv == 'OverlaySmall' then
|
|
||||||
smallOverlay = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local largeURL = 'http://cloud-3.steamusercontent.com/ugc/2021591230441678995/7B413A821136969D8723687A2AD66773B3F8FEED/'
|
|
||||||
local smallURL = 'http://cloud-3.steamusercontent.com/ugc/2021591230447630077/18C86248B9BDAF1DE01B67791439A39EE4F97B60/'
|
|
||||||
|
|
||||||
if largeOverlay == nil then
|
|
||||||
largeOverlay = { name = 'OverlayLarge', url = largeURL }
|
|
||||||
table.insert(existingAssets, largeOverlay)
|
|
||||||
else
|
|
||||||
largeOverlay.url = largeURL
|
|
||||||
end
|
|
||||||
|
|
||||||
if smallOverlay == nil then
|
|
||||||
smallOverlay = { name = 'OverlaySmall', url = smallURL }
|
|
||||||
table.insert(existingAssets, smallOverlay)
|
|
||||||
else
|
|
||||||
smallOverlay.url = smallURL
|
|
||||||
end
|
|
||||||
|
|
||||||
UI.setXml(xml, existingAssets)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- handles all button clicks
|
||||||
function buttonClicked(player, _, idValue)
|
function buttonClicked(player, _, idValue)
|
||||||
local buttonID = tonumber(idValue)
|
local buttonID = tonumber(idValue)
|
||||||
|
|
||||||
@ -558,16 +423,9 @@ function buttonClicked(player, _, idValue)
|
|||||||
selectedEditButton = buttonID
|
selectedEditButton = buttonID
|
||||||
else
|
else
|
||||||
if buttonID == selectedEditButton and editDistance > 0 then
|
if buttonID == selectedEditButton and editDistance > 0 then
|
||||||
local playerCount = getPlayerCount()
|
local colors = getColors(color)
|
||||||
local colors
|
|
||||||
|
|
||||||
if playerCount == 1 then
|
for _, v in ipairs(colors) do
|
||||||
colors = { 1, 2, 3, 4 }
|
|
||||||
else
|
|
||||||
colors = { getIndexForPlayerColor(player.color) }
|
|
||||||
end
|
|
||||||
|
|
||||||
for i, v in ipairs(colors) do
|
|
||||||
cameraParams[v][selectedEditButton].position = editPos
|
cameraParams[v][selectedEditButton].position = editPos
|
||||||
cameraParams[v][selectedEditButton].pitch = editPitch
|
cameraParams[v][selectedEditButton].pitch = editPitch
|
||||||
cameraParams[v][selectedEditButton].yaw = editYaw
|
cameraParams[v][selectedEditButton].yaw = editYaw
|
||||||
@ -579,7 +437,7 @@ function buttonClicked(player, _, idValue)
|
|||||||
selectedEditButton = -1
|
selectedEditButton = -1
|
||||||
end
|
end
|
||||||
|
|
||||||
resetOverlay()
|
updateOverlay()
|
||||||
elseif claiming then
|
elseif claiming then
|
||||||
if buttonID >= 3 and buttonID <= 6 then
|
if buttonID >= 3 and buttonID <= 6 then
|
||||||
local colorID = buttonID - 2
|
local colorID = buttonID - 2
|
||||||
@ -607,7 +465,7 @@ function buttonClicked(player, _, idValue)
|
|||||||
end
|
end
|
||||||
|
|
||||||
claiming = false
|
claiming = false
|
||||||
resetOverlay()
|
updateOverlay()
|
||||||
else
|
else
|
||||||
loadCamera(player, _, idValue)
|
loadCamera(player, _, idValue)
|
||||||
end
|
end
|
||||||
@ -619,7 +477,7 @@ function loadCamera(player, _, idValue)
|
|||||||
local playerIndex = getIndexForPlayerColor(playerColor)
|
local playerIndex = getIndexForPlayerColor(playerColor)
|
||||||
|
|
||||||
-- only do map zooming if the camera hasn't been specially set by user
|
-- only do map zooming if the camera hasn't been specially set by user
|
||||||
if index == 2 and cameraParams[playerIndex][index].distance <= 0.0 then
|
if index == 2 and cameraParams[playerIndex][index].distance <= 0 then
|
||||||
local mapObjects = Physics.cast({
|
local mapObjects = Physics.cast({
|
||||||
origin = { x = -29.2, y = 0, z = 0.0 },
|
origin = { x = -29.2, y = 0, z = 0.0 },
|
||||||
direction = { x = 0, y = 1, z = 0 },
|
direction = { x = 0, y = 1, z = 0 },
|
||||||
@ -683,7 +541,7 @@ function loadCamera(player, _, idValue)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if cameraParams[newMatIndex][index].distance <= 0.0 then
|
if cameraParams[newMatIndex][index].distance <= 0 then
|
||||||
local matObjects = Physics.cast({
|
local matObjects = Physics.cast({
|
||||||
origin = playermatData[newMatIndex].origin,
|
origin = playermatData[newMatIndex].origin,
|
||||||
direction = { x = 0, y = 1, z = 0 },
|
direction = { x = 0, y = 1, z = 0 },
|
||||||
@ -737,13 +595,10 @@ function loadCamera(player, _, idValue)
|
|||||||
local d = 0.64 * scale + 7
|
local d = 0.64 * scale + 7
|
||||||
|
|
||||||
-- need to wait if the player color changed
|
-- need to wait if the player color changed
|
||||||
Wait.frames(function()
|
Wait.frames(
|
||||||
player.lookAt({ position = { centerX, 0, centerZ }, pitch = 75.823, yaw = yaw, distance = d })
|
function() player.lookAt({ position = { centerX, 0, centerZ }, pitch = 75.823, yaw = yaw, distance = d }) end, 2)
|
||||||
end, 2)
|
|
||||||
else
|
else
|
||||||
Wait.frames(function()
|
Wait.frames(function() player.lookAt(cameraParams[newMatIndex][index]) end, 2)
|
||||||
player.lookAt(cameraParams[newMatIndex][index])
|
|
||||||
end, 2)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
player.lookAt(cameraParams[playerIndex][index])
|
player.lookAt(cameraParams[playerIndex][index])
|
||||||
@ -758,7 +613,7 @@ function beginSetCamera(object, color)
|
|||||||
end
|
end
|
||||||
|
|
||||||
editing = true
|
editing = true
|
||||||
resetOverlay()
|
updateOverlay()
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateEditCamera(params)
|
function updateEditCamera(params)
|
||||||
@ -776,7 +631,7 @@ function beginClaimColor(object, color)
|
|||||||
end
|
end
|
||||||
|
|
||||||
claiming = true
|
claiming = true
|
||||||
resetOverlay()
|
updateOverlay()
|
||||||
end
|
end
|
||||||
|
|
||||||
function resetClaimColors(object, color)
|
function resetClaimColors(object, color)
|
||||||
|
Loading…
Reference in New Issue
Block a user