void UJavascriptHttpRequest::BeginDestroy() { Super::BeginDestroy(); if (IsProcessing()) { EndProcessing(); } Request.Reset(); }
bool UJavascriptHttpRequest::ProcessRequest() { if (IsProcessing()) return false; Request->OnProcessRequestComplete().BindLambda([&](FHttpRequestPtr, FHttpResponsePtr, bool status){ EndProcessing(); OnComplete.ExecuteIfBound(status); }); Request->OnRequestProgress().BindLambda([&](FHttpRequestPtr, int32 sent, int32 recv){ EndProcessing(); OnProgress.ExecuteIfBound(sent,recv); }); if (Request->ProcessRequest()) { BeginProcessing(); return true; } else { return false; } }
void BattleView::Process(void) { Assert(m_eventQueue); if(!m_eventQueue) return; PointerList<BattleEvent>::PointerListNode *eventNode = m_eventQueue->GetHeadNode(); while (eventNode) { BattleEvent * event = eventNode->GetObj(); Assert(event); BattleViewActor * actor = event->GetActor(); bool addEvent = true; bool isAfterAttack = IsAfterAttack(*event); PointerList<BattleEvent>::PointerListNode * activeNode = m_activeEvents->GetHeadNode(); while (activeNode) { if (isAfterAttack && (activeNode->GetObj()->GetType() == BATTLE_EVENT_TYPE_ATTACK) ) { addEvent = false; break; } if((event->GetType() == BATTLE_EVENT_TYPE_PLACEMENT) && (activeNode->GetObj()->GetType() != BATTLE_EVENT_TYPE_PLACEMENT)) { addEvent = false; break; } if(activeNode->GetObj()->GetActor() == actor) { addEvent = false; break; } activeNode = activeNode->GetNext(); } if(addEvent) { PointerList<BattleEvent>::PointerListNode *addNode = eventNode; eventNode = eventNode->GetNext(); m_eventQueue->Remove(addNode); m_activeEvents->AddTail(event); } else { eventNode = eventNode->GetNext(); } } if(m_activeEvents->GetCount() > 0) { m_walker->SetList(m_activeEvents); while (m_walker->IsValid()) { BattleEvent * event = m_walker->GetObj(); Assert(event); event->Process(); if (event->IsFinished()) { m_walker->Remove(); delete event; if (!IsProcessing() && (!g_theCurrentBattle || !g_theCurrentBattle->IsDone())) { g_gevManager->GotUserInput(); } } else { m_walker->Next(); } } } }