navigate to BodyMart / AvatarIsland on 'get avatars' / 'get wearables'

This commit is contained in:
Alexander Ivash 2018-05-14 22:46:49 +03:00
parent 3baa1a588f
commit 4ce8e29d97
2 changed files with 14 additions and 83 deletions

View file

@ -430,7 +430,7 @@ Rectangle {
}
popup.showGetWearables(function() {
gotoAvatarAppPanel.visible = true;
emitSendToScript({'method' : 'navigate', 'url' : 'hifi://AvatarIsland'})
})
}
}
@ -674,7 +674,7 @@ Rectangle {
onClicked: {
popup.showBuyAvatars(function() {
gotoAvatarAppPanel.visible = true;
emitSendToScript({'method' : 'navigate', 'url' : 'hifi://BodyMart'})
});
}
}
@ -742,76 +742,4 @@ Rectangle {
CreateFavoriteDialog {
id: createFavorite
}
Rectangle {
id: gotoAvatarAppPanel
anchors.fill: parent
anchors.leftMargin: 19
anchors.rightMargin: 19
// color: 'green'
visible: false
Rectangle {
width: 442
height: 447
// color: 'yellow'
anchors.bottom: parent.bottom
anchors.bottomMargin: 259
TextStyle1 {
anchors.fill: parent
horizontalAlignment: "AlignHCenter"
wrapMode: "WordWrap"
text: "You are teleported to “AvatarIsland” VR world and you buy a hat, sunglasses and a bracelet."
}
}
Rectangle {
width: 442
height: 177
// color: 'yellow'
anchors.bottom: parent.bottom
anchors.bottomMargin: 40
TextStyle1 {
anchors.fill: parent
horizontalAlignment: "AlignHCenter"
wrapMode: "WordWrap"
text: '<a href="https://fake.link">Click here to open the Avatar app.</a>'
MouseArea {
anchors.fill: parent
property int newAvatarIndex: 0
onClicked: {
gotoAvatarAppPanel.visible = false;
var i = allAvatars.count + 1;
var avatar = {
'url': '',
'name': 'Lexi' + (++newAvatarIndex),
'wearables': []
};
allAvatars.append(avatar)
if(pageOfAvatars.hasGetAvatars())
pageOfAvatars.removeGetAvatars();
if(pageOfAvatars.count !== view.itemsPerPage)
pageOfAvatars.append(avatar);
if(pageOfAvatars.count !== view.itemsPerPage)
pageOfAvatars.appendGetAvatars();
console.debug('avatar appended: allAvatars.count: ', allAvatars.count, 'pageOfAvatars.count: ', pageOfAvatars.count);
}
}
}
}
}
}

View file

@ -128,15 +128,6 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
console.debug('avatarapp.js: currentAvatar: ', JSON.stringify(message.reply.currentAvatar, null, '\t'))
sendToQml(message)
break;
case 'adjustWearable':
if(message.properties.localRotationAngles) {
message.properties.localRotation = Quat.fromVec3Degrees(message.properties.localRotationAngles)
}
console.debug('Entities.editEntity(message.entityID, message.properties)'.replace('message.entityID', message.entityID).replace('message.properties', JSON.stringify(message.properties)));
Entities.editEntity(message.entityID, message.properties);
sendToQml({'method' : 'wearableUpdated', 'wearable' : message.entityID, wearableIndex : message.wearableIndex, properties : message.properties})
break;
case 'selectAvatar':
console.debug('avatarapp.js: selecting avatar: ', message.name);
AvatarBookmarks.loadBookmark(message.name);
@ -149,6 +140,14 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
console.debug('avatarapp.js: saving avatar: ', message.name);
AvatarBookmarks.addBookmark(message.name);
break;
case 'adjustWearable':
if(message.properties.localRotationAngles) {
message.properties.localRotation = Quat.fromVec3Degrees(message.properties.localRotationAngles)
}
console.debug('Entities.editEntity(message.entityID, message.properties)'.replace('message.entityID', message.entityID).replace('message.properties', JSON.stringify(message.properties)));
Entities.editEntity(message.entityID, message.properties);
sendToQml({'method' : 'wearableUpdated', 'wearable' : message.entityID, wearableIndex : message.wearableIndex, properties : message.properties})
break;
case 'adjustWearablesOpened':
console.debug('avatarapp.js: adjustWearablesOpened');
@ -190,6 +189,10 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
UserActivityLogger.palAction("display_name_change", message.displayName);
}
break;
case 'navigate':
console.debug('avatarapp.js: navigate: ', message.url);
AddressManager.handleLookupString(message.url, false);
break;
default:
print('Unrecognized message from AvatarApp.qml:', JSON.stringify(message));
}