/// <summary> /// reads flatbuffers byte data into object /// </summary> /// <param name="fbData"></param> public void Read(Byte[] fbData) { try { ByteBuffer byteBuffer = new ByteBuffer(fbData); m_FBData = XFBType.AnimationComponent.GetRootAsAnimationComponent(byteBuffer); // read if (m_FBData.NodesLength > 0) { for (int i = 0; i < m_FBData.NodesLength; i++) { var node = m_FBData.GetNodes(i); if (node.NodeType == XFBType.UAnimationNode.AnimationNode) { XFBType.AnimationNode animationNode = new XFBType.AnimationNode(); animationNode = node.GetNode <XFBType.AnimationNode>(animationNode); string test = animationNode.Animation.Name; } } } } catch (Exception ex) { MessageBox.Show("error: " + ex.Message); } }
public void Read(Byte[] fbData) { try { ByteBuffer byteBuffer = new ByteBuffer(fbData); m_FBData = NetMsg.Entity.GetRootAsEntity(byteBuffer); // read if (m_FBData.ComponentsLength > 0) { for (int i = 0; i < m_FBData.ComponentsLength; i++) { var component = m_FBData.GetComponents(i); if (component.CompType == NetMsg.UComponent.AnimationComponent) { XFBType.AnimationComponent acomp = new XFBType.AnimationComponent(); component.GetComp <XFBType.AnimationComponent>(acomp); if (acomp.NodesLength > 0) { for (int j = 0; j < acomp.NodesLength; j++) { var node = acomp.GetNodes(j); if (node.NodeType == XFBType.UAnimationNode.AnimationNode) { XFBType.AnimationNode animationNode = new XFBType.AnimationNode(); animationNode = node.GetNode <XFBType.AnimationNode>(animationNode); string test = animationNode.Animation.Name; } } } if (acomp.ConnectionsLength > 0) { for (int j = 0; j < acomp.ConnectionsLength; j++) { var connection = acomp.GetConnections(j); var test = connection.NodeIn; } } } } } } catch (Exception ex) { MessageBox.Show("error: " + ex.Message); } }