Skip to content

Commit

Permalink
Improve ETTP chat and til death net screens
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Mar 30, 2018
1 parent d681b89 commit 5c3d7d8
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 168 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
local t = Def.ActorFrame{}

t[#t+1] = LoadActor("../_chatbox")
if not NSMAN:IsETTP() then
t[#t+1] = LoadActor("../_chatbox")
end
t[#t+1] = LoadActor("profile")
t[#t+1] = LoadActor("roomsearch")
t[#t+1] = LoadActor("tabs")

local g = Def.ActorFrame{
BeginCommand=function(self)
local top= SCREENMAN:GetTopScreen()
if getTabIndex() == 0 and not NSMAN:IsETTP() then
top:ChatboxVisible(true)
top:ChatboxInput(true)
top:InfoSetVisible(true)
else
top:ChatboxVisible(false)
top:ChatboxInput(false)
top:InfoSetVisible(false)
end
end,
TabChangedMessageCommand=function(self)
local top= SCREENMAN:GetTopScreen()
if getTabIndex() == 0 then
if getTabIndex() == 0 and not NSMAN:IsETTP() then
top:ChatboxVisible(true)
top:ChatboxInput(true)
top:InfoSetVisible(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local t = Def.ActorFrame{
end,
SetCommand=function(self)
self:finishtweening()
if getTabIndex() == 2 then
if getTabIndex() == (NSMAN:IsETTP() and 1 or 2) then
self:queuecommand("On")
self:visible(true)
update = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,25 @@ local function ButtonActive(self)
end

local t = Def.ActorFrame{
OnCommand=function(self)
BeginCommand=function(self)
whee = SCREENMAN:GetTopScreen():GetMusicWheel()
SCREENMAN:GetTopScreen():AddInputCallback(searchInput)
self:visible(false)
self:finishtweening()
if NSMAN:IsETTP() then
ms.ok("Song search activated")
self:visible(true)
active = true
whee:Move(0)
MESSAGEMAN:Broadcast("BeginningSearch")
MESSAGEMAN:Broadcast("RefreshSearchResults")
else
self:visible(false)
end
self:queuecommand("Set")
end,
SetCommand=function(self)
self:finishtweening()
if getTabIndex() == 1 then
if getTabIndex() == (NSMAN:IsETTP() and 0 or 1) then
ms.ok("Song search activated")
MESSAGEMAN:Broadcast("BeginningSearch")
self:visible(true)
Expand Down
11 changes: 8 additions & 3 deletions Themes/Til Death/BGAnimations/ScreenNetRoom decorations/tabs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local active = true
local CtrlPressed = false
local function input(event)
if event.type ~= "InputEventType_Release" and active then
for i=1,3 do
for i=1,(NSMAN:IsETTP() and 2 or 3) do
if event.DeviceInput.button == "DeviceButton_"..i and CtrlPressed == true then
setTabIndex(i-1)
MESSAGEMAN:Broadcast("TabChanged")
Expand Down Expand Up @@ -59,9 +59,14 @@ t[#t+1] = LoadFont("Common Normal") .. {
--]]
--======================================================================================

local tabNames = {"Chatbox","Search","Profile"} -- this probably should be in tabmanager.
local tabNames
if NSMAN:IsETTP() then
tabNames = {"Search","Profile"}
else
tabNames = {"Chatbox","Search","Profile"}
end

local frameWidth = (SCREEN_WIDTH*(9/24))/(#tabNames-1)
local frameWidth = (SCREEN_WIDTH*(7/24))/(#tabNames-1)
local frameX = frameWidth/2
local frameY = SCREEN_HEIGHT-70

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ t[#t+1] = LoadActor("../_PlayerInfo")
t[#t+1] = LoadActor("currentsort")
t[#t+1] = LoadActor("currenttime")
t[#t+1] = LoadFont("Common Large")..{InitCommand=function(self)
self:xy(5,32):halign(0):valign(1):zoom(0.55):diffuse(getMainColor("positive")):settext("Select Music:")
self:xy(5,32):halign(0):valign(1):zoom(0.55):diffuse(getMainColor("positive")):maxwidth(SCREEN_WIDTH/2-10):settext("Room: "..NSMAN:GetCurrentRoomName())
end}
t[#t+1] = LoadActor("../_cursor")
t[#t+1] = LoadActor("../_mouseselect")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
local t = Def.ActorFrame{}

if NSMAN:IsETTP() then
t[#t+1] = LoadActor("../ScreenSelectMusic decorations/default")
return t
end
t[#t+1] = LoadActor("../_chatbox")
t[#t+1] = LoadActor("../ScreenSelectMusic decorations/profile")
t[#t+1] = LoadActor("../ScreenSelectMusic decorations/msd")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ return false;
end

local t = Def.ActorFrame{
OnCommand=function(self) SCREENMAN:GetTopScreen():AddInputCallback(input) SCREENMAN:GetTopScreen():UsersVisible(false) end;
OnCommand=function(self)
local s = SCREENMAN:GetTopScreen()
s:AddInputCallback(input)
if s:GetName() == "ScreenNetSelectMusic" then
s:UsersVisible(false)
end
end
}

t[#t+1] = Def.Actor{
Expand Down
97 changes: 67 additions & 30 deletions Themes/_fallback/BGAnimations/ScreenChatOverlay overlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local typing = false
local typingText = ''
local transparency = 0.5
local curmsgh = 0
local closeTabSize = 10
local Colors = {
background = color("#7777FF"),
input = color("#777777"),
Expand All @@ -38,8 +39,12 @@ function changeTab(tabName, tabType)
currentTabName = tabName
currentTabType = tabType
if not chats[tabType][tabName] then
local i = 1
local done = false
while not done do
if not tabs[i] then tabs[i] = {tabType, tabName}; done = true; end
end
chats[tabType][tabName] = {}
tabs[#tabs+1] = {tabType, tabName}
end
messages = chats[tabType][tabName]
end
Expand Down Expand Up @@ -169,26 +174,28 @@ chatWindow[#chatWindow+1] = Def.Quad{
MESSAGEMAN:Broadcast("UpdateChatOverlayMsgs")
end
}
for i = 0, lineNumber-1 do
chatWindow[#chatWindow+1] = LoadColorFont("Common Normal")..{
Name = "ChatText"..i,
InitCommand = function(self)
self:settext('')
self:halign(0):valign(1)
self:vertspacing(0)
self:zoom(scale)
self:diffuse(color("#000000"))
end,
UpdateChatOverlayMsgsMessageCommand = function(self)
self:settext((i < #messages and messages[#messages-i] ~= nil) and messages[#messages-i] or '')
self:wrapwidthpixels((width-8)/scale)

self:xy(x+4, y+height*(lineNumber+tabHeight)-4 - i*29/2)
self:croptop((height+y - (self:GetY()-self:GetHeight())) / self:GetHeight())
curmsgh = curmsgh + (self:GetHeight()+8)/29
chatWindow[#chatWindow+1] = LoadColorFont("Common Normal")..{
Name = "ChatText",
InitCommand = function(self)
self:settext('')
self:halign(0):valign(1)
self:vertspacing(0)
self:zoom(scale)
self:SetMaxLines(lineNumber, 0)
self:wrapwidthpixels((width-8)/scale)
end,
UpdateChatOverlayMsgsMessageCommand = function(self)
local t = ""
for i = lineNumber-1,0,-1 do
if messages[#messages-i] then
t = t..messages[#messages-i].."\n"
end
end
}
end
self:settext(t)
self:xy(x+4, y+height*(lineNumber+tabHeight)-4)
end
}

local tabWidth = width/maxTabs
for i = 0, maxTabs-1 do
chatWindow[#chatWindow+1] = Def.ActorFrame{
Expand Down Expand Up @@ -226,6 +233,18 @@ for i = 0, maxTabs-1 do
end
end
},
LoadFont("Common Normal")..{
InitCommand = function(self)
self:halign(0):valign(0)
self:maxwidth(tabWidth)
self:zoom(scale)
self:diffuse(color("#000000"))
self:xy(x+tabWidth*(i+1)-closeTabSize, y+height*(1+(tabHeight/4)))
end,
UpdateChatOverlayMessageCommand = function(self)
self:settext((tabs[i+1] and tabs[i+1][2]) and "X" or "")
end
},
}
end

Expand All @@ -246,7 +265,7 @@ chatWindow[#chatWindow+1] = LoadFont("Common Normal")..{
self:halign(0):valign(0)
self:zoom(scale)
self:wrapwidthpixels((width-8)/scale)
self:diffuse(color("#000000"))
self:diffuse(color("#FFFFFF"))
end,
UpdateChatOverlayMessageCommand = function(self)
self:settext(typingText)
Expand All @@ -264,11 +283,11 @@ function overTab(mx, my)
for i = 0, maxTabs-1 do
if tabs[i+1] then
if mx >= x+tabWidth*i and my>= y+height and mx <= x+tabWidth*(i+1) and my<= y+height*(1+tabHeight) then
return i+1
return i+1, mx >= x+tabWidth*(i+1)-closeTabSize
end
end
end
return nil
return nil, nil
end
function input(event)
if(not show or not online) then
Expand All @@ -291,14 +310,31 @@ function input(event)
lastx, lasty = x, y
update = true
else
local tabButton = overTab(mx, my)
local tabButton, closeTab = overTab(mx, my)
if not tabButton then
mousex, mousey = -1, -1
if typing then
update = true
end
else
changeTab(tabs[tabButton][2], tabs[tabButton][1])
if not closeTab then
changeTab(tabs[tabButton][2], tabs[tabButton][1])
else
local tabT = tabs[tabButton][1]
local tabN = tabs[tabButton][2]
if (tabT == 0 and tabN == "") or (tabT == 1 and tabN == NSMAN:GetCurrentRoomName()) then
return false
end
tabs[tabButton] = nil
if chats[tabT][tabN] == messages then
for i = #tabs,1,-1 do
if tabs[i] then
changeTab(tabs[i][2], tabs[i][1])
end
end
end
chats[tabT][tabN] = {}
end
update = true
end
end
Expand All @@ -316,6 +352,10 @@ function input(event)
end
typing = false
update = true
elseif event.button == "Back" then
typingText = ''
typing = false
update = true
elseif event.DeviceInput.button == "DeviceButton_space" then
typingText = typingText .. ' '
update = true
Expand All @@ -325,10 +365,7 @@ function input(event)
elseif event.DeviceInput.button == "DeviceButton_backspace" then
typingText = typingText:sub(1, -2)
update = true
elseif event.DeviceInput.button == "DeviceButton_=" then
typingText = typingText .. '='
update = true
elseif event.DeviceInput.button:gsub("DeviceButton_", ''):len() == 1 then
elseif event.char then
typingText = typingText .. event.char
update = true
end
Expand All @@ -338,7 +375,7 @@ function input(event)
end


return update
return update or typing
end


Expand Down
Loading

0 comments on commit 5c3d7d8

Please sign in to comment.