• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# VRage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中VRage的典型用法代码示例。如果您正苦于以下问题:C# VRage类的具体用法?C# VRage怎么用?C# VRage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VRage类属于命名空间,在下文中一共展示了VRage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ClientWrite

        protected override void ClientWrite(VRage.Library.Collections.BitStream stream,EndpointId forClient, uint timestamp, int maxBitPosition)
        {
            base.ClientWrite(stream,forClient,timestamp,maxBitPosition);

            stream.Write(Entity.WorldMatrix.Translation);

            MyShipController controller = MySession.Static.ControlledEntity as MyShipController;
            stream.WriteBool(m_grid != null && controller != null);
            if (m_grid != null && controller != null)
            {
                stream.WriteBool(m_grid.IsStatic);
                if (m_grid.IsStatic == false)
                {
                    stream.WriteBool(controller != null);
                    if (controller != null)
                    {
                        stream.WriteInt64(controller.EntityId);

                        Vector2 rotation = controller.RotationIndicator;
                        stream.WriteFloat(rotation.X);
                        stream.WriteFloat(rotation.Y);

                        stream.WriteHalf(controller.RollIndicator);

                        Vector3 position = controller.MoveIndicator;
                        stream.WriteHalf(position.X);
                        stream.WriteHalf(position.Y);
                        stream.WriteHalf(position.Z);

                        Vector3D gridPosition = m_grid.PositionComp.GetPosition();
                        MyGridPhysicsStateGroup.WriteSubgrids(m_grid, stream, ref forClient, timestamp, maxBitPosition, m_lowPositionOrientation, ref gridPosition, ref m_currentSentPosition);
                    }
                }
            }
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:35,代码来源:MyGridPositionVerificationStateGroup.cs


示例2: AddToByteStream

 public void AddToByteStream(VRage.ByteStream stream)
 {
     base.AddToByteStream(stream);
     stream.addLongList(SpawnOwners);
     stream.addString(DisplayName);
     stream.addLongList(BigOwners);
 }
开发者ID:HaoTNN,项目名称:GardenPerformance,代码行数:7,代码来源:ConcealableGrid.cs


示例3: ServerRead

        protected override void ServerRead(VRage.Library.Collections.BitStream stream, ulong clientId,uint timestamp)
        {
            base.ServerRead(stream, clientId, timestamp);
            if (stream.ReadBool())
            {
                if (m_grid != null)
                {
                    bool isStatic = stream.ReadBool();
                    if (isStatic == false)
                    {
                        if (stream.ReadBool())
                        {
                            long entityId = stream.ReadInt64();
                            Vector2 rotation = new Vector2();
                            rotation.X = stream.ReadFloat();
                            rotation.Y = stream.ReadFloat();

                            float roll = stream.ReadHalf();

                            Vector3 move = new Vector3();
                            move.X = stream.ReadHalf();
                            move.Y = stream.ReadHalf();
                            move.Z = stream.ReadHalf();

                            MyShipController controller;
                            if (MyEntities.TryGetEntityById<MyShipController>(entityId, out controller))
                            {
                                controller.CacheMoveAndRotate(ref move, ref rotation, roll);
                            }
                        }
                    }
                }
            }
        }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:34,代码来源:MyGridPositionVerificationStateGroup.cs


示例4: GetIntersectionWithLine

        //  Calculates intersection of line with any triangleVertexes in this model instance. Closest intersection and intersected triangleVertexes will be returned.
        public override bool GetIntersectionWithLine(ref LineD line, out VRage.Game.Models.MyIntersectionResultLineTriangleEx? t, IntersectionFlags flags = IntersectionFlags.ALL_TRIANGLES)
        {
            t = null;
            return false;

            //Matrix invWorld = Matrix.Invert(WorldMatrix);
            //Vector3 from = Vector3.Transform(line.From, invWorld);
            //Vector3 to = Vector3.Transform(line.To, invWorld);

            //Line lineLocal = new Line(from, to);

            //bool res = base.GetIntersectionWithLine(ref line, out t, flags);

            //if (res)
            //{
            //    var definition = MyDefinitionManager.Static.GetCubeBlockDefinition(new MyDefinitionId(MyObjectBuilderTypeEnum.Ladder));
            //    if (definition.ExcludedAreaForCamera != null)
            //    {
            //        foreach (var b in definition.ExcludedAreaForCamera)
            //        {
            //            if (b.Contains(t.Value.IntersectionPointInObjectSpace) == ContainmentType.Contains)
            //            {
            //                t = null;
            //                return false;
            //            }
            //        }
            //    }
            //}

            //return res;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:32,代码来源:MyLadder.cs


示例5: ClientWrite

        protected override void ClientWrite(VRage.Library.Collections.BitStream stream)
        {
            base.ClientWrite(stream);

            MyShipController controller = MySession.Static.ControlledEntity as MyShipController;
            stream.WriteBool(m_grid != null && controller != null);
            if (m_grid != null && controller != null)
            {
                stream.WriteBool(m_grid.IsStatic);
                if (m_grid.IsStatic == false)
                {
                  
                    stream.WriteBool(controller != null);
                    if (controller != null)
                    {
                        stream.WriteInt64(controller.EntityId);

                        Vector2 rotation = controller.RotationIndicator;
                        stream.WriteFloat(rotation.X);
                        stream.WriteFloat(rotation.Y);

                        stream.WriteHalf(controller.RollIndicator);

                        Vector3 position = controller.MoveIndicator;
                        stream.WriteHalf(position.X);
                        stream.WriteHalf(position.Y);
                        stream.WriteHalf(position.Z);
                    }
                }
            }

        }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:32,代码来源:MyGridPositionVerificationStateGroup.cs


示例6: deserialize

        public override void deserialize(VRage.ByteStream stream)
        {
            base.deserialize(stream);

            Settings = new ConquestSettings.SETTINGS();

            // Control Points
            ushort cpCount = stream.getUShort();
            Settings.ControlPoints = new List<Records.ControlPoint>();
            for (ushort i = 0; i < cpCount; ++i) {
                Settings.ControlPoints.Add(
                    Records.ControlPoint.deserialize(stream)
                );
            }

            // CP Period
            Settings.CPPeriod = (int)stream.getLong();

            // Cleanup Period
            Settings.CleanupPeriod = (int)stream.getLong();

            // Block Types
            ushort blockTypesLength = stream.getUShort();
            Settings.BlockTypes = new Records.BlockType[blockTypesLength];
            for (ushort i = 0; i < blockTypesLength; ++i) {
                Settings.BlockTypes[i] = Records.BlockType.deserialize(stream);
            }

            // Hull Rules
            ushort hullRulesLength = stream.getUShort();
            Settings.HullRules = new Records.HullRuleSet[hullRulesLength];
            for (ushort i = 0; i < hullRulesLength; ++i) {
                Settings.HullRules[i] = Records.HullRuleSet.deserialize(stream);
            }
        }
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:35,代码来源:SettingsResponse.cs


示例7: Set

        internal static void Set(VRage.Common.MyRenderVoxelMaterialData[] list)
        {
            Array.Resize(ref Materials, list.Length);

            for(int i=0; i<list.Length; i++)
            {
                // copy data :O

                Materials[i].Near.ColorMetalXZnY_Texture   = list[i].ColorMetalXZnY;
                Materials[i].Near.ColorMetalpY_Texture     = list[i].ColorMetalY;
                Materials[i].Near.NormalGlossXZnY_Texture  = list[i].NormalGlossXZnY;
                Materials[i].Near.NormalGlosspY_Texture    = list[i].NormalGlossY;
                Materials[i].Near.ExtXZnY_Texture          = list[i].ExtXZnY;
                Materials[i].Near.ExtpY_Texture            = list[i].ExtY;
                Materials[i].Near.TextureScale             = list[i].Scale;

                Materials[i].Far1.ColorMetalXZnY_Texture  = list[i].ColorMetalXZnYFar1;
                Materials[i].Far1.ColorMetalpY_Texture    = list[i].ColorMetalYFar1;
                Materials[i].Far1.NormalGlossXZnY_Texture = list[i].NormalGlossXZnYFar1;
                Materials[i].Far1.NormalGlosspY_Texture   = list[i].NormalGlossYFar1;
                Materials[i].Far1.ExtXZnY_Texture         = list[i].ExtXZnYFar1;
                Materials[i].Far1.ExtpY_Texture           = list[i].ExtYFar1;
                Materials[i].Far1.TextureScale            = list[i].ScaleFar1;

                Materials[i].Far2.ColorMetalXZnY_Texture  = list[i].ColorMetalXZnYFar2;
                Materials[i].Far2.ColorMetalpY_Texture    = list[i].ColorMetalYFar2;
                Materials[i].Far2.NormalGlossXZnY_Texture = list[i].NormalGlossXZnYFar2;
                Materials[i].Far2.NormalGlosspY_Texture   = list[i].NormalGlossYFar2;
                Materials[i].Far2.ExtXZnY_Texture         = list[i].ExtXZnYFar2;
                Materials[i].Far2.ExtpY_Texture           = list[i].ExtYFar2;
                Materials[i].Far2.TextureScale            = list[i].ScaleFar2;
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:33,代码来源:VoxelMaterial.cs


示例8: RemoveFromByteStream

 public void RemoveFromByteStream(VRage.ByteStream stream)
 {
     base.RemoveFromByteStream(stream);
     SpawnOwners = stream.getLongList();
     DisplayName = stream.getString();
     BigOwners = stream.getLongList();
 }
开发者ID:HaoTNN,项目名称:GardenPerformance,代码行数:7,代码来源:ConcealableGrid.cs


示例9: deserialize

        public override void deserialize(VRage.ByteStream stream)
        {
            base.deserialize(stream);

            NotificationText = stream.getString();
            Time = stream.getUShort();
            Font = (MyFontEnum)stream.getUShort();
        }
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:8,代码来源:NotificationResponse.cs


示例10: EntityComponent

 public EntityComponent(VRage.ByteStream stream)
     : base()
 {
     long entityId = stream.getLong();
     Entity = MyAPIGateway.Entities.GetEntityById(entityId);
     Log = new Logger("SEGarden.Logic.EntityComponent", (() => EntityId.ToString()));
     //Log.Trace("Finished EntityComponent deserialize", "ctr");
 }
开发者ID:zrisher,项目名称:SEGarden,代码行数:8,代码来源:EntityComponent.cs


示例11: ClientWrite

        protected override void ClientWrite(VRage.Library.Collections.BitStream stream)
        {
                 
            base.ClientWrite(stream);

            stream.WriteBool(m_character != null);
            if (m_character != null)
            {
                var physGroup = MyExternalReplicable.FindByObject(m_character).FindStateGroup<MyCharacterPhysicsStateGroup>();
                long? supportId = null;
                if (physGroup != null)
                {
                    physGroup.SetSupport(physGroup.FindSupportDelegate());
                    supportId = physGroup.GetSupportId();
                }

                stream.WriteBool(supportId.HasValue);
                if (supportId.HasValue)
                {
                    stream.WriteInt64(supportId.Value);
                }

                Vector3 position = m_character.MoveIndicator;
                stream.WriteHalf(position.X);
                stream.WriteHalf(position.Y);
                stream.WriteHalf(position.Z);

                Vector2 rotate = m_character.RotationIndicator;
                stream.WriteFloat(rotate.X);
                stream.WriteFloat(rotate.Y);

                stream.WriteFloat(m_character.RollIndicator);

                // Movement state, 2B
                stream.WriteUInt16((ushort)m_character.GetNetworkMovementState());
                // Movement flag.
                stream.WriteUInt16((ushort)m_character.PreviousMovementFlags);

                // Flags, 6 bits
                bool hasJetpack = m_character.JetpackComp != null;
                stream.WriteBool(hasJetpack ? m_character.JetpackComp.TurnedOn : false);
                stream.WriteBool(hasJetpack ? m_character.JetpackComp.DampenersTurnedOn : false);
                stream.WriteBool(m_character.LightEnabled); // TODO: Remove
                stream.WriteBool(m_character.ZoomMode == MyZoomModeEnum.IronSight);
                stream.WriteBool(m_character.RadioBroadcaster.WantsToBeEnabled); // TODO: Remove
                stream.WriteBool(m_character.TargetFromCamera);
                stream.WriteFloat(m_character.HeadLocalXAngle);
                stream.WriteFloat(m_character.HeadLocalYAngle);

                if ((hasJetpack && m_character.JetpackComp.TurnedOn) == false)
                {
                    MatrixD matrix = m_character.WorldMatrix;
                    stream.WriteQuaternionNorm(Quaternion.CreateFromForwardUp(matrix.Forward, matrix.Up));
                }
            }        
           
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:57,代码来源:MyCharacterPositionVerificationStateGroup.cs


示例12: ControllableEntity

 // Byte Deserialization
 public ControllableEntity(VRage.ByteStream stream)
     : base(stream)
 {
     Log.ClassName = "GP.Concealment.World.Entities.ControllableEntity";
     IsMoving = stream.getBoolean();
     RecentlyMoved = stream.getBoolean();
     RecentlyMovedEnds = stream.getDateTime();
     Log.Trace("New Controllable Entity " + DisplayName, "ctr");
 }
开发者ID:zrisher,项目名称:GardenPerformance,代码行数:10,代码来源:ControllableEntity.cs


示例13: serialize

 public void serialize(VRage.ByteStream stream)
 {
     stream.addLong((long)Position.X);
     stream.addLong((long)Position.Y);
     stream.addLong((long)Position.Z);
     stream.addString(Name);
     stream.addLong(Radius);
     stream.addLong(TokensPerPeriod);
 }
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:9,代码来源:ControlPoint.cs


示例14: Settings

 // Byte Deserialization
 public Settings(VRage.ByteStream stream)
 {
     ControlledMovingGraceTimeSeconds = (ushort)stream.getUlong();
     ControlledMovementGraceDistanceMeters = (ushort)stream.getUlong();
     RevealVisibilityMeters = (ushort)stream.getUlong();
     //RevealDetectabilityMeters = 10; //50;
     //RevealCommunicationMeters = 10; //50;
     //RevealCollisionMeters = 10; //10;
     ConcealNearAsteroids = stream.getBoolean();
 }
开发者ID:zrisher,项目名称:GardenPerformance,代码行数:11,代码来源:Settings.cs


示例15: CubeBlockEffect

 public CubeBlockEffect(VRage.Game.MyObjectBuilder_CubeBlockDefinition.CubeBlockEffect Effect)
 {
     this.Name = Effect.Name;
     this.Origin = Effect.Origin;
     this.Delay = Effect.Delay;
     this.Loop = Effect.Loop;
     this.SpawnTimeMin = Effect.SpawnTimeMin;
     this.SpawnTimeMax = Effect.SpawnTimeMax;
     this.Duration = Effect.Duration;
 }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:10,代码来源:MyCubeBlockDefinition.cs


示例16: AddToByteStream

 public void AddToByteStream(VRage.ByteStream stream)
 {
     stream.addLong(EntityId);
     stream.addUShort((ushort)Type);
     stream.addVector3D(Position);
     stream.addBoolean(Transparent);
     stream.addBoolean(IsStatic);
     stream.addUShort((ushort)Revealability);
     stream.addUShort((ushort)Concealability);
     stream.addUShort((ushort)Status);
 }
开发者ID:HaoTNN,项目名称:GardenPerformance,代码行数:11,代码来源:ConcealableEntity.cs


示例17: ConcealedEntity

 // Byte Deserialization
 public ConcealedEntity(VRage.ByteStream stream)
     : this()
 {
     TypeOfEntity = (EntityType)stream.getUShort();
     EntityId = stream.getLong();
     Position = stream.getVector3D();
     // Clients don't need AABB details
     IsRevealBlocked = stream.getBoolean();
     IsObserved = stream.getBoolean();
     Log = new Logger("GP.Concealment.World.Entities.ConcealedEntity",
         EntityId.ToString());
 }
开发者ID:zrisher,项目名称:GardenPerformance,代码行数:13,代码来源:ConcealedEntity.cs


示例18: MyClipmapHandler

        internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, Vector3D massiveCenter, float massiveRadius, bool spherize, RenderFlags additionalFlags, VRage.Voxels.MyClipmap.PruningFunc prunningFunc)
        {
            m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this, massiveCenter, massiveRadius, prunningFunc);
            m_massiveCenter = massiveCenter;
            m_renderFlags = additionalFlags;

            if (spherize)
                m_massiveRadius = massiveRadius;

            const int mergeLodSubdivideCount = 3;
            m_mergeHandler = new MyLodMeshMergeHandler(Base, MyCellCoord.MAX_LOD_COUNT, mergeLodSubdivideCount, ref worldMatrix, ref massiveCenter, massiveRadius, m_renderFlags);

            MyClipmap.AddToUpdate(MyEnvironment.CameraPosition, Base);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:14,代码来源:MyClipmapHandler.cs


示例19: deserialize

        public static BlockType deserialize(VRage.ByteStream stream)
        {
            BlockType result = new BlockType();

            result.DisplayName = stream.getString();

            ushort subTypeStringsCount = stream.getUShort();
            result.SubTypeStrings = new List<string>();
            for (ushort i = 0; i < subTypeStringsCount; ++i) {
                result.SubTypeStrings.Add(stream.getString());
            }

            return result;
        }
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:14,代码来源:BlockType.cs


示例20: ObservingEntity

        // Byte Deserialization
        public ObservingEntity(VRage.ByteStream stream)
            : base(stream)
        {
            List<long> entitiesViewing = stream.getLongList();
            foreach (long id in entitiesViewing) {
                EntitiesViewing.Add(id, null);
            }

            LastObservingTime = stream.getDateTime();
            LastObservingPosition = stream.getVector3D();
            //Log.Trace("Deserialized LastObservingTime of " + LastObservingTime, "stream ctr");
            //Log.Trace("Deserialized LastObservingPosition of " + LastObservingPosition, "stream ctr");
            //Log.Trace("Deserialized ViewDistance of " + ViewDistance, "stream ctr");
        }
开发者ID:zrisher,项目名称:GardenPerformance,代码行数:15,代码来源:ObservingEntity.cs



注:本文中的VRage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# VRageMath类代码示例发布时间:2022-05-24
下一篇:
C# VRMLParser类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap