-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommonCtrler.lua
More file actions
69 lines (53 loc) · 1.32 KB
/
Copy pathCommonCtrler.lua
File metadata and controls
69 lines (53 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
-- @Author: ZhuL
-- @Date: 2017-05-17 15:51:12
-- @Last Modified by: ZhuL
-- @Last Modified time: 2017-05-19 16:15:23
--[[
通用控制器
提供消息接收发送界面以及功能
提供通用title接口
]]
local BaseCom = require_ex("data.BaseCom")
local M = class("CommonCtrler" , BaseCom)
function M:ctor()
BaseCom.ctor(self)
self._msgQueue = require("lib.Queue").new()
end
------------------------------ 聊天 start ----------------------------
function M:registerChatEvent()
-- body
end
function M:unRegisterChatEvent()
-- body
end
function M:onReceiveMsg(msgType , data)
local chatView = self._viewMap["ChatView"]
if not chatView then
return
end
self:pushMsg({type = msgType , data = data})
chatView:tryToShowMsg()
end
function M:getMsgCount()
return self._msgQueue:length()
end
function M:pushMsg(msg)
self._msgQueue:push(msg)
end
function M:popMsg()
return self._msgQueue:pop()
end
function M:addChatView(parent)
local chatView = require_ex("games.niuniu.views.ChatView").new(self)
parent:addChatView(chatView)
end
function M:reqSendEmoji(emojiLst)
-- body
self:onReceiveMsg(1 , emojiLst)
end
function M:reqSendMsg(msg)
-- body
self:onReceiveMsg(2 , msg)
end
------------------------------ 聊天 end ----------------------------
return M.new()