void onNotifyUnitStatus(SFEvent e) { var data = e.data as SFResponseMsgNotifyUnitStatus; // if (data.runTime < m_runTime - SFCommonConf.instance.maxDiscardLag) // { // // 这个信息延迟超过100ms了,抛弃掉 // SFUtils.logWarning("消息延迟了{0}ms, 被抛弃({1} - {2})", data.runTime - m_runTime, data.runTime, m_runTime); // return; // } var infos = data.infos; foreach (var item in infos) { foreach (var controller in m_controllers) { if (controller.Key == item.uid) { controller.Value.updateStatus(item); break; } } } var balls = data.balls; if (SFBallManager.current != null) { SFBallManager.current.updateBall(balls); } }
void onNotifyUnitJoin(SFEvent e) { var data = e.data as SFResponseMsgNotifyNewUserJoin; if (data.inOrOut) { SFUnitConf conf = new SFUnitConf(); conf.uid = data.uid; conf.posX = data.posX; conf.posY = data.posY; conf.rotation = data.rotaion; conf.life = data.life; conf.maxLife = data.maxLife; addUnit(conf); } else { removeUnit(data.uid); } }
void onNetworkInterrupted(SFEvent e) { // 网络连接断开,回到标题页面 SFUtils.log("[Scene] - 网络连接断开,正在返回登陆界面..."); m_willReturn = true; }