Пример #1
0
        //PREDICATE
        public void DoUpdate()
        {
            lock (a_Main)
            {
                if (m_up) return;
                m_up = true;
            }

            RenderCollection m_NS = new RenderCollection();
            RenderCollection m_ND = new RenderCollection();
            RenderInformation RI = Camera.CreateRenderInformation(true);
            IList<Node> N = ManagedWorld.NodeLibrary.OcTree.FindNodes(RI.BoundingFrustums[0]);

            if(USE_PORTROOMS)
                PortalRoomManager.TraverseTree(m_NS, m_ND, RI.BoundingFrustums[0]);
            foreach (Node n in N)
            {
                GraphicNode gn = n as GraphicNode;
                ILrentObject.ObjectTagger ta = n.Tag as ILrentObject.ObjectTagger;
                if (!n.Visible || gn == null || ta == null)
                    continue;
                if (USE_PORTROOMS && ta.PortalRoom != null)
                    continue;
                ILrentObject o = ta.Object;
                //if (o.Entity != null && !o.IsFreePoint && o.Entity.FadeOutRange < Vector3.Distance(RI.CameraPosition, o.Position))
                //    continue;

                if (o.File.IsLevelLrent)
                    m_NS.Add(gn);
                else m_ND.Add(gn);
            }
            m_NS.FinishCollecting();
            m_ND.FinishCollecting();

            lock (a_Ren)
            {
                m_NodesStatic = m_NS;
                m_NodesDynamic = m_ND;
            }
            m_up = false;
        }
Пример #2
0
        private void UpdateText(int numTicks, ref RenderCollection rc)
        {
            List <string>          toRem    = new List <string>();
            List <DeferredMessage> messages = new List <DeferredMessage>();

            toRem.Clear();
            foreach (KeyValuePair <string, ScarboroughText> si in textitems)
            {
                try
                {
                    if (si.Value.Logic(numTicks) == false)
                    {
                        toRem.Add(si.Key);
                    }
                    else
                    {
                        if (si.Value.Opacity > 0)
                        {
                            rc.Add(si.Value);
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (si.Value.ctx != null && si.Value.ctx.trig != null)
                    {
                        messages.Add(new DeferredMessage()
                        {
                            ctx     = si.Value.ctx,
                            plug    = plug,
                            level   = Triggernometry.Plugin.DebugLevelEnum.Error,
                            Message = Triggernometry.I18n.Translate("internal/AuraContainer/updateerror", String.Format("Deactivating aura due to update exception: {0}", ex.Message))
                        }
                                     );
                    }
                    else
                    {
                        messages.Add(new DeferredMessage()
                        {
                            ctx     = null,
                            plug    = plug,
                            level   = Triggernometry.Plugin.DebugLevelEnum.Error,
                            Message = Triggernometry.I18n.Translate("internal/AuraContainer/updateerror", String.Format("Deactivating aura due to update exception: {0}", ex.Message))
                        }
                                     );
                    }
                    toRem.Add(si.Key);
                }
            }
            if (toRem.Count > 0)
            {
                foreach (string si in toRem)
                {
                    ScarboroughText sit = textitems[si];
                    if (sit.ctx != null && sit.ctx.trig != null)
                    {
                        messages.Add(new DeferredMessage()
                        {
                            ctx     = sit.ctx,
                            plug    = plug,
                            level   = Triggernometry.Plugin.DebugLevelEnum.Verbose,
                            Message = Triggernometry.I18n.Translate("internal/AuraContainer/closingaura", "Closing aura window")
                        }
                                     );
                    }
                    else
                    {
                        messages.Add(new DeferredMessage()
                        {
                            ctx     = null,
                            plug    = plug,
                            level   = Triggernometry.Plugin.DebugLevelEnum.Verbose,
                            Message = Triggernometry.I18n.Translate("internal/AuraContainer/closingaura", "Closing aura window")
                        }
                                     );
                    }
                    textitems.Remove(si);
                    sit.Dispose();
                }
            }
            ProcessMessages(messages);
        }
Пример #3
0
        private void UpdateImages(int numTicks, ref RenderCollection rc)
        {
            List <string>          toRem    = new List <string>();
            List <DeferredMessage> messages = new List <DeferredMessage>();

            toRem.Clear();
            foreach (KeyValuePair <string, ScarboroughImage> si in imageitems)
            {
                try
                {
                    if (si.Value.Logic(numTicks) == false)
                    {
                        toRem.Add(si.Key);
                    }
                    else
                    {
                        if (si.Value.Changed == true)
                        {
                            si.Value.NeedRender = true;
                            si.Value.Changed    = false;
                        }
                        rc.Add(si.Value);
                    }
                }
                catch (Exception ex)
                {
                    if (si.Value.ctx != null && si.Value.ctx.trig != null)
                    {
                        messages.Add(new DeferredMessage()
                        {
                            ctx     = si.Value.ctx,
                            plug    = plug,
                            level   = Triggernometry.RealPlugin.DebugLevelEnum.Error,
                            Message = Triggernometry.I18n.Translate("internal/AuraContainer/updateerror", String.Format("Deactivating aura '{0}' from trigger '{1}' due to update exception: {2}", si.Key, si.Value.ctx.trig.LogName, ex.Message))
                        }
                                     );
                    }
                    else
                    {
                        messages.Add(new DeferredMessage()
                        {
                            ctx     = null,
                            plug    = plug,
                            level   = Triggernometry.RealPlugin.DebugLevelEnum.Error,
                            Message = Triggernometry.I18n.Translate("internal/AuraContainer/updateerror", String.Format("Deactivating aura '{0}' due to update exception: {1}", si.Key, ex.Message))
                        }
                                     );
                    }
                    toRem.Add(si.Key);
                }
            }
            if (toRem.Count > 0)
            {
                foreach (string si in toRem)
                {
                    ScarboroughImage sit = imageitems[si];
                    if (sit.ctx != null && sit.ctx.trig != null)
                    {
                        messages.Add(new DeferredMessage()
                        {
                            ctx     = sit.ctx,
                            plug    = plug,
                            level   = Triggernometry.RealPlugin.DebugLevelEnum.Verbose,
                            Message = Triggernometry.I18n.Translate("internal/AuraContainer/closingaura", "Closing aura window")
                        }
                                     );
                    }
                    else
                    {
                        messages.Add(new DeferredMessage()
                        {
                            ctx     = null,
                            plug    = plug,
                            level   = Triggernometry.RealPlugin.DebugLevelEnum.Verbose,
                            Message = Triggernometry.I18n.Translate("internal/AuraContainer/closingaura", "Closing aura window")
                        }
                                     );
                    }
                    imageitems.Remove(si);
                    sit.Dispose();
                }
            }
            ProcessMessages(messages);
        }