Skip to content

Commit

Permalink
update plugin src
Browse files Browse the repository at this point in the history
  • Loading branch information
James committed Oct 12, 2023
1 parent 32be85f commit b4c98e7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion plugin/src/lua/plugin/Vendor/Core/PluginGui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ if not AlreadyRan then
end Iris.End()

if Iris.Button("Install Selected Packages").clicked() then
VersionController.InstallPackagesFromList(Settings.CanaryStudioManagerPackages, true)
VersionController.InstallPackagesFromList(Settings.CanaryStudioManagerPackages)
end
end Iris.End()

Expand Down
49 changes: 26 additions & 23 deletions plugin/src/lua/plugin/Vendor/Core/VersionController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,16 @@ function VersionController.GetDirectoryFromStructureJSON(json: {any}, parent: In
InstanceFromClass.Name = instanceName
InstanceFromClass.Parent = parent
end

if children["$attributes"] then
for attributeName: string, attributeValue: any in children["$attributes"] do
InstanceFromClass:SetAttribute(attributeName, attributeValue)
end
end

if children["$properties"] then
for propertyName: string, propertyValue: string | any in children["$properties"] do
if propertyName == "Source" and propertyValue:find("https://") then
if propertyName == "Source" and type(propertyValue) == "string" and propertyValue:find("https://") then
local Source = Fetch.FetchAsync(propertyValue, false)

if not Source then
Expand Down Expand Up @@ -114,11 +120,11 @@ function VersionController.GetCurrentInstance(ignoreNil: boolean?): {[string]: F
ignoreNil = ignoreNil or false

local EngineTable = {
Server = ServerStorage:FindFirstChild("EngineServer"),
Client = ReplicatedStorage:FindFirstChild("EngineClient"),
Replicated = ReplicatedStorage:FindFirstChild("EngineReplicated"),
Server = ServerStorage:FindFirstChild("Server") or ServerStorage:FindFirstChild("EngineServer"),
Client = ReplicatedStorage:FindFirstChild("Client") or ReplicatedStorage:FindFirstChild("EngineClient"),
Replicated = ReplicatedStorage:FindFirstChild("Replicated") or ReplicatedStorage:FindFirstChild("EngineReplicated"),
Framework = ReplicatedStorage:FindFirstChild("Framework") or ReplicatedStorage:FindFirstChild("CanaryEngineFramework"),
ReplicatedFirst = ReplicatedFirst:FindFirstChild("EngineReplicatedFirst")
ReplicatedFirst = ReplicatedFirst:FindFirstChild("PriorityLoad") or ReplicatedFirst:FindFirstChild("EngineReplicatedFirst")
}

if not ignoreNil then
Expand Down Expand Up @@ -225,7 +231,7 @@ function VersionController.UpdateFramework()
end)
end

function VersionController.InstallPackagesFromList(list: {[string]: boolean}, setWindow: boolean?)
function VersionController.InstallPackagesFromList(list: {[string]: boolean})
task.defer(function()
local CurrentInstance = VersionController.GetCurrentInstance()
FinishedFiles = 0
Expand Down Expand Up @@ -258,15 +264,13 @@ function VersionController.InstallPackagesFromList(list: {[string]: boolean}, se
VersionController.DataUpdated:Fire(FinishedFiles, TotalPackageFiles, "Installing ", "Installing latest version of packages", "packages")
end

if setWindow then
FinishedFiles = 0
TotalPackageFiles = 0
FinishedFiles = 0
TotalPackageFiles = 0

WindowController.SetWindow("UpdateStatusWindow", false)
WindowController.SetMessageWindow("Packages installed successfully!!", Color3.fromRGB(205, 255, 151))
WindowController.SetWindow("UpdateStatusWindow", false)
WindowController.SetMessageWindow("Packages installed successfully!", Color3.fromRGB(205, 255, 151))

VersionController.DataUpdated:Fire(FinishedFiles, 1, "nil", "nil", "nil")
end
VersionController.DataUpdated:Fire(FinishedFiles, 1, "nil", "nil", "nil")
end)
end

Expand Down Expand Up @@ -305,10 +309,10 @@ function VersionController.InstallFramework()

local NewInstance = VersionController.GetCurrentInstance()

if not CanaryStudioSettings.CanaryStudioInstaller["Enable Media Templates"] then
if not CanaryStudioSettings.CanaryStudioInstaller["Enable Asset Templates"] then
for _, folderName in RequiredEngineInstances do
if folderName ~= "Framework" and folderName ~= "ReplicatedFirst" then
NewInstance[folderName].Media:ClearAllChildren()
NewInstance[folderName].Assets:ClearAllChildren()
end
end
end
Expand All @@ -319,14 +323,8 @@ function VersionController.InstallFramework()
end

VersionController.InstallPackagesFromList(CanaryStudioSettings.CanaryStudioInstallerPackages)

FinishedFiles = 0
TotalPackageFiles = 0

WindowController.SetWindow("UpdateStatusWindow", false)
WindowController.SetMessageWindow("Framework installed successfully!", Color3.fromRGB(205, 255, 151))

VersionController.DataUpdated:Fire(FinishedFiles, 1, "nil", "nil", "nil")
task.wait(UPDATE_COOLDOWN_SECONDS)
UpdateDebounce = false
end)
Expand All @@ -340,8 +338,13 @@ function VersionController.CreateNewInstanceFromName(name: string, instanceType:
return
end

if CurrentInstance[context][`{instanceType}s`] then
WindowController.SetMessageWindow(`Cannot create instance; {name} already exists in that dir`)
if CurrentInstance[context][`{instanceType}s`]:FindFirstChild(name) then
WindowController.SetMessageWindow(`Cannot create {string.lower(instanceType)}; {name} already exists in that dir`)
return
end

if name == "Package" then
name = "ModuleScript"
end

name = string.gsub(name, "[^%a_]", "")
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/lua/plugin/Vendor/Settings/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ return {
CanaryStudioInstaller = {
["Studio Debugging"] = true,
["Live Game Debugging"] = false,
["Enable Media Templates"] = true,
["Enable Asset Templates"] = true,
},

CanaryStudioInstallerPackages = { },
Expand Down

0 comments on commit b4c98e7

Please sign in to comment.