内容参考于:易道云信息技术研究院VIP课
上一个内容:游戏窗口化助手的UI设计-CSDN博客
码云地址(游戏窗口化助手 分支):https://gitee.com/dye_your_fingers/sro_-ex.git
码云版本号:e8116af3a7b0186adba500c809fda592804a333d
代码下载地址,在 SRO_EX 目录下,文件名为:SRO_Ex-显示游戏数据到小助手UI.zip
链接:https://pan.baidu.com/s/1W-JpUcGOWbSJmMdmtMzYZg
提取码:q9n5
--来自百度网盘超级会员V4的分享
HOOK引擎,文件名为:黑兔sdk.zip
链接:https://pan.baidu.com/s/1IB-Zs6hi3yU8LC2f-8hIEw
提取码:78h8
--来自百度网盘超级会员V4的分享
以 游戏窗口化助手的UI设计 它的代码为基础进行修改
效果图:
CHelperUI.h文件的修改:新加 ShowData函数
#pragma once
#include "afxdialogex.h"
#include "resource.h"// CHelperUI 对话框class CHelperUI : public CDialogEx
{DECLARE_DYNAMIC(CHelperUI)public:CHelperUI(CWnd* pParent = nullptr); // 标准构造函数virtual ~CHelperUI();// 对话框数据
#ifdef AFX_DESIGN_TIMEenum { IDD = IDD_HELPER };
#endifprotected:virtual BOOL OnInitDialog();virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持DECLARE_MESSAGE_MAP()
public:afx_msg void OnBnClickedOk();// 血量条CProgressCtrl HPBar;// 魔法条CProgressCtrl MPBar;// 怒气条CProgressCtrl RageBar;// 升级经验值条CProgressCtrl ExBar;void ShowData();
};
CHelperUI.cpp文件的修改:修改了 OnInitDialog函数,新加ShowData函数、TimeProcHelper函数
// CHelperUI.cpp: 实现文件
//#include "pch.h"
#include "CHelperUI.h"
#include "afxdialogex.h"
#include "extern_all.h"void _stdcall TimeProcHelper(HWND, UINT, UINT_PTR, DWORD) {if (_ui_helper)_ui_helper->ShowData();
}IMPLEMENT_DYNAMIC(CHelperUI, CDialogEx)CHelperUI::CHelperUI(CWnd* pParent /*=nullptr*/): CDialogEx(IDD_HELPER, pParent)
{}CHelperUI::~CHelperUI()
{
}BOOL CHelperUI::OnInitDialog()
{CDialogEx::OnInitDialog();this->SetBackgroundColor(RGB(255, 255, 255));HPBar.SetBkColor(RGB(0 ,0, 0));MPBar.SetBkColor(RGB(0 ,0, 0));RageBar.SetBkColor(RGB(0 ,0, 0));ExBar.SetBkColor(RGB(0 ,0, 0));HPBar.SetBarColor(RGB(255 ,0, 0));MPBar.SetBarColor(RGB(0x0, 0x0, 0x99));RageBar.SetBarColor(RGB(0x66, 0x0, 0x66));ExBar.SetBarColor(RGB(0x00, 0xFF, 0xCC));HPBar.SetRange(0, 1000);MPBar.SetRange(0, 1000);RageBar.SetRange(0, 5);ExBar.SetRange(0, 1000);//HPBar.SetPos(50);//MPBar.SetPos(50);//RageBar.SetPos(50);//ExBar.SetPos(50);::SetTimer(this->m_hWnd, 0x100002, 100, TimeProcHelper);return TRUE;
}void CHelperUI::DoDataExchange(CDataExchange* pDX)
{CDialogEx::DoDataExchange(pDX);DDX_Control(pDX, IDC_PRO_HP, HPBar);DDX_Control(pDX, IDC_PRO_MP, MPBar);DDX_Control(pDX, IDC_PRO_RAGE, RageBar);DDX_Control(pDX, IDC_PRO_RAGE2, ExBar);
}BEGIN_MESSAGE_MAP(CHelperUI, CDialogEx)ON_BN_CLICKED(IDOK, &CHelperUI::OnBnClickedOk)
END_MESSAGE_MAP()// CHelperUI 消息处理程序void CHelperUI::OnBnClickedOk()
{// TODO: 在此添加控件通知处理程序代码CDialogEx::OnOK();
}void CHelperUI::ShowData()
{CString tmp;auto _player = _pgamebase->SRO_Player;if (_player) {tmp.Format(L"%s Lv %d", _player->Name.wcstrByName(), _player->LV);this->SetWindowText(tmp);float hpStep = _player->HP * 1000;hpStep = hpStep / _player->MaxHP;HPBar.SetPos(hpStep);float mpStep = _player->MP * 1000;mpStep = mpStep / _player->MaxMP;MPBar.SetPos(mpStep);RageBar.SetPos(_player->Rage);tmp.Format(L"%.1f %.1f %.1f", _player->x, _player->h, _player->y);GetDlgItem(IDC_STATIC_CORD)->SetWindowText(tmp);}
}