local PlayerDistanceView = import("Game.View.PlayerDistanceView") local MainRightPanelView = require("Game.View.MainRightPanelView") local MJMainRightPanelView = { -- 查看记录 onLogCallback = nil } local M = MJMainRightPanelView local function __init(self, mainView, view) local mainView = mainView._view -- local right_panel = view -- local btn_setting = right_panel:GetChild("btn_setting") -- btn_setting.onClick:Set(function() -- local _settingView = mainView:NewSettingView() -- _settingView.stateIndex = (mainView._room.curren_round >= 1 and mainView._allow_dissmiss) and 2 or 1 -- _settingView.cd_time = mainView.dismiss_room_cd_time -- _settingView:Show() -- local room = DataManager.CurrenRoom -- _settingView.onCallback:Add(function(context) -- local _gamectr = ControllerManager.GetController(GameController) -- if (room.CurnrenState == StateType.Ready) then -- _gamectr:LevelRoom(function(response) -- if (response.ReturnCode == 0) then -- ViewManager.ChangeView(ViewManager.View_Lobby) -- GameApplication.Instance:ShowTips("房间已解散!") -- end -- end) -- else -- if mainView.dismiss_room_cd_time > 0 then -- GameApplication.Instance:ShowTips("您还处于解散冷却时间当中,请稍后重试!") -- else -- _gamectr:AskDismissRoom() -- end -- end -- end) -- end) -- self._tex_data = right_panel:GetChild("tex_data") self._tex_time = mainView:GetChild("text_time") self._pb_batteryLevel = mainView:GetChild("ProgressBar_jiangxi") -- self._xinhao = right_panel:GetController("xinhao")0 -- self.ctr_xh = right_panel:GetChild("gcm_xinhao"):GetController("c1") -- self.ctr_wifi = right_panel:GetChild("gcm_wifi"):GetController("c1") -- self._tex_ping = right_panel:GetChild("gcm_xinhao"):GetChild("n7") -- self.ctr_log = right_panel:GetController("log") -- local btn_log = right_panel:GetChild("btn_log") -- btn_log.onClick:Set(function() -- if self.onLogCallback then -- self.onLogCallback() -- end -- end) self._total_time = 0 self:__UpdateTime() end --- Create a new MainRightPanelView function MJMainRightPanelView.new(mainView, view) setmetatable(M, { __index = MainRightPanelView }) local self = setmetatable({}, { __index = M }) self.class = "MJMainRightPanelView" __init(self, mainView, view) return self end function M:__UpdateTime() -- self._tex_data.text = os.date("%Y-%m-%d") self._tex_time.text = os.date("%H:%M") if Application.platform == RuntimePlatform.IPhonePlayer or Application.platform == RuntimePlatform.Android then self._pb_batteryLevel.value = GameApplication.Instance:GetBatteryLevel() end -- local NetworkReachability = UnityEngine.NetworkReachability -- local _client = ControllerManager.GameNetClinet -- if not _client then return end -- local ping = _client:getAveragePingTime() -- if not ping then return end -- ping = math.floor(ping / 2) -- if ping > 300 then ping = 300 end -- if ping <= 100 then -- self.ctr_xh.selectedIndex = 0 -- elseif ping <= 300 then -- self.ctr_xh.selectedIndex = 1 -- else -- self.ctr_xh.selectedIndex = 2 -- end -- self._tex_ping.text = ping .. "ms" end return M