//
// Tools_Entity_EffectVolume.h
//
// Created by Emil Popovic - 16/12/2008
// 
// Copyright (C) 2008 Rebellion, All Rights Reserved.
//
// Class to handle EffectVolume Property Window in tools. From here you can access all parameters inside EffectVolume.

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif


#ifndef __TOOLS_ENTITY_EFFECTVOLUME_H__
#define __TOOLS_ENTITY_EFFECTVOLUME_H__

#include "Entity/Tools_Entity_Object.h"

class Asura_ServerEntity_EffectVolume;

class Tools_Object_VolumeGroupEdit_Controller;

class Tools_Entity_EffectVolume : public Tools_Entity_Object
{
	typedef Tools_Entity_Object PARENT;

public:
	Tools_Entity_EffectVolume(Asura_Entity* pxEntity);
	virtual ~Tools_Entity_EffectVolume();

	static void Create();
	static Tools_Entity_EffectVolume* Create(bool bGenerateName );

	//virtual function overrides
	virtual const char* GetTypeDescription(){return "Effect Volume Controller";}
	virtual void AddOverlayControls(class Asura_Overlay* pxOverlay,class Asura_Vector_2& xOffset);
	virtual void Copy(const Tools_Object*);
	virtual bool CanBeCopied() const {return Type == TOT_Entity_EffectVolume;}
	virtual Tools_Object* CreateObjectOfThisType() const;
	virtual void OnSelection();
	virtual void OnDeselection();
	virtual void Render();
	virtual void Update();
	virtual void UpdatePositionInAsuraData(bool /*updateLinkedObjects*/);
	virtual void AddFilesToExportList(List<Asura_String>& xNameList) const;

	static const char* GetNamePrefix() { return "EV_"; }
	virtual const char* GetMyNamePrefix() const { return Tools_Entity_EffectVolume::GetNamePrefix(); }

	static bool CanPreviewThisObjectInTools(Asura_ServerEntity_EffectVolume* pxEntity);

protected:

	static void AddEffectNode(int iThis);
	static void RemoveEffectNode(int iThis);
	static void EditEffectNode(int iThis);

private:

	void	UpdateInputList();
	void	DeleteInputList();

	static void EditTransitionVolume();
	void ShowTransitionVolume(bool bShow);

	static void EditVolume();
	void ShowVolume(bool bShow);

	static bool _DoesAtLeastOneEffectExist( void );
	bool DoesAtLeastOneEffectExist();


	// Non static variables

	Asura_List_Dialog*	m_pxListDialog;

	Asura_Vector_3		m_xPreviousPosition;
	Asura_Matrix_3x3	m_xPreviousOrientation;

	int					m_iInputListSize;
	int					m_iInputSelection;
	char**				m_pszInputList;

	Tools_Object_VolumeGroupEdit_Controller* m_pxVolumeController;
	Tools_Object_VolumeGroupEdit_Controller* m_pxTransitionVolumeController;

	// This enum is only for creating Asura_List from which player can pick the Effect he wants to create.
	// The enum is not saved anywhere.
	enum EFFECT_VOLUME_EFFECT_TYPE
	{
		EFFECT_VOLUME_EFFECT_FOG	= 0,
		EFFECT_VOLUME_EFFECT_FSFX	,

		NUM_EFFECT_VOLUME_EFFECT_TYPES,
	};

	// Corresponding list of names to the enum EFFECT_VOLUME_EFFECT_TYPE
	static const char* s_aszEffectVolumeTypeNames[NUM_EFFECT_VOLUME_EFFECT_TYPES];

	static Tools_Entity_EffectVolume* s_pxSelectedEffectVolume;
	static Tools_Entity_EffectVolume* s_pxLastSelected;

	static bool  s_bMoveVolumeWithObject;
	static bool  s_bShowAllVolumes;
	static bool  s_bShowSelectedVolume;
	static bool	 s_bShowAllTransitionVolumes;
	static bool  s_bShowSelectedTransitionVolume;
	static bool	 s_bPreviewSelected;
	static bool  s_bPreviewAll;
};


#endif //__TOOLS_ENTITY_EFFECTVOLUME_H__
