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


C# MyHudNotification.SetTextFormatArguments方法代码示例

本文整理汇总了C#中Sandbox.Game.Gui.MyHudNotification.SetTextFormatArguments方法的典型用法代码示例。如果您正苦于以下问题:C# MyHudNotification.SetTextFormatArguments方法的具体用法?C# MyHudNotification.SetTextFormatArguments怎么用?C# MyHudNotification.SetTextFormatArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sandbox.Game.Gui.MyHudNotification的用法示例。


在下文中一共展示了MyHudNotification.SetTextFormatArguments方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MyGuiControlStat

            public MyGuiControlStat(MyEntityStat stat, Vector2 position, Vector2 size, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)
				: base(position: position, size: size, originAlign: originAlign)
            {
				Debug.Assert(stat != null);
				m_stat = stat;
                var vecColor = m_stat.StatDefinition.GuiDef.CriticalColorFrom;
                m_criticalValueColorFrom = new Color(vecColor.X, vecColor.Y, vecColor.Z);
                vecColor = m_stat.StatDefinition.GuiDef.CriticalColorTo;
                m_criticalValueColorTo = new Color(vecColor.X, vecColor.Y, vecColor.Z);
				if(m_stat != null)
				{
					m_stat.OnStatChanged += UpdateStatControl;
                    m_stat.OnStatChanged += DisplayStatNotification;
                    m_outOfStatNotification = new MyHudNotification(MyCommonTexts.NotificationStatZero, disappearTimeMs: 1000, font: MyFontEnum.Red, level: MyNotificationLevel.Important);
                    m_outOfStatNotification.SetTextFormatArguments(m_stat.StatId.ToString());
				}
            }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:17,代码来源:MyGuiControlStats.cs

示例2: MyAngleGrinder

        public MyAngleGrinder()
            : base(MyDefinitionManager.Static.TryGetHandItemForPhysicalItem(m_physicalItemId), 0.5f, 250)
        {
            SecondaryLightIntensityLower = 0.4f;
            SecondaryLightIntensityUpper = 0.4f;
            EffectId = MyParticleEffectsIDEnum.AngleGrinder;

            HasCubeHighlight = true;
            HighlightColor = Color.Red * 0.3f;

            m_grindingNotification = new MyHudNotification(MySpaceTexts.AngleGrinderPrimaryAction, MyHudNotification.INFINITE, level: MyNotificationLevel.Control);
            m_grindingNotification.SetTextFormatArguments(MyInput.Static.GetGameControl(MyControlsSpace.PRIMARY_TOOL_ACTION));

            m_rotationSpeed = 0.0f;

            PhysicalObject = (MyObjectBuilder_PhysicalGunObject)MyObjectBuilderSerializer.CreateNewObject(m_physicalItemId);
        }
开发者ID:martejj,项目名称:SpaceEngineers,代码行数:17,代码来源:MyAngleGrinder.cs

示例3: MyCameraBlock

        static MyCameraBlock()
        {
            var viewBtn = new MyTerminalControlButton<MyCameraBlock>("View", MySpaceTexts.BlockActionTitle_View, MySpaceTexts.Blank, (b) => b.RequestSetView());
            viewBtn.Enabled = (b) => b.CanUse();
            viewBtn.SupportsMultipleBlocks = false;
            var action = viewBtn.EnableAction(MyTerminalActionIcons.TOGGLE);
            if (action != null)
            {
                action.InvalidToolbarTypes = new List<MyToolbarType> { MyToolbarType.ButtonPanel };
                action.ValidForGroups = false;
            }
            MyTerminalControlFactory.AddControl(viewBtn);

            var controlName = MyInput.Static.GetGameControl(MyControlsSpace.USE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
            m_hudNotification = new MyHudNotification(MySpaceTexts.NotificationHintPressToExitCamera);
            m_hudNotification.SetTextFormatArguments(controlName);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:17,代码来源:MyCameraBlock.cs

示例4: RefreshControlNotifications

        private void RefreshControlNotifications()
        {
            RemoveControlNotifications();

            if (m_notificationReactorsOn == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.TOGGLE_REACTORS).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                m_notificationReactorsOn = new MyHudNotification(MySpaceTexts.NotificationHintTurnAllReactorsOn, 0);
                if (!MyInput.Static.IsJoystickConnected())
                    m_notificationReactorsOn.SetTextFormatArguments(controlName);
                else
                    m_notificationReactorsOn.SetTextFormatArguments(MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_SPACESHIP, MyControlsSpace.TOGGLE_REACTORS));
                m_notificationReactorsOn.Level = MyNotificationLevel.Control;
            }

            if (m_notificationReactorsOff == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.TOGGLE_REACTORS).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                m_notificationReactorsOff = new MyHudNotification(MySpaceTexts.NotificationHintTurnAllReactorsOff, 0);
                if (!MyInput.Static.IsJoystickConnected())
                    m_notificationReactorsOff.SetTextFormatArguments(controlName);
                else
                    m_notificationReactorsOff.SetTextFormatArguments(MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_SPACESHIP, MyControlsSpace.TOGGLE_REACTORS));
                m_notificationReactorsOff.Level = MyNotificationLevel.Control;
            }

            if (m_notificationLeave == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.USE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                m_notificationLeave = new MyHudNotification(LeaveNotificationHintText, 0);
                if (!MyInput.Static.IsJoystickConnected())
                    m_notificationLeave.SetTextFormatArguments(controlName);
                else
                    m_notificationLeave.SetTextFormatArguments(MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_SPACESHIP, MyControlsSpace.USE));
                m_notificationLeave.Level = MyNotificationLevel.Control;
            }

            if (m_notificationTerminal == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                if (!MyInput.Static.IsJoystickConnected())
                {
                    m_notificationTerminal = new MyHudNotification(MySpaceTexts.NotificationHintOpenShipControlPanel, 0);
                    m_notificationTerminal.SetTextFormatArguments(controlName);
                    m_notificationTerminal.Level = MyNotificationLevel.Control;
                }
                else
                {
                    m_notificationTerminal = null;
                }
            }

            if (m_notificationWeaponMode == null)
            {
                var controlName = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_COLOR_CHANGE).GetControlButtonName(MyGuiInputDeviceEnum.Mouse);
                if (!MyInput.Static.IsJoystickConnected())
                {
                    m_notificationWeaponMode = new MyHudNotification(MySpaceTexts.NotificationHintSwitchWeaponMode, 0);
                    m_notificationWeaponMode.SetTextFormatArguments(controlName);
                    m_notificationWeaponMode.Level = MyNotificationLevel.Control;
                }
                else
                {
                    m_notificationWeaponMode = null;
                }
            }

            MyHud.Notifications.Add(m_notificationLeave);
            if (m_notificationTerminal != null)
                MyHud.Notifications.Add(m_notificationTerminal);
            if (m_notificationWeaponMode != null)
                MyHud.Notifications.Add(m_notificationWeaponMode);
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:73,代码来源:MyShipController.cs

示例5: CreateControlNotification

 public static MyHudNotification CreateControlNotification(MyStringId textId, params object[] args)
 {
     var notification = new MyHudNotification(text: textId, disappearTimeMs: 0, level: MyNotificationLevel.Control);
     notification.SetTextFormatArguments(args);
     return notification;
 }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:6,代码来源:MyHudNotifications.cs

示例6: OnConnectedClient

        public void OnConnectedClient(ref ConnectedClientDataMsg msg, MyNetworkClient sender)
        {
            MySandboxGame.Log.WriteLineAndConsole("Client connected: " + msg.Name + " (" + msg.SteamID.ToString() + ")");
            MyTrace.Send(TraceWindow.Multiplayer, "Client connected");

            if (MySandboxGame.IsGameReady && msg.SteamID != ServerId && MySteam.UserId != msg.SteamID && msg.Join)
            {
                var clientConnected = new MyHudNotification(MySpaceTexts.NotificationClientConnected, 5000, level: MyNotificationLevel.Important);
                clientConnected.SetTextFormatArguments(msg.Name);
                MyHud.Notifications.Add(clientConnected);
            }

            m_memberData[msg.SteamID] = new MyConnectedClientData()
                {
                    Name = msg.Name,
                    IsAdmin = msg.IsAdmin
                };

            RaiseClientJoined(msg.SteamID);
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:20,代码来源:MyMultiplayerClient.cs

示例7: MyMultiplayerClient_ClientLeft

        void MyMultiplayerClient_ClientLeft(ulong user, ChatMemberStateChangeEnum stateChange)
        {
            if (user == ServerId)
            {
                RaiseHostLeft();
                return;
            }

            if (m_members.Contains(user))
            {
                m_members.Remove(user);

                MySandboxGame.Log.WriteLineAndConsole("Player disconnected: " + MySteam.API.Friends.GetPersonaName(user) + " (" + user + ")");

                MyTrace.Send(TraceWindow.Multiplayer, "Player disconnected: " + stateChange.ToString());

                if (MySandboxGame.IsGameReady && MySteam.UserId != user)
                {
                    var clientLeft = new MyHudNotification(MySpaceTexts.NotificationClientDisconnected, 5000, level: MyNotificationLevel.Important);
                    clientLeft.SetTextFormatArguments(MySteam.API.Friends.GetPersonaName(user));
                    MyHud.Notifications.Add(clientLeft);
                }

                Peer2Peer.CloseSession(user);
            }

            m_memberData.Remove(user);
        }                             
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:28,代码来源:MyMultiplayerClient.cs

示例8: ShowStationRotationNotification

        private void ShowStationRotationNotification()
        {
            if (MyPerGameSettings.Game == GameEnum.ME_GAME)
                return;

            if (m_stationRotationNotification == null && m_shipCreationClipboard.EnableStationRotation)
            {
                m_stationRotationNotification = new MyHudNotification(MySpaceTexts.NotificationStationRotation, 0, priority: 1);
                m_stationRotationNotification.SetTextFormatArguments(MyInput.Static.GetGameControl(MyControlsSpace.STATION_ROTATION));
            }
            if (m_stationRotationNotificationOff == null && !m_shipCreationClipboard.EnableStationRotation)
            {
                m_stationRotationNotificationOff = new MyHudNotification(MySpaceTexts.NotificationStationRotationOff, 0, priority: 1);
                m_stationRotationNotificationOff.SetTextFormatArguments(MyInput.Static.GetGameControl(MyControlsSpace.STATION_ROTATION));
            }

            if (m_shipCreationClipboard.EnableStationRotation)
            {
                MyHud.Notifications.Remove(m_stationRotationNotificationOff);
                MyHud.Notifications.Add(m_stationRotationNotification);
            }
            else
            {
                MyHud.Notifications.Remove(m_stationRotationNotification);
                MyHud.Notifications.Add(m_stationRotationNotificationOff);
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:27,代码来源:MyCubeBuilder.cs

示例9: RequestJump

        private void RequestJump()
        {
            if (CanJump)
            {
                if (MySession.Static.LocalCharacter != null)
                {
                    var shipController = MySession.Static.LocalCharacter.Parent as MyShipController;
                    if (shipController == null && MySession.Static.ControlledEntity != null)
                    {
                        shipController = MySession.Static.ControlledEntity.Entity as MyShipController;
                    }


                    if (shipController != null && (shipController.IsMainCockpit || !CubeGrid.HasMainCockpit()))
                    {
                        if (m_jumpTarget != null)
                        {
                            CubeGrid.GridSystems.JumpSystem.RequestJump(m_jumpTarget.Name, m_jumpTarget.Coords, shipController.OwnerId);
                        }
                        else
                        {
                            Vector3 localForward = Base6Directions.GetVector(shipController.Orientation.Forward);
                            Vector3D forward = Vector3D.Transform(localForward, shipController.CubeGrid.WorldMatrix.GetOrientation());

                            forward.Normalize();

                            Vector3D jumpCoords = CubeGrid.WorldMatrix.Translation + forward * ComputeMaxDistance();
                            CubeGrid.GridSystems.JumpSystem.RequestJump("Blind Jump", jumpCoords, shipController.OwnerId);
                        }
                    }
                }
            }
            else if (!IsJumping && !IsFull)
            {
                var notification = new MyHudNotification(MySpaceTexts.NotificationJumpDriveNotFullyCharged, 1500);
                notification.SetTextFormatArguments((m_storedPower / BlockDefinition.PowerNeededForJump).ToString("P"));
                MyHud.Notifications.Add(notification);
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:39,代码来源:MyJumpDrive.cs

示例10: OnMultiplayerHost

 private static void OnMultiplayerHost(Result hostResult, MyMultiplayerBase multiplayer)
 {
     if (hostResult == Result.OK)
     {
         Static.StartServer(multiplayer);
     }
     else
     {
         var notification = new MyHudNotification(MyCommonTexts.MultiplayerErrorStartingServer, 10000, MyFontEnum.Red);
         notification.SetTextFormatArguments(hostResult.ToString());
         MyHud.Notifications.Add(notification);
     }
 }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:13,代码来源:MySession.cs

示例11: StartRespawn

        private void StartRespawn(float respawnTime)
        {
            if (ControllerInfo.Controller != null && ControllerInfo.Controller.Player != null)
            {
                MySessionComponentMissionTriggers.PlayerDied(this.ControllerInfo.Controller.Player);
                if (!MySessionComponentMissionTriggers.CanRespawn(this.ControllerInfo.Controller.Player.Id))
                {
                    m_currentRespawnCounter = -1;
                    return;
                }
            }

            if (this == MySession.Static.ControlledEntity)
            {
                MyGuiScreenTerminal.Hide();

                m_respawnNotification = new MyHudNotification(MyCommonTexts.NotificationRespawn, (int)(RESPAWN_TIME * 1000), priority: 5);
                m_respawnNotification.Level = MyNotificationLevel.Important;
                m_respawnNotification.SetTextFormatArguments((int)m_currentRespawnCounter);
                MyHud.Notifications.Add(m_respawnNotification);
            }

            m_currentRespawnCounter = respawnTime;

            NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:26,代码来源:MyCharacter.cs

示例12: ProcessRenderOutput

        // TODO: OP! Should be on different place, somewhere in the game where we handle game data
        /// <summary>
        /// Safe to anytime from update thread, synchronized internally
        /// </summary>
        public static void ProcessRenderOutput()
        {
            VRageRender.IMyRenderMessage message;
            while (VRageRender.MyRenderProxy.OutputQueue.TryDequeue(out message))
            {
                //devicelost
                if (message == null)
                    continue;

                switch (message.MessageType)
                {
                    case VRageRender.MyRenderMessageEnum.RequireClipmapCell:
                        {
                            if (MySession.Static == null)
                                break;

                            var rMessage = (VRageRender.MyRenderMessageRequireClipmapCell)message;
                            MyRenderComponentVoxelMap render;
                            if (MySession.Static.VoxelMaps.TryGetRenderComponent(rMessage.ClipmapId, out render))
                            {
                                render.OnCellRequest(rMessage.Cell, rMessage.HighPriority);
                            }

                            break;
                        }

                    case VRageRender.MyRenderMessageEnum.CancelClipmapCell:
                        {
                            if (MySession.Static == null)
                                break;

                            var rMessage = (VRageRender.MyRenderMessageCancelClipmapCell)message;
                            MyRenderComponentVoxelMap render;
                            if (MySession.Static.VoxelMaps.TryGetRenderComponent(rMessage.ClipmapId, out render))
                            {
                                render.OnCellRequestCancelled(rMessage.Cell);
                            }

                            break;
                        }

                    case VRageRender.MyRenderMessageEnum.ScreenshotTaken:
                        {
                            if (MySession.Static == null)
                                break;

                            var rMessage = (VRageRender.MyRenderMessageScreenshotTaken)message;

                            if (rMessage.ShowNotification)
                            {
                                var screenshotNotification = new MyHudNotification(rMessage.Success ? MySpaceTexts.ScreenshotSaved : MySpaceTexts.ScreenshotFailed, 2000);
                                if (rMessage.Success)
                                    screenshotNotification.SetTextFormatArguments(System.IO.Path.GetFileName(rMessage.Filename));
                                MyHud.Notifications.Add(screenshotNotification);
                            }
                            break;
                        }
                    case VRageRender.MyRenderMessageEnum.TextNotDrawnToTexture:
                        {
                            if (MySession.Static == null)
                                break;

                            var rMessage = (VRageRender.MyRenderMessageTextNotDrawnToTexture)message;
                            MyTextPanel panel = MyEntities.GetEntityById(rMessage.EntityId) as MyTextPanel;
                            if (panel != null)
                            {
                                panel.FailedToRenderTexture = true;
                            }

                            break;
                        }

                    case VRageRender.MyRenderMessageEnum.RenderTextureFreed:
                        {
                            if (MySession.Static == null || MySession.LocalCharacter == null)
                                break;

                            var rMessage = (VRageRender.MyRenderMessageRenderTextureFreed)message;
                            var camera = MySector.MainCamera;
                            if (camera == null)
                                return;
                            BoundingSphereD sphere = new BoundingSphereD(camera.Position + camera.ForwardVector * new Vector3D(MyTextPanel.MAX_DRAW_DISTANCE / 2), MyTextPanel.MAX_DRAW_DISTANCE / 2.0);
                            List<MyEntity> entities = MyEntities.GetEntitiesInSphere(ref sphere);
                            MyTextPanel closestPanel = null;
                            double minDistance = MyTextPanel.MAX_DRAW_DISTANCE;
                            foreach (MyEntity entity in entities)
                            {
                                MyTextPanel panel = entity as MyTextPanel;
                                if (panel != null && panel.FailedToRenderTexture && panel.IsInRange() && panel.ShowTextOnScreen)
                                {
                                    double distanceToPanel = Vector3D.Distance(panel.PositionComp.GetPosition(), camera.Position);
                                    if (distanceToPanel < minDistance)
                                    {
                                        minDistance = distanceToPanel;
                                        closestPanel = panel;
                                    }
//.........这里部分代码省略.........
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:101,代码来源:MySandboxGame.cs

示例13: StartServerRequest

        /// <summary>
        /// Creates new Steam lobby
        /// </summary>
        private static void StartServerRequest()
        {
            if (MySteam.IsOnline)
            {
                // Later it will be by some dialog
                Static.UnloadMultiplayer();
                var result = MyMultiplayer.HostLobby(GetLobbyType(Static.OnlineMode), Static.MaxPlayers, Static.SyncLayer);
                result.Done += OnMultiplayerHost;

                // We have to wait, because MyMultiplayerLobby must be created before loading entities.
                // MyMultiplayerLobby is created in reaction to steam lobby callback creation. Maybe it's time to change that and create MyMultiplayerLobby before.
                result.Wait();
            }
            else
            {
                var notification = new MyHudNotification(MyCommonTexts.MultiplayerErrorStartingServer, 10000, MyFontEnum.Red);
                notification.SetTextFormatArguments("SteamOffline - try restarting Steam");
                MyHud.Notifications.Add(notification);
            }
        }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:23,代码来源:MySession.cs

示例14: ProcessRenderOutput

        // TODO: OP! Should be on different place, somewhere in the game where we handle game data
        /// <summary>
        /// Safe to anytime from update thread, synchronized internally
        /// </summary>
        public static void ProcessRenderOutput()
        {
            MyRenderMessageBase message;
            while (VRageRender.MyRenderProxy.OutputQueue.TryDequeue(out message))
            {
                //devicelost
                if (message == null)
                    continue;

                switch (message.MessageType)
                {
                    case MyRenderMessageEnum.RequireClipmapCell:
                        {
                            if (MySession.Static == null)
                                break;

                            var rMessage = (MyRenderMessageRequireClipmapCell)message;
                            MyRenderComponentVoxelMap render;
                            if (MySession.Static.VoxelMaps.TryGetRenderComponent(rMessage.ClipmapId, out render))
                            {
                                render.OnCellRequest(rMessage.Cell, rMessage.Priority, rMessage.DebugDraw);
                            }
                            break;
                        }

                    case MyRenderMessageEnum.CancelClipmapCell:
                        {
                            if (MySession.Static == null)
                                break;

                            var rMessage = (MyRenderMessageCancelClipmapCell)message;
                            MyRenderComponentVoxelMap render;
                            if (MySession.Static.VoxelMaps.TryGetRenderComponent(rMessage.ClipmapId, out render))
                            {
                                render.OnCellRequestCancelled(rMessage.Cell);
                            }

                            break;
                        }

                    case MyRenderMessageEnum.MergeVoxelMeshes:
                        {
                            if (MySession.Static == null)
                                break;

                            var rMessage = (MyRenderMessageMergeVoxelMeshes)message;
                            MyRenderComponentVoxelMap render;
                            if (MySession.Static.VoxelMaps.TryGetRenderComponent(rMessage.ClipmapId, out render))
                            {
                                render.OnMeshMergeRequest(rMessage.ClipmapId, rMessage.LodMeshMetadata, rMessage.CellCoord, rMessage.Priority, rMessage.WorkId, rMessage.BatchesToMerge);
                            }

                            break;
                        }

                    case MyRenderMessageEnum.CancelVoxelMeshMerge:
                        {
                            if (MySession.Static == null)
                                break;

                            var rMessage = (MyRenderMessageCancelVoxelMeshMerge)message;
                            MyRenderComponentVoxelMap render;
                            if (MySession.Static.VoxelMaps.TryGetRenderComponent(rMessage.ClipmapId, out render))
                            {
                                render.OnMeshMergeCancelled(rMessage.ClipmapId, rMessage.WorkId);
                            }

                            break;
                        }

                    case MyRenderMessageEnum.Error:
                        {
                            var rMessage = (MyRenderMessageError)message;
                            ErrorConsumer.OnError("Renderer error", rMessage.Message, rMessage.Callstack);
                            break;
                        }
                    case MyRenderMessageEnum.ScreenshotTaken:
                        {
                            if (MySession.Static == null)
                                break;

                            var rMessage = (MyRenderMessageScreenshotTaken)message;

                            if (rMessage.ShowNotification)
                            {
                                var screenshotNotification = new MyHudNotification(rMessage.Success ? MyCommonTexts.ScreenshotSaved : MyCommonTexts.ScreenshotFailed, 2000);
                                if (rMessage.Success)
                                    screenshotNotification.SetTextFormatArguments(System.IO.Path.GetFileName(rMessage.Filename));
                                MyHud.Notifications.Add(screenshotNotification);
                            }

                            if (MySandboxGame.Static != null && MySandboxGame.Static.OnScreenshotTaken != null)
                            {
                                MySandboxGame.Static.OnScreenshotTaken(MySandboxGame.Static, null);
                            }
                            break;
//.........这里部分代码省略.........
开发者ID:Rynchodon,项目名称:SpaceEngineers,代码行数:101,代码来源:MySandboxGame.cs

示例15: ShrinkVMap

            void ShrinkVMap()
            {
                Vector3I min, max;

                m_selectedVoxel.GetFilledStorageBounds(out min, out max);

                MyVoxelMapStorageDefinition def = null;
                if (m_selectedVoxel.AsteroidName != null)
                    MyDefinitionManager.Static.TryGetVoxelMapStorageDefinition(m_selectedVoxel.AsteroidName, out def);

                var origSize = m_selectedVoxel.Size;

                var tightSize = max - min + 1;

                var storage = new MyOctreeStorage(null, tightSize);

                var offset = (storage.Size - tightSize)/2 + 1;

                MyStorageData data = new MyStorageData();
                data.Resize(tightSize);

                m_selectedVoxel.Storage.ReadRange(data, MyStorageDataTypeFlags.ContentAndMaterial, 0, min, max);

                min = offset;
                max = offset + tightSize - 1;
                storage.WriteRange(data, MyStorageDataTypeFlags.ContentAndMaterial, ref min, ref max);

                var newMap = MyWorldGenerator.AddVoxelMap(m_selectedVoxel.StorageName, storage, m_selectedVoxel.WorldMatrix);

                m_selectedVoxel.Close();

                newMap.Save = true;

                if (def == null)
                {
                    ShowAlert("Voxel map {0} does not have a definition, the shrunk voxel map will be saved with the world instead.", m_selectedVoxel.StorageName);
                }
                else
                {
                    byte[] cVmapData;
                    newMap.Storage.Save(out cVmapData);

                    using (var ostream = MyFileSystem.OpenWrite(Path.Combine(MyFileSystem.ContentPath, def.StorageFile), FileMode.Open))
                    {
                        ostream.Write(cVmapData, 0, cVmapData.Length);
                    }
                    var notification = new MyHudNotification(MyStringId.GetOrCompute("Voxel prefab {0} updated succesfuly (size changed from {1} to {2})."), 4000);
                    notification.SetTextFormatArguments(def.Id.SubtypeName, origSize, storage.Size);
                    MyHud.Notifications.Add(notification);
                }
            }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:51,代码来源:MyVoxelDebugInputComponent.Tools.cs


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