Code: Select all
function gtkDidLoad()
------------ small grafic objects
GTK.Core.GUI:addImage({ name="balance_button", path="mod_assets/textures/balance_button.tga", origin={0, 0}, size={56, 53}, margin={10, 10, 10, 10} })
GTK.Core.GUI:addImage({ name="air_button", path="mod_assets/textures/air_button.tga", origin={0, 0}, size={56, 53}, margin={10, 10, 10, 10} })
GTK.Core.GUI:addImage({ name="spirit_button", path="mod_assets/textures/spirit_button.tga", origin={0, 0}, size={56, 53}, margin={10, 10, 10, 10} })
GTK.Core.GUI:addImage({ name="ButtonClose", path="assets/textures/gui/gui_items.tga", origin={1969, 2483}, size={110, 34}, margin={10, 10, 10, 10} })
------------ big grafic objects
GTK.Core.GUI:addImage({ name="panel-bg3", path="mod_assets/textures/dc_octogon2_panel.tga", origin={0, 0}, size={836, 949}, margin={10, 10, 10, 10} })
GTK.Core.GUI:addImage({ name="panel-bg", path="mod_assets/textures/dc_octog4_panel.tga", origin={0, 0}, size={487, 318}, margin={10, 10, 10, 10} })
-----------------------------------------------------------------------------------------------------first panel to choose the texts to show
textrecord_form = {
name = "gtk_textrecord",
type = "GWindow",
gravity = GTK.Constants.Gravity.NorthWest,
offset = {130, 0},
size = {836, 949},
bgImage = "panel-bg3",
bgDrawMode = GTK.Constants.ImageDrawMode.Stretched,
draggable = true,
children = {
{type = "GLabel",
position = {162,38},
size = {540,40},
text = "Choose your path to see the related texts",
textAlign = GTK.Constants.TextAlign.Center,
font = GTK.Constants.Fonts.Large,
},
{
type = "GPushButton",
name = "Cancel",
position = {630, 800},
size = {110, 30},
bgColor = {0, 0, 0, 0},
borders = {0, 0, 0, 0},
bgImage = "ButtonClose",
onPressed = self.go.id .. ".script.close",
},
{
type = "GPushButton",
name = "rec_up",
position = {388, 608},
size = {56, 53},
bgColor = {0,0,0,0},
borders = {0,0,0,0},
bgImage = "spirit_button",
onPressed = self.go.id .. ".script.goS",
},
{
type = "GPushButton",
name = "rec_down",
position = {385, 433},
size = {56, 53},
bgColor = {0,0,0,0},
borders = {0,0,0,0},
bgImage = "balance_button",
onPressed = self.go.id .. ".script.goB",
},
{
type = "GPushButton",
name = "rec_right",
position = {500, 313},
size = {56, 53},
bgColor = {0,0,0,0},
borders = {0,0,0,0},
bgImage = "air_button",
onPressed = self.go.id .. ".script.goA",
},
}
}
function showGui()
if ( GTK.Core.GUI:getWindow("gtk_textrecord") == nil ) then
GTK.Core.GUI:createWindow(textrecord_form)
else
GTK.Core.GUI:showWindow("gtk_textrecord")
end
end
------------------------------------------------------------------------------buttons commands
reading = false
drawFlag = true
function close(self)
GTK.Core.GUI:unlockParty()
GTK.Core.GUI:destroyWindow("gtk_textrecord")
end
function goS()
buttonpress=1
drawFlag = true
follow()
end
function goA()
buttonpress=3
drawFlag = true
follow()
end
function goB()
buttonpress=2
drawFlag = true
follow()
end
function follow()
if drawFlag then
if buttonpress == 1 then party.party:addConnector( "onDrawGui", self.go.id, "newsheetS")
elseif buttonpress == 2 then party.party:addConnector( "onDrawGui", self.go.id, "newsheetB")
elseif buttonpress == 3 then party.party:addConnector( "onDrawGui", self.go.id, "newsheetA")
end
end
end
---------------------------------------------------------------CREATE LIST of TEXTs to DISPLAY
story = 0
function newsheetS(self, context)
if drawFlag == true then
local width = context.width
local height = context.height
local offset = context.width * .05
context.drawImage2("mod_assets/textures/dc_octog4_panel.tga",5,5,0,0,487, 318, width, height)
context.drawRect(width*.9, (0.9 * height), 90, 30)
context.color(0,0,0,255)
context.drawText("CLOSE", width*.91, (0.922 * height))
context.font("large")
if ( context.button("CLOSE", width*.91, (0.92 * height), 90, 90) ) then
reading = false
story = 0
-- party.party:removeConnector( "onDrawGui", self.go.id, "newsheetS")
drawFlag = false
return
end
for i= 1, 26 do
if Stexts_toshow[i] == 1 then
context.drawParagraph(spirit_titles[i], offset, context.height * (.05 + ( .033 * i )), width*.4)
end
end
for i= 1,26 do
if ( context.button(spirit_titles[i], offset+10, context.height * (.05 + ( .033 * i )), width*.2, 20) ) then
reading = true
story = i
end
end
if reading then
context.drawParagraph(spirit_texts[story], width*.42, context.height * .1, width*.55)
end
end
end
function newsheetA(self, context)
if drawFlag == true then
local width = context.width
local height = context.height
local offset = context.width * .05
context.drawImage2("mod_assets/textures/dc_octog4_panel.tga",5,5,0,0,487, 318, width, height)
context.drawRect(width*.9, (0.9 * height), 90, 30)
context.color(0,0,0,255)
context.drawText("CLOSE", width*.91, (0.922 * height))
context.font("large")
if ( context.button("CLOSE", width*.91, (0.92 * height), 90, 90) ) then
reading = false
story = 0
-- party.party:removeConnector("onDrawGui", self.go.id, "newsheetA")
drawFlag = false
return
end
for i= 1, 9 do
if Atexts_toshow[i] == 1 then
context.drawParagraph(air_titles[i], offset, context.height * (.05 + ( .033 * i )), width*.4)
end
end
for i= 1, 9 do
if ( context.button(air_titles[i], offset+10, context.height * (.05 + ( .033 * i )), width*.2, 20) ) then
reading = true
story = i
end
end
if reading then
context.drawParagraph(air_texts[story], width*.42, context.height * .1, width*.55)
end
end
end
function newsheetB(self, context)
if drawFlag == true then
local width = context.width
local height = context.height
local offset = context.width * .05
context.drawImage2("mod_assets/textures/dc_octog4_panel.tga",5,5,0,0,487, 318, width, height)
context.drawRect(width*.9, (0.9 * height), 90, 30)
context.color(0,0,0,255)
context.drawText("CLOSE", width*.91, (0.922 * height))
context.font("large")
if ( context.button("CLOSE", width*.91, (0.92 * height), 90, 90) ) then
reading = false
story = 0
-- party.party:removeConnector( "onDrawGui", self.go.id, "newsheetB")
drawFlag = false
return
end
for i= 1, 12 do
if Btexts_toshow[i] == 1 then
context.drawParagraph(balance_titles[i], offset, context.height * (.05 + ( .033 * i )), width*.4)
end
end
for i= 1, 12 do
if ( context.button(balance_titles[i], offset+10, context.height * (.05 + ( .033 * i )), width*.2, 20) ) then
reading = true
story = i
end
end
if reading then
context.drawParagraph(balance_texts[story], width*.42, context.height * .1, width*.55)
end
end
end
---------------------------------------------TEXTS LIBRARY
----------------------------------------------------------------------------------------------------
spirit_texts = { }
spirit_titles = { }
air_texts = { }
air_titles = { }
balance_texts = { }
balance_titles = { }
-----------------------------------------------------------------------SPIRIT TEXTS
spirit_titles[1] = "Watchman's warning (Under Wreck Cape)"
spirit_texts[1] = "I placed here numerous documents which will be useful for you if you decide to \
help Edenia to find its past magnificence. In case you would prefer to find as quickly as possible \
your homes without caring you of these sorry lands, I left you a map which can help you there. \
But I have to warn you: any life here will be hostile to you and to cross these lands will be anyway a \
precarious journey. In the doubt, I protected some of this information as well as equipments which I \
reserve for those who will accept this mission. You will excuse me, it was the only way to assure me \
that all this would be of use to the revival of Edenia. \
\
The WATCHMAN"
----------------------------------------------------------and so on
end