Ejemplo n.º 1
0
void CreatureManager::UnSelectCreature()
{
	if (m_nSelectNum >= 0)
	{
		int nLastSelect = m_nSelectNum;
		if (g_getRButtonState(App::sInstance().GetHGE()) == eRButtonState_Up)
		{
			Character* lastChar = GetCreature(nLastSelect);
			if(lastChar!=NULL && lastChar->GetCamp()==eCamp_Friend)
			{
				//返回至原位置
				if(lastChar->GetActionStage() == eActionStage_AttackStage)
				{
					lastChar->SetActionStage(eActionStage_MoveStage);
					lastChar->CancelMove();
				}
				//右键取消选中的友方,需要重置行动阶段,处于移动中的单位不可以当时取消
				else if(lastChar->GetActionStage() == eActionStage_MoveStage && lastChar->GetCharacterState()==eCharacterState_Stand)	
				{
					lastChar->SetActionStage(eActionStage_WaitStage);
					m_nSelectNum = -1;
				}
			}
			else
				m_nSelectNum = -1;
		}
	}
}
void CreatureManager::UnSelectCreature()
{
	if (m_nSelectNum >= 0)
	{
		int nLastSelect = m_nSelectNum;
		if (g_getRButtonState(App::sInstance().GetHGE()) == eRButtonState_Up)
		{
			Character* lastChar = GetCreature(nLastSelect);
			if(lastChar!=NULL && lastChar->GetCamp()==eCamp_Friend && !(lastChar->GetFinish()))
			{
				//返回至原位置
				eActionStage stage = lastChar->GetActionStage();
				if(stage == eActionStage_HandleStage)
				{
					lastChar->SetActionStage(eActionStage_MoveStage);
					lastChar->CancelMove();
					//关闭操作界面
					UIWindow* commandWindow = UISystem::sInstance().GetWindow(eWindowID_Command);
					if(commandWindow)
					{
						commandWindow->SetShow(false);
					}
				}
				//攻击阶段、技能阶段、使用物品阶段可以返回至操作阶段
				else if(stage == eActionStage_AttackStage || stage == eActionStage_GoodStage || stage == eActionStage_SkillStage)
				{
					lastChar->SetActionStage(eActionStage_HandleStage);
					//打开操作界面
					UIWindow* commandWindow = UISystem::sInstance().GetWindow(eWindowID_Command);
					if(commandWindow)
					{
						commandWindow->SetShow(true);
						commandWindow->SetBindChar(lastChar);
					}
				}
				//右键取消选中的友方,需要重置行动阶段,处于移动中的单位不可以当时取消
				else if(stage == eActionStage_MoveStage && lastChar->GetCharacterState()==eCharacterState_Stand)	
				{
					lastChar->SetActionStage(eActionStage_WaitStage);
					m_nSelectNum = -1;
				}
			}
			else
				m_nSelectNum = -1;
		}
	}
}
void CreatureManager::ProcessSelectCreature()
{
	if(m_nSelectNum >= 0)
	{
		Character* selectChar = GetCreature(m_nSelectNum);
		if((selectChar->GetCamp() == eCamp_Enemy) || (selectChar->GetCamp()==eCamp_Friend && selectChar->GetCharacterState()==eCharacterState_Stand && selectChar->GetActionStage() ==eActionStage_MoveStage))
			ShowMoveRange(selectChar);
		if(selectChar->GetCamp() == eCamp_Enemy || (selectChar->GetCamp()==eCamp_Friend && (selectChar->GetActionStage()==eActionStage_AttackStage || selectChar->GetActionStage()==eActionStage_SkillStage)))
			ShowAttackRange(selectChar);
	}
	
}