PlayerDashboard::PlayerDashboard(DataStore *dataStore, QWidget *parent):
  QWidget(parent),
  dataStore(dataStore)
{
  setupUi();
  connect(
    dataStore,
    SIGNAL(playerCreated()),
    this,
    SLOT(setPlayerInfo()));
  connect(
    dataStore,
    SIGNAL(playerNameChanged(const QString&)),
    this,
    SLOT(setPlayerInfo()));
  connect(
    dataStore,
    SIGNAL(playerLocationSet()),
    this,
    SLOT(setPlayerInfo()));
  connect(
    dataStore,
    SIGNAL(playerPasswordSet()),
    this,
    SLOT(setPlayerInfo()));
  connect(
    dataStore,
    SIGNAL(playerPasswordRemoved()),
    this,
    SLOT(setPlayerInfo()));
}
void PlayerDashboard::setupUi(){
  nameLabel = new QLabel();
  locationLabel = new QLabel();
  passwordLabel = new QLabel();

  setPlayerInfo();

  QVBoxLayout *layout = new QVBoxLayout;
  layout->addWidget(nameLabel);
  layout->addWidget(passwordLabel);
  layout->addWidget(locationLabel);
  setLayout(layout);
}
示例#3
0
void StageManager::setPlayerInfo(const PlayerInfo& info)
{
	if (m_GameScene == nullptr)
	{
		return;
	}
	auto layer = m_GameScene->getGameLayer();
	if (layer == nullptr)
	{
		return;
	}
	layer->setPlayerInfo(info);
}