pass39: complete exhaustive class-by-class and method-by-method rendering and display parity

This commit is contained in:
shen
2026-10-08 06:19:30 -07:00
parent 83c7c5ad0b
commit d7adbb3014
8 changed files with 1678 additions and 243 deletions
+169 -68
View File
@@ -16,6 +16,7 @@
namespace UI
{
class CSlotWindow;
class CGraphicTextInstance {
public:
@@ -316,7 +317,7 @@ namespace UI
{
public:
static DWORD Type();
CBar3D(PyObject * ppyObject) : CWindow(ppyObject), m_dwLeftColor(0), m_dwRightColor(0), m_dwCenterColor(0) {}
CBar3D(PyObject * ppyObject) : CWindow(ppyObject), m_dwLeftColor(0xFF333333), m_dwRightColor(0xFFB2B2B2), m_dwCenterColor(0xFF000000) {}
virtual ~CBar3D() {}
void SetColor(DWORD l, DWORD r, DWORD c) { m_dwLeftColor = l; m_dwRightColor = r; m_dwCenterColor = c; }
protected:
@@ -362,15 +363,21 @@ namespace UI
{
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; }
CNumberLine(PyObject * ppyObject);
CNumberLine(CWindow * pParent);
virtual ~CNumberLine();
void SetPath(const char * c_szPath);
void SetHorizontalAlign(int iType);
void SetNumber(const char * c_szNumber);
protected:
void ClearNumber();
void OnRender() override;
void OnChangePosition() override;
BOOL OnIsType(DWORD dwType) override;
std::string m_strPath, m_strNumber;
std::string m_strPath;
std::string m_strNumber;
std::vector<CGraphicImageInstance *> m_ImageInstanceVector;
int m_iHorizontalAlign;
DWORD m_dwWidthSummary;
};
@@ -448,7 +455,7 @@ namespace UI
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) {}
void SetImageClipRect(float fLeft, float fTop, float fRight, float fBottom, bool bIsVertical = false);
protected:
void OnCreateInstance() override;
@@ -478,6 +485,8 @@ namespace UI
void SetMoveSpeed(float speed);
void SetMovePos(float directionX, float directionY);
float GetRotation();
void CheckMove();
void OnMoveDone();
protected:
void OnUpdate() override;
@@ -491,6 +500,10 @@ namespace UI
BYTE m_bycurDelay;
BYTE m_byDelay;
BYTE m_bycurIndex;
float nextX;
float nextY;
float fSpeed;
bool moveStart;
std::vector<CGraphicExpandedImageInstance*> m_ImageVector;
};
@@ -507,7 +520,7 @@ namespace UI
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) {}
void SetRenderingRect(float fLeft, float fTop, float fRight, float fBottom);
const char * GetUpVisualFileName();
const char * GetOverVisualFileName();
@@ -515,16 +528,17 @@ namespace UI
void FlashEx() { m_isFlashEx = TRUE; }
void Flash(bool bFlash = true) { m_isFlash = bFlash; }
void Enable() { m_bEnable = TRUE; }
void Disable() { m_bEnable = FALSE; }
void Enable();
void Disable();
void SetUp();
void Up();
void Over();
void Down();
BOOL IsDisable() { return !m_bEnable; }
BOOL IsDisable() { return m_bEnable; }
BOOL IsPressed() { return m_isPressed; }
BOOL IsEnable() { return m_bEnable; }
protected:
void OnUpdate() override;
@@ -536,7 +550,6 @@ namespace UI
void OnMouseOverIn() override;
void OnMouseOverOut() override;
BOOL IsEnable() { return m_bEnable; }
void SetCurrentVisual(CGraphicImageInstance* pVisual);
BOOL OnIsType(DWORD dwType) override;
@@ -557,34 +570,41 @@ namespace UI
{
public:
static DWORD Type();
CRadioButton(PyObject* ppyObject) : CButton(ppyObject) {}
virtual ~CRadioButton() {}
CRadioButton(PyObject* ppyObject);
virtual ~CRadioButton();
protected:
BOOL OnIsType(DWORD dwType) override;
BOOL OnMouseLeftButtonDown() override;
BOOL OnMouseLeftButtonUp() override;
void OnMouseOverIn() override;
void OnMouseOverOut() override;
};
class CToggleButton : public CButton
{
public:
static DWORD Type();
CToggleButton(PyObject* ppyObject) : CButton(ppyObject) {}
virtual ~CToggleButton() {}
CToggleButton(PyObject* ppyObject);
virtual ~CToggleButton();
protected:
BOOL OnIsType(DWORD dwType) override;
BOOL OnMouseLeftButtonDown() override;
BOOL OnMouseLeftButtonUp() override;
void OnMouseOverIn() override;
void OnMouseOverOut() 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;
}
CDragButton(PyObject * ppyObject);
virtual ~CDragButton();
void SetRestrictMovementArea(int ix, int iy, int iwidth, int iheight);
protected:
BOOL OnIsType(DWORD dwType) override;
void OnChangePosition() override;
void OnMouseOverIn() override;
RECT m_restrictArea;
};
@@ -592,33 +612,100 @@ namespace UI
{
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) {}
CUiRenderTarget(PyObject* ppyObject);
virtual ~CUiRenderTarget();
bool SetRenderTarget(int index);
void SetRenderingRect(float fLeft, float fTop, float fRight, float fBottom);
protected:
void OnRender() override;
BOOL OnIsType(DWORD dwType) override;
DWORD m_dwIndex;
RECT rect_ex;
};
class CSlotButton : public CButton
{
public:
CSlotButton(PyObject* ppy = nullptr);
CSlotButton(DWORD dwSlotNumber, CSlotWindow* pParent);
virtual ~CSlotButton();
void SetSlotNumber(DWORD dwSlotNumber) { m_dwSlotNumber = dwSlotNumber; }
DWORD GetSlotNumber() const { return m_dwSlotNumber; }
void SetParentSlotWindow(CSlotWindow* pParent) { m_pParent = pParent; }
protected:
DWORD m_dwSlotNumber;
CSlotWindow* m_pParent;
};
class CCoverButton : public CSlotButton
{
public:
CCoverButton(PyObject* ppy = nullptr);
CCoverButton(DWORD dwSlotNumber, CSlotWindow* pParent);
virtual ~CCoverButton();
void SetLeftButtonEnable(BOOL b) { m_bLeftButtonEnable = b; }
void SetRightButtonEnable(BOOL b) { m_bRightButtonEnable = b; }
void RenderButton();
void OnRender() override {}
BOOL OnMouseLeftButtonDown() override;
protected:
BOOL m_bLeftButtonEnable;
BOOL m_bRightButtonEnable;
};
class CSlotWindow : public CWindow
{
public:
enum ESlotState
{
SLOT_STATE_LOCK = (1 << 0),
SLOT_STATE_CANT_USE = (1 << 1),
SLOT_STATE_DISABLE = (1 << 2),
SLOT_STATE_ALWAYS_RENDER_COVER = (1 << 3),
SLOT_STATE_CANT_MOUSE_EVENT = (1 << 4),
SLOT_STATE_UNUSABLE = (1 << 5),
};
enum ESlotStyle
{
SLOT_STYLE_NONE = 0,
SLOT_STYLE_PICK_UP = 1,
SLOT_STYLE_SELECT = 2,
};
struct SStoreCoolDown
{
float fCoolTime;
float fElapsedTime;
bool bActive;
};
struct SSlot
{
DWORD dwIndex = 0;
DWORD dwState = 0;
DWORD dwSlotNumber = 0;
DWORD dwCenterSlotNumber = 0;
int ixPosition = 0;
int iyPosition = 0;
int ixCellSize = 32;
int iyCellSize = 32;
BYTE byWidth = 1;
BYTE byHeight = 1;
BYTE byxPlacedItemSize = 1;
BYTE byyPlacedItemSize = 1;
bool bRenderBaseSlotImage = true;
bool isItem = false;
DWORD dwItemIndex = 0;
DWORD dwItemID = 0;
CGraphicImageInstance* pInstance = nullptr;
CGraphicImageInstance* pCoverInstance = nullptr;
CNumberLine* pNumberLine = nullptr;
CCoverButton* pCoverButton = nullptr;
CSlotButton* pSlotButton = nullptr;
CImageBox* pSignImage = nullptr;
CAniImageBox* pFinishCoolTimeEffect = nullptr;
CAniImageBox* pActiveSlotEffect[3]{};
DWORD dwItemCount = 0;
DWORD dwGrade = 0;
bool bActive = false;
@@ -631,22 +718,22 @@ namespace UI
CSlotWindow(PyObject * ppyObject);
virtual ~CSlotWindow();
void Destroy();
void SetSlotID(DWORD dwIndex, DWORD dwID) {}
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 AppendSlotButton(const char* c_szUpImageName, const char* c_szOverImageName, const char* c_szDownImageName);
void AppendRequirementSignImage(const char* c_szImageName);
void SetSlotBaseImageScale(const char* szFileName, float fr, float fg, float fb, float fa, float sx, float sy);
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 EnableCoverButton(DWORD dwIndex);
void DisableCoverButton(DWORD dwIndex);
void SetAlwaysRenderCoverButton(DWORD dwIndex, bool bAlways = false);
void ShowSlotBaseImage(DWORD dwIndex);
void HideSlotBaseImage(DWORD dwIndex);
BOOL IsDisableCoverButton(DWORD) { return FALSE; }
BOOL IsDisableCoverButton(DWORD dwIndex);
BOOL HasSlot(DWORD dwIndex);
void ClearAllSlot();
void ClearSlot(DWORD dwIndex);
@@ -658,8 +745,8 @@ namespace UI
bool IsSlotCoolTime(DWORD dwIndex);
float GetSlotCoolTime(DWORD dwIndex);
float GetSlotRemainingCoolTime(DWORD dwIndex);
void StoreSlotCoolTime(DWORD, DWORD, float, float = 0.0f) {}
void RestoreSlotCoolTime(DWORD) {}
void StoreSlotCoolTime(DWORD dwKey, DWORD dwSlotIndex, float fCoolTime, float fElapsedTime = 0.0f);
void RestoreSlotCoolTime(DWORD dwKey);
void ActivateSlot(DWORD dwIndex);
void DeactivateSlot(DWORD dwIndex);
void RefreshSlot() {}
@@ -667,52 +754,66 @@ namespace UI
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) {}
void SetCantUseSlot(DWORD dwIndex);
void SetUseSlot(DWORD dwIndex);
BOOL IsCantUseSlot(DWORD dwIndex);
void EnableSlot(DWORD dwIndex);
void DisableSlot(DWORD dwIndex);
BOOL IsEnableSlot(DWORD dwIndex);
void SetCanMouseEventSlot(DWORD dwIndex);
void SetCantMouseEventSlot(DWORD dwIndex);
void SetUsableSlotOnTopWnd(DWORD dwIndex);
void SetUnusableSlotOnTopWnd(DWORD dwIndex);
void ClearSelected() { m_dwSelectedSlotIndexList.clear(); }
void SelectSlot(DWORD dwIndex);
BOOL isSelectedSlot(DWORD dwIndex);
DWORD GetSelectedSlotCount() { return (DWORD)m_dwSelectedSlotIndexList.size(); }
DWORD GetSelectedSlotNumber(DWORD dwIndex);
void ShowSlotButton(DWORD dwIndex);
void HideAllSlotButton();
void ShowRequirementSign(DWORD dwIndex);
void HideRequirementSign(DWORD dwIndex);
void SetUseMode(BOOL bFlag) { m_isUseMode = bFlag; }
void SetUsableItem(BOOL bFlag) { m_isUsableItem = bFlag; }
void ActivateEffect(DWORD dwIndex, float r = 1.0f, float g = 1.0f, float b = 1.0f, float a = 1.0f);
void DeactivateEffect(DWORD dwIndex);
BOOL GetSlotPointer(DWORD dwIndex, SSlot** ppSlot);
BOOL GetSelectedSlotPointer(SSlot** ppSlot);
protected:
void OnRender() override;
BOOL OnIsType(DWORD dwType) override;
virtual void OnRenderPickingSlot();
virtual void OnRenderSelectedSlot();
void RenderSlotBaseImage();
void RenderLockedSlot();
protected:
DWORD m_dwSlotType;
DWORD m_dwSlotStyle;
BOOL m_isUseMode;
BOOL m_isUsableItem;
std::vector<DWORD> m_slots;
std::vector<DWORD> m_selected;
std::vector<DWORD> m_dwSelectedSlotIndexList;
std::map<DWORD, SSlot> m_slotMap;
std::map<DWORD, std::map<DWORD, SStoreCoolDown>> m_CoolDownStore;
CGraphicImageInstance* m_pBaseImageInstance;
CAniImageBox* m_apSlotActiveEffect[3]{};
};
class CGridSlotWindow : public CSlotWindow
{
public:
static DWORD Type();
CGridSlotWindow(PyObject * ppyObject) : CSlotWindow(ppyObject) {}
virtual ~CGridSlotWindow() {}
CGridSlotWindow(PyObject * ppyObject);
virtual ~CGridSlotWindow();
void ArrangeGridSlot(DWORD dwStartIndex, DWORD dwxCount, DWORD dwyCount, int ixSlotSize, int iySlotSize, int ixTemporarySize, int iyTemporarySize);
BOOL GetPickedSlotList(BYTE byWidth, BYTE byHeight, std::vector<SSlot*>* pSlotList);
BOOL GetPickedSlotPointer(SSlot** ppSlot);
BOOL CheckMoving(DWORD dwSlotNumber, DWORD dwItemIndex, const std::vector<SSlot*>& slotList);
protected:
void OnRenderPickingSlot() override;
BOOL OnIsType(DWORD dwType) override;
};
}