#pragma once
#include "EngineFrame/Scene/Scene.h"
#include "Asset/AssetManager.h"
#include "EngineFrame/Component/Animation.h"
#include "Actor/Map/GameMap.h"
#include "Actor/Map/GameMapCamera.h"
#include "Actor/Object/CharacterObject.h"
class Scene_SelectCharacter_UI : public Scene
{
private:
    /* data */
    GameMap *map;
    RefPtr<GameMapCamera> camera = nullptr;

public:
    Scene_SelectCharacter_UI(/* args */) {

    };
    ~Scene_SelectCharacter_UI() {

    };

public:
    void Enter() override
    {
        map = new GameMap;
        map->LoadMap("map/cataclysm/town/elvengard/new_elvengard.map");
        map->Enter(this);

        RefPtr<CharacterObject> obj = new CharacterObject();
        obj->SetPosition({620, 200, 0});
        // 构造为鬼剑士
        obj->Construction(0);

        map->AddObject(obj);

        camera = new GameMapCamera;
        camera->SetParentMap(map);
        camera->SetFromActor(obj.Get());
        AddChild(camera);

        // RefPtr<Actor> actor = new Actor;
        // actor->SetPos(VecFPos{450, 350});
        // // actor->SetAnchor(VecFPos{0.5, 0.5});
        // actor->SetScale(VecFPos{-1.f, 1.f});
        // AddChild(actor);

        // RefPtr<Actor> actor2 = new Actor;
        // actor->AddChild(actor2);

        // RefPtr<Animation> ani4 = new Animation("map/cataclysm/town/hendonmyre/animation/object/gateall_02.ani");
        // // ani4->SetScale(VecFPos{-1.0, 1.0});
        // actor2->AddChild(ani4);

        // RefPtr<Animation> ani3 = new Animation("map/cataclysm/town/elvengard/animation/obj/serialight01_right.ani");
        // ani3->SetPos(VecPos{300, 300});
        // actor->AddChild(ani3);

        // RefPtr<Animation> ani4 = new Animation("map/cataclysm/town/hendonmyre/animation/object/gateall_02.ani");
        // ani4->SetPos(VecPos{300, 500});
        // actor->AddChild(ani4);

        // for (size_t i = 0; i < 400; i++)
        // {
        //     RefPtr<Actor> actor = new Actor;
        //     AddChild(actor);

        //     // RefPtr<Animation> ani3 = new Animation("common/commoneffect/animation/priestslowheal1.ani");
        //     // actor->AddComponent(ani3);
        //     // ani3->SetRenderZOrder(1000);

        //     // RefPtr<Animation> ani = new Animation("common/anton/main.ani");
        //     // actor->AddComponent(ani);
        //     // ani->SetRenderZOrder(500);

        //     RefPtr<Sprite> sprite = new Sprite("sprite/item/avatar/swordman/0sm_acap.img", 0);
        //     actor->AddComponent(sprite);
        //     // RefPtr<Animation> ani2 = new Animation("common/anton/face/0/0.ani");
        //     // actor->AddComponent(ani2);
        //     // ani2->SetRenderZOrder(1000);
        // }

        // SDL_Log("进入了选择角色场景!");
    };

    void HandleEvents(SDL_Event *e) override
    {
        Scene::HandleEvents(e);
        map->HandleEvents(e);
    };
    void Update(float deltaTime) override
    {
        Scene::Update(deltaTime);
        map->Update(deltaTime);
    };
    // void Render() override;
    // void Exit() override;
};
