public bool UpdateDrawPosition(DrawParam param) { if (!drawList.ContainsKey(param.ObjectName)) { return(false); } IDrawn drawObject = drawList[param.ObjectName]; drawObject.X = param.Position.X; drawObject.Y = param.Position.Y; drawList[param.ObjectName] = drawObject; return(true); }
public bool UpdateDrawPosition(DrawParam param) { if (!drawList.ContainsKey(param.ObjectName)) return false; IDrawn drawObject = drawList[param.ObjectName]; drawObject.X = param.Position.X; drawObject.Y = param.Position.Y; drawList[param.ObjectName] = drawObject; return true; }
public bool UpdateDrawList(DrawParam param) { if (!drawList.ContainsKey(param.ObjectName)) return false; if (drawCache.Cache.ContainsKey(param.ObjectName)) { ObjectCache cache = drawCache.Cache[param.ObjectName]; if (cache.Cache.ContainsKey(param.DrawableName)) { IDrawn drawableObject = cache.Cache[param.DrawableName]; drawableObject.X = param.Position.X; drawableObject.Y = param.Position.Y; switch (drawableObject.DrawnType) { case DrawnType.Animation: Animation animation = (Animation) drawableObject; animation.Reset(); drawList[param.ObjectName] = animation; return true; default: drawList[param.ObjectName] = drawableObject; return true; } } } else { drawCache.Cache.Add(param.ObjectName, new ObjectCache()); } ObjectCache objCache = drawCache.Cache[param.ObjectName]; switch (param.DrawType) { case DrawnType.Animation: if (!animationList.ContainsKey(param.DrawableName)) return false; Animation animation = animationList[param.DrawableName].CloneAnimation(param.DrawableName); animation.Reset(); animation.X = param.Position.X; animation.Y = param.Position.Y; drawList.Add(param.ObjectName, animation); objCache.Cache.Add(animation.Name, animation); break; case DrawnType.Shape: if (!shapeList.ContainsKey(param.DrawableName)) return false; IDrawnShape shape = shapeList[param.DrawableName]; switch (shape.Shape) { case ShapeType.Line: DrawnLine line = (DrawnLine) shape; DrawnLine drawLine = line.Clone(line.Name); drawLine.X = param.Position.X; drawLine.Y = param.Position.Y; drawList.Add(param.ObjectName, drawLine); objCache.Cache.Add(drawLine.Name, drawLine); return true; case ShapeType.Rectangle: DrawnRectangle rectangle = (DrawnRectangle)shape; DrawnRectangle drawRectangle = rectangle.Clone(rectangle.Name); drawRectangle.X = param.Position.X; drawRectangle.Y = param.Position.Y; drawList.Add(param.ObjectName, drawRectangle); objCache.Cache.Add(drawRectangle.Name, drawRectangle); return true; } break; case DrawnType.String: if (!stringList.ContainsKey(param.DrawableName)) return false; DrawnString drawString = stringList[param.DrawableName].Clone(param.DrawableName); drawString.X = param.Position.X; drawString.Y = param.Position.Y; drawList.Add(param.ObjectName, drawString); objCache.Cache.Add(drawString.Name, drawString); return true; } return false; }
public bool UpdateDrawList(DrawParam param) { if (!drawList.ContainsKey(param.ObjectName)) { return(false); } if (drawCache.Cache.ContainsKey(param.ObjectName)) { ObjectCache cache = drawCache.Cache[param.ObjectName]; if (cache.Cache.ContainsKey(param.DrawableName)) { IDrawn drawableObject = cache.Cache[param.DrawableName]; drawableObject.X = param.Position.X; drawableObject.Y = param.Position.Y; switch (drawableObject.DrawnType) { case DrawnType.Animation: Animation animation = (Animation)drawableObject; animation.Reset(); drawList[param.ObjectName] = animation; return(true); default: drawList[param.ObjectName] = drawableObject; return(true); } } } else { drawCache.Cache.Add(param.ObjectName, new ObjectCache()); } ObjectCache objCache = drawCache.Cache[param.ObjectName]; switch (param.DrawType) { case DrawnType.Animation: if (!animationList.ContainsKey(param.DrawableName)) { return(false); } Animation animation = animationList[param.DrawableName].CloneAnimation(param.DrawableName); animation.Reset(); animation.X = param.Position.X; animation.Y = param.Position.Y; drawList.Add(param.ObjectName, animation); objCache.Cache.Add(animation.Name, animation); break; case DrawnType.Shape: if (!shapeList.ContainsKey(param.DrawableName)) { return(false); } IDrawnShape shape = shapeList[param.DrawableName]; switch (shape.Shape) { case ShapeType.Line: DrawnLine line = (DrawnLine)shape; DrawnLine drawLine = line.Clone(line.Name); drawLine.X = param.Position.X; drawLine.Y = param.Position.Y; drawList.Add(param.ObjectName, drawLine); objCache.Cache.Add(drawLine.Name, drawLine); return(true); case ShapeType.Rectangle: DrawnRectangle rectangle = (DrawnRectangle)shape; DrawnRectangle drawRectangle = rectangle.Clone(rectangle.Name); drawRectangle.X = param.Position.X; drawRectangle.Y = param.Position.Y; drawList.Add(param.ObjectName, drawRectangle); objCache.Cache.Add(drawRectangle.Name, drawRectangle); return(true); } break; case DrawnType.String: if (!stringList.ContainsKey(param.DrawableName)) { return(false); } DrawnString drawString = stringList[param.DrawableName].Clone(param.DrawableName); drawString.X = param.Position.X; drawString.Y = param.Position.Y; drawList.Add(param.ObjectName, drawString); objCache.Cache.Add(drawString.Name, drawString); return(true); } return(false); }