ULTRACOMBOS-DEV 2 months ago
commit 58d92642f1
  1. 14
      vite/public/cuelist_0923.json
  2. 19
      vite/src/pages/flow_free.jsx
  3. 49
      vite/src/util/useUser.jsx

@ -48,7 +48,8 @@
"audioFile": "assets/combine/Q4-0-1.mp3",
"nextcue": 4.1,
"callback":"numpad",
"numpad_type":"userid"
"numpad_type":"userid",
"input_time": 20000
},
{
"id": 4.1,
@ -126,8 +127,9 @@
"description": "discard"
}
},
"hint":"保留,請按1\n刪除,請按9\n確定,請按#",
"hint_time": 21800,
"hint":"保留,請按1\n刪除,請按9\n確定輸入後,請按#",
"hint_time":13000,
"input_time":18000,
"nextcue":5.4
},
{
@ -141,7 +143,8 @@
"callback":"numpad",
"numpad_type":"password",
"hint":"請輸入四位數密碼\n確定輸入後,請按#",
"hint_time": 7800,
"hint_time": 3000,
"input_time":11000,
"default_password":"0000"
},
{
@ -155,7 +158,8 @@
"callback":"numpad",
"numpad_type":"password",
"hint":"請輸入四位數密碼\n確定輸入後,請按#",
"hint_time": 7900,
"hint_time": 3000,
"input_time":11000,
"default_password":"0000"
},
{

@ -60,7 +60,7 @@ export function FreeFlow(){
const [padInput, setPadInput] = useState(null);
const [showMessage, setShowMessage] = useState(false);
const [inputReady, setInputReady] = useState(false);
const { userId, setUserId, getFileId, setPassword, reset:resetUser, uploadHistory, setSummary, summary,setChoice,choice, getUploadFolder,getDataId, writeSheet } = useUser();
@ -83,6 +83,7 @@ export function FreeFlow(){
const refData=useRef(data);
const refHintTimeout=useRef();
const refInputTimeout=useRef();
const refFadeOutInterval=useRef();
const refVolDownInterval=useRef();
@ -431,9 +432,19 @@ export function FreeFlow(){
if(cue.hint!=null && cue.hint_time!=null){
refHintTimeout.current=setTimeout(()=>{
sendOsc(OSC_ADDRESS.HINT, cue.hint); // Send OSC hint message
}, cue.hint_time);
}
setInputReady(false);
if(cue.input_time!=null){
if(refInputTimeout.current) clearTimeout(refInputTimeout.current);
refInputTimeout.current=setTimeout(()=>{
setInputReady(()=>true);
}, cue.input_time);
}
if(cue.audioFile){
playAudio(cue.audioFile);
}
@ -857,7 +868,7 @@ export function FreeFlow(){
<span className="">{localIP || '...'}</span>
</div>
<DebugControl onReset={resetData}/>
<div className="w-full p-2 grid grid-cols-4 gap-2 items-stretch justify-center *:max-h-[5rem]">
<div className="w-full p-2 grid grid-cols-3 gap-2 items-stretch justify-center *:max-h-[5rem]">
<div className="bg-gray-100 text-4xl font-bold mb-4 flex justify-center items-center">
{refCurrentCue.current?.name}
</div>
@ -866,12 +877,12 @@ export function FreeFlow(){
{/* <button onClick={saveImage}>Save image</button> */}
<NumPad onSend={onNumpad}
disabled={currentCue?.callback !== 'numpad'}
disabled={currentCue?.callback !== 'numpad' || !inputReady}
type={currentCue?.numpad_type}
clientId={data?.id}
/>
{/* <Light ref={refLight} /> */}
<VoiceAnalysis/>
{/* <VoiceAnalysis/> */}
{/* <div className="flex flex-col">
<label className="text-center">Voice</label>

@ -6,12 +6,12 @@ import { useData } from "./useData";
const userContext=createContext();
const SessionTime={
A:["12:00", "13:30"],
B:["13:30", "15:00"],
C:["15:00", "17:30"],
D:["17:30", "19:00"],
E:["19:00", "20:30"],
F:["20:30", "22:00"]
"1200":["13:00", "14:00"],
"1330":["14:20", "15:30"],
"1500":["16:00", "17:00"],
"1730":["18:30", "19:30"],
"1900":["20:00", "21:00"],
"2030":["21:30", "23:00"]
}
@ -28,9 +28,7 @@ export function UserProvider({children}) {
const {data}=useData();
function getSessionId(){
return `${SessionTime[sessionId]!=null? SessionTime[sessionId][0].replace(':',''):'no-session'}`;
}
function getFileId(){
if(!userId){
if(data?.id){
@ -115,20 +113,31 @@ export function UserProvider({children}) {
});
},[choice, summary, refPassword.current]);
useEffect(() => {
let symbol='';
for(const [key, value] of Object.entries(SessionTime)){
function getSessionId(time){
let symbol='no-session';
for(const [key, value] of Object.entries(SessionTime)){
const start=moment(value[0], "HH:mm");
const end=moment(value[1], "HH:mm");
if(moment().isBetween(start, end)){
symbol=key;
break;
if(time){
const checkTime=moment(time, "HH:mm");
if(checkTime.isBetween(start, end)){
return key;
}
}else{
if(moment().isBetween(start, end)){
symbol=key;
break;
}
}
}
return symbol;
}
useEffect(() => {
const symbol=getSessionId();
setSessionId(symbol);
@ -137,6 +146,10 @@ export function UserProvider({children}) {
console.log("Session ID changed:", sessionId);
}, [sessionId]);
// console.log(getSessionId(), getSessionId("13:12"), getSessionId("14:55"), getSessionId("2213"));
// useEffect(()=>{
// refChoice.current=choice;
// console.log("Choice changed:", choice);

Loading…
Cancel
Save