本文整理汇总了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类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: OnPlayerIdentityChanged
static void OnPlayerIdentityChanged(ref PlayerIdentityChangedMsg msg, MyNetworkClient sender)
{
Debug.Assert(!Sync.IsServer);
var playerId = new PlayerId(msg.ClientSteamId, msg.PlayerSerialId);
var player = Sync.Players.TryGetPlayerById(playerId);
Debug.Assert(player != null, "Changing identity of an unknown or unconnected player!");
if (player == null) return;
MyIdentity identity = null;
Sync.Players.m_allIdentities.TryGetValue(msg.IdentityId, out identity);
Debug.Assert(identity != null, "Changing player's identity to an unknown identity!");
if (identity == null) return;
player.ChangeIdentity(identity);
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:17,代码来源:MyPlayerCollection.cs
示例17: OnNewPlayerFailure
static void OnNewPlayerFailure(ref NewPlayerFailureMsg msg, MyNetworkClient sender)
{
if (msg.ClientSteamId != MySteam.UserId)
{
Debug.Assert(false, "Your SteamId differs from message steam id");
return;
}
var playerId = new PlayerId(msg.ClientSteamId, msg.PlayerSerialId);
if (Sync.Players.NewPlayerRequestFailed != null)
{
Sync.Players.NewPlayerRequestFailed(playerId.SerialId);
}
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:14,代码来源:MyPlayerCollection.cs
示例18: LoadConnectedPlayers
public void LoadConnectedPlayers(MyObjectBuilder_Checkpoint checkpoint, MyPlayer.PlayerId? savingPlayerId = null)
{
#warning TODO: Probably not needed? If not, remove the method
//long identityId = FindLocalIdentityId(checkpoint);
// Backward compatibility
if (checkpoint.AllPlayers != null && checkpoint.AllPlayers.Count != 0)
{
foreach (var playerItem in checkpoint.AllPlayers)
{
long identityId = playerItem.PlayerId;
var playerOb = new MyObjectBuilder_Player();
playerOb.Connected = true;
playerOb.DisplayName = playerItem.Name;
playerOb.IdentityId = identityId;
var playerId = new PlayerId(playerItem.SteamId, 0);
if (savingPlayerId != null && playerId == savingPlayerId)
{
playerId = new PlayerId(MySteam.UserId);
ChangeDisplayNameOfPlayerAndIdentity(playerOb, MySteam.UserName);
}
LoadPlayerInternal(ref playerId, playerOb, obsolete: true);
}
}
// Backward compatibility
else if (checkpoint.ConnectedPlayers != null && checkpoint.ConnectedPlayers.Dictionary.Count != 0)
{
Debug.Assert(checkpoint.DisconnectedPlayers != null, "Inconsistency in save! ConnectedPlayers were present, but DisconnectedPlayers not!");
foreach (var playerItem in checkpoint.ConnectedPlayers.Dictionary)
{
var playerId = new PlayerId(playerItem.Key.ClientId, playerItem.Key.SerialId);
if (savingPlayerId != null && playerId == savingPlayerId)
{
playerId = new PlayerId(MySteam.UserId);
ChangeDisplayNameOfPlayerAndIdentity(playerItem.Value, MySteam.UserName);
}
playerItem.Value.Connected = true;
LoadPlayerInternal(ref playerId, playerItem.Value, obsolete: false);
}
foreach (var playerItem in checkpoint.DisconnectedPlayers.Dictionary)
{
var playerId = new PlayerId(playerItem.Key.ClientId, playerItem.Key.SerialId);
var playerOb = new MyObjectBuilder_Player();
playerOb.Connected = false;
playerOb.IdentityId = playerItem.Value;
playerOb.DisplayName = null;
if (savingPlayerId != null && playerId == savingPlayerId)
{
playerId = new PlayerId(MySteam.UserId);
ChangeDisplayNameOfPlayerAndIdentity(playerOb, MySteam.UserName);
}
LoadPlayerInternal(ref playerId, playerOb, obsolete: false);
}
//LoadDisconnectedPlayers(checkpoint.DisconnectedPlayers.Dictionary);
}
else if (checkpoint.AllPlayersData != null)
{
foreach (var playerItem in checkpoint.AllPlayersData.Dictionary)
{
var playerId = new MyPlayer.PlayerId(playerItem.Key.ClientId, playerItem.Key.SerialId);
if (savingPlayerId != null && playerId == savingPlayerId)
{
playerId = new PlayerId(MySteam.UserId);
ChangeDisplayNameOfPlayerAndIdentity(playerItem.Value, MySteam.UserName);
}
LoadPlayerInternal(ref playerId, playerItem.Value, obsolete: false);
}
}
/*long identityId = FindLocalIdentityId(checkpoint);
//Player was saved in death state or there is no player
if (identityId == 0)
{
checkpoint.ControlledObject = 0; //This will lead to RequestRespawn
checkpoint.CameraController = MyCameraControllerEnum.Entity;
IsCameraAwaitingEntity = true;
}
else
{
// TODO: Refactor this later
MyEntity controlledObject = null;
if (checkpoint.ControlledObject != -1)
{
MyEntities.TryGetEntityById(checkpoint.ControlledObject, out controlledObject);
System.Diagnostics.Debug.Assert(controlledObject != null);
if (controlledObject is IMyControllableEntity)
{
//.........这里部分代码省略.........
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:101,代码来源:MyPlayerCollection.cs
示例19: InitNewPlayer
//public MyPlayer InitNewPlayer(MyIdentity identity, PlayerId id, string playerName)
//{
// 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;
// return CreateNewPlayerInternal(identity, steamClient, playerName, ref id);
//}
public MyPlayer InitNewPlayer(MyIdentity identity, PlayerId id, MyObjectBuilder_Player playerOb)
{
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;
MyPlayer playerInstance = CreateNewPlayerInternal(identity, steamClient, playerOb.DisplayName, ref id);
return playerInstance;
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:20,代码来源:MyPlayerCollection.cs
示例20: LoadDisconnectedPlayers
public void LoadDisconnectedPlayers(Dictionary<MyObjectBuilder_Checkpoint.PlayerId, long> dictionary)
{
foreach (var item in dictionary)
{
var playerId = new PlayerId(item.Key.ClientId, item.Key.SerialId);
m_playerIdentityIds.Add(playerId, item.Value);
}
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:8,代码来源:MyPlayerCollection.cs
注:本文中的Sandbox.Game.World.MyPlayer.PlayerId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论