Custom HUD colors

This commit is contained in:
ZomgPonies
2013-11-30 18:30:18 -05:00
parent d14866c354
commit ebb29c625e
7 changed files with 128 additions and 13 deletions
+20 -6
View File
@@ -44,6 +44,9 @@ datum/preferences
var/be_special = 0 //Special role selection
var/UI_style = "Midnight"
var/toggles = TOGGLES_DEFAULT
var/UI_style_color = "#ffffff"
var/UI_style_alpha = 255
//character preferences
var/real_name //our character's name
@@ -258,7 +261,10 @@ datum/preferences
if (1) // General Preferences
dat += "<table><tr><td width='340px' height='300px' valign='top'>"
dat += "<h2>General Settings</h2>"
// dat += "<b>UI Style:</b> <a href='?_src_=prefs;preference=ui'><b>[UI_style]</b></a><br>"
dat += "<b>UI Style:</b> <a href='?_src_=prefs;preference=ui'><b>[UI_style]</b></a><br>"
dat += "<b>Custom UI</b>(recommended for White UI):<br>"
dat += "-Color: <a href='?_src_=prefs;preference=UIcolor'><b>[UI_style_color]</b></a> <table style='display:inline;' bgcolor='[UI_style_color]'><tr><td>__</td></tr></table><br>"
dat += "-Alpha(transparence): <a href='?_src_=prefs;preference=UIalpha'><b>[UI_style_alpha]</b></a><br>"
dat += "<b>Play admin midis:</b> <a href='?_src_=prefs;preference=hear_midis'><b>[(toggles & SOUND_MIDI) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Play lobby music:</b> <a href='?_src_=prefs;preference=lobby_music'><b>[(toggles & SOUND_LOBBY) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Ghost ears:</b> <a href='?_src_=prefs;preference=ghost_ears'><b>[(toggles & CHAT_GHOSTEARS) ? "Nearest Creatures" : "All Speech"]</b></a><br>"
@@ -1117,16 +1123,24 @@ datum/preferences
if("hear_adminhelps")
toggles ^= SOUND_ADMINHELP
/*
if("ui")
switch(UI_style)
if("Midnight")
UI_style = "Orange"
if("Orange")
UI_style = "old"
UI_style = "White"
else
UI_style = "Midnight"
*/
if("UIcolor")
var/UI_style_color_new = input(user, "Choose your UI color, dark colors are not recommended!") as color|null
if(!UI_style_color_new) return
UI_style_color = UI_style_color_new
if("UIalpha")
var/UI_style_alpha_new = input(user, "Select a new alpha(transparence) parametr for UI, between 50 and 255") as num
if(!UI_style_alpha_new | !(UI_style_alpha_new <= 255 && UI_style_alpha_new >= 50)) return
UI_style_alpha = UI_style_alpha_new
if("be_special")
var/num = text2num(href_list["num"])
be_special ^= (1<<num)
+10 -1
View File
@@ -54,14 +54,20 @@
S["be_special"] >> be_special
S["default_slot"] >> default_slot
S["toggles"] >> toggles
S["UI_style_color"] >> UI_style_color
S["UI_style_alpha"] >> UI_style_alpha
//Sanitize
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
UI_style = sanitize_inlist(UI_style, list("Midnight","Orange","old"), initial(UI_style))
UI_style = sanitize_inlist(UI_style, list("White", "Midnight"), initial(UI_style))
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))
default_slot = sanitize_integer(default_slot, 1, MAX_SAVE_SLOTS, initial(default_slot))
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color))
UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha))
return 1
@@ -80,6 +86,9 @@
S["be_special"] << be_special
S["default_slot"] << default_slot
S["toggles"] << toggles
S["UI_style_color"] << UI_style_color
S["UI_style_alpha"] << UI_style_alpha
return 1
+38 -1
View File
@@ -135,4 +135,41 @@
prefs.be_special ^= role_flag
prefs.save_preferences()
src << "You will [(prefs.be_special & role_flag) ? "now" : "no longer"] be considered for [role] events (where possible)."
feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/change_ui()
set name = "Change UI"
set category = "Preferences"
set desc = "Configure your user interface"
if(!ishuman(usr))
usr << "This only for human"
return
var/UI_style_new = input(usr, "Select a style, we recommend White for customization") in list("White", "Midnight", "Orange", "old")
if(!UI_style_new) return
var/UI_style_alpha_new = input(usr, "Select a new alpha(transparence) parametr for UI, between 50 and 255") as num
if(!UI_style_alpha_new | !(UI_style_alpha_new <= 255 && UI_style_alpha_new >= 50)) return
var/UI_style_color_new = input(usr, "Choose your UI color, dark colors are not recommended!") as color|null
if(!UI_style_color_new) return
//update UI
var/list/icons = usr.hud_used.adding + usr.hud_used.other +usr.hud_used.hotkeybuttons
icons.Add(usr.zone_sel)
for(var/obj/screen/I in icons)
if(I.color && I.alpha)
I.icon = ui_style2icon(UI_style_new)
I.color = UI_style_color_new
I.alpha = UI_style_alpha_new
if(alert("Like it? Save changes?",,"Yes", "No") == "Yes")
prefs.UI_style = UI_style_new
prefs.UI_style_alpha = UI_style_alpha_new
prefs.UI_style_color = UI_style_color_new
prefs.save_preferences()
usr << "UI was saved"