core completed.

This commit is contained in:
lhhxxxxx
2022-06-05 00:46:21 +08:00
parent 2cc08e3971
commit f694204856
6 changed files with 48 additions and 12 deletions

View File

@@ -821,6 +821,7 @@
255
],
"next": [
"GameStart",
"StartToWakeUp",
"StartUpConnectingFlag",
"StartLoginBServer",

View File

@@ -161,7 +161,7 @@ namespace asst
enum class ServerType
{
Official,
Official = 0,
Bilibili
};
}

View File

@@ -1 +1,17 @@
#include "StartGameTask.h"
#include "Controller.h"
using namespace asst;
bool StartGameTask::_run()
{
m_ctrler->start_game(m_server_type);
return true;
}
StartGameTask& StartGameTask::set_param(ServerType server_type) noexcept
{
m_server_type = server_type;
return *this;
}

View File

@@ -1,7 +1,21 @@
#pragma once
class StartGameTask
#include "AbstractTask.h"
#include "AsstTypes.h"
namespace asst
{
public:
};
class StartGameTask : public AbstractTask
{
public:
using AbstractTask::AbstractTask;
~StartGameTask() override = default;
StartGameTask& set_param(ServerType server_type = ServerType::Official) noexcept;
protected:
bool _run() override;
ServerType m_server_type = ServerType::Official;
};
}

View File

@@ -4,17 +4,21 @@
asst::StartUpTask::StartUpTask(AsstCallback callback, void* callback_arg)
: PackageTask(callback, callback_arg, TaskType),
m_start_up_task_ptr(std::make_shared<ProcessTask>(m_callback, m_callback_arg, TaskType))
m_start_game_task_ptr(std::make_shared<StartGameTask>(m_callback, m_callback_arg, TaskType)),
m_start_up_task_ptr(std::make_shared<ProcessTask>(m_callback, m_callback_arg, TaskType))
{
m_start_up_task_ptr->set_tasks({ "StartUp" })
.set_times_limit("ReturnToTerminal", 0)
.set_times_limit("Terminal", 0);
m_start_up_task_ptr->set_tasks({"StartUp"})
.set_times_limit("ReturnToTerminal", 0)
.set_times_limit("Terminal", 0);
m_subtasks.emplace_back(m_start_game_task_ptr);
m_subtasks.emplace_back(m_start_up_task_ptr);
}
bool asst::StartUpTask::set_params(const json::value& params)
{
if (!params.contains("server_type")) {
return false;
if (params.contains("server_type"))
{
m_start_game_task_ptr->set_param(static_cast<ServerType>(params.get("server_type", 0)));
}
return true;
}

View File

@@ -1,5 +1,6 @@
#pragma once
#include "PackageTask.h"
#include "StartGameTask.h"
namespace asst
{
@@ -15,7 +16,7 @@ namespace asst
static constexpr const char* TaskType = "StartUp";
private:
std::shared_ptr<StartGameTask> m_start_game_task_ptr = nullptr;
std::shared_ptr<ProcessTask> m_start_up_task_ptr = nullptr;
};
}