コード例 #1
0
        Packet_PositionAndOrientation ToNetworkEntityPosition(ServerPlatform platform, ServerEntityPositionAndOrientation position)
        {
            Packet_PositionAndOrientation p = new Packet_PositionAndOrientation();

            p.X       = platform.FloatToInt(position.x * 32);
            p.Y       = platform.FloatToInt(position.y * 32);
            p.Z       = platform.FloatToInt(position.z * 32);
            p.Heading = position.heading;
            p.Pitch   = position.pitch;
            p.Stance  = position.stance;
            return(p);
        }
コード例 #2
0
        Packet_ServerEntity ToNetworkEntity(ServerPlatform platform, ServerEntity entity)
        {
            Packet_ServerEntity p = new Packet_ServerEntity();

            if (entity.position != null)
            {
                p.Position = ToNetworkEntityPosition(platform, entity.position);
            }
            if (entity.drawModel != null)
            {
                p.DrawModel              = new Packet_ServerEntityAnimatedModel();
                p.DrawModel.EyeHeight    = platform.FloatToInt(entity.drawModel.eyeHeight * 32);
                p.DrawModel.Model_       = entity.drawModel.model;
                p.DrawModel.ModelHeight  = platform.FloatToInt(entity.drawModel.modelHeight * 32);
                p.DrawModel.Texture_     = entity.drawModel.texture;
                p.DrawModel.DownloadSkin = entity.drawModel.downloadSkin ? 1 : 0;
            }
            if (entity.drawName != null)
            {
                p.DrawName_                    = new Packet_ServerEntityDrawName();
                p.DrawName_.Name               = entity.drawName.name;
                p.DrawName_.Color              = entity.drawName.color;
                p.DrawName_.OnlyWhenSelected   = entity.drawName.onlyWhenSelected;
                p.DrawName_.ClientAutoComplete = entity.drawName.clientAutoComplete;
            }
            if (entity.drawText != null)
            {
                p.DrawText      = new Packet_ServerEntityDrawText();
                p.DrawText.Dx   = platform.FloatToInt(entity.drawText.dx * 32);
                p.DrawText.Dy   = platform.FloatToInt(entity.drawText.dy * 32);
                p.DrawText.Dz   = platform.FloatToInt(entity.drawText.dz * 32);
                p.DrawText.Rotx = platform.FloatToInt(entity.drawText.rotx);
                p.DrawText.Roty = platform.FloatToInt(entity.drawText.roty);
                p.DrawText.Rotz = platform.FloatToInt(entity.drawText.rotz);
                p.DrawText.Text = entity.drawText.text;
            }
            if (entity.push != null)
            {
                p.Push            = new Packet_ServerEntityPush();
                p.Push.RangeFloat = platform.FloatToInt(entity.push.range * 32);
            }
            p.Usable = entity.usable;
            if (entity.drawArea != null)
            {
                p.DrawArea                   = new Packet_ServerEntityDrawArea();
                p.DrawArea.X                 = entity.drawArea.x;
                p.DrawArea.Y                 = entity.drawArea.y;
                p.DrawArea.Z                 = entity.drawArea.z;
                p.DrawArea.Sizex             = entity.drawArea.sizex;
                p.DrawArea.Sizey             = entity.drawArea.sizey;
                p.DrawArea.Sizez             = entity.drawArea.sizez;
                p.DrawArea.VisibleToClientId = entity.drawArea.visibleToClientId;
            }

            return(p);
        }
コード例 #3
0
 Packet_PositionAndOrientation ToNetworkEntityPosition(ServerPlatform platform, ServerEntityPositionAndOrientation position)
 {
     Packet_PositionAndOrientation p = new Packet_PositionAndOrientation();
     p.X = platform.FloatToInt(position.x * 32);
     p.Y = platform.FloatToInt(position.y * 32);
     p.Z = platform.FloatToInt(position.z * 32);
     p.Heading = position.heading;
     p.Pitch = position.pitch;
     p.Stance = position.stance;
     return p;
 }
コード例 #4
0
    Packet_ServerEntity ToNetworkEntity(ServerPlatform platform, ServerEntity entity)
    {
        Packet_ServerEntity p = new Packet_ServerEntity();
        if (entity.position != null)
        {
            p.Position = ToNetworkEntityPosition(platform, entity.position);
        }
        if (entity.drawModel != null)
        {
            p.DrawModel = new Packet_ServerEntityAnimatedModel();
            p.DrawModel.EyeHeight = platform.FloatToInt(entity.drawModel.eyeHeight * 32);
            p.DrawModel.Model_ = entity.drawModel.model;
            p.DrawModel.ModelHeight = platform.FloatToInt(entity.drawModel.modelHeight * 32);
            p.DrawModel.Texture_ = entity.drawModel.texture;
            p.DrawModel.DownloadSkin = entity.drawModel.downloadSkin ? 1 : 0;
        }
        if (entity.drawName != null)
        {
            p.DrawName_ = new Packet_ServerEntityDrawName();
            p.DrawName_.Name = entity.drawName.name;
            p.DrawName_.Color = entity.drawName.color;
            p.DrawName_.OnlyWhenSelected = entity.drawName.onlyWhenSelected;
            p.DrawName_.ClientAutoComplete = entity.drawName.clientAutoComplete;
        }
        if (entity.drawText != null)
        {
            p.DrawText = new Packet_ServerEntityDrawText();
            p.DrawText.Dx = platform.FloatToInt(entity.drawText.dx * 32);
            p.DrawText.Dy = platform.FloatToInt(entity.drawText.dy * 32);
            p.DrawText.Dz = platform.FloatToInt(entity.drawText.dz * 32);
            p.DrawText.Rotx = platform.FloatToInt(entity.drawText.rotx);
            p.DrawText.Roty = platform.FloatToInt(entity.drawText.roty);
            p.DrawText.Rotz = platform.FloatToInt(entity.drawText.rotz);
            p.DrawText.Text = entity.drawText.text;
        }
        if (entity.push != null)
        {
            p.Push = new Packet_ServerEntityPush();
            p.Push.RangeFloat = platform.FloatToInt(entity.push.range * 32);
        }
        p.Usable = entity.usable;
        if (entity.drawArea != null)
        {
            p.DrawArea = new Packet_ServerEntityDrawArea();
            p.DrawArea.X = entity.drawArea.x;
            p.DrawArea.Y = entity.drawArea.y;
            p.DrawArea.Z = entity.drawArea.z;
            p.DrawArea.Sizex = entity.drawArea.sizex;
            p.DrawArea.Sizey = entity.drawArea.sizey;
            p.DrawArea.Sizez = entity.drawArea.sizez;
            p.DrawArea.VisibleToClientId = entity.drawArea.visibleToClientId;
        }

        return p;
    }