Guest User

Untitled

a guest
Apr 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class SRSettingsTab extends UT2K4TabPanel
  2.     editinlinenew
  3.     instanced;
  4.  
  5. var automated GUISectionBackground i_BGSec;
  6.  
  7. //NEW
  8. var() automated GUICheckBoxButton ch_ShowDamages;
  9. var() automated GUILabel ShowdamagesLabel;
  10.    
  11. var SRPlayerReplicationInfo SRPRI;
  12.  
  13.  
  14.  
  15. function InitComponent(GUIController MyController, GUIComponent MyOwner)
  16. {
  17.     Super.InitComponent(MyController, MyOwner);
  18.     SRPRI = SRPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo);
  19.    
  20.     ch_ShowDamages.bChecked = bool(class'SRMySettings'.static.Get("bShowDamage"));
  21.     SRPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo).SendSettingsToServer("bShowDamage", string(int(ch_ShowDamages.bChecked)));
  22.     SRPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo).bShowDamage = ch_ShowDamages.bChecked;
  23.    
  24.     ReSizeButtons();
  25. }
  26.  
  27. //Следующие 2 функции я использую, чтобы элемент управления GUICheckBoxButton был квадратный независимо от разрешения монитора
  28. function ResolutionChanged(int ResX, int ResY)
  29. {
  30.     Super.ResolutionChanged(ResX,ResY);
  31.     ReSizeButtons();
  32. }
  33.  
  34. function ReSizeButtons()
  35. {
  36.     local float bSize;
  37.  
  38.     bSize=i_BGSec.ActualWidth() / 25.0;
  39.    
  40.     ch_ShowDamages.WinHeight = bSize;
  41.     ch_ShowDamages.WinWidth = bSize;
  42. }
  43.  
  44. //Если мы нажимаем на GUICheckBoxButton и разрешаем или запрещаем поднимать пушки - переменная bAllowPickup в SRPlayerReplicationInfo изменяется. И на клиенте и на сервере.
  45. function InternalOnChange( GUIComponent C )
  46. {
  47.     if((PlayerOwner().PlayerReplicationInfo != none) && SRPRI == none)
  48.     {
  49.         SRPRI = SRPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo);
  50.     }
  51.  
  52.     if ( C == checkBoxAllowPickup )
  53.     {
  54. ...
  55.     }
  56.    
  57.     if ( C == ch_NoobCrosshair )
  58.     {
  59. ...
  60.     }
  61.    
  62.     if(C==checkBoxChangeView)
  63.     {
  64. ...
  65.     }  
  66.    
  67.     if ( C == ch_ShowDamages )
  68.     {
  69.         class'SRMySettings'.static.Set("bShowDamage", string(int(ch_ShowDamages.bChecked)));
  70.         SRPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo).SendSettingsToServer("bShowDamage", string(int(ch_ShowDamages.bChecked)));
  71.         SRPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo).bShowDamage = ch_ShowDamages.bChecked;
  72.     }
  73. }
  74.  
  75. defaultproperties
  76. {
  77.     //Background
  78.     //Checked
  79.     Begin Object Class=GUISectionBackground Name=BGSec
  80.         Caption="Settings"
  81.         WinTop=0.050
  82.         WinLeft=0.250
  83.         WinWidth=0.50
  84.         WinHeight=0.80
  85.         RenderWeight=0.10010
  86.         OnPreDraw=BGSec.InternalPreDraw
  87.     End Object
  88.     i_BGSec=BGSec
  89.    
  90.     //CheckBox Button
  91.     //Checked
  92.     Begin Object Class=GUICheckBoxButton Name=ShowDamages
  93.         Hint="If checked, the damage you're doing to zeds will pop up on your screen"
  94.         WinTop=0.30
  95.         WinLeft=0.680
  96.         WinWidth=0.050
  97.         OnChange=SRSettingsTab.InternalOnChange
  98.         OnKeyEvent=ShowDamages.InternalOnKeyEvent
  99.     End Object
  100.     ch_ShowDamages=ShowDamages
  101.    
  102.     //Text
  103.     //Checked
  104.     Begin Object Class=GUILabel Name=ShowdamagesLabelD
  105.         Caption="Show Damages [In testing period]"
  106.         VertAlign=1
  107.         StyleName="TextLabel"
  108.         WinTop=0.30
  109.         WinLeft=0.30
  110.         WinWidth=0.40
  111.         WinHeight=0.040
  112.     End Object
  113.     ShowdamagesLabel=ShowdamagesLabelD 
  114. }
Advertisement
Add Comment
Please, Sign In to add comment