Skip to content

Commit 5c3d7d8

Browse files
committed
Improve ETTP chat and til death net screens
1 parent d681b89 commit 5c3d7d8

File tree

14 files changed

+304
-168
lines changed

14 files changed

+304
-168
lines changed

Themes/Til Death/BGAnimations/ScreenNetRoom decorations/default.lua

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
local t = Def.ActorFrame{}
2-
3-
t[#t+1] = LoadActor("../_chatbox")
2+
if not NSMAN:IsETTP() then
3+
t[#t+1] = LoadActor("../_chatbox")
4+
end
45
t[#t+1] = LoadActor("profile")
56
t[#t+1] = LoadActor("roomsearch")
67
t[#t+1] = LoadActor("tabs")
78

89
local g = Def.ActorFrame{
10+
BeginCommand=function(self)
11+
local top= SCREENMAN:GetTopScreen()
12+
if getTabIndex() == 0 and not NSMAN:IsETTP() then
13+
top:ChatboxVisible(true)
14+
top:ChatboxInput(true)
15+
top:InfoSetVisible(true)
16+
else
17+
top:ChatboxVisible(false)
18+
top:ChatboxInput(false)
19+
top:InfoSetVisible(false)
20+
end
21+
end,
922
TabChangedMessageCommand=function(self)
1023
local top= SCREENMAN:GetTopScreen()
11-
if getTabIndex() == 0 then
24+
if getTabIndex() == 0 and not NSMAN:IsETTP() then
1225
top:ChatboxVisible(true)
1326
top:ChatboxInput(true)
1427
top:InfoSetVisible(true)

Themes/Til Death/BGAnimations/ScreenNetRoom decorations/profile.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local t = Def.ActorFrame{
1111
end,
1212
SetCommand=function(self)
1313
self:finishtweening()
14-
if getTabIndex() == 2 then
14+
if getTabIndex() == (NSMAN:IsETTP() and 1 or 2) then
1515
self:queuecommand("On")
1616
self:visible(true)
1717
update = true

Themes/Til Death/BGAnimations/ScreenNetRoom decorations/roomsearch.lua

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,25 @@ local function ButtonActive(self)
105105
end
106106

107107
local t = Def.ActorFrame{
108-
OnCommand=function(self)
108+
BeginCommand=function(self)
109109
whee = SCREENMAN:GetTopScreen():GetMusicWheel()
110110
SCREENMAN:GetTopScreen():AddInputCallback(searchInput)
111-
self:visible(false)
111+
self:finishtweening()
112+
if NSMAN:IsETTP() then
113+
ms.ok("Song search activated")
114+
self:visible(true)
115+
active = true
116+
whee:Move(0)
117+
MESSAGEMAN:Broadcast("BeginningSearch")
118+
MESSAGEMAN:Broadcast("RefreshSearchResults")
119+
else
120+
self:visible(false)
121+
end
122+
self:queuecommand("Set")
112123
end,
113124
SetCommand=function(self)
114125
self:finishtweening()
115-
if getTabIndex() == 1 then
126+
if getTabIndex() == (NSMAN:IsETTP() and 0 or 1) then
116127
ms.ok("Song search activated")
117128
MESSAGEMAN:Broadcast("BeginningSearch")
118129
self:visible(true)

Themes/Til Death/BGAnimations/ScreenNetRoom decorations/tabs.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ local active = true
33
local CtrlPressed = false
44
local function input(event)
55
if event.type ~= "InputEventType_Release" and active then
6-
for i=1,3 do
6+
for i=1,(NSMAN:IsETTP() and 2 or 3) do
77
if event.DeviceInput.button == "DeviceButton_"..i and CtrlPressed == true then
88
setTabIndex(i-1)
99
MESSAGEMAN:Broadcast("TabChanged")
@@ -59,9 +59,14 @@ t[#t+1] = LoadFont("Common Normal") .. {
5959
--]]
6060
--======================================================================================
6161

62-
local tabNames = {"Chatbox","Search","Profile"} -- this probably should be in tabmanager.
62+
local tabNames
63+
if NSMAN:IsETTP() then
64+
tabNames = {"Search","Profile"}
65+
else
66+
tabNames = {"Chatbox","Search","Profile"}
67+
end
6368

64-
local frameWidth = (SCREEN_WIDTH*(9/24))/(#tabNames-1)
69+
local frameWidth = (SCREEN_WIDTH*(7/24))/(#tabNames-1)
6570
local frameX = frameWidth/2
6671
local frameY = SCREEN_HEIGHT-70
6772

Themes/Til Death/BGAnimations/ScreenNetSelectBase overlay/default.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ t[#t+1] = LoadActor("../_PlayerInfo")
3838
t[#t+1] = LoadActor("currentsort")
3939
t[#t+1] = LoadActor("currenttime")
4040
t[#t+1] = LoadFont("Common Large")..{InitCommand=function(self)
41-
self:xy(5,32):halign(0):valign(1):zoom(0.55):diffuse(getMainColor("positive")):settext("Select Music:")
41+
self:xy(5,32):halign(0):valign(1):zoom(0.55):diffuse(getMainColor("positive")):maxwidth(SCREEN_WIDTH/2-10):settext("Room: "..NSMAN:GetCurrentRoomName())
4242
end}
4343
t[#t+1] = LoadActor("../_cursor")
4444
t[#t+1] = LoadActor("../_mouseselect")

Themes/Til Death/BGAnimations/ScreenNetSelectMusic decorations/default.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
local t = Def.ActorFrame{}
2-
2+
if NSMAN:IsETTP() then
3+
t[#t+1] = LoadActor("../ScreenSelectMusic decorations/default")
4+
return t
5+
end
36
t[#t+1] = LoadActor("../_chatbox")
47
t[#t+1] = LoadActor("../ScreenSelectMusic decorations/profile")
58
t[#t+1] = LoadActor("../ScreenSelectMusic decorations/msd")

Themes/Til Death/BGAnimations/ScreenSelectMusic overlay/default.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ return false;
1818
end
1919

2020
local t = Def.ActorFrame{
21-
OnCommand=function(self) SCREENMAN:GetTopScreen():AddInputCallback(input) SCREENMAN:GetTopScreen():UsersVisible(false) end;
21+
OnCommand=function(self)
22+
local s = SCREENMAN:GetTopScreen()
23+
s:AddInputCallback(input)
24+
if s:GetName() == "ScreenNetSelectMusic" then
25+
s:UsersVisible(false)
26+
end
27+
end
2228
}
2329

2430
t[#t+1] = Def.Actor{

Themes/_fallback/BGAnimations/ScreenChatOverlay overlay.lua

Lines changed: 67 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ local typing = false
1414
local typingText = ''
1515
local transparency = 0.5
1616
local curmsgh = 0
17+
local closeTabSize = 10
1718
local Colors = {
1819
background = color("#7777FF"),
1920
input = color("#777777"),
@@ -38,8 +39,12 @@ function changeTab(tabName, tabType)
3839
currentTabName = tabName
3940
currentTabType = tabType
4041
if not chats[tabType][tabName] then
42+
local i = 1
43+
local done = false
44+
while not done do
45+
if not tabs[i] then tabs[i] = {tabType, tabName}; done = true; end
46+
end
4147
chats[tabType][tabName] = {}
42-
tabs[#tabs+1] = {tabType, tabName}
4348
end
4449
messages = chats[tabType][tabName]
4550
end
@@ -169,26 +174,28 @@ chatWindow[#chatWindow+1] = Def.Quad{
169174
MESSAGEMAN:Broadcast("UpdateChatOverlayMsgs")
170175
end
171176
}
172-
for i = 0, lineNumber-1 do
173-
chatWindow[#chatWindow+1] = LoadColorFont("Common Normal")..{
174-
Name = "ChatText"..i,
175-
InitCommand = function(self)
176-
self:settext('')
177-
self:halign(0):valign(1)
178-
self:vertspacing(0)
179-
self:zoom(scale)
180-
self:diffuse(color("#000000"))
181-
end,
182-
UpdateChatOverlayMsgsMessageCommand = function(self)
183-
self:settext((i < #messages and messages[#messages-i] ~= nil) and messages[#messages-i] or '')
184-
self:wrapwidthpixels((width-8)/scale)
185-
186-
self:xy(x+4, y+height*(lineNumber+tabHeight)-4 - i*29/2)
187-
self:croptop((height+y - (self:GetY()-self:GetHeight())) / self:GetHeight())
188-
curmsgh = curmsgh + (self:GetHeight()+8)/29
177+
chatWindow[#chatWindow+1] = LoadColorFont("Common Normal")..{
178+
Name = "ChatText",
179+
InitCommand = function(self)
180+
self:settext('')
181+
self:halign(0):valign(1)
182+
self:vertspacing(0)
183+
self:zoom(scale)
184+
self:SetMaxLines(lineNumber, 0)
185+
self:wrapwidthpixels((width-8)/scale)
186+
end,
187+
UpdateChatOverlayMsgsMessageCommand = function(self)
188+
local t = ""
189+
for i = lineNumber-1,0,-1 do
190+
if messages[#messages-i] then
191+
t = t..messages[#messages-i].."\n"
192+
end
189193
end
190-
}
191-
end
194+
self:settext(t)
195+
self:xy(x+4, y+height*(lineNumber+tabHeight)-4)
196+
end
197+
}
198+
192199
local tabWidth = width/maxTabs
193200
for i = 0, maxTabs-1 do
194201
chatWindow[#chatWindow+1] = Def.ActorFrame{
@@ -226,6 +233,18 @@ for i = 0, maxTabs-1 do
226233
end
227234
end
228235
},
236+
LoadFont("Common Normal")..{
237+
InitCommand = function(self)
238+
self:halign(0):valign(0)
239+
self:maxwidth(tabWidth)
240+
self:zoom(scale)
241+
self:diffuse(color("#000000"))
242+
self:xy(x+tabWidth*(i+1)-closeTabSize, y+height*(1+(tabHeight/4)))
243+
end,
244+
UpdateChatOverlayMessageCommand = function(self)
245+
self:settext((tabs[i+1] and tabs[i+1][2]) and "X" or "")
246+
end
247+
},
229248
}
230249
end
231250

@@ -246,7 +265,7 @@ chatWindow[#chatWindow+1] = LoadFont("Common Normal")..{
246265
self:halign(0):valign(0)
247266
self:zoom(scale)
248267
self:wrapwidthpixels((width-8)/scale)
249-
self:diffuse(color("#000000"))
268+
self:diffuse(color("#FFFFFF"))
250269
end,
251270
UpdateChatOverlayMessageCommand = function(self)
252271
self:settext(typingText)
@@ -264,11 +283,11 @@ function overTab(mx, my)
264283
for i = 0, maxTabs-1 do
265284
if tabs[i+1] then
266285
if mx >= x+tabWidth*i and my>= y+height and mx <= x+tabWidth*(i+1) and my<= y+height*(1+tabHeight) then
267-
return i+1
286+
return i+1, mx >= x+tabWidth*(i+1)-closeTabSize
268287
end
269288
end
270289
end
271-
return nil
290+
return nil, nil
272291
end
273292
function input(event)
274293
if(not show or not online) then
@@ -291,14 +310,31 @@ function input(event)
291310
lastx, lasty = x, y
292311
update = true
293312
else
294-
local tabButton = overTab(mx, my)
313+
local tabButton, closeTab = overTab(mx, my)
295314
if not tabButton then
296315
mousex, mousey = -1, -1
297316
if typing then
298317
update = true
299318
end
300319
else
301-
changeTab(tabs[tabButton][2], tabs[tabButton][1])
320+
if not closeTab then
321+
changeTab(tabs[tabButton][2], tabs[tabButton][1])
322+
else
323+
local tabT = tabs[tabButton][1]
324+
local tabN = tabs[tabButton][2]
325+
if (tabT == 0 and tabN == "") or (tabT == 1 and tabN == NSMAN:GetCurrentRoomName()) then
326+
return false
327+
end
328+
tabs[tabButton] = nil
329+
if chats[tabT][tabN] == messages then
330+
for i = #tabs,1,-1 do
331+
if tabs[i] then
332+
changeTab(tabs[i][2], tabs[i][1])
333+
end
334+
end
335+
end
336+
chats[tabT][tabN] = {}
337+
end
302338
update = true
303339
end
304340
end
@@ -316,6 +352,10 @@ function input(event)
316352
end
317353
typing = false
318354
update = true
355+
elseif event.button == "Back" then
356+
typingText = ''
357+
typing = false
358+
update = true
319359
elseif event.DeviceInput.button == "DeviceButton_space" then
320360
typingText = typingText .. ' '
321361
update = true
@@ -325,10 +365,7 @@ function input(event)
325365
elseif event.DeviceInput.button == "DeviceButton_backspace" then
326366
typingText = typingText:sub(1, -2)
327367
update = true
328-
elseif event.DeviceInput.button == "DeviceButton_=" then
329-
typingText = typingText .. '='
330-
update = true
331-
elseif event.DeviceInput.button:gsub("DeviceButton_", ''):len() == 1 then
368+
elseif event.char then
332369
typingText = typingText .. event.char
333370
update = true
334371
end
@@ -338,7 +375,7 @@ function input(event)
338375
end
339376

340377

341-
return update
378+
return update or typing
342379
end
343380

344381

0 commit comments

Comments
 (0)