[Splash] Contest section is now general news section.

This commit is contained in:
Tanasart 2024-09-27 11:17:37 +07:00
parent cb6ab49aa6
commit 044c4df265
24 changed files with 333 additions and 194 deletions

View file

@ -1791,7 +1791,6 @@
{"name":"s_button_bottom_right","order":1,"path":"sprites/s_button_bottom_right/s_button_bottom_right.yy",}, {"name":"s_button_bottom_right","order":1,"path":"sprites/s_button_bottom_right/s_button_bottom_right.yy",},
{"name":"s_button_hide_circle_28","order":2,"path":"sprites/s_button_hide_circle_28/s_button_hide_circle_28.yy",}, {"name":"s_button_hide_circle_28","order":2,"path":"sprites/s_button_hide_circle_28/s_button_hide_circle_28.yy",},
{"name":"s_button_hide_fill","order":3,"path":"sprites/s_button_hide_fill/s_button_hide_fill.yy",}, {"name":"s_button_hide_fill","order":3,"path":"sprites/s_button_hide_fill/s_button_hide_fill.yy",},
{"name":"s_button_hide_fill1036","order":157,"path":"sprites/s_button_hide_fill1036/s_button_hide_fill1036.yy",},
{"name":"s_button_hide_left","order":4,"path":"sprites/s_button_hide_left/s_button_hide_left.yy",}, {"name":"s_button_hide_left","order":4,"path":"sprites/s_button_hide_left/s_button_hide_left.yy",},
{"name":"s_button_hide_middle","order":5,"path":"sprites/s_button_hide_middle/s_button_hide_middle.yy",}, {"name":"s_button_hide_middle","order":5,"path":"sprites/s_button_hide_middle/s_button_hide_middle.yy",},
{"name":"s_button_hide_right","order":6,"path":"sprites/s_button_hide_right/s_button_hide_right.yy",}, {"name":"s_button_hide_right","order":6,"path":"sprites/s_button_hide_right/s_button_hide_right.yy",},
@ -1903,6 +1902,7 @@
{"name":"s_gear_16","order":230,"path":"sprites/s_gear_16/s_gear_16.yy",}, {"name":"s_gear_16","order":230,"path":"sprites/s_gear_16/s_gear_16.yy",},
{"name":"s_gear_24","order":69,"path":"sprites/s_gear_24/s_gear_24.yy",}, {"name":"s_gear_24","order":69,"path":"sprites/s_gear_24/s_gear_24.yy",},
{"name":"s_gizmo","order":4,"path":"sprites/s_gizmo/s_gizmo.yy",}, {"name":"s_gizmo","order":4,"path":"sprites/s_gizmo/s_gizmo.yy",},
{"name":"s_globe","order":233,"path":"sprites/s_globe/s_globe.yy",},
{"name":"s_grad_blend","order":70,"path":"sprites/s_grad_blend/s_grad_blend.yy",}, {"name":"s_grad_blend","order":70,"path":"sprites/s_grad_blend/s_grad_blend.yy",},
{"name":"s_gradient_mask","order":12,"path":"sprites/s_gradient_mask/s_gradient_mask.yy",}, {"name":"s_gradient_mask","order":12,"path":"sprites/s_gradient_mask/s_gradient_mask.yy",},
{"name":"s_graph","order":71,"path":"sprites/s_graph/s_graph.yy",}, {"name":"s_graph","order":71,"path":"sprites/s_graph/s_graph.yy",},

View file

@ -2497,7 +2497,6 @@
{"id":{"name":"s_button_bottom_right","path":"sprites/s_button_bottom_right/s_button_bottom_right.yy",},}, {"id":{"name":"s_button_bottom_right","path":"sprites/s_button_bottom_right/s_button_bottom_right.yy",},},
{"id":{"name":"s_button_hide_circle_28","path":"sprites/s_button_hide_circle_28/s_button_hide_circle_28.yy",},}, {"id":{"name":"s_button_hide_circle_28","path":"sprites/s_button_hide_circle_28/s_button_hide_circle_28.yy",},},
{"id":{"name":"s_button_hide_fill","path":"sprites/s_button_hide_fill/s_button_hide_fill.yy",},}, {"id":{"name":"s_button_hide_fill","path":"sprites/s_button_hide_fill/s_button_hide_fill.yy",},},
{"id":{"name":"s_button_hide_fill1036","path":"sprites/s_button_hide_fill1036/s_button_hide_fill1036.yy",},},
{"id":{"name":"s_button_hide_left","path":"sprites/s_button_hide_left/s_button_hide_left.yy",},}, {"id":{"name":"s_button_hide_left","path":"sprites/s_button_hide_left/s_button_hide_left.yy",},},
{"id":{"name":"s_button_hide_middle","path":"sprites/s_button_hide_middle/s_button_hide_middle.yy",},}, {"id":{"name":"s_button_hide_middle","path":"sprites/s_button_hide_middle/s_button_hide_middle.yy",},},
{"id":{"name":"s_button_hide_right","path":"sprites/s_button_hide_right/s_button_hide_right.yy",},}, {"id":{"name":"s_button_hide_right","path":"sprites/s_button_hide_right/s_button_hide_right.yy",},},
@ -2612,6 +2611,7 @@
{"id":{"name":"s_gear_16","path":"sprites/s_gear_16/s_gear_16.yy",},}, {"id":{"name":"s_gear_16","path":"sprites/s_gear_16/s_gear_16.yy",},},
{"id":{"name":"s_gear_24","path":"sprites/s_gear_24/s_gear_24.yy",},}, {"id":{"name":"s_gear_24","path":"sprites/s_gear_24/s_gear_24.yy",},},
{"id":{"name":"s_gizmo","path":"sprites/s_gizmo/s_gizmo.yy",},}, {"id":{"name":"s_gizmo","path":"sprites/s_gizmo/s_gizmo.yy",},},
{"id":{"name":"s_globe","path":"sprites/s_globe/s_globe.yy",},},
{"id":{"name":"s_grad_blend","path":"sprites/s_grad_blend/s_grad_blend.yy",},}, {"id":{"name":"s_grad_blend","path":"sprites/s_grad_blend/s_grad_blend.yy",},},
{"id":{"name":"s_gradient_mask","path":"sprites/s_gradient_mask/s_gradient_mask.yy",},}, {"id":{"name":"s_gradient_mask","path":"sprites/s_gradient_mask/s_gradient_mask.yy",},},
{"id":{"name":"s_graph","path":"sprites/s_graph/s_graph.yy",},}, {"id":{"name":"s_graph","path":"sprites/s_graph/s_graph.yy",},},

Binary file not shown.

View file

@ -69,10 +69,10 @@ event_inherited();
if(node_menu_selecting == noone) return; if(node_menu_selecting == noone) return;
var _node = node_menu_selecting.node; var _node = node_menu_selecting.node;
if(!is_array(global.FAV_NODES)) global.FAV_NODES = []; if(struct_exists(global.FAV_NODES, _node)) struct_remove(global.FAV_NODES, _node);
else global.FAV_NODES[$ _node] = 1;
if(array_exists(global.FAV_NODES, _node)) array_remove(global.FAV_NODES, _node); PREF_SAVE();
else array_push(global.FAV_NODES, _node);
} }
registerFunction("Add Node", "Trigger Favourite", "", MOD_KEY.none, trigger_favourite); registerFunction("Add Node", "Trigger Favourite", "", MOD_KEY.none, trigger_favourite);
@ -81,7 +81,7 @@ event_inherited();
if(!is_instanceof(node, NodeObject)) return; if(!is_instanceof(node, NodeObject)) return;
node_menu_selecting = node; node_menu_selecting = node;
var fav = array_exists(global.FAV_NODES, node.node); var fav = struct_exists(global.FAV_NODES, node.node);
var menu = [ var menu = [
menuItem(fav? __txtx("add_node_remove_favourite", "Remove from favourite") : __txtx("add_node_add_favourite", "Add to favourite"), trigger_favourite, THEME.star) menuItem(fav? __txtx("add_node_remove_favourite", "Remove from favourite") : __txtx("add_node_add_favourite", "Add to favourite"), trigger_favourite, THEME.star)
]; ];
@ -429,9 +429,9 @@ event_inherited();
} }
ds_list_add(_list, "Favourites"); ds_list_add(_list, "Favourites");
if(is_array(global.FAV_NODES)) var _favs = struct_get_names(global.FAV_NODES);
for( var i = 0, n = array_length(global.FAV_NODES); i < n; i++ ) { for( var i = 0, n = array_length(_favs); i < n; i++ ) {
var _nodeIndex = global.FAV_NODES[i]; var _nodeIndex = _favs[i];
if(!ds_map_exists(ALL_NODES, _nodeIndex)) continue; if(!ds_map_exists(ALL_NODES, _nodeIndex)) continue;
var _node = ALL_NODES[? _nodeIndex]; var _node = ALL_NODES[? _nodeIndex];

View file

@ -7,9 +7,9 @@ event_inherited();
dialog_w = ui(960); dialog_w = ui(960);
dialog_h = ui(600); dialog_h = ui(600);
pages = ["Welcome Files"]; pages = ["News", "Welcome Files"];
if(STEAM_ENABLED) array_push(pages, "Workshop"); if(STEAM_ENABLED) array_push(pages, "Workshop");
project_page = 0; project_page = 1;
thumbnail_retriever = 0; thumbnail_retriever = 0;
recent_thumbnail = false; recent_thumbnail = false;
@ -21,21 +21,6 @@ event_inherited();
#endregion #endregion
#region content #region content
function resize() {
var x0 = dialog_x + ui(16);
var x1 = x0 + recent_width;
var y0 = dialog_y + ui(48);
var y1 = dialog_y + dialog_h - ui(16);
sp_recent.resize(x1 - x0 - ui(12), y1 - y0);
x0 = x1 + ui(16);
x1 = dialog_x + dialog_w - ui(16);
sp_sample.resize( x1 - x0 - ui(12), y1 - y0 - 1);
sp_contest.resize(x1 - x0 - ui(12), y1 - y0 - 2);
}
var x0 = dialog_x + ui(16); var x0 = dialog_x + ui(16);
var x1 = x0 + recent_width; var x1 = x0 + recent_width;
var y0 = dialog_y + ui(128); var y0 = dialog_y + ui(128);
@ -381,10 +366,8 @@ event_inherited();
contest_req = noone; contest_req = noone;
contest_message_req = []; contest_message_req = [];
if(os_is_network_connected()) { // if(os_is_network_connected())
var url = "https://discord.com/api/v10/guilds/953634069646835773/threads/active"; // contest_req = http_request("https://discord.com/api/v10/guilds/953634069646835773/threads/active", "GET", discord_map, "");
contest_req = http_request(url, "GET", discord_map, "");
}
nicknames = ds_map_create(); nicknames = ds_map_create();
attachment = ds_map_create(); attachment = ds_map_create();
@ -397,18 +380,19 @@ event_inherited();
contest_viewing = noone; contest_viewing = noone;
sp_contest = new scrollPane(x1 - x0 - ui(12), y1 - y0 - 2, function(_y, _m) { sp_contest = new scrollPane(x1 - x0 - ui(12), y1 - y0 - 2, function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 0); draw_clear_alpha(COLORS.panel_bg_clear, 1);
var hh = 0; var hh = 0;
var sww = sp_contest.surface_w;
if(contest_viewing == noone) { if(contest_viewing == noone) {
var amo = array_length(contests); var amo = array_length(contests);
var bx = sp_contest.surface_w / 2; var bx = sww / 2;
var sy = ui(16); var sy = ui(16);
var spr_w = sprite_get_width(s_contest_banner); var spr_w = sprite_get_width(s_contest_banner);
var spr_h = sprite_get_height(s_contest_banner); var spr_h = sprite_get_height(s_contest_banner);
var ss = (sp_contest.surface_w - 40) / spr_w; var ss = (sww - 40) / spr_w;
draw_sprite_ext(s_contest_banner, 0, bx, _y + sy, ss, ss, 0, c_white, 1); draw_sprite_ext(s_contest_banner, 0, bx, _y + sy, ss, ss, 0, c_white, 1);
@ -430,7 +414,7 @@ event_inherited();
var grid_width = ui(276); var grid_width = ui(276);
var grid_space = ui(20); var grid_space = ui(20);
var grid_hspac = ui(40); var grid_hspac = ui(40);
var col = floor(sp_contest.surface_w / (grid_width + grid_space)); var col = floor(sww / (grid_width + grid_space));
grid_surface = surface_verify(grid_surface, grid_width, grid_heigh); grid_surface = surface_verify(grid_surface, grid_width, grid_heigh);
@ -527,7 +511,7 @@ event_inherited();
var ty = _y + ui(68); var ty = _y + ui(68);
hh = ui(68); hh = ui(68);
var tw = sp_contest.surface_w - ui(16); var tw = sww - ui(16);
var th = 0; var th = 0;
var pad = ui(12); var pad = ui(12);
@ -551,17 +535,17 @@ event_inherited();
txt_y += string_height_ext(con_title.content, -1, tw - pad * 2) + pad; txt_y += string_height_ext(con_title.content, -1, tw - pad * 2) + pad;
if(sprite_exists(con_thumb)) if(sprite_exists(con_thumb))
draw_sprite_ext(con_thumb, 0, sp_contest.surface_w / 2, txt_y + spr_h / 2, ss, ss, 0, c_white, 1); draw_sprite_ext(con_thumb, 0, sww / 2, txt_y + spr_h / 2, ss, ss, 0, c_white, 1);
hh += th + pad; hh += th + pad;
var submissions = contest_viewing.messages; var submissions = contest_viewing.messages;
var amo = 0, col = 0; var amo = 0, col = 0;
var grid_space = ui(20); var grid_space = ui(20);
var grid_width = (sp_contest.surface_w - grid_space - ui(16)) / 2; var grid_width = (sww - grid_space - ui(16)) / 2;
var _yy = txt_y + spr_h + pad * 2; var _yy = txt_y + spr_h + pad * 2;
var cx = sp_contest.surface_w / 2; var cx = sww / 2;
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub); draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub);
draw_text(cx, _yy + ui(8), __txt("Submissions")); draw_text(cx, _yy + ui(8), __txt("Submissions"));
var txt_w = string_width(__txt("Submissions")); var txt_w = string_width(__txt("Submissions"));
@ -631,9 +615,9 @@ event_inherited();
//banner //banner
banner_alpha = lerp_float(banner_alpha, _y < 0, 3); banner_alpha = lerp_float(banner_alpha, _y < 0, 3);
draw_sprite_stretched_ext(THEME.shadow_drop_down_24, 0, 0, ui(56), sp_contest.surface_w, ui(20), c_white, banner_alpha); draw_sprite_stretched_ext(THEME.shadow_drop_down_24, 0, 0, ui(56), sww, ui(20), c_white, banner_alpha);
draw_set_color(COLORS.panel_bg_clear); draw_set_color(COLORS.panel_bg_clear);
draw_rectangle(0, 0, sp_contest.surface_w, ui(64), false); draw_rectangle(0, 0, sww, ui(64), false);
draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text); draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text);
draw_text_add(ui(32 + 8), ui(8 + 4), con_name); draw_text_add(ui(32 + 8), ui(8 + 4), con_name);
@ -642,10 +626,10 @@ event_inherited();
draw_text_add(ui(32 + 8), ui(8 + 30), __txt("By") + " " + con_author); draw_text_add(ui(32 + 8), ui(8 + 30), __txt("By") + " " + con_author);
draw_set_text(f_p0b, fa_right, fa_top, COLORS._main_text_accent); draw_set_text(f_p0b, fa_right, fa_top, COLORS._main_text_accent);
draw_text_add(sp_contest.surface_w - ui(44), ui(8 + 8), amo); draw_text_add(sww - ui(44), ui(8 + 8), amo);
draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub); draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub);
draw_text_add(sp_contest.surface_w - ui(44), ui(8 + 28), __txt("Submissions")); draw_text_add(sww - ui(44), ui(8 + 28), __txt("Submissions"));
if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], ui(20 - 16), ui(36 - 16), ui(20 + 16), ui(36 + 16))) { if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], ui(20 - 16), ui(36 - 16), ui(20 + 16), ui(36 + 16))) {
sp_contest.hover_content = true; sp_contest.hover_content = true;
@ -655,7 +639,7 @@ event_inherited();
} else } else
draw_sprite_ui(THEME.arrow_back_32, 0, ui(20), ui(36),,,, COLORS._main_icon); draw_sprite_ui(THEME.arrow_back_32, 0, ui(20), ui(36),,,, COLORS._main_icon);
var bx = sp_contest.surface_w - ui(20); var bx = sww - ui(20);
var by = ui(36); var by = ui(36);
if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], bx - ui(16), by - ui(16), bx + ui(16), by + ui(16))) { if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], bx - ui(16), by - ui(16), bx + ui(16), by + ui(16))) {
@ -672,4 +656,63 @@ event_inherited();
return hh; return hh;
}); });
sp_contest.always_scroll = false; sp_contest.always_scroll = false;
#endregion #endregion
#region news
news_requests = {};
news_content = [];
news_req = "";
if(os_is_network_connected())
news_req = http_get($"https://gist.githubusercontent.com/Ttanasart-pt/ae0701295a897a3f61f43a9af07b430b/raw/pxc_info");
sp_news = new scrollPane(x1 - x0 - ui(12), y1 - y0 - 2, function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 1);
var hh = ui(16);
var ww = sp_news.surface_w;
for (var i = 0, n = array_length(news_content); i < n; i++) {
var _inf = news_content[i];
if(!sprite_exists(_inf.img)) continue;
var _sw = sprite_get_width(_inf.img);
var _sh = sprite_get_height(_inf.img);
var _hg = _sh;
var _sx = ww / 2 - _sw / 2;
var _sy = ui(16) + _y;
draw_sprite(_inf.img, 0, _sx, _sy);
if(_inf.link != "" && sp_news.hover && point_in_rectangle(_m[0], _m[1], _sx, _sy, _sx + _sw, _sy + _sh)) {
draw_sprite_stretched_add(THEME.node_bg, 1, _sx, _sy, _sw, _sh, COLORS._main_icon, .4);
TOOLTIP = _inf.tooltip;
if(mouse_press(mb_left, sp_news.active))
url_open(_inf.link);
}
hh += _hg + ui(8);
_y += _hg + ui(8);
}
return hh;
});
#endregion
function resize() {
var x0 = dialog_x + ui(16);
var x1 = x0 + recent_width;
var y0 = dialog_y + ui(128);
var y1 = dialog_y + dialog_h - ui(16);
sp_recent.resize(x1 - x0 - ui(12), y1 - y0);
x0 = x1 + ui(16);
x1 = dialog_x + dialog_w - ui(16);
sp_sample.resize( x1 - x0 - ui(12), y1 - y0 - 1);
sp_contest.resize(x1 - x0 - ui(12), y1 - y0 - 2);
sp_news.resize( x1 - x0 - ui(12), y1 - y0 - 1);
}

View file

@ -87,21 +87,27 @@ if !ready exit;
var tab_cover = noone; var tab_cover = noone;
var th = ui(36) + THEME_VALUE.panel_tab_extend; var th = ui(36) + THEME_VALUE.panel_tab_extend;
for( var i = 0, n = array_length(pages); i < n; i++ ) { #region for( var i = 0, n = array_length(pages); i < n; i++ ) {
draw_set_text(f_p0, fa_left, fa_bottom, project_page == i? COLORS._main_text : COLORS._main_text_sub); draw_set_text(f_p0, fa_left, fa_bottom, project_page == i? COLORS._main_text : COLORS._main_text_sub);
var txt = pages[i]; var txt = pages[i];
var dtxt = __txt(txt); var dtxt = __txt(txt);
var amo = 0; var amo = 0;
var tw = ui(16) + string_width(dtxt);
switch(txt) { switch(txt) {
case "Welcome Files" : break; case "Workshop" :
case "Workshop" : amo = ds_list_size(STEAM_PROJECTS); break; amo = ds_list_size(STEAM_PROJECTS);
case "Contests" : dtxt = ""; break; break;
case "Contests" :
case "News" :
dtxt = "";
tw = ui(32 + 8);
amo = 0;
break;
} }
var tw = ui(16) + string_width(dtxt);
if(amo) tw += ui(8) + string_width(amo) + ui(6); if(amo) tw += ui(8) + string_width(amo) + ui(6);
if(txt == "Contests") tw = ui(32 + 8);
var _x1 = min(bx + tw, x1); var _x1 = min(bx + tw, x1);
var _tabW = _x1 - bx; var _tabW = _x1 - bx;
@ -127,13 +133,24 @@ if !ready exit;
draw_sprite_stretched_ext(THEME.ui_panel_tab, 0, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab_inactive, 1); draw_sprite_stretched_ext(THEME.ui_panel_tab, 0, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab_inactive, 1);
var _btx = bx + ui(8); var _btx = bx + ui(8);
if(txt == "Contests") { var cc = COLORS._main_text_sub;
if(project_page == i) cc = COLORS._main_text;
switch(txt) {
case "Contests" :
if(project_page == i) cc = CDEF.yellow;
draw_sprite_ui(THEME.trophy, 0, _btx + ui(12), y0 - ui(14),,,, COLORS._main_icon); draw_sprite_ui(THEME.trophy, 0, _btx + ui(12), y0 - ui(14),,,, COLORS._main_icon);
_btx += ui(32); _btx += ui(32);
} break;
var cc = COLORS._main_text_sub; case "News" :
if(project_page == i) cc = txt == "Contests"? CDEF.yellow : COLORS._main_text; if(project_page == i) cc = CDEF.cyan;
draw_sprite_ui(THEME.globe, 0, _btx + ui(12), y0 - ui(16),,,, COLORS._main_icon);
_btx += ui(32);
break;
}
draw_set_color(cc); draw_set_color(cc);
draw_text_cut(_btx, y0 - ui(4), dtxt, _tabW - ui(16)); draw_text_cut(_btx, y0 - ui(4), dtxt, _tabW - ui(16));
@ -154,7 +171,7 @@ if !ready exit;
} }
bx += _tabW; bx += _tabW;
} #endregion }
draw_sprite_stretched(THEME.ui_panel_bg, 0, x0, y0, x1 - x0, y1 - y0); draw_sprite_stretched(THEME.ui_panel_bg, 0, x0, y0, x1 - x0, y1 - y0);
draw_sprite_stretched_ext(THEME.ui_panel, 1, x0, y0, x1 - x0, y1 - y0, COLORS.panel_frame); draw_sprite_stretched_ext(THEME.ui_panel, 1, x0, y0, x1 - x0, y1 - y0, COLORS.panel_frame);
@ -186,6 +203,11 @@ if !ready exit;
sp_contest.setFocusHover(sFOCUS, sHOVER); sp_contest.setFocusHover(sFOCUS, sHOVER);
sp_contest.draw(x0 + ui(6), y0 + 1); sp_contest.draw(x0 + ui(6), y0 + 1);
break; break;
case "News" :
sp_news.setFocusHover(sFOCUS, sHOVER);
sp_news.draw(x0 + ui(6), y0 + 1);
break;
} }
if(expandAction) { if(expandAction) {

View file

@ -1,5 +1,7 @@
/// @description /// @description
if(async_load[? "id"] == contest_req) { //get contests var _id = async_load[? "id"];
if(_id == contest_req) {
var r_str = async_load[? "result"]; var r_str = async_load[? "result"];
if(is_undefined(r_str)) exit; if(is_undefined(r_str)) exit;
@ -8,7 +10,6 @@ if(async_load[? "id"] == contest_req) { //get contests
if(struct_has(thr_str, "threads")) { if(struct_has(thr_str, "threads")) {
var thrs = thr_str.threads; var thrs = thr_str.threads;
for( var i = 0, n = array_length(thrs); i < n; i++ ) { for( var i = 0, n = array_length(thrs); i < n; i++ ) {
var thr = thrs[i]; var thr = thrs[i];
if(thr.parent_id != "1113080578351312906") continue; //not in contest channel if(thr.parent_id != "1113080578351312906") continue; //not in contest channel
@ -30,6 +31,47 @@ if(async_load[? "id"] == contest_req) { //get contests
exit; exit;
} }
if(_id == news_req) {
var r_str = async_load[? "result"];
if(is_undefined(r_str)) exit;
var thr_str = json_try_parse(r_str, noone);
if(!is_array(thr_str)) exit;
for (var i = 0, n = array_length(thr_str); i < n; i++) {
var _inf = thr_str[i];
_inf.img = noone;
if(_inf.img_url != "") {
var _fil = $"{DIRECTORY}Cache/{_inf.header}.png";
if(file_exists_empty(_fil)) {
_inf.img = sprite_add(_fil, 0, false, false, 0, 0);
} else {
var _rid = http_get_file(_inf.img_url, _fil);
news_requests[$ _rid] = _inf;
}
}
news_content[i] = _inf;
}
exit;
}
if(struct_has(news_requests, _id)) {
var _status = ds_map_find_value(async_load, "status");
if (_status != 0) exit;
var _path = ds_map_find_value(async_load, "result");
var _inf = news_requests[$ _id];
if(file_exists_empty(_path))
_inf.img = sprite_add(_path, 0, false, false, 0, 0);
exit;
}
for( var i = 0, n = array_length(contest_message_req); i < n; i++ ) { for( var i = 0, n = array_length(contest_message_req); i < n; i++ ) {
if(async_load[? "id"] != contest_message_req[i][0]) continue; if(async_load[? "id"] != contest_message_req[i][0]) continue;

View file

@ -45,6 +45,7 @@
PREFERENCES_DIR = $"{DIRECTORY}Preferences/{PREF_VERSION}/"; PREFERENCES_DIR = $"{DIRECTORY}Preferences/{PREF_VERSION}/";
directory_verify(DIRECTORY); directory_verify(DIRECTORY);
directory_verify($"{DIRECTORY}Cache");
APP_LOCATION = program_directory; APP_LOCATION = program_directory;
if(OS == os_macosx) APP_LOCATION = string_replace(APP_LOCATION, "/Contents/MacOS/", "/Contents/Resources/"); if(OS == os_macosx) APP_LOCATION = string_replace(APP_LOCATION, "/Contents/MacOS/", "/Contents/Resources/");

View file

@ -136,7 +136,7 @@ function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constr
draw_sprite_ui_uniform(THEME.node_deprecated_badge, 1, _x + grid_size - ui(12), _y + ui(6)); draw_sprite_ui_uniform(THEME.node_deprecated_badge, 1, _x + grid_size - ui(12), _y + ui(6));
} }
var fav = array_exists(global.FAV_NODES, node); var fav = struct_exists(global.FAV_NODES, node);
if(fav) draw_sprite_ui_uniform(THEME.star, 0, _x + grid_size - ui(10), _y + grid_size - ui(10), 0.7, COLORS._main_accent, 1.); if(fav) draw_sprite_ui_uniform(THEME.star, 0, _x + grid_size - ui(10), _y + grid_size - ui(10), 0.7, COLORS._main_accent, 1.);
var spr_x = _x + grid_size - 4; var spr_x = _x + grid_size - 4;
@ -158,7 +158,7 @@ function NodeObject(_name, _spr, _node, _create, tooltip = "", tags = []) constr
} }
static drawList = function(_x, _y, _mx, _my, list_height, _param = {}) { static drawList = function(_x, _y, _mx, _my, list_height, _param = {}) {
var fav = array_exists(global.FAV_NODES, node); var fav = struct_exists(global.FAV_NODES, node);
if(fav) draw_sprite_ui_uniform(THEME.star, 0, ui(32), _y + list_height / 2, 0.7, COLORS._main_accent, 1.); if(fav) draw_sprite_ui_uniform(THEME.star, 0, ui(32), _y + list_height / 2, 0.7, COLORS._main_accent, 1.);
var spr_x = list_height / 2 + ui(44); var spr_x = list_height / 2 + ui(44);
@ -280,11 +280,15 @@ function addNodePCXCatagory( name, list, filter = []) { ds_list_a
function __initNodes() { function __initNodes() {
global.__currPage = ""; global.__currPage = "";
global.__startPage = 0; global.__startPage = 0;
global.FAV_NODES = {};
if(!IS_CMD) { if(!IS_CMD) {
var favPath = DIRECTORY + "Nodes/fav.json"; var favPath = DIRECTORY + "Nodes/fav.json";
global.FAV_NODES = file_exists_empty(favPath)? json_load_struct(favPath) : []; if(file_exists_empty(favPath)) {
if(!is_array(global.FAV_NODES)) global.FAV_NODES = []; var favs = json_load_struct(favPath);
for (var i = 0, n = array_length(favs); i < n; i++)
global.FAV_NODES[$ favs[i]] = 1;
}
var recPath = DIRECTORY + "Nodes/recent.json"; var recPath = DIRECTORY + "Nodes/recent.json";
global.RECENT_NODES = file_exists_empty(recPath)? json_load_struct(recPath) : []; global.RECENT_NODES = file_exists_empty(recPath)? json_load_struct(recPath) : [];

View file

@ -282,6 +282,8 @@ function Panel_Collection() : PanelContent() constructor {
grid_size = ui(48); grid_size = ui(48);
grid_size_to = grid_size; grid_size_to = grid_size;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
contentView = 0; contentView = 0;
contentPane = new scrollPane(content_w - ui(8), content_h - ui(4), function(_y, _m) { contentPane = new scrollPane(content_w - ui(8), content_h - ui(4), function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear_inner, 1); draw_clear_alpha(COLORS.panel_bg_clear_inner, 1);
@ -525,8 +527,33 @@ function Panel_Collection() : PanelContent() constructor {
return hh + ui(28); return hh + ui(28);
}); });
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
nodeListPane_page = 0; nodeListPane_page = 0;
node_temp_list = ds_list_create(); node_temp_list = ds_list_create();
node_menu_selecting = noone;
function trigger_favourite() {
if(node_menu_selecting == noone) return;
var _node = node_menu_selecting.node;
if(struct_exists(global.FAV_NODES, _node)) struct_remove(global.FAV_NODES, _node);
else global.FAV_NODES[$ _node] = 1;
PREF_SAVE();
}
function rightClickNode(node) {
if(!is_instanceof(node, NodeObject)) return;
node_menu_selecting = node;
var fav = struct_exists(global.FAV_NODES, node.node);
var menu = [
menuItem(fav? __txtx("add_node_remove_favourite", "Remove from favourite") : __txtx("add_node_add_favourite", "Add to favourite"), trigger_favourite, THEME.star)
];
menuCall("add_node_window_menu", menu, 0, 0, fa_left);
}
nodeListPane = new scrollPane(group_w - ui(8), content_h, function(_y, _m) { nodeListPane = new scrollPane(group_w - ui(8), content_h, function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 1); draw_clear_alpha(COLORS.panel_bg_clear, 1);
@ -578,8 +605,9 @@ function Panel_Collection() : PanelContent() constructor {
} else if(nodeListPane_page == 0) { } else if(nodeListPane_page == 0) {
ds_list_clear(node_temp_list); ds_list_clear(node_temp_list);
for( var i = 0, n = array_length(global.FAV_NODES); i < n; i++ ) { var _favs = struct_get_names(global.FAV_NODES);
var _nodeIndex = global.FAV_NODES[i]; for( var i = 0, n = array_length(_favs); i < n; i++ ) {
var _nodeIndex = _favs[i];
if(!ds_map_exists(ALL_NODES, _nodeIndex)) continue; if(!ds_map_exists(ALL_NODES, _nodeIndex)) continue;
var _node = ALL_NODES[? _nodeIndex]; var _node = ALL_NODES[? _nodeIndex];
@ -633,17 +661,23 @@ function Panel_Collection() : PanelContent() constructor {
nodecontentPane.hover_content = true; nodecontentPane.hover_content = true;
draw_sprite_stretched_ext(THEME.node_bg, 1, _boxx, yy, grid_size, grid_size, COLORS._main_accent, 1); draw_sprite_stretched_ext(THEME.node_bg, 1, _boxx, yy, grid_size, grid_size, COLORS._main_accent, 1);
if(mouse_press(mb_left, pFOCUS)) if(pFOCUS) {
DRAGGING = { type : "Node", data : _node }; if(mouse_press(mb_left)) DRAGGING = { type : "Node", data : _node };
if(mouse_press(mb_right)) rightClickNode(_node);
}
} }
var ss = grid_size / 80; var ss = grid_size / 96;
var sx = _boxx + grid_size / 2; var sx = _boxx + grid_size / 2;
var sy = yy + grid_size / 2; var sy = yy + grid_size / 2;
BLEND_ALPHA_MULP BLEND_ALPHA_MULP
draw_sprite_ext(_node.spr, 0, sx, sy, ss, ss, 0, c_white, 1); draw_sprite_ext(_node.spr, 0, sx, sy, ss, ss, 0, c_white, 1);
BLEND_NORMAL BLEND_NORMAL
var fav = struct_exists(global.FAV_NODES, _node.node);
if(fav) draw_sprite_ui_uniform(THEME.star, 0, _boxx + grid_size - ui(8), yy + grid_size - ui(8), 0.7, COLORS._main_accent, 1.);
} }
draw_set_text(font, fa_center, fa_top, COLORS._main_text_inner); draw_set_text(font, fa_center, fa_top, COLORS._main_text_inner);
@ -672,6 +706,8 @@ function Panel_Collection() : PanelContent() constructor {
return hh + ui(16); return hh + ui(16);
}); });
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function setPage(i) { function setPage(i) {
page = i; page = i;
root = roots[i][1]; root = roots[i][1];
@ -827,6 +863,7 @@ function Panel_Collection() : PanelContent() constructor {
bx -= ui(36); bx -= ui(36);
} }
if(pageStr[page] != "Nodes") {
if(bx < rootx) return; if(bx < rootx) return;
var txt = __txtx("panel_collection_open_file", "Open in file explorer"); var txt = __txtx("panel_collection_open_file", "Open in file explorer");
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.path_open) == 2) if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.path_open) == 2)
@ -847,5 +884,6 @@ function Panel_Collection() : PanelContent() constructor {
bx -= ui(36); bx -= ui(36);
} }
}
} }

View file

@ -300,7 +300,7 @@
json_save_struct(PREFERENCES_DIR + "keys.json", PREFERENCES); json_save_struct(PREFERENCES_DIR + "keys.json", PREFERENCES);
json_save_struct(PREFERENCES_DIR + "default_project.json", PROJECT_ATTRIBUTES); json_save_struct(PREFERENCES_DIR + "default_project.json", PROJECT_ATTRIBUTES);
json_save_struct(DIRECTORY + "Nodes/fav.json", global.FAV_NODES); json_save_struct(DIRECTORY + "Nodes/fav.json", variable_struct_get_names(global.FAV_NODES));
json_save_struct(DIRECTORY + "Nodes/recent.json", global.RECENT_NODES); json_save_struct(DIRECTORY + "Nodes/recent.json", global.RECENT_NODES);
hotkey_serialize(); hotkey_serialize();

View file

@ -71,6 +71,7 @@ function Theme() constructor {
frame_range = s_frame_range; frame_range = s_frame_range;
gear = s_gear_24; gear = s_gear_24;
gear_16 = s_gear_16; gear_16 = s_gear_16;
globe = s_globe;
grad_blend = s_grad_blend; grad_blend = s_grad_blend;
group_s = s_group_16; group_s = s_group_16;
group = s_group_24; group = s_group_24;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

View file

@ -1,102 +0,0 @@
{
"$GMSprite":"",
"%Name":"s_button_hide_fill1036",
"bboxMode":0,
"bbox_bottom":15,
"bbox_left":0,
"bbox_right":15,
"bbox_top":0,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"0ef1a201-f57f-4f98-98b7-b19a9a608adc","name":"0ef1a201-f57f-4f98-98b7-b19a9a608adc","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"5688387c-9024-482f-9971-dc16f8ce5fd3","name":"5688387c-9024-482f-9971-dc16f8ce5fd3","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"ac0c1c09-fbcc-4af4-b14a-6ddf0696067a","name":"ac0c1c09-fbcc-4af4-b14a-6ddf0696067a","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"f76e4112-fdd6-4676-9437-710933bfbe79","name":"f76e4112-fdd6-4676-9437-710933bfbe79","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":16,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"4492851e-5d39-4b4b-91a5-93e0fb081b8a","blendMode":0,"displayName":"default","isLocked":false,"name":"4492851e-5d39-4b4b-91a5-93e0fb081b8a","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_button_hide_fill1036",
"nineSlice":null,
"origin":4,
"parent":{
"name":"PixelComposer",
"path":"PixelComposer.yyp",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_button_hide_fill1036",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":4.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_button_hide_fill1036",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"0ef1a201-f57f-4f98-98b7-b19a9a608adc","path":"sprites/s_button_hide_fill1036/s_button_hide_fill1036.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"c32726ca-ac72-4885-9850-648c728fb23c","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"5688387c-9024-482f-9971-dc16f8ce5fd3","path":"sprites/s_button_hide_fill1036/s_button_hide_fill1036.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"55271735-c898-4dee-99e4-3385d6594418","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"ac0c1c09-fbcc-4af4-b14a-6ddf0696067a","path":"sprites/s_button_hide_fill1036/s_button_hide_fill1036.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"33eecd76-2385-48c1-86b5-02f0abdc75c3","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"f76e4112-fdd6-4676-9437-710933bfbe79","path":"sprites/s_button_hide_fill1036/s_button_hide_fill1036.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"34d4cc92-766a-4258-bdef-063340b21a42","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,
"volume":1.0,
"xorigin":8,
"yorigin":8,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":16,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_globe",
"bboxMode":0,
"bbox_bottom":20,
"bbox_left":3,
"bbox_right":20,
"bbox_top":3,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"2530a638-aa0d-4114-828e-bb9a0c7630af","name":"2530a638-aa0d-4114-828e-bb9a0c7630af","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":24,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"c0a36aa8-c732-4c3b-abd0-8f23f0143b8e","blendMode":0,"displayName":"default","isLocked":false,"name":"c0a36aa8-c732-4c3b-abd0-8f23f0143b8e","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_globe",
"nineSlice":null,
"origin":4,
"parent":{
"name":"icon",
"path":"folders/theme/icon.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_globe",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":1.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_globe",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"2530a638-aa0d-4114-828e-bb9a0c7630af","path":"sprites/s_globe/s_globe.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"5f92d7c1-b40a-483f-b629-b5750c0046aa","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,
"volume":1.0,
"xorigin":12,
"yorigin":12,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":24,
}