huddebugwinchardebug.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. class HudDebugWinCharDebug extends HudDebugWinBase
  2. {
  3. private PluginDeveloper m_ModuleDeveloper;
  4. private TextWidget m_PlayerPosTextWidget;
  5. private TextWidget m_ClipboardTextWidget;
  6. //============================================
  7. // HudDebugWinCharDebug
  8. //============================================
  9. void HudDebugWinCharDebug(Widget widget_root)
  10. {
  11. m_PlayerPosTextWidget = TextWidget.Cast( widget_root.FindAnyWidget("txt_PlayerPos") );
  12. m_ClipboardTextWidget = TextWidget.Cast( widget_root.FindAnyWidget("txt_Clipboard") );
  13. }
  14. //============================================
  15. // ~HudDebugWinCharDebug
  16. //============================================
  17. void ~HudDebugWinCharDebug()
  18. {
  19. }
  20. //============================================
  21. // Update
  22. //============================================
  23. override void Update()
  24. {
  25. super.Update();
  26. PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
  27. if ( player != NULL )
  28. {
  29. vector pos = player.GetPosition();
  30. string pos_str = "Pos: " + pos[0].ToString() + " " + pos[2].ToString();
  31. m_PlayerPosTextWidget.SetText(pos_str);
  32. }
  33. string clipboard;
  34. GetGame().CopyFromClipboard(clipboard);
  35. clipboard = clipboard.Substring( 0, Math.Min( clipboard.Length(), 128 ) ); //max 128 chars
  36. clipboard = "Clipboard: " + clipboard;
  37. m_ClipboardTextWidget.SetText(clipboard);
  38. }
  39. //============================================
  40. // GetWinType
  41. //============================================
  42. override int GetType()
  43. {
  44. return HudDebug.HUD_WIN_CHAR_DEBUG;
  45. }
  46. }