Skip to content

Commit

Permalink
Display short url and normal one, small changes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Natsumi-sama committed Dec 5, 2021
1 parent 78bc71b commit b998e04
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 27 deletions.
9 changes: 7 additions & 2 deletions AppApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,14 @@ public void ShowVRForm()
}
}

public void SetVR(bool active, bool hmdOverlay, bool wristOverlay)
public void SetVR(bool active, bool hmdOverlay, bool wristOverlay, bool menuButton)
{
VRCXVR.Instance.SetActive(active, hmdOverlay, wristOverlay);
VRCXVR.Instance.SetActive(active, hmdOverlay, wristOverlay, menuButton);
}

public void TriggerLeftHand()
{
VRCXVR.Instance.TriggerLeftHand();
}

public void RefreshVR()
Expand Down
7 changes: 4 additions & 3 deletions VRCXVR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class VRCXVR
private bool _active;
private bool _hmdOverlayActive;
private bool _wristOverlayActive;
private bool _menuButton;

static VRCXVR()
{
Expand Down Expand Up @@ -245,11 +246,12 @@ private void ThreadLoop()

}

public void SetActive(bool active, bool hmdOverlay, bool wristOverlay)
public void SetActive(bool active, bool hmdOverlay, bool wristOverlay, bool menuButton)
{
_active = active;
_hmdOverlayActive = hmdOverlay;
_wristOverlayActive = wristOverlay;
_menuButton = menuButton;
}

public void Refresh()
Expand Down Expand Up @@ -300,7 +302,6 @@ internal void UpdateDevices(CVRSystem system, ref uint overlayIndex)
sb.Clear();
system.GetStringTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_TrackingSystemName_String, sb, (uint)sb.Capacity, ref err);
var isOculus = sb.ToString().IndexOf("oculus", StringComparison.OrdinalIgnoreCase) >= 0;
var button = "true".Equals(SharedVariable.Instance.Get("config:vrcx_overlaybutton"));
// Oculus : B/Y, Bit 1, Mask 2
// Oculus : A/X, Bit 7, Mask 128
// Vive : Menu, Bit 1, Mask 2,
Expand All @@ -310,7 +311,7 @@ internal void UpdateDevices(CVRSystem system, ref uint overlayIndex)
role == ETrackedControllerRole.RightHand)
{
if (system.GetControllerState(i, ref state, (uint)Marshal.SizeOf(state)) &&
(state.ulButtonPressed & (button ? 2u : (isOculus ? 128u : 4u))) != 0)
(state.ulButtonPressed & (_menuButton ? 2u : (isOculus ? 128u : 4u))) != 0)
{
if (role == ETrackedControllerRole.LeftHand)
{
Expand Down
66 changes: 45 additions & 21 deletions html/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8281,31 +8281,33 @@ speechSynthesis.getVoices();
) {
photonBots.unshift(id);
}
if (joinTime && joinTime + 10000 < dtNow && !hasInstantiated) {
if (isInvisible) {
if (!this.photonLobbyBots.includes(id)) {
this.addEntryPhotonEvent({
photonId: id,
displayName: ref.displayName,
userId: ref.id,
text: 'photon bot has joined',
text: 'has joined invisible',
created_at: new Date().toJSON()
});
}
photonBots.unshift(id);
}
if (isInvisible) {
} else if (avatarEyeHeight < 0) {
if (!this.photonLobbyBots.includes(id)) {
this.addEntryPhotonEvent({
photonId: id,
displayName: ref.displayName,
userId: ref.id,
text: 'has joined invisible',
text: 'photon bot has joined',
created_at: new Date().toJSON()
});
}
photonBots.unshift(id);
}
if (avatarEyeHeight < 0) {
} else if (
joinTime &&
joinTime + 10000 < dtNow &&
!hasInstantiated
) {
if (!this.photonLobbyBots.includes(id)) {
this.addEntryPhotonEvent({
photonId: id,
Expand Down Expand Up @@ -8439,6 +8441,11 @@ speechSynthesis.getVoices();
this.lookupUser(ref);
}
}
} else {
this.$message({
message: 'Missing user info',
type: 'error'
});
}
};

Expand Down Expand Up @@ -9074,6 +9081,10 @@ speechSynthesis.getVoices();
/VideoPlay\(PyPyDance\) "(.+?)",([\d.]+),([\d.]+),"(.+?)\s*(?:)?"/g.exec(
gameLog.data
);
if (!data) {
console.error('failed to parse', gameLog.data);
return;
}
var videoUrl = data[1];
var videoPos = Number(data[2]);
var videoLength = Number(data[3]);
Expand Down Expand Up @@ -9139,9 +9150,13 @@ speechSynthesis.getVoices();

$app.methods.addGameLogVRDancing = function (gameLog, location) {
var data =
/VideoPlay\(VRDancing\) "(.+?)",([\d.]+),([\d.]+),([\d.]+),"(.+?)","(.+?)"/g.exec(
/VideoPlay\(VRDancing\) "(.+?)",([\d.]+),([\d.]+),(-?[\d.]+),"(.+?)","(.+?)"/g.exec(
gameLog.data
);
if (!data) {
console.error('failed to parse', gameLog.data);
return;
}
var videoUrl = data[1];
var videoPos = Number(data[2]);
var videoLength = Number(data[3]);
Expand Down Expand Up @@ -9468,7 +9483,8 @@ speechSynthesis.getVoices();
appId = '784094509008551956';
bigIcon = 'pypy';
} else if (
L.worldId === 'wrld_42377cf1-c54f-45ed-8996-5875b0573a83'
L.worldId === 'wrld_42377cf1-c54f-45ed-8996-5875b0573a83' ||
L.worldId === 'wrld_dd6d2888-dbdc-47c2-bc98-3d631b2acd7c'
) {
appId = '846232616054030376';
bigIcon = 'vr_dancing';
Expand Down Expand Up @@ -9683,11 +9699,11 @@ speechSynthesis.getVoices();
params.tag = ref.tag;
}
if (!this.searchWorldLabs) {
if (params.tag) {
params.tag += ',system_approved';
} else {
params.tag = 'system_approved';
}
if (params.tag) {
params.tag += ',system_approved';
} else {
params.tag = 'system_approved';
}
}
// TODO: option.platform
this.searchWorldParams = params;
Expand Down Expand Up @@ -11214,7 +11230,7 @@ speechSynthesis.getVoices();
'sharedFeedFilters',
JSON.stringify(this.sharedFeedFilters)
);
this.updateVRConfigVars();
this.updateSharedFeed(true);
};

$app.methods.cancelSharedFeedFilters = function () {
Expand Down Expand Up @@ -11274,7 +11290,8 @@ speechSynthesis.getVoices();
$app.methods.isDanceWorld = function (location) {
var danceWorlds = [
'wrld_f20326da-f1ac-45fc-a062-609723b097b1',
'wrld_42377cf1-c54f-45ed-8996-5875b0573a83'
'wrld_42377cf1-c54f-45ed-8996-5875b0573a83',
'wrld_dd6d2888-dbdc-47c2-bc98-3d631b2acd7c'
];
var L = API.parseLocation(location);
if (danceWorlds.includes(L.worldId)) {
Expand Down Expand Up @@ -11384,10 +11401,15 @@ speechSynthesis.getVoices();
) {
hmdOverlay = true;
}
// active, hmdOverlay, wristOverlay
AppApi.SetVR(true, hmdOverlay, this.overlayWrist);
// active, hmdOverlay, wristOverlay, menuButton
AppApi.SetVR(
true,
hmdOverlay,
this.overlayWrist,
this.overlaybutton
);
} else {
AppApi.SetVR(false, false, false);
AppApi.SetVR(false, false, false, false);
}
};

Expand Down Expand Up @@ -14304,7 +14326,8 @@ speechSynthesis.getVoices();
loading: false,
desktop: configRepository.getBool('launchAsDesktop'),
location: '',
url: ''
url: '',
shortUrl: ''
};

$app.watch['launchDialog.desktop'] = function () {
Expand All @@ -14317,7 +14340,7 @@ speechSynthesis.getVoices();

API.$on('INSTANCE:SHORTNAME', function (args) {
var url = `https://vrch.at/${args.json}`;
$app.launchDialog.url = url;
$app.launchDialog.shortUrl = url;
});

$app.methods.showLaunchDialog = function (tag) {
Expand All @@ -14332,6 +14355,7 @@ speechSynthesis.getVoices();
} else {
D.location = L.worldId;
}
D.shortUrl = '';
D.url = getLaunchURL(L.worldId, L.instanceId);
D.visible = true;
API.getInstanceShortName({
Expand Down
5 changes: 4 additions & 1 deletion html/src/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,10 @@ html

//- dialog: launch
el-dialog.x-dialog(ref="launchDialog" :visible.sync="launchDialog.visible" title="Launch" width="400px")
div #[span(v-text="launchDialog.url" style="word-break:break-all;font-size:12px")]
div #[span(v-text="launchDialog.shortUrl" style="word-break:break-all;font-size:12px")]
el-tooltip(placement="top" content="Copy to clipboard" :disabled="hideTooltips")
el-button(@click="copyInstanceUrl(launchDialog.shortUrl)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle)
div(style="margin-top:10px") #[span(v-text="launchDialog.url" style="word-break:break-all;font-size:12px")]
el-tooltip(placement="top" content="Copy to clipboard" :disabled="hideTooltips")
el-button(@click="copyInstanceUrl(launchDialog.url)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle)
template(#footer)
Expand Down

0 comments on commit b998e04

Please sign in to comment.