diff --git a/Mt.rbxlx b/Mt.rbxlx index 1c04c46..11f565b 100644 --- a/Mt.rbxlx +++ b/Mt.rbxlx @@ -80,27 +80,27 @@ - 24.827137 - 61.1076584 - -13.1518173 - 0.0272198282 - -0.892819822 - 0.449590892 - -9.31322464e-10 - 0.449757546 - 0.893150747 - -0.999629498 - -0.0243114103 - 0.0122423228 + 78.735878 + 14.4161358 + -10.7617636 + -0.970561981 + -0.160243854 + 0.179809585 + 7.45058149e-09 + 0.746557176 + 0.66532141 + -0.24085179 + 0.645735681 + -0.724579871 null 0 70 0 - 23.9279556 - 59.3213577 - -13.176302 + 78.3762589 + 13.0854931 + -9.31260395 1 0 0 @@ -1080,6 +1080,8 @@ local MWindow = { Name = "window", -- ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Title = "window", -- Window title (string) (Read-only (Use SetTitle()) + + WindowInteractionState = MtEnum.WindowInteractionState.None -- Window interaction state (string (enum)) (Read-only) } MWindow.Init = function(self,screen,_obj) @@ -1088,12 +1090,13 @@ MWindow.Init = function(self,screen,_obj) _obj.Screen = screen _obj.Screen:AddWidget(_obj) + _obj.Interacted=Instance.new("BindableEvent") _obj.Resizing = Instance.new("BindableEvent") _obj.Moving = Instance.new("BindableEvent") MWindow.InitGui(_obj) MWindow.InitWindowFunctionality(_obj) - + table.insert(Windows,_obj) return _obj @@ -1124,7 +1127,7 @@ MWindow.InitGui = function(self) local uicorner = Instance.new("UICorner") uicorner.Parent = self.Content - + self.Stroke = Instance.new("UIStroke") self.Stroke.Parent = self.Content self.Stroke.Color = script.handle.BackgroundColor3 @@ -1143,28 +1146,86 @@ end MWindow.InitResize = function(self) self.ResizeRegions = {} - self.ResizeRegions.LeftResizeRegion = MWindowResizeRegion:Init(0,0,MtEnum.Side.Left,0,1,5,0,self) - self.ResizeRegions.RightResizeRegion= MWindowResizeRegion:Init(1,0,MtEnum.Side.Right,0,1,-5,0,self) - self.ResizeRegions.TopResizeRegion = MWindowResizeRegion:Init(0,0,MtEnum.Side.Top,1,0,0,5,self) + self.ResizeRegions.LeftResizeRegion = MWindowResizeRegion:Init(0,0,MtEnum.Side.Left ,0,1,5 ,0,self) + self.ResizeRegions.RightResizeRegion= MWindowResizeRegion:Init(1,0,MtEnum.Side.Right ,0,1,-5,0,self) + self.ResizeRegions.TopResizeRegion = MWindowResizeRegion:Init(0,0,MtEnum.Side.Top ,1,0,0 ,5,self) self.ResizeRegions.BottomResizeRegion=MWindowResizeRegion:Init(0,1,MtEnum.Side.Bottom,1,0,0,-5,self) for i,v in pairs(self.ResizeRegions) do v.Resizing.Event:Connect(function(size) self.NormalSize = size + self.WindowInteractionState = MtEnum.WindowInteractionState.Resizing self.Resizing:Fire(size) end) + + v.ResizeEnded.Event:Connect(function() + self.WindowInteractionState = MtEnum.WindowInteractionState.None + end) + end +end + +MWindow.IsAnyOtherWindowBeingInteracted = function(self) + for i,v in ipairs(Windows) do + if v ~= self then + if v.WindowInteractionState ~= MtEnum.WindowInteractionState.None then + return true + end + end + end + return false +end + +MWindow.RefreshWindowZIndex = function() + for i,v in ipairs(Windows) do + v.Content.ZIndex = i + + for di,dv in ipairs(v.Content:GetDescendants()) do + if dv:IsA("GuiObject") then + dv.ZIndex = i + end + end + + if i == #Windows then + v.Content.handle.BackgroundColor3 = Color3.fromRGB(0,120,180) + v.Content:FindFirstChildOfClass("UIStroke").Color = Color3.fromRGB(0,120,180) + else + v.Content.handle.BackgroundColor3 = Color3.fromRGB(105, 150, 255) + v.Content:FindFirstChildOfClass("UIStroke").Color = Color3.fromRGB(105, 150, 255) + end end end MWindow.InitWindowFunctionality = function(self) self:InitResize() + + --[[ + self.Content.InputBegan:Connect(function(input) + if self:IsAnyOtherWindowBeingInteracted() then + return + end + + if input.UserInputType == Enum.UserInputType.MouseButton1 then + + self:FireEvent(self.Interacted) + + local i = self.Content.ZIndex + table.move(Windows,i,i,#Windows+1) + self:RefreshWindowZIndex() + table.remove(Windows,#Windows) + end + end) + --]] self.Handle.InputBegan:Connect(function(input) - if self.Content:FindFirstChild("resizeRegions").Dragging.Value then + if + self.Content:FindFirstChild("resizeRegions").Dragging.Value or + self:IsAnyOtherWindowBeingInteracted() + then return end if input.UserInputType == Enum.UserInputType.MouseButton1 then + local clickLocation = uis:GetMouseLocation() local windowPosX = self.Content.Position.X.Offset local windowPosY = self.Content.Position.Y.Offset @@ -1178,11 +1239,15 @@ MWindow.InitWindowFunctionality = function(self) location.X-xoff, location.Y-yoff ) + + self.WindowInteractionState = MtEnum.WindowInteractionState.Moving self.Moving:Fire(self.Content.Position,location) task.wait(0.025) end + + self.WindowInteractionState = MtEnum.WindowInteractionState.None end end) @@ -1217,7 +1282,7 @@ MWindow.InitWindowFunctionality = function(self) 0.2, true ) - self.MaxButton.Image = "http://www.roblox.com/asset/?id=9194909505" + self.MaxButton.Image = "rbxassetid://9194909505" else self.Content:TweenSizeAndPosition( self.NormalSize, @@ -1798,29 +1863,29 @@ return MWindow]]> {4B0E1833-342E-48B8-9103-F78E30D9A98B} DiagonalRight = "DRight", DiagonalLeft = "DLeft", }, + + WindowInteractionState = { + None = "None", + Moving = "Moving", + Resizing = "Resizing" + }, WindowHandleStyle = { Windows = "Windows", diff --git a/Mt.rbxlx.lock b/Mt.rbxlx.lock index bb8674f..50d0144 100644 --- a/Mt.rbxlx.lock +++ b/Mt.rbxlx.lock @@ -1,4 +1,4 @@ -7124 +2856 RobloxStudioBeta SAMYHP 4a64b69f-03f4-461c-9f0d-22cb6bfd7899