mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 18:30:42 +02:00
added notifications (faked user name for now), along with switch to avatar entities
This commit is contained in:
parent
0edcdde746
commit
76657a670c
4 changed files with 32 additions and 5 deletions
|
@ -235,6 +235,14 @@ void WindowScriptingInterface::shareSnapshot(const QString& path, const QUrl& hr
|
||||||
qApp->shareSnapshot(path, href);
|
qApp->shareSnapshot(path, href);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowScriptingInterface::makeConnection(bool success, const QString& userNameOrError) {
|
||||||
|
if (success) {
|
||||||
|
emit connectionAdded(userNameOrError);
|
||||||
|
} else {
|
||||||
|
emit connectionError(userNameOrError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool WindowScriptingInterface::isPhysicsEnabled() {
|
bool WindowScriptingInterface::isPhysicsEnabled() {
|
||||||
return qApp->isPhysicsEnabled();
|
return qApp->isPhysicsEnabled();
|
||||||
}
|
}
|
||||||
|
@ -255,7 +263,7 @@ int WindowScriptingInterface::openMessageBox(QString title, QString text, int bu
|
||||||
}
|
}
|
||||||
|
|
||||||
int WindowScriptingInterface::createMessageBox(QString title, QString text, int buttons, int defaultButton) {
|
int WindowScriptingInterface::createMessageBox(QString title, QString text, int buttons, int defaultButton) {
|
||||||
auto messageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION, title, text,
|
auto messageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION, title, text,
|
||||||
static_cast<QFlags<QMessageBox::StandardButton>>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
|
static_cast<QFlags<QMessageBox::StandardButton>>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
|
||||||
connect(messageBox, SIGNAL(selected(int)), this, SLOT(onMessageBoxSelected(int)));
|
connect(messageBox, SIGNAL(selected(int)), this, SLOT(onMessageBoxSelected(int)));
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ public slots:
|
||||||
void showAssetServer(const QString& upload = "");
|
void showAssetServer(const QString& upload = "");
|
||||||
void copyToClipboard(const QString& text);
|
void copyToClipboard(const QString& text);
|
||||||
void takeSnapshot(bool notify = true, bool includeAnimated = false, float aspectRatio = 0.0f);
|
void takeSnapshot(bool notify = true, bool includeAnimated = false, float aspectRatio = 0.0f);
|
||||||
|
void makeConnection(bool success, const QString& userNameOrError);
|
||||||
void shareSnapshot(const QString& path, const QUrl& href = QUrl(""));
|
void shareSnapshot(const QString& path, const QUrl& href = QUrl(""));
|
||||||
bool isPhysicsEnabled();
|
bool isPhysicsEnabled();
|
||||||
|
|
||||||
|
@ -74,6 +75,9 @@ signals:
|
||||||
void snapshotShared(const QString& error);
|
void snapshotShared(const QString& error);
|
||||||
void processingGif();
|
void processingGif();
|
||||||
|
|
||||||
|
void connectionAdded(const QString& connectionName);
|
||||||
|
void connectionError(const QString& errorString);
|
||||||
|
|
||||||
void messageBoxClosed(int id, int button);
|
void messageBoxClosed(int id, int button);
|
||||||
|
|
||||||
// triggered when window size or position changes
|
// triggered when window size or position changes
|
||||||
|
|
|
@ -271,7 +271,8 @@ function updateVisualization() {
|
||||||
particleProps = PARTICLE_EFFECT_PROPS;
|
particleProps = PARTICLE_EFFECT_PROPS;
|
||||||
particleProps.isEmitting = 0;
|
particleProps.isEmitting = 0;
|
||||||
particleProps.position = calcParticlePos(myHandPosition, otherHand, otherOrientation);
|
particleProps.position = calcParticlePos(myHandPosition, otherHand, otherOrientation);
|
||||||
particleEffect = Entities.addEntity(particleProps);
|
particleProps.parentID = MyAvatar.sessionUUID;
|
||||||
|
particleEffect = Entities.addEntity(particleProps, true);
|
||||||
} else {
|
} else {
|
||||||
particleProps.position = calcParticlePos(myHandPosition, otherHand, otherOrientation);
|
particleProps.position = calcParticlePos(myHandPosition, otherHand, otherOrientation);
|
||||||
particleProps.isEmitting = 1;
|
particleProps.isEmitting = 1;
|
||||||
|
@ -279,10 +280,11 @@ function updateVisualization() {
|
||||||
}
|
}
|
||||||
if (!makingConnectionParticleEffect) {
|
if (!makingConnectionParticleEffect) {
|
||||||
var props = MAKING_CONNECTION_PARTICLE_PROPS;
|
var props = MAKING_CONNECTION_PARTICLE_PROPS;
|
||||||
|
props.parentID = MyAvatar.sessionUUID;
|
||||||
makingConnectionEmitRate = 2000;
|
makingConnectionEmitRate = 2000;
|
||||||
props.emitRate = makingConnectionEmitRate;
|
props.emitRate = makingConnectionEmitRate;
|
||||||
props.position = myHandPosition;
|
props.position = myHandPosition;
|
||||||
makingConnectionParticleEffect = Entities.addEntity(props);
|
makingConnectionParticleEffect = Entities.addEntity(props, true);
|
||||||
} else {
|
} else {
|
||||||
makingConnectionEmitRate *= 0.5;
|
makingConnectionEmitRate *= 0.5;
|
||||||
Entities.editEntity(makingConnectionParticleEffect, {emitRate: makingConnectionEmitRate, position: myHandPosition, isEmitting: 1});
|
Entities.editEntity(makingConnectionParticleEffect, {emitRate: makingConnectionEmitRate, position: myHandPosition, isEmitting: 1});
|
||||||
|
@ -485,7 +487,6 @@ function makeConnection(id) {
|
||||||
// probably, in which we do this.
|
// probably, in which we do this.
|
||||||
Controller.triggerHapticPulse(HAPTIC_DATA.background.strength, MAKING_CONNECTION_TIMEOUT, handToHaptic(currentHand));
|
Controller.triggerHapticPulse(HAPTIC_DATA.background.strength, MAKING_CONNECTION_TIMEOUT, handToHaptic(currentHand));
|
||||||
|
|
||||||
// now that we made connection, reset everything
|
|
||||||
makingFriendsTimeout = Script.setTimeout(function () {
|
makingFriendsTimeout = Script.setTimeout(function () {
|
||||||
if (!successfulHandshakeInjector) {
|
if (!successfulHandshakeInjector) {
|
||||||
successfulHandshakeInjector = Audio.playSound(successfulHandshakeSound, {position: getHandPosition(MyAvatar, currentHand), volume: 0.5, localOnly: true});
|
successfulHandshakeInjector = Audio.playSound(successfulHandshakeSound, {position: getHandPosition(MyAvatar, currentHand), volume: 0.5, localOnly: true});
|
||||||
|
@ -494,6 +495,8 @@ function makeConnection(id) {
|
||||||
}
|
}
|
||||||
Controller.triggerHapticPulse(HAPTIC_DATA.success.strength, HAPTIC_DATA.success.duration, handToHaptic(currentHand));
|
Controller.triggerHapticPulse(HAPTIC_DATA.success.strength, HAPTIC_DATA.success.duration, handToHaptic(currentHand));
|
||||||
// don't change state (so animation continues while gripped)
|
// don't change state (so animation continues while gripped)
|
||||||
|
// but do send a notification, by calling the slot that emits the signal for it
|
||||||
|
Window.makeConnection(true, "otherGuy"); // this is successful, unsucessful would be false, errorString
|
||||||
}, MAKING_CONNECTION_TIMEOUT);
|
}, MAKING_CONNECTION_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,11 +94,13 @@ var NotificationType = {
|
||||||
LOD_WARNING: 2,
|
LOD_WARNING: 2,
|
||||||
CONNECTION_REFUSED: 3,
|
CONNECTION_REFUSED: 3,
|
||||||
EDIT_ERROR: 4,
|
EDIT_ERROR: 4,
|
||||||
|
CONNECTION: 5,
|
||||||
properties: [
|
properties: [
|
||||||
{ text: "Snapshot" },
|
{ text: "Snapshot" },
|
||||||
{ text: "Level of Detail" },
|
{ text: "Level of Detail" },
|
||||||
{ text: "Connection Refused" },
|
{ text: "Connection Refused" },
|
||||||
{ text: "Edit error" }
|
{ text: "Edit error" },
|
||||||
|
{ text: "Connection" }
|
||||||
],
|
],
|
||||||
getTypeFromMenuItem: function(menuItemName) {
|
getTypeFromMenuItem: function(menuItemName) {
|
||||||
if (menuItemName.substr(menuItemName.length - NOTIFICATION_MENU_ITEM_POST.length) !== NOTIFICATION_MENU_ITEM_POST) {
|
if (menuItemName.substr(menuItemName.length - NOTIFICATION_MENU_ITEM_POST.length) !== NOTIFICATION_MENU_ITEM_POST) {
|
||||||
|
@ -539,6 +541,14 @@ function processingGif() {
|
||||||
createNotification("Processing GIF snapshot...", NotificationType.SNAPSHOT);
|
createNotification("Processing GIF snapshot...", NotificationType.SNAPSHOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function connectionAdded(connectionName) {
|
||||||
|
createNotification(wordWrap("Successfully connected to " + connectionName), NotificationType.CONNECTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
function connectionError(error) {
|
||||||
|
createNotification(wordWrap("Error trying to make connection: " + error), NotificationType.CONNECTION);
|
||||||
|
}
|
||||||
|
|
||||||
// handles mouse clicks on buttons
|
// handles mouse clicks on buttons
|
||||||
function mousePressEvent(event) {
|
function mousePressEvent(event) {
|
||||||
var pickRay,
|
var pickRay,
|
||||||
|
@ -639,6 +649,8 @@ Menu.menuItemEvent.connect(menuItemEvent);
|
||||||
Window.domainConnectionRefused.connect(onDomainConnectionRefused);
|
Window.domainConnectionRefused.connect(onDomainConnectionRefused);
|
||||||
Window.snapshotTaken.connect(onSnapshotTaken);
|
Window.snapshotTaken.connect(onSnapshotTaken);
|
||||||
Window.processingGif.connect(processingGif);
|
Window.processingGif.connect(processingGif);
|
||||||
|
Window.connectionAdded.connect(connectionAdded);
|
||||||
|
Window.connectionError.connect(connectionError);
|
||||||
Window.notifyEditError = onEditError;
|
Window.notifyEditError = onEditError;
|
||||||
Window.notify = onNotify;
|
Window.notify = onNotify;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue