Update 6
This commit is contained in:
parent
d3c699ac88
commit
9d1fa3ac4d
116
public/asset/6
116
public/asset/6
|
|
@ -1,17 +1,4 @@
|
||||||
%6%
|
%6%
|
||||||
function waitForProperty(instance, name)
|
|
||||||
while not instance[name] do
|
|
||||||
instance.Changed:wait()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function waitForChild(instance, name)
|
|
||||||
while not instance:FindFirstChild(name) do
|
|
||||||
instance.ChildAdded:wait()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local mainFrame
|
local mainFrame
|
||||||
local choices = {}
|
local choices = {}
|
||||||
local lastChoice
|
local lastChoice
|
||||||
|
|
@ -36,15 +23,6 @@ local reenableDialogScript
|
||||||
local dialogMap = {}
|
local dialogMap = {}
|
||||||
local dialogConnections = {}
|
local dialogConnections = {}
|
||||||
|
|
||||||
local gui = nil
|
|
||||||
waitForChild(game,"CoreGui")
|
|
||||||
waitForChild(game.CoreGui,"RobloxGui")
|
|
||||||
if game.CoreGui.RobloxGui:FindFirstChild("ControlFrame") then
|
|
||||||
gui = game.CoreGui.RobloxGui.ControlFrame
|
|
||||||
else
|
|
||||||
gui = game.CoreGui.RobloxGui
|
|
||||||
end
|
|
||||||
|
|
||||||
function currentTone()
|
function currentTone()
|
||||||
if currentConversationDialog then
|
if currentConversationDialog then
|
||||||
return currentConversationDialog.Tone
|
return currentConversationDialog.Tone
|
||||||
|
|
@ -426,7 +404,7 @@ end
|
||||||
|
|
||||||
function checkForLeaveArea()
|
function checkForLeaveArea()
|
||||||
while currentConversationDialog do
|
while currentConversationDialog do
|
||||||
if currentConversationDialog.Parent and (player:DistanceFromCharacter(currentConversationDialog.Parent.Position) >= currentConversationDialog.ConversationDistance) then
|
if player:DistanceFromCharacter(currentConversationDialog.Parent.Position) >= currentConversationDialog.ConversationDistance then
|
||||||
wanderDialog()
|
wanderDialog()
|
||||||
end
|
end
|
||||||
wait(1)
|
wait(1)
|
||||||
|
|
@ -438,7 +416,7 @@ function startDialog(dialog)
|
||||||
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
||||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for dialog, gui in pairs(dialogMap) do
|
for dialog, gui in pairs(dialogMap) do
|
||||||
if dialog and gui then
|
if dialog and gui then
|
||||||
|
|
@ -453,6 +431,19 @@ function startDialog(dialog)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function waitForProperty(instance, name)
|
||||||
|
while not instance[name] do
|
||||||
|
instance.Changed:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function waitForChild(instance, name)
|
||||||
|
while not instance:FindFirstChild(name) do
|
||||||
|
instance.ChildAdded:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function removeDialog(dialog)
|
function removeDialog(dialog)
|
||||||
if dialogMap[dialog] then
|
if dialogMap[dialog] then
|
||||||
dialogMap[dialog]:Remove()
|
dialogMap[dialog]:Remove()
|
||||||
|
|
@ -465,57 +456,43 @@ function removeDialog(dialog)
|
||||||
end
|
end
|
||||||
|
|
||||||
function addDialog(dialog)
|
function addDialog(dialog)
|
||||||
if dialog.Parent then
|
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||||
if dialog.Parent:IsA("BasePart") then
|
local chatGui = chatNotificationGui:clone()
|
||||||
local chatGui = chatNotificationGui:clone()
|
chatGui.Enabled = not dialog.InUse
|
||||||
chatGui.Enabled = not dialog.InUse
|
chatGui.Adornee = dialog.Parent
|
||||||
chatGui.Adornee = dialog.Parent
|
chatGui.RobloxLocked = true
|
||||||
chatGui.RobloxLocked = true
|
chatGui.Parent = game.CoreGui
|
||||||
chatGui.Parent = game.CoreGui
|
chatGui.Image.Button.MouseButton1Click:connect(function() startDialog(dialog) end)
|
||||||
chatGui.Image.Button.MouseButton1Click:connect(function() startDialog(dialog) end)
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
|
||||||
|
dialogMap[dialog] = chatGui
|
||||||
dialogMap[dialog] = chatGui
|
|
||||||
|
|
||||||
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
||||||
if prop == "Parent" and dialog.Parent then
|
if prop == "Parent" and dialog.Parent then
|
||||||
--This handles the reparenting case, seperate from removal case
|
--This handles the reparenting case, seperate from removal case
|
||||||
removeDialog(dialog)
|
removeDialog(dialog)
|
||||||
addDialog(dialog)
|
addDialog(dialog)
|
||||||
elseif prop == "InUse" then
|
elseif prop == "InUse" then
|
||||||
chatGui.Enabled = not currentConversationDialog and not dialog.InUse
|
chatGui.Enabled = not currentConversationDialog and not dialog.InUse
|
||||||
if dialog == currentConversationDialog then
|
if dialog == currentConversationDialog then
|
||||||
timeoutDialog()
|
timeoutDialog()
|
||||||
end
|
end
|
||||||
elseif prop == "Tone" or prop == "Purpose" then
|
elseif prop == "Tone" or prop == "Purpose" then
|
||||||
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else -- still need to listen to parent changes even if current parent is not a BasePart
|
|
||||||
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
|
||||||
if prop == "Parent" and dialog.Parent then
|
|
||||||
--This handles the reparenting case, seperate from removal case
|
|
||||||
removeDialog(dialog)
|
|
||||||
addDialog(dialog)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function fetchScripts()
|
function fetchScripts()
|
||||||
|
--print("InsertService")
|
||||||
local model = game:GetService("InsertService"):LoadAsset(39226062)
|
local model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
if type(model) == "string" then -- load failed, lets try again
|
--print(model)
|
||||||
wait(0.1)
|
while model == "No assetUrl set" do
|
||||||
|
--print("Trying again to fetch Scripts")
|
||||||
model = game:GetService("InsertService"):LoadAsset(39226062)
|
model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
end
|
end
|
||||||
if type(model) == "string" then -- not going to work, lets bail
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
waitForChild(model,"TimeoutScript")
|
|
||||||
timeoutScript = model.TimeoutScript
|
timeoutScript = model.TimeoutScript
|
||||||
waitForChild(model,"ReenableDialogScript")
|
|
||||||
reenableDialogScript = model.ReenableDialogScript
|
reenableDialogScript = model.ReenableDialogScript
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -529,14 +506,17 @@ function onLoad()
|
||||||
|
|
||||||
--print("Creating Guis")
|
--print("Creating Guis")
|
||||||
createChatNotificationGui()
|
createChatNotificationGui()
|
||||||
|
|
||||||
|
--print("Waiting for RobloxGui")
|
||||||
|
waitForChild(game.CoreGui, "RobloxGui")
|
||||||
|
|
||||||
--print("Creating MessageDialog")
|
--print("Creating MessageDialog")
|
||||||
createMessageDialog()
|
createMessageDialog()
|
||||||
messageDialog.RobloxLocked = true
|
messageDialog.RobloxLocked = true
|
||||||
messageDialog.Parent = gui
|
messageDialog.Parent = game.CoreGui.RobloxGui
|
||||||
|
|
||||||
--print("Waiting for BottomLeftControl")
|
--print("Waiting for BottomLeftControl")
|
||||||
waitForChild(gui, "BottomLeftControl")
|
waitForChild(game.CoreGui.RobloxGui, "BottomLeftControl")
|
||||||
|
|
||||||
--print("Initializing Frame")
|
--print("Initializing Frame")
|
||||||
local frame = Instance.new("Frame")
|
local frame = Instance.new("Frame")
|
||||||
|
|
@ -545,7 +525,7 @@ function onLoad()
|
||||||
frame.Size = UDim2.new(0,0,0,0)
|
frame.Size = UDim2.new(0,0,0,0)
|
||||||
frame.BackgroundTransparency = 1
|
frame.BackgroundTransparency = 1
|
||||||
frame.RobloxLocked = true
|
frame.RobloxLocked = true
|
||||||
frame.Parent = gui.BottomLeftControl
|
frame.Parent = game.CoreGui.RobloxGui.BottomLeftControl
|
||||||
initialize(frame)
|
initialize(frame)
|
||||||
|
|
||||||
--print("Adding Dialogs")
|
--print("Adding Dialogs")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue