Compare commits
No commits in common. "22be09682db49264376b0f6a715ea8c92902480f" and "24918b9e21b3b756df9b27203e6bf5446b129f55" have entirely different histories.
22be09682d
...
24918b9e21
|
@ -102,13 +102,13 @@
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="componentbasic.cpp" />
|
<ClCompile Include="componentbasic.cpp" />
|
||||||
<ClCompile Include="DeduceFramework.cpp" />
|
<ClCompile Include="EntityDocks.cpp" />
|
||||||
<ClCompile Include="InvisibleComponent.cpp" />
|
<ClCompile Include="InvisibleComponent.cpp" />
|
||||||
<ClCompile Include="MapRoute.cpp" />
|
<ClCompile Include="MapRoute.cpp" />
|
||||||
<ClCompile Include="VisibleBox.cpp" />
|
<ClCompile Include="VisibleBox.cpp" />
|
||||||
<ClInclude Include="componentbasic_global.h" />
|
<ClInclude Include="componentbasic_global.h" />
|
||||||
<ClInclude Include="componentbasic.h" />
|
<ClInclude Include="componentbasic.h" />
|
||||||
<QtMoc Include="DeduceFramework.h" />
|
<QtMoc Include="EntityDocks.h" />
|
||||||
<ClInclude Include="InvisibleComponent.h" />
|
<ClInclude Include="InvisibleComponent.h" />
|
||||||
<ClInclude Include="MapRoute.h" />
|
<ClInclude Include="MapRoute.h" />
|
||||||
<ClInclude Include="VisibleBox.h" />
|
<ClInclude Include="VisibleBox.h" />
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<ClCompile Include="MapRoute.cpp">
|
<ClCompile Include="MapRoute.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="DeduceFramework.cpp">
|
<ClCompile Include="EntityDocks.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="componentbasic.cpp">
|
<ClCompile Include="componentbasic.cpp">
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="DeduceFramework.h">
|
<QtMoc Include="EntityDocks.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "DeduceFramework.h"
|
#include "EntityDocks.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
|
@ -65,12 +65,8 @@ void DeduceFramework::init_framework()
|
||||||
mgr_e->append(this->shared_from_this());
|
mgr_e->append(this->shared_from_this());
|
||||||
auto info_pulls = std::make_shared<ComponentsInfoPull>();
|
auto info_pulls = std::make_shared<ComponentsInfoPull>();
|
||||||
mgr_e->append(info_pulls);
|
mgr_e->append(info_pulls);
|
||||||
this->_entity_map_over_0xffff[mgr_e->entityID()] = mgr_e;
|
|
||||||
|
|
||||||
auto res_e = std::make_shared<RtResourceManager>();
|
this->_entity_map_over_0xffff[mgr_e->entityID()] = mgr_e;
|
||||||
info_pulls = std::make_shared<ComponentsInfoPull>();
|
|
||||||
res_e->append(info_pulls);
|
|
||||||
this->_entity_map_over_0xffff[res_e->entityID()] = res_e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<WsComponent> DeduceFramework::defaultNew() const
|
std::shared_ptr<WsComponent> DeduceFramework::defaultNew() const
|
||||||
|
@ -178,7 +174,6 @@ void DeduceFramework::execute(std::shared_ptr<Immediate> map,
|
||||||
ins->_component_types = this->_factory_ins->allComponentTypes();
|
ins->_component_types = this->_factory_ins->allComponentTypes();
|
||||||
|
|
||||||
ins->_entity_templets[NAME(RtEntityManager)] = RtEntityManager::const_id;
|
ins->_entity_templets[NAME(RtEntityManager)] = RtEntityManager::const_id;
|
||||||
ins->_entity_templets[NAME(RtResourceManager)] = RtResourceManager::const_id;
|
|
||||||
for (auto ekey : this->_templets_within_0x2ff_0xffff.keys())
|
for (auto ekey : this->_templets_within_0x2ff_0xffff.keys())
|
||||||
ins->_entity_templets[ekey] = this->_templets_within_0x2ff_0xffff[ekey]->entityID();
|
ins->_entity_templets[ekey] = this->_templets_within_0x2ff_0xffff[ekey]->entityID();
|
||||||
|
|
|
@ -223,88 +223,3 @@ QList<std::shared_ptr<WsMessage>> ImmediateKernel::execute(std::shared_ptr<const
|
||||||
}
|
}
|
||||||
return rets;
|
return rets;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t ImmediateKernel::resourceManagerID() const
|
|
||||||
{
|
|
||||||
return RtResourceManager::const_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString RtResourceManager::templetName() const
|
|
||||||
{
|
|
||||||
return "RtResourceManager";
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t RtResourceManager::entityID() const
|
|
||||||
{
|
|
||||||
return const_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString RtResourceManager::name() const
|
|
||||||
{
|
|
||||||
return "资源管理器实例";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<WsEntity> RtResourceManager::defaultNew() const
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<WsRespondEntry> RtResourceManager::getEntryWithSignature(const WsRespondSignatureType& t) const
|
|
||||||
{
|
|
||||||
QList<WsRespondEntry> list;
|
|
||||||
for (auto c : this->_comps_list)
|
|
||||||
list.append(c->getEntryWithSignature(t));
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<WsRespondEntry> RtResourceManager::getEntryWithInType(const QString& msg_type) const
|
|
||||||
{
|
|
||||||
QList<WsRespondEntry> list;
|
|
||||||
for (auto c : this->_comps_list)
|
|
||||||
list.append(c->getEntrysWithInType(msg_type));
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RtResourceManager::recoveryFrom(const QJsonObject& obj)
|
|
||||||
{
|
|
||||||
auto array = obj["component_array"].toArray();
|
|
||||||
for (auto idx = 0; idx < array.size(); ++idx) {
|
|
||||||
auto value = array.at(idx).toObject();
|
|
||||||
auto type = value["component_type"].toString();
|
|
||||||
|
|
||||||
auto compins = this->_comps_list[type];
|
|
||||||
if (!compins)
|
|
||||||
throw new UniException(type + "类型插件不存在!");
|
|
||||||
|
|
||||||
compins->recoveryFrom(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RtResourceManager::saveTo(QJsonObject& obj) const
|
|
||||||
{
|
|
||||||
QJsonArray array;
|
|
||||||
for (auto c : this->_comps_list)
|
|
||||||
{
|
|
||||||
QJsonObject comp_obj;
|
|
||||||
comp_obj["component_type"] = c->name();
|
|
||||||
c->saveTo(comp_obj);
|
|
||||||
array.append(comp_obj);
|
|
||||||
}
|
|
||||||
obj["component_array"] = array;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RtResourceManager::append(std::shared_ptr<WsComponent> ins)
|
|
||||||
{
|
|
||||||
ins->bindEntity(this->shared_from_this());
|
|
||||||
this->_comps_list[ins->name()] = ins;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RtResourceManager::remove(const QString& component_type)
|
|
||||||
{
|
|
||||||
this->_comps_list.remove(component_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<std::shared_ptr<WsComponent>> RtResourceManager::components() const
|
|
||||||
{
|
|
||||||
return this->_comps_list.values();
|
|
||||||
}
|
|
||||||
|
|
|
@ -118,30 +118,6 @@ public:
|
||||||
void saveTo(QJsonObject& obj) const override;
|
void saveTo(QJsonObject& obj) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SIMSBASIC_EXPORT RtResourceManager : public WsEntity, public ComponentSet,
|
|
||||||
public std::enable_shared_from_this<RtResourceManager>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static const uint64_t const_id = 0x01f0;
|
|
||||||
QHash<QString, std::shared_ptr<WsComponent>> _comps_list;
|
|
||||||
|
|
||||||
QString templetName() const override;
|
|
||||||
uint64_t entityID() const override;
|
|
||||||
QString name() const override;
|
|
||||||
|
|
||||||
std::shared_ptr<WsEntity> defaultNew() const override;
|
|
||||||
QList<WsRespondEntry> getEntryWithSignature(const WsRespondSignatureType& t) const override;
|
|
||||||
QList<WsRespondEntry> getEntryWithInType(const QString& msg_type) const override;
|
|
||||||
|
|
||||||
void recoveryFrom(const QJsonObject& obj) override;
|
|
||||||
void saveTo(QJsonObject& obj) const override;
|
|
||||||
|
|
||||||
void append(std::shared_ptr<WsComponent> ins) override;
|
|
||||||
void remove(const QString& component_type) override;
|
|
||||||
QList<std::shared_ptr<WsComponent>> components() const override;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实体内迅捷调用核心
|
/// 实体内迅捷调用核心
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -157,8 +133,6 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
virtual uint64_t entityManagerID() const override;
|
virtual uint64_t entityManagerID() const override;
|
||||||
|
|
||||||
virtual uint64_t resourceManagerID() const override;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实体内指定类型的调用立即执行
|
/// 实体内指定类型的调用立即执行
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -172,5 +146,4 @@ public:
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
virtual QList<std::shared_ptr<WsMessage>> execute(std::shared_ptr<const WsMessage> in) override;
|
virtual QList<std::shared_ptr<WsMessage>> execute(std::shared_ptr<const WsMessage> in) override;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
|
@ -77,11 +77,6 @@ public:
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
virtual uint64_t entityManagerID() const = 0;
|
virtual uint64_t entityManagerID() const = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源管理器id
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
virtual uint64_t resourceManagerID() const = 0;
|
|
||||||
/// <summary>
|
|
||||||
/// 实体内指定类型的调用立即执行
|
/// 实体内指定类型的调用立即执行
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="in"></param>
|
/// <param name="in"></param>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <DeduceFramework.h>
|
#include <EntityDocks.h>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
|
|
|
@ -28,8 +28,7 @@ void TempletAssemble::reply_accept(const QList<std::shared_ptr<WsMessage>>& msg_
|
||||||
this->_component_types->addItems(conv->_component_types);
|
this->_component_types->addItems(conv->_component_types);
|
||||||
for (auto info : conv->_entity_templets.keys()) {
|
for (auto info : conv->_entity_templets.keys()) {
|
||||||
auto templat_id = conv->_entity_templets[info];
|
auto templat_id = conv->_entity_templets[info];
|
||||||
if ((QList<uint64_t>{ RtEntityManager::const_id, RtResourceManager::const_id })
|
if ((QList<uint64_t>{RtEntityManager::const_id}).contains(templat_id))
|
||||||
.contains(templat_id))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto cell = new QStandardItem(info);
|
auto cell = new QStandardItem(info);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <DeduceFramework.h>
|
#include <EntityDocks.h>
|
||||||
|
|
||||||
class TempletAssemble : public QDialog
|
class TempletAssemble : public QDialog
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <QtWidgets/QMainWindow>
|
#include <QtWidgets/QMainWindow>
|
||||||
#include "ui_sims_world.h"
|
#include "ui_sims_world.h"
|
||||||
#include <DeduceFramework.h>
|
#include <EntityDocks.h>
|
||||||
|
|
||||||
class SimsWorld : public QMainWindow
|
class SimsWorld : public QMainWindow
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue