#include <ScriptSystem.h>
◆ ScriptSystem()
MQEngine::ScriptSystem::ScriptSystem |
( |
| ) |
|
◆ ~ScriptSystem()
MQEngine::ScriptSystem::~ScriptSystem |
( |
| ) |
|
◆ convertComponentValueToJS()
v8::Local< v8::Value > MQEngine::ScriptSystem::convertComponentValueToJS |
( |
const ComponentValue & | value | ) |
|
|
private |
◆ convertJSObjectToComponentValue() [1/2]
ComponentValue MQEngine::ScriptSystem::convertJSObjectToComponentValue |
( |
const std::string & | fieldType, |
|
|
const FCT::JSAny & | fieldValue ) |
|
private |
◆ convertJSObjectToComponentValue() [2/2]
ComponentValue MQEngine::ScriptSystem::convertJSObjectToComponentValue |
( |
const std::string & | fieldType, |
|
|
FCT::JSAny & | jsAny, |
|
|
const std::string & | fieldName ) |
|
private |
通用类型转换函数:从JSObject转换为ComponentValue
- 参数
-
fieldType | 字段类型 |
jsObject | JavaScript对象 |
fieldName | 字段名称(同时用于错误输出) |
- 返回
- 转换后的ComponentValue
◆ getEntityFromJS()
std::pair< entt::registry *, entt::entity > MQEngine::ScriptSystem::getEntityFromJS |
( |
FCT::NodeEnvironment & | env | ) |
|
|
private |
◆ getFunctionNames()
std::vector< std::string > MQEngine::ScriptSystem::getFunctionNames |
( |
| ) |
const |
获取当前JavaScript环境中的所有函数名
- 返回
- JavaScript函数名列表
◆ loadJSFilesFromDirectory()
std::vector< std::string > MQEngine::ScriptSystem::loadJSFilesFromDirectory |
( |
const std::string & | directory | ) |
|
|
private |
从指定目录加载所有JavaScript文件
- 参数
-
- 返回
- 文件路径列表
◆ loadScripts()
void MQEngine::ScriptSystem::loadScripts |
( |
| ) |
|
加载并执行JavaScript脚本文件
从./res/scripts/dist/和./res/scripts/js目录下获取所有js文件, 然后使用NodeEnvironment执行所有的js文件
◆ readFileContent()
std::string MQEngine::ScriptSystem::readFileContent |
( |
const std::string & | filePath | ) |
|
|
private |
◆ registerEntityFunctions()
void MQEngine::ScriptSystem::registerEntityFunctions |
( |
| ) |
|
|
private |
◆ setLogicDeltaTime()
void MQEngine::ScriptSystem::setLogicDeltaTime |
( |
float | deltaTime | ) |
|
◆ update()
void MQEngine::ScriptSystem::update |
( |
| ) |
|
更新系统,执行所有ScriptComponent的脚本
◆ m_componentReflection
◆ m_dataManager
◆ m_logicDeltaTime
float MQEngine::ScriptSystem::m_logicDeltaTime = 0.0f |
|
private |
◆ m_nodeEnv
std::unique_ptr<FCT::NodeEnvironment> MQEngine::ScriptSystem::m_nodeEnv |
|
private |
该类的文档由以下文件生成: