112 lines
2.0 KiB
C++
112 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include "head.h"
|
|
|
|
class UISprite : public UI::Scene
|
|
{
|
|
public:
|
|
UISprite();
|
|
~UISprite();
|
|
|
|
virtual void Update() override;
|
|
|
|
private:
|
|
UI::Panel *_panelMenu;
|
|
|
|
UI::Panel *_panelBase;
|
|
gcSprite _sprPanda;
|
|
gcSprite _sprPandaEffect;
|
|
|
|
UI::Panel* _panelEffect;
|
|
gcSprite _sprBoard;
|
|
gcAnimation _aniEffect;
|
|
gcAnimation _aniEffectOver;
|
|
gcAnimation _aniEffectUnder;
|
|
gcAnimation _aniEffectColor;
|
|
gcAnimation _aniEffectAlpha;
|
|
gcAnimation _aniNormal;
|
|
gcAnimation _aniGray;
|
|
|
|
//
|
|
UI::Panel *_panelLink;
|
|
UI::EditBox *_edtSpeed;
|
|
gcSprite _sprSun;
|
|
gcSprite _sprEarth;
|
|
gcSprite _sprMoon;
|
|
std::list<Position2> _allMoonPos;
|
|
TimerRegular _tMoon;
|
|
|
|
// 性能测试
|
|
UI::Panel *_panelPerformance;
|
|
struct Ball
|
|
{
|
|
gcSprite _spr;
|
|
Position _v;
|
|
Position _pos;
|
|
};
|
|
std::vector<Ball> _vecBall;
|
|
bool _bUseCoor;
|
|
bool _bRender;
|
|
|
|
// 瓦片地图
|
|
struct MapNode
|
|
{
|
|
gcSprite _spr;
|
|
};
|
|
Coor* _coorTileMap;
|
|
Vector2<MapNode> _tileMap;
|
|
UI::Text* _txtTileMap;
|
|
|
|
// 帧动画
|
|
struct AnimationFSM
|
|
{
|
|
void SetState(std::string_view name)
|
|
{
|
|
_state = name;
|
|
gcAnimation ani_cur = GetAnimaitonCurrent();
|
|
if(ani_cur)
|
|
ani_cur->Replay(g_time->GetFrameTkc());
|
|
}
|
|
gcAnimation GetAnimaitonCurrent()
|
|
{
|
|
auto iter = _allAni.find(_state);
|
|
if (iter == _allAni.end())
|
|
return {};
|
|
return iter->second;
|
|
}
|
|
void AddState(std::string_view name, gcAnimation& ani)
|
|
{
|
|
_allAni[std::string{name}] = ani;
|
|
}
|
|
void Render()
|
|
{
|
|
auto iter = _allAni.find(_state);
|
|
if (iter == _allAni.end())
|
|
return;
|
|
iter->second->Render(g_time->GetFrameTkc());
|
|
}
|
|
std::unordered_map<std::string, gcAnimation> _allAni;
|
|
std::string _state;
|
|
}_fsmAni;
|
|
gcText _txtAni;
|
|
|
|
// 粒子系统
|
|
Particle* _par;
|
|
Particle* _parMouse;
|
|
Particle* _parClick;
|
|
|
|
void _init_tile_map();
|
|
void _update_base();
|
|
void _update_effect();
|
|
void _udpate_link();
|
|
void _update_performance();
|
|
void _update_tile();
|
|
void _update_animation();
|
|
void _update_particle();
|
|
|
|
void _add_test();
|
|
void _del_test()
|
|
{
|
|
_vecBall.resize(std::min(_vecBall.size(), (size_t)1000));
|
|
}
|
|
}; |