Skip to content

Commit

Permalink
merge #7 from nonoesimposible/clean-cubescript-ui
Browse files Browse the repository at this point in the history
cleans up scoreboard.cfg for #1
  • Loading branch information
no-lex authored Jan 4, 2021
2 parents 2de606f + 733c901 commit 75768b5
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 80 deletions.
154 changes: 74 additions & 80 deletions config/ui/scoreboard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ newui "scoreboard" [
uicolor (? $sbtransparent $c_menu_a $c_menu) 0 0 [
uivlist 0 [
UI_sbheader
uifill 0 0.005
uifill 0 $pad_thin
UI_playertableteam
UI_spectatorlist
]
Expand All @@ -18,35 +18,34 @@ newui "scoreboard" [

///////////////////////////////////////////////////////////////////////////////

UI_sbwteam = 1.18
UI_sbheader = [
uifill 0 0.005
uifill $UI_sbwteam 0.05 [
uifill (-f $UI_sbwteam (? (= $showip 1) 0.18 0)) 0 [
uifill 0 $pad_thin
uifill $sbwidth $pad_medium [
uifill (-f $sbwidth (? (= $showip 1) $sbipwidth 0)) 0 [
uialign -1
uiclip (-f $UI_sbwteam (? (= $showip 1) 0.18 0)) 0 [
uiclip (-f $sbwidth (? (= $showip 1) $sbipwidth 0)) 0 [
uialign -1
uispace 0.01 0 [
uispace $pad_thin 0 [
uivlist 0 [
if $scoreboardservinfo [
uitext $scoreboardservinfo 0.65
uitext $scoreboardservinfo $title_height
] [
uitext "^f4Imprimis" 0.65
uitext "^f4Imprimis" $title_height
]
uihlist 0.015 [
uihlist $sbpadhorizontal [
uifill
uihlist 0.003 [
uitext "^fs[" 0.52
uitext (concatword (at ["^f0" "^f0" "^f2" "^f3"] $getmastermode) (getmastermodename $getmastermode)) 0.52
uitext "^fS]" 0.52
uihlist $pad_thin [
uitext "^fs[" $sbmidtext
uitext (concatword (at ["^f0" "^f0" "^f2" "^f3"] $getmastermode) (getmastermodename $getmastermode)) $sbmidtext
uitext "^fS]" $sbmidtext
]
UItriangle 0x606060 0.01 0.01 270
uitext (getmodeprettyname $getmode) 0.52
UItriangle 0x606060 0.01 0.01 270
uitext $scoreboardmap 0.52
UItriangle $color_light_gray $trianglewidth $triangleheight 270
uitext (getmodeprettyname $getmode) $sbmidtext
UItriangle $color_light_gray $trianglewidth $triangleheight 270
uitext $scoreboardmap $sbmidtext
if (MODE_TIMED $getmode) [
UItriangle 0x606060 0.01 0.01 270
uitext (concatword (? (|| $intermission $paused) "^f3" "^f8") $scoreboardtime) 0.52
UItriangle $color_light_gray $trianglewidth $triangleheight 270
uitext (concatword (? (|| $intermission $paused) "^f3" "^f8") $scoreboardtime) $sbmidtext
]
]
uialign* -1
Expand All @@ -56,15 +55,15 @@ UI_sbheader = [
]
if $scoreboardmultiplayer [
if $showip [
uifill 0.18 0 [
uifill $sbipwidth 0 [
uialign 1
UIbar 0 1; uialign- -1
uiclip 0.18 0 [
uiclip $sbipwidth 0 [
uialign 1
uispace 0.01 0 [
uivlist 0.004 [
uicolortext $connectedip 0xA0A0A0 0.52
uicolortext $connectedport 0xA0A0A0 0.52
uispace $pad_thin 0 [
uivlist $pad_thin [
uicolortext $connectedip $color_mid_gray $sbmidtext
uicolortext $connectedport $color_mid_gray $sbmidtext
uialign* 1
]
]
Expand All @@ -76,87 +75,82 @@ UI_sbheader = [
]
]
//-------------------------------------------------------------------------------------------------
UI_cw_s = 0.042
UI_cw_k = 0.054
UI_cw_d = 0.054
UI_cw_pj = 0.050
UI_cw_p = 0.050
UI_cw_cn = 0.040
UI_cw_n = [-f (*f $UI_sbwteam 0.5) (? $showscore $UI_cw_s) (? $showkills $UI_cw_k) (? $showdeaths $UI_cw_d) (? $scoreboardmultiplayer (? $showpj $UI_cw_pj)) (? $scoreboardmultiplayer (? $showping $UI_cw_p)) (? $scoreboardmultiplayer (? $showclientnum $UI_cw_cn)) 0.03]
// ^ change scoreboard size depending on what features are enabled

UI_playertableteam = [
uifill 0 0 [
uihlist 0 [
uitable 0 0 [
uialign 0 -1
uitableheader [
uifill 0.015
uifill $sbpadhorizontal
if $scoreboardmultiplayer [
if $showclientnum [uifill $UI_cw_cn 0.042 [uicolortext "#" 0xA0A0A0 0.45 ; uialign- -1 1]]
if $showping [uifill $UI_cw_p 0.042 [uicolortext "P" 0x77A1D9 0.45 ; uialign- -1 1]]
if $showpj [uifill $UI_cw_pj 0.042 [uicolortext "PJ" 0x77A1D9 0.45 ; uialign- -1 1]]
if $showclientnum [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "#" $color_mid_gray $sblittletext ; uialign- -1 1]]
if $showping [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "P" $sbnetstat $sblittletext ; uialign- -1 1]]
if $showpj [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "PJ" $sbnetstat $sblittletext ; uialign- -1 1]]
]
if $showdeaths [uifill $UI_cw_d 0.042 [uicolortext "D" 0xE56767 0.45 ; uialign- -1 1]]
if $showkills [uifill $UI_cw_k 0.042 [uicolortext "K" 0xBBCC8B 0.45 ; uialign- -1 1]]
if $showscore [uifill $UI_cw_s 0.042 [uicolortext "Score" 0x62B370 0.45 ; uialign- -1 1]]
uifill (UI_cw_n) 0.042 [uicolortext (getteamscore 1) 0x4060D0 1 ; uialign- 1]
uifill 0.015
if $showdeaths [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "D" $sbdeaths $sblittletext ; uialign- -1 1]]
if $showkills [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "K" $sbkills $sblittletext ; uialign- -1 1]]
if $showscore [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "Score" $sbscore $sblittletext ; uialign- -1 1]]
uifill (sbnamecolwidth) $sbtableheaderheight [uicolortext (getteamscore 1) 0x4060D0 1 ; uialign- 1]
uifill $sbpadhorizontal
] [uicolor 0x99202860 0 0 [uiclamp 1 1 1 1]]
// used to toggle the background color of each row
UI_sbtc = 0
loopscoreboard cn 1 [
UI_sbtc = (! $UI_sbtc)
uitablerow [
uifill 0.015
uifill $sbpadhorizontal
if $scoreboardmultiplayer [
if $showclientnum [uifill $UI_cw_cn 0.026 [uicolortext (? (isai $cn) "^f4-" $cn) 0xA0A0A0 0.52 ; uialign- -1]]
if $showping [uifill $UI_cw_p 0.026 [uicolortext (? (isai $cn) "^f4-" (scoreboardping $cn)) 0x77A1D9 0.52 ; uialign- -1]]
if $showpj [uifill $UI_cw_pj 0.026 [uicolortext (? (isai $cn) "^f4-" (scoreboardpj $cn)) 0x77A1D9 0.52 ; uialign- -1]]
if $showclientnum [uifill $sbcolumnwidth $rowheight [uicolortext (? (isai $cn) "^f4-" $cn) $color_mid_gray $sbmidtext ; uialign- -1]]
if $showping [uifill $sbcolumnwidth $rowheight [uicolortext (? (isai $cn) "^f4-" (scoreboardping $cn)) $sbnetstat $sbmidtext ; uialign- -1]]
if $showpj [uifill $sbcolumnwidth $rowheight [uicolortext (? (isai $cn) "^f4-" (scoreboardpj $cn)) $sbnetstat $sbmidtext ; uialign- -1]]
]
if $showdeaths [uifill $UI_cw_d 0.026 [uicolortext (getclientdeaths $cn) 0xE56767 0.52 ; uialign- -1]]
if $showkills [uifill $UI_cw_k 0.026 [uicolortext (getclientfrags $cn) 0xBBCC8B 0.52 ; uialign- -1]]
if $showscore [uifill $UI_cw_s 0.026 [uicolortext (getclientscore $cn) 0x62B370 0.52 ; uialign- -1]]
uifill (UI_cw_n) 0.026 [uicolortext (getclientcolorname $cn) (scoreboardstatus $cn) 0.57 ; uialign- 1]
uifill 0.015
if $showdeaths [uifill $sbcolumnwidth $rowheight [uicolortext (getclientdeaths $cn) $sbdeaths $sbmidtext ; uialign- -1]]
if $showkills [uifill $sbcolumnwidth $rowheight [uicolortext (getclientfrags $cn) $sbkills $sbmidtext ; uialign- -1]]
if $showscore [uifill $sbcolumnwidth $rowheight [uicolortext (getclientscore $cn) $sbscore $sbmidtext ; uialign- -1]]
uifill (sbnamecolwidth) $rowheight [uicolortext (getclientcolorname $cn) (scoreboardstatus $cn) $sbbigtext ; uialign- 1]
uifill $sbpadhorizontal
] [
uicolor (? $UI_sbtc 0x99333b40 0x99262b33) 0 0 [uiclamp 1 1 1 1]
pushif highlight (scoreboardhighlight $cn) [uioutline 0xA0A0A0 (-f (*f $UI_sbwteam 0.5) 0.002) 0.024]
uicolor (? $UI_sbtc $sbtablerow1 $sbtablerow2) 0 0 [uiclamp 1 1 1 1]
pushif highlight (scoreboardhighlight $cn) [uioutline $color_mid_gray (-f (*f $sbwidth 0.5) $playeroutlinewidth) (-f $rowheight $playeroutlinewidth)]
]
]
]
uitable 0 0 [
uialign 0 -1
uitableheader [
uifill 0.015
uifill (UI_cw_n) 0.042 [uicolortext (getteamscore 2) 0xD04040 1 ; uialign- -1]
if $showscore [uifill $UI_cw_s 0.042 [uicolortext "Score" 0x62B370 0.45 ; uialign- 1 1]]
if $showkills [uifill $UI_cw_k 0.042 [uicolortext "K" 0xBBCC8B 0.45 ; uialign- 1 1]]
if $showdeaths [uifill $UI_cw_d 0.042 [uicolortext "D" 0xE56767 0.45 ; uialign- 1 1]]
uifill $sbpadhorizontal
uifill (sbnamecolwidth) $sbtableheaderheight [uicolortext (getteamscore 2) 0xD04040 1 ; uialign- -1]
if $showscore [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "Score" $sbscore $sblittletext ; uialign- 1 1]]
if $showkills [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "K" $sbkills $sblittletext ; uialign- 1 1]]
if $showdeaths [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "D" $sbdeaths $sblittletext ; uialign- 1 1]]
if $scoreboardmultiplayer [
if $showpj [uifill $UI_cw_pj 0.042 [uicolortext "PJ" 0x77A1D9 0.45 ; uialign- 1 1]]
if $showping [uifill $UI_cw_p 0.042 [uicolortext "P" 0x77A1D9 0.45 ; uialign- 1 1]]
if $showclientnum [uifill $UI_cw_cn 0.042 [uicolortext "#" 0xA0A0A0 0.45 ; uialign- 1 1]]
if $showpj [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "PJ" $sbnetstat $sblittletext ; uialign- 1 1]]
if $showping [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "P" $sbnetstat $sblittletext ; uialign- 1 1]]
if $showclientnum [uifill $sbcolumnwidth $sbtableheaderheight [uicolortext "#" $color_mid_gray $sblittletext ; uialign- 1 1]]
]
uifill 0.015
uifill $sbpadhorizontal
] [uicolor 0x99602020 0 0 [uiclamp 1 1 1 1]]
// used to toggle the background color of each row
UI_sbtc = 0
loopscoreboard cn 2 [
UI_sbtc = (! $UI_sbtc)
uitablerow [
uifill 0.015
uifill (UI_cw_n) 0.026 [uicolortext (getclientcolorname $cn) (scoreboardstatus $cn) 0.57 ; uialign- -1]
if $showscore [uifill $UI_cw_s 0.026 [uicolortext (getclientscore $cn) 0x62B370 0.52 ; uialign- 1]]
if $showkills [uifill $UI_cw_k 0.026 [uicolortext (getclientfrags $cn) 0xBBCC8B 0.52 ; uialign- 1]]
if $showdeaths [uifill $UI_cw_d 0.026 [uicolortext (getclientdeaths $cn) 0xE56767 0.52 ; uialign- 1]]

uifill $sbpadhorizontal
uifill (sbnamecolwidth) $rowheight [uicolortext (getclientcolorname $cn) (scoreboardstatus $cn) $sbbigtext ; uialign- -1]
if $showscore [uifill $sbcolumnwidth $rowheight [uicolortext (getclientscore $cn) $sbscore $sbmidtext ; uialign- 1]]
if $showkills [uifill $sbcolumnwidth $rowheight [uicolortext (getclientfrags $cn) $sbkills $sbmidtext ; uialign- 1]]
if $showdeaths [uifill $sbcolumnwidth $rowheight [uicolortext (getclientdeaths $cn) $sbdeaths $sbmidtext ; uialign- 1]]
if $scoreboardmultiplayer [
if $showpj [uifill $UI_cw_pj 0.026 [uicolortext (? (isai $cn) "^f4-" (scoreboardpj $cn)) 0x77A1D9 0.52 ; uialign- 1]]
if $showping [uifill $UI_cw_p 0.026 [uicolortext (? (isai $cn) "^f4-" (scoreboardping $cn)) 0x77A1D9 0.52 ; uialign- 1]]
if $showclientnum [uifill $UI_cw_cn 0.026 [uicolortext (? (isai $cn) "^f4-" $cn) 0xA0A0A0 0.52 ; uialign- 1]]
if $showpj [uifill $sbcolumnwidth $rowheight [uicolortext (? (isai $cn) "^f4-" (scoreboardpj $cn)) $sbnetstat $sbmidtext ; uialign- 1]]
if $showping [uifill $sbcolumnwidth $rowheight [uicolortext (? (isai $cn) "^f4-" (scoreboardping $cn)) $sbnetstat $sbmidtext ; uialign- 1]]
if $showclientnum [uifill $sbcolumnwidth $rowheight [uicolortext (? (isai $cn) "^f4-" $cn) $color_mid_gray $sbmidtext ; uialign- 1]]
]
uifill 0.015
uifill $sbpadhorizontal
] [
uicolor (? $UI_sbtc 0x99403333 0x99332626) 0 0 [uiclamp 1 1 1 1]
pushif highlight (scoreboardhighlight $cn) [uioutline 0xA0A0A0 (-f (*f $UI_sbwteam 0.5) 0.002) 0.024]
uicolor (? $UI_sbtc $sbtablerow1 $sbtablerow2) 0 0 [uiclamp 1 1 1 1]
pushif highlight (scoreboardhighlight $cn) [uioutline $color_mid_gray (-f (*f $sbwidth 0.5) $playeroutlinewidth) (-f $rowheight $playeroutlinewidth)]
]
]
]
Expand All @@ -165,18 +159,18 @@ UI_playertableteam = [
]
//-------------------------------------------------------------------------------------------------
UI_spectatorlist = [
uicolor 0x88161616 0 0.022 [
uicolor (? $sbtransparent $c_menu_a $c_menu) 0 $rowheight [
uiclamp 1 1 1 1
if $showspectators [
uigrid (? (> $getmode 0) 3 2) 0 0 [
loopscoreboard cn -1 [
uispace 0.01 0.01 [
uispace $pad_thin $pad_thin [
pushif sbhigh (scoreboardhighlight $cn) [
uioutline 0xA0A0A0 ; uiclamp- 1 1 1 1
uioutline $color_mid_gray ; uiclamp- 1 1 1 1
]
uihlist 0.01 [
uicolortext (getclientcolorname $cn) (scoreboardstatus $cn) 0.57
if $scoreboardmultiplayer [if $showclientnum [uitext $cn 0.57]]
uihlist $pad_thin [
uicolortext (getclientcolorname $cn) (scoreboardstatus $cn) $sbbigtext
if $scoreboardmultiplayer [if $showclientnum [uitext $cn $sbbigtext]]
]
]
]
Expand Down
47 changes: 47 additions & 0 deletions config/ui/style.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// padding
pad_thin = 0.005
pad_medium = 0.05

// these variables need better names
rowheight = 0.026
trianglewidth = 0.01
triangleheight = 0.01

// font sizes
title_height = 0.65

// colors
// still trying to find a consistent naming scheme
color_light_gray = 0x606060
color_mid_gray = 0xA0A0A0

// styles used by the elements of stdui.cfg for the game menus

textbright 90
Expand Down Expand Up @@ -175,3 +192,33 @@ style_img_hold2 = [// HOVER, ESC
]
]

///////////////////////////////////////////////////////////////////////////////
// Scoreboard //
///////////////////////////////////////////////////////////////////////////////

// text size
sblittletext = 0.45
sbmidtext = 0.52
sbbigtext = 0.57

// colors
sbdeaths = 0xE56767
sbkills = 0xBBCC8B
sbscore = 0x62B370
// ping and pj (packet jump)
sbnetstat = 0x77A1D9

// table stuff
sbwidth = 1.18
sbcolumnwidth = 0.05
// changes scoreboard size depending on what features are enabled (doesn't seem to work?)
sbnamecolwidth = [-f (*f $sbwidth 0.5) (? $showscore $sbcolumnwidth) (? $showkills $sbcolumnwidth) (? $showdeaths $sbcolumnwidth) (? $scoreboardmultiplayer (? $showpj $sbcolumnwidth)) (? $scoreboardmultiplayer (? $showping $sbcolumnwidth)) (? $scoreboardmultiplayer (? $showclientnum $sbcolumnwidth)) 0.03]
sbtableheaderheight = 0.042
playeroutlinewidth = 0.002
sbpadhorizontal = 0.015
// each row alternates color
sbtablerow1 = 0x99444444
sbtablerow2 = 0x99393939
// sbipwidth controls the width of the upper-right IP info when showip is 1
sbipwidth = 0.18

0 comments on commit 75768b5

Please sign in to comment.