public static CSData Create() { CSData packet = ReferencePool.Acquire <CSData>(); if (packet.m_ExtensionObject == null) { packet.m_ExtensionObject = new DataRequest(); } return(packet); }
//- 战斗逻辑 // // @return none public void frameLockLogic() { //Log.Info("frameLockLogic " + GameData.g_uGameLogicFrame); ProcedureGame.Instance.CurrentGame.UpdateLogic(); recordLastPos(); for (int i = 0; i < GameData.g_listAsteroid.Count; i++) { Asteroid asteroid = GameData.g_listAsteroid[i]; asteroid.UpdateLogic(); } for (int i = 0; i < GameData.g_listBullet.Count; i++) { Bullet bullet = GameData.g_listBullet[i]; bullet.UpdateLogic(); } CSData csData = CSData.Create(); DataRequest dataRequest = (DataRequest)csData.GetExtensionObject(); for (int i = 0; i < GameData.g_listAircreaft.Count; i++) { Aircraft aircraft = GameData.g_listAircreaft[i]; aircraft.UpdateLogic(); ObjData objData = new ObjData(); objData.SerialId = aircraft.Id; objData.X = aircraft.m_fixv3LogicPosition.x.RawValue; objData.Y = aircraft.m_fixv3LogicPosition.y.RawValue; objData.Z = aircraft.m_fixv3LogicPosition.z.RawValue; objData.IsFire = aircraft.isFire; dataRequest.Objs.Add(objData); } //发送到服务器 if (dataRequest.Objs.Count > 0 && GameEntry.Network.GetNetworkChannel("game") != null) { GameEntry.Network.GetNetworkChannel("game").Send(csData); //for (int i = 0; i < GameData.g_listAircreaft.Count; i++) //{ // Aircraft aircraft = GameData.g_listAircreaft[i]; // aircraft.m_fixv3RenderPosition = aircraft.m_fixv3LogicPosition; //} } }