/// <summary> /// 刷新支持的站台列表,以指定指令。返回一个值,指示读取是否成功 /// </summary> /// <param name="order"></param> public bool UpdateSupportingList(enumListPageOrder order) { List <StopFileBlockStruct> result; if (order == enumListPageOrder.Previous) { result = haveStopReader.ReadPreviousBlock(); } else { result = haveStopReader.ReadNextBlock(); } if (result.Count != 0) { //可以,输入 supportingStops.Clear(); foreach (var item in result) { supportingStops.Add(item.stopName); } return(true); } else { //没有数据,到头了,不能再读了 return(false); } }
public static PropertyAnimation Read(BlockReader reader, ActorComponent component) { BlockReader propertyBlock = reader.ReadNextBlock(); if (propertyBlock == null) { return(null); } PropertyAnimation propertyAnimation = new PropertyAnimation(); int type = propertyBlock.BlockType; if (!Enum.IsDefined(typeof(PropertyTypes), type)) { return(null); } else { propertyAnimation.m_Type = (PropertyTypes)type; Func <BinaryReader, ActorComponent, KeyFrame> keyFrameReader = null; switch (propertyAnimation.m_Type) { case PropertyTypes.PosX: keyFrameReader = KeyFramePosX.Read; break; case PropertyTypes.PosY: keyFrameReader = KeyFramePosY.Read; break; case PropertyTypes.ScaleX: keyFrameReader = KeyFrameScaleX.Read; break; case PropertyTypes.ScaleY: keyFrameReader = KeyFrameScaleY.Read; break; case PropertyTypes.Rotation: keyFrameReader = KeyFrameRotation.Read; break; case PropertyTypes.Opacity: keyFrameReader = KeyFrameOpacity.Read; break; case PropertyTypes.DrawOrder: keyFrameReader = KeyFrameDrawOrder.Read; break; case PropertyTypes.Length: keyFrameReader = KeyFrameLength.Read; break; case PropertyTypes.VertexDeform: keyFrameReader = KeyFrameVertexDeform.Read; break; case PropertyTypes.ConstraintStrength: keyFrameReader = KeyFrameConstraintStrength.Read; break; case PropertyTypes.Trigger: keyFrameReader = KeyFrameTrigger.Read; break; case PropertyTypes.IntProperty: keyFrameReader = KeyFrameIntProperty.Read; break; case PropertyTypes.FloatProperty: keyFrameReader = KeyFrameFloatProperty.Read; break; case PropertyTypes.StringProperty: keyFrameReader = KeyFrameStringProperty.Read; break; case PropertyTypes.BooleanProperty: keyFrameReader = KeyFrameBooleanProperty.Read; break; case PropertyTypes.CollisionEnabled: keyFrameReader = KeyFrameCollisionEnabledProperty.Read; break; case PropertyTypes.ActiveChildIndex: keyFrameReader = KeyFrameActiveChild.Read; break; } int keyFrameCount = propertyBlock.ReadUInt16(); propertyAnimation.m_KeyFrames = new KeyFrame[keyFrameCount]; KeyFrame lastKeyFrame = null; for (int i = 0; i < keyFrameCount; i++) { KeyFrame frame = keyFrameReader(propertyBlock, component); propertyAnimation.m_KeyFrames[i] = frame; if (lastKeyFrame != null) { lastKeyFrame.SetNext(frame); } lastKeyFrame = frame; } } return(propertyAnimation); }