Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
V
VRClassroom
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Danny Pires
VRClassroom
Commits
de7c8ba5
Commit
de7c8ba5
authored
Mar 01, 2021
by
Geovanny Vera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Schedule widget with API calls done
parent
54ec0503
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
83 additions
and
78 deletions
+83
-78
DefaultInput.ini
src/Config/DefaultInput.ini
+31
-31
Login.umap
src/Content/Campus/Maps/Login.umap
+0
-0
Login_BuiltData.uasset
src/Content/Campus/Maps/Login_BuiltData.uasset
+0
-0
MotionControllerPawn.uasset
...t/VirtualRealityBP/Blueprints/MotionControllerPawn.uasset
+0
-0
main.js
src/Instancing/main.js
+1
-1
HttpService.cpp
src/Source/VRClassroom/Private/HttpService.cpp
+15
-6
VRCGameInstance.cpp
src/Source/VRClassroom/Private/VRCGameInstance.cpp
+1
-0
VRCPlayerController.cpp
src/Source/VRClassroom/Private/VRCPlayerController.cpp
+13
-15
VRCScheduleWidget.cpp
src/Source/VRClassroom/Private/VRCScheduleWidget.cpp
+15
-24
HttpService.h
src/Source/VRClassroom/Public/HttpService.h
+7
-1
No files found.
src/Config/DefaultInput.ini
View file @
de7c8ba5
...
@@ -158,43 +158,13 @@ DoubleClickTime=0.200000
...
@@ -158,43 +158,13 @@ DoubleClickTime=0.200000
+
ActionMappings
=
(ActionName="TriggerRight",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouch_Right_Trigger_Click)
+
ActionMappings
=
(ActionName="TriggerRight",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouch_Right_Trigger_Click)
+
ActionMappings
=
(ActionName="TriggerLeft",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouch_Left_Trigger_Click)
+
ActionMappings
=
(ActionName="TriggerLeft",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouch_Left_Trigger_Click)
+
ActionMappings
=
(ActionName="TeleportRight",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
+
ActionMappings
=
(ActionName="TeleportRight",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
+
AxisMappings
=
(AxisName="TeleportDirectionUp",Scale=1.000000,Key=Gamepad_LeftY)
+
AxisMappings
=
(AxisName="TeleportDirectionRight",Scale=1.000000,Key=Gamepad_LeftX)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=Vive_Left_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=OculusTouch_Left_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=ValveIndex_Left_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=MixedReality_Left_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=OculusGo_Left_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=Vive_Left_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=OculusTouch_Left_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=ValveIndex_Left_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=MixedReality_Left_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=OculusGo_Left_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=Vive_Right_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=OculusTouch_Right_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=ValveIndex_Right_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=MixedReality_Right_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=OculusGo_Right_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=Vive_Right_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=OculusTouch_Right_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=ValveIndex_Right_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=MixedReality_Right_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=OculusGo_Right_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=Daydream_Left_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=Daydream_Left_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=Daydream_Right_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=Daydream_Right_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=MagicLeap_Right_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=MagicLeap_Right_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=MagicLeap_Left_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=MagicLeap_Left_Trackpad_X)
+
ActionMappings
=
(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
+
ActionMappings
=
(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
+
ActionMappings
=
(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_FaceButton_Bottom)
+
ActionMappings
=
(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_FaceButton_Bottom)
+
ActionMappings
=
(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Left_Trigger)
+
ActionMappings
=
(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Left_Trigger)
+
ActionMappings
=
(ActionName="ResetVR",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=R)
+
ActionMappings
=
(ActionName="ResetVR",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=R)
+
ActionMappings
=
(ActionName="ResetVR",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Left_Grip1)
+
ActionMappings
=
(ActionName="ResetVR",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Left_Grip1)
+
ActionMappings
=
(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Right_Trigger)
+
ActionMappings
=
(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Right_Trigger)
+
ActionMappings
=
(ActionName="
UseAbility1",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=One
)
+
ActionMappings
=
(ActionName="
ToggleKeyboard",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouch_Right_B_Click
)
+
ActionMappings
=
(ActionName="UseAbility2",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Two)
+
ActionMappings
=
(ActionName="UseAbility2",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Two)
+
ActionMappings
=
(ActionName="UseAbility3",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Three)
+
ActionMappings
=
(ActionName="UseAbility3",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Three)
+
ActionMappings
=
(ActionName="UseAbility4",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Four)
+
ActionMappings
=
(ActionName="UseAbility4",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Four)
...
@@ -234,6 +204,36 @@ DoubleClickTime=0.200000
...
@@ -234,6 +204,36 @@ DoubleClickTime=0.200000
+
ActionMappings
=
(ActionName="ClearTarget",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=BackSpace)
+
ActionMappings
=
(ActionName="ClearTarget",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=BackSpace)
+
ActionMappings
=
(ActionName="SelectTargetOrPressSwitch",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=RightMouseButton)
+
ActionMappings
=
(ActionName="SelectTargetOrPressSwitch",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=RightMouseButton)
+
ActionMappings
=
(ActionName="TeleportOutOfDungeon",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=T)
+
ActionMappings
=
(ActionName="TeleportOutOfDungeon",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=T)
+
AxisMappings
=
(AxisName="TeleportDirectionUp",Scale=1.000000,Key=Gamepad_LeftY)
+
AxisMappings
=
(AxisName="TeleportDirectionRight",Scale=1.000000,Key=Gamepad_LeftX)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=Vive_Left_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=OculusTouch_Left_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=ValveIndex_Left_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=MixedReality_Left_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=OculusGo_Left_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=Vive_Left_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=OculusTouch_Left_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=ValveIndex_Left_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=MixedReality_Left_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=OculusGo_Left_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=Vive_Right_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=OculusTouch_Right_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=ValveIndex_Right_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=MixedReality_Right_Thumbstick_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=OculusGo_Right_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=Vive_Right_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=OculusTouch_Right_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=ValveIndex_Right_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=MixedReality_Right_Thumbstick_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=OculusGo_Right_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=Daydream_Left_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=Daydream_Left_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=Daydream_Right_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=Daydream_Right_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_Y",Scale=1.000000,Key=MagicLeap_Right_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbRight_X",Scale=1.000000,Key=MagicLeap_Right_Trackpad_X)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_Y",Scale=1.000000,Key=MagicLeap_Left_Trackpad_Y)
+
AxisMappings
=
(AxisName="MotionControllerThumbLeft_X",Scale=1.000000,Key=MagicLeap_Left_Trackpad_X)
+
AxisMappings
=
(AxisName="MoveForward",Scale=1.000000,Key=W)
+
AxisMappings
=
(AxisName="MoveForward",Scale=1.000000,Key=W)
+
AxisMappings
=
(AxisName="MoveForward",Scale=-1.000000,Key=S)
+
AxisMappings
=
(AxisName="MoveForward",Scale=-1.000000,Key=S)
+
AxisMappings
=
(AxisName="MoveForward",Scale=1.000000,Key=Up)
+
AxisMappings
=
(AxisName="MoveForward",Scale=1.000000,Key=Up)
...
...
src/Content/Campus/Maps/Login.umap
View file @
de7c8ba5
No preview for this file type
src/Content/Campus/Maps/Login_BuiltData.uasset
View file @
de7c8ba5
No preview for this file type
src/Content/VirtualRealityBP/Blueprints/MotionControllerPawn.uasset
View file @
de7c8ba5
No preview for this file type
src/Instancing/main.js
View file @
de7c8ba5
...
@@ -16,7 +16,7 @@ async function main(){
...
@@ -16,7 +16,7 @@ async function main(){
app
.
use
(
router
.
routes
()).
use
(
router
.
allowedMethods
());
app
.
use
(
router
.
routes
()).
use
(
router
.
allowedMethods
());
const
response
=
await
fetch
(
'http
://localhost:1337
/instances/add-world-server'
);
const
response
=
await
fetch
(
'http
s://api.ev3.me
/instances/add-world-server'
);
// const data = await response.json();
// const data = await response.json();
// console.log(data);
// console.log(data);
...
...
src/Source/VRClassroom/Private/HttpService.cpp
View file @
de7c8ba5
...
@@ -23,13 +23,12 @@ UHttpService* UHttpService::GetHttp() {
...
@@ -23,13 +23,12 @@ UHttpService* UHttpService::GetHttp() {
return
this
;
return
this
;
}
}
void
UHttpService
::
SetAuthToken
(
FString
token
)
{
AuthToken
=
"Bearer "
;
AuthToken
.
Append
(
token
);
}
void
UHttpService
::
SetTimeout
(
float
Timeout
)
{
void
UHttpService
::
SetTimeout
(
float
Timeout
)
{
if
(
this
==
NULL
)
{
UE_LOG
(
LogTemp
,
Log
,
TEXT
(
"TU PUTA MADRE"
));
}
else
if
(
this
->
Http
==
NULL
)
{
UE_LOG
(
LogTemp
,
Log
,
TEXT
(
"LA TUYA"
));
}
Http
->
SetHttpTimeout
(
Timeout
);
Http
->
SetHttpTimeout
(
Timeout
);
}
}
...
@@ -79,3 +78,13 @@ TSharedRef<IHttpRequest> UHttpService::GetRequest(FString Subroute) {
...
@@ -79,3 +78,13 @@ TSharedRef<IHttpRequest> UHttpService::GetRequest(FString Subroute) {
return
Request
;
return
Request
;
}
}
TSharedRef
<
IHttpRequest
>
UHttpService
::
AuthPostRequest
(
FString
Subroute
,
FString
ContentJsonString
)
{
TSharedRef
<
IHttpRequest
>
Request
=
PostRequest
(
Subroute
,
ContentJsonString
);
Request
->
SetHeader
(
"Authorization"
,
AuthToken
);
}
TSharedRef
<
IHttpRequest
>
UHttpService
::
AuthGetRequest
(
FString
Subroute
)
{
TSharedRef
<
IHttpRequest
>
Request
=
GetRequest
(
Subroute
);
Request
->
SetHeader
(
"Authorization"
,
AuthToken
);
}
\ No newline at end of file
src/Source/VRClassroom/Private/VRCGameInstance.cpp
View file @
de7c8ba5
...
@@ -14,6 +14,7 @@ UHttpService* UVRCGameInstance::GetHttpService() {
...
@@ -14,6 +14,7 @@ UHttpService* UVRCGameInstance::GetHttpService() {
void
UVRCGameInstance
::
SetUserToken
(
FString
token
)
{
void
UVRCGameInstance
::
SetUserToken
(
FString
token
)
{
User
.
Token
=
token
;
User
.
Token
=
token
;
Http
->
SetAuthToken
(
token
);
}
}
FString
UVRCGameInstance
::
GetUserToken
()
{
FString
UVRCGameInstance
::
GetUserToken
()
{
...
...
src/Source/VRClassroom/Private/VRCPlayerController.cpp
View file @
de7c8ba5
...
@@ -19,21 +19,21 @@ void AVRCPlayerController::ConnectToCampus() {
...
@@ -19,21 +19,21 @@ void AVRCPlayerController::ConnectToCampus() {
UVRCGameInstance
*
GameInstance
=
Cast
<
UVRCGameInstance
>
(
GetWorld
()
->
GetGameInstance
());
UVRCGameInstance
*
GameInstance
=
Cast
<
UVRCGameInstance
>
(
GetWorld
()
->
GetGameInstance
());
Http
=
GameInstance
->
GetHttpService
();
Http
=
GameInstance
->
GetHttpService
();
FString
token
=
GameInstance
->
GetUserToken
();
//
FString token = GameInstance->GetUserToken();
Http
->
SetTimeout
(
TravelTimeout
);
Http
->
SetTimeout
(
TravelTimeout
);
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
GetRequest
(
"instances/join-server"
);
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
Auth
GetRequest
(
"instances/join-server"
);
Request
->
OnProcessRequestComplete
().
BindUObject
(
this
,
&
AVRCPlayerController
::
OnConnectToCampusResponseRecieved
);
Request
->
OnProcessRequestComplete
().
BindUObject
(
this
,
&
AVRCPlayerController
::
OnConnectToCampusResponseRecieved
);
Request
->
SetHeader
(
"Accepts"
,
TEXT
(
"application/json"
));
Request
->
SetHeader
(
"Accepts"
,
TEXT
(
"application/json"
));
FString
auth
=
"Bearer "
;
//
FString auth = "Bearer ";
auth
.
Append
(
token
);
//
auth.Append(token);
Request
->
SetHeader
(
"Authorization"
,
auth
);
//
Request->SetHeader("Authorization", auth);
FString
url
=
FString
(
VRCAPIPath
+
"instances/join-server"
);
//
FString url = FString(VRCAPIPath + "instances/join-server");
Request
->
SetURL
(
url
);
//
Request->SetURL(url);
Request
->
ProcessRequest
();
Request
->
ProcessRequest
();
}
}
...
@@ -68,19 +68,17 @@ void AVRCPlayerController::ConnectToMeeting(int32 MeetingId) {
...
@@ -68,19 +68,17 @@ void AVRCPlayerController::ConnectToMeeting(int32 MeetingId) {
UVRCGameInstance
*
GameInstance
=
Cast
<
UVRCGameInstance
>
(
GetWorld
()
->
GetGameInstance
());
UVRCGameInstance
*
GameInstance
=
Cast
<
UVRCGameInstance
>
(
GetWorld
()
->
GetGameInstance
());
Http
=
GameInstance
->
GetHttpService
();
Http
=
GameInstance
->
GetHttpService
();
FString
token
=
GameInstance
->
GetUserToken
();
Http
->
SetTimeout
(
20.0
f
);
Http
->
SetTimeout
(
20.0
f
);
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
GetRequest
(
"instances/join-classroom/123"
);
FString
SubRoute
=
"instances/join-classroom/"
;
FString
url
=
"http://localhost:1337/instances/join-classroom/"
;
SubRoute
.
AppendInt
(
MeetingId
);
url
.
AppendInt
(
MeetingId
);
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
AuthGetRequest
(
SubRoute
);
Request
->
SetURL
(
url
);
//FString url = "http://localhost:1337/instances/join-classroom/";
//url.AppendInt(MeetingId);
//Request->SetURL(url);
Request
->
SetHeader
(
"Accepts"
,
TEXT
(
"application/json"
));
Request
->
SetHeader
(
"Accepts"
,
TEXT
(
"application/json"
));
Request
->
OnProcessRequestComplete
().
BindUObject
(
this
,
&
AVRCPlayerController
::
OnConnectToMeetingResponseRecieved
);
Request
->
OnProcessRequestComplete
().
BindUObject
(
this
,
&
AVRCPlayerController
::
OnConnectToMeetingResponseRecieved
);
FString
auth
=
"Bearer "
;
auth
.
Append
(
token
);
Request
->
SetHeader
(
"Authorization"
,
auth
);
Request
->
ProcessRequest
();
Request
->
ProcessRequest
();
}
}
...
...
src/Source/VRClassroom/Private/VRCScheduleWidget.cpp
View file @
de7c8ba5
...
@@ -10,20 +10,20 @@ void UVRCScheduleWidget::GetMeetings() {
...
@@ -10,20 +10,20 @@ void UVRCScheduleWidget::GetMeetings() {
UVRCGameInstance
*
GameInstance
=
Cast
<
UVRCGameInstance
>
(
GetWorld
()
->
GetGameInstance
());
UVRCGameInstance
*
GameInstance
=
Cast
<
UVRCGameInstance
>
(
GetWorld
()
->
GetGameInstance
());
Http
=
GameInstance
->
GetHttpService
();
Http
=
GameInstance
->
GetHttpService
();
FString
token
=
GameInstance
->
GetUserToken
();
//
FString token = GameInstance->GetUserToken();
Http
->
SetTimeout
(
20.0
f
);
Http
->
SetTimeout
(
20.0
f
);
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
GetRequest
(
"instances/join-classroom/123
"
);
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
AuthGetRequest
(
"users/meetings
"
);
Request
->
SetURL
(
FString
(
"http://localhost:1337/users/meetings"
));
//
Request->SetURL(FString("http://localhost:1337/users/meetings"));
Request
->
SetHeader
(
"Accepts"
,
TEXT
(
"application/json"
));
Request
->
SetHeader
(
"Accepts"
,
TEXT
(
"application/json"
));
Request
->
OnProcessRequestComplete
().
BindUObject
(
this
,
&
UVRCScheduleWidget
::
OnGetMeetingsResponseRecieved
);
Request
->
OnProcessRequestComplete
().
BindUObject
(
this
,
&
UVRCScheduleWidget
::
OnGetMeetingsResponseRecieved
);
FString
auth
=
"Bearer "
;
//
FString auth = "Bearer ";
auth
.
Append
(
token
);
//
auth.Append(token);
Request
->
SetHeader
(
"Authorization"
,
auth
);
//
Request->SetHeader("Authorization", auth);
//
Request->ProcessRequest();
Request
->
ProcessRequest
();
Testy
();
//
Testy();
}
}
void
UVRCScheduleWidget
::
Testy
()
{
void
UVRCScheduleWidget
::
Testy
()
{
...
@@ -42,27 +42,18 @@ void UVRCScheduleWidget::Testy() {
...
@@ -42,27 +42,18 @@ void UVRCScheduleWidget::Testy() {
}
}
void
UVRCScheduleWidget
::
OnGetMeetingsResponseRecieved
(
FHttpRequestPtr
Request
,
FHttpResponsePtr
Response
,
bool
bWasSuccessful
)
{
void
UVRCScheduleWidget
::
OnGetMeetingsResponseRecieved
(
FHttpRequestPtr
Request
,
FHttpResponsePtr
Response
,
bool
bWasSuccessful
)
{
FString
asd
=
"[{
\"
id
\"
:34,
\"
map_id
\"
:1,
\"
name
\"
:
\"
CSC123
\"
,
\"
password
\"
:
\"
angry
\"
,
\"
repeating
\"
:0,
\"
active
\"
:0,
\"
creator_id
\"
:1}]"
;
if
(
Http
->
ResponseIsValid
(
Response
,
bWasSuccessful
))
{
if
(
Http
->
ResponseIsValid
(
Response
,
bWasSuccessful
))
{
TSharedPtr
<
FJsonObject
>
JsonObject
;
TArray
<
FMeetingInfo
>
responseMeetings
;
TArray
<
FMeetingInfo
>
responseMeetings
;
TSharedRef
<
TJsonReader
<>>
Reader
=
TJsonReaderFactory
<>::
Create
(
Response
->
GetContentAsString
());
FString
content
=
FString
(
Response
->
GetContentAsString
());
FString
dsa
=
Response
->
GetContentAsString
();
if
(
FJsonObjectConverter
::
JsonArrayStringToUStruct
(
content
,
&
responseMeetings
,
0
,
0
))
{
//UE_LOG(LogTemp, Log, TEXT("Response: %s"), &dsa);
meetings
=
responseMeetings
;
//if (FJsonSerializer::Deserialize(Reader, JsonObject))
UE_LOG
(
LogTemp
,
Log
,
TEXT
(
"Meetings found: %d"
,
meetings
.
Num
));
//{
if
(
FJsonObjectConverter
::
JsonArrayStringToUStruct
(
asd
,
&
responseMeetings
,
0
,
0
)){
/*FString IP = JsonObject->GetStringField("ip");
FString PORT = JsonObject->GetStringField("port");
FString URL = IP + FString(TEXT(":")) + PORT.Left(4);
UE_LOG(LogTemp, Log, TEXT("OnConnectToCampus IP is %s Port %s, Both"), *IP, *PORT, *URL);*/
//NotifyGetMeetings();
NotifyGetMeetings
();
//UE_LOG(LogTemp, Log, TEXT("Response: %s"), Response->GetContentAsString());
}
}
else
{
else
{
UE_LOG
(
LogTemp
,
Error
,
TEXT
(
"GetMeetings returned no data!
"
));
UE_LOG
(
LogTemp
,
Log
,
TEXT
(
"No meetings found
"
));
}
}
}
}
else
{
else
{
...
...
src/Source/VRClassroom/Public/HttpService.h
View file @
de7c8ba5
...
@@ -15,7 +15,7 @@ class VRCLASSROOM_API UHttpService : public UObject
...
@@ -15,7 +15,7 @@ class VRCLASSROOM_API UHttpService : public UObject
GENERATED_BODY
()
GENERATED_BODY
()
FHttpModule
*
Http
;
FHttpModule
*
Http
;
FString
AuthToken
=
""
;
public
:
public
:
...
@@ -25,6 +25,8 @@ public:
...
@@ -25,6 +25,8 @@ public:
UHttpService
*
GetHttp
();
UHttpService
*
GetHttp
();
void
SetAuthToken
(
FString
token
);
void
SetTimeout
(
float
Timeout
);
void
SetTimeout
(
float
Timeout
);
bool
ResponseIsValid
(
FHttpResponsePtr
Response
,
bool
bWasSuccessful
);
bool
ResponseIsValid
(
FHttpResponsePtr
Response
,
bool
bWasSuccessful
);
...
@@ -36,4 +38,8 @@ public:
...
@@ -36,4 +38,8 @@ public:
TSharedRef
<
IHttpRequest
>
PostRequest
(
FString
Subroute
,
FString
ContentJsonString
);
TSharedRef
<
IHttpRequest
>
PostRequest
(
FString
Subroute
,
FString
ContentJsonString
);
TSharedRef
<
IHttpRequest
>
GetRequest
(
FString
Subroute
);
TSharedRef
<
IHttpRequest
>
GetRequest
(
FString
Subroute
);
TSharedRef
<
IHttpRequest
>
AuthPostRequest
(
FString
Subroute
,
FString
ContentJsonString
);
TSharedRef
<
IHttpRequest
>
AuthGetRequest
(
FString
Subroute
);
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment