Example #1
0
        private bool DoUpdateLater(DoLaterBase qInstance, object parm)
        {
            object[]             parms  = (object[])parm;
            IEntity              ent    = (IEntity)parms[0];
            UpdateCodes          detail = (UpdateCodes)parms[1];
            EntityUpdateCallback euc    = OnEntityUpdate;

            if (euc != null)
            {
                euc(ent, detail);
            }
            return(true);
        }
Example #2
0
    public void AddRegion(RegionContextBase rcontext) {
        m_log.Log(LogLevel.DWORLD, "Simulator connected " + rcontext.Name);
        RegionContextBase foundRegion = null;
        lock (m_regionList) {
            foundRegion = GetRegion(rcontext.Name);
            if (foundRegion == null) {
                // we don't know about this region. Add it and connect to events
                m_regionList.Add(rcontext);

                IEntityCollection coll;
                if (rcontext.TryGet<IEntityCollection>(out coll)) {
                    if (Region_OnNewEntityCallback == null) {
                        Region_OnNewEntityCallback = new EntityNewCallback(Region_OnNewEntity);
                    }
                    coll.OnEntityNew += Region_OnNewEntityCallback;

                    if (Region_OnUpdateEntityCallback == null) {
                        Region_OnUpdateEntityCallback = new EntityUpdateCallback(Region_OnUpdateEntity);
                    }
                    coll.OnEntityUpdate += Region_OnUpdateEntityCallback;

                    if (Region_OnRemovedEntityCallback == null) {
                        Region_OnRemovedEntityCallback = new EntityRemovedCallback(Region_OnRemovedEntity);
                    }
                    coll.OnEntityRemoved += Region_OnRemovedEntityCallback;
                }

                if (Region_OnRegionUpdatedCallback == null) {
                    Region_OnRegionUpdatedCallback = new RegionRegionUpdatedCallback(Region_OnRegionUpdated);
                }
                rcontext.OnRegionUpdated += Region_OnRegionUpdatedCallback;
            }
        }
        // tell the world there is a new region (do it outside the lock)
        if (foundRegion == null) {
            if (OnWorldRegionNew != null) OnWorldRegionNew(rcontext);
        }
    }