Advertisement
MrStump

Fix for buttons on Universal Table

Apr 15th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1. --Button creation, trigger is in onload()
  2. function createButtons()
  3.     --Card count displays, get created first so they have index of 0 on their zones
  4.     for i, v in ipairs(objectSets) do
  5.         --local pos = {0,-1.7,3} if i==1 then pos = {0.07,-1.7,-2.865} end
  6.         local cScale = v.z.getScale()
  7.         local dScale = {x=1/cScale.x, y=1/cScale.y, z=1/cScale.z}
  8.  
  9.         local pos = {0*dScale.x,-1.7*dScale.y,3*dScale.z}
  10.         if i==1 then
  11.             pos = {0.05*dScale.x,-1.7*dScale.y,-2.85*dScale.z}
  12.         end
  13.         local rot = {0,180,0}
  14.  
  15.         v.z.createButton({
  16.             label="99", click_function="hitCard", function_owner=nil,
  17.             position=pos, rotation=rot, height=500, width=500, font_size=300,
  18.             scale=dScale
  19.         })
  20.     end
  21.     --Pay or clear bet buttons
  22.     for i, v in ipairs(objectSets) do
  23.         local cScale = v.z.getScale()
  24.         local dScale = {x=1/cScale.x, y=1/cScale.y, z=1/cScale.z}
  25.         if i > 1 then
  26.             v.z.createButton({
  27.                 label="Clear", click_function="clearBet", function_owner=nil,
  28.                 position={1*dScale.x,-1.7*dScale.y,3*dScale.z},
  29.                 rotation={0,180,0}, height=400, width=400, font_size=140,
  30.                 scale=dScale
  31.             })
  32.             v.z.createButton({
  33.                 label="Pay", click_function="payBet", function_owner=nil,
  34.                 position={-1*dScale.x,-1.7*dScale.y,3*dScale.z},
  35.                 rotation={0,180,0}, height=400, width=400, font_size=140,
  36.                 scale=dScale
  37.             })
  38.         end
  39.     end
  40.     --Deal and deck buttons
  41.     cardHandler.createButton({
  42.         label="Deal\nCards", click_function="dealButtonPressed", function_owner=nil,
  43.         position={0,0.19,0}, rotation={0,0,0}, width=450, height=450, font_size=150
  44.     })
  45.     cardHandler.createButton({
  46.         label="New\nDeck", click_function="newDeck", function_owner=nil,
  47.         position={0.9,0.19,0}, rotation={0,0,0}, width=450, height=450, font_size=150
  48.     })
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement