Skip to content

Commit

Permalink
Tidies whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
BadgerCode committed Jul 2, 2019
1 parent d4b582f commit d38bd71
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 226 deletions.
4 changes: 2 additions & 2 deletions emojichat/lua/emojichat/cl_chat-overrides.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local oldAddText = chat.AddText
function chat.AddText(...)
eChat.AddLine(TextComponentBuilder.Build(...))
oldAddText(...)
eChat.AddLine(TextComponentBuilder.Build(...))
oldAddText(...)
end

chat.Open = eChat.showBox
Expand Down
24 changes: 12 additions & 12 deletions emojichat/lua/emojichat/cl_echat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ CHATMODE_GLOBAL = 1
CHATMODE_TEAM = 2

eChat = {
Ready = false,
Active = false,
ChatMode = CHATMODE_GLOBAL,
ExistingMessages = { },
HTMLOutput = nil
Ready = false,
Active = false,
ChatMode = CHATMODE_GLOBAL,
ExistingMessages = { },
HTMLOutput = nil
}

eChat.config = {
html = table.concat(emojichatHTML),
timestamps = true,
position = 1,
fadeTime = 12,
defaultChatColour = Color(255, 255, 255, 255),
timestampColour = Color(255, 255, 255, 255),
serverMessageColour = Color(151, 211, 255, 255)
html = table.concat(emojichatHTML),
timestamps = true,
position = 1,
fadeTime = 12,
defaultChatColour = Color(255, 255, 255, 255),
timestampColour = Color(255, 255, 255, 255),
serverMessageColour = Color(151, 211, 255, 255)
}
32 changes: 16 additions & 16 deletions emojichat/lua/emojichat/cl_hooks.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
hook.Remove("Initialize", "emojichat_init")
hook.Add("Initialize", "emojichat_init", function()
-- TODO: Can this get called too early?
eChat.AddServerMessage("EmojiChat by Badger")
eChat.AddServerMessage("EmojiChat by Badger")
eChat.buildBox()
end)

hook.Remove("ChatText", "emojichat_joinleave")
hook.Add("ChatText", "emojichat_joinleave", function( index, name, text, type )
if type != "chat" then
eChat.AddServerMessage(text)
return true
end
if type != "chat" then
eChat.AddServerMessage(text)
return true
end
end)

hook.Remove("PlayerBindPress", "emojichat_hijackbind")
hook.Add("PlayerBindPress", "emojichat_hijackbind", function(ply, bind, pressed)
if string.sub( bind, 1, 11 ) == "messagemode" then
local chatMode = CHATMODE_GLOBAL
if bind == "messagemode2" then
chatMode = CHATMODE_TEAM
end
if string.sub( bind, 1, 11 ) == "messagemode" then
local chatMode = CHATMODE_GLOBAL
if bind == "messagemode2" then
chatMode = CHATMODE_TEAM
end

eChat.showBox(chatMode)
return true
end
eChat.showBox(chatMode)
return true
end
end)

hook.Remove("HUDShouldDraw", "emojichat_hidedefault")
hook.Add("HUDShouldDraw", "emojichat_hidedefault", function( name )
if name == "CHudChat" then
return false
end
if name == "CHudChat" then
return false
end
end)
32 changes: 16 additions & 16 deletions emojichat/lua/emojichat/cl_html-chat-callbacks.lua
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
HTMLChatCallbacks = {}

function HTMLChatCallbacks.SendMessage(message, destination)
if string.Trim( message ) != "" then
if string.Trim( message ) != "" then

if destination == DESTINATION_TEAM then
LocalPlayer():ConCommand("say_team \"" .. (message or "") .. "\"")
if destination == DESTINATION_TEAM then
LocalPlayer():ConCommand("say_team \"" .. (message or "") .. "\"")

elseif destination == DESTINATION_CONSOLE then
LocalPlayer():ConCommand(message or "")
elseif destination == DESTINATION_CONSOLE then
LocalPlayer():ConCommand(message or "")

else
LocalPlayer():ConCommand("say \"" .. message .. "\"")
else
LocalPlayer():ConCommand("say \"" .. message .. "\"")

end
end
end
end

eChat.hideBox()
HTMLChatCallbacks.InputChange("")
eChat.hideBox()
HTMLChatCallbacks.InputChange("")
end

function HTMLChatCallbacks.InputChange(newValue)
hook.Run("ChatTextChanged", newValue)
hook.Run("ChatTextChanged", newValue)
end

function HTMLChatCallbacks.CloseChat()
eChat.hideBox()
gui.HideGameUI()
gui.HideGameUI()
end

function HTMLChatCallbacks.PlayWarningSound()
surface.PlaySound("resource/warning.wav")
surface.PlaySound("resource/warning.wav")
end

function HTMLChatCallbacks.HideMenu()
gui.HideGameUI()
end

function HTMLChatCallbacks.OpenURL(url)
gui.OpenURL(url)
HTMLChatCallbacks.CloseChat()
gui.OpenURL(url)
HTMLChatCallbacks.CloseChat()
end
60 changes: 30 additions & 30 deletions emojichat/lua/emojichat/cl_html-chat-component.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,53 @@ HTMLChatComponent = { }
HTMLChatComponent.__index = HTMLChatComponent

function HTMLChatComponent.New(htmlVGUIElement)
local self = setmetatable({}, HTMLChatComponent)
self.htmlElement = htmlVGUIElement
return self
local self = setmetatable({}, HTMLChatComponent)
self.htmlElement = htmlVGUIElement
return self
end

function HTMLChatComponent.RenderTextLine(self, textComponents)
local json = string.JavascriptSafe(util.TableToJSON(textComponents))
self.htmlElement:QueueJavascript("emojiChat.addOutput('" .. json .. "')")
local json = string.JavascriptSafe(util.TableToJSON(textComponents))
self.htmlElement:QueueJavascript("emojiChat.addOutput('" .. json .. "')")
end

function HTMLChatComponent.SetActive(self, chatMode)
local desination = DESTINATION_GLOBAL
if(chatMode == CHATMODE_TEAM) then
desination = DESTINATION_TEAM
end
local desination = DESTINATION_GLOBAL
if(chatMode == CHATMODE_TEAM) then
desination = DESTINATION_TEAM
end

local playerList = {}
for k, ply in pairs(player.GetAll()) do
local playerViewModel = { name = ply:Nick() }
table.insert(playerList, playerViewModel)
end
local playerList = {}
for k, ply in pairs(player.GetAll()) do
local playerViewModel = { name = ply:Nick() }
table.insert(playerList, playerViewModel)
end

local activePlayer = {
name = LocalPlayer():Nick()
}
local activePlayer = {
name = LocalPlayer():Nick()
}

local jsonPlayerList = string.JavascriptSafe(util.TableToJSON(playerList))
local jsonActivePlayer = string.JavascriptSafe(util.TableToJSON(activePlayer))
local jsonPlayerList = string.JavascriptSafe(util.TableToJSON(playerList))
local jsonActivePlayer = string.JavascriptSafe(util.TableToJSON(activePlayer))

self.htmlElement:QueueJavascript("emojiChat.setActive(" .. desination .. ",'" .. jsonPlayerList .. "', '" .. jsonActivePlayer .. "')")
self.htmlElement:QueueJavascript("emojiChat.setActive(" .. desination .. ",'" .. jsonPlayerList .. "', '" .. jsonActivePlayer .. "')")
end

function HTMLChatComponent.SetInactive(self)
self.htmlElement:QueueJavascript("emojiChat.setInactive()")
self.htmlElement:QueueJavascript("emojiChat.setInactive()")
end

function HTMLChatComponent.UpdateFadeTime(self, durationInSeconds)
self.htmlElement:QueueJavascript("emojiChat.setFadeTime(" .. durationInSeconds .. ")")
self.htmlElement:QueueJavascript("emojiChat.setFadeTime(" .. durationInSeconds .. ")")
end

function HTMLChatComponent.ReloadPlayerList(self)
local playerList = {}
for k, ply in pairs(player.GetAll()) do
local playerViewModel = { name = ply:Nick() }
table.insert(playerList, playerViewModel)
end

local json = string.JavascriptSafe(util.TableToJSON(playerList))
self.htmlElement:QueueJavascript("emojiChat.reloadPlayerList('" .. json .. "')")
local playerList = {}
for k, ply in pairs(player.GetAll()) do
local playerViewModel = { name = ply:Nick() }
table.insert(playerList, playerViewModel)
end

local json = string.JavascriptSafe(util.TableToJSON(playerList))
self.htmlElement:QueueJavascript("emojiChat.reloadPlayerList('" .. json .. "')")
end
Loading

0 comments on commit d38bd71

Please sign in to comment.