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


C# MyObjectBuilder_Checkpoint类代码示例

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


MyObjectBuilder_Checkpoint类属于命名空间,在下文中一共展示了MyObjectBuilder_Checkpoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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