TrackEventTrack.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <LyShine/Animation/IUiAnimation.h>
  10. #include "CryCommon/StlUtils.h"
  11. #include "AnimTrack.h"
  12. #include "AnimKey.h"
  13. class CUiAnimStringTable
  14. : public IUiAnimStringTable
  15. {
  16. public:
  17. AZ_CLASS_ALLOCATOR(CUiAnimStringTable, AZ::SystemAllocator);
  18. AZ_RTTI(CUiAnimStringTable, "{4640F535-0417-4BE6-A856-80A2C7D9E885}", IUiAnimStringTable);
  19. CUiAnimStringTable();
  20. ~CUiAnimStringTable();
  21. const char* Add(const char* p) override;
  22. //////////////////////////////////////////////////////////////////////////
  23. // for intrusive_ptr support
  24. void add_ref() override;
  25. void release() override;
  26. //////////////////////////////////////////////////////////////////////////
  27. static void Reflect([[maybe_unused]] AZ::SerializeContext* serializeContext) {}
  28. private:
  29. struct Page
  30. {
  31. Page* pPrev;
  32. char mem[512 - sizeof(Page*)];
  33. };
  34. typedef std::unordered_map<const char*, const char*, stl::hash_string<const char*>, stl::equality_string<const char*> > TableMap;
  35. private:
  36. CUiAnimStringTable(const CUiAnimStringTable&);
  37. CUiAnimStringTable& operator = (const CUiAnimStringTable&);
  38. private:
  39. int m_refCount;
  40. Page* m_pLastPage;
  41. char* m_pEnd;
  42. TableMap m_table;
  43. };
  44. class CUiTrackEventTrack
  45. : public TUiAnimTrack<IEventKey>
  46. {
  47. public:
  48. AZ_CLASS_ALLOCATOR(CUiTrackEventTrack, AZ::SystemAllocator);
  49. AZ_RTTI(CUiTrackEventTrack, "{18AB327E-02EA-43D9-BA3B-FB93B6C15837}", IUiAnimTrack);
  50. explicit CUiTrackEventTrack(IUiAnimStringTable* pStrings);
  51. CUiTrackEventTrack(); // default constr needed for AZ Serialization
  52. //////////////////////////////////////////////////////////////////////////
  53. // Overrides of IAnimTrack.
  54. //////////////////////////////////////////////////////////////////////////
  55. void GetKeyInfo(int key, const char*& description, float& duration) override;
  56. void SerializeKey(IEventKey& key, XmlNodeRef& keyNode, bool bLoading) override;
  57. void SetKey(int index, IKey* key) override;
  58. void InitPostLoad(IUiAnimSequence* sequence) override;
  59. static void Reflect(AZ::SerializeContext* serializeContext);
  60. private:
  61. AZStd::intrusive_ptr<IUiAnimStringTable> m_pStrings;
  62. };