mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-08 02:49:40 +02:00
Initial work
This commit is contained in:
parent
b3798553ed
commit
05fe33e417
2 changed files with 104 additions and 2 deletions
|
@ -308,6 +308,22 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "Particle" button
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: particle;
|
||||||
|
color: hifi.buttons.blue;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter;
|
||||||
|
anchors.top: nearbyButton.bottom;
|
||||||
|
anchors.topMargin: 24;
|
||||||
|
height: 50;
|
||||||
|
width: 160;
|
||||||
|
text: "Try Particles";
|
||||||
|
onClicked: {
|
||||||
|
sendSignalToWallet({method: 'sendMoney_sendPublicly', recipient: "{d90f0952-20c0-46b7-8851-92184db83e1f}", amount: 2});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Send Money Home END
|
// Send Money Home END
|
||||||
|
@ -967,7 +983,7 @@ Item {
|
||||||
|
|
||||||
HifiControlsUit.CheckBox {
|
HifiControlsUit.CheckBox {
|
||||||
id: sendPubliclyCheckbox;
|
id: sendPubliclyCheckbox;
|
||||||
visible: false; // FIXME ONCE PARTICLE EFFECTS ARE IN
|
visible: true;
|
||||||
text: "Send Publicly"
|
text: "Send Publicly"
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: messageContainer.bottom;
|
anchors.top: messageContainer.bottom;
|
||||||
|
@ -1035,7 +1051,11 @@ Item {
|
||||||
if (sendMoneyStep.referrer === "connections") {
|
if (sendMoneyStep.referrer === "connections") {
|
||||||
Commerce.transferHfcToUsername(sendMoneyStep.selectedRecipientUserName, parseInt(amountTextField.text), optionalMessage.text);
|
Commerce.transferHfcToUsername(sendMoneyStep.selectedRecipientUserName, parseInt(amountTextField.text), optionalMessage.text);
|
||||||
} else if (sendMoneyStep.referrer === "nearby") {
|
} else if (sendMoneyStep.referrer === "nearby") {
|
||||||
Commerce.transferHfcToNode(sendMoneyStep.selectedRecipientNodeID, parseInt(amountTextField.text), optionalMessage.text);
|
var transferAmount = parseInt(amountTextField.text);
|
||||||
|
Commerce.transferHfcToNode(sendMoneyStep.selectedRecipientNodeID, transferAmount, optionalMessage.text);
|
||||||
|
if (sendPubliclyCheckbox.checked) {
|
||||||
|
sendSignalToWallet({method: 'sendMoney_sendPublicly', recipient: sendMoneyStep.selectedRecipientNodeID, amount: transferAmount});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1533,6 +1553,7 @@ Item {
|
||||||
sendMoneyStep.selectedRecipientProfilePic = "";
|
sendMoneyStep.selectedRecipientProfilePic = "";
|
||||||
amountTextField.text = "";
|
amountTextField.text = "";
|
||||||
optionalMessage.text = "";
|
optionalMessage.text = "";
|
||||||
|
sendPubliclyCheckbox.checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -527,6 +527,69 @@
|
||||||
//
|
//
|
||||||
//***********************************************
|
//***********************************************
|
||||||
|
|
||||||
|
var sendMoneyParticleEffectUpdateTimer;
|
||||||
|
var sendMoneyParticleEffectDeleteTimer;
|
||||||
|
var sendMoneyParticleEffect;
|
||||||
|
var SEND_MONEY_PARTICLE_TIMER_UPDATE = 250;
|
||||||
|
var SEND_MONEY_PARTICLE_TIMER_TIMEOUT = 4000;
|
||||||
|
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: -3, z: 0 },
|
||||||
|
emitDimensions: { x: 0, y: 0, z: 0 },
|
||||||
|
emitOrientation: { x: 0, y: 0, z: 0 },
|
||||||
|
emitRate: 4.5,
|
||||||
|
emitSpeed: 2.1,
|
||||||
|
emitterShouldTrail: true,
|
||||||
|
isEmitting: 1,
|
||||||
|
lifespan: 3,
|
||||||
|
lifetime: 15,
|
||||||
|
maxParticles: 10,
|
||||||
|
name: 'hfc-particles',
|
||||||
|
particleRadius: 0.2,
|
||||||
|
polarFinish: 0,
|
||||||
|
polarStart: 0,
|
||||||
|
radiusFinish: 0,
|
||||||
|
radiusSpread: 0,
|
||||||
|
radiusStart: 0,
|
||||||
|
speedSpread: 0,
|
||||||
|
textures: "http://hifi-content.s3.amazonaws.com/alan/dev/Particles/Bokeh-Particle-HFC.png",
|
||||||
|
type: 'ParticleEffect'
|
||||||
|
};
|
||||||
|
|
||||||
|
function updateSendMoneyParticleEffect() {
|
||||||
|
if (sendMoneyParticleEffect) {
|
||||||
|
var accel = Vec3.subtract(AvatarList.getAvatar(recipient).position, MyAvatar.position);
|
||||||
|
accel.y -= 3.0;
|
||||||
|
Entities.editEntity(sendMoneyParticleEffect, {
|
||||||
|
emitAcceleration: accel
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteSendMoneyParticleEffect() {
|
||||||
|
if (sendMoneyParticleEffectDeleteTimer) {
|
||||||
|
Script.clearTimeout(sendMoneyParticleEffectDeleteTimer);
|
||||||
|
sendMoneyParticleEffectDeleteTimer = null;
|
||||||
|
}
|
||||||
|
if (sendMoneyParticleEffectUpdateTimer) {
|
||||||
|
Script.clearInterval(sendMoneyParticleEffectUpdateTimer);
|
||||||
|
sendMoneyParticleEffectUpdateTimer = null;
|
||||||
|
}
|
||||||
|
if (sendMoneyParticleEffect) {
|
||||||
|
sendMoneyParticleEffect = Entities.deleteEntity(sendMoneyParticleEffect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Function Name: fromQml()
|
// Function Name: fromQml()
|
||||||
//
|
//
|
||||||
// Description:
|
// Description:
|
||||||
|
@ -534,6 +597,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 +669,22 @@
|
||||||
}
|
}
|
||||||
removeOverlays();
|
removeOverlays();
|
||||||
break;
|
break;
|
||||||
|
case 'sendMoney_sendPublicly':
|
||||||
|
var recipient = message.recipient;
|
||||||
|
var amount = message.amount;
|
||||||
|
var props = SEND_MONEY_PARTICLE_PROPERTIES;
|
||||||
|
if (sendMoneyParticleEffect) {
|
||||||
|
deleteSendMoneyParticleEffect();
|
||||||
|
}
|
||||||
|
props.parentID = MyAvatar.sessionUUID;
|
||||||
|
props.emitAcceleration = Vec3.subtract(AvatarList.getAvatar(recipient).position, MyAvatar.position);
|
||||||
|
props.emitAcceleration.y -= 3.0;
|
||||||
|
props.position = MyAvatar.position;
|
||||||
|
props.position.y += 0.2;
|
||||||
|
sendMoneyParticleEffect = Entities.addEntity(props, true);
|
||||||
|
sendMoneyParticleEffectUpdateTimer = Script.setInterval(updateSendMoneyParticleEffect, SEND_MONEY_PARTICLE_TIMER_UPDATE);
|
||||||
|
sendMoneyParticleEffectDeleteTimer = Script.setTimeout(deleteSendMoneyParticleEffect, SEND_MONEY_PARTICLE_TIMER_TIMEOUT);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print('Unrecognized message from QML:', JSON.stringify(message));
|
print('Unrecognized message from QML:', JSON.stringify(message));
|
||||||
}
|
}
|
||||||
|
@ -706,6 +786,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) {
|
||||||
|
|
Loading…
Reference in a new issue