@everymatrix/player-reality-check 0.0.162 → 0.0.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/player-reality-check",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.166",
|
|
4
4
|
"main": "dist/player-reality-check.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "cc5cea8f5d4ed68bf0b052d98cc82ce69e97fc45"
|
|
40
40
|
}
|
|
@@ -1,32 +1,75 @@
|
|
|
1
1
|
<svelte:options tag={null} />
|
|
2
|
+
|
|
2
3
|
<script lang="typescript">
|
|
4
|
+
import { onMount } from "svelte";
|
|
3
5
|
import { getDevice } from 'rvhelper';
|
|
4
6
|
|
|
7
|
+
export let realitycheck:any = '';
|
|
8
|
+
|
|
5
9
|
let userAgent:String = window.navigator.userAgent;
|
|
6
10
|
let isMobile = (getDevice(userAgent) === 'PC') ? false : true;
|
|
7
|
-
let frequency = '
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
let frequency = '';
|
|
12
|
+
let receivedData:any = {};
|
|
13
|
+
let realityCheckData:any = {};
|
|
14
|
+
|
|
15
|
+
let realityCheckSuccess:boolean = false;
|
|
16
|
+
let realityCheckSuccessMessage:string = 'Reality check ha been successfully updated.';
|
|
17
|
+
|
|
18
|
+
let realityCheckOptions = [
|
|
19
|
+
{value: '0', text: 'Never'},
|
|
20
|
+
{value: '60', text: '1 Hour'},
|
|
21
|
+
{value: '120', text: '2 Hours'},
|
|
22
|
+
{value: '180', text: '3 Hours'},
|
|
23
|
+
{value: '240', text: '4 Hours'}
|
|
15
24
|
]
|
|
16
25
|
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
// Send Frequency period and date
|
|
27
|
+
const submitFrequency = () => {
|
|
28
|
+
window.postMessage({ type: 'SubmittedRealityCheck', realityCheckUpdatedValue: frequency }, window.location.href);
|
|
29
|
+
}
|
|
21
30
|
|
|
22
31
|
const toggleScreen = () => {
|
|
23
32
|
window.postMessage({ type: 'ReturnToMenu' }, window.location.href);
|
|
24
33
|
}
|
|
25
34
|
|
|
35
|
+
const initialLoad = () => {
|
|
36
|
+
if(realitycheck) {
|
|
37
|
+
frequency = realitycheck;
|
|
38
|
+
} else {
|
|
39
|
+
frequency = realityCheckOptions[0].value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const messageHandler = (e:any) => {
|
|
44
|
+
if (e.data) {
|
|
45
|
+
switch(e.data.type) {
|
|
46
|
+
case 'RealityCheckValueUpdated':
|
|
47
|
+
realityCheckSuccess = true;
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
realityCheckSuccess = false;
|
|
50
|
+
}, 2000)
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onMount(() => {
|
|
57
|
+
window.addEventListener('message', messageHandler, false);
|
|
58
|
+
|
|
59
|
+
return () => {
|
|
60
|
+
window.removeEventListener('message', messageHandler);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
$: realitycheck && initialLoad();
|
|
26
65
|
</script>
|
|
27
66
|
|
|
67
|
+
|
|
28
68
|
<div class="PlayerRealityCheckWrapper { isMobile ? 'PlayerRealityCheckWrapperMobile' : '' }">
|
|
29
69
|
{#if isMobile}
|
|
70
|
+
{#if realityCheckSuccess}
|
|
71
|
+
<div class="successMessageMobile">{realityCheckSuccessMessage}</div>
|
|
72
|
+
{/if}
|
|
30
73
|
<div class="MenuReturnButton" on:click={() => toggleScreen()}>
|
|
31
74
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><defs><style>.aaa{fill:#d0046c;}</style></defs><g transform="translate(-20 -158)">
|
|
32
75
|
<g transform="translate(20 158)">
|
|
@@ -36,13 +79,15 @@
|
|
|
36
79
|
<h2 class="RealityCheckTitleMobile">Reality Check</h2>
|
|
37
80
|
</div>
|
|
38
81
|
{/if}
|
|
39
|
-
|
|
82
|
+
{#if realityCheckSuccess}
|
|
83
|
+
<div class="successMessage {isMobile ? 'successMessageMobile' : ''}">{realityCheckSuccessMessage}</div>
|
|
84
|
+
{/if}
|
|
40
85
|
<h2 class="RealityCheckTitle {isMobile ? 'RealityCheckTitleNone' : ''}">Reality Check</h2>
|
|
41
86
|
<div class="RealityCheckDescription {isMobile ? 'RealityCheckDescriptionMobile' : ''}">
|
|
42
87
|
<p>The Reality Check facility allows you to set the frequency at which you will see a Reality Check on the screen within your gaming session. A Reality Check means a display of the time elapsed since your session began.<br><br>
|
|
43
88
|
You are able to control the frequency at which the Reality Check will appear on your screen.</p>
|
|
44
89
|
<form class="customRadio">
|
|
45
|
-
{#each
|
|
90
|
+
{#each realityCheckOptions as {value, text}, idx}
|
|
46
91
|
<div>
|
|
47
92
|
<input type="radio" id="{value}" {value} bind:group={frequency} />
|
|
48
93
|
<label for="{value}">{text}</label>
|
|
@@ -51,7 +96,7 @@
|
|
|
51
96
|
</form>
|
|
52
97
|
</div>
|
|
53
98
|
<div class="BottomButtonsArea {isMobile ? 'BottomButtonsAreaMobile' : ''}">
|
|
54
|
-
<button class="PlayerRealityCheckButton">Set frequency</button>
|
|
99
|
+
<button class="PlayerRealityCheckButton" on:click={() => submitFrequency()}>Set frequency</button>
|
|
55
100
|
</div>
|
|
56
101
|
</div>
|
|
57
102
|
|
|
@@ -64,6 +109,33 @@
|
|
|
64
109
|
@return $value * $multiplicator;
|
|
65
110
|
}
|
|
66
111
|
|
|
112
|
+
.successMessage {
|
|
113
|
+
position: absolute;
|
|
114
|
+
display: block;
|
|
115
|
+
top: 25px;
|
|
116
|
+
left: 50px;
|
|
117
|
+
background: #16CE16;
|
|
118
|
+
font-size: 14px;
|
|
119
|
+
border-radius: 5px;
|
|
120
|
+
padding: 10px;
|
|
121
|
+
color: #FFF;
|
|
122
|
+
&.successMessageMobile {
|
|
123
|
+
display: none;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.successMessageMobile {
|
|
128
|
+
display: block;
|
|
129
|
+
background: #16CE16;
|
|
130
|
+
font-size: 14px;
|
|
131
|
+
border-radius: 5px;
|
|
132
|
+
padding: 10px;
|
|
133
|
+
color: #FFF;
|
|
134
|
+
&.successMessage {
|
|
135
|
+
display: none;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
67
139
|
.TextContainer {
|
|
68
140
|
display: flex;
|
|
69
141
|
flex-direction: column;
|
|
@@ -72,7 +144,7 @@
|
|
|
72
144
|
|
|
73
145
|
// Custom Radio Button
|
|
74
146
|
.customRadio {
|
|
75
|
-
margin-top:
|
|
147
|
+
margin-top: 15px;
|
|
76
148
|
}
|
|
77
149
|
|
|
78
150
|
.customRadio div {
|
|
@@ -140,6 +212,7 @@
|
|
|
140
212
|
}
|
|
141
213
|
|
|
142
214
|
.PlayerRealityCheckWrapper {
|
|
215
|
+
position: relative;
|
|
143
216
|
color: #07072A;
|
|
144
217
|
padding: 50px;
|
|
145
218
|
max-width: 760px;
|