local MJSettingView = require("main.majiang.MJSettingViewNew") local MJMainView = require("main.majiang.MJMainView") local WitnessView = {} local M = WitnessView setmetatable(M, { __index = BaseView }) function M:init() self._gamectr = ControllerManager.GetController(GameController) self._room = DataManager.CurrenRoom self._room.Witness = true UIPackage.AddPackage('base/chat/ui/Chat') self._eventmap = {} self._put_map = false self._new_hide = false self._queue = false self._style = 1 self._popEvent = true self:InitView() end function M:InitView(url) local room = self._room BaseView.InitView(self, url) self.btn_setting = self._view:GetChild("btn_setting") self.com_logocType = self._view:GetChild("com_logo"):GetController("cType") self.btn_setting.onClick:Set(function() local view = MJSettingView.new(self, true) view:Show() end) self.com_notice = self._view:GetChild("com_notice") end function M:Show() getmetatable(WitnessView).__index.Show(self) self:DoNoticeAnimation() end function M:DoNoticeAnimation() self.noticeIndex = self.noticeIndex or 1 if not DataManager.GameNotice or #DataManager.GameNotice == 0 then return end local text_notice = self.com_notice:GetChild("text_notice") text_notice.text = DataManager.GameNotice[self.noticeIndex] local speed = 44 local time = text_notice.width / speed text_notice.x = self.com_notice.width local tween = text_notice:TweenMove(Vector2(-text_notice.width, text_notice.y), time):OnComplete(function() self:DoNoticeAnimation() end) tween:SetEase(EaseType.Linear) self.noticeIndex = self.noticeIndex + 1 if self.noticeIndex > #DataManager.GameNotice then self.noticeIndex = 1 end --强制让牌类型为1,只有一种牌 self._room.card_type = 1 end return M