Skip to content

Commit

Permalink
Setup new splash screen that always shows
Browse files Browse the repository at this point in the history
Add insert properties for start screen sections
  • Loading branch information
JannisX11 committed Mar 28, 2022
1 parent e4b2038 commit e845e68
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 48 deletions.
Binary file added assets/splash_art.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 8 additions & 16 deletions content/news.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
{
"new_version": {
"color": "#12182a",
"text_color": "#e8ddcd",
"graphic": {
"type": "image",
"source": "https://web.blockbench.net/content/splash_art.png?41",
"width": 1000,
"aspect_ratio": "21/9",
"description": "Splash Art by [MisterGriimm](https://twitter.com/MisterGriimm) and [MidnitePixel_](https://twitter.com/MidnitePixel_)",
"text_color": "#aba4a3"
},
"color": "var(--color-bright_ui)",
"text_color": "var(--color-bright_ui_text)",
"layout": "vertical",
"insert_after": "splash_screen",
"text": [
{"text": "Happy Holidays!", "type": "h1"},
{"text": "...and welcome to Blockbench 4.1, the Inverse Kinematics Update!", "type": "h2"},
{"text": "Check out the [full changelog](https://github.com/JannisX11/blockbench/releases/tag/v4.1.0)"}
{"text": "Welcome to Blockbench 4.2, the Panel Update!", "type": "h1"},
{"text": "Check out the [full changelog](https://github.com/JannisX11/blockbench/releases/tag/v4.2.0)!"}
],
"features": [
{
"image": "https://web.blockbench.net/content/inverse_kinematics.png",
"title": "Inverse Kinematics!",
"title": "Moveable Panels!",
"text": "Inverse Kinematics allow you to animate a chain of bones by just moving the end point!"
},
{
"image": "https://web.blockbench.net/content/gif_crop.png",
"title": "GIF Cropping!",
"title": "Texture Editing!",
"text": "The new GIF recorder allows you to crop your GIF to just the content you need!"
},
{
"image": "https://web.blockbench.net/content/collada.png",
"title": "Collada Export",
"title": "Move Texture with UV",
"text": "With Collada support you can export your models directly into Unity and other programs!"
}
]
Expand Down
Binary file modified content/splash_art.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 53 additions & 32 deletions js/interface/start_screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,16 @@ function addStartScreenSection(id, data) {
}
if (data.last) {
$('#start_screen content').append(obj);
} else if (data.insert_after) {
$('#start_screen content').find(`#${data.insert_after}`).after(obj);
} else if (data.insert_before) {
$('#start_screen content').find(`#${data.insert_before}`).before(obj);
} else {
$('#start_screen content').prepend(obj);
}
if (!obj[0].parentElement) {
$('#start_screen content').append(obj);
}
}

onVueSetup(function() {
Expand Down Expand Up @@ -241,37 +248,6 @@ onVueSetup(function() {
url: 'https://web.blockbench.net/content/news.json',
dataType: 'json'
});
Promise.all([news_call, documentReady]).then((data) => {
if (!data || !data[0]) return;
data = data[0];

//Update Screen
if (Blockbench.hasFlag('after_update') && data.new_version) {
addStartScreenSection(data.new_version)
jQuery.ajax({
url: 'https://blckbn.ch/api/event/successful_update',
type: 'POST',
data: {
version: Blockbench.version
}
})
}
if (data.psa) {
(function() {
if (typeof data.psa.version == 'string') {
if (data.psa.version.includes('-')) {
limits = data.psa.version.split('-');
if (limits[0] && compareVersions(limits[0], Blockbench.version)) return;
if (limits[1] && compareVersions(Blockbench.version, limits[1])) return;
} else {
if (data.psa.version != Blockbench.version) return;
}
}
addStartScreenSection(data.psa)
})()
}

})
documentReady.then(() => {
Blockbench.startup_count = parseInt(localStorage.getItem('startups')||0)

Expand All @@ -295,6 +271,20 @@ onVueSetup(function() {
if (settings.streamer_mode.value) {
updateStreamerModeNotification()
}
addStartScreenSection('splash_screen', {
"text_color": '#000000',
"graphic": {
"type": "image",
"source": "./assets/splash_art.png?42",
"width": 1000,
"aspect_ratio": "21/9",
"description": "Splash Art by [Shroomy](https://twitter.com/ShroomyArts) and [RedstoneMvv](https://twitter.com/Redstone_mvv)",
"text_color": '#cfcfcf'
}
})
if (!Blockbench.hasFlag('after_update')) {
document.getElementById('start_screen').scrollTop = 100;
}

//Twitter
let twitter_ad;
Expand Down Expand Up @@ -330,7 +320,6 @@ onVueSetup(function() {

let section = Interface.createElement('section', {id: 'quick_setup'});
$('#start_screen content').prepend(section);
console.log(section)

new Vue({
data() {return {
Expand Down Expand Up @@ -416,4 +405,36 @@ onVueSetup(function() {
}).$mount(section);
}
})
Promise.all([news_call, documentReady]).then((data) => {
if (!data || !data[0]) return;
data = data[0];

//Update Screen
if (Blockbench.hasFlag('after_update') && data.new_version) {
data.new_version.insert_after = 'splash_screen'
addStartScreenSection('new_version', data.new_version);
jQuery.ajax({
url: 'https://blckbn.ch/api/event/successful_update',
type: 'POST',
data: {
version: Blockbench.version
}
})
}
if (data.psa) {
(function() {
if (typeof data.psa.version == 'string') {
if (data.psa.version.includes('-')) {
limits = data.psa.version.split('-');
if (limits[0] && compareVersions(limits[0], Blockbench.version)) return;
if (limits[1] && compareVersions(Blockbench.version, limits[1])) return;
} else {
if (data.psa.version != Blockbench.version) return;
}
}
addStartScreenSection(data.psa)
})()
}

})
})()

0 comments on commit e845e68

Please sign in to comment.