Fixed Threading errors
Fixed an error where corotuine.yeild was being called outside of a thread Weworked the text display manager and input manager A graphical redesgin of the inputbox and choices are on the TODO list
This commit is contained in:
parent
1b8f63563f
commit
f21e52b15e
@ -1,6 +1,6 @@
|
||||
LOAD gamedata/lobby.txt
|
||||
[CONFIG]{
|
||||
//newThread("THREAD") // Starts a thread that handles events and stuff... Just throw this in and things flow nicely
|
||||
newThread("THREAD") // Starts a thread that handles events and stuff... Just throw this in and things flow nicely
|
||||
SND_ELEVATOR_BG=loadAudio("audio/elevator.ogg")
|
||||
SND_ELEVATOR_OPEN_CLOSE=loadAudio("audio/elevator_open_close.mp3")
|
||||
SND_ROPE_CRACKING=loadAudio("audio/rope_cracking.mp3")
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
//SND_ROPE_CRACKING
|
||||
//SND_FOOTSTEPS
|
||||
[LOBBY]{
|
||||
name=getInput("What is your name: ")
|
||||
"Yo $name$ enjoy the game"
|
||||
BG("images/elevator-lobby.jpg")
|
||||
"Abby: Oh no I'm running late!"
|
||||
"Abby: I hope I make my interview"
|
||||
|
||||
@ -20,11 +20,7 @@ parseManager:define{
|
||||
inputBox.message.text=msg
|
||||
inputBox.Visible=true
|
||||
go.Visible=false
|
||||
self.handle:Pause()
|
||||
while _inputvar==nil do
|
||||
multi:lManager()
|
||||
end
|
||||
self.handle:Resume()
|
||||
thread.hold(function() return _inputvar~=nil end)
|
||||
local i=_inputvar
|
||||
_inputvar=nil
|
||||
inputBox.Visible=false
|
||||
@ -59,8 +55,7 @@ parseManager:define{
|
||||
end
|
||||
end,
|
||||
sleep=function(self,n)
|
||||
local num=n
|
||||
self.handle:hold(num)
|
||||
thread.sleep(n)
|
||||
end,
|
||||
fadeSong=function(self,item)
|
||||
self.handle:Pause()
|
||||
@ -142,12 +137,10 @@ parseManager:define{
|
||||
item:Reset()
|
||||
end,
|
||||
setImage=function(self,item,path)
|
||||
smartPrint(item)
|
||||
item:SetImage(path)
|
||||
end,
|
||||
setText=function(self,item,text)
|
||||
if type(item)=="string" then
|
||||
print(actor)
|
||||
self:pushError("item must be a gui object!")
|
||||
end
|
||||
item.text=text
|
||||
@ -188,11 +181,6 @@ parseManager:define{
|
||||
local ThreadTest=parseManager:load(blocklink.chunks[block].path)
|
||||
ThreadTest.mainENV=blocklink.mainENV
|
||||
ThreadTest.handle=loop
|
||||
ThreadTest:define{
|
||||
sleep=function(self,n)
|
||||
thread.sleep(n)
|
||||
end
|
||||
}
|
||||
local t=ThreadTest:next(block)
|
||||
while true do
|
||||
if t.Type=="text" then
|
||||
@ -219,7 +207,6 @@ core.chatFrame.textHolder.Visibility=0
|
||||
core.chatFrame.textHolder.text=""
|
||||
core.chatFrame.textHolder.TextFormat="left"
|
||||
test=parseManager:load("init.txt")
|
||||
table.print(test)
|
||||
--~ print("DUMP:")
|
||||
dump=test:dump()
|
||||
print(dump)
|
||||
@ -228,13 +215,17 @@ test.mainENV["gui"]=workspace
|
||||
test.mainENV["menu"]=top
|
||||
go=core.chatFrame.textHolder:newImageButton("images/arrow.png",-25,-25,20,20,1,1)
|
||||
go:OnReleased(function(b,self)
|
||||
dialogeHandler:Resume()
|
||||
ready=true
|
||||
end)
|
||||
dialogeHandler=multi:newLoop(function(self,ti)
|
||||
--dialogeHandler=multi:newLoop(function(self,ti)
|
||||
ready=false
|
||||
multi:newThread("TextHandler",function()
|
||||
while true do
|
||||
t=test:next()
|
||||
if t.Type=="text" then
|
||||
core.chatFrame.textHolder.text=t.text
|
||||
self:Pause()
|
||||
ready=false
|
||||
thread.hold(function() return ready==true end)
|
||||
elseif t.Type=="choice" then
|
||||
go.Visible=false
|
||||
local choiceframe=gui:newFrame("",0,0,300,(#t+1)*40-10)
|
||||
@ -249,17 +240,15 @@ dialogeHandler=multi:newLoop(function(self,ti)
|
||||
end
|
||||
choiceframe:centerX()
|
||||
choiceframe:centerY()
|
||||
self:Pause()
|
||||
while choicemade==nil do
|
||||
multi:lManager()
|
||||
end
|
||||
self:Resume()
|
||||
thread.hold(function() return choicemade~=nil end)
|
||||
go.Visible=true
|
||||
choiceframe:Destroy()
|
||||
local cm=choicemade
|
||||
choicemade=nil
|
||||
t=test:next(nil,cm)
|
||||
end
|
||||
thread.sleep(.001)
|
||||
end
|
||||
end)
|
||||
test.handle=dialogeHandler
|
||||
inputBox=gui:newFrame(0,0,500,160)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user