mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-05 13:17:49 +00:00
104 lines
4.4 KiB
Lua
104 lines
4.4 KiB
Lua
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
|
-- Created by Ben T. 10/29/10
|
|
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
|
|
local scriptContext = game:GetService("ScriptContext")
|
|
local touchEnabled = game:GetService("UserInputService").TouchEnabled
|
|
|
|
local RobloxGui = Game:GetService("CoreGui"):WaitForChild("RobloxGui")
|
|
local screenGui = Game:GetService("CoreGui"):FindFirstChild("RobloxGui")
|
|
|
|
-- TopBar
|
|
local topbarSuccess, topbarFlagValue = pcall(function() return settings():GetFFlag("UseInGameTopBar") end)
|
|
local useTopBar = (topbarSuccess and topbarFlagValue == true)
|
|
if useTopBar then
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/Topbar", screenGui)
|
|
end
|
|
|
|
-- SettingsScript
|
|
local luaControlsSuccess, luaControlsFlagValue = pcall(function() return settings():GetFFlag("UseLuaCameraAndControl") end)
|
|
local newSettingsSuccess, newSettingsFlagValue = pcall(function() return settings():GetFFlag("NewMenuSettingsScript") end)
|
|
local useNewSettings = newSettingsSuccess and newSettingsFlagValue
|
|
if useNewSettings then
|
|
spawn(function() require(RobloxGui.Modules.Settings2) end)
|
|
else
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/Settings", screenGui)
|
|
end
|
|
|
|
-- Set up touch controls. TODO: Remove when new lua controls are stable.
|
|
if touchEnabled then
|
|
if not luaControlsSuccess or luaControlsFlagValue == false then
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/TouchControls", screenGui)
|
|
end
|
|
end
|
|
|
|
-- MainBotChatScript (the Lua part of Dialogs)
|
|
local useNewDialogLook = false
|
|
pcall(function() useNewDialogLook = settings():GetFFlag("UseNewBubbleSkin") end)
|
|
if useNewDialogLook then
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/MainBotChatScript2", screenGui)
|
|
else
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/MainBotChatScript", screenGui)
|
|
end
|
|
|
|
-- Developer Console Script
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/DeveloperConsole", screenGui)
|
|
|
|
-- In-game notifications script
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/NotificationScript2", screenGui)
|
|
|
|
-- Chat script
|
|
if useTopBar then
|
|
spawn(function() require(RobloxGui.Modules.Chat) end)
|
|
else
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/ChatScript2", screenGui)
|
|
end
|
|
|
|
-- Purchase Prompt Script
|
|
local newPurchaseSuccess, newPurchaseEnabled = pcall(function() return settings():GetFFlag("NewPurchaseScript") end)
|
|
local isNewPurchaseScript = newPurchaseSuccess and newPurchaseEnabled
|
|
if isNewPurchaseScript then
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/PurchasePromptScript2", screenGui)
|
|
else
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/PurchasePromptScript", screenGui)
|
|
end
|
|
-- Health Script
|
|
if not useTopBar then
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/HealthScript", screenGui)
|
|
end
|
|
|
|
local playerListSuccess, playerListFlagValue = pcall(function() return settings():GetFFlag("NewPlayerListScript") end)
|
|
local isNotSmallTouchDevice = not touchEnabled or Game:GetService("GuiService"):GetScreenResolution().Y >= 500
|
|
-- New Player List
|
|
if playerListSuccess and playerListFlagValue == true then
|
|
if useTopBar then
|
|
--spawn(function() require(RobloxGui.Modules.PlayerlistModule) end)
|
|
elseif isNotSmallTouchDevice then
|
|
--scriptContext:AddCoreScriptLocal("CoreScripts/2015/PlayerListScript2", screenGui)
|
|
end
|
|
elseif isNotSmallTouchDevice then
|
|
--scriptContext:AddCoreScriptLocal("CoreScripts/2015/PlayerListScript", screenGui)
|
|
end
|
|
|
|
do -- Backpack!
|
|
spawn(function() require(RobloxGui.Modules.BackpackScript) end)
|
|
end
|
|
|
|
local luaVehicleHudSuccess, luaVehicleHudEnabled = pcall(function() return settings():GetFFlag('NewVehicleHud') end)
|
|
if useTopBar and (luaVehicleHudSuccess and luaVehicleHudEnabled == true) then
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/VehicleHud", screenGui)
|
|
end
|
|
|
|
local gamepadSupportSuccess, gamepadSupportFlagValue = pcall(function() return settings():GetFFlag("TopbarGamepadSupport") end)
|
|
if gamepadSupportSuccess and gamepadSupportFlagValue then
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/GamepadMenu", screenGui)
|
|
end
|
|
|
|
if touchEnabled then -- touch devices don't use same control frame
|
|
-- only used for touch device button generation
|
|
scriptContext:AddCoreScriptLocal("CoreScripts/2015/ContextActionTouch", screenGui)
|
|
|
|
screenGui:WaitForChild("ControlFrame")
|
|
screenGui.ControlFrame:WaitForChild("BottomLeftControl")
|
|
screenGui.ControlFrame.BottomLeftControl.Visible = false
|
|
end
|