Advertisement
Guest User

Untitled

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