当前位置: 首页>>代码示例>>C#>>正文


C# MyPlayer.PlayerId类代码示例

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


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

示例1: RequestClearSlot

        public static void RequestClearSlot(PlayerId pid, int index)
        {
            var msg = new PlayerToolbarClearSlotMsg();
            msg.ClientSteamId = pid.SteamId;
            msg.PlayerSerialId = pid.SerialId;
            msg.Index = index;

            Sync.Layer.SendMessageToServer(ref msg);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyToolbarCollection.cs

示例2: RequestChangeSlotItem

        public static void RequestChangeSlotItem(PlayerId pid, int index, MyDefinitionId defId)
        {
            var msg = new PlayerToolbarChangeSlotMsg();
            msg.ClientSteamId = pid.SteamId;
            msg.PlayerSerialId = pid.SerialId;
            msg.Index = index;
            msg.DefId = defId;

            Sync.Layer.SendMessageToServer(ref msg);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:10,代码来源:MyToolbarCollection.cs

示例3: OnSaveEntityCameraSettings

 static void OnSaveEntityCameraSettings(PlayerId playerId, long entityId, bool isFirstPerson, double distance, float headAngleX, float headAngleY)
 {
     PlayerId pid = new PlayerId(playerId.SteamId, playerId.SerialId);
     Vector2 headAngle = new Vector2(headAngleX, headAngleY);
     MyPlayer player = MySession.Static.Players.GetPlayerById(pid);
     if (player != null && player.Character != null && player.Character.EntityId == entityId)
         MySession.Static.Cameras.AddCharacterCameraData(pid, isFirstPerson, distance, headAngle);
     else
         MySession.Static.Cameras.AddCameraData(pid, entityId, isFirstPerson, distance, headAngle);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:10,代码来源:MyCameraCollection.cs

示例4: OnClearSlotRequest

        static void OnClearSlotRequest(ref PlayerToolbarClearSlotMsg msg, MyNetworkClient sender)
        {
            var playerId = new PlayerId(sender.SteamUserId, msg.PlayerSerialId);
            if (!MySession.Static.Toolbars.ContainsToolbar(playerId))
                return;

            var toolbar = MySession.Static.Toolbars.TryGetPlayerToolbar(playerId);

            toolbar.SetItemAtIndex(msg.Index, null);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:10,代码来源:MyToolbarCollection.cs

示例5: OnClearSlotRequest

        static void OnClearSlotRequest(int playerSerialId, int index)
        {
            ulong senderId = GetSenderIdSafe();
            var playerId = new PlayerId(senderId, playerSerialId);
            if (!MySession.Static.Toolbars.ContainsToolbar(playerId))
                return;

            var toolbar = MySession.Static.Toolbars.TryGetPlayerToolbar(playerId);

            toolbar.SetItemAtIndex(index, null);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:11,代码来源:MyToolbarCollection.cs

示例6: OnChangeSlotBuilderItemRequest

        static void OnChangeSlotBuilderItemRequest(int playerSerialId, int index,
            [Serialize(MyObjectFlags.Dynamic, DynamicSerializerType = typeof(MyObjectBuilderDynamicSerializer))] MyObjectBuilder_ToolbarItem itemBuilder)
		{
            ulong senderId = GetSenderIdSafe();
            var playerId = new PlayerId(senderId, playerSerialId);
			if (!MySession.Static.Toolbars.ContainsToolbar(playerId))
				return;

            var tItem = MyToolbarItemFactory.CreateToolbarItem(itemBuilder);
			var toolbar = MySession.Static.Toolbars.TryGetPlayerToolbar(playerId);
			if (toolbar == null)
				return;
            toolbar.SetItemAtIndex(index, tItem);
		}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:14,代码来源:MyToolbarCollection.cs

示例7: RequestSaveEntityCameraSettings

        public void RequestSaveEntityCameraSettings(PlayerId pid, long entityId, bool isFirstPerson, double distance, float headAngleX, float headAngleY)
        {
            if (MyEntities.CloseAllowed)
                return;

            var msg = new PlayerSaveEntityCameraSettingsMsg();
            msg.PlayerSerialId = pid.SerialId;
            msg.EntityId = entityId;
            msg.Distance = distance;
            msg.IsFirstPerson = isFirstPerson;
            msg.HeadX = headAngleX;
            msg.HeadY = headAngleY;

            Sync.Layer.SendMessageToServer(ref msg);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:15,代码来源:MyCameraCollection.cs

示例8: OnChangeSlotItemRequest

        static void OnChangeSlotItemRequest(int playerSerialId, int index, DefinitionIdBlit defId)
		{
            ulong senderId = GetSenderIdSafe();
            var playerId = new PlayerId(senderId, playerSerialId);
			if (!MySession.Static.Toolbars.ContainsToolbar(playerId))
				return;

			MyDefinitionBase def;
			MyDefinitionManager.Static.TryGetDefinition(defId, out def);
			if (def == null)
				return;

			var ob = MyToolbarItemFactory.ObjectBuilderFromDefinition(def);
			var tItem = MyToolbarItemFactory.CreateToolbarItem(ob);
			var toolbar = MySession.Static.Toolbars.TryGetPlayerToolbar(playerId);
			if (toolbar == null)
				return;
			toolbar.SetItemAtIndex(index, tItem);
		}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:19,代码来源:MyToolbarCollection.cs

示例9: AddCameraData

 private void AddCameraData(PlayerId pid, long entityId, bool isFirstPerson, double distance, Vector2 headAngle)
 {
     MyEntityCameraSettings cameraSettings = null;
     if (TryGetCameraSettings(pid, entityId, out cameraSettings))
     {
         cameraSettings.IsFirstPerson = isFirstPerson;
         if (!isFirstPerson)
         {
             cameraSettings.Distance = distance;
             cameraSettings.HeadAngle = headAngle;
         }
     }
     else
     {
         cameraSettings = new MyEntityCameraSettings()
         {
             Distance = distance,
             IsFirstPerson = isFirstPerson,
             HeadAngle = headAngle,
         };
         AddCameraData(pid, entityId, cameraSettings);
     }
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:23,代码来源:MyCameraCollection.cs

示例10: SaveEntityCameraSettings

        public void SaveEntityCameraSettings(PlayerId pid, long entityId, bool isFirstPerson, double distance, float headAngleX, float headAngleY, bool sync = true)
        {
            if (!Sync.IsServer && sync)
            {
                RequestSaveEntityCameraSettings(pid, entityId, isFirstPerson, distance, headAngleX, headAngleY);
            }

            Vector2 headAngle = new Vector2(headAngleX, headAngleY);
            if (MySession.ControlledEntity is MyCharacter || (MySession.LocalCharacter != null && MySession.LocalCharacter.EntityId == entityId))
                AddCharacterCameraData(pid, isFirstPerson, distance, headAngle);
            else
                AddCameraData(pid, entityId, isFirstPerson, distance, headAngle);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:13,代码来源:MyCameraCollection.cs

示例11: LoadCameraCollection

        public void LoadCameraCollection(MyObjectBuilder_Checkpoint checkpoint)
        {
            m_entityCameraSettings = new Dictionary<PlayerId, Dictionary<long, MyEntityCameraSettings>>();
            
            var allPlayers = checkpoint.AllPlayersData;
            if (allPlayers != null)
            {
                foreach (var playerData in allPlayers.Dictionary)
                {
                    PlayerId pid = new PlayerId(playerData.Key.ClientId, playerData.Key.SerialId);
                    m_entityCameraSettings[pid] = new Dictionary<long, MyEntityCameraSettings>();
                    foreach (var cameraSettings in playerData.Value.EntityCameraData)
                    {
                        MyEntityCameraSettings data = new MyEntityCameraSettings()
                        {
                            Distance = cameraSettings.Distance,
                            HeadAngle = (Vector2?)cameraSettings.HeadAngle,
                            IsFirstPerson = cameraSettings.IsFirstPerson
                        };

                        m_entityCameraSettings[pid][cameraSettings.EntityId] = data;
                    }

                    if (playerData.Value.CharacterCameraData != null)
                    {
                        m_characterCameraSettings = new MyEntityCameraSettings()
                        {
                           Distance =  playerData.Value.CharacterCameraData.Distance,
                            HeadAngle = playerData.Value.CharacterCameraData.HeadAngle,
                            IsFirstPerson = playerData.Value.CharacterCameraData.IsFirstPerson
                        };
                    }
                }
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:35,代码来源:MyCameraCollection.cs

示例12: AddCameraData

        private void AddCameraData(PlayerId pid, long entityId, MyEntityCameraSettings data)
        {
            if (!ContainsPlayer(pid))
            {
                m_entityCameraSettings[pid] = new Dictionary<long, MyEntityCameraSettings>();
            }

            if (m_entityCameraSettings[pid].ContainsKey(entityId))
                m_entityCameraSettings[pid][entityId] = data;
            else
                m_entityCameraSettings[pid].Add(entityId, data);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:12,代码来源:MyCameraCollection.cs

示例13: ContainsPlayer

 public bool ContainsPlayer(PlayerId pid)
 {
     return m_entityCameraSettings.ContainsKey(pid);
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:4,代码来源:MyCameraCollection.cs

示例14: CreateNewPlayer

        public MyPlayer CreateNewPlayer(MyIdentity identity, PlayerId id, string playerName)
        {
            Debug.Assert(Sync.IsServer);

            MyNetworkClient steamClient;
            Sync.Clients.TryGetClient(id.SteamId, out steamClient);
            Debug.Assert(steamClient != null, "Could not find a client for the new player!");
            if (steamClient == null) return null;

            var player = CreateNewPlayerInternal(identity, steamClient, playerName, ref id);
            if (player != null)
            {
                var msg = new PlayerCreatedMsg();
                msg.ClientSteamId = id.SteamId;
                msg.PlayerSerialId = id.SerialId;
                msg.IdentityId = identity.IdentityId;
                msg.DisplayName = playerName;

                Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
            }
            return player;
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:22,代码来源:MyPlayerCollection.cs

示例15: LoadControlledEntities

        public void LoadControlledEntities(SerializableDictionaryCompat<long, MyObjectBuilder_Checkpoint.PlayerId, ulong> controlledEntities, long controlledObject, MyPlayer.PlayerId? savingPlayerId = null)
        {
            if (controlledEntities == null) return;

            foreach (var controlledEntityIt in controlledEntities.Dictionary)
            {
                MyEntity controlledEntity;
                MyEntities.TryGetEntityById(controlledEntityIt.Key, out controlledEntity);

                var playerId = new PlayerId(controlledEntityIt.Value.ClientId, controlledEntityIt.Value.SerialId);
                if (savingPlayerId != null && playerId == savingPlayerId) playerId = new PlayerId(MySteam.UserId);

                MyPlayer player = Sync.Players.TryGetPlayerById(playerId);

                if (player != null && controlledEntity != null)
                {
                    if (!MySandboxGame.IsDedicated && controlledEntity is IMyControllableEntity)
                    {
                        player.Controller.TakeControl(controlledEntity as IMyControllableEntity);
                        if (controlledEntity is MyCharacter)
                            player.Identity.ChangeCharacter(controlledEntity as MyCharacter);
                        if (controlledEntity is MyShipController)
                            player.Identity.ChangeCharacter((controlledEntity as MyShipController).Pilot);
                        if (controlledEntity is MyLargeTurretBase)
                            player.Identity.ChangeCharacter((controlledEntity as MyLargeTurretBase).Pilot);
                    }
                    else
                    {
                        m_controlledEntities.Add(controlledEntityIt.Key, playerId, true);
                    }
                }
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:33,代码来源:MyPlayerCollection.cs


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