rework done
TODO: clean
This commit is contained in:
parent
6ffaeb801a
commit
117da9d24a
3 changed files with 50 additions and 45 deletions
|
@ -239,14 +239,19 @@ FPortalStatusData ParsePortalStatus(const uint8* StatusResponse)
|
||||||
{
|
{
|
||||||
case 0b00:
|
case 0b00:
|
||||||
FigureStatus = EFigureStatus::NOT_PRESENT;
|
FigureStatus = EFigureStatus::NOT_PRESENT;
|
||||||
|
break;
|
||||||
case 0b01:
|
case 0b01:
|
||||||
FigureStatus = EFigureStatus::PRESENT;
|
FigureStatus = EFigureStatus::PRESENT;
|
||||||
|
break;
|
||||||
case 0b11:
|
case 0b11:
|
||||||
FigureStatus = EFigureStatus::ADDED;
|
FigureStatus = EFigureStatus::ADDED; // When it's a new NUID detected
|
||||||
|
break;
|
||||||
case 0b10:
|
case 0b10:
|
||||||
FigureStatus = EFigureStatus::REMOVED;
|
FigureStatus = EFigureStatus::REMOVED; // New NUID removed
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
FigureStatus = EFigureStatus::NOT_PRESENT; // Default case
|
FigureStatus = EFigureStatus::NOT_PRESENT; // Default case
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to the array of figure statuses
|
// Add to the array of figure statuses
|
||||||
|
|
|
@ -56,6 +56,7 @@ void FPortalStatusChecker::CheckPortalStatus()
|
||||||
{
|
{
|
||||||
case S:
|
case S:
|
||||||
CurrentStatusData = ParsePortalStatus(output);
|
CurrentStatusData = ParsePortalStatus(output);
|
||||||
|
UE_LOG(LogSkyportalIO, Verbose, TEXT("Output Data: %s"), *BytesToHex(output, sizeof(output)));
|
||||||
|
|
||||||
//Send delegate when new informations are received
|
//Send delegate when new informations are received
|
||||||
if (OldStatusData != CurrentStatusData) {
|
if (OldStatusData != CurrentStatusData) {
|
||||||
|
@ -79,18 +80,17 @@ void FPortalStatusChecker::CheckPortalStatus()
|
||||||
case EFigureStatus::ADDED:
|
case EFigureStatus::ADDED:
|
||||||
//FigureData = ReadFigureBlocks(i);
|
//FigureData = ReadFigureBlocks(i);
|
||||||
//subref->OnSkylanderAdded.Broadcast(GetFigureID(FigureData), i);
|
//subref->OnSkylanderAdded.Broadcast(GetFigureID(FigureData), i);
|
||||||
|
break;
|
||||||
case EFigureStatus::REMOVED:
|
case EFigureStatus::REMOVED:
|
||||||
subref->OnSkylanderRemoved.Broadcast(00, i);
|
subref->OnSkylanderRemoved.Broadcast(00, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OldStatusData = CurrentStatusData;
|
OldStatusData = CurrentStatusData;
|
||||||
subref->StatusData = CurrentStatusData;
|
subref->StatusData = CurrentStatusData;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -13,7 +13,7 @@ void USkyPortalSubsystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||||
|
|
||||||
Super::Initialize(Collection);
|
Super::Initialize(Collection);
|
||||||
// Start the status checker thread
|
// Start the status checker thread
|
||||||
StatusChecker = new FPortalStatusChecker(this, 0.1f); // Check every 50 milliseconds
|
StatusChecker = new FPortalStatusChecker(this, 0.01f); // Check every 10 milliseconds
|
||||||
StatusCheckerThread = FRunnableThread::Create(StatusChecker, TEXT("PortalStatusCheckerThread"), 0, TPri_AboveNormal);
|
StatusCheckerThread = FRunnableThread::Create(StatusChecker, TEXT("PortalStatusCheckerThread"), 0, TPri_AboveNormal);
|
||||||
|
|
||||||
UE_LOG(LogTemp, Log, TEXT("SkyPortalSubsystem Initialized"));
|
UE_LOG(LogTemp, Log, TEXT("SkyPortalSubsystem Initialized"));
|
||||||
|
|
Loading…
Reference in a new issue