ChatPlexSDK-BS 1.0.1-v6.2.0
C++ ChatPlex BeatSaber SDK
Loading...
Searching...
No Matches
IXUIElement.hpp
1#pragma once
2
3#include "../../ChatPlexSDK.hpp"
4#include "../../UI/UIIl2cpp.hpp"
5#include "../../UI/UISystem.hpp"
6
7#include <UnityEngine/GameObject.hpp>
8#include <UnityEngine/RectTransform.hpp>
9#include <UnityEngine/Transform.hpp>
10
11#include <string>
12
13namespace CP_SDK::XUI {
14
15 namespace _u
16 {
17 using namespace TMPro;
18 using namespace UnityEngine;
19 using namespace UnityEngine::UI;
20 }
21 namespace _v
22 {
23 using namespace CP_SDK::UI;
24 using namespace CP_SDK::UI::Components;
25 using namespace CP_SDK::Utils;
26 }
27
29 #define XUI_PROXY_IMPL(__Type, __Impl) { if (m_Element) { auto x = m_Element.Ptr(false); __Impl; return this; } else return OnReady([=](__Type* x) __Impl); }
30 #define XUI_PROXY_IMPL_EX(__Type, __Impl) { if (m_Element) { auto x = m_Element.Ptr(false); __Impl; return (t_Base*)this; } else return OnReady([=](__Type* x) __Impl); }
31
34 {
35 CP_SDK_NO_COPYMOVE_CTORS(IXUIElement);
36
37 public:
38 enum class ETypeID
39 {
40 ColorInput,
41 Dropdown,
42 FLayout,
43 GLayout,
44 HLayout,
45 HSpacer,
46 IconButton,
47 Image,
48 PrimaryButton,
49 SecondaryButton,
50 Slider,
51 TabControl,
52 Text,
53 TextInput,
54 TextSegmentedControl,
55 Toggle,
56 VLayout,
57 VSpacer,
58 VScrollView,
59 VVList,
60 };
61
62 ETypeID m_TypeID;
63
64 protected:
65 std::u16string m_InitialName;
66
67 public:
68 virtual _v::UIFieldRef<_u::RectTransform> RTransform() = 0;
69
70 protected:
74 IXUIElement(std::u16string_view p_Name, ETypeID p_TypeID)
75 : m_InitialName(p_Name), m_TypeID(p_TypeID)
76 { }
78 virtual ~IXUIElement() = default;
79
80 protected:
82 std::u16string_view GetInitialName()
83 {
84 return m_InitialName;
85 }
86
87 public:
90 virtual void BuildUI(_u::Transform* p_Parent) = 0;
91
92 };
93
94}
Element interface.
IXUIElement(std::u16string_view p_Name, ETypeID p_TypeID)
Constructor.
virtual void BuildUI(_u::Transform *p_Parent)=0
BuildUI for this element into p_Parent transform.
std::u16string_view GetInitialName()
Get initial name.
virtual ~IXUIElement()=default
Destructor.
Generic UI components.
User interface components, views, flow coordinator, builders and factories.
Various platform utils like Delegate/Action/Function/Event system.
Definition Delegate.hpp:8
Tree like syntax CP_SDK::UI builder.