aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.h
blob: f7a703b345b0f6fc4fd0c74e5d5c4b02f42791a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once

#include "UIControl_Button.h"

class UIControl_EnchantmentButton : public UIControl_Button
{
private:
	// Maps to values in AS
	enum EState
	{
		eState_Inactive = 0,
		eState_Active = 1,
		eState_Selected = 2,
	};

	EState m_lastState;
	int m_lastCost;
	int m_index;
	wstring m_enchantmentString;
	bool m_bHasFocus;

	IggyName m_funcChangeState;

	unsigned int m_textColour, m_textFocusColour, m_textDisabledColour;

	class EnchantmentNames
	{
	public:
		static EnchantmentNames instance;

	private:
		Random random;
		vector<wstring> words;

		EnchantmentNames();

	public:
		wstring getRandomName();
	};

public:
	UIControl_EnchantmentButton();

	virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);

	virtual void tick();

	void init(int index);
	virtual void ReInit();
	void render(IggyCustomDrawCallbackRegion *region);

	void updateState();

	virtual void setFocus(bool focus);
};