void CreatureManager::ShowCreatureInfo()
{
	Block block = App::sInstance().GetMouseBlock();
	if (block.xpos!=-1 && block.ypos!=-1)
	{
		Character* cha = GetEnemy(block.xpos,block.ypos);
		if(cha == NULL)
		{
			cha = GetFriend(block.xpos,block.ypos);
			if(cha == NULL)
			{
				TipWnd::sInstance().Clear();
				TipWnd::sInstance().SetShow(false);
				return;
			}
		}
		//得到单位,显示其信息
		char temp[256] = {0};
		TipWnd::sInstance().Clear();
		sprintf(temp," ID   : %d",cha->GetID());
		TipWnd::sInstance().AddText(temp,0xFFFFFFFF,-1,-1,eFontType_MSYaHei,eFontSize_FontMiddle);
		sprintf(temp," 坐标 : %d , %d",cha->GetBlock().xpos,cha->GetBlock().ypos);
		TipWnd::sInstance().AddText(temp,0xFFFFFFFF,-1,-1,eFontType_MSYaHei,eFontSize_FontMiddle);
		sprintf(temp," 生命值:%d",cha->GetHP());
		TipWnd::sInstance().AddText(temp,0xFFFFFFFF,-1,-1,eFontType_MSYaHei,eFontSize_FontMiddle);
		TipWnd::sInstance().SetShow(true);
		TipWnd::sInstance().SetPos(block.xpos,block.ypos);
	}
	else
	{
		TipWnd::sInstance().Clear();
		TipWnd::sInstance().SetShow(false);
	}

}
bool GUIFCCharacterItem::OnEvent(const SEvent& event)
{
  bool bHandled = false;

  switch ( event.EventType )
  {
  case  EET_GUI_EVENT:
    {
      s32 elemID = event.GUIEvent.Caller->getID();

      switch ( event.GUIEvent.EventType )
      {
      case  EGET_ELEMENT_HOVERED:
        {
          if ( event.GUIEvent.Caller == this )
          {
            SetHighlight(true);
            bHandled = true;
          }
        }
        break;

      case  EGET_ELEMENT_LEFT:
        {
          if ( event.GUIEvent.Caller == this )
          {
            SetHighlight(false);
            bHandled = true;
          }
        }
        break;

      default:
        break;
      }
    }
    break;

	case	EET_MOUSE_INPUT_EVENT:
		{
			switch ( event.MouseInput.Event )
			{
			case	EMIE_LMOUSE_LEFT_UP:
				{
          if ( isPointInside( core::position2d<s32>( event.MouseInput.X, event.MouseInput.Y ) ) )
          {
						Character* pChar = GetCharacter();

						if ( m_pContainer && pChar )
						{
							FCViewEvent e( VE_CharacterSelected, pChar->GetID() );
							m_pContainer->GetController()->OnViewEvent(e);
              bHandled = true;
						}
					}
				}
				break;

			default:
				break;
			}
		}
		break;

  default:
    break;
  }

  return bHandled;
}
//----------------------------------------------------------------------------
void SkillStepLink::OnEnter (SkillInstance *instance)
{
	SkillStep::OnEnter(instance);

	Skill *skill = instance->GetSkill();
	Character *character = skill->GetCharacter();
	Scene *scene = character->GetScene();
	Node *sceneNode = DynamicCast<Node>(scene->GetSceneNode());
	APoint charPos = character->GetPosition();

	int aimTarget = instance->GetAimTarget();
	Character *aimTargetChar = DynamicCast<Character>(scene->GetActorByID(
		aimTarget));
	if (aimTargetChar)
	{
		SkillActorLinkPtr skillActorLink = new0 SkillActorLink();

		instance->AddSkillActor(aimTarget, skillActorLink);

		skillActorLink->SetID(10000+scene->GetNextID());

		skillActorLink->Initlize();

		if (!mSelfEffectFilename.empty())
			skillActorLink->SetMovableFilename(mSelfEffectFilename);

		skillActorLink->SetFromActorID(character->GetID());
		skillActorLink->SetFromActorAnchor(mSelfEffectAnchor);

		if (IsLinkToActor())
		{
			skillActorLink->SetTargetType(SkillActorLink::TT_ACTOR);
			skillActorLink->SetToActorID(aimTarget);
		}
		else
		{
			APoint toPos = charPos + mLinkDir * mSpeed * mLinkToTime; 

			skillActorLink->SetTargetType(SkillActorLink::TT_POSITION);
			skillActorLink->SetToPosition(toPos);
		}

		skillActorLink->SetPosition(charPos);
		skillActorLink->SetLinkSpeed(GetSpeed());

		skillActorLink->ShowHelpMovable(false);

		scene->AddActor(skillActorLink);

		skillActorLink->Start();

		if (!mSelfPosEffectFilename.empty())
		{
			APoint pos = character->GetPosition();
			Transform trans;
			trans.SetTranslate(pos);
			trans.SetRotate(character->GetMovable()->WorldTransform.GetRotate());

			if (!mSelfPosEffectFilename.empty())
			{
				Node *anchor = character->GetAnchor(mSelfPosEffectAnchor);
				if (anchor)
				{
					//trans = anchor->WorldTransform;
					trans.SetTranslate(anchor->WorldTransform.GetTranslate());
				}
			}

			Object *obj = PX2_RM.BlockLoadShareCopy(mSelfPosEffectFilename, false,
				false, true);
			if (obj)
			{
				EffectNode *effectNode = DynamicCast<EffectNode>(obj);
				if (effectNode)
				{
					effectNode->SetSelfCtrled(true);
					effectNode->WorldTransform = trans;
					effectNode->WorldTransformIsCurrent = true;
					sceneNode->AttachChild(effectNode);
					effectNode->ResetPlay();

					PX2_DM.AddDeletingObj(effectNode, mSelfPosEffectTime, 3.0f);
				}
			}
		}
	}
	else
	{
		if (PX2_PROJ.IsInEditor())
		{
			SkillActorLinkPtr skillActorLink = new0 SkillActorLink();

			instance->AddSkillActor(aimTarget, skillActorLink);

			skillActorLink->SetID(10000+scene->GetNextID());

			skillActorLink->Initlize();

			if (!mSelfEffectFilename.empty())
				skillActorLink->SetMovableFilename(mSelfEffectFilename);

			skillActorLink->SetFromActorID(character->GetID());
			skillActorLink->SetFromActorAnchor(mSelfEffectAnchor);

			if (IsLinkToActor())
			{
				skillActorLink->SetTargetType(SkillActorLink::TT_ACTOR);
				skillActorLink->SetToActorID(aimTarget);
			}
			else
			{
				APoint toPos = charPos + mLinkDir * mSpeed * mLinkToTime; 

				skillActorLink->SetTargetType(SkillActorLink::TT_POSITION);
				skillActorLink->SetToPosition(toPos);
			}

			skillActorLink->SetPosition(charPos);
			skillActorLink->SetLinkSpeed(GetSpeed());

			skillActorLink->ShowHelpMovable(false);

			scene->AddActor(skillActorLink);

			skillActorLink->Start();
		}
		else
		{
			// over
		}
	}
}
//----------------------------------------------------------------------------
bool Skill::Activate()
{
	Scene *scene = PX2_PROJ.GetScene();
	if (!scene) return false;

	if (!mCharacter)
		return false;

	if (!mFirstSkillStep)
		return false;

	if (mActivateAllowTimes >= 0)
	{
		if (mActivatedTimes >= mActivateAllowTimes)
			return false;
	}

	if (IsOnCD())
		return false;

	SkillController *skillComp = DynamicCast<SkillController>(
		mCharacter->GetControllerByName("SkillController"));
	if (skillComp)
	{
		assertion(false, "has no this component.");
		return false;
	}

	mIsActivatting = true;
	SetOnCD(true);
	SetOnCDTime(0.0f);

	float randomVal = Mathf::UnitRandom();
	if (randomVal > mActivateProbability)
		return true;

	mActivatedTimes++;

	const APoint &curPos = mCharacter->LocalTransform.GetTranslate();
	const AVector &faceDir = mCharacter->GetHeading();
	int aimTarget = skillComp->GetAimTarget();
	Character *aimChar = skillComp->GetAimTargetCharacter();
	int group = mCharacter->GetGroup();

	float radiusLength = GetMRadiusLength();
	float width = GetMWidth();
	float degree = GetMFanDegree();

	ShapeType shapeType = GetShapeType();
	int numRangeLock = GetNumRangeLock();
	AffectGroupType agt = GetAffectGroupType();

	if (NFT_NEAR == mNearFarType)
	{
		SkillInstance *inst = new0 SkillInstance(this);
		mSkillInstances.push_back(inst);

		int numAdded = 0;

		inst->SetAimTarget(aimTarget);

		if (IsRangeType()) // ·¶Ξ§
		{
			if (-1 == numRangeLock)
			{
				std::vector<Actor*> actors;
				scene->GetRangeActors(actors, curPos, radiusLength, true, GetSkillQueryBitSet());
				for (int i = 0; i < (int)actors.size(); i++)
				{
					Character *character = DynamicCast<Character>(actors[i]);

					if (character && !character->IsDead())
					{
						const APoint &targetPos = character->LocalTransform.GetTranslate();
						float targetRadius = character->GetRadius();

						if (IsInRange(curPos, radiusLength, width, faceDir, degree, targetPos,
							targetRadius, shapeType, false))
						{
							inst->AddTarget(character->GetID());
							numAdded++;
						}
					}
				}
			}
			else if (numRangeLock > 0)
			{
				if (AGT_SELF == agt)
				{
					inst->AddTarget(mCharacter->GetID());
					numAdded++;
				}

				std::vector<Actor*> actors;
				scene->GetRangeActors(actors, curPos, radiusLength, true, GetSkillQueryBitSet());
				for (int i = 0; i < (int)actors.size(); i++)
				{
					Character *character = DynamicCast<Character>(actors[i]);
					if (character && !character->IsDead() &&
						character != aimChar && character != mCharacter)
					{
						if ((AGT_ENEMYS == agt && character->GetGroup() != group) ||
							(AGT_SELF_GROUP==agt) && character->GetGroup()==group ||
							(AGT_SELF == agt && character->GetGroup() == group) ||
							(AGT_BOTH == agt))
						{
							const APoint &targetPos = character->LocalTransform.GetTranslate();
							float targetRadius = character->GetRadius();

							if (IsInRange(curPos, radiusLength, width, faceDir, degree, targetPos,
								targetRadius, shapeType, false) && numAdded < numRangeLock)
							{
								inst->AddTarget(character->GetID());
								numAdded++;
							}
						}
					}
				}
			}
		}
		else // µ¥Με
		{
			if (AGT_ENEMYS == agt || AGT_BOTH == agt)
			{
				Character *aimChar = skillComp->GetAimTargetCharacterAlive();
				if (aimChar && aimChar->IsContainAllBits(GetSkillQueryBitSet()))
				{
					const APoint &targetPos = aimChar->LocalTransform.GetTranslate();
					float targetRadius = aimChar->GetRadius();

					if (IsInRange(curPos, radiusLength, width, faceDir, degree, targetPos,
						targetRadius, shapeType, false))
					{
						inst->AddTarget(aimChar->GetID());
						numAdded++;
					}
				}
			}
			else if (AGT_SELF == agt)
			{
				inst->AddTarget(mCharacter->GetID());
				numAdded++;
			}
		}

		inst->Enter(mFirstSkillStep);
	}
	else
	{
		int multiAdd = 0;

		if (1 == mNumMultiInstance)
		{
			SkillInstance *inst = new0 SkillInstance(this);
			mSkillInstances.push_back(inst);
			inst->SetAimTarget(aimTarget);
			inst->Enter(mFirstSkillStep);

			multiAdd++;
		}
		else if (mNumMultiInstance > 1)
		{
			std::vector<Actor*> actors;
			scene->GetRangeActors(actors, curPos, radiusLength, true, GetSkillQueryBitSet());

			SkillInstance *inst = new0 SkillInstance(this);
			mSkillInstances.push_back(inst);

			if (AGT_ENEMYS == this->GetAffectGroupType())
			{
				inst->SetAimTarget(aimTarget);
			}
			else if (AGT_SELF == this->GetAffectGroupType())
			{
				inst->SetAimTarget(mCharacter->GetID());
			}

			inst->Enter(mFirstSkillStep);

			multiAdd++;

			for (int i = 0; i < (int)actors.size(); i++)
			{
				Character *character = DynamicCast<Character>(actors[i]);
				if (character && !character->IsDead() && character != aimChar && character != mCharacter)
				{
					SkillInstance *inst1 = new0 SkillInstance(this);
					mSkillInstances.push_back(inst1);
					inst1->SetAimTarget(character->GetID());
					inst->SetBeShared(true);
					inst1->Enter(mFirstSkillStep);

					multiAdd++;
				}

				if (multiAdd >= mNumMultiInstance)
					break;
			}
		}
	}

	return true;
}