|
Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT SERVER-PC 10.0 build 26200 (Windows 11) AMD64 User : ServerPC ( 0) PHP Version : 8.2.12 Disable Function : NONE Directory : C:/Program Files (x86)/Steam/steamapps/common/wallpaper_engine/assets/presets/countdown/ |
Upload File : |
{
"name" : "ui_editor_preset_countdown_title",
"description" : "ui_editor_preset_countdown_description",
"tag" : "scene2d",
"group" : "preset",
"options" :
{
"droplistVisible" : true,
"droplistOptions" :
[
{
"label" : "ui_editor_preset_countdown_variant_release",
"value" : 0
}
]
},
"variants" :
[
{
"preview" : "previewcountdown/project.json",
"objects" :
[
{
"alpha" : 1.0,
"anchor" : "none",
"angles" : "0.000 0.000 0.000",
"backgroundcolor" : "0.000 0.000 0.000",
"color" : "1.000 1.000 1.000",
"colorBlendMode" : 0,
"copybackground" : true,
"font" : "systemfont_arial",
"horizontalalign" : "center",
"locktransforms" : false,
"name" : "Countdown",
"opaquebackground" : false,
"origin" : "960.000 540.000 0.000",
"parallaxDepth" : "1.000 1.000",
"perspective" : false,
"pointsize" : 32.0,
"scale" : "1.000 1.000 1.000",
"size" : "1032.000 115.000",
"solid" : true,
"text" :
{
"script" : "'use strict';\n\nexport var scriptProperties = createScriptProperties()\n\t// The time that the coutdown will end on.\n\t.addText({\n\t\tname: 'date',\n\t\tlabel: 'ui_editor_properties_date',\n\t\tvalue: '2019-12-25T00:00:00'\n\t})\n\t// Whether the year should be ignored.\n\t.addCheckbox({\n\t\tname: 'recurring',\n\t\tlabel: 'ui_editor_properties_recurring',\n\t\tvalue: true\n\t})\n\t// This text will be shown for non-recurring countdowns after they concluded.\n\t.addCheckbox({\n\t\tname: 'finalMessage',\n\t\tlabel: 'ui_editor_properties_end_message',\n\t\tvalue: 'The countdown finished!'\n\t})\n\t.finish();\n\n/**\n * @param {String} value (for property 'text')\n */\nvar originalText;\nexport function update(value) {\n\tvar currentDate = new Date();\n\tvar targetDate = new Date(scriptProperties.date);\n\tvar isRecurringEachYear = scriptProperties.recurring;\n\tif (isRecurringEachYear) {\n\t\ttargetDate.setUTCFullYear(currentDate.getUTCFullYear());\n\t\tif ((targetDate.getTime() - currentDate.getTime()) < 0) {\n\t\t\ttargetDate.setUTCFullYear(currentDate.getUTCFullYear() + 1);\n\t\t}\n\t}\n\n\tvar diff = targetDate.getTime() - currentDate.getTime();\n\tif (!isRecurringEachYear\n\t\t&& diff < 0) {\n\t\treturn scriptProperties.finalMessage;\n\t}\n\n\tvar years = Math.floor(diff / (1000 * 60 * 60 * 24 * 365));\n\tvar days = Math.floor(diff / (1000 * 60 * 60 * 24));\n\tvar hours = Math.floor(diff / (1000 * 60 * 60)) % 24;\n\tvar minutes = Math.floor(diff / (1000 * 60)) % 60;\n\n\tif (!isRecurringEachYear) {\n\t\tdays %= 365;\n\t}\n\n\tvalue = originalText + '\\n';\n\tif (years > 0 && !isRecurringEachYear) {\n\t\tvalue += years + ' years, ';\n\t}\n\tif (days > 0) {\n\t\tvalue += days + ' days, ';\n\t}\n\tvalue += hours + ' hours';\n\tif (days == 0) {\n\t\tvalue += ', ' + minutes + ' minutes';\n\t}\n\treturn value;\n}\n\n/**\n * @param {String} value (for property 'text')\n */\nexport function init(value) {\n\toriginalText = value;\n\treturn value;\n}\n",
"scriptproperties" :
{
"date" : "2019-12-25T00:00:00",
"finalMessage" : "The countdown finished!",
"recurring" : true
},
"value" : "Time until Christmas:"
},
"verticalalign" : "center",
"visible" : true
}
]
}
]
}