mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
fix: player name 3d text not updating by Decorator
This commit is contained in:
parent
a9d185256a
commit
33db2633a2
5 changed files with 23 additions and 20 deletions
|
|
@ -20,6 +20,7 @@
|
|||
#include "world/generator/GeneratorDef.hpp"
|
||||
#include "data/dv_util.hpp"
|
||||
#include "debug/Logger.hpp"
|
||||
#include "util/stringutil.hpp"
|
||||
|
||||
static debug::Logger logger("player");
|
||||
|
||||
|
|
@ -28,7 +29,7 @@ constexpr int SPAWN_ATTEMPTS_PER_UPDATE = 64;
|
|||
Player::Player(
|
||||
Level& level,
|
||||
int64_t id,
|
||||
const std::string& name,
|
||||
const std::wstring& name,
|
||||
glm::vec3 position,
|
||||
float speed,
|
||||
std::shared_ptr<Inventory> inv,
|
||||
|
|
@ -230,11 +231,11 @@ entityid_t Player::getSelectedEntity() const {
|
|||
return selectedEid;
|
||||
}
|
||||
|
||||
void Player::setName(const std::string& name) {
|
||||
void Player::setName(const std::wstring& name) {
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
const std::string& Player::getName() const {
|
||||
const std::wstring& Player::getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +267,7 @@ dv::value Player::serialize() const {
|
|||
auto root = dv::object();
|
||||
|
||||
root["id"] = id;
|
||||
root["name"] = name;
|
||||
root["name"] = util::wstr2str_utf8(name);
|
||||
|
||||
root["position"] = dv::to_value(position);
|
||||
root["rotation"] = dv::to_value(rotation);
|
||||
|
|
@ -293,7 +294,10 @@ dv::value Player::serialize() const {
|
|||
|
||||
void Player::deserialize(const dv::value& src) {
|
||||
src.at("id").get(id);
|
||||
src.at("name").get(name);
|
||||
|
||||
std::string utf8name;
|
||||
src.at("name").get(utf8name);
|
||||
name = util::str2wstr_utf8(utf8name);
|
||||
|
||||
const auto& posarr = src["position"];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue