#pragma once
#include "global.h"
#include "Entity.h"
#include "EntityRes.h"
#include "MyView.h"
#include "UiBossHpBar.h"
//游戏左上方属性栏绘制
class GameUI
{
public:
	GameUI();
	virtual ~GameUI();
	void Init(MyDX11Renderer* pRenderer, MyView* pView, EntityRes* entityResCopy);
	void Reset();
	void OnResetScale();
	void Step();
	void Draw(float deltaTime);
	void SetVisible(bool bVisiable);
	PlayerUIData* GetPlayerUIData(int playerIndex);
	UiBossHpBar* GetBossHpBar();
	std::weak_ptr<Entity>* GetPlayerKey(int playerIndex);
	void Swap();
private:
	void DrawPlayerBoard();//绘制玩家UI板
	void DrawPlayer1UI();//绘制玩家1UI
	void DrawPlayer2UI();//绘制玩家2UI
	void DrawAddNum(float srcX, float srcY, float dstX, float dstY, int num, bool order = false);//绘制数字
	void DrawAddOxygenNum(float srcX, float srcY, float dstX, float dstY, int num, bool order = false);//绘制大数字
	MyDX11Renderer* pRenderer = nullptr;
	MyView* pView = nullptr;
	EntityRes entityRes;
	bool showPlayer2UI = false;//绘制玩家2的UI
	//玩家1
	PlayerUIData player1UI;
	//玩家2
	PlayerUIData player2UI;
	bool bVisiable = false;
	//效果实体
	std::list<std::shared_ptr<Entity>> Ui;//界面实体
	MyView uiView;
	//UI位置控制
	float offY = 0;
	float offX = 0;
	//气泡效果
	int bubbleInterval = 0;
	void BubbleStep();
	//投掷物动画
	void ThrowItemStep();
	//闪烁动画
	void FlashStep();
	//技能按键显示
	std::list<std::shared_ptr<Entity>> ui_player1Key;//界面实体
	std::list<std::shared_ptr<Entity>> ui_player2Key;//界面实体
	std::weak_ptr<Entity> keyArrPlayer1[20];//只保存指针
	std::weak_ptr<Entity> keyArrPlayer2[20];
	//Boss战
	UiBossHpBar bossHpBar;
	//UI切换动画
	float swap_counter = 0;
	float swap_counter_last = 0;
	float swap_counter_max = 100;
};

