Пример #1
0
void GameSceneUILayer::closeCharWindow()
{
	m_CharWInLayer->hideCharWin();
	m_CharWindowOn = false;
	m_CharWinRect.setRect(m_WinWidth - 30 * RESOLUTION, 315 * RESOLUTION, 30 * RESOLUTION, 60 * RESOLUTION);
	GET_INPUT_MANAGER()->resetMousePoints();
}
Пример #2
0
void GameSceneUILayer::openCharWindow()
{
	m_CharWInLayer->showCharWin();
	m_CharWindowOn = true;
	m_CharWinRect.setRect(m_WinWidth - 390 * RESOLUTION, 315 * RESOLUTION, 30 * RESOLUTION, 60 * RESOLUTION);
	GET_INPUT_MANAGER()->resetMousePoints();
}
Пример #3
0
bool GameLayer::init()
{
    if( !Layer::init() )
    {
        return false;
    }

    GET_INPUT_MANAGER()->receiveKeyboardData( this );
    m_Player = Player::create();
    m_Player->retain();

    auto contactListener = cocos2d::EventListenerPhysicsContact::create();
    contactListener->onContactBegin = CC_CALLBACK_1(GameLayer::onContactBegin, this);
    contactListener->onContactSeperate = CC_CALLBACK_1(GameLayer::onContactSeparate, this);
    _eventDispatcher->addEventListenerWithSceneGraphPriority(contactListener, this);
    m_BackGround = GET_RESOURCE_MANAGER()->createSprite(ST_BACKGROUND);
    addChild(m_BackGround);
    m_BackGround->setZOrder(BACKGROUND);

    for(int idx = 0; idx < MAX_ROOM_LAYER_NUM; ++idx)
    {
        m_RoomLayers[idx] = nullptr;
    }

    return true;
}
Пример #4
0
void GameSceneUILayer::openMapWindow()
{
	m_MapLayer->showMapWin();
	m_MapWindowOn = true;
	m_MapWinRect.setRect(850 * RESOLUTION, 315 * RESOLUTION, 30 * RESOLUTION, 60 * RESOLUTION);
	GET_INPUT_MANAGER()->resetMousePoints();
}
Пример #5
0
void GameSceneUILayer::closeMapWindow()
{
	m_MapLayer->hideMapWin();
	m_MapWindowOn = false;
	m_MapWinRect.setRect(0, 315 * RESOLUTION, 30 * RESOLUTION, 60 * RESOLUTION);
	GET_INPUT_MANAGER()->resetMousePoints();
}
Пример #6
0
void KeyStateSentinel::update(float dTime)
{

	for (int i = 0; i < 162; i++)
	{
		KeyState prevState = GET_INPUT_MANAGER()->m_PrevKeyStates[i];
		KeyState nowState = GET_INPUT_MANAGER()->m_KeyStates[i];

		if (prevState == KS_NONE && nowState == KS_NONE)
		{
			GET_INPUT_MANAGER()->m_FinalKeyStates[i] = KS_NONE;
		}
		else if (prevState == KS_NONE && nowState == KS_PRESS)
		{
			GET_INPUT_MANAGER()->m_FinalKeyStates[i] = KS_PRESS;
		}
		else if (prevState == KS_PRESS && nowState == KS_NONE)
		{
			GET_INPUT_MANAGER()->m_FinalKeyStates[i] = KS_RELEASE;
		}
		else if (prevState == KS_PRESS && nowState == KS_PRESS)
		{
			GET_INPUT_MANAGER()->m_FinalKeyStates[i] = KS_HOLD;
		}

		GET_INPUT_MANAGER()->m_PrevKeyStates[i] = nowState;
	}
}
Пример #7
0
void GameLayer::testCode()
{
#ifdef _DEBUG
    if(GET_INPUT_MANAGER()->getKeyState(KC_TEST2) == KS_PRESS)
    {
        shakeRooms();
    }
#endif
}
Пример #8
0
//=============================================================================
// update
//=============================================================================
void Tutorial::Update()
{
	auto p_input_manager = GET_INPUT_MANAGER();
	//if (p_input_manager->GetTrigger(InputManager::Command::A, 0))
	if(GET_INPUT_MOUSE()->GetPress(InputMouse::MOUSE_KEY::LEFT))
	{
		SceneManager::Instance().set_p_next_scene(SceneManager::Instance().get_game());
		SceneManager::Instance().set_scene_change_flag(true);
	}
}
Пример #9
0
void LandFloorGateway::collisionOccured( InteractiveObject* enemy , Directions dir )
{
	if( !m_IsOpen && enemy->getType() == OT_PLAYER && GET_INPUT_MANAGER()->getKeyState( KC_UP ) )
	{
		m_IsOpen = true;
		auto animate = Animate::create( m_OpenAnimation );
		auto callfunc = CallFuncN::create( CC_CALLBACK_1( LandFloorGateway::gotoNextFloor , this ) );
		auto action = Sequence::create( animate , callfunc , NULL );
		m_MainSprite->runAction( action );
	}
}
Пример #10
0
void IconLayer::update(float dTime)
{
	MouseInfo mouseInput = GET_INPUT_MANAGER()->getMouseInfo();
	if (m_Labeled)
	{
		if (m_IconRect.containsPoint(mouseInput.m_MouseMove))
		{
			m_IconLabel->setVisible(true);
		}
		else
		{
			m_IconLabel->setVisible(false);
		}
	}
}
Пример #11
0
void GameSceneUILayer::controlUIMouse()
{
	MouseInfo mouseInput = GET_INPUT_MANAGER()->getMouseInfo();
	if (m_MapWinRect.containsPoint(mouseInput.m_MouseEnd[LEFT_CLICK_POINT]))
	{
		if (!m_MapWindowOn)
		{
			openMapWindow();
		}
		else if (m_MapWindowOn)
		{
			closeMapWindow();
		}
	}
	if (m_CharWinRect.containsPoint(mouseInput.m_MouseEnd[LEFT_CLICK_POINT]))
	{
		if (!m_CharWindowOn)
		{
			openCharWindow();
		}
		else if (m_CharWindowOn)
		{
			closeCharWindow();
		}
	}
	if (mouseInput.m_MouseState == MS_RIGHT_UP)
	{
		if (m_MenuWindowOn)
		{
			closeGameMenu();
		}
		else if (m_MapWindowOn)
		{
			closeMapWindow();
		}
		else if (m_CharWindowOn)
		{
			closeCharWindow();
		}
	}
}
Пример #12
0
void KeyStateSentinel::onKeyPressed(cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event)
{
	GET_INPUT_MANAGER()->m_KeyStates[(int)keyCode] = KS_PRESS;
}
Пример #13
0
void KeyStateSentinel::onKeyReleased(cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event)
{
	GET_INPUT_MANAGER()->m_KeyStates[(int)keyCode] = KS_NONE;
}
Пример #14
0
void GameSceneUILayer::controlUIKeyboard()
{
	KeyState mapKey1 = GET_INPUT_MANAGER()->getKeyState(KC_MAP);
	KeyState mapKey2 = GET_INPUT_MANAGER()->getKeyState(KC_TAB);
	KeyState escKey = GET_INPUT_MANAGER()->getKeyState(KC_ESC);
	KeyState charKey = GET_INPUT_MANAGER()->getKeyState(KC_CHARACTER);
	KeyState enterKey = GET_INPUT_MANAGER()->getKeyState(KC_RETURN);

	if (escKey == KS_PRESS)
	{
		GET_SOUND_MANAGER()->createSound(SoundManager::MENU, false);
		if (m_MenuWindowOn)
		{
			closeGameMenu();
		}
		else
		{
			if (m_MapWindowOn)
			{
				closeMapWindow();
			}
			else if (m_CharWindowOn)
			{
				closeCharWindow();
			}
			else
			{
				openGameMenu();
			}
		}
	}

	if (mapKey1 == KS_PRESS || mapKey2 == KS_PRESS)
	{
		GET_SOUND_MANAGER()->createSound(SoundManager::MENU, false);
		if (!m_MenuWindowOn)
		{
			if (m_MapWindowOn)
			{
				closeMapWindow();
			}
			else
			{
				openMapWindow();
			}
		}
	}

	if (charKey == KS_PRESS)
	{
		GET_SOUND_MANAGER()->createSound(SoundManager::MENU, false);
		if (!m_MenuWindowOn)
		{
			if (m_CharWindowOn)
			{
				closeCharWindow();
			}
			else
			{
				openCharWindow();
			}
		}
	}
}
Пример #15
0
void GameSceneUILayer::closeGameMenu()
{
	m_GameMenuLayer->hideGameMenu();
	m_MenuWindowOn = false;
	GET_INPUT_MANAGER()->resetMousePoints();
}
Пример #16
0
void GameSceneUILayer::openGameMenu()
{
	m_GameMenuLayer->showGameMenu();
	m_MenuWindowOn = true;
	GET_INPUT_MANAGER()->resetMousePoints();
}
Пример #17
0
//=============================================================================
// update
//=============================================================================
void Title::Update()
{
	auto p_input_manager = GET_INPUT_MANAGER();
	auto window = GET_WINDOW();

	//効果音デバッグ
	if (GET_INPUT_KEYBOARD()->GetTrigger(DIK_O))
	{
		{
			Sound::Instance().PlaySeSound(SOUND_LABEL_SE_PMOVE, 0);
		}
	}

	//if (p_input_manager->GetTrigger(InputManager::Command::A, 0))
	if(GET_INPUT_MOUSE()->GetPress(InputMouse::MOUSE_KEY::LEFT))
	{
		//効果音再生
		Sound::Instance().PlaySeSound(SOUND_LABEL_SE_YES, 0);

		SceneManager::Instance().set_p_next_scene(SceneManager::Instance().get_game());
		SceneManager::Instance().set_scene_change_flag(true);
	}

	//パーティクル
	for (u32 i = 0; i < PARTICUL_MAX; ++i)
	{
		
		if (particul_cnt_ == particul_[i].start_cnt_)
		{
			particul_[i].start_flag_ = true;

		}	
		if (particul_[i].start_flag_)
		{
			auto position = particul_[i].particul_->GetPosition();
			particul_[i].particul_angle_ -= D3DX_PI*0.01f;
			position._x -= sinf(particul_[i].particul_angle_);
			position._y += 0.5f;

			auto rotate = particul_[i].particul_->GetRotation();
			rotate._z = 1.2f;

			
			if (particul_[i].particul_angle_ < -D3DX_PI)
			{
				particul_[i].particul_angle_ += 2 * D3DX_PI;
			}
			else if (particul_[i].particul_angle_ > D3DX_PI)
			{
				particul_[i].particul_angle_ -= 2 * D3DX_PI;
			}
			
			if (position._y > window->GetHeight())
			{
				position._x = (rand() % window->GetWidth());
				position._y = -10.0f;
			}
			
			particul_[i].particul_->SetPosition(position._x, position._y, position._z);
			particul_[i].particul_->SetRotation(rotate);
		}
	}
	particul_cnt_++;

	for (int i = 0; i < PLAYER_SUM; i++)
	{
		if (GET_INPUT_XPAD(i)->GetPress(XIPad::KEY::A) || GET_INPUT_XPAD(i)->GetPress(XIPad::KEY::B))
		{
			//効果音再生
			Sound::Instance().PlaySeSound(SOUND_LABEL_SE_YES, 0);

			SceneManager::Instance().set_p_next_scene(SceneManager::Instance().get_game());
			SceneManager::Instance().set_scene_change_flag(true);
		}
	}
}