<commit_before>#include "PlayerLayer.h"
#include "GameManager.h"

USING_NS_CC;

bool CPlayerLayer::init()
{
	//////////////////////////////
	// 1. super init first
	if ( !CCLayer::init() )
	{
		return false;
	}

	m_CurrentPlayerId = -1;

	m_VisibleSize = CCDirector::sharedDirector()->getVisibleSize();

	//ġ  Ѵ. ġ  ̴.
	m_UIposition[0].x = DEFAULT_CHARACTER_MARGIN_H;
	m_UIposition[0].y = m_VisibleSize.height - DEFAULT_CHARACTER_MARGIN_V;

	m_UIposition[1].x = m_VisibleSize.width - DEFAULT_CHARACTER_MARGIN_H;
	m_UIposition[1].y =m_VisibleSize.height - DEFAULT_CHARACTER_MARGIN_V;

	m_UIposition[2].x = DEFAULT_CHARACTER_MARGIN_H;
	m_UIposition[2].y = DEFAULT_CHARACTER_MARGIN_V;

	m_UIposition[3].x =m_VisibleSize.width -  DEFAULT_CHARACTER_MARGIN_H;
	m_UIposition[3].y = DEFAULT_CHARACTER_MARGIN_V;

	//CCSpriteBatchNode Ͽ ҽ غѴ.
	m_pSpriteBatchNode = CCSpriteBatchNode::create("image/CharacterPlayAnimation.png");
	addChild(m_pSpriteBatchNode,0);
	
	
	CCSpriteFrameCache* cache = CCSpriteFrameCache::sharedSpriteFrameCache();
	cache->addSpriteFramesWithFile("image/CharacterPlayAnimation.plist");
	
	//ϴ  ÷̾ ĳͰ  ġ  Ѵ.
	for (int playerId = 0; playerId<MAX_PLAYER_NUM; ++playerId)
	{
		//  ÷̾ ѱ.
		if (CGameManager::GetInstance()->GetCharacterId(playerId)==-1)
			continue;

		int position = CGameManager::GetInstance()->GetPlayerTurn(playerId);

		m_Player[playerId] = CCSprite::create();
		m_Player[playerId]->setPosition(m_UIposition[position]);

		m_PlayerName[playerId] = CCLabelTTF::create(CGameManager::GetInstance()->GetPlayerName(playerId).c_str(), "Arial", 12, 
			CCSizeMake(245, 32), kCCTextAlignmentCenter);

		m_PlayerName[playerId]->setPosition(ccp(m_UIposition[position].x+DEFAULT_CHARACTER_WIDTH/2,m_UIposition[position].y));

		switch(position)
		{
		case 0:
			break;
		case 1:
			m_Player[playerId]->setFlipX(true);
			break;
		case 2:
			m_Player[playerId]->setFlipY(true);
			break;
		case 3:
			m_Player[playerId]->setRotation(180.0f);
			break;
		}
	}

	//ĳ ù°   UI غѴ.
	SetWaitingCharacters();
	
	//addChildش.
	for(int playerId=0;playerId<MAX_PLAYER_NUM;++playerId)
	{
		if (CGameManager::GetInstance()->GetCharacterId(playerId)==-1)
			continue;

		m_pSpriteBatchNode->addChild(m_Player[playerId],0);
		addChild(m_PlayerName[playerId],1);

	}

	// (ù° ) ִϸ̼   ֵ update()   ش.
	update(0);

	return true;<commit_msg>[PlayScene]->가운데를 쳐다보도록 플레이어 이름 추가<commit_after>#include "PlayerLayer.h"
#include "GameManager.h"

USING_NS_CC;

bool CPlayerLayer::init()
{
	//////////////////////////////
	// 1. super init first
	if ( !CCLayer::init() )
	{
		return false;
	}

	m_CurrentPlayerId = -1;

	m_VisibleSize = CCDirector::sharedDirector()->getVisibleSize();

	//ġ  Ѵ. ġ  ̴.
	m_UIposition[0].x = DEFAULT_CHARACTER_MARGIN_H;
	m_UIposition[0].y = m_VisibleSize.height - DEFAULT_CHARACTER_MARGIN_V;

	m_UIposition[1].x = m_VisibleSize.width - DEFAULT_CHARACTER_MARGIN_H;
	m_UIposition[1].y =m_VisibleSize.height - DEFAULT_CHARACTER_MARGIN_V;

	m_UIposition[2].x = DEFAULT_CHARACTER_MARGIN_H;
	m_UIposition[2].y = DEFAULT_CHARACTER_MARGIN_V;

	m_UIposition[3].x =m_VisibleSize.width -  DEFAULT_CHARACTER_MARGIN_H;
	m_UIposition[3].y = DEFAULT_CHARACTER_MARGIN_V;

	//CCSpriteBatchNode Ͽ ҽ غѴ.
	m_pSpriteBatchNode = CCSpriteBatchNode::create("image/CharacterPlayAnimation.png");
	addChild(m_pSpriteBatchNode,0);
	
	
	CCSpriteFrameCache* cache = CCSpriteFrameCache::sharedSpriteFrameCache();
	cache->addSpriteFramesWithFile("image/CharacterPlayAnimation.plist");
	
	//ϴ  ÷̾ ĳͰ  ġ  Ѵ.
	for (int playerId = 0; playerId<MAX_PLAYER_NUM; ++playerId)
	{
		//  ÷̾ ѱ.
		if (CGameManager::GetInstance()->GetCharacterId(playerId)==-1)
			continue;

		int position = CGameManager::GetInstance()->GetPlayerTurn(playerId);

		m_Player[playerId] = CCSprite::create();
		m_Player[playerId]->setPosition(m_UIposition[position]);

		m_PlayerName[playerId] = CCLabelTTF::create(CGameManager::GetInstance()->GetPlayerName(playerId).c_str(), "Arial", 12, 
			CCSizeMake(245, 32), kCCTextAlignmentCenter);

		m_PlayerName[playerId]->setPosition(m_UIposition[position]);

		switch(position)
		{
		case 0:
			m_PlayerName[playerId]->setRotation(-45.0f);
			break;
		case 1:
			m_Player[playerId]->setFlipX(true);
			m_PlayerName[playerId]->setRotation(45.0f);
			break;
		case 2:
			m_Player[playerId]->setFlipY(true);
			m_PlayerName[playerId]->setRotation(-135.0f);
			break;
		case 3:
			m_Player[playerId]->setRotation(180.0f);
			m_PlayerName[playerId]->setRotation(135.0f);
			break;
		}
	}

	//ĳ ù°   UI غѴ.
	SetWaitingCharacters();
	
	//addChildش.
	for(int playerId=0;playerId<MAX_PLAYER_NUM;++playerId)
	{
		if (CGameManager::GetInstance()->GetCharacterId(playerId)==-1)
			continue;

		m_pSpriteBatchNode->addChild(m_Player[playerId],0);
		addChild(m_PlayerName[playerId],1);

	}

	// (ù° ) ִϸ̼   ֵ update()   ش.
	update(0);

	return true;
{'fraction_non_alphanumeric': 0.15602397189501963, 'fraction_numerical': 0.016738995660260384, 'mean_word_length': 4.953259532595326, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1742980', 'n_tokens_mistral': 2101, 'n_tokens_neox': 1938, 'n_words': 249}