local MainRightPanelView = require("Game.View.MainRightPanelView") local RunFast_RightPanelView = {} local M = RunFast_RightPanelView local function __init(self,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 print("mainView.dismiss_room_cd_time"..mainView.dismiss_room_cd_time) 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 = right_panel:GetChild("tex_time") self._pb_batteryLevel = right_panel:GetChild("pb_batteryLevel") self._xinhao = right_panel:GetController("xinhao") 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() -- self._timer = Timer.New(handler(self,self.__UpdateTime),10,-1,true) -- self._timer:Start() end function RunFast_RightPanelView.new(mainView,view) setmetatable(M, {__index = MainRightPanelView}) local self = setmetatable({}, {__index = M}) self.class = "RunFast_RightPanelView" __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