public void AddFigure(FigureUnit item) { if (this.isLaserOff != null) { item.IsLaserOff = this.isLaserOff.Value; this.isLaserOff = null; } this.figureCollection.Add(item); this.figureMap.Add(item.Id, item); this.OnAdd?.Invoke(item); }
public FigureUnit Take(string id) { FigureUnit figure = null; try { var temp = this.figureMap[id]; figure = CopyUtil.DeepCopy <FigureUnit>(temp); } catch { } return(figure); }
public void Update(string id, FigureUnit item) { try { var figure = this.figureMap[id]; int index = this.figureCollection.IndexOf(figure); this.figureCollection[index] = item; this.figureMap[id] = item; this.OnUpdate?.Invoke(item); } catch { } }