mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 14:20:33 +02:00
Merge pull request #12315 from zfox23/commerce_SendMoneyNearbyParticle
Commerce: Send Money Nearby particle effect!
This commit is contained in:
commit
2a0d85a119
5 changed files with 145 additions and 6 deletions
BIN
interface/resources/qml/hifi/commerce/common/images/loader.gif
Normal file
BIN
interface/resources/qml/hifi/commerce/common/images/loader.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
|
@ -58,6 +58,9 @@ Item {
|
||||||
|
|
||||||
if (result.status === 'success') {
|
if (result.status === 'success') {
|
||||||
root.nextActiveView = 'paymentSuccess';
|
root.nextActiveView = 'paymentSuccess';
|
||||||
|
if (sendPubliclyCheckbox.checked && sendMoneyStep.referrer === "nearby") {
|
||||||
|
sendSignalToWallet({method: 'sendMoney_sendPublicly', recipient: sendMoneyStep.selectedRecipientNodeID, amount: parseInt(amountTextField.text)});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
root.nextActiveView = 'paymentFailure';
|
root.nextActiveView = 'paymentFailure';
|
||||||
}
|
}
|
||||||
|
@ -104,6 +107,12 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HifiCommerceCommon.CommerceLightbox {
|
||||||
|
id: lightboxPopup;
|
||||||
|
visible: false;
|
||||||
|
anchors.fill: parent;
|
||||||
|
}
|
||||||
|
|
||||||
// Send Money Home BEGIN
|
// Send Money Home BEGIN
|
||||||
Item {
|
Item {
|
||||||
id: sendMoneyHome;
|
id: sendMoneyHome;
|
||||||
|
@ -921,7 +930,7 @@ Item {
|
||||||
id: optionalMessage;
|
id: optionalMessage;
|
||||||
property int maximumLength: 72;
|
property int maximumLength: 72;
|
||||||
property string previousText: text;
|
property string previousText: text;
|
||||||
placeholderText: "<i>Optional Message (" + maximumLength + " character limit)</i>";
|
placeholderText: "<i>Optional Public Message (" + maximumLength + " character limit)</i>";
|
||||||
font.family: firaSansSemiBold.name;
|
font.family: firaSansSemiBold.name;
|
||||||
font.pixelSize: 20;
|
font.pixelSize: 20;
|
||||||
// Anchors
|
// Anchors
|
||||||
|
@ -971,16 +980,54 @@ Item {
|
||||||
|
|
||||||
HifiControlsUit.CheckBox {
|
HifiControlsUit.CheckBox {
|
||||||
id: sendPubliclyCheckbox;
|
id: sendPubliclyCheckbox;
|
||||||
visible: false; // FIXME ONCE PARTICLE EFFECTS ARE IN
|
visible: sendMoneyStep.referrer === "nearby";
|
||||||
text: "Send Publicly"
|
checked: Settings.getValue("sendMoneyNearbyPublicly", true);
|
||||||
|
text: "Show Effect"
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: messageContainer.bottom;
|
anchors.top: messageContainer.bottom;
|
||||||
anchors.topMargin: 16;
|
anchors.topMargin: 16;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: 20;
|
anchors.leftMargin: 20;
|
||||||
anchors.right: parent.right;
|
width: 110;
|
||||||
anchors.rightMargin: 16;
|
boxSize: 28;
|
||||||
boxSize: 24;
|
onCheckedChanged: {
|
||||||
|
Settings.setValue("sendMoneyNearbyPublicly", checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RalewaySemiBold {
|
||||||
|
id: sendPubliclyCheckboxHelp;
|
||||||
|
visible: sendPubliclyCheckbox.visible;
|
||||||
|
text: "[?]";
|
||||||
|
// Anchors
|
||||||
|
anchors.left: sendPubliclyCheckbox.right;
|
||||||
|
anchors.leftMargin: 8;
|
||||||
|
anchors.verticalCenter: sendPubliclyCheckbox.verticalCenter;
|
||||||
|
height: 30;
|
||||||
|
width: paintedWidth;
|
||||||
|
// Text size
|
||||||
|
size: 18;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.blueAccent;
|
||||||
|
MouseArea {
|
||||||
|
enabled: sendPubliclyCheckboxHelp.visible;
|
||||||
|
anchors.fill: parent;
|
||||||
|
hoverEnabled: true;
|
||||||
|
onEntered: {
|
||||||
|
parent.color = hifi.colors.blueHighlight;
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
parent.color = hifi.colors.blueAccent;
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
lightboxPopup.titleText = "Send Money Effect";
|
||||||
|
lightboxPopup.bodyImageSource = "../wallet/sendMoney/images/send-money-effect-sm.jpg"; // Path relative to CommerceLightbox.qml
|
||||||
|
lightboxPopup.bodyText = "Enabling this option will create a particle effect between you and " +
|
||||||
|
"your recipient that is visible to everyone nearby.";
|
||||||
|
lightboxPopup.button1text = "CLOSE";
|
||||||
|
lightboxPopup.button1method = "root.visible = false;"
|
||||||
|
lightboxPopup.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -1538,6 +1585,8 @@ Item {
|
||||||
sendMoneyStep.selectedRecipientProfilePic = "";
|
sendMoneyStep.selectedRecipientProfilePic = "";
|
||||||
amountTextField.text = "";
|
amountTextField.text = "";
|
||||||
optionalMessage.text = "";
|
optionalMessage.text = "";
|
||||||
|
sendPubliclyCheckbox.checked = Settings.getValue("sendMoneyNearbyPublicly", true);
|
||||||
|
sendMoneyStep.referrer = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
|
@ -527,6 +527,80 @@
|
||||||
//
|
//
|
||||||
//***********************************************
|
//***********************************************
|
||||||
|
|
||||||
|
var sendMoneyRecipient;
|
||||||
|
var sendMoneyParticleEffectUpdateTimer;
|
||||||
|
var particleEffectTimestamp;
|
||||||
|
var sendMoneyParticleEffect;
|
||||||
|
var SEND_MONEY_PARTICLE_TIMER_UPDATE = 250;
|
||||||
|
var SEND_MONEY_PARTICLE_EMITTING_DURATION = 3000;
|
||||||
|
var SEND_MONEY_PARTICLE_LIFETIME_SECONDS = 8;
|
||||||
|
var SEND_MONEY_PARTICLE_PROPERTIES = {
|
||||||
|
accelerationSpread: { x: 0, y: 0, z: 0 },
|
||||||
|
alpha: 1,
|
||||||
|
alphaFinish: 1,
|
||||||
|
alphaSpread: 0,
|
||||||
|
alphaStart: 1,
|
||||||
|
azimuthFinish: 0,
|
||||||
|
azimuthStart: -6,
|
||||||
|
color: { red: 143, green: 5, blue: 255 },
|
||||||
|
colorFinish: { red: 255, green: 0, blue: 204 },
|
||||||
|
colorSpread: { red: 0, green: 0, blue: 0 },
|
||||||
|
colorStart: { red: 0, green: 136, blue: 255 },
|
||||||
|
emitAcceleration: { x: 0, y: 0, z: 0 }, // Immediately gets updated to be accurate
|
||||||
|
emitDimensions: { x: 0, y: 0, z: 0 },
|
||||||
|
emitOrientation: { x: 0, y: 0, z: 0 },
|
||||||
|
emitRate: 4,
|
||||||
|
emitSpeed: 2.1,
|
||||||
|
emitterShouldTrail: true,
|
||||||
|
isEmitting: 1,
|
||||||
|
lifespan: SEND_MONEY_PARTICLE_LIFETIME_SECONDS + 1, // Immediately gets updated to be accurate
|
||||||
|
lifetime: SEND_MONEY_PARTICLE_LIFETIME_SECONDS + 1,
|
||||||
|
maxParticles: 20,
|
||||||
|
name: 'hfc-particles',
|
||||||
|
particleRadius: 0.2,
|
||||||
|
polarFinish: 0,
|
||||||
|
polarStart: 0,
|
||||||
|
radiusFinish: 0.05,
|
||||||
|
radiusSpread: 0,
|
||||||
|
radiusStart: 0.2,
|
||||||
|
speedSpread: 0,
|
||||||
|
textures: "http://hifi-content.s3.amazonaws.com/alan/dev/Particles/Bokeh-Particle-HFC.png",
|
||||||
|
type: 'ParticleEffect'
|
||||||
|
};
|
||||||
|
|
||||||
|
function updateSendMoneyParticleEffect() {
|
||||||
|
var timestampNow = Date.now();
|
||||||
|
if ((timestampNow - particleEffectTimestamp) > (SEND_MONEY_PARTICLE_LIFETIME_SECONDS * 1000)) {
|
||||||
|
deleteSendMoneyParticleEffect();
|
||||||
|
return;
|
||||||
|
} else if ((timestampNow - particleEffectTimestamp) > SEND_MONEY_PARTICLE_EMITTING_DURATION) {
|
||||||
|
Entities.editEntity(sendMoneyParticleEffect, {
|
||||||
|
isEmitting: 0
|
||||||
|
});
|
||||||
|
} else if (sendMoneyParticleEffect) {
|
||||||
|
var recipientPosition = AvatarList.getAvatar(sendMoneyRecipient).position;
|
||||||
|
var distance = Vec3.distance(recipientPosition, MyAvatar.position);
|
||||||
|
var accel = Vec3.subtract(recipientPosition, MyAvatar.position);
|
||||||
|
accel.y -= 3.0;
|
||||||
|
var life = Math.sqrt(2 * distance / Vec3.length(accel));
|
||||||
|
Entities.editEntity(sendMoneyParticleEffect, {
|
||||||
|
emitAcceleration: accel,
|
||||||
|
lifespan: life
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteSendMoneyParticleEffect() {
|
||||||
|
if (sendMoneyParticleEffectUpdateTimer) {
|
||||||
|
Script.clearInterval(sendMoneyParticleEffectUpdateTimer);
|
||||||
|
sendMoneyParticleEffectUpdateTimer = null;
|
||||||
|
}
|
||||||
|
if (sendMoneyParticleEffect) {
|
||||||
|
sendMoneyParticleEffect = Entities.deleteEntity(sendMoneyParticleEffect);
|
||||||
|
}
|
||||||
|
sendMoneyRecipient = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Function Name: fromQml()
|
// Function Name: fromQml()
|
||||||
//
|
//
|
||||||
// Description:
|
// Description:
|
||||||
|
@ -534,6 +608,7 @@
|
||||||
// in the format "{method, params}", like json-rpc. See also sendToQml().
|
// in the format "{method, params}", like json-rpc. See also sendToQml().
|
||||||
var isHmdPreviewDisabled = true;
|
var isHmdPreviewDisabled = true;
|
||||||
var MARKETPLACES_INJECT_SCRIPT_URL = Script.resolvePath("../html/js/marketplacesInject.js");
|
var MARKETPLACES_INJECT_SCRIPT_URL = Script.resolvePath("../html/js/marketplacesInject.js");
|
||||||
|
|
||||||
function fromQml(message) {
|
function fromQml(message) {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case 'passphrasePopup_cancelClicked':
|
case 'passphrasePopup_cancelClicked':
|
||||||
|
@ -605,6 +680,19 @@
|
||||||
}
|
}
|
||||||
removeOverlays();
|
removeOverlays();
|
||||||
break;
|
break;
|
||||||
|
case 'sendMoney_sendPublicly':
|
||||||
|
deleteSendMoneyParticleEffect();
|
||||||
|
sendMoneyRecipient = message.recipient;
|
||||||
|
var amount = message.amount;
|
||||||
|
var props = SEND_MONEY_PARTICLE_PROPERTIES;
|
||||||
|
props.parentID = MyAvatar.sessionUUID;
|
||||||
|
props.position = MyAvatar.position;
|
||||||
|
props.position.y += 0.2;
|
||||||
|
sendMoneyParticleEffect = Entities.addEntity(props, true);
|
||||||
|
particleEffectTimestamp = Date.now();
|
||||||
|
updateSendMoneyParticleEffect();
|
||||||
|
sendMoneyParticleEffectUpdateTimer = Script.setInterval(updateSendMoneyParticleEffect, SEND_MONEY_PARTICLE_TIMER_UPDATE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print('Unrecognized message from QML:', JSON.stringify(message));
|
print('Unrecognized message from QML:', JSON.stringify(message));
|
||||||
}
|
}
|
||||||
|
@ -706,6 +794,7 @@
|
||||||
function shutdown() {
|
function shutdown() {
|
||||||
button.clicked.disconnect(onButtonClicked);
|
button.clicked.disconnect(onButtonClicked);
|
||||||
tablet.removeButton(button);
|
tablet.removeButton(button);
|
||||||
|
deleteSendMoneyParticleEffect();
|
||||||
if (tablet) {
|
if (tablet) {
|
||||||
tablet.screenChanged.disconnect(onTabletScreenChanged);
|
tablet.screenChanged.disconnect(onTabletScreenChanged);
|
||||||
if (onWalletScreen) {
|
if (onWalletScreen) {
|
||||||
|
|
|
@ -578,6 +578,7 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
case 'refreshConnections':
|
case 'refreshConnections':
|
||||||
case 'enable_ChooseRecipientNearbyMode':
|
case 'enable_ChooseRecipientNearbyMode':
|
||||||
case 'disable_ChooseRecipientNearbyMode':
|
case 'disable_ChooseRecipientNearbyMode':
|
||||||
|
case 'sendMoney_sendPublicly':
|
||||||
// NOP
|
// NOP
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue