Skip to content

Commit

Permalink
feat: add unlock video
Browse files Browse the repository at this point in the history
  • Loading branch information
Mivik committed Feb 6, 2024
1 parent 0a99644 commit 207c472
Show file tree
Hide file tree
Showing 30 changed files with 896 additions and 332 deletions.
76 changes: 35 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion phira/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ image = "*"
lru = "0.12.1"
lyon = "*"
macroquad = { git = "https://github.com/Mivik/prpr-macroquad", default-features = false }
md5 = "0.7"
nalgebra = "*"
once_cell = "*"
openssl = { version = "*", features = ["vendored"] }
Expand All @@ -43,6 +42,7 @@ serde_yaml = "0.9.17"
sha2 = "*"
smallvec = "1.10.0"
tap = "1.0.1"
tempfile = "3.10.0"
tokio = { version = "*", features = ["rt-multi-thread", "sync"] }
tracing = "0.1.37"
walkdir = "2.3.3"
Expand Down
1 change: 1 addition & 0 deletions phira/locales/en-US/song.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ delete = Delete
rate = Rate
exercise = Exercise
offset = Adjust offset
unlock = Play unlock video
edit-cancel = Cancel
edit-save = Save
Expand Down
1 change: 1 addition & 0 deletions phira/locales/zh-CN/song.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ delete = 删除
rate = 评分
exercise = 练习
offset = 调整延迟
unlock = 播放解锁动画
edit-cancel = 取消
edit-save = 保存
Expand Down
12 changes: 10 additions & 2 deletions phira/src/data.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
client::{Ptr, User, Character},
client::{Character, Ptr, User},
dir,
};
use anyhow::Result;
Expand All @@ -10,7 +10,11 @@ use prpr::{
scene::SimpleRecord,
};
use serde::{Deserialize, Serialize};
use std::{collections::{HashSet, HashMap}, ops::DerefMut, path::Path};
use std::{
collections::{HashMap, HashSet},
ops::DerefMut,
path::Path,
};

#[derive(Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -57,6 +61,8 @@ pub struct LocalChart {
pub record: Option<SimpleRecord>,
#[serde(default)]
pub mods: Mods,
#[serde(default)]
pub played_unlock: bool,
}

#[derive(Default, Serialize, Deserialize)]
Expand Down Expand Up @@ -102,6 +108,7 @@ impl Data {
local_path: filename,
record: None,
mods: Mods::default(),
played_unlock: false,
});
}
}
Expand All @@ -125,6 +132,7 @@ impl Data {
local_path: filename,
record: None,
mods: Mods::default(),
played_unlock: false,
});
}
}
Expand Down
1 change: 1 addition & 0 deletions phira/src/mp/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ impl MPPanel {
self.client.as_ref().map(Arc::clone),
None,
None,
false,
)?;
}
} else {
Expand Down
6 changes: 5 additions & 1 deletion phira/src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ mod main;
pub use main::{MainScene, BGM_VOLUME_UPDATED, MP_PANEL};

mod song;
use once_cell::sync::Lazy;
pub use song::{Downloading, SongScene, RECORD_ID};

mod unlock;
pub use unlock::UnlockScene;

mod profile;
pub use profile::ProfileScene;

use crate::{client::UserManager, data::LocalChart, dir, get_data, get_data_mut, page::Fader, save_data};
use anyhow::{bail, Context, Result};
use async_trait::async_trait;
use once_cell::sync::Lazy;
use prpr::{
config::Mods,
core::{BOLD_FONT, PGR_FONT},
Expand Down Expand Up @@ -181,6 +184,7 @@ pub async fn import_chart_to(dir: &Path, id: Uuid, path: String) -> Result<Local
local_path,
record: None,
mods: Mods::default(),
played_unlock: false,
})
}

Expand Down
1 change: 1 addition & 0 deletions phira/src/scene/chapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ impl Scene for ChapterScene {
format: None,
music: ":music".to_owned(),
illustration: ":illu".to_owned(),
unlock_video: None,

preview_start: 0.,
preview_end: None,
Expand Down
Loading

0 comments on commit 207c472

Please sign in to comment.