(() => {
const queryString = window.location.search;
const parameters = new URLSearchParams(queryString);
function WaitDefinition(variable, updateInterval){
return new Promise((res, rej) => {
let interval = setInterval(()=>{
if (variable != undefined){
res(variable);
clearInterval(interval);
}
}, updateInterval);
})
}
const AssetsPage = {
GetRequest : (url) => {
return new Promise((resolve, reject)=>{
fetch(url, {
method: "GET",
mode: 'cors'
}).then(res=>{
if (res.status >= 200 && res.status <= 299)
res.text().then(res2 => {resolve(res2);})
else
reject(new Error());
}).catch(err => reject(err));
})
},
JSONPostRequest : (url, body) => {
return new Promise((resolve, reject)=>{
fetch(url, {
method: "POST",
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(body),
mode: 'cors'
}).then(res=>{
if (res.status >= 200 && res.status <= 299)
res.json().then(res2 => {resolve(res2);})
else
reject(new Error());
}).catch(err => reject(err));
})
},
SearchStore : (body) => {
return AssetsPage.JSONPostRequest("https://dapp.isotopic.io/api/v1/assets/search", body);
},
GetThumbnailSrcURL : (asset_id) => `https://dapp.isotopic.io/api/v1/assets/files/${asset_id}/thumbnail`,
GetAssetCategories : () => new Promise((res, rej) => {
AssetsPage.GetRequest(`https://dapp.isotopic.io/api/v1/assets/categories`).then(categoriesResText => {res(JSON.parse(categoriesResText)); }).catch(err => rej(err));
}),
}
AssetsPage.SearchStoreFeaturedPromise = AssetsPage.SearchStore({limit: 20}).catch(err => {throw err;});
AssetsPage.SearchCrossGamePromise = AssetsPage.SearchStore({limit: 4, special:"cross_game_support"}).catch(err => {throw err;});
AssetsPage.SearchModelCategoryPromise = AssetsPage.SearchStore({limit: 4, category:3}).catch(err => {throw err;});
AssetsPage.GetCategoriesPromise = AssetsPage.GetAssetCategories().catch(err => {throw err;});
let storesidebarRes = AssetsPage.GetRequest("https://dapp.isotopic.io/asset-store/sidebar").catch(err => {throw err});
$(document).ready(async ()=> {
const mainViewDiv = $("#games-window-target");
const storeSidebar = $("#store-sidebar");
const featuredDiv = $("#featured-target");
const grid2 = $("#grid-2");
const recentAssets = $("#top-games-slideshow");
const AssetCategoriesDict = await AssetsPage.GetCategoriesPromise;
let swiperBanner1Content = [
{img: "https://dapp.isotopic.io/media/banner-top/isotopic-sdk-banner-2.png", url: "https://isotopic.io/sdk", btn_text: "Learn More", title:"Isotopic SDK", content: "Integrate Cross-Game items in your game with the Isotopic SDK!"},
{img: "https://dapp.isotopic.io/api/v1/assets/files/Ship_Nyk_Apollo_FBX/page_images/?index=1", url: "https://isotopic.io/asset/?asset=Ship_Nyk_Apollo_FBX", btn_text: "Go to Asset", title:"Nyk Apollo FBX", content: "This is a realistic model of a real ship that is traveling the seas! Shaded, optimized, and ready for all your needs as an FBX model!"},
{img: "https://dapp.isotopic.io/api/v1/assets/files/Ancient_Mythology_Bird/page_images/?index=2", url: "https://isotopic.io/asset/?asset=Ancient_Mythology_Bird", btn_text: "Go to Asset", title: "Ancient Mythology Bird", content: "This is a stymphalida, from the ancient legend of Hercules. They are feisty and attack you on sight, be careful!"},
{img: "https://dapp.isotopic.io/api/v1/assets/files/Ford_F150_Raptor/page_images/?index=2", url: "https://isotopic.io/asset/?asset=Ford_F150_Raptor", btn_text: "Go to Asset", title: "Ford F150 Raptor", content: "One of if not the first thought that come to any truck-lover's mind when they think about trucks! We took that thought, and made it into a realistic 3D model."},
{img: "https://dapp.isotopic.io/api/v1/assets/files/Centaur_3D_Model/page_images/?index=1", url: "https://isotopic.io/asset/?asset=Centaur_3D_Model", btn_text: "Go to Asset", title: "Centaur FBX", content: "This is a 3D FBX model for Centaur, the ancient mythological creature that's half human and half horse. Dressed in war armor and comes with an axe. Shaded, un-rigged."}
];
let article1ImgSrc = "https://dapp.isotopic.io/media/discord.png";
let article1Title = "Discord";
let article1Text = "Join us on our discord server! Meet the community, share your development progress and stay up to date with our latest news!";
let article1URL = "https://discord.gg/zZqNycn6FJ";
let article2ImgSrc = "https://dapp.isotopic.io/media/nrg_panel.png";
let article2Title = "Partnership";
let article2Text = "Isotopic is now partnered with NRG CORE, to bring special features to our combined users!";
let article2URL = "https://nrgcore.com/";
let article3ImgSrc = "https://dapp.isotopic.io/media/igc_2/WINNER_123_IGC2.jpg";
let article3Title = "Game Competition";
let article3Text = " Check out the winners!";
let article3URL = "https://isotopic.io/isotopic-game-competition-2-results/";
let article4ImgSrc = "https://dapp.isotopic.io/media/OneClick-Publisher-isotopic.jpg";
let article4Title = "One Click Publish from Unity";
let article4Text = "We just released our unity package that allows you to easily upload your new build to the Isotopic Store, directly from within the Unity Editor!";
let article4URL = "https://isotopic.io/announcing-one-click-publishing-through-unity-editor/";
const GetGrid2Item = (asset) => {
let priceStr = "";
if(asset.price==0){
priceStr="FREE";
}else{
priceStr=asset.price + " $";
}
/* ****** discount check needed*/
let discountStr=``;
if(asset.discount!=null && asset.discount!=0 ){
discountStr = `
`;
}
return `
`
}
const GetAssetItem = (asset) => {
let priceStr = "";
if(asset.price==0){
priceStr="FREE";
}else{
priceStr=asset.price + " $";
}
/* ****** discount check needed*/
let discountStr=``;
if(asset.discount!=null && asset.discount!=0 ){
discountStr = ``;
}
return `
`
}
const GetAssetItemWithInfo = (asset) => {
let priceStr = "";
if(asset.price==0){
priceStr="FREE";
}else{
priceStr=asset.price + " $";
}
/* ****** discount check needed*/
let discountStr=``;
if(asset.discount!=null && asset.discount!=0 ){
discountStr = ``;
}
return `
`
}
const SetTopBanner = async() => {
console.log("SetTopBanner");
grid2.append(`
Isotopic Asset Store
Welcome to Isotopic Asset store where you can sell, buy or exchange assets for your games!
`)}
/*swiper*/
const SetSwiperMain = async() => {
console.log("setSwiper");
console.log("SetStoreMenu");
categories = await AssetsPage.GetCategoriesPromise;
grid2.append(`
`)
grid2.append(`
`);
const swiperBannerDiv = $("#swiper-banner-div");
for(let i=0; i
`);
}
mainViewDiv.append(`
`)
}
/*recent assets*/
const SetRecentAssets = async()=>{
categories = await AssetsPage.GetCategoriesPromise;
grid2.append(`
`);
/*GRID 2 - FEATURED LOAD ITEMS*/
let parent = $(".assets-recent-container")
let all_assets = (await AssetsPage.SearchStoreFeaturedPromise).results;
let featured_assets = all_assets.slice(0,6);
featured_assets.forEach(asset => {
$(GetGrid2Item(asset)).appendTo(parent);
})
}
/*recent assets*/
const SetCrossGameAssets = async()=>{
categories = await AssetsPage.GetCategoriesPromise;
grid2.append(`
Your assets everywhere
Use your assets across all the games in your library. Be a part of a unique personalized experience.
View All
`);
/*CROSS GAME ASSETS*/
let parent = $("#cross-game-assets-holder")
let featured_assets = (await AssetsPage.SearchCrossGamePromise).results;
// *********** uncoment on release
/* featured_assets.forEach(asset => {
// Execute your first function
$(GetAssetItem(asset)).appendTo(parent);
}); */
/* ************** remove on release*/
if (featured_assets.length < 4) {
// Execute a function for each item in the array
featured_assets.forEach(asset => {
// Execute your first function
$(GetAssetItem(asset)).appendTo(parent);
});
// Execute another function for the remaining items needed to reach 4
const remainingItemsCount = 4 - featured_assets.length;
for (let i = 0; i < remainingItemsCount; i++) {
// Execute your second function
$(GetAssetItem(featured_assets[0])).appendTo(parent);;
}
} else {
// If the array already has 4 or more items, just loop through and execute your first function
featured_assets.forEach(asset => {
// Execute your first function
$(GetAssetItem(asset)).appendTo(parent);
});
}
}
//3D models
const SetModelsAssets = async()=>{
categories = await AssetsPage.GetCategoriesPromise;
grid2.append(`
enrich your game
Find the most exciting 3D models to use in your games.
View All
`);
/*CROSS GAME ASSETS*/
let parent = $("#models-assets")
let featured_assets = (await AssetsPage.SearchModelCategoryPromise).results;
// *********** uncoment on release
/* featured_assets.forEach(asset => {
// Execute your first function
$(GetAssetItem(asset)).appendTo(parent);
}); */
/* *********** remove on release*/
if (featured_assets.length < 4) {
// Execute a function for each item in the array
featured_assets.forEach(asset => {
// Execute your first function
$(GetAssetItem(asset)).appendTo(parent);
});
// Execute another function for the remaining items needed to reach 4
const remainingItemsCount = 4 - featured_assets.length;
for (let i = 0; i < remainingItemsCount; i++) {
// Execute your second function
$(GetAssetItem(featured_assets[i])).appendTo(parent);;
}
} else {
// If the array already has 4 or more items, just loop through and execute your first function
featured_assets.forEach(asset => {
// Execute your first function
$(GetAssetItem(asset)).appendTo(parent);
});
}
}
//3D models
const SetPopularAssets = async()=>{
categories = await AssetsPage.GetCategoriesPromise;
grid2.append(`
Your assets everywhere
Use your assets across all the games in your library. Be a part of a unique personalized experience.
`);
/*CROSS GAME ASSETS*/
let parent = $("#popular-assets-holder")
let featured_assets = (await AssetsPage.SearchStoreFeaturedPromise).results.sort(() => Math.random() - 0.5);;
// *********** uncoment on release
/* featured_assets.forEach(asset => {
// Execute your first function
$(GetAssetItem(asset)).appendTo(parent);
}); */
/* ************** remove on release*/
if (featured_assets.length < 8) {
// Execute a function for each item in the array
featured_assets.forEach(asset => {
// Execute your first function
$(GetAssetItemWithInfo(asset)).appendTo(parent);
});
// Execute another function for the remaining items needed to reach 4
const remainingItemsCount = 8 - featured_assets.length;
for (let i = 0; i < remainingItemsCount; i++) {
// Execute your second function
$(GetAssetItemWithInfo(featured_assets[i])).appendTo(parent);;
}
} else {
// If the array already has 4 or more items, just loop through and execute your first function
featured_assets.forEach(asset => {
// Execute your first function
$(GetAssetItemWithInfo(asset)).appendTo(parent);
});
}
$(``).appendTo(parent);
}
//banner
const SetBottomBanner= async()=>{
categories = await AssetsPage.GetCategoriesPromise;
grid2.append(`
Create your own experiece
Create, share, download and use assets from our library in your games for the unheard-of customized experience.
`);
}
const SetSidebar = async () => {
const sidebarElement = $('#store-sidebar');
let htmlString = await storesidebarRes;
sidebarElement.html(htmlString);
}
const SetNewsBottom = async () => {
recentAssets.append(`
`);
}
//wp override
const cssRuleHeaderUnderline = '.edgtf-main-menu > ul > li > a::after { background-color: var(--assetstore-main) !important; }';
// Append the CSS rule to the head of the document
$('