Skip to content

Commit

Permalink
Update Nexus Instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNexusAvenger committed Jan 4, 2023
1 parent b9edb90 commit 434fa5e
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions sourcemap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"Nexus-Button","className":"DataModel","filePaths":["place.project.json"],"children":[{"name":"ReplicatedStorage","className":"ReplicatedStorage","children":[{"name":"NexusButton","className":"ModuleScript","filePaths":["src\\init.lua","default.project.json"],"children":[{"name":"ControllerIcon","className":"ModuleScript","filePaths":["src\\ControllerIcon\\init.lua"],"children":[{"name":"ControllerIconCreator","className":"ModuleScript","filePaths":["src\\ControllerIcon\\ControllerIconCreator\\init.lua"],"children":[{"name":"Spritesheet","className":"ModuleScript","filePaths":["src\\ControllerIcon\\ControllerIconCreator\\Spritesheet.lua"]},{"name":"Spritesheets","className":"Folder","children":[{"name":"XboxOne","className":"Folder","children":[{"name":"Dark","className":"ModuleScript","filePaths":["src\\ControllerIcon\\ControllerIconCreator\\Spritesheets\\XboxOne\\Dark.lua"]},{"name":"Light","className":"ModuleScript","filePaths":["src\\ControllerIcon\\ControllerIconCreator\\Spritesheets\\XboxOne\\Light.lua"]}]}]}]}]},{"name":"Factory","className":"Folder","children":[{"name":"ButtonFactory","className":"ModuleScript","filePaths":["src\\Factory\\ButtonFactory.lua"]},{"name":"TextButtonFactory","className":"ModuleScript","filePaths":["src\\Factory\\TextButtonFactory.lua"]}]},{"name":"ThemedFrame","className":"ModuleScript","filePaths":["src\\ThemedFrame.lua"]},{"name":"NexusWrappedInstance","className":"ModuleScript","filePaths":["module/Nexus-Wrapped-Instance\\./src\\init.lua","module/Nexus-Wrapped-Instance/default.project.json"],"children":[{"name":"NexusInstance","className":"Folder","filePaths":["module/Nexus-Wrapped-Instance\\./module/Nexus-Instance/default.project.json"],"children":[{"name":"Event","className":"Folder","children":[{"name":"NexusConnection","className":"ModuleScript","filePaths":["module/Nexus-Wrapped-Instance\\./module/Nexus-Instance\\./src\\Event\\NexusConnection.lua"]},{"name":"NexusEvent","className":"ModuleScript","filePaths":["module/Nexus-Wrapped-Instance\\./module/Nexus-Instance\\./src\\Event\\NexusEvent.lua"]}]},{"name":"NexusInstance","className":"ModuleScript","filePaths":["module/Nexus-Wrapped-Instance\\./module/Nexus-Instance\\./src\\NexusInstance.lua"]},{"name":"NexusObject","className":"ModuleScript","filePaths":["module/Nexus-Wrapped-Instance\\./module/Nexus-Instance\\./src\\NexusObject.lua"]},{"name":"PropertyValidator","className":"Folder","children":[{"name":"TypePropertyValidator","className":"ModuleScript","filePaths":["module/Nexus-Wrapped-Instance\\./module/Nexus-Instance\\./src\\PropertyValidator\\TypePropertyValidator.lua"]}]}]}]}]},{"name":"NexusButtonTests.nexusspec","className":"ModuleScript","filePaths":["test\\init.lua"],"children":[{"name":"ControllerIconTests.nexusspec","className":"ModuleScript","filePaths":["test\\ControllerIconTests.nexusspec.lua"]},{"name":"Factory","className":"Folder","children":[{"name":"ButtonFactoryTests.nexusspec","className":"ModuleScript","filePaths":["test\\Factory\\ButtonFactoryTests.nexusspec.lua"]},{"name":"TextButtonFactoryTests.nexusspec","className":"ModuleScript","filePaths":["test\\Factory\\TextButtonFactoryTests.nexusspec.lua"]}]}]}]}]}
4 changes: 2 additions & 2 deletions src/ControllerIcon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ControllerIcon:SetClassName("ControllerIcon")
Constructor of the Controller Icon class.
--]]
function ControllerIcon:__new()
self:InitializeSuper()
NexusInstance.__new(self)

--Create the adorn frame.
local AdornFrame = Instance.new("ImageLabel")
Expand Down Expand Up @@ -118,7 +118,7 @@ end
Destroys the frame.
--]]
function ControllerIcon:Destroy(): nil
self.super:Destroy()
NexusInstance.Destroy(self)

--Disconnect the events.
for _,Event in pairs(self.Events) do
Expand Down
6 changes: 3 additions & 3 deletions src/Factory/ButtonFactory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ local BORDER_COLOR_OFFSET = Color3.new(-30 / 255, -30 / 255, -30 / 255)

local RootModule = script.Parent.Parent

local NexusInstance = require(RootModule:WaitForChild("NexusWrappedInstance"):WaitForChild("NexusInstance"):WaitForChild("NexusInstance"))
local NexusObject = require(RootModule:WaitForChild("NexusWrappedInstance"):WaitForChild("NexusInstance"):WaitForChild("NexusObject"))
local NexusButton = require(RootModule)

local ButtonFactory = NexusInstance:Extend()
local ButtonFactory = NexusObject:Extend()
ButtonFactory:SetClassName("ButtonFactory")


Expand Down Expand Up @@ -49,7 +49,7 @@ end
Creates a button factory.
--]]
function ButtonFactory:__new()
self:InitializeSuper()
NexusObject.__new(self)
self.Defaults = {}
end

Expand Down
4 changes: 2 additions & 2 deletions src/Factory/TextButtonFactory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end
Creates a text button factory.
--]]
function TextButtonFactory:__new()
self:InitializeSuper()
ButtonFactory.__new(self)
self.TextDefaults = {}
end

Expand All @@ -62,7 +62,7 @@ Creates a text button instance.
--]]
function TextButtonFactory:Create()
--Create the button.
local Button = self.super:Create()
local Button = ButtonFactory.Create(self)

--Add a text label.
local TextLabel = Instance.new("TextLabel")
Expand Down
2 changes: 1 addition & 1 deletion src/ThemedFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ThemedFrame:SetClassName("ThemedFrame")
Creates the themed frame.
--]]
function ThemedFrame:__new()
self:InitializeSuper("ImageLabel")
NexusWrappedInstance.__new(self, "ImageLabel")
self.BackgroundTransparency = 1

--Connect replicating values.
Expand Down
5 changes: 2 additions & 3 deletions src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ local DEFAULT_THEMES = {



local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GuiService = game:GetService("GuiService")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
Expand All @@ -87,7 +86,7 @@ end
Creates a Nexus Button object.
--]]
function NexusButton:__new()
self:InitializeSuper("TextButton")
NexusWrappedInstance.__new(self, "TextButton")

--Create the frames.
local BaseButton = self:GetWrappedInstance()
Expand Down Expand Up @@ -365,7 +364,7 @@ end
Destroys the button and disconnects the events.
--]]
function NexusButton:Destroy(): nil
self.super:Destroy()
NexusWrappedInstance.Destroy(self)
self.GamepadIcon:Destroy()

--Disconnect the events.
Expand Down
1 change: 1 addition & 0 deletions test/ControllerIconTests.nexusspec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Unit tests for the ControllerIcon class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")
_G.EnsureNexusWrappedInstanceSingleton = false

local NexusButton = game:GetService("ReplicatedStorage"):WaitForChild("NexusButton")
local ControllerIcon = require(NexusButton:WaitForChild("ControllerIcon"))
Expand Down
1 change: 1 addition & 0 deletions test/Factory/ButtonFactoryTests.nexusspec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Unit tests for the ButtonFactory class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")
_G.EnsureNexusWrappedInstanceSingleton = false

local NexusButton = game:GetService("ReplicatedStorage"):WaitForChild("NexusButton")
local Factory = NexusButton:WaitForChild("Factory")
Expand Down
1 change: 1 addition & 0 deletions test/Factory/TextButtonFactoryTests.nexusspec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Unit tests for the TextButtonFactory class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")
_G.EnsureNexusWrappedInstanceSingleton = false

local NexusButton = game:GetService("ReplicatedStorage"):WaitForChild("NexusButton")
local Factory = NexusButton:WaitForChild("Factory")
Expand Down
1 change: 1 addition & 0 deletions test/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Unit tests for the NeuxsButton class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")
_G.EnsureNexusWrappedInstanceSingleton = false

local NexusButton = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusButton"))
local NexusButtonTest = NexusUnitTesting.UnitTest:Extend()
Expand Down

0 comments on commit 434fa5e

Please sign in to comment.