AVA2 cross-platform client parity baseline
This commit is contained in:
@@ -0,0 +1,694 @@
|
||||
#pragma once
|
||||
|
||||
#include "shared/common/Win32Types.h"
|
||||
#include "shared/common/EterBaseUtils.h"
|
||||
#include "shared/common/PythonUtils.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include "src/eter_image/GrpImageInstance.h"
|
||||
#include "src/eter_image/GrpExpandedImageInstance.h"
|
||||
#include "src/eter_image/GrpMarkInstance.h"
|
||||
#include "src/eter_resource/ResourceManager.h"
|
||||
|
||||
namespace UI
|
||||
{
|
||||
|
||||
class CGraphicTextInstance {
|
||||
public:
|
||||
enum {
|
||||
HORIZONTAL_ALIGN_LEFT = 0x01,
|
||||
HORIZONTAL_ALIGN_CENTER = 0x02,
|
||||
HORIZONTAL_ALIGN_RIGHT = 0x03,
|
||||
VERTICAL_ALIGN_TOP = 0x10,
|
||||
VERTICAL_ALIGN_CENTER = 0x20,
|
||||
VERTICAL_ALIGN_BOTTOM = 0x30
|
||||
};
|
||||
CGraphicTextInstance() = default;
|
||||
~CGraphicTextInstance() = default;
|
||||
void SetText(const char* text) { if (text) m_text = text; }
|
||||
const char* GetText() const { return m_text.c_str(); }
|
||||
void SetValue(const char* text) { SetText(text); }
|
||||
void SetHorizonalAlign(int align) { m_hAlign = align; }
|
||||
void SetVerticalAlign(int align) { m_vAlign = align; }
|
||||
void SetMax(int max) { m_max = max; }
|
||||
void SetFontName(const char* name) { if (name) m_font = name; }
|
||||
void SetFontColor(DWORD color) { m_color = color; }
|
||||
void SetLimitWidth(float w) { m_limitWidth = w; }
|
||||
void SetSecret(BOOL b) { m_secret = b; }
|
||||
void SetOutline(BOOL b) { m_outline = b; }
|
||||
void SetFeather(BOOL b) { m_feather = b; }
|
||||
void SetMultiLine(BOOL b) { m_multiLine = b; }
|
||||
void SetLineHeight(int h) { m_lineHeight = h; }
|
||||
int GetLineHeight() const { return m_lineHeight; }
|
||||
int GetTextLineCount() const { return 1; }
|
||||
void DisableEnterToken() {}
|
||||
void ShowCursor() { m_showCursor = true; }
|
||||
void HideCursor() { m_showCursor = false; }
|
||||
int GetCursorPosition() const { return (int)m_text.length(); }
|
||||
void GetTextSize(int* w, int* h) {
|
||||
if (w) *w = (int)m_text.length() * 6;
|
||||
if (h) *h = 12;
|
||||
}
|
||||
void SetPosition(float fx, float fy) { m_v2Position.x = fx; m_v2Position.y = fy; }
|
||||
D3DXVECTOR2 GetPosition() const { return m_v2Position; }
|
||||
void Update() {}
|
||||
void Render();
|
||||
static const char* Hyperlink_GetText(const std::string&, int, int*) { return ""; }
|
||||
private:
|
||||
D3DXVECTOR2 m_v2Position = D3DXVECTOR2(0.0f, 0.0f);
|
||||
std::string m_text;
|
||||
std::string m_font;
|
||||
DWORD m_color = 0xffffffff;
|
||||
int m_hAlign = HORIZONTAL_ALIGN_LEFT;
|
||||
int m_vAlign = VERTICAL_ALIGN_TOP;
|
||||
int m_max = 0;
|
||||
int m_lineHeight = 12;
|
||||
float m_limitWidth = 0.0f;
|
||||
BOOL m_secret = FALSE;
|
||||
BOOL m_outline = FALSE;
|
||||
BOOL m_feather = FALSE;
|
||||
BOOL m_multiLine = FALSE;
|
||||
bool m_showCursor = false;
|
||||
};
|
||||
|
||||
class CWindow
|
||||
{
|
||||
public:
|
||||
typedef std::list<CWindow *> TWindowContainer;
|
||||
|
||||
static DWORD Type();
|
||||
BOOL IsType(DWORD dwType);
|
||||
|
||||
enum EHorizontalAlign
|
||||
{
|
||||
HORIZONTAL_ALIGN_LEFT = 0,
|
||||
HORIZONTAL_ALIGN_CENTER = 1,
|
||||
HORIZONTAL_ALIGN_RIGHT = 2,
|
||||
};
|
||||
|
||||
enum EVerticalAlign
|
||||
{
|
||||
VERTICAL_ALIGN_TOP = 0,
|
||||
VERTICAL_ALIGN_CENTER = 1,
|
||||
VERTICAL_ALIGN_BOTTOM = 2,
|
||||
};
|
||||
|
||||
enum EFlags
|
||||
{
|
||||
FLAG_MOVABLE = (1 << 0),
|
||||
FLAG_LIMIT = (1 << 1),
|
||||
FLAG_SNAP = (1 << 2),
|
||||
FLAG_DRAGABLE = (1 << 3),
|
||||
FLAG_ATTACH = (1 << 4),
|
||||
FLAG_RESTRICT_X = (1 << 5),
|
||||
FLAG_RESTRICT_Y = (1 << 6),
|
||||
FLAG_NOT_CAPTURE = (1 << 7),
|
||||
FLAG_FLOAT = (1 << 8),
|
||||
FLAG_NOT_PICK = (1 << 9),
|
||||
FLAG_IGNORE_SIZE = (1 << 10),
|
||||
FLAG_RTL = (1 << 11),
|
||||
};
|
||||
|
||||
public:
|
||||
CWindow(PyObject * ppyObject);
|
||||
virtual ~CWindow();
|
||||
|
||||
void AddChild(CWindow * pWin);
|
||||
void Clear();
|
||||
void DestroyHandle();
|
||||
void Update();
|
||||
void Render();
|
||||
|
||||
void SetName(const char * c_szName);
|
||||
const char * GetName() { return m_strName.c_str(); }
|
||||
void SetSize(long width, long height);
|
||||
long GetWidth() { return m_lWidth; }
|
||||
long GetHeight() { return m_lHeight; }
|
||||
|
||||
void SetHorizontalAlign(DWORD dwAlign);
|
||||
void SetVerticalAlign(DWORD dwAlign);
|
||||
void SetPosition(long x, long y);
|
||||
void GetPosition(long * plx, long * ply);
|
||||
long GetPositionX( void ) const { return m_x; }
|
||||
long GetPositionY( void ) const { return m_y; }
|
||||
RECT & GetRect() { return m_rect; }
|
||||
void GetLocalPosition(long & rlx, long & rly);
|
||||
void GetMouseLocalPosition(long & rlx, long & rly);
|
||||
long UpdateRect();
|
||||
|
||||
RECT & GetLimitBias() { return m_limitBiasRect; }
|
||||
void SetLimitBias(long l, long r, long t, long b) { m_limitBiasRect.left = l; m_limitBiasRect.right = r; m_limitBiasRect.top = t; m_limitBiasRect.bottom = b; }
|
||||
|
||||
void Show();
|
||||
void Hide();
|
||||
bool IsShow() { return m_bShow; }
|
||||
bool IsRendering();
|
||||
|
||||
bool HasParent() { return m_pParent ? true : false; }
|
||||
bool HasChild() { return !m_pChildList.empty(); }
|
||||
int GetChildCount() { return (int)m_pChildList.size(); }
|
||||
|
||||
CWindow * GetRoot();
|
||||
CWindow * GetParent();
|
||||
bool IsChild(CWindow * pWin);
|
||||
void DeleteChild(CWindow * pWin);
|
||||
void SetTop(CWindow * pWin);
|
||||
|
||||
bool IsIn(long x, long y);
|
||||
bool IsIn();
|
||||
CWindow * PickWindow(long x, long y);
|
||||
CWindow * PickTopWindow(long x, long y);
|
||||
|
||||
void __RemoveReserveChildren();
|
||||
|
||||
void AddFlag(DWORD flag) { SET_BIT(m_dwFlag, flag); }
|
||||
void RemoveFlag(DWORD flag) { REMOVE_BIT(m_dwFlag, flag); }
|
||||
bool IsFlag(DWORD flag) { return (m_dwFlag & flag) ? true : false; }
|
||||
|
||||
virtual void OnRender();
|
||||
virtual void OnUpdate();
|
||||
virtual void OnChangePosition(){}
|
||||
|
||||
virtual void OnSetFocus();
|
||||
virtual void OnKillFocus();
|
||||
|
||||
virtual void OnMouseDrag(long lx, long ly);
|
||||
virtual void OnMouseOverIn();
|
||||
virtual void OnMouseOverOut();
|
||||
virtual void OnMouseOver();
|
||||
virtual void OnDrop();
|
||||
virtual void OnTop();
|
||||
virtual void OnIMEUpdate();
|
||||
|
||||
virtual void OnMoveWindow(long x, long y);
|
||||
|
||||
BOOL RunIMETabEvent();
|
||||
BOOL RunIMEReturnEvent();
|
||||
BOOL RunIMEKeyDownEvent(int ikey);
|
||||
|
||||
CWindow * RunKeyDownEvent(int ikey);
|
||||
BOOL RunKeyUpEvent(int ikey);
|
||||
BOOL RunPressEscapeKeyEvent();
|
||||
BOOL RunPressExitKeyEvent();
|
||||
|
||||
virtual BOOL OnIMETabEvent();
|
||||
virtual BOOL OnIMEReturnEvent();
|
||||
virtual BOOL OnIMEKeyDownEvent(int ikey);
|
||||
|
||||
virtual BOOL OnIMEChangeCodePage();
|
||||
virtual BOOL OnIMEOpenCandidateListEvent();
|
||||
virtual BOOL OnIMECloseCandidateListEvent();
|
||||
virtual BOOL OnIMEOpenReadingWndEvent();
|
||||
virtual BOOL OnIMECloseReadingWndEvent();
|
||||
|
||||
virtual BOOL OnMouseLeftButtonDown();
|
||||
virtual BOOL OnMouseLeftButtonUp();
|
||||
virtual BOOL OnMouseLeftButtonDoubleClick();
|
||||
virtual BOOL OnMouseRightButtonDown();
|
||||
virtual BOOL OnMouseRightButtonUp();
|
||||
virtual BOOL OnMouseRightButtonDoubleClick();
|
||||
virtual BOOL OnMouseMiddleButtonDown();
|
||||
virtual BOOL OnMouseMiddleButtonUp();
|
||||
virtual BOOL OnMouseWheelScroll(short wDelta) { return FALSE; }
|
||||
virtual void SetScrollable() { m_bIsScrollable = true; }
|
||||
virtual BOOL OnMouseWheel(int nLen) { return FALSE; }
|
||||
virtual BOOL RunMouseWheelEvent(long nLen) { return FALSE; }
|
||||
|
||||
virtual BOOL OnKeyDown(int ikey);
|
||||
virtual BOOL OnKeyUp(int ikey);
|
||||
virtual BOOL OnPressEscapeKey();
|
||||
virtual BOOL OnPressExitKey();
|
||||
|
||||
virtual void SetColor(DWORD dwColor){}
|
||||
virtual BOOL OnIsType(DWORD dwType);
|
||||
|
||||
virtual BOOL IsWindow() { return TRUE; }
|
||||
|
||||
protected:
|
||||
std::string m_strName;
|
||||
EHorizontalAlign m_HorizontalAlign;
|
||||
EVerticalAlign m_VerticalAlign;
|
||||
long m_x, m_y;
|
||||
long m_lWidth, m_lHeight;
|
||||
RECT m_rect;
|
||||
RECT m_limitBiasRect;
|
||||
bool m_bMovable;
|
||||
bool m_bShow;
|
||||
DWORD m_dwFlag;
|
||||
PyObject * m_poHandler;
|
||||
CWindow * m_pParent;
|
||||
TWindowContainer m_pChildList;
|
||||
BOOL m_isUpdatingChildren;
|
||||
TWindowContainer m_pReserveChildList;
|
||||
bool m_bIsScrollable = false;
|
||||
};
|
||||
|
||||
class CLayer : public CWindow
|
||||
{
|
||||
public:
|
||||
CLayer(PyObject * ppyObject) : CWindow(ppyObject) {}
|
||||
virtual ~CLayer() {}
|
||||
BOOL IsWindow() override { return FALSE; }
|
||||
};
|
||||
|
||||
class CBox : public CWindow
|
||||
{
|
||||
public:
|
||||
CBox(PyObject * ppyObject) : CWindow(ppyObject), m_dwColor(0) {}
|
||||
virtual ~CBox() {}
|
||||
void SetColor(DWORD dwColor) override { m_dwColor = dwColor; }
|
||||
protected:
|
||||
void OnRender() override;
|
||||
DWORD m_dwColor;
|
||||
};
|
||||
|
||||
class CBar : public CWindow
|
||||
{
|
||||
public:
|
||||
CBar(PyObject * ppyObject) : CWindow(ppyObject), m_dwColor(0) {}
|
||||
virtual ~CBar() {}
|
||||
void SetColor(DWORD dwColor) override { m_dwColor = dwColor; }
|
||||
protected:
|
||||
void OnRender() override;
|
||||
DWORD m_dwColor;
|
||||
};
|
||||
|
||||
class CLine : public CWindow
|
||||
{
|
||||
public:
|
||||
CLine(PyObject * ppyObject) : CWindow(ppyObject), m_dwColor(0) {}
|
||||
virtual ~CLine() {}
|
||||
void SetColor(DWORD dwColor) override { m_dwColor = dwColor; }
|
||||
protected:
|
||||
void OnRender() override;
|
||||
DWORD m_dwColor;
|
||||
};
|
||||
|
||||
class CBar3D : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CBar3D(PyObject * ppyObject) : CWindow(ppyObject), m_dwLeftColor(0), m_dwRightColor(0), m_dwCenterColor(0) {}
|
||||
virtual ~CBar3D() {}
|
||||
void SetColor(DWORD l, DWORD r, DWORD c) { m_dwLeftColor = l; m_dwRightColor = r; m_dwCenterColor = c; }
|
||||
protected:
|
||||
void OnRender() override;
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
DWORD m_dwLeftColor, m_dwRightColor, m_dwCenterColor;
|
||||
};
|
||||
|
||||
class CTextLine : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CTextLine(PyObject * ppyObject);
|
||||
virtual ~CTextLine();
|
||||
void SetMax(int iMax) { m_TextInstance.SetMax(iMax); }
|
||||
void SetHorizontalAlign(int iType) { m_TextInstance.SetHorizonalAlign(iType); }
|
||||
void SetVerticalAlign(int iType) { m_TextInstance.SetVerticalAlign(iType); }
|
||||
void SetSecret(BOOL bFlag) { m_TextInstance.SetSecret(bFlag); }
|
||||
void SetOutline(BOOL bFlag) { m_TextInstance.SetOutline(bFlag); }
|
||||
void SetFeather(BOOL bFlag) { m_TextInstance.SetFeather(bFlag); }
|
||||
void SetMultiLine(BOOL bFlag) { m_TextInstance.SetMultiLine(bFlag); }
|
||||
void SetFontName(const char * c_szFontName) { m_TextInstance.SetFontName(c_szFontName); }
|
||||
void SetFontColor(DWORD dwColor) { m_TextInstance.SetFontColor(dwColor); }
|
||||
void SetLimitWidth(float fWidth) { m_TextInstance.SetLimitWidth(fWidth); }
|
||||
void ShowCursor() { m_TextInstance.ShowCursor(); }
|
||||
void HideCursor() { m_TextInstance.HideCursor(); }
|
||||
int GetCursorPosition() { return m_TextInstance.GetCursorPosition(); }
|
||||
void SetText(const char * c_szText);
|
||||
const char * GetText() { return m_TextInstance.GetText(); }
|
||||
void GetTextSize(int* pnWidth, int* pnHeight) { m_TextInstance.GetTextSize(pnWidth, pnHeight); }
|
||||
int GetTextLineCount() { return m_TextInstance.GetTextLineCount(); }
|
||||
void DisableEnterToken() { m_TextInstance.DisableEnterToken(); }
|
||||
void SetLineHeight(int iHeight) { m_TextInstance.SetLineHeight(iHeight); }
|
||||
int GetLineHeight() { return m_TextInstance.GetLineHeight(); }
|
||||
protected:
|
||||
void OnRender() override;
|
||||
void OnChangePosition() override;
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
CGraphicTextInstance m_TextInstance;
|
||||
};
|
||||
|
||||
class CNumberLine : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CNumberLine(PyObject * ppyObject) : CWindow(ppyObject), m_iHorizontalAlign(0), m_dwWidthSummary(0) {}
|
||||
CNumberLine(CWindow * pParent) : CWindow(nullptr), m_iHorizontalAlign(0), m_dwWidthSummary(0) { m_pParent = pParent; }
|
||||
virtual ~CNumberLine() {}
|
||||
void SetPath(const char * c_szPath) { if (c_szPath) m_strPath = c_szPath; }
|
||||
void SetHorizontalAlign(int iType) { m_iHorizontalAlign = iType; }
|
||||
void SetNumber(const char * c_szNumber) { if (c_szNumber) m_strNumber = c_szNumber; }
|
||||
protected:
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
std::string m_strPath, m_strNumber;
|
||||
int m_iHorizontalAlign;
|
||||
DWORD m_dwWidthSummary;
|
||||
};
|
||||
|
||||
class CImageBox : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CImageBox(PyObject * ppyObject);
|
||||
virtual ~CImageBox();
|
||||
|
||||
void LeftRightReverse();
|
||||
BOOL LoadImage(CGraphicImageInstance* imageInstance);
|
||||
BOOL LoadImage(const char * c_szFileName);
|
||||
void SetDiffuseColor(float fr, float fg, float fb, float fa);
|
||||
|
||||
void Clear();
|
||||
int GetWidth();
|
||||
int GetHeight();
|
||||
void SetScale(float sx, float sy);
|
||||
void SetCoolTime(float fCoolTime) { m_fCoolTime = fCoolTime; }
|
||||
void SetCoolTimeStart(float fCoolTimeStart) { m_fCoolTimeStart = fCoolTimeStart; }
|
||||
|
||||
protected:
|
||||
virtual void OnCreateInstance();
|
||||
virtual void OnDestroyInstance();
|
||||
|
||||
void OnUpdate() override;
|
||||
void OnRender() override;
|
||||
void OnChangePosition() override;
|
||||
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
|
||||
protected:
|
||||
CGraphicImageInstance * m_pImageInstance;
|
||||
float m_fCoolTime;
|
||||
float m_fCoolTimeStart;
|
||||
};
|
||||
|
||||
class CMarkBox : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CMarkBox(PyObject * ppyObject);
|
||||
virtual ~CMarkBox();
|
||||
|
||||
void LoadImage(const char * c_szFilename);
|
||||
void SetDiffuseColor(float fr, float fg, float fb, float fa);
|
||||
void SetIndex(UINT uIndex);
|
||||
void SetScale(FLOAT fScale);
|
||||
|
||||
protected:
|
||||
virtual void OnCreateInstance();
|
||||
virtual void OnDestroyInstance();
|
||||
|
||||
void OnUpdate() override;
|
||||
void OnRender() override;
|
||||
void OnChangePosition() override;
|
||||
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
|
||||
protected:
|
||||
CGraphicMarkInstance * m_pMarkInstance;
|
||||
};
|
||||
|
||||
class CExpandedImageBox : public CImageBox
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CExpandedImageBox(PyObject * ppyObject);
|
||||
virtual ~CExpandedImageBox();
|
||||
|
||||
void SetScale(float fx, float fy);
|
||||
void SetOrigin(float fx, float fy);
|
||||
void SetRotation(float fRotation);
|
||||
void SetRenderingRect(float fLeft, float fTop, float fRight, float fBottom);
|
||||
void SetRenderingMode(int iMode);
|
||||
void SetImageClipRect(float fLeft, float fTop, float fRight, float fBottom, bool bIsVertical = false) {}
|
||||
|
||||
protected:
|
||||
void OnCreateInstance() override;
|
||||
void OnDestroyInstance() override;
|
||||
|
||||
void OnUpdate() override;
|
||||
void OnRender() override;
|
||||
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
};
|
||||
|
||||
class CAniImageBox : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CAniImageBox(PyObject * ppyObject);
|
||||
virtual ~CAniImageBox();
|
||||
|
||||
void SetDelay(int iDelay);
|
||||
void AppendImage(const char * c_szFileName, float r = 1.0, float g = 1.0, float b = 1.0, float a = 1.0);
|
||||
void SetRenderingRect(float fLeft, float fTop, float fRight, float fBottom);
|
||||
void SetRenderingMode(int iMode);
|
||||
void AppendImageScale(const char * c_szFileName, float scale_x, float scale_y);
|
||||
void ResetFrame();
|
||||
void SetRotation(float fRotation);
|
||||
void SetMoveStatus(bool bFlag);
|
||||
void SetMoveSpeed(float speed);
|
||||
void SetMovePos(float directionX, float directionY);
|
||||
float GetRotation();
|
||||
|
||||
protected:
|
||||
void OnUpdate() override;
|
||||
void OnRender() override;
|
||||
void OnChangePosition() override;
|
||||
virtual void OnEndFrame();
|
||||
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
|
||||
protected:
|
||||
BYTE m_bycurDelay;
|
||||
BYTE m_byDelay;
|
||||
BYTE m_bycurIndex;
|
||||
std::vector<CGraphicExpandedImageInstance*> m_ImageVector;
|
||||
};
|
||||
|
||||
class CButton : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CButton(PyObject * ppyObject);
|
||||
virtual ~CButton();
|
||||
|
||||
void LeftRightReverse();
|
||||
|
||||
BOOL SetUpVisual(const char * c_szFileName);
|
||||
BOOL SetOverVisual(const char * c_szFileName);
|
||||
BOOL SetDownVisual(const char * c_szFileName);
|
||||
BOOL SetDisableVisual(const char * c_szFileName);
|
||||
void SetRenderingRect(float fLeft, float fTop, float fRight, float fBottom) {}
|
||||
|
||||
const char * GetUpVisualFileName();
|
||||
const char * GetOverVisualFileName();
|
||||
const char * GetDownVisualFileName();
|
||||
|
||||
void FlashEx() { m_isFlashEx = TRUE; }
|
||||
void Flash(bool bFlash = true) { m_isFlash = bFlash; }
|
||||
void Enable() { m_bEnable = TRUE; }
|
||||
void Disable() { m_bEnable = FALSE; }
|
||||
|
||||
void SetUp();
|
||||
void Up();
|
||||
void Over();
|
||||
void Down();
|
||||
|
||||
BOOL IsDisable() { return !m_bEnable; }
|
||||
BOOL IsPressed() { return m_isPressed; }
|
||||
|
||||
protected:
|
||||
void OnUpdate() override;
|
||||
void OnRender() override;
|
||||
void OnChangePosition() override;
|
||||
|
||||
BOOL OnMouseLeftButtonDown() override;
|
||||
BOOL OnMouseLeftButtonUp() override;
|
||||
void OnMouseOverIn() override;
|
||||
void OnMouseOverOut() override;
|
||||
|
||||
BOOL IsEnable() { return m_bEnable; }
|
||||
void SetCurrentVisual(CGraphicImageInstance* pVisual);
|
||||
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
|
||||
protected:
|
||||
BOOL m_bEnable;
|
||||
BOOL m_isPressed;
|
||||
BOOL m_isFlashEx;
|
||||
BOOL m_isFlash;
|
||||
CGraphicImageInstance* m_pcurVisual;
|
||||
CGraphicImageInstance m_upVisual;
|
||||
CGraphicImageInstance m_overVisual;
|
||||
CGraphicImageInstance m_downVisual;
|
||||
CGraphicImageInstance m_disableVisual;
|
||||
};
|
||||
|
||||
class CRadioButton : public CButton
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CRadioButton(PyObject* ppyObject) : CButton(ppyObject) {}
|
||||
virtual ~CRadioButton() {}
|
||||
protected:
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
};
|
||||
|
||||
class CToggleButton : public CButton
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CToggleButton(PyObject* ppyObject) : CButton(ppyObject) {}
|
||||
virtual ~CToggleButton() {}
|
||||
protected:
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
};
|
||||
|
||||
class CDragButton : public CButton
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CDragButton(PyObject * ppyObject) : CButton(ppyObject) { memset(&m_restrictArea, 0, sizeof(m_restrictArea)); }
|
||||
virtual ~CDragButton() {}
|
||||
void SetRestrictMovementArea(int ix, int iy, int iwidth, int iheight) {
|
||||
m_restrictArea.left = ix; m_restrictArea.top = iy;
|
||||
m_restrictArea.right = ix + iwidth; m_restrictArea.bottom = iy + iheight;
|
||||
}
|
||||
protected:
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
RECT m_restrictArea;
|
||||
};
|
||||
|
||||
class CUiRenderTarget : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CUiRenderTarget(PyObject* ppyObject) : CWindow(ppyObject), m_dwIndex(0) {}
|
||||
virtual ~CUiRenderTarget() {}
|
||||
bool SetRenderTarget(int index) { m_dwIndex = (DWORD)index; return true; }
|
||||
void SetRenderingRect(float fLeft, float fTop, float fRight, float fBottom) {}
|
||||
protected:
|
||||
void OnRender() override;
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
DWORD m_dwIndex;
|
||||
};
|
||||
|
||||
class CSlotWindow : public CWindow
|
||||
{
|
||||
public:
|
||||
struct SSlot
|
||||
{
|
||||
DWORD dwIndex = 0;
|
||||
int ixPosition = 0;
|
||||
int iyPosition = 0;
|
||||
int ixCellSize = 32;
|
||||
int iyCellSize = 32;
|
||||
BYTE byWidth = 1;
|
||||
BYTE byHeight = 1;
|
||||
bool bRenderBaseSlotImage = true;
|
||||
bool isItem = false;
|
||||
DWORD dwItemIndex = 0;
|
||||
CGraphicImageInstance* pInstance = nullptr;
|
||||
CGraphicImageInstance* pCoverInstance = nullptr;
|
||||
DWORD dwItemCount = 0;
|
||||
DWORD dwGrade = 0;
|
||||
bool bActive = false;
|
||||
bool bLocked = false;
|
||||
float fCoolTime = 0.0f;
|
||||
float fStartCoolTime = 0.0f;
|
||||
};
|
||||
|
||||
static DWORD Type();
|
||||
CSlotWindow(PyObject * ppyObject);
|
||||
virtual ~CSlotWindow();
|
||||
void Destroy();
|
||||
void SetSlotID(DWORD dwIndex, DWORD dwID) {}
|
||||
void SetSlotType(DWORD dwType) { m_dwSlotType = dwType; }
|
||||
void SetSlotStyle(DWORD dwStyle) { m_dwSlotStyle = dwStyle; }
|
||||
void AppendSlot(DWORD dwIndex, int ix, int iy, int iw, int ih);
|
||||
void SetCoverButton(DWORD dwIndex, const char* c_szUpImageName, const char* c_szOverImageName, const char* c_szDownImageName, const char* c_szDisableImageName, BOOL bLeftButtonEnable, BOOL bRightButtonEnable);
|
||||
void SetSlotBaseImage(const char* szFileName, float fr = 1.0f, float fg = 1.0f, float fb = 1.0f, float fa = 1.0f);
|
||||
void AppendSlotButton(const char*, const char*, const char*) {}
|
||||
void AppendRequirementSignImage(const char*) {}
|
||||
void SetSlotBaseImageScale(const char*, float, float, float, float, float, float) {}
|
||||
void SetSlotScale(DWORD dwIndex, DWORD dwItemIndex, BYTE byWidth, BYTE byHeight, CGraphicImage* pImage, float sx, float sy, const D3DXCOLOR& diffuseColor);
|
||||
void EnableCoverButton(DWORD) {}
|
||||
void DisableCoverButton(DWORD) {}
|
||||
void SetAlwaysRenderCoverButton(DWORD, bool = false) {}
|
||||
void ShowSlotBaseImage(DWORD dwIndex);
|
||||
void HideSlotBaseImage(DWORD dwIndex);
|
||||
BOOL IsDisableCoverButton(DWORD) { return FALSE; }
|
||||
BOOL HasSlot(DWORD dwIndex);
|
||||
void ClearAllSlot();
|
||||
void ClearSlot(DWORD dwIndex);
|
||||
void SetSlot(DWORD dwIndex, DWORD dwItemIndex, BYTE byWidth, BYTE byHeight, CGraphicImage* pImage, const D3DXCOLOR& diffuseColor);
|
||||
void SetCardSlot(DWORD dwIndex, DWORD, BYTE, BYTE, const char*, DWORD) { if (!HasSlot(dwIndex)) AppendSlot(dwIndex, 0, 0, 32, 32); }
|
||||
void SetSlotCount(DWORD dwIndex, DWORD dwCount);
|
||||
void SetSlotCountNew(DWORD dwIndex, DWORD dwGrade, DWORD dwCount);
|
||||
void SetSlotCoolTime(DWORD dwIndex, float fCoolTime, float fElapsedTime = 0.0f);
|
||||
bool IsSlotCoolTime(DWORD dwIndex);
|
||||
float GetSlotCoolTime(DWORD dwIndex);
|
||||
float GetSlotRemainingCoolTime(DWORD dwIndex);
|
||||
void StoreSlotCoolTime(DWORD, DWORD, float, float = 0.0f) {}
|
||||
void RestoreSlotCoolTime(DWORD) {}
|
||||
void ActivateSlot(DWORD dwIndex);
|
||||
void DeactivateSlot(DWORD dwIndex);
|
||||
void RefreshSlot() {}
|
||||
DWORD GetSlotCount() { return (DWORD)m_slotMap.size(); }
|
||||
void LockSlot(DWORD dwIndex);
|
||||
void UnlockSlot(DWORD dwIndex);
|
||||
BOOL IsLockSlot(DWORD dwIndex);
|
||||
void SetCantUseSlot(DWORD) {}
|
||||
void SetUseSlot(DWORD) {}
|
||||
BOOL IsCantUseSlot(DWORD) { return FALSE; }
|
||||
void EnableSlot(DWORD) {}
|
||||
void DisableSlot(DWORD) {}
|
||||
BOOL IsEnableSlot(DWORD) { return TRUE; }
|
||||
void SetCanMouseEventSlot(DWORD) {}
|
||||
void SetCantMouseEventSlot(DWORD) {}
|
||||
void SetUsableSlotOnTopWnd(DWORD) {}
|
||||
void SetUnusableSlotOnTopWnd(DWORD) {}
|
||||
void ClearSelected() { m_selected.clear(); }
|
||||
void SelectSlot(DWORD dwIndex) { m_selected.push_back(dwIndex); }
|
||||
BOOL isSelectedSlot(DWORD dwIndex) {
|
||||
return std::find(m_selected.begin(), m_selected.end(), dwIndex) != m_selected.end();
|
||||
}
|
||||
DWORD GetSelectedSlotCount() { return (DWORD)m_selected.size(); }
|
||||
DWORD GetSelectedSlotNumber(DWORD dwIndex) {
|
||||
return (dwIndex < m_selected.size()) ? m_selected[dwIndex] : 0;
|
||||
}
|
||||
void ShowSlotButton(DWORD) {}
|
||||
void HideAllSlotButton() {}
|
||||
void ShowRequirementSign(DWORD) {}
|
||||
void HideRequirementSign(DWORD) {}
|
||||
void SetUseMode(BOOL) {}
|
||||
void SetUsableItem(BOOL) {}
|
||||
void ActivateEffect(DWORD, float, float, float, float) {}
|
||||
void DeactivateEffect(DWORD) {}
|
||||
protected:
|
||||
void OnRender() override;
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
DWORD m_dwSlotType;
|
||||
DWORD m_dwSlotStyle;
|
||||
std::vector<DWORD> m_slots;
|
||||
std::vector<DWORD> m_selected;
|
||||
std::map<DWORD, SSlot> m_slotMap;
|
||||
CGraphicImageInstance* m_pBaseImageInstance;
|
||||
};
|
||||
|
||||
class CGridSlotWindow : public CSlotWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
CGridSlotWindow(PyObject * ppyObject) : CSlotWindow(ppyObject) {}
|
||||
virtual ~CGridSlotWindow() {}
|
||||
void ArrangeGridSlot(DWORD dwStartIndex, DWORD dwxCount, DWORD dwyCount, int ixSlotSize, int iySlotSize, int ixTemporarySize, int iyTemporarySize);
|
||||
protected:
|
||||
BOOL OnIsType(DWORD dwType) override;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user