public AreaExt CloneWithOperationArea(AreaExtOperator op, Area area) { List <KeyValuePair <int, AreaExtOperator> > newAreaList = new List <KeyValuePair <int, AreaExtOperator> >(areaExtID.Areas); newAreaList.RemoveAll(x => x.Key == area.ID); AreaExtID newID = areaExtID; if (op == AreaExtOperator.Inclusion) { newAreaList.Insert(0, new KeyValuePair <int, AreaExtOperator>(area.ID, AreaExtOperator.Inclusion)); } else if (op == AreaExtOperator.Exclusion) { newAreaList.Add(new KeyValuePair <int, AreaExtOperator>(area.ID, AreaExtOperator.Exclusion)); } else { if (newAreaList.Count == 0) { return(null); } } newID = new AreaExtID(areaManager.map.uniqueID, newAreaList); return(new AreaExt(newID)); }
public AreaExt(AreaExtID areaExtID) { this.areaExtID = areaExtID; this.Init(); AreaExtEventManager.Register(this); }
public AreaExt(Map map, AreaExtOperator op, Area area) { var areaIDList = new List <KeyValuePair <int, AreaExtOperator> >(); areaIDList.Add(new KeyValuePair <int, AreaExtOperator>(area.ID, op)); this.areaExtID = new AreaExtID(map.uniqueID, areaIDList); this.Init(); AreaExtEventManager.Register(this); }
public static AreaExt OnLoadingVars(string id) { AreaExtID areaExtID = new AreaExtID(id); if (!cache.ContainsKey(areaExtID.MapID)) { cache[areaExtID.MapID] = new List<WeakReference<AreaExt>>(); } AreaExt areaExt; WeakReference<AreaExt> refAreaExt = cache[areaExtID.MapID].Find(x => x.IsAlive && x.Target.GetUniqueLoadID() == id); if (refAreaExt != null) { areaExt = refAreaExt.Target; } else { areaExt = new AreaExt(areaExtID); cache[areaExtID.MapID].Add(new WeakReference<AreaExt>(areaExt)); } return areaExt; }