patreon manual verification

This commit is contained in:
Tanasart 2024-11-20 15:05:51 +07:00
parent 814b37dc6d
commit ee49f67414
47 changed files with 847 additions and 211 deletions

View file

@ -451,6 +451,7 @@
{"name":"BBMOD_Vec3","order":5,"path":"scripts/BBMOD_Vec3/BBMOD_Vec3.yy",},
{"name":"BBMOD_Vec4","order":6,"path":"scripts/BBMOD_Vec4/BBMOD_Vec4.yy",},
{"name":"bin_function","order":11,"path":"scripts/bin_function/bin_function.yy",},
{"name":"binder_gamemaker_room","order":2,"path":"scripts/binder_gamemaker_room/binder_gamemaker_room.yy",},
{"name":"biterator","order":1,"path":"scripts/biterator/biterator.yy",},
{"name":"buffer_object","order":1,"path":"scripts/buffer_object/buffer_object.yy",},
{"name":"buttonAnchor","order":5,"path":"scripts/buttonAnchor/buttonAnchor.yy",},
@ -709,6 +710,7 @@
{"name":"meta_data","order":12,"path":"scripts/meta_data/meta_data.yy",},
{"name":"mouse_input","order":1,"path":"scripts/mouse_input/mouse_input.yy",},
{"name":"mtl_reader","order":6,"path":"scripts/mtl_reader/mtl_reader.yy",},
{"name":"network_data","order":22,"path":"scripts/network_data/network_data.yy",},
{"name":"node_3d_camera_set","order":1,"path":"scripts/node_3d_camera_set/node_3d_camera_set.yy",},
{"name":"node_3d_displace","order":8,"path":"scripts/node_3d_displace/node_3d_displace.yy",},
{"name":"node_3d_instancer","order":3,"path":"scripts/node_3d_instancer/node_3d_instancer.yy",},
@ -1996,6 +1998,8 @@
{"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_globe","order":233,"path":"sprites/s_globe/s_globe.yy",},
{"name":"s_gmlayer","order":4,"path":"sprites/s_gmlayer/s_gmlayer.yy",},
{"name":"s_gmroom","order":3,"path":"sprites/s_gmroom/s_gmroom.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_graph","order":71,"path":"sprites/s_graph/s_graph.yy",},

View file

@ -953,6 +953,7 @@
{"id":{"name":"BBMOD_Vec3","path":"scripts/BBMOD_Vec3/BBMOD_Vec3.yy",},},
{"id":{"name":"BBMOD_Vec4","path":"scripts/BBMOD_Vec4/BBMOD_Vec4.yy",},},
{"id":{"name":"bin_function","path":"scripts/bin_function/bin_function.yy",},},
{"id":{"name":"binder_gamemaker_room","path":"scripts/binder_gamemaker_room/binder_gamemaker_room.yy",},},
{"id":{"name":"binder_gamemaker","path":"scripts/binder_gamemaker/binder_gamemaker.yy",},},
{"id":{"name":"biterator","path":"scripts/biterator/biterator.yy",},},
{"id":{"name":"blurSurface","path":"scripts/blurSurface/blurSurface.yy",},},
@ -1255,6 +1256,7 @@
{"id":{"name":"migration_function","path":"scripts/migration_function/migration_function.yy",},},
{"id":{"name":"mouse_input","path":"scripts/mouse_input/mouse_input.yy",},},
{"id":{"name":"mtl_reader","path":"scripts/mtl_reader/mtl_reader.yy",},},
{"id":{"name":"network_data","path":"scripts/network_data/network_data.yy",},},
{"id":{"name":"node_2d_light","path":"scripts/node_2d_light/node_2d_light.yy",},},
{"id":{"name":"node_3d_camera_set","path":"scripts/node_3d_camera_set/node_3d_camera_set.yy",},},
{"id":{"name":"node_3d_camera","path":"scripts/node_3d_camera/node_3d_camera.yy",},},
@ -2721,6 +2723,8 @@
{"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_globe","path":"sprites/s_globe/s_globe.yy",},},
{"id":{"name":"s_gmlayer","path":"sprites/s_gmlayer/s_gmlayer.yy",},},
{"id":{"name":"s_gmroom","path":"sprites/s_gmroom/s_gmroom.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_graph","path":"sprites/s_graph/s_graph.yy",},},

View file

@ -1,42 +1,37 @@
/// @description
#region base
var pal = DEF_PALETTE;
var col = min(array_length(pal), 8);
var row = ceil(array_length(pal) / col);
var pal = DEF_PALETTE;
var col = min(array_length(pal), 8);
var row = ceil(array_length(pal) / col);
var ss = ui(24);
var ww = ui(16) + ss * col;
var hh = ui(16) + ss * row;
var x0 = min(x, WIN_W - ww);
var y0 = min(y, WIN_H - hh);
var x1 = x0 + ww;
var y1 = y0 + hh;
draw_sprite_stretched(THEME.dialog, 0, x0 - ui(8), y0 - ui(8), ww + ui(8) * 2, hh + ui(8) * 2);
for( var i = 0, n = array_length(pal); i < n; i++ ) {
var r = floor(i / col);
var c = i % col;
var ss = ui(24);
var ww = ui(16) + ss * col;
var hh = ui(16) + ss * row;
var _x = x0 + ui(8) + c * ss;
var _y = y0 + ui(8) + r * ss;
var x0 = min(x, WIN_W - ww);
var y0 = min(y, WIN_H - hh);
draw_sprite_stretched_ext(THEME.s_box_r2, 0, _x + 1, _y + 1, ss - 2, ss - 2, pal[i]);
var x1 = x0 + ww;
var y1 = y0 + hh;
draw_sprite_stretched(THEME.dialog, 0, x0 - ui(8), y0 - ui(8), ww + ui(8) * 2, hh + ui(8) * 2);
for( var i = 0, n = array_length(pal); i < n; i++ ) {
var r = floor(i / col);
var c = i % col;
if(point_in_rectangle(mouse_mx, mouse_my, _x, _y, _x + ss - 1, _y + ss - 1)) {
draw_sprite_stretched_add(THEME.s_box_r2, 1, _x + 1, _y + 1, ss - 2, ss - 2, c_white, 0.3);
var _x = x0 + ui(8) + c * ss;
var _y = y0 + ui(8) + r * ss;
draw_set_color(pal[i]);
draw_rectangle(_x + 2, _y + 2, _x + ss - 2, _y + ss - 2, false);
if(point_in_rectangle(mouse_mx, mouse_my, _x, _y, _x + ss - 1, _y + ss - 1)) {
draw_set_color(c_white);
draw_rectangle_border(_x + 2, _y + 2, _x + ss - 2, _y + ss - 2, 2);
if(selecting != i) {
if(onApply) onApply(pal[i]);
}
selecting = i;
}
if(selecting != i && onApply) onApply(pal[i]);
selecting = i;
}
if(mouse_release(mb_left))
instance_destroy();
#endregion
}
if(mouse_release(mb_left))
instance_destroy();

View file

@ -3,7 +3,7 @@ event_inherited();
#region data
dialog_w = ui(480);
dialog_h = ui(200);
dialog_h = ui(240);
title_height = ui(28);
destroy_on_click_out = false;
@ -13,29 +13,62 @@ event_inherited();
req_member = {};
access_token = "";
page = 0;
status = 0;
tb_code = new textBox(TEXTBOX_INPUT.text, function(t) /*=>*/ { submit_code(t); });
if(IS_PATREON) {
txt = "Patreon verified, thank you for supporting Pixel Composer!";
server = 0;
dialog_h += ui(40);
} else {
txt = "Sign-in to Patreon on browser";
var attmp = 0;
do {
port = irandom_range(7000, 20000);
server = network_create_server_raw(network_socket_ws, port, 32);
} until(server >= 0 || attmp++ >= 100);
if(!os_is_network_connected()) {
status = -1;
txt = "No internet connection, please try again.";
} else {
txt = "Sign-in to Patreon on browser";
var attmp = 0;
do {
port = irandom_range(7000, 20000);
server = network_create_server_raw(network_socket_ws, port, 32);
} until(server >= 0 || attmp++ >= 100);
if(server >= 0) {
var _url = "www.patreon.com/oauth2/authorize";
_url += "?response_type=code";
_url += "&client_id=oZ1PNvUY61uH0FiA7ZPMBy77Xau3Ok9tfvsT_Y8DQwyKeMNjaVC35r1qsK09QJhY";
_url += "&redirect_uri=https://pixel-composer.com/verify";
_url += "&scope=identity campaigns.members";
_url += "&state=" + string(port);
url_open(_url);
} else {
status = -1;
txt = "Cannot connect to Patreon, please try again.";
}
}
}
function submit_code(code) {
code = string_trim(code);
var _url = @"www.patreon.com/oauth2/authorize";
var _header = ds_map_create();
_header[? "User-Agent"] = "pixelcomposer";
_header[? "Content-Type"] = "application/x-www-form-urlencoded";
var _content = $"code={code}";
_content += $"&grant_type=authorization_code";
_content += $"&client_id=oZ1PNvUY61uH0FiA7ZPMBy77Xau3Ok9tfvsT_Y8DQwyKeMNjaVC35r1qsK09QJhY";
_content += $"&client_secret=winWb1rAgSGUn9JBXxCjWqIb7EYkfYWO9j4nK_Stmg4W_wtKbdE30ckqvcwcCn2o";
_content += $"&redirect_uri=https://pixel-composer.com/verify";
_url += "?response_type=code";
_url += "&client_id=oZ1PNvUY61uH0FiA7ZPMBy77Xau3Ok9tfvsT_Y8DQwyKeMNjaVC35r1qsK09QJhY";
_url += "&redirect_uri=https://pixel-composer.com/verify";
_url += "&scope=identity campaigns.members";
_url += $"&state={port}";
url_open(_url);
req_patreon = http_request("https://www.patreon.com/api/oauth2/token", "POST", _header, _content);
ds_map_destroy(_header);
page = 1;
}
#endregion

View file

@ -27,14 +27,14 @@ if !ready exit;
draw_sprite(s_patreon_banner, 0, cx, yy);
var _bw = ui(100);
var _bh = ui(32);
var _bx = cx - _bw / 2;
var _by = dialog_y + dialog_h - ui(16 + 32);
var _ty = yy + ui(120);
if(IS_PATREON) {
var _bw = ui(100);
var _bh = ui(32);
var _bx = cx - _bw / 2;
var _by = dialog_y + dialog_h - ui(16 + 32);
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_value_positive);
draw_text(cx, _ty, txt);
@ -52,5 +52,18 @@ if !ready exit;
} else {
draw_set_text(f_p1, fa_center, fa_center, status == 0? COLORS._main_text : COLORS._main_value_negative);
draw_text(cx, _ty, txt);
var _tw = dialog_w - ui(32);
var _th = TEXTBOX_HEIGHT + ui(4);
var _tx = cx - _tw / 2;
var _ty = dialog_y + dialog_h - ui(16) - _th;
if(page == 0) {
tb_code.setFocusHover(sFOCUS, sHOVER);
tb_code.draw(_tx, _ty, _tw, _th, "");
} else if(status == 0) {
draw_sprite_ext(THEME.loading_s, 0, cx, _ty + _th / 2, 1, 1, current_time, COLORS._main_icon, 1);
}
}
#endregion

View file

@ -156,6 +156,7 @@
asyncInit();
network_set_config(network_config_use_non_blocking_socket, 0);
if(!os_is_network_connected()) array_push(NETWORK_LOG, new notification(NOTI_TYPE.internal, $"Network offline"));
#endregion
#region steam

View file

@ -1,5 +1,5 @@
/// @description network
var _id = async_load[? "id"];
var _id = async_load[? "id"];
if(ds_map_exists(global.FILE_LOAD_ASYNC, async_load[? "id"])) {
var cb = global.FILE_LOAD_ASYNC[? async_load[? "id"]];

View file

@ -1,5 +1,9 @@
/// @description
var _id = async_load[? "id"];
var _nid = $"net_{struct_names_count(NETWORK_LOG_DATA)}";
NETWORK_LOG_DATA[$ _nid] = ds_map_print(async_load);
array_push(NETWORK_LOG, new notification(NOTI_TYPE.internal, $"Received network event {_nid}"));
if(_id == TCP_SERVER) {
var t = async_load[? "type"];

View file

@ -5,14 +5,16 @@ function Binder_Gamemaker(path) {
return new __Binder_Gamemaker(path);
}
function GMSprite(_gm, _path, _info) constructor {
function GMObject(_gm, _path, _info) constructor {
gmBinder = _gm;
path = $"{_gm.dir}/{_path}";
key = _path;
raw = _info;
type = _info.resourceType;
thumbnail = noone;
}
function GMSprite(_gm, _path, _info) : GMObject(_gm, _path, _info) constructor {
var _dirr = filename_dir(path);
var _frame = raw.frames;
var _layers = raw.layers;
@ -27,27 +29,10 @@ function GMSprite(_gm, _path, _info) constructor {
}
}
function GMTileset(_gm, _path, _info) constructor {
gmBinder = _gm;
path = $"{_gm.dir}/{_path}";
key = _path;
raw = _info;
type = _info.resourceType;
thumbnail = noone;
function GMTileset(_gm, _path, _info) : GMObject(_gm, _path, _info) constructor {
sprite = raw.spriteId.path;
}
function GMRoom(_gm, _path, _info) constructor {
gmBinder = _gm;
path = $"{_gm.dir}/{_path}";
key = _path;
raw = _info;
type = _info.resourceType;
thumbnail = noone;
}
function __Binder_Gamemaker(path) constructor {
self.path = path;
name = filename_name_only(path);

View file

@ -0,0 +1,56 @@
function GMRoom(_gm, _path, _info) : GMObject(_gm, _path, _info) constructor {
layers = GMRoom_create_layers(raw.layers);
}
function GMRoom_create_layers(layers) {
var _l = [];
for( var i = 0, n = array_length(layers); i < n; i++ ) {
var _dat = layers[i];
switch(_dat.resourceType) {
case "GMRBackgroundLayer" : _l[i] = new GMRoom_Background(_dat); break;
case "GMRTileLayer" : _l[i] = new GMRoom_Tile(_dat); break;
case "GMRInstanceLayer" : _l[i] = new GMRoom_Instance(_dat); break;
case "GMRPathLayer" : _l[i] = new GMRoom_Path(_dat); break;
case "GMRAssetLayer" : _l[i] = new GMRoom_Asset(_dat); break;
case "GMREffectLayer" : _l[i] = new GMRoom_Effect(_dat); break;
default : _l[i] = new GMRoom_Layer(_dat); break;
}
}
return _l;
}
function GMRoom_Layer(_raw) constructor {
name = _raw.name;
visible = _raw.visible;
depth = _raw.depth;
layers = GMRoom_create_layers(_raw.layers);
index = 6;
}
function GMRoom_Background(_raw) : GMRoom_Layer(_raw) constructor {
index = 0;
x = _raw.x;
y = _raw.y;
colour = _raw.colour;
}
function GMRoom_Tile(_raw) : GMRoom_Layer(_raw) constructor {
index = 1;
x = _raw.x;
y = _raw.y;
tiles = _raw.tiles;
tilesetId = _raw.tilesetId;
}
function GMRoom_Instance(_raw) : GMRoom_Layer(_raw) constructor { index = 2; }
function GMRoom_Path(_raw) : GMRoom_Layer(_raw) constructor { index = 3; }
function GMRoom_Asset(_raw) : GMRoom_Layer(_raw) constructor { index = 4; }
function GMRoom_Effect(_raw) : GMRoom_Layer(_raw) constructor { index = 5; }

View file

@ -0,0 +1,13 @@
{
"$GMScript":"v1",
"%Name":"binder_gamemaker_room",
"isCompatibility":false,
"isDnD":false,
"name":"binder_gamemaker_room",
"parent":{
"name":"binder",
"path":"folders/main/binder.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -11,24 +11,36 @@ CMD_COLOR = {
BOLD : "\033[1m",
}
function cmd_error_param(command) {
var _txt = $"[Error] `{command}` not enough argument.";
array_push(CMD, cmdLine(_txt, COLORS._main_value_negative) );
log_console(_txt, true);
}
function cmd_submit(command) {
if(command == "") return;
if(command == "") return noone;
array_push(CMD, cmdLineIn(command));
array_push(CMDIN, command);
var cmd = string_splice(command, " ", false, false);
var cmd_type = cmd[0];
cmd_type = string_trim(cmd_type);
var raw = string_splice(command, " ", false, false);
var opt = [];
var cmd = [];
for( var i = 0, n = array_length(raw); i < n; i++ ) {
var _c = string_trim(raw[i]);
if(string_starts_with(_c, "-"))
array_push(opt, _c);
else
array_push(cmd, _c);
}
var cmd_type = cmd[0];
switch(cmd_type) {
case "f":
case "flag":
if(array_length(cmd) < 2) {
var _txt = $"[Error] `flag` not enough argument.";
array_push(CMD, cmdLine(_txt, COLORS._main_value_negative) );
log_console(_txt, true);
break;
}
if(array_length(cmd) < 2) { cmd_error_param(cmd_type); break; }
var flg = cmd[1];
global.FLAG[$ flg] = !global.FLAG[$ flg];
@ -37,14 +49,8 @@ function cmd_submit(command) {
log_console(_txt, true);
break;
case "s":
case "set":
if(array_length(cmd) < 3) {
var _txt = $"[Error] `set` not enough argument.";
array_push(CMD, cmdLine(_txt, COLORS._main_value_negative) );
log_console(_txt, true);
break;
}
if(array_length(cmd) < 3) { cmd_error_param(cmd_type); break; }
var key = string_trim(cmd[1]);
var val = string_trim(cmd[2]);
@ -73,18 +79,45 @@ function cmd_submit(command) {
log_console(_txt, true);
break;
case "r":
case "render":
PROGRAM_ARGUMENTS._run = true;
PROGRAM_ARGUMENTS._rendering = true;
CLI_EXPORT_AMOUNT = 0;
break;
case "x":
case "exit":
game_end();
break;
case "print":
if(array_length(cmd) < 2) { cmd_error_param(cmd_type); break; }
print(cmd[1]);
break;
case "netlog":
if(array_length(cmd) == 1) {
for( var i = 0, n = array_length(NETWORK_LOG); i < n; i++ ) {
var _log = NETWORK_LOG[i];
print($"{_log.time} - {_log.txt}");
}
} else if(array_length(cmd) == 2) {
var _key = cmd[1];
if(!struct_has(NETWORK_LOG_DATA, _key)) {
array_push(CMD, cmdLine($"[Error] netdat `{_key}` not found", COLORS._main_value_negative) );
break;
}
print(NETWORK_LOG_DATA[$ _key]);
}
break;
case "patreon":
if(array_length(cmd) < 2) { cmd_error_param(cmd_type); break; }
var _leg = array_exists(opt, "-l");
if(_leg) return new cmd_program_patreon_legacy(cmd[1]);
break;
default:
if(struct_has(CMD_FUNCTIONS, cmd[0])) {
var _f = CMD_FUNCTIONS[$ cmd[0]];
@ -112,6 +145,8 @@ function cmd_submit(command) {
log_console(_txt, true);
break;
}
return noone;
}
function cmd_path(path) {
@ -142,4 +177,13 @@ function cmd_path(path) {
}
return vals;
}
function cmd_program() constructor {
title = "cmd";
color = CDEF.main_dkgrey;
static close = function() { CMDPRG = noone; }
static submit = function(arg) { return 0; }
}

View file

@ -58,9 +58,20 @@ function ds_map_print(map) {
var k = ds_map_find_first(map);
repeat(ds_map_size(map)) {
txt += string(k) + " : " + string(map[? k]) + ", ";
txt += $"{k} : {map[? k]}, ";
k = ds_map_find_next(map, k);
}
txt += "}";
return txt;
}
function ds_map_to_struct(map) {
var _s = {};
var k = ds_map_find_first(map);
repeat(ds_map_size(map)) {
_s[$ k] = map[? k];
k = ds_map_find_next(map, k);
}
return _s;
}

View file

@ -11,6 +11,7 @@ function filepath_resolve(path) {
path = string_replace_all(path, "%DIR%/", DIRECTORY);
path = string_replace_all(path, "%APP%/", APP_LOCATION);
path = string_replace_all(path, "\\", "/");
if(PROJECT) path = string_replace_all(path, "./", filename_dir(PROJECT.path) + "/");
return path;
}

View file

@ -21,7 +21,7 @@
#region ======================================================================= MAIN =======================================================================
globalvar OS, DEBUG, THEME, COLOR_KEYS, RUN_IDE;
globalvar CMD, CMDIN;
globalvar CMD, CMDIN, CMDPRG;
globalvar FPS_REAL;
#macro MAC (OS == os_macosx)
@ -29,6 +29,8 @@
OS = os_type;
CMD = [];
CMDIN = [];
CMDPRG = noone;
FPS_REAL = 0;
RUN_IDE = GM_build_type == "run";
@ -42,8 +44,8 @@
LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_04_0;
SAVE_VERSION = 1_18_02_0;
VERSION_STRING = MAC? "1.18.003m" : "1.18.4";
BUILD_NUMBER = 1_18_03_1;
VERSION_STRING = MAC? "1.18.003m" : "1.18.4b";
BUILD_NUMBER = 1_18_04_1;
HOTKEYS = ds_map_create();
HOTKEY_CONTEXT = ds_list_create();

View file

@ -0,0 +1,39 @@
globalvar NETWORK_LOG, NETWORK_LOG_DATA;
NETWORK_LOG = [];
NETWORK_LOG_DATA = {};
#macro network_create_socket Network_create_socket
#macro __network_create_socket network_create_socket
function Network_create_socket(type) {
var c = __network_create_socket(type);
array_push(NETWORK_LOG, new notification(NOTI_TYPE.internal, $"Created socket {c} of type {type}"));
return c;
}
#macro network_create_server_raw Network_create_server_raw
#macro __network_create_server_raw network_create_server_raw
function Network_create_server_raw(type, port, max_client) {
var s = __network_create_server_raw(type, port, max_client);
array_push(NETWORK_LOG, new notification(NOTI_TYPE.internal, $"Created server {s} of type {type} at port {port} (mclient {max_client})"));
return s;
}
#macro network_destroy Network_destroy
#macro __network_destroy network_destroy
function Network_destroy(server) {
__network_destroy(server);
array_push(NETWORK_LOG, new notification(NOTI_TYPE.internal, $"Destroy server {server}"));
}
#macro url_open URL_open
#macro __url_open url_open
function URL_open(url) {
__url_open(url);
array_push(NETWORK_LOG, new notification(NOTI_TYPE.internal, $"Open {url}"));
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"v1",
"%Name":"network_data",
"isCompatibility":false,
"isDnD":false,
"name":"network_data",
"parent":{
"name":"components",
"path":"folders/main/components.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -1,3 +1,88 @@
function Script1257(){
function Node_GMRoom(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "GMRoom";
color = COLORS.node_blend_input;
gmRoom = noone;
attributes.exposed_layer = [];
layer_selecting = noone;
layers_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
if(gmRoom == noone) {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, ui(28), COLORS.node_composite_bg_blend, 1);
draw_set_text(f_p3, fa_center, fa_center, COLORS._main_text_sub);
draw_text_add(_x + _w / 2, _y + ui(14), "No data");
return ui(28);
}
var _amo = array_length(gmRoom.layers);
var hh = ui(28);
var _h = hh * _amo + ui(16);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _h, COLORS.node_composite_bg_blend, 1);
for( var i = 0, n = array_length(gmRoom.layers); i < n; i++ ) {
var _bx = _x + ui(24);
var _yy = _y + ui(8) + i * hh;
var _layer = gmRoom.layers[i];
var cc = layer_selecting == _layer? COLORS._main_text_accent : COLORS._main_text_sub;
if(_hover && point_in_rectangle(_m[0], _m[1], _x, _yy, _x + _w, _yy + hh - 1)) {
cc = COLORS._main_text;
if(mouse_press(mb_left, _focus))
layer_selecting = layer_selecting == _layer? noone : _layer;
}
draw_sprite_ui_uniform(s_gmlayer, _layer.index, _bx, _yy + hh / 2, 1, cc);
draw_set_text(f_p2, fa_left, fa_center, cc);
draw_text_add(_bx + ui(20), _yy + hh / 2, _layer.name);
}
return _h;
});
layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
if(layer_selecting == noone) {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, ui(28), COLORS.node_composite_bg_blend, 1);
return ui(28);
}
var _h = ui(64);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _h, COLORS.node_composite_bg_blend, 1);
return _h;
});
input_display_list = [
layers_renderer,
new Inspector_Spacer(ui(4)),
layer_renderer,
];
static step = function() {
}
static update = function() {
}
static attributeSerialize = function() {
var _attr = {
gm_key: gmRoom == noone? noone : gmRoom.key,
};
return _attr;
}
static attributeDeserialize = function(attr) {
if(struct_has(attr, "gm_key")) {
var _key = attr.gm_key;
var _gm = project.bind_gamemaker;
if(_gm != noone) gmRoom = struct_try_get(_gm.resourcesMap, _ey, noone);
}
}
}

View file

@ -563,6 +563,9 @@ function __initNodes() {
addNodeObject(input, "Spout Sender", s_node_spout, "Node_Spout_Send", [1, Node_Spout_Send],, "Send surface through Spout.").setVersion(11600);
addNodeObject(input, "MIDI In", s_node_midi, "Node_MIDI_In", [1, Node_MIDI_In],, "Receive MIDI message.").setVersion(11630).notTest();
addNodeObject(input, "HTTP", s_node_http, "Node_HTTP_request", [1, Node_HTTP_request],, "Request data from the internet.").setVersion(11780);
ds_list_add(input, "Gamemaker");
addNodeObject(input, "GMRoom", s_gmroom, "Node_GMRoom", [1, Node_GMRoom]).setVersion(1_18_04_1);
#endregion
#region transform
@ -847,6 +850,7 @@ function __initNodes() {
addNodeObject(generator, "MK Fracture", s_node_mk_fracture, "Node_MK_Fracture", [1, Node_MK_Fracture],, "Deterministically fracture and image and apply basic physics.").patreonExtra();
addNodeObject(generator, "MK Sparkle", s_node_mk_sparkle, "Node_MK_Sparkle", [1, Node_MK_Sparkle],, "Generate random star animation.").patreonExtra();
addNodeObject(generator, "MK Subpixel", s_node_mk_subpixel, "Node_MK_Subpixel", [1, Node_MK_Subpixel],, "Apply subpixel filter on top of a surface.").setVersion(1_17_11_0);
#endregion
#region compose
var compose = ds_list_create();
@ -1284,5 +1288,4 @@ function __initNodes() {
addNodeObject(hid, "getHeight", s_node_pixel_builder, "Node_DynaSurf_Out_Height", [1, Node_DynaSurf_Out_Height]).hideRecent();
#endregion
// NODE LIST
}

View file

@ -4,9 +4,17 @@ function __NodeValue_Path(_name, _node, _value, _tooltip = "") : NodeValue(_name
/////============== GET =============
static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) {
return is_string(value)? filepath_resolve(value) : value;
}
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
getValueRecursive(self.__curr_get_val, _time);
var val = __curr_get_val[0];
if(is_array(val)) val = array_map(val, function(v) /*=>*/ {return valueProcess(v)});
else val = valueProcess(val);
return val;
}

View file

@ -33,7 +33,7 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co
network_set_config(network_config_connect_timeout, val);
}) ]);
static connectTo = function(newPort, newUrl, params) { #region
static connectTo = function(newPort, newUrl, params) {
logNode($"Connecting to {newUrl}:{newPort}");
if(ds_map_exists(PORT_MAP, port))
@ -58,7 +58,7 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co
NETWORK_CLIENTS[? _conId] = socket;
logNode($"Connected to {newUrl}:{newPort}");
} #endregion
}
setInspector(1, __txt("Resend"), [ THEME.refresh_icon, 1, COLORS._main_value_positive ], function() { triggerRender(); });
@ -78,7 +78,7 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co
}
}
static asyncPackets = function(_async_load) { #region
static asyncPackets = function(_async_load) {
if(!active) return;
var aid = async_load[? "id"];
@ -92,18 +92,18 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co
var callBack = callbackMap[$ aid];
sendCall(aid, callBack);
}
} #endregion
}
static step = function() { #region
static step = function() {
var _type = getInputData(1);
inputs[2].setVisible(_type == 0, _type == 0);
inputs[3].setVisible(_type == 1, _type == 1);
inputs[4].setVisible(_type == 2, _type == 2);
inputs[6].setVisible(_type == 3, _type == 3);
} #endregion
}
static update = function(frame = CURRENT_FRAME) { #region
static update = function(frame = CURRENT_FRAME) {
var _port = getInputData(0);
var _target = getInputData(5);
@ -135,9 +135,9 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co
params.content = _buff;
connectTo(_port, _target, params);
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
var network = ds_map_try_get(NETWORK_CLIENTS, port, noone);
@ -153,9 +153,9 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co
draw_set_alpha(1);
draw_sprite_fit(THEME.node_websocket_send, 0, bbox.xc, (_y0 + _y1) / 2, bbox.w, _y1 - _y0, cc, aa);
} #endregion
}
static postApplyDeserialize = function() { #region
static postApplyDeserialize = function() {
if(struct_has(attributes, "network_timeout")) network_set_config(network_config_connect_timeout, attributes.network_timeout);
} #endregion
}
}

View file

@ -8,9 +8,10 @@
#region classes
enum NOTI_TYPE {
log = 1 << 0,
warning = 1 << 1,
error = 1 << 2,
log = 1 << 0,
warning = 1 << 1,
error = 1 << 2,
internal = 1 << 3,
}
function notification(type, str, icon = noone, color = c_ui_blue_dkgrey, life = -1) constructor {
@ -28,8 +29,7 @@
self.icon_end = noone;
self.amount = 1;
self.time = $"{string_lead_zero(current_hour, 2)}:{string_lead_zero(current_minute, 2)}.{string_lead_zero(current_second, 2)}";
self.time = $"{string_lead_zero(current_hour, 2)}:{string_lead_zero(current_minute, 2)}.{string_lead_zero(current_second, 2)}";
static setOnClick = function(onClick, tooltip = "", icon_end = noone) {
self.onClick = method(self, onClick);
@ -39,7 +39,7 @@
return self;
}
array_push(CMD, self);
if(type != NOTI_TYPE.internal) array_push(CMD, self);
}
function noti_status(str, icon = noone, flash = false, ref = noone) {

View file

@ -22,7 +22,9 @@ function Panel_Console() : PanelContent() constructor {
scroll_y = 0;
prevFocus = false;
function drawHistory(_y) { #region
function setCommand(_com) { command = _com; keyboard_string = _com; }
function drawHistory(_y) {
var _x = ui(32 + 8);
var _w = w - ui(16 + 32);
@ -69,9 +71,9 @@ function Panel_Console() : PanelContent() constructor {
if(mouse_wheel_up()) scroll_y = clamp(scroll_y + 1, 0, array_length(CMD) - 1);
if(mouse_wheel_down()) scroll_y = clamp(scroll_y - 1, 0, array_length(CMD) - 1);
}
} #endregion
}
function drawContent(panel) { #region
function drawContent(panel) {
if(pFOCUS) {
if(prevFocus == false)
keyboard_string = command;
@ -92,37 +94,65 @@ function Panel_Console() : PanelContent() constructor {
var hy = h - ui(32);
drawHistory(hy);
draw_set_text(f_code, fa_right, fa_bottom, CDEF.main_dkgrey);
draw_text(ui(32 - 4), h - ui(4), ">");
var ty = ui(10);
draw_set_text(f_code, fa_left, fa_bottom, CDEF.main_dkgrey);
var _curs = CMDPRG? CMDPRG.title + ":" : ">";
if(CMDPRG) draw_set_color(CMDPRG.color);
var _curw = string_width(_curs);
draw_text(ty, h - ui(4), _curs);
ty += _curw + ui(4);
draw_set_text(f_code, fa_left, fa_bottom, COLORS._main_text);
draw_text(ui(32 + 8), h - ui(4), command);
draw_text(ty, h - ui(4), command);
ty += string_width(command);
draw_set_color(COLORS._main_text_sub);
draw_text(ui(32 + 8) + string_width(command), h - ui(4), "_");
draw_text(ty, h - ui(4), "_");
if(pFOCUS) {
if(keyboard_check_pressed(vk_enter)) {
cmd_submit(command);
command = "";
keyboard_string = "";
} else if(keyboard_check_pressed(vk_up)) {
cmd_index = max(0, cmd_index - 1);
var his = array_safe_get_fast(CMDIN, cmd_index, "");
command = is_instanceof(his, __cmdLine)? his.txt : his;
keyboard_string = command;
} else if(keyboard_check_pressed(vk_escape)) {
command = "";
keyboard_string = "";
} else if(keyboard_check_pressed(vk_anykey)) {
cmd_index = array_length(CMDIN);
if(!pFOCUS) return;
if(keyboard_check(vk_control)) {
if(keyboard_check_pressed(ord("V"))) {
setCommand(clipboard_get_text());
}
} else if(keyboard_check_pressed(vk_enter)) {
if(CMDPRG) {
var res = CMDPRG.submit(command);
if(res) CMDPRG = noone;
} else {
var prg = cmd_submit(command);
if(prg) {
CMDPRG = prg;
CMDPRG.console = self;
}
}
setCommand("");
cmd_index = array_length(CMDIN);
} else if(keyboard_check_pressed(vk_up)) {
cmd_index = max(0, cmd_index - 1);
var his = array_safe_get_fast(CMDIN, cmd_index, "");
setCommand(is_instanceof(his, __cmdLine)? his.txt : his);
} else if(keyboard_check_pressed(vk_down)) {
cmd_index = min(cmd_index + 1, array_length(CMDIN));
var his = array_safe_get_fast(CMDIN, cmd_index, "");
setCommand(is_instanceof(his, __cmdLine)? his.txt : his);
} else if(keyboard_check_pressed(vk_escape)) {
if(CMDPRG) CMDPRG = noone;
setCommand("");
} else if(keyboard_check_pressed(vk_anykey)) {
cmd_index = array_length(CMDIN);
}
} #endregion
}
}

View file

@ -83,10 +83,14 @@ function Panel_GM_Explore(gmBinder) : PanelContent() constructor {
var _raw = _ass.raw;
var _thm = noone;
if(_ass.type == "GMSprite") _thm = _ass.thumbnail;
else if(_ass.type == "GMTileSet") {
var _spm = struct_try_get(gmBinder.resourcesMap, _ass.sprite, noone);
_thm = _spm == noone? noone : _spm.thumbnail;
switch(_ass.type) {
case "GMSprite" : _thm = _ass.thumbnail; break;
case "GMRoom" : _thm = s_gmroom; break;
case "GMTileSet" :
var _spm = struct_try_get(gmBinder.resourcesMap, _ass.sprite, noone);
_thm = _spm == noone? noone : _spm.thumbnail;
break;
}
if(sprite_exists(_thm)) draw_sprite_bbox_uniform(_thm, 0, BBOX().fromWH(_asx + ui(2), _asy + ui(2), _ths - ui(4), _ths - ui(4)));

View file

@ -3258,6 +3258,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
node = nodeBuild("Node_Tile_Tileset", mouse_grid_x, mouse_grid_y).skipDefault();
node.gmTile = DRAGGING.data;
break;
case "GMRoom" :
node = nodeBuild("Node_GMRoom", mouse_grid_x, mouse_grid_y).skipDefault();
node.gmRoom = DRAGGING.data;
break;
}
if(!key_mod_press(SHIFT) && node && struct_has(DRAGGING, "from") && DRAGGING.from.value_from == noone) {

View file

@ -148,7 +148,7 @@ function Panel_Menu() : PanelContent() constructor {
}),
-1,
menuItem(__txtx("panel_menu_connect_patreon", "Connect to Patreon"), function() { dialogCall(o_dialog_patreon); }, THEME.patreon),
// menuItem(__txtx("panel_menu_connect_patreon", "Connect to Patreon (legacy)"), function() { dialogPanelCall(new Panel_Patreon()); }, THEME.patreon),
menuItem(__txtx("panel_menu_connect_patreon", "Connect to Patreon (legacy)"), function() { dialogPanelCall(new Panel_Patreon()); }, THEME.patreon),
];
menuItem_undo = MENU_ITEMS.undo;
@ -287,29 +287,21 @@ function Panel_Menu() : PanelContent() constructor {
}
function undoUpdate() {
var txt;
if(ds_stack_empty(UNDO_STACK)) {
txt = __txt("Undo");
} else {
var txt = __txt("Undo");
if(!ds_stack_empty(UNDO_STACK)) {
var act = ds_stack_top(UNDO_STACK);
if(array_length(act) > 1)
txt = $"{__txt("Undo")} {array_length(act)} {__txt("Actions")}";
else
txt = $"{__txt("Undo")} {act[0]}";
if(array_length(act) > 1) txt = $"{__txt("Undo")} {array_length(act)} {__txt("Actions")}";
else txt = $"{__txt("Undo")} {act[0]}";
}
menuItem_undo.active = !ds_stack_empty(UNDO_STACK);
menuItem_undo.name = txt;
if(ds_stack_empty(REDO_STACK)) {
txt = __txt("Redo");
} else {
txt = __txt("Redo");
if(!ds_stack_empty(REDO_STACK)) {
var act = ds_stack_top(REDO_STACK);
if(array_length(act) > 1)
txt = $"{__txt("Redo")} {array_length(act)} {__txt("Actions")}";
else
txt = $"{__txt("Redo")} {act[0]}";
if(array_length(act) > 1) txt = $"{__txt("Redo")} {array_length(act)} {__txt("Actions")}";
else txt = $"{__txt("Redo")} {act[0]}";
}
menuItem_redo.active = !ds_stack_empty(REDO_STACK);
@ -327,9 +319,9 @@ function Panel_Menu() : PanelContent() constructor {
var xx = ui(40);
var yy = ui(8);
#region about icon
#region about
if(hori) {
if(PREFERENCES.panel_menu_right_control)
if(_right)
xx = ui(24);
else {
xx = ui(140);
@ -337,16 +329,13 @@ function Panel_Menu() : PanelContent() constructor {
draw_line_round(xx, ui(8), xx, h - ui(8), 3);
}
var bx = xx;
if(!PREFERENCES.panel_menu_right_control)
bx = w - ui(24);
var bx = _right? xx : w - ui(24);
draw_sprite_ui_uniform(THEME.icon_24, 0, bx, h / 2, 1, c_white);
if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), 0, bx + ui(16), ui(32))) {
_draggable = false;
if(mouse_press(mb_left, pFOCUS))
dialogCall(o_dialog_about);
if(mouse_press(mb_left, pFOCUS)) dialogCall(o_dialog_about);
}
} else {
var bx = ui(20);
var by = h - ui(20);
@ -354,40 +343,40 @@ function Panel_Menu() : PanelContent() constructor {
draw_sprite_ui_uniform(THEME.icon_24, 0, bx, by, 1, c_white);
if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), by - ui(16), bx + ui(16), by + ui(16))) {
_draggable = false;
if(mouse_press(mb_left, pFOCUS))
dialogCall(o_dialog_about);
if(mouse_press(mb_left, pFOCUS)) dialogCall(o_dialog_about);
}
}
#endregion
#region menu
if(hori) {
if(PREFERENCES.panel_menu_right_control)
xx += ui(20);
else
xx += ui(8);
yy = 0;
xx += _right? ui(20) : ui(8);
yy = 0;
} else {
xx = ui(8);
yy = w < vertical_break? ui(72) : ui(40);
}
var sx = xx;
var xc, x0, x1, yc, y0, y1, _mx = xx;
var row = 1, maxRow = ceil(h / ui(40));
var _ww = 0;
var xc, x0, x1, yc, y0, y1;
var sx = xx;
var _mx = xx;
var row = 1;
var maxRow = ceil(h / ui(40));
var ww, _ww = 0;
draw_set_text(font, fa_center, fa_center, COLORS._main_text);
for(var i = 0; i < array_length(menus) - 1; i++) {
draw_set_text(font, fa_center, fa_center, COLORS._main_text);
var ww = string_width(menus[i][0]) + ui(16 + 8);
ww = string_width(menus[i][0]) + ui(16 + 8);
_ww += ww;
if(_ww > w * 0.4 - sx) {
row++;
_ww = 0;
}
}
row = min(row, maxRow);
var _curRow = 0, currY;
var _rowH = (h - ui(12)) / row;
@ -403,7 +392,6 @@ function Panel_Menu() : PanelContent() constructor {
if(hori) {
xc = xx + ww / 2;
x0 = xx;
x1 = xx + ww;
y0 = ui(6) + _rowH * _curRow;
@ -411,6 +399,7 @@ function Panel_Menu() : PanelContent() constructor {
yc = (y0 + y1) / 2;
currY = yc;
} else {
xc = w / 2;
yc = yy + hh / 2;
@ -443,6 +432,7 @@ function Panel_Menu() : PanelContent() constructor {
_ww = 0;
xx = sx;
}
} else
yy += hh + 8;
}
@ -551,6 +541,7 @@ function Panel_Menu() : PanelContent() constructor {
if(b) _draggable = false;
if(b == 2) window_close();
break;
case "maximize":
var win_max = window_is_maximized || window_is_fullscreen;
if(OS == os_macosx)
@ -563,29 +554,32 @@ function Panel_Menu() : PanelContent() constructor {
if(window_is_fullscreen) {
winMan_setFullscreen(false);
winMan_Unmaximize();
} else if(window_is_maximized) {
winMan_Unmaximize();
DISPLAY_REFRESH
} else {
winMan_Maximize();
DISPLAY_REFRESH
}
} else if(OS == os_macosx) {
if(__win_is_maximized) mac_window_minimize();
else mac_window_maximize();
}
}
break;
case "minimize":
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_minimize, 0, [ COLORS._main_icon, CDEF.yellow ]);
if(b) _draggable = false;
if(b == -2) {
if(OS == os_windows)
winMan_Minimize();
else if(OS == os_macosx)
mac_window_dock();
if(OS == os_windows) winMan_Minimize();
else if(OS == os_macosx) mac_window_dock();
}
break;
case "fullscreen":
var win_full = window_is_fullscreen;
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_fullscreen, win_full, [ COLORS._main_icon, CDEF.cyan ]);
@ -593,6 +587,7 @@ function Panel_Menu() : PanelContent() constructor {
if(b == 2) {
if(OS == os_windows)
winMan_setFullscreen(!win_full);
else if(OS == os_macosx) {
if(win_full) {
winMan_setFullscreen(false);
@ -612,7 +607,7 @@ function Panel_Menu() : PanelContent() constructor {
#region version
var _xx1 = _right? x1 : w - ui(40);
var txt = "v. " + string(VERSION_STRING);
var txt = $"v. {VERSION_STRING}";
if(STEAM_ENABLED) txt += " Steam";
version_name_copy = lerp_float(version_name_copy, 0, 10);
@ -637,6 +632,7 @@ function Panel_Menu() : PanelContent() constructor {
if(mouse_press(mb_left, pFOCUS))
dialogCall(o_dialog_release_note);
if(mouse_press(mb_right, pFOCUS)) {
clipboard_set_text(VERSION_STRING);
version_name_copy = 3;
@ -646,6 +642,7 @@ function Panel_Menu() : PanelContent() constructor {
draw_text(round((_x0 + _x1) / 2), round((_y0 + _y1) / 2), txt);
_xx1 = _x0 - ui(8);
}
} else {
var _xx1 = ui(40);
var y1 = h - ui(20);
@ -658,6 +655,7 @@ function Panel_Menu() : PanelContent() constructor {
if(mouse_press(mb_left, pFOCUS))
dialogCall(o_dialog_release_note);
if(mouse_press(mb_right, pFOCUS)) {
clipboard_set_text(VERSION_STRING);
version_name_copy = 3;
@ -684,6 +682,7 @@ function Panel_Menu() : PanelContent() constructor {
ty0 = 0;
ty1 = h;
tcx = (tx0 + tx1) / 2;
} else {
tx0 = ui(8);
tx1 = w < vertical_break? w - ui(16) : w - ui(144);

View file

@ -1,3 +1,5 @@
global.PATREON_VERIFY_CODE = undefined;
function Panel_Patreon() : PanelContent() constructor {
w = ui(480);
h = ui(264);
@ -5,8 +7,6 @@ function Panel_Patreon() : PanelContent() constructor {
resizable = false;
auto_pin = true;
//patreon_email_check("tanasart_pt@outlook.co.th");
mail = "";
code = "";
@ -18,7 +18,6 @@ function Panel_Patreon() : PanelContent() constructor {
tb_code = new textBox(TEXTBOX_INPUT.text, function(_code) { code = _code; });
mail_checking = false;
verify_code = "";
function mailCallback(response) {
mail_checking = false;
@ -42,12 +41,11 @@ function Panel_Patreon() : PanelContent() constructor {
var key = keys[0];
var member = map[$ key];
var stat = string_replace_all(string_lower(member.status), " ", "_");
print(stat);
if(string_pos("active", stat) > 0) {
var _mail = member.email;
var _code = patreon_generate_activation_key(_mail); //yea we doing this on client now.
verify_code = _code;
global.PATREON_VERIFY_CODE = _code;
var _map = ds_map_create();
@ -132,6 +130,7 @@ function Panel_Patreon() : PanelContent() constructor {
} else
draw_sprite_ext(THEME.loading_s, 0, w / 2, _yy + _bh / 2, 1, 1, current_time, COLORS._main_icon, 1);
break;
case 1 :
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text_inner);
draw_text(w / 2, _yy, "Enter verification code:");
@ -145,7 +144,7 @@ function Panel_Patreon() : PanelContent() constructor {
_yy += TEXTBOX_HEIGHT + 12;
if(buttonInstant(THEME.button_def, _bx, _yy, _bw, _bh, [ mx, my ], pFOCUS, pHOVER) == 2) {
if(code == verify_code) {
if(code == global.PATREON_VERIFY_CODE) {
result = "Patreon verified, thank you for suporting Pixel Composer!";
result_color = COLORS._main_value_positive;

View file

@ -3,6 +3,87 @@ globalvar IS_PATREON;
#macro FIRESTORE_ID "pixelcomposer-f9cef"
function cmd_program_patreon_legacy(mail) : cmd_program() constructor {
title = "Patreon";
color = CDEF.pink;
array_push(CMD, cmdLine($"Patreon legacy verifier", CDEF.pink) );
array_push(CMD, cmdLine($"> Checking email: {mail}", COLORS._main_text_sub) );
mail_checking = true;
function mailCallback(response) {
mail_checking = false;
if (response[? "status"] != 200) {
array_push(CMD, cmdLine($"X Request error.", COLORS._main_value_negative) );
CMDPRG = noone;
return;
}
var val = response[? "value"];
var map = json_try_parse(val);
var keys = struct_get_names(map);
if(array_empty(keys)) {
array_push(CMD, cmdLine($"X Patreon email not found.", COLORS._main_value_negative) );
CMDPRG = noone;
return;
}
var key = keys[0];
var member = map[$ key];
var stat = string_replace_all(string_lower(member.status), " ", "_");
if(string_pos("active", stat) > 0) {
var _mail = member.email;
var _code = patreon_generate_activation_key(_mail); //yea we doing this on client now.
global.PATREON_VERIFY_CODE = _code;
var _map = ds_map_create();
_map[? "Api-Token"] = patreon_get_email_token();
_map[? "Content-Type"] = "application/json";
var _body = {
from: {
email: "verify@pixel-composer.com",
name: "Pixel Composer"
},
to: [ { email: _mail } ],
template_uuid: "82b77e89-0343-4a20-a63d-063f4f8dcdfe",
template_variables: { verification_code: _code }
};
http_request("https://send.api.mailtrap.io/api/send", "POST", _map, json_stringify(_body));
array_push(CMD, cmdLine($"> Verification code has been send to your email.", COLORS._main_text_sub) );
array_push(CMD, cmdLine($"> Enter verification code: ", COLORS._main_text) );
} else {
array_push(CMD, cmdLine($"X Patreon membership not active.", COLORS._main_value_negative) );
CMDPRG = noone;
}
}
patreon_email_check(mail, mailCallback);
static submit = function(arg) {
if(arg == global.PATREON_VERIFY_CODE) {
array_push(CMD, cmdLine($"> Patreon verified, thank you for suporting Pixel Composer!", COLORS._main_value_positive) );
return 1;
} else {
array_push(CMD, cmdLine($"> Incorrect code, please try again.", COLORS._main_value_negative) );
array_push(CMD, cmdLine($"> Enter verification code: ", COLORS._main_text) );
return 0;
}
return 0;
}
}
function patreon_email_check(mail, callback) {
PATREON_MAIL_CHECK = FirebaseFirestore("memberships").Where("email", "==", mail).Query();
PATREON_MAIL_CALLBACK = callback;

View file

@ -61,4 +61,4 @@ function struct_try_override(original, override, key) {
if(!struct_has(override, key)) return;
original[$ key] = override[$ key];
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

View file

@ -0,0 +1,114 @@
{
"$GMSprite":"",
"%Name":"s_gmlayer",
"bboxMode":0,
"bbox_bottom":22,
"bbox_left":1,
"bbox_right":22,
"bbox_top":1,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"d81c8a0c-7ea7-4c85-95ad-0b7394936c31","name":"d81c8a0c-7ea7-4c85-95ad-0b7394936c31","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"7ec25b15-c8dc-4ce5-9f17-c5e9923a9525","name":"7ec25b15-c8dc-4ce5-9f17-c5e9923a9525","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"cc9f6201-c9f5-414e-8b28-97566eb6b405","name":"cc9f6201-c9f5-414e-8b28-97566eb6b405","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"f17dd9a2-d5cb-44d9-9ec1-903968019825","name":"f17dd9a2-d5cb-44d9-9ec1-903968019825","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"6e5e2b10-f3fc-47b7-be0c-1af0ed6c727b","name":"6e5e2b10-f3fc-47b7-be0c-1af0ed6c727b","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"6327ddfc-a4fa-4bf4-9a22-511c4581e6c2","name":"6327ddfc-a4fa-4bf4-9a22-511c4581e6c2","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"793151f9-7bc7-4285-af9a-e4c5f3d6105e","name":"793151f9-7bc7-4285-af9a-e4c5f3d6105e","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":24,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"3c6fc479-708a-439a-8f0c-80dd14f575f8","blendMode":0,"displayName":"default","isLocked":false,"name":"3c6fc479-708a-439a-8f0c-80dd14f575f8","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_gmlayer",
"nineSlice":null,
"origin":4,
"parent":{
"name":"misc",
"path":"folders/sprites/misc.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_gmlayer",
"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":7.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_gmlayer",
"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":"d81c8a0c-7ea7-4c85-95ad-0b7394936c31","path":"sprites/s_gmlayer/s_gmlayer.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"671d2d2f-be63-4494-b4c5-45e075521b78","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7ec25b15-c8dc-4ce5-9f17-c5e9923a9525","path":"sprites/s_gmlayer/s_gmlayer.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"d7b6e61d-c1a8-49fe-a2fd-4dd847355e9f","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"cc9f6201-c9f5-414e-8b28-97566eb6b405","path":"sprites/s_gmlayer/s_gmlayer.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"4be75be3-bcca-48c9-8ef2-70c1a0f1bc5a","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"f17dd9a2-d5cb-44d9-9ec1-903968019825","path":"sprites/s_gmlayer/s_gmlayer.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"fc33d751-c70f-46e8-b4bd-460d0acec7f7","IsCreationKey":false,"Key":3.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"6e5e2b10-f3fc-47b7-be0c-1af0ed6c727b","path":"sprites/s_gmlayer/s_gmlayer.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"14350154-a924-46b2-859b-71a1c4217ed5","IsCreationKey":false,"Key":4.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"6327ddfc-a4fa-4bf4-9a22-511c4581e6c2","path":"sprites/s_gmlayer/s_gmlayer.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"f6c00056-1774-494a-acdf-4e14586da8d7","IsCreationKey":false,"Key":5.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"793151f9-7bc7-4285-af9a-e4c5f3d6105e","path":"sprites/s_gmlayer/s_gmlayer.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"c25f7b51-19f0-44bf-afb6-aa3348a5050b","IsCreationKey":false,"Key":6.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,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_gmroom",
"bboxMode":0,
"bbox_bottom":54,
"bbox_left":9,
"bbox_right":54,
"bbox_top":9,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"cf8a0785-6466-41ac-a4b0-1d74a16a9e93","name":"cf8a0785-6466-41ac-a4b0-1d74a16a9e93","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":64,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"4ce347b1-ee6d-4cde-be23-eb243caf1c50","blendMode":0,"displayName":"default","isLocked":false,"name":"4ce347b1-ee6d-4cde-be23-eb243caf1c50","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_gmroom",
"nineSlice":null,
"origin":4,
"parent":{
"name":"misc",
"path":"folders/sprites/misc.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_gmroom",
"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_gmroom",
"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":"cf8a0785-6466-41ac-a4b0-1d74a16a9e93","path":"sprites/s_gmroom/s_gmroom.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"b247d921-eb69-4dd9-a734-bc95ddcdd829","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":32,
"yorigin":32,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":64,
}