public void Text(int x, int y, string message, Color?forecolor = null, string anchor = null) { int a = default; if (!string.IsNullOrEmpty(anchor)) { a = anchor switch { "0" => 0, "topleft" => 0, "1" => 1, "topright" => 1, "2" => 2, "bottomleft" => 2, "3" => 3, "bottomright" => 3, _ => default }; } else { x -= Emulator.CoreComm.ScreenLogicalOffsetX; y -= Emulator.CoreComm.ScreenLogicalOffsetY; } var pos = new MessagePosition { X = x, Y = y, Anchor = (MessagePosition.AnchorType)a }; GlobalWin.OSD.AddGuiText(message, pos, Color.Black, forecolor ?? Color.White); }
private void SetFromOption(MessagePosition position) { _programmaticallyChangingValues = true; XNumeric.Value = position.X; YNumeric.Value = position.Y; _px = position.X; _py = position.Y; switch (position.Anchor) { default: case MessagePosition.AnchorType.TopLeft: TL.Checked = true; break; case MessagePosition.AnchorType.TopRight: TR.Checked = true; break; case MessagePosition.AnchorType.BottomLeft: BL.Checked = true; break; case MessagePosition.AnchorType.BottomRight: BR.Checked = true; break; } _programmaticallyChangingValues = false; }
public DisplayMessage(float displayTime, float fontSize, string message, MessagePosition position) { this.displayTime = displayTime; this.fontSize = fontSize; this.message = message; this.position = position; }
private void ResetDefaultsButton_Click(object sender, EventArgs e) { _fps = _config.Fps = DefaultMessagePositions.Fps.Clone(); _frameCounter = _config.FrameCounter = DefaultMessagePositions.FrameCounter.Clone(); _lagCounter = _config.LagCounter = DefaultMessagePositions.LagCounter.Clone(); _inputDisplay = _config.InputDisplay = DefaultMessagePositions.InputDisplay.Clone(); _reRecordCounter = _config.ReRecordCounter = DefaultMessagePositions.ReRecordCounter.Clone(); _multitrackRecorder = _config.MultitrackRecorder = DefaultMessagePositions.MultitrackRecorder.Clone(); _messages = _config.Messages = DefaultMessagePositions.Messages.Clone(); _autohold = _config.Autohold = DefaultMessagePositions.Autohold.Clone(); _ramWatches = _config.RamWatches = DefaultMessagePositions.RamWatches.Clone(); _messageColor = _config.MessagesColor = DefaultMessagePositions.MessagesColor; _alertColor = _config.AlertMessageColor = DefaultMessagePositions.AlertMessageColor; _lastInputColor = _config.LastInputColor = DefaultMessagePositions.LastInputColor; _movieInput = _config.MovieInput = DefaultMessagePositions.MovieInput; MessageColorDialog.Color = Color.FromArgb(_messageColor); AlertColorDialog.Color = Color.FromArgb(_alertColor); LInputColorDialog.Color = Color.FromArgb(_lastInputColor); MovieInputColorDialog.Color = Color.FromArgb(_movieInput); SetMaxXy(); SetColorBox(); SetPositionInfo(); StackMessagesCheckbox.Checked = _config.StackOSDMessages = true; }
private int getIndexFromMessagePosition(MessagePosition pos) { var msg = Logic.Message; var position = 0; for (var wordIndex = 0; wordIndex <= pos.WordIndex; wordIndex++) { var word = msg.Words[wordIndex]; for (var splitIndex = 0; splitIndex <= (wordIndex == pos.WordIndex ? pos.SplitIndex : (word.SplitSegments?.Length ?? 0)); splitIndex++) { var split = word.SplitSegments?[splitIndex].Item1 ?? word.Value as string; if (pos.WordIndex == wordIndex && pos.SplitIndex == splitIndex) { for (var i = 0; i < pos.CharIndex; i++) { position++; } goto end; } else { position += split.Length + 1; } } } end: return(position); }
public static string GetPositionTranslated(this MessagePosition position) { switch (position) { case MessagePosition.TopLeft: return("placement: {from: 'top', align: 'left'}"); case MessagePosition.TopCenter: return("placement: {from: 'top', align: 'center'}"); case MessagePosition.TopRight: return("placement: {from: 'top', align: 'right'}"); case MessagePosition.BottomLeft: return("placement: {from: 'bottom', align: 'left'}"); case MessagePosition.BottomCenter: return("placement: {from: 'bottom', align: 'center'}"); case MessagePosition.BottomRight: return("placement: {from: 'bottom', align: 'right'}"); default: throw new NotImplementedException(); } }
public void Bind(MessagePosition position, Action changeCallback) { _messagePosition = position; _changeCallback = changeCallback; _programmaticallyChangingValues = true; XNumeric.Value = position.X; YNumeric.Value = position.Y; switch (position.Anchor) { default: case MessagePosition.AnchorType.TopLeft: TL.Checked = true; break; case MessagePosition.AnchorType.TopRight: TR.Checked = true; break; case MessagePosition.AnchorType.BottomLeft: BL.Checked = true; break; case MessagePosition.AnchorType.BottomRight: BR.Checked = true; break; } _programmaticallyChangingValues = false; PositionGroupBox.Refresh(); }
public MessageConfig(Config config) { _config = config; _fps = _config.Fps.Clone(); _frameCounter = _config.FrameCounter.Clone(); _lagCounter = _config.LagCounter.Clone(); _inputDisplay = _config.InputDisplay.Clone(); _reRecordCounter = _config.ReRecordCounter.Clone(); _messages = _config.Messages.Clone(); _autohold = _config.Autohold.Clone(); _ramWatches = _config.RamWatches.Clone(); InitializeComponent(); // I'm done wasting my time w/ the Designer --yoshi SuspendLayout(); _nudDuration = new() { Maximum = 10.0M, Minimum = 1.0M, Size = new(48, 20) }; Controls.Add(new LocSzSingleRowFLP { Anchor = AnchorStyles.Bottom | AnchorStyles.Left, Controls = { new LabelEx { Text = "Messages fade after" }, _nudDuration, new LabelEx { Text = "seconds" }, },
public static void Message(string content, float duration, MessagePosition position, Tuple3 color, float size = 20) { var htmlColor = "#" + ColorUtility.ToHtmlStringRGB(color.ToColor()); var message = "<color=" + htmlColor + "><size=" + size.ToString() + ">" + content + "</size></color>"; ScreenMessages.PostScreenMessage(message, duration, position.ToScreenMessageStyle()); }
public MusicActionMessage( string message, MessagePosition position, double displayTime) { this.message = message; this.position = position; this.startTime = displayTime; }
public void AddGuiText(string message, MessagePosition pos, Color backGround, Color foreColor) { _guiTextList.Add(new UIDisplay { Message = message, Position = pos, BackGround = backGround, ForeColor = foreColor }); }
public void Bind( string displayName, MessagePosition position, Action <MessagePosition> selectedCallback) { MessagePosition = position; _selectedCallback = selectedCallback; RowRadio.Text = displayName; SetText(); }
public void AddRamWatch(string message, MessagePosition pos, Color backGround, Color foreColor) { _ramWatchList.Add(new UIDisplay { Message = message, Position = pos, BackGround = backGround, ForeColor = foreColor }); }
private static ChatModel PrepareChatModel(Message message, User sender, MessagePosition position, string senderName = null) { return(new ChatModel { CreatedOn = message.CreatedOn, FullName = senderName ?? sender.FullName, Message = message.Content, Position = position, ProfilePicture = sender.GetProfilePicture(), MessageId = message.Id }); }
private PointF GetCoordinates(IBlitter g, MessagePosition position, string message) { var size = g.MeasureString(message, MessageFont); float x = position.Anchor.IsLeft() ? position.X : g.ClipBounds.Width - position.X - size.Width; float y = position.Anchor.IsTop() ? position.Y : g.ClipBounds.Height - position.Y - size.Height; return(new PointF(x, y)); }
public MessageConfig(Config config) { _config = config; _fps = _config.Fps.Clone(); _frameCounter = _config.FrameCounter.Clone(); _lagCounter = _config.LagCounter.Clone(); _inputDisplay = _config.InputDisplay.Clone(); _reRecordCounter = _config.ReRecordCounter.Clone(); _messages = _config.Messages.Clone(); _autohold = _config.Autohold.Clone(); _ramWatches = _config.RamWatches.Clone(); InitializeComponent(); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); mouseDown = true; leftClick = (e.Button == MouseButtons.Left); int index; var msg = MessageAtPoint(e.Location, out index); if (msg != null) { var graphics = App.UseDirectX ? null : CreateGraphics(); MessagePosition position; if (e.Button == MouseButtons.Left) { position = msg.MessagePositionAtPoint(graphics, new CommonPoint(e.X - MessagePadding.Left, e.Y - msg.Y), index); selection = new Selection(position, position); } var word = msg.WordAtPoint(new CommonPoint(e.X - MessagePadding.Left, e.Y - msg.Y)); mouseDownWord = word; if (word != null) { if (e.Button == MouseButtons.Left) { position = msg.MessagePositionAtPoint(graphics, new CommonPoint(word.X + 1, e.Y - msg.Y), index); MessagePosition position2 = msg.MessagePositionAtPoint(graphics, new CommonPoint((word.X + 1 + word.Width), e.Y - msg.Y), index); mouseDownSelection = new Selection(position, position2); } if (word.Link != null) { mouseDownLink = word.Link; } } graphics?.Dispose(); } else if (e.Button == MouseButtons.Left) { selection = null; } Invalidate(); }
private void ResetDefaultsButton_Click(object sender, EventArgs e) { _fps = DefaultMessagePositions.Fps.Clone(); _frameCounter = DefaultMessagePositions.FrameCounter.Clone(); _lagCounter = DefaultMessagePositions.LagCounter.Clone(); _inputDisplay = DefaultMessagePositions.InputDisplay.Clone(); _reRecordCounter = DefaultMessagePositions.ReRecordCounter.Clone(); _messages = DefaultMessagePositions.Messages.Clone(); _autohold = DefaultMessagePositions.Autohold.Clone(); _ramWatches = DefaultMessagePositions.RamWatches.Clone(); ColorRows.Single(r => r.Name == "Main Messages").SelectedColor = DefaultMessagePositions.MessagesColor; ColorRows.Single(r => r.Name == "Alert Messages").SelectedColor = DefaultMessagePositions.AlertMessageColor; ColorRows.Single(r => r.Name == "Previous Frame Input").SelectedColor = DefaultMessagePositions.LastInputColor; ColorRows.Single(r => r.Name == "Movie Input").SelectedColor = DefaultMessagePositions.MovieInput; CreateMessageRows(); StackMessagesCheckbox.Checked = true; }
/// <summary> /// Convert a kRPC message position to a screen message style. /// </summary> public static ScreenMessageStyle ToScreenMessageStyle(this MessagePosition position) { switch (position) { case MessagePosition.BottomCenter: return(ScreenMessageStyle.LOWER_CENTER); case MessagePosition.TopCenter: return(ScreenMessageStyle.UPPER_CENTER); case MessagePosition.TopLeft: return(ScreenMessageStyle.UPPER_LEFT); case MessagePosition.TopRight: return(ScreenMessageStyle.UPPER_RIGHT); default: throw new ArgumentOutOfRangeException(nameof(position)); } }
public MessageConfig(Config config) { _config = config; _fps = _config.Fps.Clone(); _frameCounter = _config.FrameCounter.Clone(); _lagCounter = _config.LagCounter.Clone(); _inputDisplay = _config.InputDisplay.Clone(); _reRecordCounter = _config.ReRecordCounter.Clone(); _multitrackRecorder = _config.MultitrackRecorder.Clone(); _messages = _config.Messages.Clone(); _autohold = _config.Autohold.Clone(); _ramWatches = _config.RamWatches.Clone(); _messageColor = _config.MessagesColor; _alertColor = _config.AlertMessageColor; _lastInputColor = _config.LastInputColor; _movieInput = _config.MovieInput; InitializeComponent(); }
private static void UpdateMessagePosition(FrameworkElement message, MessagePosition position) { if (position == MessagePosition.Left) { Grid.SetColumn(message, 0); Grid.SetRow(message, 1); } else if (position == MessagePosition.Top) { Grid.SetColumn(message, 1); Grid.SetRow(message, 0); } else if (position == MessagePosition.Bottom) { Grid.SetColumn(message, 1); Grid.SetRow(message, 2); } else // if (position == MessagePosition.Right) { Grid.SetColumn(message, 2); Grid.SetRow(message, 1); } }
public static void Message(string content, float duration = 1f, MessagePosition position = MessagePosition.TopCenter) { ScreenMessages.PostScreenMessage(content, duration, position.ToScreenMessageStyle()); }
public static void Message (string content, float duration = 1f, MessagePosition position = MessagePosition.TopCenter) { ScreenMessages.PostScreenMessage (content, duration, position.ToScreenMessageStyle ()); }
public static void ShowMessage(this Controller controller, MessageType messageType, string message, bool showAfterRedirect = false, MessagePosition messagePos = MessagePosition.TopCentre, bool persistMessage = false) { var messageTypeKey = messageType.ToString(); if (showAfterRedirect) { controller.TempData[messageTypeKey] = message; controller.TempData["MessagePosition"] = messagePos.ToString(); controller.TempData["PersistMessage"] = persistMessage.ToString(); } else { controller.ViewData[messageTypeKey] = message; controller.ViewData["MessagePosition"] = messagePos.ToString(); controller.ViewData["PersistMessage"] = persistMessage.ToString(); } }
public static string ToCoordinateStr(this MessagePosition position) => $"{position.X}, {position.Y}";
private void PacketReceived(NetIncomingMessage msg) { if (msg == null) { if (_currentScene == "GameCore" && loaded) { PropertyInfo property = typeof(StandardLevelGameplayManager).GetProperty("gameState"); property.DeclaringType.GetProperty("gameState"); property.GetSetMethod(true).Invoke(_gameManager, new object[] { StandardLevelGameplayManager.GameState.Failed }); } return; } switch ((CommandType)msg.ReadByte()) { case CommandType.UpdatePlayerInfo: { float currentTime = msg.ReadFloat(); float totalTime = msg.ReadFloat(); int playersCount = msg.ReadInt32(); List <PlayerInfo> playerInfos = new List <PlayerInfo>(); try { for (int j = 0; j < playersCount; j++) { playerInfos.Add(new PlayerInfo(msg)); } } catch (Exception e) { #if DEBUG Misc.Logger.Exception($"Unable to parse PlayerInfo! Player count={playersCount} Message size={msg.LengthBytes} Excpetion: {e}"); #endif return; } playerInfos = playerInfos.Where(x => (x.playerState == PlayerState.Game && _currentScene == "GameCore") || (x.playerState == PlayerState.Room && _currentScene == "MenuCore") || (x.playerState == PlayerState.DownloadingSongs && _currentScene == "MenuCore")).OrderByDescending(x => x.playerId).ToList(); int localPlayerIndex = playerInfos.FindIndexInList(Client.Instance.playerInfo); try { int index = 0; OnlinePlayerController player = null; foreach (PlayerInfo info in playerInfos) { try { player = _players.FirstOrDefault(x => x != null && x.PlayerInfo.Equals(info)); if (player != null) { player.PlayerInfo = info; player.avatarOffset = (index - localPlayerIndex) * (_currentScene == "GameCore" ? 5f : 0f); player.SetAvatarState(((ShowAvatarsInGame() && !Config.Instance.SpectatorMode && loaded) || ShowAvatarsInRoom()) && !Client.Instance.InRadioMode); } else { player = new GameObject("OnlinePlayerController").AddComponent <OnlinePlayerController>(); player.PlayerInfo = info; player.avatarOffset = (index - localPlayerIndex) * (_currentScene == "GameCore" ? 5f : 0f); player.SetAvatarState(((ShowAvatarsInGame() && !Config.Instance.SpectatorMode && loaded) || ShowAvatarsInRoom()) && !Client.Instance.InRadioMode); _players.Add(player); } index++; } catch (Exception e) { Console.WriteLine($"PlayerController exception: {e}"); } } if (_players.Count > playerInfos.Count) { foreach (OnlinePlayerController controller in _players.Where(x => !playerInfos.Any(y => y.Equals(x.PlayerInfo)))) { if (controller != null && !controller.destroyed) { Destroy(controller.gameObject); } } _players.RemoveAll(x => x == null || x.destroyed); } } catch (Exception e) { Console.WriteLine($"PlayerControllers exception: {e}"); } if (_currentScene == "GameCore" && loaded) { playerInfos = playerInfos.OrderByDescending(x => x.playerScore).ToList(); localPlayerIndex = playerInfos.FindIndexInList(Client.Instance.playerInfo); if (_scoreDisplays.Count < 5) { _scoreScreen = new GameObject("ScoreScreen"); _scoreScreen.transform.position = new Vector3(0f, 4f, 12f); _scoreScreen.transform.rotation = Quaternion.Euler(0f, 0f, 0f); _scoreDisplays.Clear(); for (int i = 0; i < 5; i++) { PlayerInfoDisplay buffer = new GameObject("ScoreDisplay " + i).AddComponent <PlayerInfoDisplay>(); buffer.transform.SetParent(_scoreScreen.transform); buffer.transform.localPosition = new Vector3(0f, 2.5f - i, 0); _scoreDisplays.Add(buffer); } } if (playerInfos.Count <= 5) { for (int i = 0; i < playerInfos.Count; i++) { _scoreDisplays[i].UpdatePlayerInfo(playerInfos[i], playerInfos.FindIndexInList(playerInfos[i])); } for (int i = playerInfos.Count; i < _scoreDisplays.Count; i++) { _scoreDisplays[i].UpdatePlayerInfo(null, 0); } } else { if (localPlayerIndex < 3) { for (int i = 0; i < 5; i++) { _scoreDisplays[i].UpdatePlayerInfo(playerInfos[i], playerInfos.FindIndexInList(playerInfos[i])); } } else if (localPlayerIndex > playerInfos.Count - 3) { for (int i = playerInfos.Count - 5; i < playerInfos.Count; i++) { _scoreDisplays[i - (playerInfos.Count - 5)].UpdatePlayerInfo(playerInfos[i], playerInfos.FindIndexInList(playerInfos[i])); } } else { for (int i = localPlayerIndex - 2; i < localPlayerIndex + 3; i++) { _scoreDisplays[i - (localPlayerIndex - 2)].UpdatePlayerInfo(playerInfos[i], playerInfos.FindIndexInList(playerInfos[i])); } } } } } break; case CommandType.UpdateVoIPData: { if (!Config.Instance.EnableVoiceChat) { return; } int playersCount = msg.ReadInt32(); for (int j = 0; j < playersCount; j++) { try { VoipFragment data = new VoipFragment(msg); #if DEBUG if (data.data != null && data.data.Length > 0) #else if (data.data != null && data.data.Length > 0 && data.playerId != Client.Instance.playerInfo.playerId) #endif { if (speexDec == null || speexDec.mode != data.mode) { speexDec = SpeexCodex.Create(data.mode); } _players.FirstOrDefault(x => x.PlayerInfo.playerId == data.playerId)?.PlayVoIPFragment(speexDec.Decode(data.data), data.index); } } catch (Exception e) { #if DEBUG Misc.Logger.Exception($"Unable to parse VoIP fragment! Excpetion: {e}"); #endif } } } break; case CommandType.SetGameState: { if (_currentScene == "GameCore" && loaded) { PropertyInfo property = typeof(StandardLevelGameplayManager).GetProperty("gameState"); property.DeclaringType.GetProperty("gameState"); property.GetSetMethod(true).Invoke(_gameManager, new object[] { (StandardLevelGameplayManager.GameState)msg.ReadByte() }); } } break; case CommandType.DisplayMessage: { _messageDisplayTime = msg.ReadFloat(); _messageDisplayText.fontSize = msg.ReadFloat(); _messageDisplayText.text = msg.ReadString(); if (msg.LengthBits - msg.Position >= 8) { MessagePosition position = (MessagePosition)msg.ReadByte(); switch (position) { default: case MessagePosition.Top: _messageDisplayText.transform.position = new Vector3(0f, 3.75f, 3.75f); _messageDisplayText.transform.rotation = Quaternion.Euler(-30f, 0f, 0f); break; case MessagePosition.Bottom: _messageDisplayText.transform.position = new Vector3(0f, 0f, 2.25f); _messageDisplayText.transform.rotation = Quaternion.Euler(30f, 0f, 0f); break; } } }; break; } }
public void ShowMessage(MessageType MsgType, String Message, bool AutoClose, MessagePosition MsgPosition, bool Modal) { string MsgType_S = "alert", Message_S = "", AutoClose_S = "true", MsgPosition_S = "Bottom", Modal_S = "false"; MsgType_S = MsgType.ToString(); //================================================================================ if (MsgType == MessageType.Success) { MsgType_S = "success"; } if (MsgType == MessageType.Alert) { MsgType_S = "alert"; } if (MsgType == MessageType.Error) { MsgType_S = "error"; } if (MsgType == MessageType.Warning) { MsgType_S = "warning"; } if (MsgType == MessageType.Infomation) { MsgType_S = "information"; } //================================================================================ if (MsgPosition == MessagePosition.Top) { MsgPosition_S = "top"; } if (MsgPosition == MessagePosition.TopLeft) { MsgPosition_S = "topLeft"; } if (MsgPosition == MessagePosition.TopCenter) { MsgPosition_S = "topCenter"; } if (MsgPosition == MessagePosition.TopRight) { MsgPosition_S = "topRight"; } if (MsgPosition == MessagePosition.CenterLeft) { MsgPosition_S = "centerLeft"; } if (MsgPosition == MessagePosition.Center) { MsgPosition_S = "center"; } if (MsgPosition == MessagePosition.CenterRight) { MsgPosition_S = "centerRight"; } if (MsgPosition == MessagePosition.BottomLeft) { MsgPosition_S = "bottomLeft"; } if (MsgPosition == MessagePosition.BottomCenter) { MsgPosition_S = "bottomCenter"; } if (MsgPosition == MessagePosition.BottomRight) { MsgPosition_S = "bottomRight"; } if (MsgPosition == MessagePosition.Bottom) { MsgPosition_S = "bottom"; } //================================================================================ Message_S = Message; //================================================================================ if (AutoClose) { AutoClose_S = "6000"; } else { AutoClose_S = "false"; } //================================================================================ if (Modal) { Modal_S = "true"; } else { Modal_S = "false"; } //================================================================================ String Script = "Fn_ShowMessage('" + MsgType_S + "','" + Message_S + "'," + AutoClose_S + ",'" + MsgPosition_S + "'," + Modal_S + ");"; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "SASASASS", Script, true); }
private void SetOptionPosition(MessagePosition position) { position.X = _px; position.Y = _py; }
private string ToCoordinateStr(MessagePosition position) { return($"{position.X}, {position.Y}"); }
protected override void OnMouseMove(MouseEventArgs e) { int index; var graphics = App.UseDirectX ? null : CreateGraphics(); var msg = MessageAtPoint(e.Location, out index); if (msg != null) { var word = msg.WordAtPoint(new CommonPoint(e.X - MessagePadding.Left, e.Y - msg.Y)); MessagePosition pos = msg.MessagePositionAtPoint(graphics, new CommonPoint(e.X - MessagePadding.Left, e.Y - msg.Y), index); //Console.WriteLine($"pos: {pos.MessageIndex} : {pos.WordIndex} : {pos.SplitIndex} : {pos.CharIndex}"); if (selection != null && mouseDown && leftClick) { var newSelection = new Selection(selection.Start, pos); if (!newSelection.Equals(selection)) { selection = newSelection; clearOtherSelections(); Invalidate(); } } if (word != null) { if (word.Link != null) { Cursor = Cursors.Hand; } else if (word.Type == SpanType.Text) { Cursor = Cursors.IBeam; } else { Cursor = Cursors.Default; } if (word.Tooltip != null) { App.ShowToolTip(PointToScreen(new Point(e.Location.X + 16, e.Location.Y + 16)), word.Tooltip, word.TooltipImageUrl, word.TooltipImage); } else { App.HideToolTip(); } } else { Cursor = Cursors.Default; App.HideToolTip(); } } graphics?.Dispose(); base.OnMouseMove(e); }