本文整理汇总了C#中MyObjectBuilder_Checkpoint类的典型用法代码示例。如果您正苦于以下问题:C# MyObjectBuilder_Checkpoint类的具体用法?C# MyObjectBuilder_Checkpoint怎么用?C# MyObjectBuilder_Checkpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyObjectBuilder_Checkpoint类属于命名空间,在下文中一共展示了MyObjectBuilder_Checkpoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CalcSize
private static Vector2 CalcSize(MyObjectBuilder_Checkpoint checkpoint)//TODO optimize
{
float width = checkpoint == null ? 0.9f : 0.65f;
float height = checkpoint == null ? 1.24f : 0.97f;
if (checkpoint != null)
height -= 0.05f;
height -= 0.27f;
return new Vector2(width, height);
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:10,代码来源:MyGuiScreenScenarioBase.cs
示例2: CalcSize
private static Vector2 CalcSize(MyObjectBuilder_Checkpoint checkpoint)//TODO optimize
{
float width = checkpoint == null ? 0.9f : 0.65f;
float height = checkpoint == null ? 1.24f : 0.97f;
if (checkpoint != null)
height -= 0.05f;
if (MyFakes.OCTOBER_RELEASE_HIDE_WORLD_PARAMS)
height -= 0.27f;
return new Vector2(width, height);
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:11,代码来源:MyGuiScreenScenarioBase.cs
示例3: FixSessionObjectBuilders
public override void FixSessionObjectBuilders(MyObjectBuilder_Checkpoint checkpoint, MyObjectBuilder_Sector sector)
{
base.FixSessionObjectBuilders(checkpoint, sector);
if (sector.AppVersion == 0)
{
HashSet<String> previouslyColored = new HashSet<String>();
previouslyColored.Add("LargeBlockArmorBlock");
previouslyColored.Add("LargeBlockArmorSlope");
previouslyColored.Add("LargeBlockArmorCorner");
previouslyColored.Add("LargeBlockArmorCornerInv");
previouslyColored.Add("LargeRoundArmor_Slope");
previouslyColored.Add("LargeRoundArmor_Corner");
previouslyColored.Add("LargeRoundArmor_CornerInv");
previouslyColored.Add("LargeHeavyBlockArmorBlock");
previouslyColored.Add("LargeHeavyBlockArmorSlope");
previouslyColored.Add("LargeHeavyBlockArmorCorner");
previouslyColored.Add("LargeHeavyBlockArmorCornerInv");
previouslyColored.Add("SmallBlockArmorBlock");
previouslyColored.Add("SmallBlockArmorSlope");
previouslyColored.Add("SmallBlockArmorCorner");
previouslyColored.Add("SmallBlockArmorCornerInv");
previouslyColored.Add("SmallHeavyBlockArmorBlock");
previouslyColored.Add("SmallHeavyBlockArmorSlope");
previouslyColored.Add("SmallHeavyBlockArmorCorner");
previouslyColored.Add("SmallHeavyBlockArmorCornerInv");
previouslyColored.Add("LargeBlockInteriorWall");
foreach (var obj in sector.SectorObjects)
{
var grid = obj as MyObjectBuilder_CubeGrid;
if (grid == null)
continue;
foreach (var block in grid.CubeBlocks)
{
if (block.TypeId != typeof(MyObjectBuilder_CubeBlock) || !previouslyColored.Contains(block.SubtypeName))
{
block.ColorMaskHSV = MyRenderComponentBase.OldGrayToHSV;
}
}
}
}
if (sector.AppVersion <= 01100001)
{
CheckOxygenContainers(sector);
}
// TODO: this is disabled now because replication of MyEntity with components is not resolved, when you enable it make sure that corresponding
// definitions are also changed (InventoryBagDefinition/.... to EntityBase/...)
//CheckInventoryBagEntity(sector);
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:53,代码来源:MySpaceSessionCompatHelper.cs
示例4: FixSessionObjectBuilders
public override void FixSessionObjectBuilders(MyObjectBuilder_Checkpoint checkpoint, MyObjectBuilder_Sector sector)
{
if (sector.AppVersion == 0)
{
HashSet<String> previouslyColored = new HashSet<String>();
previouslyColored.Add("LargeBlockArmorBlock");
previouslyColored.Add("LargeBlockArmorSlope");
previouslyColored.Add("LargeBlockArmorCorner");
previouslyColored.Add("LargeBlockArmorCornerInv");
previouslyColored.Add("LargeRoundArmor_Slope");
previouslyColored.Add("LargeRoundArmor_Corner");
previouslyColored.Add("LargeRoundArmor_CornerInv");
previouslyColored.Add("LargeHeavyBlockArmorBlock");
previouslyColored.Add("LargeHeavyBlockArmorSlope");
previouslyColored.Add("LargeHeavyBlockArmorCorner");
previouslyColored.Add("LargeHeavyBlockArmorCornerInv");
previouslyColored.Add("SmallBlockArmorBlock");
previouslyColored.Add("SmallBlockArmorSlope");
previouslyColored.Add("SmallBlockArmorCorner");
previouslyColored.Add("SmallBlockArmorCornerInv");
previouslyColored.Add("SmallHeavyBlockArmorBlock");
previouslyColored.Add("SmallHeavyBlockArmorSlope");
previouslyColored.Add("SmallHeavyBlockArmorCorner");
previouslyColored.Add("SmallHeavyBlockArmorCornerInv");
previouslyColored.Add("LargeBlockInteriorWall");
foreach (var obj in sector.SectorObjects)
{
var grid = obj as MyObjectBuilder_CubeGrid;
if (grid == null)
continue;
foreach (var block in grid.CubeBlocks)
{
if (block.TypeId != typeof(MyObjectBuilder_CubeBlock) || !previouslyColored.Contains(block.SubtypeName))
{
block.ColorMaskHSV = MyRenderComponentBase.OldGrayToHSV;
}
}
}
}
if (sector.AppVersion <= 01100001)
{
CheckOxygenContainers(sector);
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:47,代码来源:MySpaceSessionCompatHelper.cs
示例5: UpdateSessionSettings
public void UpdateSessionSettings( )
{
MyConfigDedicatedData<MyObjectBuilder_SessionSettings> config = Server.Instance.LoadServerConfig( );
ApplicationLog.BaseLog.Info( "Loading Session Settings" );
try
{
string worldPath = config.LoadWorld;
ulong fileSize;
m_checkPoint = LoadSandbox(worldPath, out fileSize);
if (m_checkPoint == null)
return;
m_checkPoint.Settings = config.SessionSettings;
m_checkPoint.Scenario = config.Scenario;
m_checkPoint.Mods.Clear( );
foreach ( ulong modid in config.Mods )
m_checkPoint.Mods.Add( new MyObjectBuilder_Checkpoint.ModItem( modid ) );
File.Copy( Path.Combine( worldPath, "Sandbox.sbc" ), Path.Combine( worldPath, "Sandbox.sbc.bak" ), true );
SaveSandbox(m_checkPoint, worldPath, out fileSize);
ApplicationLog.BaseLog.Info( "{0}Max Players: {1}", Environment.NewLine, m_checkPoint.Settings.MaxPlayers );
ApplicationLog.BaseLog.Info( "OnlineMode: {0}", m_checkPoint.Settings.OnlineMode );
ApplicationLog.BaseLog.Info( "GameMode: {0}", m_checkPoint.Settings.GameMode );
ApplicationLog.BaseLog.Info( "Scenario: {0}", m_checkPoint.Scenario.SubtypeId );
ApplicationLog.BaseLog.Info( "World Size: {0}{1}", m_checkPoint.Settings.WorldSizeKm, Environment.NewLine );
}
catch (Exception ex)
{
if ( ExtenderOptions.IsDebugging )
ApplicationLog.BaseLog.Error( ex, "Session Manager Exception: {0}" );
}
}
开发者ID:rexxar-tc,项目名称:SEServerExtender,代码行数:38,代码来源:SessionManager.cs
示例6: SaveSessionComponentObjectBuilders
private void SaveSessionComponentObjectBuilders(MyObjectBuilder_Checkpoint checkpoint)
{
checkpoint.SessionComponents = new List<MyObjectBuilder_SessionComponent>();
foreach (var comp in m_sessionComponents.Values)
{
var ob = comp.GetObjectBuilder();
if (ob != null)
checkpoint.SessionComponents.Add(ob);
}
}
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:10,代码来源:MySession.cs
示例7: LoadCameraControllerSettings
private void LoadCameraControllerSettings(MyObjectBuilder_Checkpoint checkpoint)
{
//m_cameraControllerSettings.Clear();
//// Backwards compatibility section
//if (checkpoint.Players != null)
//{
// MyObjectBuilder_Player playerOb;
// if (checkpoint.Players.Dictionary.TryGetValue(Sync.Clients.LocalClient.SteamUserId, out playerOb))
// {
// foreach (var cameraController in playerOb.CameraData.Dictionary)
// {
// // m_cameraControllerSettings.Add(cameraController.Key, cameraController.Value);
// }
// }
//}
//// End backwards compatibility section
//else
//{
// #warning load camera settings from a new object builder
//}
Cameras.LoadCameraCollection(checkpoint);
}
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:23,代码来源:MySession.cs
示例8: LoadCamera
private void LoadCamera(MyObjectBuilder_Checkpoint checkpoint)
{
if (checkpoint.SpectatorDistance > 0)
{
MyThirdPersonSpectator.Static.UpdateAfterSimulation();
MyThirdPersonSpectator.Static.ResetViewerDistance(checkpoint.SpectatorDistance);
}
MySandboxGame.Log.WriteLine("Checkpoint.CameraAttachedTo: " + checkpoint.CameraEntity);
IMyEntity cameraEntity = null;
var cameraControllerToSet = checkpoint.CameraController;
if (Static.Enable3RdPersonView == false && cameraControllerToSet == MyCameraControllerEnum.ThirdPersonSpectator)
{
cameraControllerToSet = checkpoint.CameraController = MyCameraControllerEnum.Entity;
}
if (checkpoint.CameraEntity == 0 && ControlledEntity != null)
{
cameraEntity = ControlledEntity as MyEntity;
if (cameraEntity != null)
{
Debug.Assert(ControlledEntity is IMyCameraController, "Controlled entity is not a camera controller");
if (!(ControlledEntity is IMyCameraController))
{
cameraEntity = null;
cameraControllerToSet = MyCameraControllerEnum.Spectator;
}
}
}
else
{
if (!MyEntities.EntityExists(checkpoint.CameraEntity))
{
cameraEntity = ControlledEntity as MyEntity;
if (cameraEntity != null)
{
cameraControllerToSet = MyCameraControllerEnum.Entity;
Debug.Assert(ControlledEntity is IMyCameraController, "Controlled entity is not a camera controller");
if (!(ControlledEntity is IMyCameraController))
{
cameraEntity = null;
cameraControllerToSet = MyCameraControllerEnum.Spectator;
}
}
else
{
MyLog.Default.WriteLine("ERROR: Camera entity from checkpoint does not exists!");
cameraControllerToSet = MyCameraControllerEnum.Spectator;
}
}
else
cameraEntity = MyEntities.GetEntityById(checkpoint.CameraEntity);
}
if (cameraControllerToSet == MyCameraControllerEnum.Spectator && MyFinalBuildConstants.IS_OFFICIAL && cameraEntity != null)
cameraControllerToSet = MyCameraControllerEnum.Entity;
MyEntityCameraSettings settings = null;
bool resetThirdPersonPosition = false;
if (!Engine.Platform.Game.IsDedicated)
{
if ((cameraControllerToSet == MyCameraControllerEnum.Entity
|| cameraControllerToSet == MyCameraControllerEnum.ThirdPersonSpectator)
&& cameraEntity != null)
{
MyPlayer.PlayerId pid = LocalHumanPlayer == null ? new MyPlayer.PlayerId(Sync.MyId, 0) : LocalHumanPlayer.Id;
if (Static.Cameras.TryGetCameraSettings(pid, cameraEntity.EntityId, out settings))
{
if (!settings.IsFirstPerson)
{
cameraControllerToSet = MyCameraControllerEnum.ThirdPersonSpectator;
resetThirdPersonPosition = true;
}
}
}
}
Static.IsCameraAwaitingEntity = false;
SetCameraController(cameraControllerToSet, cameraEntity);
if (resetThirdPersonPosition)
{
MyThirdPersonSpectator.Static.ResetViewerAngle(settings.HeadAngle);
MyThirdPersonSpectator.Static.ResetViewerDistance(settings.Distance);
}
}
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:87,代码来源:MySession.cs
示例9: FixSessionObjectBuilders
public virtual void FixSessionObjectBuilders(MyObjectBuilder_Checkpoint checkpoint, MyObjectBuilder_Sector sector)
{ }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:2,代码来源:MySessionCompatHelper.cs
示例10: AddMod
private void AddMod(bool active, StringBuilder title, StringBuilder toolTip, StringBuilder modState, MyGuiHighlightTexture? icon, MyObjectBuilder_Checkpoint.ModItem mod, Color? textColor = null)
{
var row = new MyGuiControlTable.Row(mod);
row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, toolTip: modState.ToString(), icon: icon));
row.AddCell(new MyGuiControlTable.Cell(text: title, toolTip: toolTip.ToString(), textColor: textColor));
if (active)
m_modsTableEnabled.Insert(0, row);
else
m_modsTableDisabled.Insert(0, row);
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:11,代码来源:MyGuiScreenMods.cs
示例11: MyGuiScreenWorldSettings
// Edit game constructor
public MyGuiScreenWorldSettings(MyObjectBuilder_Checkpoint checkpoint, string path)
: base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, CalcSize(checkpoint))
{
MySandboxGame.Log.WriteLine("MyGuiScreenWorldSettings.ctor START");
EnabledBackgroundFade = true;
Static = this;
m_checkpoint = checkpoint;
if (checkpoint == null || checkpoint.Mods == null)
m_mods = new List<MyObjectBuilder_Checkpoint.ModItem>();
else
m_mods = checkpoint.Mods;
m_sessionPath = path;
m_isNewGame = (checkpoint == null);
RecreateControls(true);
// If this screen is loaded from "Saved Games" it should not use the EnvironmentHostility logic
m_isHostilityChanged = !m_isNewGame;
MySandboxGame.Log.WriteLine("MyGuiScreenWorldSettings.ctor END");
}
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:23,代码来源:MyGuiScreenWorldSettings.cs
示例12: IsCompatibleVersion
public static bool IsCompatibleVersion(MyObjectBuilder_Checkpoint checkpoint)
{
if (checkpoint == null)
return false;
return checkpoint.AppVersion <= MyFinalBuildConstants.APP_VERSION;
}
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:6,代码来源:MySession.cs
示例13: LoadMission
public static void LoadMission(string sessionPath, MyObjectBuilder_Checkpoint checkpoint, ulong checkpointSizeInBytes, string name, string description)
{
MyAnalyticsHelper.SetEntry(MyGameEntryEnum.Load);
Load(sessionPath, checkpoint, checkpointSizeInBytes);
Static.Name = name;
Static.Description = description;
string safeName = MyUtils.StripInvalidChars(checkpoint.SessionName);
Static.CurrentPath = MyLocalCache.GetSessionSavesPath(safeName, false, false);
while (Directory.Exists(Static.CurrentPath))
{
Static.CurrentPath = MyLocalCache.GetSessionSavesPath(safeName + MyUtils.GetRandomInt(int.MaxValue).ToString("########"), false, false);
};
}
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:13,代码来源:MySession.cs
示例14: SaveCameraCollection
public void SaveCameraCollection(MyObjectBuilder_Checkpoint checkpoint)
{
MyDebug.AssertDebug(checkpoint.AllPlayersData != null, "Players data not initialized!");
if (checkpoint.AllPlayersData == null)
return;
foreach (var playerData in checkpoint.AllPlayersData.Dictionary)
{
PlayerId pid = new PlayerId(playerData.Key.ClientId, playerData.Key.SerialId);
playerData.Value.EntityCameraData = new List<CameraControllerSettings>();
if (!m_entityCameraSettings.ContainsKey(pid))
continue;
m_entitiesToRemove.Clear();
foreach (var cameraSetting in m_entityCameraSettings[pid])
{
if (MyEntities.EntityExists(cameraSetting.Key))
{
CameraControllerSettings settings = new CameraControllerSettings()
{
Distance = cameraSetting.Value.Distance,
IsFirstPerson = cameraSetting.Value.IsFirstPerson,
HeadAngle = cameraSetting.Value.HeadAngle,
EntityId = cameraSetting.Key,
};
playerData.Value.EntityCameraData.Add(settings);
}
else
{
m_entitiesToRemove.Add(cameraSetting.Key);
}
}
foreach (long entityId in m_entitiesToRemove)
m_entityCameraSettings[pid].Remove(entityId);
if (m_characterCameraSettings != null)
{
playerData.Value.CharacterCameraData = new CameraControllerSettings()
{
Distance = m_characterCameraSettings.Distance,
IsFirstPerson = m_characterCameraSettings.IsFirstPerson,
HeadAngle = m_characterCameraSettings.HeadAngle,
};
}
}
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:48,代码来源:MyCameraCollection.cs
示例15: 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
示例16: SavePlayers
public void SavePlayers(MyObjectBuilder_Checkpoint checkpoint)
{
checkpoint.ConnectedPlayers = new SerializableDictionary<MyObjectBuilder_Checkpoint.PlayerId, MyObjectBuilder_Player>();
checkpoint.DisconnectedPlayers = new SerializableDictionary<MyObjectBuilder_Checkpoint.PlayerId, long>();
checkpoint.AllPlayersData = new SerializableDictionary<MyObjectBuilder_Checkpoint.PlayerId, MyObjectBuilder_Player>();
foreach (var player in m_players.Values)
{
var id = new MyObjectBuilder_Checkpoint.PlayerId() { ClientId = player.Id.SteamId, SerialId = player.Id.SerialId };
MyObjectBuilder_Player playerOb = new MyObjectBuilder_Player();
playerOb.DisplayName = player.DisplayName;
playerOb.IdentityId = player.Identity.IdentityId;
playerOb.Connected = true;
checkpoint.AllPlayersData.Dictionary.Add(id, playerOb);
}
foreach (var entry in m_playerIdentityIds)
{
if (m_players.ContainsKey(entry.Key) || entry.Key.SerialId != 0) continue;
var id = new MyObjectBuilder_Checkpoint.PlayerId() { ClientId = entry.Key.SteamId, SerialId = entry.Key.SerialId };
MyObjectBuilder_Player playerOb = new MyObjectBuilder_Player();
playerOb.Connected = false;
playerOb.IdentityId = entry.Value;
var identity = TryGetIdentity(entry.Value);
playerOb.DisplayName = identity != null ? identity.DisplayName : null;
checkpoint.AllPlayersData.Dictionary.Add(id, playerOb);
}
//foreach (var entry in m_playerIdentityIds)
//{
// // Skip connected players
// if (m_players.ContainsKey(entry.Key)) continue;
// var id = new MyObjectBuilder_Checkpoint.PlayerId() { ClientId = entry.Key.SteamId, SerialId = entry.Key.SerialId };
// checkpoint.DisconnectedPlayers.Dictionary.Add(id, entry.Value);
//}
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:42,代码来源:MyPlayerCollection.cs
示例17: 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
示例18: LoadIdentities
public void LoadIdentities(MyObjectBuilder_Checkpoint checkpoint, MyPlayer.PlayerId? savingPlayerId = null)
{
if (checkpoint.NonPlayerIdentities != null)
{
LoadNpcIdentities(checkpoint.NonPlayerIdentities);
}
//checkpoint.Identities or checkpoint.AllPlayers will never be null, because it's a .NET bug :-(
if (checkpoint.AllPlayers.Count != 0)
{
Debug.Assert(checkpoint.Identities.Count == 0, "Both AllPlayers and Identities were present in checkpoint object builder!");
LoadIdentitiesObsolete(checkpoint.AllPlayers, savingPlayerId);
}
else
{
LoadIdentities(checkpoint.Identities);
}
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:18,代码来源:MyPlayerCollection.cs
示例19: FindLocalIdentityId
private long FindLocalIdentityId(MyObjectBuilder_Checkpoint checkpoint)
{
long playerId = 0;
playerId = TryGetIdentityId(MySteam.UserId);
if (playerId != 0)
return playerId;
// Backward compatibility:
if (checkpoint.Players != null)
{
if (checkpoint.Players.Dictionary.ContainsKey(MySteam.UserId))
playerId = checkpoint.Players[MySteam.UserId].PlayerId != 0 ? checkpoint.Players[MySteam.UserId].PlayerId : playerId;
}
if (checkpoint.AllPlayers != null)
{
foreach (var player in checkpoint.AllPlayers)
{
if (player.SteamId == MySteam.UserId && !player.IsDead)
{
playerId = player.PlayerId;
break;
}
if (player.SteamId == MySteam.UserId && playerId == player.PlayerId && player.IsDead)
{
playerId = 0;
break;
}
}
}
return playerId;
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:34,代码来源:MyPlayerCollection.cs
示例20: SaveChatHistory
private void SaveChatHistory(MyObjectBuilder_Checkpoint checkpoint)
{
if (MyFakes.ENABLE_COMMUNICATION)
{
checkpoint.ChatHistory = new List<MyObjectBuilder_ChatHistory>(ChatHistory.Keys.Count);
foreach (var chatHistory in ChatHistory)
{
var chatHistoryBuilder = chatHistory.Value.GetObjectBuilder();
checkpoint.ChatHistory.Add(chatHistoryBuilder);
}
checkpoint.FactionChatHistory = new List<MyObjectBuilder_FactionChatHistory>(FactionChatHistory.Count);
foreach (var factionChatHistory in FactionChatHistory)
{
var factionChatHistoryBuilder = factionChatHistory.GetObjectBuilder();
checkpoint.FactionChatHistory.Add(factionChatHistoryBuilder);
}
}
}
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:18,代码来源:MySession.cs
注:本文中的MyObjectBuilder_Checkpoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论