/// <summary> /// Raises an event indicating that a game object has been added to an area. /// </summary> protected void InstanceInsertedIntoCollection(OEICollectionWithEvents cList, int index, object value) { INWN2Instance ins = (INWN2Instance)value; NWN2GameArea area = (NWN2GameArea)cList.Tag; OnInstanceAdded(cList, new InstanceEventArgs(ins, area)); }
// // Called when a resource element changes and a rescan is necessary. // private void OnResourceRepositoryInvalidated(OEICollectionWithEvents List) { // // Tell the resource accessor to invalidate its resource indexes. // InvalidateResourceIndexes(); }
private void OnResourceRepositoryAdded(OEICollectionWithEvents List, int Index, object Value) { IResourceRepository Repository = (IResourceRepository)Value; // // Subscribe to the new repository. // Repository.Resources.Changed += this.OnResourceRepositoryContentsInvalidated; InvalidateResourceIndexes(); }
/// <summary> /// Raises an event indicating that a game object has been removed from an area. /// </summary> protected void InstanceRemovedFromCollection(OEICollectionWithEvents cList, int index, object value) { INWN2Instance ins = (INWN2Instance)value; try { foreach (NWN2GameArea a in NWN2Toolset.NWN2ToolsetMainForm.App.Module.Areas.Values) { foreach (NWN2InstanceCollection collection in a.AllInstances) { if (collection == cList) { OnInstanceRemoved(cList, new InstanceEventArgs(ins, a)); return; } } } } catch (Exception) {} // Always null when the instance has been removed: NWN2GameArea area = (NWN2GameArea)cList.Tag; OnInstanceRemoved(cList, new InstanceEventArgs(ins, area)); }