Exemple #1
0
 internal QueryResult Add(string alias, EntityShadow entity, string[] columns)
 {
     results.Add(alias, new EntityContainer {
         Alias = alias, Entity = entity, Columns = columns
     });
     return(this);
 }
Exemple #2
0
 public EntityList(Game game)
 {
     this.game = game;
     game.Events.ChatFontChanged += ChatFontChanged;
     NamesMode  = Options.GetEnum(OptionsKey.NamesMode, NameMode.AllNamesAndHovered);
     ShadowMode = Options.GetEnum(OptionsKey.EntityShadow, EntityShadow.None);
 }
Exemple #3
0
 public EntityList( Game game )
 {
     this.game = game;
     game.Events.ChatFontChanged += ChatFontChanged;
     game.Events.TextureChanged += TextureChanged;
     NamesMode = Options.GetEnum( OptionsKey.NamesMode, NameMode.AllAndHovered );
     if( game.ClassicMode ) NamesMode = NameMode.HoveredOnly;
     ShadowMode = Options.GetEnum( OptionsKey.EntityShadow, EntityShadow.None );
     if( game.ClassicMode ) ShadowMode = EntityShadow.None;
 }
 internal EntityContainer(EntityShadow entity)
 {
     if (entity == null)
     {
         throw new ArgumentException("root entity cannot be null.");
     }
     this[string.Empty] = entity;
     this.Id            = entity.Id;
     this.LogicalName   = entity.LogicalName;
 }
 public EntityList(Game game)
 {
     this.game = game;
     game.Events.ChatFontChanged += ChatFontChanged;
     game.Events.TextureChanged  += TextureChanged;
     NamesMode = Options.GetEnum(OptionsKey.NamesMode, NameMode.AllAndHovered);
     if (game.ClassicMode)
     {
         NamesMode = NameMode.HoveredOnly;
     }
     ShadowMode = Options.GetEnum(OptionsKey.EntityShadow, EntityShadow.None);
     if (game.ClassicMode)
     {
         ShadowMode = EntityShadow.None;
     }
 }
Exemple #6
0
        public EntityList(Game game)
        {
            this.game = game;
            game.Graphics.ContextLost      += ContextLost;
            game.Graphics.ContextRecreated += ContextRecreated;
            game.Events.ChatFontChanged    += ChatFontChanged;

            NamesMode = Options.GetEnum(OptionsKey.NamesMode, NameMode.Hovered);
            if (game.ClassicMode)
            {
                NamesMode = NameMode.Hovered;
            }
            ShadowMode = Options.GetEnum(OptionsKey.EntityShadow, EntityShadow.None);
            if (game.ClassicMode)
            {
                ShadowMode = EntityShadow.None;
            }
        }
        internal EntityContainer Add(string alias, EntityShadow entity)
        {
            if (string.IsNullOrEmpty(alias))
            {
                throw new ArgumentException("alias cannot be null");
            }

            if (entities.ContainsKey(alias))
            {
                throw new ArgumentException("Dublicate alias, alias can only be used once.");
            }

            var result = new EntityContainer(this[string.Empty]);

            foreach (var key in this.entities.Keys)
            {
                if (key != string.Empty)
                {
                    result[key] = this.entities[key];
                }
            }
            result[alias] = entity;
            return(result);
        }
Exemple #8
0
        internal void Draw()
        {
            EntityShadow mode = game.Entities.ShadowMode;
            Vector3      Position = entity.Position;
            float        posX = Position.X, posZ = Position.Z;
            int          posY = Math.Min((int)Position.Y, game.World.Height - 1);
            int          index = 0, vb = 0;

            radius = 7f * Math.Min(entity.ModelScale, 1) * entity.Model.ShadowScale;

            VertexP3fT2fC4b[] verts = null;
            int         posCount = 0, dataCount = 0;
            Vector3I *  coords = stackalloc Vector3I[4];
            ShadowData *data   = stackalloc ShadowData[4];

            for (int i = 0; i < 4; i++)
            {
                coords[i] = new Vector3I(int.MinValue);
                data[i]   = new ShadowData();
            }

            if (mode == EntityShadow.SnapToBlock)
            {
                vb = game.Graphics.texVb; verts = game.Graphics.texVerts;
                if (!GetBlocks(coords, ref posCount, posX, posZ, posY, data, ref dataCount))
                {
                    return;
                }

                float x1 = Utils.Floor(posX), z1 = Utils.Floor(posZ);
                DraqSquareShadow(verts, ref index, data[0].Y, 220, x1, z1);
            }
            else
            {
                vb = game.ModelCache.vb; verts = game.ModelCache.vertices;

                float x = posX - radius / 16f, z = posZ - radius / 16f;
                if (GetBlocks(coords, ref posCount, x, z, posY, data, ref dataCount) && data[0].A > 0)
                {
                    DrawCircle(verts, ref index, data, dataCount, x, z);
                }

                x = Math.Max(posX - radius / 16f, Utils.Floor(posX + radius / 16f));
                if (GetBlocks(coords, ref posCount, x, z, posY, data, ref dataCount) && data[0].A > 0)
                {
                    DrawCircle(verts, ref index, data, dataCount, x, z);
                }

                z = Math.Max(posZ - radius / 16f, Utils.Floor(posZ + radius / 16f));
                if (GetBlocks(coords, ref posCount, x, z, posY, data, ref dataCount) && data[0].A > 0)
                {
                    DrawCircle(verts, ref index, data, dataCount, x, z);
                }

                x = posX - radius / 16f;
                if (GetBlocks(coords, ref posCount, x, z, posY, data, ref dataCount) && data[0].A > 0)
                {
                    DrawCircle(verts, ref index, data, dataCount, x, z);
                }
            }

            if (index == 0)
            {
                return;
            }
            CheckShadowTexture(game.Graphics);

            if (!boundShadowTex)
            {
                game.Graphics.BindTexture(shadowTex);
                boundShadowTex = true;
            }
            game.Graphics.UpdateDynamicIndexedVb(DrawMode.Triangles, vb, verts, index);
        }
Exemple #9
0
 internal QueryResult(EntityShadow entity, string[] columns)
 {
     results.Add(entity.LogicalName, new EntityContainer {
         Entity = entity, Columns = columns
     });
 }