//-----------------------------------------------------------------------------
// File			: ToolsAVP_Node_Objective.h
// Author		: Gareth Thomas
// Created		: 18 / 12 / 2007
// Copyright (c) 2007 Rebellion. All rights reserved.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Begin File Wrapper
#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif
#ifndef __TOOLSAVP_NODE_OBJECTIVE_H___
#define __TOOLSAVP_NODE_OBJECTIVE_H___ 1
// End File Wrapper
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include "Entity/Locations/Tools_Entity_Node.h"
#include "Objects/Tools_VolumeGroupEdit_Controller.h"

class ToolsAVP_Objective_VolumeEdit_Controller;
//-----------------------------------------------------------------------------
// Class		: ToolsAVP_Node_Objective
// Author		: Gareth Thomas
// Created		: 23 / 01 / 08
// Description	: 
//-----------------------------------------------------------------------------
class ToolsAVP_Node_Objective : public Tools_Entity_Node
{

public:

	// Public Construction / Deconstruction functions...
	ToolsAVP_Node_Objective								( Asura_Entity* pxEntity );
	virtual ~ToolsAVP_Node_Objective					( void);

	// Public Static functions...
	static void				Create						( void );
	static Tools_Object*	Create						( Asura_Entity* pxEntity);
	static Tools_Object*	CreateAndReturn				( void );
	static void				Project_Create				( void );

	// Public Overridden Virtual Functions...
	virtual bool			IsBaseOrDerivativeOf		( int iToolsObjectType ) const;
	virtual bool			CanBeCopied					( void ) const							{ return ( true ); }
	virtual Tools_Object*	CreateObjectOfThisType		( void ) const;
	virtual const char*		GetTypeDescription			( void )								{ return ( "AVP Objective" ); }
	virtual void			OnSelection					( void );
	virtual void			OnDeselection				( void );
	virtual void			UpdateWhileSelected			( void );
	virtual void			Render						( void );
	virtual void			AddOverlayControls			( class Asura_Overlay* pxOverlay,class Asura_Vector_2& xOffset );

	static const Asura_Hashed_List < ToolsAVP_Node_Objective >* GetList(void)					{ return &s_xList; }

protected:

	typedef Tools_Entity_Node PARENT;

	ToolsAVP_Objective_VolumeEdit_Controller*		GetVolumeController( void )			{ return m_pxVolumeController; }
	ToolsAVP_Objective_VolumeEdit_Controller*		m_pxVolumeController;

	void UpdateGamePlayVolumeTextDialog                 (Asura_Dialog* pxDialog);
	static void EditVolume								( void );
	static void	SelectGPV								( void );
	static void ClearGPV								( void );
	static void SetSelectedGPV							( Asura_Guid uGuid );

	static bool											s_bVolumesEdited;
	static bool											s_bShowVolumes;
	static bool											s_bShowSelectedVolume;
	static bool											s_bMoveVolumeWithObject;

private:

	static Asura_Hashed_List<ToolsAVP_Node_Objective>	s_xList;
	static ToolsAVP_Node_Objective*						s_pxSelectedObjective;

};


//----------------------------------------------------------------------------------
// Class        : ToolsAVP_MarineObjective_VolumeEdit_Controller
// Author       : Gareth Thomas
// Date         : 12 / 05 / 08
// Description  : For dealing with editing the volumes associated with this entity
//----------------------------------------------------------------------------------
#include "Entity/Locations/Objective/AVP_ServerNode_Objective.h"

class ToolsAVP_Objective_VolumeEdit_Controller : public Tools_VolumeGroupEdit_Controller
{

public:

	typedef Tools_VolumeGroupEdit_Controller PARENT;

	// Public Construction / Deconstruction functions...
	ToolsAVP_Objective_VolumeEdit_Controller(ToolsAVP_Node_Objective* pxToolsEntity);

	// Public Virtual Functions...
	virtual void				StartVolumeEditing();
	virtual void				EndVolumeEditing();

	// Returns a Volume corresponding with the passed in index
	virtual Asura_Volume*		GetVolume(u_int uIndex)								{return m_pxAVPEntity->GetVolume(uIndex);}

protected:

	// Protected Overridden Virtual Functions...
	virtual bool				CanCreateVolume()									{return true;}
	virtual bool				CanDeleteVolume()									{return GetNumberOfVolumes() > 1;}
	//Gets the current number of volumes
	virtual int					GetNumberOfVolumes()								{return m_pxAVPEntity->GetNumVolumes();}
	//Gets a pointer to the orientation for a given volume. Returns 0 if there is none
	virtual Asura_Quat*			GetVolumeOrient(int iIndex)							{ return m_pxAVPEntity->GetVolumeOrient(static_cast<u_int>(iIndex)); }
	//Gets a default position for volume objects that have yet to gain a proper volume
	virtual Asura_Vector_3		GetDefaultPosition()								{return m_pxToolsEntity->Position;}
	//Gets the name of the owner , to use for part of the volume names
	virtual const char*			GetName()											{return m_pxToolsEntity->GetName();}
	// Creates the new volume in the asura data
	virtual void				CreateVolumeCuboidMain();
	// Creates the new volume in the asura data
	virtual void				CreateVolumeSphereMain();
	// Creates the new volume in the asura data
	virtual void				CreateVolumeCylinderMain();
	// Deletes a volume
	virtual void				DeleteVolumeMain(int iIndex);

private:

	// Private Member Variables...
	ToolsAVP_Node_Objective*		m_pxToolsEntity;
	AVP_ServerNode_Objective*    	m_pxAVPEntity;

};

#endif // __TOOLSAVP_NODE_OBJECTIVE_H___