public virtual bool SendToSocket() { var _SocketServerManager = VEFModule.UnityContainer.Resolve(typeof(SocketServerManager), "") as SocketServerManager; //if (NetID <= 0) // NetID = _SocketServerManager.NewNetID(); var fbdata = FBObject.CreateFBData(); FBObject.Read(fbdata._fbData); return(_SocketServerManager.SendMessageToServer(NetID, SceneID, NetMsg.Data.Scene, fbdata)); }
public bool SaveToDB(IDAL_DCTX ctx) { string DBPath = DBFileUtil.GetDBFilePath(this.Parent); if (!String.IsNullOrEmpty(DBPath)) { IDAL.MDB.Scene dbSceneData = new IDAL.MDB.Scene(); dbSceneData.Data = FBObject.CreateFBData()._fbData; dbSceneData.SceneID = SceneID; dbSceneData.Name = this.Name; IDAL.IDAL.insertScene(ctx, dbSceneData); uint nodeCount = 0; foreach (var sceneitem in Entities) { var entity = sceneitem as EntityX; if (entity != null) { // entity.SaveToDB(ctx); var m_SceneNodeDB = new IDAL.MDB.SceneNode(); var body = entity.GetComponentX <BodyComponent>() as BodyComponent; if (body != null) { //if (body.SceneNodeID <= 0) // MessageBox.Show("SceneNodeID <= 0!"); //else { m_SceneNodeDB.Data = body.FBObject.CreateFBData()._fbData; m_SceneNodeDB.Name = Name; m_SceneNodeDB.SceneID = SceneID; m_SceneNodeDB.NodeID = nodeCount = nodeCount + 1; m_SceneNodeDB.EntID = entity.EntityID; //save sceneNode to db if (m_SceneNodeDB.NodeID > 0) { IDAL.IDAL.insertSceneNode(ctx, m_SceneNodeDB); } // } } } } } return(true); }