From 287b8d1481c1edfc9284793c01170ca51e841ac3 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Wed, 3 Jan 2024 15:22:18 -0500 Subject: [PATCH] Add files via upload --- applications/flyAvatar/app-flyAvatar.js | 30 +++++++++++++++---- applications/flyAvatar/flyAvatar.html | 9 +++++- applications/flyAvatar/icon_inactive_off.png | Bin 0 -> 1418 bytes applications/flyAvatar/icon_inactive_on.png | Bin 0 -> 1381 bytes 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 applications/flyAvatar/icon_inactive_off.png create mode 100644 applications/flyAvatar/icon_inactive_on.png diff --git a/applications/flyAvatar/app-flyAvatar.js b/applications/flyAvatar/app-flyAvatar.js index 69dd7f3..43b0e31 100644 --- a/applications/flyAvatar/app-flyAvatar.js +++ b/applications/flyAvatar/app-flyAvatar.js @@ -15,7 +15,9 @@ var APP_NAME = "FLY-AV"; var APP_URL = ROOT + "flyAvatar.html"; - var APP_ICON_INACTIVE = ROOT + "icon_inactive.png"; + var APP_ICON_INACTIVE_ON = ROOT + "icon_inactive_on.png"; + var APP_ICON_INACTIVE_OFF = ROOT + "icon_inactive_off.png"; + var inactiveIcon = APP_ICON_INACTIVE_ON; var APP_ICON_ACTIVE = ROOT + "icon_active.png"; // BLACK on var ICON_CAPTION_COLOR = "#FFFFFF"; var appStatus = false; @@ -23,6 +25,8 @@ var timestamp = 0; var INTERCALL_DELAY = 200; //0.3 sec var FLY_AVATAR_SETTING_KEY = "overte.application.more.flyAvatar.avatarUrl"; + var FLY_AVATAR_SWITCH_SETTING_KEY = "overte.application.more.flyAvatar.switch"; + var flyAvatarSwitch = true; var flyAvatarUrl = ""; var originalAvatarUrl = ""; var isFlying = false; @@ -35,7 +39,7 @@ var button = tablet.addButton({ text: APP_NAME, - icon: APP_ICON_INACTIVE, + icon: APP_ICON_INACTIVE_ON, activeIcon: APP_ICON_ACTIVE, captionColor: ICON_CAPTION_COLOR }); @@ -50,7 +54,7 @@ appStatus = false; }else{ //Launching the Application UI. - tablet.gotoWebScreen(APP_URL); // <== Data can be transmitted at opening of teh UI by using GET method, through paramater in the URL. + "?parameter=value" + tablet.gotoWebScreen(APP_URL); tablet.webEventReceived.connect(onAppWebEventReceived); colorCaption = "#000000"; appStatus = true; @@ -79,8 +83,16 @@ sendCurrentFlyAvatarUrlToUI(); } else if (instruction.action === "UPDATE_URL") { flyAvatarUrl = instruction.url; + flyAvatarSwitch = instruction.mainSwitch; Settings.setValue( FLY_AVATAR_SETTING_KEY, flyAvatarUrl); + Settings.setValue( FLY_AVATAR_SWITCH_SETTING_KEY, flyAvatarSwitch); updateAvatar(); + if (flyAvatarSwitch) { + inactiveIcon = APP_ICON_INACTIVE_ON; + } else { + inactiveIcon = APP_ICON_INACTIVE_OFF; + } + button.editProperties({icon: inactiveIcon}); } else if (instruction.action === "SELF_UNINSTALL" && (n - timestamp) > INTERCALL_DELAY) { //<== This is a good practice to add a "Uninstall this app" button for rarely used app. (toolbar has a limit in size) d = new Date(); timestamp = d.getTime(); @@ -91,7 +103,7 @@ } function updateAvatar() { - if (MyAvatar.isFlying()) { + if (MyAvatar.isFlying() && flyAvatarSwitch) { MyAvatar.useFullAvatarURL(flyAvatarUrl); } else { if (MyAvatar.skeletonModelURL === flyAvatarUrl) { @@ -124,7 +136,8 @@ var message = { "channel": channel, "action": "FLY-AVATAR-URL", - "url": flyAvatarUrl + "url": flyAvatarUrl, + "mainSwitch": flyAvatarSwitch }; tablet.emitScriptEvent(JSON.stringify(message)); } @@ -159,5 +172,12 @@ Script.scriptEnding.connect(cleanup); originalAvatarUrl = MyAvatar.skeletonModelURL; flyAvatarUrl = Settings.getValue( FLY_AVATAR_SETTING_KEY, "" ); + flyAvatarSwitch = Settings.getValue( FLY_AVATAR_SWITCH_SETTING_KEY, true ); + if (flyAvatarSwitch) { + inactiveIcon = APP_ICON_INACTIVE_ON; + } else { + inactiveIcon = APP_ICON_INACTIVE_OFF; + } + button.editProperties({icon: inactiveIcon}); Script.update.connect(myTimer); }()); diff --git a/applications/flyAvatar/flyAvatar.html b/applications/flyAvatar/flyAvatar.html index a796dac..099f235 100644 --- a/applications/flyAvatar/flyAvatar.html +++ b/applications/flyAvatar/flyAvatar.html @@ -21,12 +21,15 @@ var currentPath = window.location.protocol + "//" + window.location.host + window.location.pathname; var ROOTPATH = currentPath.replace(thisPageName, ""); var flyAvatarUrl = ""; + var flyAvatarSwitch = true; EventBridge.scriptEventReceived.connect(function(message){ messageObj = JSON.parse(message); if (messageObj.channel === channel) { if (messageObj.action === "FLY-AVATAR-URL") { flyAvatarUrl = messageObj.url; + flyAvatarSwitch = messageObj.mainSwitch; + document.getElementById("mainSwitch").checked = flyAvatarSwitch; document.getElementById("avatarUrl").value = flyAvatarUrl; } } @@ -99,6 +102,8 @@

FLY AVATAR



+ +

Avatar Url to use while flying:


@@ -121,10 +126,12 @@

FLY AVATAR

function updateAvatarUrl() { flyAvatarUrl = document.getElementById("avatarUrl").value; + flyAvatarSwitch = document.getElementById("mainSwitch").checked; var message = { "channel": channel, "action": "UPDATE_URL", - "url": flyAvatarUrl + "url": flyAvatarUrl, + "mainSwitch": flyAvatarSwitch }; EventBridge.emitWebEvent(JSON.stringify(message)); } diff --git a/applications/flyAvatar/icon_inactive_off.png b/applications/flyAvatar/icon_inactive_off.png new file mode 100644 index 0000000000000000000000000000000000000000..5b0d56b8888d565b69dba34ef04e9bef47f9138d GIT binary patch literal 1418 zcma)6`Bzg%6rT681A!Mp2ulbLfy$9ZK#=7iyo6W*WidrWaG?=3E>+Qrh$t_B<>AUw zS5%U^QI9C;iAPipc;JC(p$(b}QniwbHRz#4K|q%D@gMYuJKxNld+#^j%-ma+lC*?t zv{sv_4Q`<|DI-jB!tMnbmJH{1rtJ`jnpV(YtVv7vhtu9Iq6n!K zfQds145llx6xO;RTcxqf9p<$czxnwNRv;pTH1i^KhDA0L^?$QG7yv5i^8A2xa&Etg zF=&cXY<8V@LY7M0I4w`~DT3lbPx=d0gA;KLmM6$!Dfc81)2-ksH5LRv3%Hy7=z3LG#65^=8SXz zb2fUBHQKpf?$2POBjxrUPtESCJiaceoMjZDX!9rt;Xs<4p^%MFN9f|U_Jm!mZv=wC#(XsCn$({0N5muS zgI(R;o7kt$RcMnn+1wop=*Yd_bB&xU*4SzrQW`GZ;LQjccFAbu!_BI3I#PY%smO}{vL?z!lo`bPBSRqXJ0}~95sXbw7PKl zH=>t0ndQ9=pqAKa)qmFqoTA&)|@Jv$+k;&N6TAG}1iLTv>UV6N(egw)PJ_SuU?kETb5miBEX7O{oN< z;$xZ@W7v$JpD_?@Y4Vl$ZpyBAsTGIZAOV7rd33{$85^=uY5b&WU=lSI84rMeVd;>M zx_23R#fBWv2L$JrnTlE)k`PK8<)8XuBQ3{Sx8neZ*socW$qbHCiGC5JL~>n>191ty zdIiZiGQP!$DtN+e^J<$m1JKl`F!QhT2P2ru%w?QMtrwIKzCy&Dt?F;fVRf-({Smk9 z9JHF(&Sa}4?|I55EGeUx?5Dmvv&A!T$z2fZaB6PW$fER*@Z-D2xQz7D!&LBQP}wQI z3^myLILZQ49T3&RLNL=hb|iZx)MiqT*w*nQyA!^0iYryzm`&Aca9uIm;HpiVaXy{ literal 0 HcmV?d00001 diff --git a/applications/flyAvatar/icon_inactive_on.png b/applications/flyAvatar/icon_inactive_on.png new file mode 100644 index 0000000000000000000000000000000000000000..a8a93f4d4703fd6759f75095e4c9ad26f36da125 GIT binary patch literal 1381 zcma)6`%@EF6u!H86GAqDBp5QG)UL~pg)}R-E-%h^WAgrov%b0y@q2W zwgCWeA|n(k61_hglTLbRD4`>PwKHPFE&%KdpA9;($j*t}q<$S16$XIrXx_)z3Nl8w zM5v+w$n^vOF9cv_jzlv6dzJ$*mIA9Q&4u3D2>@g; zEME^Wz;QYTsC_LK=Ko%%Ob{aEU#jUnW`zk6(1qyEKrjIr2gTI37onPQ7Ex8=ML}^# zMp%76mk2PG?FWVg%qppI1(2^}c|tIhLqp$rq>_}nz6WK8v7W<*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