Styles basic HTML UIs (#7001)

This commit is contained in:
Karolis
2019-09-23 23:42:15 +03:00
committed by Werner
parent 18557e5fce
commit 61f6e5a6c1
53 changed files with 257 additions and 293 deletions
+45 -17
View File
@@ -50,6 +50,11 @@ Byond Vue UI framework's management subsystem
..()
for(var/mob/M in mob_list)
var/mob/abstract/new_player/np = M
if(istype(np))
np.new_player_panel_proc()
/**
* Gets a vueui_var_monitor associated with the given source type.
*
@@ -222,25 +227,48 @@ Byond Vue UI framework's management subsystem
if (!LAZYLEN(open_uis[old_object_key]))
open_uis -= old_object_key
/datum/controller/subsystem/processing/vueui/proc/get_html_theme_header()
return {"<meta http-equiv="X-UA-Compatible" content="IE=edge"><link rel="stylesheet" type="text/css" href="vueui.css">"}
/datum/controller/subsystem/processing/vueui/proc/get_html_theme(var/mob/user)
var/client/cl = null
if(istype(user))
cl = user.client
else
if(istype(user, /client))
cl = user
if(!cl)
return
var/style = cl.prefs.html_UI_style
if(!(style in available_html_themes))
style = "Nano"
return available_html_themes[style]
/datum/controller/subsystem/processing/vueui/proc/get_html_theme_class(var/mob/user)
if(user.client)
var/style = user.client.prefs.html_UI_style
if(!(style in available_html_themes))
style = "Nano"
var/list/theme = available_html_themes[style]
var/class = ""
class += "[theme["class"]]"
if(theme["type"] == THEME_TYPE_DARK)
class += " dark-theme"
return class
return ""
var/list/theme = get_html_theme(user)
if(!theme)
return FALLBACK_HTML_THEME
var/class = ""
class += "[theme["class"]]"
if(theme["type"] == THEME_TYPE_DARK)
class += " dark-theme"
return class
/datum/controller/subsystem/processing/vueui/proc/send_theme_resources(var/mob/user)
if(user.client)
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/vueui_theming)
assets.send(user.client)
/proc/send_theme_resources(var/user)
#ifdef UIDEBUG
user << browse_rsc(file("vueui/dist/app.js"), "vueui.js")
user << browse_rsc(file("vueui/dist/app.css"), "vueui.css")
#else
simple_asset_ensure_is_sent(user, /datum/asset/simple/vueui)
#endif
/proc/get_html_theme_header(var/themeclass, var/extra_header = "")
return {"<html><head><meta http-equiv="X-UA-Compatible" content="IE=edge"><link rel="stylesheet" type="text/css" href="vueui.css">[extra_header]</head><body class="[themeclass]">"}
/proc/get_html_theme_footer()
return {"</body></html>"}
/proc/enable_ui_theme(var/user, var/contents, var/extra_header = "")
var/theme_class = FALLBACK_HTML_THEME
if(SSvueui)
theme_class = SSvueui.get_html_theme_class(user)
return get_html_theme_header(theme_class, extra_header) + contents + get_html_theme_footer()
#undef NULL_OR_EQUAL