安装 Steam						
					
				
				
									登录
											 | 
						语言
						
																																															繁體中文(繁体中文)
																													日本語(日语)
																													한국어(韩语)
																													ไทย(泰语)
																													български(保加利亚语)
																													Čeština(捷克语)
																													Dansk(丹麦语)
																													Deutsch(德语)
																													English(英语)
																													Español-España(西班牙语 - 西班牙)
																													Español - Latinoamérica(西班牙语 - 拉丁美洲)
																													Ελληνικά(希腊语)
																													Français(法语)
																													Italiano(意大利语)
																													Bahasa Indonesia(印度尼西亚语)
																													Magyar(匈牙利语)
																													Nederlands(荷兰语)
																													Norsk(挪威语)
																													Polski(波兰语)
																													Português(葡萄牙语 - 葡萄牙)
																													Português-Brasil(葡萄牙语 - 巴西)
																													Română(罗马尼亚语)
																													Русский(俄语)
																													Suomi(芬兰语)
																													Svenska(瑞典语)
																													Türkçe(土耳其语)
																													Tiếng Việt(越南语)
																													Українська(乌克兰语)
																									报告翻译问题
							
						
 
											 
													

 39
 39								 
					




 举报此帖
 举报此帖


Это затратно, и будет загружать игру
там при нажатии вещи раскладываются по столу, но при этом все и все при загрузке лежит в мешочках
удобно
-- Universal Counter Tokens
--Saves the count value into a table (data_to_save) then encodes it into the Tabletop save
function onSave()
local data_to_save = {saved_count = count}
saved_data = JSON.encode(data_to_save)
return saved_data
end
--Loads the saved data then creates the buttons
function onload(saved_data)
generateButtonParamiters()
--Checks if there is a saved data. If there is, it gets the saved value for 'count'
if saved_data != '' then
local loaded_data = JSON.decode(saved_data)
count = loaded_data.saved_count
else
--If there wasn't saved data, the default value is set to 10.
count = 10
end
--Generates the buttons after putting the count value onto the 'display' button
b_display.label = tostring(count)
if count >= 100 then
b_display.font_size = 100
else
b_display.font_size = 100
end
self.createButton(b_display)
self.createButton(b_plus)
self.createButton(b_minus)
self.createButton(b_plus5)
self.createButton(b_minus5)
self.createButton(b_plus100)
self.createButton(b_minus100)
self.createButton(b_plus1000)
self.createButton(b_minus1000)
end
--Activates when + is hit. Adds 1 to 'count' then updates the display button.
function increase()
count = count + 1
updateDisplay()
end
--Activates when - is hit. Subtracts 1 from 'count' then updates the display button.
function decrease()
--Prevents count from going below 0
if count > 0 then
count = count - 1
updateDisplay()
end
end
--Activates when + is hit. Adds 5 to 'count' then updates the display button.
function increase5()
count = count + 10
updateDisplay()
end
--Activates when + is hit. Adds 5 to 'count' then updates the display button.
function increase1000()
count = count + 1000
updateDisplay()
end
--Activates when - is hit. Subtracts 5 from 'count' then updates the display button.
function decrease5()
--Prevents count from going below 0
if count > 9 then
count = count - 10
else
count = 0
end
updateDisplay()
end
function increase100()
count = count + 100
updateDisplay()
end
--Activates when - is hit. Subtracts 5 from 'count' then updates the display button.
function decrease100()
--Prevents count from going below 0
if count > 99 then
count = count - 100
else
count = 0
end
updateDisplay()
end
--Activates when - is hit. Subtracts 5 from 'count' then updates the display button.
function decrease1000()
--Prevents count from going below 0
if count > 999 then
count = count - 1000
else
count = 0
end
updateDisplay()
end
function customSet()
local description = self.getDescription()
if description != '' and type(tonumber(description)) == 'number' then
self.setDescription('')
count = tonumber(description)
updateDisplay()
end
end
--function that updates the display. I trigger it whenever I change 'count'
function updateDisplay()
--If statement to resize font size if it gets too long
if count >= 100 then
b_display.font_size = 100
else
b_display.font_size = 100
end
b_display.label = tostring(count)
self.editButton(b_display)
end
--This is activated when onload runs. This sets all paramiters for our buttons.
--I do not have to put this all into a function, but I prefer to do it this way.
function generateButtonParamiters()
b_display = {
index = 0, click_function = 'customSet', function_owner = self, label = '',
position = {0,0.1,0.65}, width = 325, height = 200, font_size = 10
}
b_plus = {
click_function = 'increase', function_owner = self, label = '+1',
position = {0.8,0.1,0.75}, width = 150, height = 150, font_size = 90
}
b_minus = {
click_function = 'decrease', function_owner = self, label = '-1',
position = {-0.8,0.1,0.75}, width = 150, height = 150, font_size = 90
}
b_plus5 = {
click_function = 'increase5', function_owner = self, label = '+10',
position = {0.8,0.1,0.25}, width = 150, height = 150, font_size = 90
}
b_minus5 = {
click_function = 'decrease5', function_owner = self, label = '-10',
position = {-0.8,0.1,0.25}, width = 150, height = 150, font_size = 90
}
b_plus100 = {
click_function = 'increase100', function_owner = self, label = '+100',
position = {0.78,0.1,-0.25}, width = 250, height = 150, font_size = 90
}
b_minus100 = {
click_function = 'decrease100', function_owner = self, label = '-100',
position = {-0.78,0.1,-0.25}, width = 250, height = 150, font_size = 90
}
b_plus1000 = {
click_function = 'increase1000', function_owner = self, label = '+1000',
position = {0.72,0.1,-0.75}, width = 300, height = 150, font_size = 90
}
b_minus1000 = {
click_function = 'decrease1000', function_owner = self, label = '-1000',
position = {-0.72,0.1,-0.75}, width = 300, height = 150, font_size = 90
}
end