fix(moonwell): убрать соглашения и оформить выбор реалма
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
//! Fork-only replacement for the login ModelFFX image; remove on leaving login.
|
||||
//! Optional login policies and presentation supplied by client forks.
|
||||
use bevy::prelude::*;
|
||||
|
||||
/// An offscreen scene composited at the glue model's bucket, under all stock UI regions.
|
||||
/// An offscreen scene composited in the named glue models' buckets, under their UI regions.
|
||||
/// The provider owns its camera, image and lifecycle; stock Benilla never inserts this.
|
||||
#[derive(Clone, PartialEq, Eq, Resource)]
|
||||
pub struct LoginBackdrop {
|
||||
pub image: Handle<Image>,
|
||||
pub panes: &'static [&'static str],
|
||||
}
|
||||
|
||||
/// Skip the stock client agreements for builds with their own login policy.
|
||||
#[derive(Resource)]
|
||||
pub struct LoginBackdrop(pub Handle<Image>);
|
||||
pub struct SkipLoginAgreements;
|
||||
|
||||
/// Deviation: override the glue theme because MoonWell ships its own main-screen soundtrack.
|
||||
/// Uses the existing music mixer, volume controls and world-entry fade; stock Benilla has none.
|
||||
|
||||
@@ -138,7 +138,20 @@ impl Addon {
|
||||
) -> Vec<String> {
|
||||
let mut failures = Vec::new();
|
||||
// The `<Include>` / `<Script file=>` provider; `read` is the sandbox.
|
||||
let provider = |req: &str| -> Option<Vec<u8>> { self.read(req) };
|
||||
let skip_agreements =
|
||||
self.name == super::reference_ui::GLUE_NAME && script.glue_notices().is_disabled();
|
||||
let provider = |req: &str| -> Option<Vec<u8>> {
|
||||
// The stock agreement panes use bare SimpleHTML file attributes. Keep the panes
|
||||
// available to GlueXML while leaving the documents unopened for opted-out clients.
|
||||
if skip_agreements
|
||||
&& ["eula.html", "tos.html", "scan.html", "contest.html"]
|
||||
.iter()
|
||||
.any(|name| req.eq_ignore_ascii_case(name))
|
||||
{
|
||||
return None;
|
||||
}
|
||||
self.read(req)
|
||||
};
|
||||
for file in files {
|
||||
// Resolved once into the source's path space, for `read` and the loader alike.
|
||||
let path = benilla_ui::loader::join_ref(&self.prefix(), file);
|
||||
|
||||
@@ -231,7 +231,7 @@ pub(super) struct GateInputs {
|
||||
extracted: Vec<benilla_ui::script::ExtractedQuad>,
|
||||
text_ui: Option<benilla_ui::script::EditBoxTextUi>,
|
||||
dims: Option<(u32, u32, u32, u32)>,
|
||||
login_backdrop: Option<Handle<Image>>,
|
||||
login_backdrop: Option<crate::login_backdrop::LoginBackdrop>,
|
||||
portraits: std::collections::HashMap<String, crate::portrait::PortraitSource>,
|
||||
/// The `UiFontAtlas::generation` the held glyph UVs came from; it moves only on a reset.
|
||||
generation: Option<u64>,
|
||||
@@ -774,7 +774,7 @@ pub(super) fn paint_script(
|
||||
// and the blink phase (0.5 s, `0x77a790`).
|
||||
let text_ui = script.focused_editbox_text_ui();
|
||||
let _ = lap(); // re-arm: the editbox seam above is not the walk's cost
|
||||
let login_backdrop = booths.login_backdrop.as_ref().map(|b| b.0.clone());
|
||||
let login_backdrop = booths.login_backdrop.as_deref().cloned();
|
||||
let extracted = script.extract();
|
||||
let us_exm = lap();
|
||||
let n_extracted = extracted.len();
|
||||
@@ -1263,18 +1263,19 @@ fn convert_entry(
|
||||
// overrides the paint registration `0x76d160`), so every UI region paints over it.
|
||||
// The scene is the glue booth's, which renders the window's view of the stage the
|
||||
// glue VM feeds it (`crate::ui_script::glue_scene`); the pane shows its part of it.
|
||||
if ffx {
|
||||
// Deviation: replace the login image because this fork supplies MoonWell branding.
|
||||
// The same ARTWORK bucket (0x46fa90) preserves stock regions and input.
|
||||
let image = booths
|
||||
.login_backdrop
|
||||
.as_ref()
|
||||
.filter(|_| name.as_deref() == Some("AccountLogin"))
|
||||
.map(|b| &b.0)
|
||||
.or_else(|| match booths.images.0.get(crate::portrait::GLUE_SLOT) {
|
||||
// A fork can replace a named model's image in its original bucket, including a
|
||||
// plain Model such as RealmWizard. The stock regions and input stay on that frame.
|
||||
let backdrop = booths
|
||||
.login_backdrop
|
||||
.as_ref()
|
||||
.filter(|b| name.as_deref().is_some_and(|name| b.panes.contains(&name)));
|
||||
if ffx || backdrop.is_some() {
|
||||
let image = backdrop.map(|b| &b.image).or_else(|| {
|
||||
match booths.images.0.get(crate::portrait::GLUE_SLOT) {
|
||||
Some(PortraitSource::Live(image)) => Some(image),
|
||||
_ => None,
|
||||
});
|
||||
}
|
||||
});
|
||||
let Some(image) = image else { return };
|
||||
if w <= 0.0 || h <= 0.0 {
|
||||
return;
|
||||
@@ -2143,6 +2144,10 @@ mod extract_gate_tests {
|
||||
local pane = CreateFrame("ModelFFX", "AccountLogin")
|
||||
pane:SetAllPoints()
|
||||
pane:SetModel("prototype.mdx")
|
||||
local wizard = CreateFrame("Model", "RealmWizard")
|
||||
wizard:SetAllPoints()
|
||||
wizard:SetModel("prototype.mdx")
|
||||
wizard:Hide()
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -2169,10 +2174,24 @@ mod extract_gate_tests {
|
||||
};
|
||||
assert!(drawn(&app, &stock));
|
||||
app.world_mut()
|
||||
.insert_resource(crate::login_backdrop::LoginBackdrop(custom.clone()));
|
||||
.insert_resource(crate::login_backdrop::LoginBackdrop {
|
||||
image: custom.clone(),
|
||||
panes: &["AccountLogin", "RealmWizard"],
|
||||
});
|
||||
app.update();
|
||||
assert!(drawn(&app, &custom));
|
||||
assert!(!drawn(&app, &stock));
|
||||
app.world()
|
||||
.non_send_resource::<UiScript>()
|
||||
.run("AccountLogin:Hide(); RealmWizard:Show()")
|
||||
.unwrap();
|
||||
app.update();
|
||||
assert!(drawn(&app, &custom));
|
||||
assert!(!drawn(&app, &stock));
|
||||
app.world()
|
||||
.non_send_resource::<UiScript>()
|
||||
.run("RealmWizard:Hide(); AccountLogin:Show()")
|
||||
.unwrap();
|
||||
app.world_mut()
|
||||
.remove_resource::<crate::login_backdrop::LoginBackdrop>();
|
||||
app.update();
|
||||
|
||||
@@ -141,6 +141,10 @@ fn start_server_alert(world: &mut World, script: &UiScript) {
|
||||
/// login screen's `OnShow` asks them at once. Every glue build after it (`0x402090`, a size
|
||||
/// change) seats the same cells unread, and only the accepts write them.
|
||||
fn seed_agreements(world: &mut World, script: &mut UiScript) {
|
||||
if world.contains_resource::<crate::login_backdrop::SkipLoginAgreements>() {
|
||||
script.set_glue_notices(benilla_ui::script::GlueNotices::disabled());
|
||||
return;
|
||||
}
|
||||
let Some(shared) = world
|
||||
.get_non_send_resource::<super::glue_mgr::SharedGlueMgr>()
|
||||
.cloned()
|
||||
@@ -1936,10 +1940,13 @@ mod tests {
|
||||
fn the_login_screen_comes_up_on_the_accepted_agreements() {
|
||||
use crate::client_state::ClientState;
|
||||
let _ = benilla_formats::wow_data_or_skip!();
|
||||
let screens = |cvars: crate::cvars::Cvars| {
|
||||
let screens = |cvars: crate::cvars::Cvars, skip_agreements: bool| {
|
||||
let mut world = World::new();
|
||||
world.insert_resource(State::new(ClientState::Login));
|
||||
world.insert_resource(cvars);
|
||||
if skip_agreements {
|
||||
world.insert_resource(crate::login_backdrop::SkipLoginAgreements);
|
||||
}
|
||||
world.init_non_send_resource::<super::super::glue_mgr::SharedGlueMgr>();
|
||||
setup_script(&mut world);
|
||||
world
|
||||
@@ -1953,15 +1960,20 @@ mod tests {
|
||||
let mut accepted = crate::cvars::Cvars::with_value("readEULA", "1");
|
||||
accepted.set("readTOS", "1");
|
||||
assert_eq!(
|
||||
screens(accepted),
|
||||
screens(accepted, false),
|
||||
(false, true, true),
|
||||
"accepted agreements go straight to the login boxes"
|
||||
);
|
||||
assert_eq!(
|
||||
screens(crate::cvars::Cvars::default()),
|
||||
screens(crate::cvars::Cvars::default(), false),
|
||||
(true, false, false),
|
||||
"a first launch is asked for the EULA"
|
||||
);
|
||||
assert_eq!(
|
||||
screens(crate::cvars::Cvars::with_value("readEULA", "-1"), true),
|
||||
(false, true, true),
|
||||
"a client that skips agreements ignores pending notices"
|
||||
);
|
||||
}
|
||||
|
||||
/// `0x46a400` reads the four `read*` options into the flag cells once, at `0x402b36`; after
|
||||
|
||||
@@ -71,25 +71,48 @@ impl NoticeState {
|
||||
/// state. The glue manager seeds them once (`0x46a400`) and seats the same cells in every glue VM
|
||||
/// it builds, so a rebuild (`0x46a7b0`) reads what the last one left and the accepts' stores
|
||||
/// (`0x46aef0` and its siblings) are the only writes after the seed.
|
||||
#[derive(Clone, Default)]
|
||||
pub struct GlueNotices(std::rc::Rc<std::cell::Cell<[NoticeState; 4]>>);
|
||||
#[derive(Clone)]
|
||||
pub struct GlueNotices(Option<std::rc::Rc<std::cell::Cell<[NoticeState; 4]>>>);
|
||||
|
||||
impl Default for GlueNotices {
|
||||
fn default() -> Self {
|
||||
Self::new([NoticeState::default(); 4])
|
||||
}
|
||||
}
|
||||
|
||||
impl GlueNotices {
|
||||
/// The cells seeded with `states`, in [`GlueNotice::ALL`] order.
|
||||
pub fn new(states: [NoticeState; 4]) -> Self {
|
||||
Self(std::rc::Rc::new(std::cell::Cell::new(states)))
|
||||
Self(Some(std::rc::Rc::new(std::cell::Cell::new(states))))
|
||||
}
|
||||
|
||||
/// One agreement's flags.
|
||||
/// Opt out of agreements. The stock Lua sees no pending step and accepts persist nothing.
|
||||
pub fn disabled() -> Self {
|
||||
Self(None)
|
||||
}
|
||||
|
||||
pub fn is_disabled(&self) -> bool {
|
||||
self.0.is_none()
|
||||
}
|
||||
|
||||
/// One agreement's flags. Stock Lua uses the accepted flag to skip a step.
|
||||
pub fn get(&self, notice: GlueNotice) -> NoticeState {
|
||||
self.0.get()[notice.index()]
|
||||
self.0.as_ref().map_or(
|
||||
NoticeState {
|
||||
accepted: true,
|
||||
show_notice: false,
|
||||
},
|
||||
|states| states.get()[notice.index()],
|
||||
)
|
||||
}
|
||||
|
||||
/// Store one agreement's flags.
|
||||
/// Store one agreement's flags when agreements are enabled.
|
||||
pub fn set(&self, notice: GlueNotice, state: NoticeState) {
|
||||
let mut all = self.0.get();
|
||||
all[notice.index()] = state;
|
||||
self.0.set(all);
|
||||
if let Some(states) = &self.0 {
|
||||
let mut all = states.get();
|
||||
all[notice.index()] = state;
|
||||
states.set(all);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -964,6 +987,9 @@ pub(super) fn install(lua: &Lua) -> mlua::Result<()> {
|
||||
accept,
|
||||
lua.create_function(move |lua, _: MultiValue| {
|
||||
let mut model = lua.app_data_mut::<Model>().expect("model app_data");
|
||||
if model.glue.notices.is_disabled() {
|
||||
return Ok(());
|
||||
}
|
||||
model.glue.notices.set(
|
||||
notice,
|
||||
NoticeState {
|
||||
@@ -1604,6 +1630,28 @@ mod tests {
|
||||
assert!(s.take_glue_requests().is_empty() && s.take_glue_calls().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disabled_agreements_allow_login_without_recording_acceptance() {
|
||||
let mut s = UiScript::new_glue().unwrap();
|
||||
s.register_cvars(GlueNotice::ALL.map(|notice| (notice.cvar(), "-1")));
|
||||
s.set_glue_notices(GlueNotices::disabled());
|
||||
s.run(
|
||||
"assert(EULAAccepted() and TOSAccepted() and ScanningAccepted() and ContestAccepted())
|
||||
assert(not (ShowEULANotice() or ShowTOSNotice() or ShowScanningNotice() or ShowContestNotice()))
|
||||
AcceptEULA() AcceptTOS() AcceptScanning() AcceptContest()
|
||||
DefaultServerLogin('probe', 'probe')",
|
||||
)
|
||||
.unwrap();
|
||||
for notice in GlueNotice::ALL {
|
||||
assert_eq!(s.cvar(notice.cvar()).as_deref(), Some("-1"));
|
||||
}
|
||||
assert!(s.take_cvar_changes().is_empty());
|
||||
assert!(matches!(
|
||||
s.take_glue_calls().as_slice(),
|
||||
[GlueCall::Login(_)]
|
||||
));
|
||||
}
|
||||
|
||||
/// The saved account name is the `accountName` CVar (`0x46cdd0`, `0x46cdf0`): what one side
|
||||
/// writes the other reads, and the write queues for the host like a `SetCVar`.
|
||||
#[test]
|
||||
|
||||
@@ -21,58 +21,6 @@ const BASE_ARCHIVES: &[&str] = &[
|
||||
"model.mpq",
|
||||
];
|
||||
|
||||
// AccountLogin.xml's SimpleHTML file= attributes are loose Storm opens (0x78a2a0),
|
||||
// not members of the mounted base archives: omitting them leaves the agreement panes empty.
|
||||
const AGREEMENTS: &[&str] = &["eula.html", "tos.html", "scan.html", "contest.html"];
|
||||
|
||||
fn agreement_files(data: &Path) -> Result<Vec<(String, PathBuf)>> {
|
||||
let mut files = Vec::new();
|
||||
for name in AGREEMENTS {
|
||||
let mut found = None;
|
||||
for folder in data.parent().into_iter().chain([data]) {
|
||||
let entries = fs::read_dir(folder)?.collect::<std::io::Result<Vec<_>>>()?;
|
||||
for candidate in [name.to_string(), format!("{name}.MPQ")] {
|
||||
let matches: Vec<_> = entries
|
||||
.iter()
|
||||
.filter(|e| {
|
||||
e.file_name()
|
||||
.to_string_lossy()
|
||||
.eq_ignore_ascii_case(&candidate)
|
||||
})
|
||||
.collect();
|
||||
ensure!(matches.len() <= 1, "duplicate agreement: {candidate}");
|
||||
if let Some(entry) = matches.first() {
|
||||
let path = entry.path();
|
||||
ensure!(
|
||||
path.is_file(),
|
||||
"agreement must be a file: {}",
|
||||
path.display()
|
||||
);
|
||||
let bytes = if candidate.ends_with(".MPQ") {
|
||||
benilla_mpq::Archive::open(&path)?.read_file(name)?
|
||||
} else {
|
||||
fs::read(&path)?
|
||||
};
|
||||
ensure!(!bytes.is_empty(), "empty agreement: {}", path.display());
|
||||
found = Some((candidate, path));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if found.is_some() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Scan/contest are conditional on regional GlueLocalization flags; enUS ships neither.
|
||||
if found.is_none() && matches!(*name, "scan.html" | "contest.html") {
|
||||
continue;
|
||||
}
|
||||
files.push(found.with_context(|| {
|
||||
format!("missing {name} (or {name}.MPQ) in the install root or Data; cannot stage an empty agreement dialog")
|
||||
})?);
|
||||
}
|
||||
Ok(files)
|
||||
}
|
||||
|
||||
fn patch_name(name: &str) -> bool {
|
||||
let name = name.to_ascii_lowercase();
|
||||
name == "patch"
|
||||
@@ -395,7 +343,6 @@ pub fn validate_distribution(root: &Path) -> Result<()> {
|
||||
);
|
||||
validate_data(&root.join("Data"))?;
|
||||
russian_archives(&root.join("Data"))?;
|
||||
agreement_files(&root.join("Data"))?;
|
||||
ensure!(
|
||||
root.join("realmlist.wtf").is_file(),
|
||||
"realmlist.wtf is missing"
|
||||
@@ -417,16 +364,12 @@ pub fn stage(
|
||||
);
|
||||
let archives = validate_data(data)?;
|
||||
let localized = russian_archives(data)?;
|
||||
let agreements = agreement_files(data)?;
|
||||
ensure_outside(data, output)?;
|
||||
if let Some(archive) = localized.first() {
|
||||
// A locale directory may point outside Data; it remains a read-only input as well.
|
||||
ensure_outside(archive.parent().context("language pack directory")?, output)?;
|
||||
}
|
||||
ensure_outside(binary, output)?;
|
||||
for (_, path) in &agreements {
|
||||
ensure_outside(path, output)?;
|
||||
}
|
||||
if let Some(source) = source {
|
||||
ensure_outside(source, output)?;
|
||||
}
|
||||
@@ -462,9 +405,6 @@ pub fn stage(
|
||||
}
|
||||
let target_data = output.join("Data");
|
||||
fs::create_dir(&target_data)?;
|
||||
for (name, path) in agreements {
|
||||
fs::copy(path, target_data.join(name))?;
|
||||
}
|
||||
// Build custom patches first; an explicitly supplied source replaces that install's patch.
|
||||
if let Some(source) = source {
|
||||
pack(source, output)?;
|
||||
@@ -545,13 +485,7 @@ mod tests {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let data = temp.path().join("install/Data");
|
||||
fs::create_dir_all(&data).unwrap();
|
||||
for name in AGREEMENTS {
|
||||
fs::write(
|
||||
data.join(name),
|
||||
format!("<html><body><p>Test {name}</p></body></html>"),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
fs::write(data.join("tos.html"), b"old agreement").unwrap();
|
||||
for name in BASE_ARCHIVES.iter().chain([&"patch-m.mpq"]) {
|
||||
let mut spell = [0u8; 20];
|
||||
spell[..4].copy_from_slice(b"WDBC");
|
||||
@@ -576,12 +510,7 @@ mod tests {
|
||||
fs::write(&binary, b"MZ\x00\x00 synthetic test executable").unwrap();
|
||||
let out = temp.path().join("out");
|
||||
stage(&binary, &data, &out, Some(&source), "127.0.0.1:3724").unwrap();
|
||||
for name in AGREEMENTS {
|
||||
assert_eq!(
|
||||
fs::read(out.join("Data").join(name)).unwrap(),
|
||||
fs::read(data.join(name)).unwrap()
|
||||
);
|
||||
}
|
||||
assert!(!out.join("Data/tos.html").exists());
|
||||
assert_eq!(fs::read(data.join("patch-m.mpq")).unwrap(), original);
|
||||
assert_eq!(
|
||||
fs::read(out.join("Data/ruRU/patch-1.MPQ")).unwrap(),
|
||||
@@ -597,48 +526,6 @@ mod tests {
|
||||
assert!(stage(&binary, &data, &out, None, "127.0.0.1").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn agreements_preserve_root_precedence_and_accept_loose_archives() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let data = temp.path().join("Data");
|
||||
fs::create_dir(&data).unwrap();
|
||||
assert!(agreement_files(&data)
|
||||
.unwrap_err()
|
||||
.to_string()
|
||||
.contains("missing eula.html"));
|
||||
for name in AGREEMENTS {
|
||||
fs::write(data.join(name), b"test data agreement").unwrap();
|
||||
}
|
||||
fs::remove_file(data.join("scan.html")).unwrap();
|
||||
fs::remove_file(data.join("contest.html")).unwrap();
|
||||
assert_eq!(agreement_files(&data).unwrap().len(), 2);
|
||||
let root = temp.path().join("EULA.HTML");
|
||||
fs::write(&root, b"test root agreement").unwrap();
|
||||
fs::remove_file(data.join("tos.html")).unwrap();
|
||||
let archive = data.join("TOS.HTML.mpq");
|
||||
ArchiveBuilder::new()
|
||||
.version(FormatVersion::V1)
|
||||
.add_file_data(b"test archived agreement".to_vec(), "tos.html")
|
||||
.build(&archive)
|
||||
.unwrap();
|
||||
crate::vanilla_mpq::normalize(&archive).unwrap();
|
||||
let files = agreement_files(&data).unwrap();
|
||||
assert_eq!(files[0], ("eula.html".to_string(), root));
|
||||
assert_eq!(files[1], ("tos.html.MPQ".to_string(), archive.clone()));
|
||||
assert_eq!(
|
||||
benilla_mpq::Archive::open(archive)
|
||||
.unwrap()
|
||||
.read_file("tos.html")
|
||||
.unwrap(),
|
||||
b"test archived agreement"
|
||||
);
|
||||
fs::write(data.join("scan.html"), b"").unwrap();
|
||||
assert!(agreement_files(&data)
|
||||
.unwrap_err()
|
||||
.to_string()
|
||||
.contains("empty agreement"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_auth_ports_and_wrath_archives_are_rejected() {
|
||||
for host in [
|
||||
|
||||
@@ -67,10 +67,10 @@ water's time multiplier; `TURBIDITY` sets its channel absorption. Water colors a
|
||||
The embedded, user-provided full logo is `src/login_logo.png`; its screen placement and UV crop
|
||||
are the `ImageNode` in `sync_scene`. The app icon is `assets/moonwell.ico`.
|
||||
|
||||
The camera renders only layer 61 into its own window-sized target. Removing the login screen
|
||||
despawns the complete stage and drops its target; returning builds one fresh stage. The core
|
||||
fork's optional `LoginBackdrop` replaces only the existing ModelFFX image, at its original
|
||||
paint bucket. No global lighting or world-render settings are changed.
|
||||
The camera renders only layer 61 into its own window-sized target. The login screen, realm
|
||||
wizard and realm list share the stage. Leaving those screens for character selection or the
|
||||
world despawns the stage and drops its target. The optional `LoginBackdrop` replaces named
|
||||
glue model images in their original paint buckets.
|
||||
|
||||
The well is the player's `World/wmo/Kalimdor/Buildings/NightElfMoonWell/NightElfMoonWell.wmo`.
|
||||
`src/login_scene/model.rs` loads it through the existing MPQ asset pipeline, preserves its six
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! MoonWell's fork-only login stage. All geometry is owned by one disposable root;
|
||||
//! its offscreen image uses the stock ModelFFX bucket, never a world camera or light.
|
||||
//! its offscreen image uses the stock glue model buckets, away from the world cameras and lights.
|
||||
use benilla_app::login_backdrop::LoginBackdrop;
|
||||
use benilla_ui::script::{UiScript, VmKind};
|
||||
use bevy::{
|
||||
@@ -51,8 +51,9 @@ const _: () = assert!(LEAVES < IMPACT_CAPACITY);
|
||||
pub struct MoonwellLoginPlugin;
|
||||
impl Plugin for MoonwellLoginPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins(interface::LoginInterfacePlugin);
|
||||
if std::env::var("MOONWELL_LOGIN_SCENE").is_ok_and(|v| v == "0") {
|
||||
let branded_scene = std::env::var("MOONWELL_LOGIN_SCENE").as_deref() != Ok("0");
|
||||
app.add_plugins(interface::LoginInterfacePlugin { branded_scene });
|
||||
if !branded_scene {
|
||||
return;
|
||||
}
|
||||
embedded_asset!(app, "login_water.wgsl");
|
||||
@@ -158,8 +159,13 @@ fn sync_scene(
|
||||
mut water: ResMut<Assets<MoonWater>>,
|
||||
mut floors: ResMut<Assets<scenery::ForestFloor>>,
|
||||
) {
|
||||
let script = script.filter(|s| s.vm_kind() == VmKind::Glue && s.frame_visible("AccountLogin"));
|
||||
let Some(script) = script else {
|
||||
let visible = script.is_some_and(|s| {
|
||||
s.vm_kind() == VmKind::Glue
|
||||
&& ["AccountLogin", "RealmWizard", "RealmList"]
|
||||
.iter()
|
||||
.any(|name| s.frame_visible(name))
|
||||
});
|
||||
if !visible {
|
||||
if let Some(scene) = scene {
|
||||
commands.entity(scene.root).despawn();
|
||||
commands.entity(scene.logo_root).despawn();
|
||||
@@ -169,7 +175,7 @@ fn sync_scene(
|
||||
info!("moonwell-login: released stage and render target");
|
||||
}
|
||||
return;
|
||||
};
|
||||
}
|
||||
let Ok(window) = window.single() else { return };
|
||||
// Minimized windows report 0x0; keep the last valid target and camera framing.
|
||||
if window.physical_width() == 0 || window.physical_height() == 0 {
|
||||
@@ -206,10 +212,6 @@ fn sync_scene(
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Deviation: hide the stock logo because MoonWell supplies its own branded header.
|
||||
if let Err(e) = script.run("if AccountLoginLogo then AccountLoginLogo:Hide() end") {
|
||||
error!("moonwell-login: hiding stock logo: {e}");
|
||||
}
|
||||
let image = images.add(Image::new_target_texture(
|
||||
window.physical_width().max(1),
|
||||
window.physical_height().max(1),
|
||||
@@ -396,7 +398,11 @@ fn sync_scene(
|
||||
Leaf { index, material },
|
||||
));
|
||||
}
|
||||
commands.insert_resource(LoginBackdrop(image.clone()));
|
||||
commands.insert_resource(LoginBackdrop {
|
||||
image: image.clone(),
|
||||
// RealmList is a dialog. It uses whichever of the other panes is behind it.
|
||||
panes: &["AccountLogin", "RealmWizard", "CharacterSelect"],
|
||||
});
|
||||
commands.insert_resource(Scene {
|
||||
root,
|
||||
image,
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
-- Deviation: skin the installed glue because MoonWell needs its own launcher branding and loading view.
|
||||
if AccountLoginTOSButton then
|
||||
if AccountLoginRealmName and AccountLoginRealmName:GetParent() == AccountLoginTOSButton then
|
||||
AccountLoginRealmName:SetParent(AccountLoginUI)
|
||||
end
|
||||
AccountLoginTOSButton:SetScript("OnClick", nil)
|
||||
AccountLoginTOSButton:Hide()
|
||||
end
|
||||
|
||||
local f = CreateFrame("Frame", "MoonWellLoginStatus", AccountLogin)
|
||||
f:SetWidth(500); f:SetHeight(110)
|
||||
f:SetPoint("CENTER", AccountLogin, "CENTER", 0, -65)
|
||||
@@ -47,7 +55,8 @@ local function clean(frame)
|
||||
for _, child in ipairs({frame:GetChildren()}) do clean(child) end
|
||||
end
|
||||
local lastClean = -2
|
||||
function MoonWellLoginPaint(automatic, busy, seconds)
|
||||
local characterLogoAlpha
|
||||
function MoonWellLoginPaint(automatic, busy, seconds, brandedScene)
|
||||
if seconds - lastClean > 1 then clean(GlueParent); lastClean = seconds end
|
||||
if GlueDialogText then branded(GlueDialogText) end
|
||||
if automatic and AccountLoginUI then
|
||||
@@ -62,7 +71,25 @@ function MoonWellLoginPaint(automatic, busy, seconds)
|
||||
AccountLoginAccountEdit:ClearFocus()
|
||||
AccountLoginPasswordEdit:ClearFocus()
|
||||
end
|
||||
local realm = (RealmList and RealmList:IsVisible()) or (RealmWizard and RealmWizard:IsVisible())
|
||||
local realmList = RealmList and RealmList:IsVisible()
|
||||
local realmWizard = RealmWizard and RealmWizard:IsVisible()
|
||||
if brandedScene then
|
||||
if AccountLoginLogo and AccountLoginLogo:IsShown() then AccountLoginLogo:Hide() end
|
||||
if realmWizard then
|
||||
if RealmWizardLogoLeft then RealmWizardLogoLeft:Hide() end
|
||||
if RealmWizardLogoRight then RealmWizardLogoRight:Hide() end
|
||||
end
|
||||
if CharacterSelectLogo then
|
||||
if realmList and not characterLogoAlpha then
|
||||
characterLogoAlpha = CharacterSelectLogo:GetAlpha()
|
||||
CharacterSelectLogo:SetAlpha(0)
|
||||
elseif not realmList and characterLogoAlpha then
|
||||
CharacterSelectLogo:SetAlpha(characterLogoAlpha)
|
||||
characterLogoAlpha = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
local realm = realmList or realmWizard
|
||||
local pin = VirtualKeypadFrame and VirtualKeypadFrame:IsVisible()
|
||||
AccountLogin:EnableKeyboard(not automatic or not not pin)
|
||||
local loading = automatic and busy and AccountLogin:IsVisible() and not realm and not pin
|
||||
|
||||
@@ -1,29 +1,34 @@
|
||||
//! Launcher-only skin; stock realm, locale, PIN and refusal handlers still own their decisions.
|
||||
use benilla_app::login_backdrop::LoginPresentation;
|
||||
use benilla_app::login_backdrop::{LoginPresentation, SkipLoginAgreements};
|
||||
use benilla_ui::script::{UiScript, VmKind};
|
||||
use bevy::prelude::*;
|
||||
|
||||
const MINIMUM_SCENE_SECONDS: f32 = 6.0;
|
||||
const STAGE_SECONDS: f32 = 0.85;
|
||||
|
||||
pub(super) struct LoginInterfacePlugin;
|
||||
pub(super) struct LoginInterfacePlugin {
|
||||
pub(super) branded_scene: bool,
|
||||
}
|
||||
impl Plugin for LoginInterfacePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
let automatic = ["WOW_USER", "WOW_PASS"]
|
||||
.iter()
|
||||
.all(|k| std::env::var_os(k).is_some());
|
||||
app.insert_resource(LoginPresentation {
|
||||
automatic,
|
||||
minimum_seconds: MINIMUM_SCENE_SECONDS,
|
||||
stage_seconds: STAGE_SECONDS,
|
||||
shown_at: None,
|
||||
busy: automatic,
|
||||
})
|
||||
.add_systems(PreUpdate, paint);
|
||||
let branded_scene = self.branded_scene;
|
||||
app.insert_resource(SkipLoginAgreements)
|
||||
.insert_resource(LoginPresentation {
|
||||
automatic,
|
||||
minimum_seconds: MINIMUM_SCENE_SECONDS,
|
||||
stage_seconds: STAGE_SECONDS,
|
||||
shown_at: None,
|
||||
busy: automatic,
|
||||
})
|
||||
.add_systems(PreUpdate, (move || branded_scene).pipe(paint));
|
||||
}
|
||||
}
|
||||
|
||||
fn paint(
|
||||
In(branded_scene): In<bool>,
|
||||
script: Option<NonSend<UiScript>>,
|
||||
mut presentation: ResMut<LoginPresentation>,
|
||||
time: Res<Time>,
|
||||
@@ -61,6 +66,7 @@ fn paint(
|
||||
presentation.automatic,
|
||||
presentation.busy,
|
||||
time.elapsed_secs(),
|
||||
branded_scene,
|
||||
))
|
||||
}) {
|
||||
error!("moonwell-login: interface paint: {error}");
|
||||
|
||||
@@ -13,9 +13,16 @@ fn skin_keeps_manual_login_realm_pin_and_errors_usable() {
|
||||
AccountLoginPasswordEdit=CreateFrame('EditBox','AccountLoginPasswordEdit',AccountLoginUI)
|
||||
AccountLoginExitButton=CreateFrame('Button','AccountLoginExitButton',AccountLoginUI)
|
||||
AccountLoginExitButton:SetScript('OnClick',function() QuitGame() end)
|
||||
TOSFrame=CreateFrame('Frame','TOSFrame',AccountLogin); TOSFrame:Hide()
|
||||
AccountLoginTOSButton=CreateFrame('Button','AccountLoginTOSButton',AccountLoginUI)
|
||||
AccountLoginTOSButton:SetScript('OnClick',function() TOSFrame:Show() end)
|
||||
AccountLoginRealmName=AccountLoginTOSButton:CreateFontString('AccountLoginRealmName','ARTWORK','GlueFontNormalLarge')
|
||||
VirtualKeypadFrame=CreateFrame('Frame','VirtualKeypadFrame',AccountLoginUI); VirtualKeypadFrame:Hide()
|
||||
RealmList=CreateFrame('Frame','RealmList',GlueParent); RealmList:Hide()
|
||||
RealmWizard=CreateFrame('Frame','RealmWizard',GlueParent); RealmWizard:Hide()
|
||||
RealmWizardLogoLeft=RealmWizard:CreateTexture('RealmWizardLogoLeft','ARTWORK')
|
||||
RealmWizardLogoRight=RealmWizard:CreateTexture('RealmWizardLogoRight','ARTWORK')
|
||||
CharacterSelectLogo=GlueParent:CreateTexture('CharacterSelectLogo','ARTWORK')
|
||||
GlueDialog=CreateFrame('Frame','GlueDialog',GlueParent)
|
||||
GlueDialogBackground=CreateFrame('Frame','GlueDialogBackground',GlueDialog)
|
||||
GlueDialogButton1=CreateFrame('Button','GlueDialogButton1',GlueDialogBackground)
|
||||
@@ -30,6 +37,12 @@ fn skin_keeps_manual_login_realm_pin_and_errors_usable() {
|
||||
.unwrap();
|
||||
s.run("MoonWellLoginPaint(false,false,0)").unwrap();
|
||||
assert!(s.frame_visible("AccountLoginAccountEdit"));
|
||||
assert!(!s.frame_visible("AccountLoginTOSButton"));
|
||||
s.run("AccountLoginTOSButton:Click()").unwrap();
|
||||
assert!(!s.frame_visible("TOSFrame"));
|
||||
assert!(s
|
||||
.eval::<bool>("return AccountLoginRealmName:GetParent() == AccountLoginUI")
|
||||
.unwrap());
|
||||
assert!(s
|
||||
.eval::<bool>("return Brand:IsShown() ~= 1 and Disclaimer:IsShown() ~= 1")
|
||||
.unwrap());
|
||||
@@ -48,17 +61,26 @@ fn skin_keeps_manual_login_realm_pin_and_errors_usable() {
|
||||
.unwrap(),
|
||||
0.0
|
||||
);
|
||||
s.run("RealmList:Show(); MoonWellLoginPaint(true,true,2)")
|
||||
s.run("RealmList:Show(); MoonWellLoginPaint(true,true,2,true)")
|
||||
.unwrap();
|
||||
assert!(!s.frame_visible("MoonWellLoginStatus"));
|
||||
assert!(s.frame_visible("RealmList"));
|
||||
assert!(s
|
||||
.eval::<bool>("return CharacterSelectLogo:GetAlpha() == 0")
|
||||
.unwrap());
|
||||
assert!(s.frame_visible("AccountLoginExitButton"));
|
||||
assert_eq!(
|
||||
s.eval::<f64>("return GlueDialogBackground:GetAlpha()")
|
||||
.unwrap(),
|
||||
1.0
|
||||
);
|
||||
s.run("RealmList:Hide(); VirtualKeypadFrame:Show(); MoonWellLoginPaint(true,true,3)")
|
||||
s.run("RealmList:Hide(); RealmWizard:Show(); MoonWellLoginPaint(true,true,2.5,true)")
|
||||
.unwrap();
|
||||
assert!(!s.frame_visible("MoonWellLoginStatus"));
|
||||
assert!(s
|
||||
.eval::<bool>("return CharacterSelectLogo:GetAlpha() == 1 and not RealmWizardLogoLeft:IsShown() and not RealmWizardLogoRight:IsShown()")
|
||||
.unwrap());
|
||||
s.run("RealmWizard:Hide(); VirtualKeypadFrame:Show(); MoonWellLoginPaint(true,true,3,true)")
|
||||
.unwrap();
|
||||
assert!(!s.frame_visible("MoonWellLoginStatus"));
|
||||
assert!(s.frame_visible("VirtualKeypadFrame"));
|
||||
|
||||
Reference in New Issue
Block a user