代码拉取完成,页面将自动刷新
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "TurboMir.h"
#include "MainFrm.h"
#include "LoginDialog.h"
#include ".\mainfrm.h"
#include "cpptooltip\PPTooltip.h"
#include "BCGExtended\ToolBarLabel.h"
#include "QuitDialog.h"
#include "afxwin.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
const int TIMER_EVENT_CHECK_ATTACK_MODE=0x815;
const char szAd[]=
"TeaM-D 传奇2外辅 私服版\n"
//"http://www.tmdwg.com/\n"
//"\n"
//"广告销售规则:\n"
//"1、 所有广告采用星期形式出租,谢绝分期付款。 \n"
//"2、 本站广告没有测试服务,先全额付费,再放广告,请遵守本站广告销售流程。 \n"
//"3、 本站不采用n元/1000ip的计费方式,均为星期广告,如果您觉得不适合您的营销策略,请勿联系本站。 \n"
//"4、 任何弹窗退窗类广告,在广告期间,一旦发现所弹窗口有违规内容,比如:自动设为首页、额外弹窗、额外退出弹窗、网页自动最大化、恶意代码等, 一律马上撤销您的弹窗。 \n"
//"5、 所有网页必须按照规格像素大小制作,尺寸正规。 \n"
//"6、 一次性投放一季度只需支付2.5个月费用;一次性投放半年只需支付5个月费用;一次性投放一年只需要要支付9个月费用。 \n"
//"7、 我们只保证本站不断的发展壮大,保证流量的不断增长,但是我们不保证能给您带来多少流量。对此,我们不能轻易做出任何承诺。 \n"
//"8、 如果您感觉无法接受以上条款,请勿联系本站。最大限度的互惠互利,希望诚信为准,公平交易。 \n"
//"\n"
//"广告投放说明:\n"
//"1、以上广告位一次性包租两个月9.2折优惠,一次性包租三个月8.5折优惠,可提前一周进行预定!\n"
//"2、先付款并款到帐后开始投放广告,如果我们查询未到帐请扫描您的汇款底单经我们确认后才给投放广告!\n"
//"3、以上已租出广告位可提前交款预定!(须联系确定后需付30%的定金)\n"
//"4、具体与 QQ:99106278\n"
//"5、除以上广告位,其它位置均可联系我们详谈!\n"
//"6、如续费,请在到期前三天联系我们确定当月价格后付款(广告价格每月可能会有所变动)!\n"
//"7、本站为个人网站,投放广告不开具发票!\n"
//"8、广告位租出后不能更换到其它位置!\n"
//"9、其他待续! \n"
//"\n"
//"注意:申请广告包月的客户必须遵循国务院292号令公布的“互联网信息服务管理办法”,您的网站不得制作、复制、发布、传播含有下列内容的信息:反对宪法所确定的基本原则的;危害国家安全,泄露国家秘密,颠覆国家政权,破坏国家统一的;损害国家荣誉和利益的;煽动 民族仇恨、民族歧视,破坏民族团结的;破坏国家宗教政策,宣扬邪教和封建迷信的;散布谣言,扰乱社会秩序,破坏社会稳定的;散布淫秽、色情、赌博、暴力、凶杀、恐怖或者教唆犯罪的;侮辱或者诽谤他人,侵害他人合法利益的;含有法律行政法规禁止的其他内容的\n"
"\n\n";
// CMessageBox
IMPLEMENT_DYNAMIC(CMessageBox, CDialogEx)
BEGIN_MESSAGE_MAP(CMessageBox, CDialogEx)
END_MESSAGE_MAP()
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CFrameWndEx)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWndEx)
ON_WM_CREATE()
ON_WM_SETFOCUS()
ON_COMMAND_RANGE(ID_SKIN_LunaBlue, ID_SKIN_Normal, OnAppLook)
ON_UPDATE_COMMAND_UI_RANGE(ID_SKIN_LunaBlue, ID_SKIN_Normal, OnUpdateAppLook)
ON_COMMAND(ID_LOGIN, OnLogin)
ON_UPDATE_COMMAND_UI(ID_LOGIN, OnUpdateLogin)
ON_COMMAND(ID_DISCONNECT, OnDisconnect)
ON_UPDATE_COMMAND_UI(ID_DISCONNECT, OnUpdateDisconnect)
ON_UPDATE_COMMAND_UI(ID_SCRIPT_RUN, OnUpdateScriptRun)
ON_COMMAND(ID_SETTING, OnSetting)
ON_UPDATE_COMMAND_UI(ID_SETTING, OnUpdateSetting)
ON_MESSAGE(WM_ADDLOG,OnAddLog)
ON_MESSAGE(WM_DEBUGOUT,OnDebugOut)
ON_MESSAGE(WM_ADDCHAT,OnAddChat)
ON_COMMAND(ID_ATTACKMODE_CHANGE, OnAttackmodeChange)
ON_COMMAND_RANGE(ID_ATTACKMODE_0, ID_ATTACKMODE_7, OnAttackmode)
ON_UPDATE_COMMAND_UI_RANGE(ID_ATTACKMODE_0, ID_ATTACKMODE_7, OnUpdateAttackmode)
ON_UPDATE_COMMAND_UI(ID_ATTACKMODE_CHANGE, OnUpdateAttackmodeChange)
ON_COMMAND(ID_USE_ITEM, OnUseItem)
ON_WM_TIMER()
ON_COMMAND(ID_TALK_TO, OnTalkTo)
ON_COMMAND_RANGE(ID_TAKEON_1, ID_TAKEON_13, OnTakeOn)
ON_COMMAND(ID_DROP_ITEM, OnDropItem)
ON_COMMAND(ID_VIEW_ACTORS, OnViewActors)
ON_COMMAND(ID_VIEW_BAG, OnViewBag)
ON_COMMAND(ID_VIEW_DEBUG, OnViewDebug)
ON_COMMAND(ID_VIEW_DROPEDITEM, OnViewDropeditem)
ON_COMMAND(ID_VIEW_SELF, OnViewSelf)
ON_COMMAND(ID_VIEW_USEITEM, OnViewUseitem)
ON_COMMAND(ID_VIEW_SYSTEMLOG, OnViewSystemlog)
ON_UPDATE_COMMAND_UI(ID_VIEW_BAG, OnUpdateViewBag)
ON_UPDATE_COMMAND_UI(ID_VIEW_DEBUG, OnUpdateViewDebug)
ON_UPDATE_COMMAND_UI(ID_VIEW_DROPEDITEM, OnUpdateViewDropeditem)
ON_UPDATE_COMMAND_UI(ID_VIEW_ACTORS, OnUpdateViewActors)
ON_UPDATE_COMMAND_UI(ID_VIEW_SELF, OnUpdateViewSelf)
ON_UPDATE_COMMAND_UI(ID_VIEW_SYSTEMLOG, OnUpdateViewSystemlog)
ON_UPDATE_COMMAND_UI(ID_VIEW_USEITEM, OnUpdateViewUseitem)
ON_WM_SYSCOMMAND()
ON_COMMAND(ID_REFRESH_BAG, OnRefreshBag)
ON_COMMAND(ID_FIGHT_START, OnFightStart)
ON_UPDATE_COMMAND_UI(ID_FIGHT_START, OnUpdateFightStart)
ON_MESSAGE(WM_TRAY_NOTIFICATION, OnTrayNotification)
ON_COMMAND(ID_SHOW_MAIN, OnShowMain)
ON_UPDATE_COMMAND_UI(ID_SHOW_MAIN, OnUpdateShowMain)
ON_COMMAND(ID_VIEW_OBJECT_WINDOW, OnViewObjectWindow)
ON_UPDATE_COMMAND_UI(ID_VIEW_OBJECT_WINDOW, OnUpdateViewObjectWindow)
ON_COMMAND(ID_HELP_COMMAND, &CMainFrame::OnHelpCommand)
ON_COMMAND(ID_MOVE_TO, &CMainFrame::OnMoveTo)
ON_COMMAND(ID_ITEM_NOPICK, &CMainFrame::OnItemNopick)
ON_COMMAND(ID_NORMAL_PICKUP, &CMainFrame::OnNormalPickup)
ON_COMMAND(ID_FIRST_PICKUP, &CMainFrame::OnFirstPickup)
ON_COMMAND(ID_MUST_PICKUP, &CMainFrame::OnMustPickup)
ON_UPDATE_COMMAND_UI(ID_ITEM_NOPICK, &CMainFrame::OnUpdateItemNopick)
ON_UPDATE_COMMAND_UI(ID_NORMAL_PICKUP, &CMainFrame::OnUpdateItemNormalPickup)
ON_UPDATE_COMMAND_UI(ID_FIRST_PICKUP, &CMainFrame::OnUpdateItemFirstPickup)
ON_UPDATE_COMMAND_UI(ID_MUST_PICKUP, &CMainFrame::OnUpdateItemMustPickup)
ON_UPDATE_COMMAND_UI(ID_REFRESH_BAG, &CMainFrame::OnUpdateInGameEnable)
ON_UPDATE_COMMAND_UI(ID_MOVE_TO, &CMainFrame::OnUpdateInGameEnable)
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // 状态行指示器
ID_MONEY, // 钱
ID_HERO_NAME, // 角色名称
ID_HERO_JOB, // 角色名称
ID_LEVEL, // 等级
ID_SHOW_MAPNAME, // 地图显示
ID_SHOW_XY, // 当前坐标
ID_SHOW_BAG_FREE, // 包裹剩余空间
};
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
: m_Game(*this)
, m_SettingDialog(m_Game)
, m_wndMap(m_Game)
, m_wndLeftView(m_Game,*this)
, m_wndSystemLog(this)
, m_wndActors(this)
, m_wndSelf(this)
, m_wndBag(this)
, m_wndUseItem(this)
, m_wndGround(this)
#ifndef PUBLIC_EDTION
, m_wndDebug(this)
#endif
, m_TrayIcon(IDR_TRAY_MENU)
,m_wndView(new CRichEditView)
,m_MerchantDlg(m_Game)
{
InitializeCriticalSection(&m_logSC);
InitializeCriticalSection(&m_chtSC);
InitializeCriticalSection(&m_dbgSC);
m_Game.sig_EventItemShow.connect(boost::bind(&CMainFrame::OnItemShow,boost::ref(*this),_1));
m_Game.sig_EventItemHide.connect(boost::bind(&CMainFrame::OnItemHide,boost::ref(*this),_1));
m_Game.sig_HpChange.connect(boost::bind(&CMainFrame::OnHpChange,boost::ref(*this),_1,_2));
m_Game.sig_MpChange.connect(boost::bind(&CMainFrame::OnMpChange,boost::ref(*this),_1,_2));
m_Game.sig_ExpChange.connect(boost::bind(&CMainFrame::OnExpChange,boost::ref(*this),_1,_2));
m_Game.sig_WeightChange.connect(boost::bind(&CMainFrame::OnWeightChange,boost::ref(*this),_1,_2));
m_Game.sig_PositionChange.connect(boost::bind(&CMainFrame::OnPositionChange,boost::ref(*this),_1));
m_Game.sig_LogMessage.connect(boost::bind(&CMainFrame::AddLog,boost::ref(*this),_1,_2,_3,_4));
m_Game.sig_UpdateSelfInfo.connect(boost::bind(&CMainFrame::UpdateSelfInfo,boost::ref(*this)));
m_Game.sig_UpdateUseItem.connect(boost::bind(&CMainFrame::UpdateUseItem,boost::ref(*this)));
m_Game.sig_ClearBag.connect(boost::bind(&CMainFrame::ClearBag,boost::ref(*this)));
m_Game.sig_ClearActors.connect(boost::bind(&CMainFrame::ClearActors,boost::ref(*this)));
m_Game.sig_UpdateActor.connect(boost::bind(&CMainFrame::UpdateActors,boost::ref(*this),_1,_2));
m_Game.sig_UpdateBagItem.connect(boost::bind(&CMainFrame::UpdateBag,boost::ref(*this),_1,_2));
m_Game.sig_SetGameStatus.connect(boost::bind(&CMainFrame::SetTrayGameStatus,boost::ref(*this),_1));
m_Game.sig_SetPath.connect(boost::bind(&CMapView::SetPath,boost::ref(m_wndMap),_1));
m_Game.sig_MessageBox.connect(boost::bind(&CMainFrame::OnGameMessageBox,boost::ref(*this),_1,_2));
m_Game.sig_SetTarget.connect(boost::bind(&CLeftView::SetTarget,boost::ref(m_wndLeftView),_1));
m_Game.sig_TargetPosChange.connect(boost::bind(&CLeftView::OnTargetPosChange,boost::ref(m_wndLeftView),_1,_2,_3,_4));
m_Game.sig_TargetHpChange.connect(boost::bind(&CLeftView::OnTargetHpChange,boost::ref(m_wndLeftView),_1,_2,_3));
}
CMainFrame::~CMainFrame()
{
DeleteCriticalSection(&m_logSC);
DeleteCriticalSection(&m_chtSC);
DeleteCriticalSection(&m_dbgSC);
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
static UINT AppArray[]=
{
ID_SKIN_Normal,
ID_SKIN_XP,
ID_SKIN_2003,
ID_SKIN_2005,
ID_SKIN_LunaBlue,
ID_SKIN_Silver,
ID_SKIN_ObsidianBlack,
ID_SKIN_Aqua,
ID_SKIN_XPNative,
};
m_nAppLook = AppArray[GetPrivateProfileInt("System","AppLook",2,(CGameMir::GetMainDir()+"\\main.ini").c_str())];
OnAppLook (m_nAppLook);
{
m_wndRibbonBar.Create (this);
//-------------------
// Load panel images:
//-------------------
m_PanelImages.SetImageSize (CSize (16, 16));
m_PanelImages.Load (IDB_TOOLBAR256);
//------------------
// Init main button:
//------------------
m_MainButton.SetImage (IDB_MAIN);
m_wndRibbonBar.SetApplicationButton (&m_MainButton, CSize (45, 45));
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
CMFCRibbonCategory* pCategoryGame = m_wndRibbonBar.AddCategory(_T("游戏\ng"), IDB_TOOLBAR256, IDB_TOOLBARLARGE);
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
CMFCRibbonPanel* pPanelNetWork = pCategoryGame->AddPanel (_T("网络\nn"), m_PanelImages.ExtractIcon (-1));
pPanelNetWork->Add (new CMFCRibbonButton (ID_LOGIN, _T("连接\nc"), 0, 0));
pPanelNetWork->Add (new CMFCRibbonButton (ID_DISCONNECT, _T("断开\nd"), 1, 1));
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
CMFCRibbonPanel* pPanelControl = pCategoryGame->AddPanel (_T("控制\nc"), m_PanelImages.ExtractIcon (-1));
pPanelControl->Add (new CMFCRibbonButton (ID_FIGHT_START, _T("开始\ns"), 2, 2));
CMFCRibbonButton* pBtnAttackMode = new CMFCRibbonButton (0, _T("攻击模式\nm"), -1, -1);
pBtnAttackMode->SetMenu (IDR_ATTACKMODE, TRUE);
pBtnAttackMode->SetAlwaysLargeImage();
pPanelControl->Add (pBtnAttackMode);
pPanelControl->Add (new CMFCRibbonButton (ID_REFRESH_BAG, _T("刷新背包\nr"), -1, -1));
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
CMFCRibbonPanel* pPanelSetting = pCategoryGame->AddPanel (_T("设置\ns"), m_PanelImages.ExtractIcon (-1));
pPanelSetting->Add (new CMFCRibbonButton (ID_SETTING, _T("设置\ns"), 4, 4));
//pPanelSetting->Add (new CMFCRibbonButton (ID_VIEW_MAP, _T("地图\ns"), 3, 3));
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
CMFCRibbonCategory* pCategoryView = m_wndRibbonBar.AddCategory(_T("查看\nv"), IDB_TOOLBAR256, IDB_TOOLBARLARGE);
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
CMFCRibbonPanel* pPanelView = pCategoryView->AddPanel (_T("视图\nw"), m_PanelImages.ExtractIcon (-1));
pPanelView->Add (new CMFCRibbonCheckBox (ID_VIEW_STATUS_BAR, "状态栏\ns"));
pPanelView->Add (new CMFCRibbonSeparator);
pPanelView->Add (new CMFCRibbonCheckBox (ID_VIEW_SELF, "个人信息\ns"));
pPanelView->Add (new CMFCRibbonCheckBox (ID_VIEW_USEITEM, "装备\ns"));
pPanelView->Add (new CMFCRibbonCheckBox (ID_VIEW_BAG, "背包\ns"));
pPanelView->Add (new CMFCRibbonCheckBox (ID_VIEW_ACTORS, "周围环境\ns"));
pPanelView->Add (new CMFCRibbonCheckBox (ID_VIEW_DROPEDITEM, "地面物品\ns"));
pPanelView->Add (new CMFCRibbonSeparator);
pPanelView->Add (new CMFCRibbonCheckBox (ID_VIEW_SYSTEMLOG, "系统消息\ns"));
pPanelView->Add (new CMFCRibbonCheckBox (ID_VIEW_DEBUG, "调试窗口\ns"));
pPanelView->Add (new CMFCRibbonSeparator);
pPanelView->Add (new CMFCRibbonCheckBox (ID_VIEW_OBJECT_WINDOW, "目标\ns"));
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
CMFCRibbonPanel* pPanelHero = pCategoryGame->AddPanel (_T("Hero"));
pPanelHero->Add(new CMFCRibbonLabel (_T("HP")));
pPanelHero->Add(new CMFCRibbonLabel (_T("MP")));
pPanelHero->Add(new CMFCRibbonLabel (_T("EXP")));
CMFCRibbonProgressBar*pProgressBar=new CMFCRibbonProgressBar (ID_HP_PROGRESS, 200);
pProgressBar->SetRange(0,200);
pPanelHero->Add(pProgressBar);
pProgressBar=new CMFCRibbonProgressBar (ID_MP_PROGRESS, 200);
pProgressBar->SetRange(0,200);
pPanelHero->Add(pProgressBar);
pProgressBar=new CMFCRibbonProgressBar (ID_EXP_PROGRESS, 200);
pProgressBar->SetRange(0,200);
pPanelHero->Add(pProgressBar);
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
CList<UINT, UINT> lstQATCmds;
lstQATCmds.AddTail (ID_LOGIN);
lstQATCmds.AddTail (ID_FIGHT_START);
lstQATCmds.AddTail (ID_SETTING);
m_wndRibbonBar.SetQuickAccessCommands (lstQATCmds);
// Add "Style" button to the right of tabs:
CMFCRibbonButton* pStyleButton = new CMFCRibbonButton ((UINT)-1, _T("Style\ns"), (UINT)-1, (UINT)-1);
pStyleButton->SetMenu (IDR_THEME_MENU, TRUE /* Right align */);
m_wndRibbonBar.AddToTabs (pStyleButton);
m_wndRibbonBar.AddToTabs (new CMFCRibbonButton (ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon (6)));
}
if (!m_Font.CreatePointFont(9*10,"宋体"))
{
TRACE0("Failed to create Font\n");
return -1; // fail to create
}
//if (!m_wndMenuBar.Create (this))
//{
// TRACE0("Failed to create menubar\n");
// return -1; // fail to create
//}
//m_wndMenuBar.SetBarStyle(m_wndMenuBar.GetBarStyle() | CBRS_SIZE_DYNAMIC);
//m_wndMenuBar.SetWindowText("菜单");
if(!m_wndHeroStatusBar.Create (this, WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_HIDE_INPLACE|CBRS_SIZE_DYNAMIC|
CBRS_GRIPPER | CBRS_BORDER_3D,
ID_VIEW_HERO_TOOLBAR))
{
TRACE0("Failed to create 角色消息栏\n");
return -1; // fail to create
}
m_wndHeroStatusBar.LoadToolBar (IDR_HERO_BAR, 0, 0, TRUE /* Is locked */);
m_wndHeroStatusBar.SetOwner (this);
m_wndHeroStatusBar.SetRouteCommandsViaFrame (FALSE);
m_wndHeroStatusBar.SetWindowText("角色消息栏");
if(!CreateProgress())
{
return -1;
}
//CClientDC dc (this);
//BOOL bIsHighColor = dc.GetDeviceCaps (BITSPIXEL) > 8;
//UINT uiToolbarHotID = bIsHighColor ? IDB_TOOLBAR256 : 0;
//UINT uiToolbarColdID = bIsHighColor ? IDB_TOOLBARCOLD256 : 0;
//if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
// | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
// !m_wndToolBar.LoadToolBar(IDR_MAINFRAME, uiToolbarHotID, 0, FALSE, 0, 0, uiToolbarHotID))
//{
// TRACE0("Failed to create toolbar\n");
// return -1; // fail to create
//}
//m_wndToolBar.SetWindowText("工具栏");
if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators( indicators, sizeof(indicators)/sizeof(UINT) ) )
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// Create tabs window:
if (!m_wndTabs.Create (CMFCTabCtrl::STYLE_3D, CRect(0,0,0,0), this, AFX_IDW_PANE_FIRST,CMFCTabCtrl::LOCATION_TOP))
{
TRACE0("Failed to create output tab window\n");
return -1; // fail to create
}
m_wndTabs.SetDrawFrame(FALSE);
const DWORD dwStyle =
WS_CHILD|WS_VISIBLE|/*WS_BORDER|*/ES_MULTILINE|WS_VSCROLL|ES_READONLY;
if (!m_wndView->Create( NULL, NULL, dwStyle, CRect(0,0,200,200), &m_wndTabs, IDC_RICHEDIT21, NULL ))
{
TRACE0("Failed to create output view\n");
return -1;
}
m_wndTabs.AddTab (m_wndView, _T("聊天记录"), -1);
if (!m_wndMap.Create(NULL,NULL,WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL/*|WS_CAPTION*/,CRect(0,0,0,0),&m_wndTabs,0))
{
TRACE0("Failed to create Map view\n");
return -1;
}
m_wndTabs.AddTab (&m_wndMap, _T("游戏地图"), -1);
{
m_wndView->GetRichEditCtrl().SetBackgroundColor(FALSE,crChatBg);
CHARFORMAT cf;
ZeroMemory(&cf,sizeof(cf));
cf.dwMask=CFM_COLOR|CFM_SIZE|CFM_FACE|CFM_STRIKEOUT|CFM_BOLD|CFM_ITALIC;
cf.dwEffects=CFE_DISABLED;
cf.crTextColor=RGB(255,255,255);
cf.yHeight=175;
strcpy(cf.szFaceName,"宋体");
cf.cbSize=sizeof(cf);
m_wndView->GetRichEditCtrl().SetDefaultCharFormat(cf);
m_wndView->GetRichEditCtrl().SetWindowText(szAd);
}
#ifdef PUBLIC_EDTION
if (!m_wndAdvert.Create(CAdvert::IDD,&m_wndTabs))
{
TRACE0("Failed to create CAdvert\n");
return -1;
}
m_wndAdvert.ShowWindow(SW_SHOWNORMAL);
m_wndTabs.AddTab (&m_wndAdvert, _T("TMD 网站"), -1);
#endif
if (!m_wndLeftView.Create(CLeftView::IDD,this))
{
TRACE0("Failed to create Left view\n");
return -1;
}
m_wndLeftView.ShowWindow(SW_SHOWNORMAL);
//////////////////////////////////////////////////////////////////////////
// 系统信息
//////////////////////////////////////////////////////////////////////////
{
if (!m_wndSystemLog.Create (_T("系统消息"), this, CRect (0, 0, 200, 200),
TRUE, 0,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI ))
{
TRACE0("Failed to create Workspace bar\n");
return FALSE; // fail to create
}
const DWORD dwStyle =
WS_CHILD|WS_VISIBLE|WS_BORDER|ES_MULTILINE|WS_VSCROLL|ES_READONLY ;
if (!m_wndSystemLog.m_wndChild.Create (dwStyle, CRect(0,0,200,200), &m_wndSystemLog, 0))
{
TRACE0("Failed to create output view\n");
return FALSE; // fail to create
}
m_wndSystemLog.m_wndChild.SetBackgroundColor(FALSE,crSysLogBg);
CHARFORMAT cf;
ZeroMemory(&cf,sizeof(cf));
cf.dwMask=CFM_COLOR|CFM_SIZE|CFM_FACE|CFM_STRIKEOUT|CFM_BOLD|CFM_ITALIC;
cf.dwEffects=CFE_DISABLED;
cf.crTextColor=RGB(255,255,255);
cf.yHeight=175;
strcpy(cf.szFaceName,"宋体");
cf.cbSize=sizeof(cf);
m_wndSystemLog.m_wndChild.SetDefaultCharFormat(cf);
}
//////////////////////////////////////////////////////////////////////////
// 调试窗口
//////////////////////////////////////////////////////////////////////////
#ifndef PUBLIC_EDTION
{
if (!m_wndDebug.Create (_T("Debug"), this, CRect (0, 0, 600, 200),
TRUE, 0,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI ))
{
TRACE0("Failed to create Workspace bar\n");
return FALSE; // fail to create
}
const DWORD dwStyle =
WS_CHILD|WS_VISIBLE|WS_BORDER|ES_MULTILINE|WS_VSCROLL|ES_READONLY ;
if (!m_wndDebug.m_wndChild.Create (dwStyle, CRect(0,0,200,200), &m_wndDebug, 0))
{
TRACE0("Failed to create output view\n");
return FALSE; // fail to create
}
m_wndDebug.m_wndChild.SetBackgroundColor(FALSE,crDebugBg);
CHARFORMAT cf;
ZeroMemory(&cf,sizeof(cf));
cf.dwMask=CFM_COLOR|CFM_SIZE|CFM_FACE|CFM_STRIKEOUT|CFM_BOLD|CFM_ITALIC;
cf.dwEffects=CFE_DISABLED;
cf.crTextColor=RGB(255,255,255);
cf.yHeight=175;
strcpy(cf.szFaceName,"宋体");
cf.cbSize=sizeof(cf);
m_wndDebug.m_wndChild.SetDefaultCharFormat(cf);
}
#endif
//////////////////////////////////////////////////////////////////////////
// 环境
//////////////////////////////////////////////////////////////////////////
{
if (!m_wndActors.Create (_T("环境"), this, CRect (0, 0, 320, 320),
TRUE, 0,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI ))
{
TRACE0("Failed to create Workspace bar\n");
return FALSE; // fail to create
}
const DWORD dwStyle =
WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT|LVS_SINGLESEL ;
if (!m_wndActors.m_wndChild.Create (dwStyle, CRect(0,0,200,200), &m_wndActors, IDR_ACTORS))
{
TRACE0("Failed to create output view\n");
return FALSE; // fail to create
}
m_wndActors.m_wndChild.SetExtendedStyle(m_wndActors.m_wndChild.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
//m_wndActors.m_wndChild.SetFont(font);
m_wndActors.m_wndChild.InsertColumn(0,"名字",LVCFMT_LEFT,170);
m_wndActors.m_wndChild.InsertColumn(1,"位置",LVCFMT_LEFT,90);
m_wndActors.m_wndChild.InsertColumn(2,"类型",LVCFMT_LEFT,40);
m_wndActors.m_wndChild.SetCellTextColorCallBack(this,
static_cast<UIExtended::CColorListCtrl::fGetCellTextColor>(&CMainFrame::GetCellTextColorActors));
m_wndActors.m_wndChild.SetCellBkColorCallBack(this,
static_cast<UIExtended::CColorListCtrl::fGetCellBkColor>(&CMainFrame::GetCellBkColorActors));
}
//////////////////////////////////////////////////////////////////////////
// 信息
//////////////////////////////////////////////////////////////////////////
{
if (!m_wndSelf.Create (_T("角色"), this, CRect (0, 0, 330, 320),
TRUE, 1,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI ))
{
TRACE0("Failed to create Workspace bar\n");
return FALSE; // fail to create
}
const DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_REPORT | LVS_SINGLESEL;
if (!m_wndSelf.m_wndChild.Create ( dwStyle, CRect(0,0,200,200), &m_wndSelf, 0 ))
{
TRACE0("Failed to create output view\n");
return FALSE; // fail to create
}
m_wndSelf.m_wndChild.SetExtendedStyle(m_wndSelf.m_wndChild.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
//m_wndSelf.m_wndChild.SetFont(font);
int i=0;
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"名字"), CI_NAME);
//m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"性别"), CI_SEX);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"职业"), CI_PROF);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"等级"), CI_LEVEL);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"位置"), CI_POS);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"金币"), CI_GOLD);
//m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"配偶"), CI_SPOUSE);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"生命值"), CI_HP);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"魔法值"), CI_MP);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"防御"), CI_AC);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"魔法防御"), CI_MAC);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"攻击力"), CI_DC);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"魔法力"), CI_MC);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"道术"), CI_SC);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"经验"), CI_EXP);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"背包重量"), CI_BAGWEIGHT);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"负重"), CI_BODYWEIGHT);
m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"腕力"), CI_HANDWEIGHT);
//m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"准确"), CI_ZHUNQUE);
//m_wndSelf.m_wndChild.SetItemData(m_wndSelf.m_wndChild.InsertItem(i++,"敏捷"), CI_MINJIE);
m_wndSelf.m_wndChild.InsertColumn(0,"属性",LVCFMT_LEFT,70);
m_wndSelf.m_wndChild.InsertColumn(1,"数值",LVCFMT_LEFT,230);
}
//////////////////////////////////////////////////////////////////////////
// 装备
//////////////////////////////////////////////////////////////////////////
{
if (!m_wndUseItem.Create (_T("装备"), this, CRect (0, 0, 330, 320),
TRUE, 1,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI ))
{
TRACE0("Failed to create Workspace bar\n");
return FALSE; // fail to create
}
const DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_REPORT | LVS_SINGLESEL;
if (!m_wndUseItem.m_wndChild.Create ( dwStyle, CRect(0,0,200,200), &m_wndUseItem, 0 ))
{
TRACE0("Failed to create output view\n");
return FALSE; // fail to create
}
m_wndUseItem.m_wndChild.SetExtendedStyle(m_wndUseItem.m_wndChild.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
//m_wndUseItem.m_wndChild.SetFont(font);
int i=0;
m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"衣服"), U_DRESS);
m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"武器"), U_WEAPON);
m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"勋章"), U_RIGHTHAND);
m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"项链"), U_NECKLACE);
m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"头盔"), U_HELMET);
m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"左手镯"), U_ARMRINGL);
m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"右手镯"), U_ARMRINGR);
m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"左戒指"), U_RINGL);
m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"右戒指"), U_RINGR);
//m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"--"), CI_BUJUK);
//m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"腰带"), CI_BELT);
//m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"鞋子"), CI_BOOTS);
//m_wndUseItem.m_wndChild.SetItemData(m_wndUseItem.m_wndChild.InsertItem(i++,"--"), CI_CHARM);
m_wndUseItem.m_wndChild.InsertColumn(0,"位置",LVCFMT_LEFT,70);
m_wndUseItem.m_wndChild.InsertColumn(1,"物品",LVCFMT_LEFT,230);
UpdateSelfInfo();
}
//////////////////////////////////////////////////////////////////////////
// 背包
//////////////////////////////////////////////////////////////////////////
{
if (!m_wndBag.Create (_T("背包"), this, CRect (0, 0, 320, 320),
TRUE, 1,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI ))
{
TRACE0("Failed to create Workspace bar\n");
return FALSE; // fail to create
}
const DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_REPORT | LVS_SINGLESEL;
if (!m_wndBag.m_wndChild.Create (dwStyle, CRect(0,0,200,200), &m_wndBag, IDR_USERBAG))
{
TRACE0("Failed to create output view\n");
return FALSE; // fail to create
}
m_wndBag.m_wndChild.SetExtendedStyle(m_wndBag.m_wndChild.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
//m_wndBag.m_wndChild.SetFont(font);
m_wndBag.m_wndChild.InsertColumn(0,"名称",LVCFMT_LEFT,200);
m_wndBag.m_wndChild.InsertColumn(1,"持久",LVCFMT_LEFT,100);
m_wndBag.m_wndChild.SetToolTipCallBack(this,
static_cast<UIExtended::CColorListCtrl::fGetTooltipText>(&CMainFrame::GetTooltipTextBag));
}
//////////////////////////////////////////////////////////////////////////
// 地面
//////////////////////////////////////////////////////////////////////////
{
if (!m_wndGround.Create (_T("地面"), this, CRect (0, 0, 320, 320),
TRUE, 1,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI ))
{
TRACE0("Failed to create Workspace bar\n");
return FALSE; // fail to create
}
const DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_REPORT | LVS_SINGLESEL;
if (!m_wndGround.m_wndChild.Create (dwStyle, CRect(0,0,200,200), &m_wndGround, 0))
{
TRACE0("Failed to create output view\n");
return FALSE; // fail to create
}
m_wndGround.m_wndChild.SetExtendedStyle(m_wndGround.m_wndChild.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
//m_wndBag.m_wndChild.SetFont(font);
m_wndGround.m_wndChild.InsertColumn(0,"名称",LVCFMT_LEFT,200);
m_wndGround.m_wndChild.InsertColumn(1,"位置",LVCFMT_LEFT,100);
}
//////////////////////////////////////////////////////////////////////////
// 设置停靠
//////////////////////////////////////////////////////////////////////////
//CString strMainToolbarTitle;
//strMainToolbarTitle.LoadString (IDS_MAIN_TOOLBAR);
//m_wndToolBar.SetWindowText (strMainToolbarTitle);
//m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndHeroStatusBar.EnableDocking(CBRS_ALIGN_ANY);
//m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndSystemLog.EnableDocking(CBRS_ALIGN_ANY);
m_wndActors.EnableDocking(CBRS_ALIGN_ANY);
m_wndSelf.EnableDocking(CBRS_ALIGN_ANY);
m_wndUseItem.EnableDocking(CBRS_ALIGN_ANY);
m_wndBag.EnableDocking(CBRS_ALIGN_ANY);
m_wndGround.EnableDocking(CBRS_ALIGN_ANY);
#ifndef PUBLIC_EDTION
m_wndDebug.EnableDocking(CBRS_ALIGN_ANY);
#endif
EnableDocking(CBRS_ALIGN_ANY);
GetDockingManager()->EnableDocking(CBRS_ALIGN_ANY);
GetDockingManager()->EnableAutoHidePanes(CBRS_ALIGN_ANY);
//DockControlBar(&m_wndMenuBar);
//DockControlBar(&m_wndToolBar);
DockPane(&m_wndHeroStatusBar);
DockPane(&m_wndSystemLog);
DockPane(&m_wndSelf);
m_wndGround.AttachToTabWnd (&m_wndSelf, DM_STANDARD, FALSE, NULL);
m_wndUseItem.AttachToTabWnd (&m_wndSelf, DM_STANDARD, FALSE, NULL);
m_wndActors.AttachToTabWnd (&m_wndSelf, DM_STANDARD, FALSE, NULL);
m_wndBag.AttachToTabWnd (&m_wndSelf, DM_STANDARD, FALSE, NULL);
#ifndef PUBLIC_EDTION
DockPane(&m_wndDebug);
m_wndDebug.DockToWindow (&m_wndSystemLog, CBRS_ALIGN_RIGHT);
#endif
m_wndStatusBar.SetPaneWidth(1,80);
m_wndStatusBar.SetPaneWidth(2,160);
m_wndStatusBar.SetPaneWidth(3,80);
m_wndStatusBar.SetPaneWidth(4,40);
m_wndStatusBar.SetPaneWidth(5,140);
m_wndStatusBar.SetPaneWidth(6,120);
m_wndStatusBar.SetPaneStyle (1, SBPS_NOBORDERS);
m_wndStatusBar.SetPaneBackgroundColor(1,crYellow);
m_bmpIcon1.LoadBitmap(IDB_BITMAP1);
m_wndStatusBar.SetPaneIcon(1, m_bmpIcon1);
m_wndStatusBar.SetPaneBackgroundColor(4,crLime);
m_SettingDialog.Create(CDialogSetting::IDD);
m_MerchantDlg.Create(CTalkToNpcDlg::IDD);
SetTitle("传2TMD (" __DATE__")");
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strMenu;
pSysMenu->AppendMenu(MF_SEPARATOR);
strMenu="关于(&A)\tF1";
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strMenu);
strMenu="退出(&C)\tCTRL+Q";
pSysMenu->AppendMenu(MF_STRING, IDM_QUITAPP, strMenu);
for(unsigned int i=0;i<pSysMenu->GetMenuItemCount();i++)
{
if(pSysMenu->GetMenuItemID(i) == SC_CLOSE)
{
pSysMenu->ModifyMenu(SC_CLOSE, MF_BYCOMMAND, SC_CLOSE, "隐藏主窗口(&H)\tALT+F4");
}
}
}
m_TrayIcon.SetNotificationWnd(this, WM_TRAY_NOTIFICATION);
SetTrayGameStatus(_T("未登陆"));
CRect rWnd,rClient;
m_wndLeftView.GetWindowRect(rWnd);
m_wndLeftView.GetClientRect(rClient);
CSize sWnd=m_wndLeftView.GetNeedSize();
rWnd.right=400+sWnd.cx+rWnd.Width()-rClient.Width();
rWnd.bottom=150+sWnd.cy+rWnd.Height()-rClient.Height();
rWnd.top=150;
rWnd.left=400;
m_wndLeftView.MoveWindow(rWnd);
SetTimer(TIMER_EVENT_CHECK_ATTACK_MODE,2000,NULL);
//m_Game.AddLog( crMessage, _T("界面初始化完毕!\n") );
//m_wndTabs.ActivateMDITab(2);
m_wndMsgBox.Create(IDD_MESSAGEBOX);
return 0;
}
void CMainFrame::SetTrayGameStatus(LPCTSTR text)
{
CString s;
if(strlen(text)>0)
{
s=_T("TeaM-D Mir2 - ");
s+=text;
m_TrayIcon.SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),s);
}
else
{
m_TrayIcon.SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),_T("TeaM-D Mir2"));
}
}
LRESULT CMainFrame::OnTrayNotification(WPARAM uID, LPARAM lEvent)
{
return m_TrayIcon.OnTrayNotification(uID, lEvent);
}
afx_msg LRESULT CMainFrame::OnToolbarReset(WPARAM wp, LPARAM)
{
UINT uiToolBarId = (UINT) wp;
switch (uiToolBarId)
{
case IDR_HERO_BAR:
m_wndHeroStatusBar.ReplaceButton (ID_LABEL_HP, CToolBarLabel(ID_LABEL_HP, _T("生命")));
m_wndHeroStatusBar.ReplaceButton (ID_LABEL_MP, CToolBarLabel(ID_LABEL_MP, _T("魔法")));
m_wndHeroStatusBar.ReplaceButton (ID_LABEL_EXP, CToolBarLabel(ID_LABEL_EXP, _T("经验")));
m_wndHeroStatusBar.ReplaceButton (ID_LABEL_BAG, CToolBarLabel(ID_LABEL_BAG, _T("背包")));
break;
}
return 0;
}
BOOL CMainFrame::CreateProgress(void)
{
CRect rect;
m_wndHeroStatusBar.SetButtonInfo(1,ID_HP_PROGRESS,TBBS_SEPARATOR,200);
m_wndHeroStatusBar.GetItemRect(1,&rect);
rect.top += 1;
rect.bottom -= 1;
m_wndHeroStatusBar.m_wndHPProgress.Create(WS_CHILD|WS_VISIBLE,rect,&m_wndHeroStatusBar,ID_HP_PROGRESS);
m_wndHeroStatusBar.m_wndHPProgress.SetTextFont(&m_Font);
m_wndHeroStatusBar.m_wndHPProgress.SetShowTextStyle(4);
m_wndHeroStatusBar.m_wndHPProgress.SetForeColour(RGB(255,0,0));
m_wndHeroStatusBar.m_wndHPProgress.SetTextForeColour(RGB(255,0,0));
m_wndHeroStatusBar.m_wndHPProgress.SetRange(0,999);
m_wndHeroStatusBar.m_wndHPProgress.SetPos(999);
m_wndHeroStatusBar.m_wndHPProgress.ShowWindow(SW_SHOW);
m_wndHeroStatusBar.SetButtonInfo(3,ID_MP_PROGRESS,TBBS_SEPARATOR,200);
m_wndHeroStatusBar.GetItemRect(3,&rect);
rect.top += 1;
rect.bottom -= 1;
m_wndHeroStatusBar.m_wndMPProgress.Create(WS_CHILD|WS_VISIBLE,rect,&m_wndHeroStatusBar,ID_MP_PROGRESS);
m_wndHeroStatusBar.m_wndMPProgress.SetTextFont(&m_Font);
m_wndHeroStatusBar.m_wndMPProgress.SetShowTextStyle(4);
m_wndHeroStatusBar.m_wndMPProgress.SetForeColour(RGB(0,0,255));
m_wndHeroStatusBar.m_wndMPProgress.SetTextForeColour(RGB(0,0,255));
m_wndHeroStatusBar.m_wndMPProgress.SetRange(0,999);
m_wndHeroStatusBar.m_wndMPProgress.SetPos(999);
m_wndHeroStatusBar.m_wndMPProgress.ShowWindow(SW_SHOW);
m_wndHeroStatusBar.SetButtonInfo(5,ID_EXP_PROGRESS,TBBS_SEPARATOR,200);
m_wndHeroStatusBar.GetItemRect(5,&rect);
rect.top += 1;
rect.bottom -= 1;
m_wndHeroStatusBar.m_wndEXPProgress.Create(WS_CHILD|WS_VISIBLE,rect,&m_wndHeroStatusBar,ID_EXP_PROGRESS);
m_wndHeroStatusBar.m_wndEXPProgress.SetTextFont(&m_Font);
m_wndHeroStatusBar.m_wndEXPProgress.SetShowTextStyle(4);
m_wndHeroStatusBar.m_wndEXPProgress.SetForeColour(RGB(135,116,116));
m_wndHeroStatusBar.m_wndEXPProgress.SetTextForeColour(RGB(135,116,116));
m_wndHeroStatusBar.m_wndEXPProgress.SetRange(0,999);
m_wndHeroStatusBar.m_wndEXPProgress.SetPos(999);
m_wndHeroStatusBar.m_wndEXPProgress.ShowWindow(SW_SHOW);
m_wndHeroStatusBar.SetButtonInfo(7,ID_BAG_PROGRESS,TBBS_SEPARATOR,200);
m_wndHeroStatusBar.GetItemRect(7,&rect);
rect.top += 1;
rect.bottom -= 1;
m_wndHeroStatusBar.m_wndBagProgress.Create(WS_CHILD|WS_VISIBLE,rect,&m_wndHeroStatusBar,ID_BAG_PROGRESS);
m_wndHeroStatusBar.m_wndBagProgress.SetTextFont(&m_Font);
m_wndHeroStatusBar.m_wndBagProgress.SetShowTextStyle(3);
m_wndHeroStatusBar.m_wndBagProgress.SetForeColour(RGB(240,0,240));
m_wndHeroStatusBar.m_wndBagProgress.SetTextForeColour(RGB(240,0,240));
m_wndHeroStatusBar.m_wndBagProgress.SetRange(0,999);
m_wndHeroStatusBar.m_wndBagProgress.SetPos(999);
m_wndHeroStatusBar.m_wndBagProgress.ShowWindow(SW_SHOW);
return TRUE;
}
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
if ( nID == IDM_ABOUTBOX )
{
theApp.OnAppAbout();
return;
}
if ( nID == IDM_QUITAPP )
{
PostMessage(WM_COMMAND,ID_APP_EXIT);
return;
}
if ( nID == SC_CLOSE )
{
CQuitDialog dlg;
if (dlg.DoModal()==IDOK)
PostMessage(WM_COMMAND,ID_APP_EXIT);
else
PostMessage(WM_COMMAND,ID_SHOW_MAIN);
return;
}
CFrameWndEx::OnSysCommand(nID, lParam);
}
struct sLogItem
{
CTime time;
std::string text;
COLORREF crFont,crBack;
};
void CMainFrame::AddLog( sLogMessageType type, COLORREF font, COLORREF back, LPCTSTR body )
{
sLogItem log;
log.time=CTime::GetCurrentTime();
switch(type)
{
case LMT_DEBUG:
log.text=body;
SendMessage(WM_DEBUGOUT,0,(LPARAM)&log);
break;
case LMT_SYSTEM:
log.time=CTime::GetCurrentTime();
log.text=body;
log.crFont=font;
SendMessage(WM_ADDLOG,0,(LPARAM)&log);
break;
case LMT_CHAT:
log.time=CTime::GetCurrentTime();
log.text=body;
log.crFont=font;
log.crBack=back;
SendMessage(WM_ADDCHAT,0,(LPARAM)&log);
break;
}
}
LRESULT CMainFrame::OnAddLog( WPARAM , LPARAM l )
{
sLogItem* p=(sLogItem*)l;
CRichEditCtrl&edit=m_wndSystemLog.m_wndChild;
EnterCriticalSection(&m_logSC);
{
if ( edit.GetLineCount() > 1000 )
edit.SetWindowText("");
long s;
CHARFORMAT cf;
edit.GetDefaultCharFormat( cf );
cf.dwMask |= CFM_COLOR;
cf.crTextColor = crTime;
s = edit.GetTextLength();
edit.SetSel( s, -1 );
edit.SetSelectionCharFormat( cf );
edit.ReplaceSel( p->time.Format( "%H:%M:%S " ) );
edit.GetDefaultCharFormat( cf );
cf.dwMask |= CFM_COLOR;
cf.crTextColor = p->crFont;
s = edit.GetTextLength();
edit.SetSel( s, -1 );
edit.SetSelectionCharFormat( cf );
edit.ReplaceSel( p->text.c_str() );
edit.SendMessage( EM_SCROLL, SB_PAGEDOWN, 0 );
}
LeaveCriticalSection(&m_logSC);
return 0;
}
LRESULT CMainFrame::OnDebugOut( WPARAM , LPARAM l )
{
sLogItem* p=(sLogItem*)l;
CRichEditCtrl&edit=m_wndDebug.m_wndChild;
EnterCriticalSection(&m_dbgSC);
{
if ( edit.GetLineCount() > 1000 )
edit.SetWindowText("");
long s;
CHARFORMAT cf;
edit.GetDefaultCharFormat( cf );
cf.dwMask |= CFM_COLOR;
cf.crTextColor = crTime;
s = edit.GetTextLength();
edit.SetSel( s, -1 );
edit.SetSelectionCharFormat( cf );
edit.ReplaceSel( p->time.Format( "%H:%M:%S " ) );
edit.GetDefaultCharFormat( cf );
cf.dwMask |= CFM_COLOR;
cf.crTextColor = crDebug;
s = edit.GetTextLength();
edit.SetSel( s, -1 );
edit.SetSelectionCharFormat( cf );
edit.ReplaceSel( p->text.c_str() );
edit.SendMessage( EM_SCROLL, SB_PAGEDOWN, 0 );
}
LeaveCriticalSection(&m_dbgSC);
return 0;
}
LRESULT CMainFrame::OnAddChat( WPARAM , LPARAM l )
{
sLogItem* p=(sLogItem*)l;
CRichEditCtrl & edit=m_wndView->GetRichEditCtrl();
EnterCriticalSection(&m_chtSC);
{
if ( edit.GetLineCount() > 1000 )
{
edit.SetWindowText(szAd);
}
long s;
CHARFORMAT2 cf2;
ZeroMemory(&cf2,sizeof(CHARFORMAT2));
edit.GetDefaultCharFormat(cf2);
cf2.dwMask|=CFM_COLOR;
cf2.crTextColor=crTime;
s=edit.GetTextLength();
edit.SetSel(s,-1);
edit.SetSelectionCharFormat(cf2);
edit.ReplaceSel(p->time.Format("%H:%M:%S "));
ZeroMemory(&cf2,sizeof(CHARFORMAT2));
edit.GetDefaultCharFormat(cf2);
cf2.dwMask|=CFM_COLOR|CFM_BACKCOLOR;
cf2.dwEffects&=~CFE_AUTOBACKCOLOR;
cf2.crBackColor=p->crBack;
cf2.crTextColor=p->crFont;
s=edit.GetTextLength();
edit.SetSel(s,-1);
edit.SetSelectionCharFormat(cf2);
edit.ReplaceSel(p->text.c_str());
edit.SendMessage(EM_SCROLL,SB_PAGEDOWN,0);
}
LeaveCriticalSection(&m_chtSC);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWndEx::PreCreateWindow(cs) )
return FALSE;
cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
| WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
cs.lpszClass = AfxRegisterWndClass(0);
return TRUE;
}
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWndEx::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWndEx::Dump(dc);
}
#endif //_DEBUG
// CMainFrame message handlers
void CMainFrame::OnSetFocus(CWnd* /*pOldWnd*/)
{
// forward focus to the view window
m_wndView->SetFocus();
}
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// let the view have first crack at the command
if (m_wndView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
// otherwise, do default handling
return CFrameWndEx::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
BOOL CMainFrame::OnShowPopupMenu (CMFCPopupMenu* pMenuPopup)
{
//---------------------------------------------------------
// Replace ID_VIEW_TOOLBARS menu item to the toolbars list:
//---------------------------------------------------------
CFrameWndEx::OnShowPopupMenu (pMenuPopup);
if (pMenuPopup != NULL &&
pMenuPopup->GetMenuBar ()->CommandToIndex (ID_VIEW_TOOLBARS) >= 0)
{
if (CMFCToolBar::IsCustomizeMode ())
{
//----------------------------------------------------
// Don't show toolbars list in the cuztomization mode!
//----------------------------------------------------
return FALSE;
}
pMenuPopup->RemoveAllItems ();
CMenu menu;
VERIFY(menu.LoadMenu (IDR_POPUP_TOOLBAR));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
pMenuPopup->GetMenuBar ()->ImportFromMenu (*pPopup, TRUE);
}
return TRUE;
}
void CMainFrame::OnAppLook(UINT id)
{
m_nAppLook = id;
switch (id)
{
case ID_SKIN_Normal:
CTabbedPane::m_StyleTabWnd = CMFCTabCtrl::STYLE_3D;
CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManager));
CDockingManager::SetDockingMode (DT_STANDARD);
WritePrivateProfileString("System","AppLook","0",(CGameMir::GetMainDir()+"\\main.ini").c_str());
break;
case ID_SKIN_XP:
CTabbedPane::m_StyleTabWnd = CMFCTabCtrl::STYLE_3D;
CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOfficeXP));
CDockingManager::SetDockingMode (DT_STANDARD);
WritePrivateProfileString("System","AppLook","1",(CGameMir::GetMainDir()+"\\main.ini").c_str());
break;
case ID_SKIN_2003:
CTabbedPane::m_StyleTabWnd = CMFCTabCtrl::STYLE_3D;
CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2003));
CDockingManager::SetDockingMode (DT_STANDARD);
WritePrivateProfileString("System","AppLook","2",(CGameMir::GetMainDir()+"\\main.ini").c_str());
break;
case ID_SKIN_2005:
CTabbedPane::m_StyleTabWnd = CMFCTabCtrl::STYLE_3D;
CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerVS2005));
CDockingManager::SetDockingMode (DT_SMART);
WritePrivateProfileString("System","AppLook","3",(CGameMir::GetMainDir()+"\\main.ini").c_str());
break;
case ID_SKIN_XPNative:
CTabbedPane::m_StyleTabWnd = CMFCTabCtrl::STYLE_3D;
CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerWindows));
CDockingManager::SetDockingMode (DT_STANDARD);
WritePrivateProfileString("System","AppLook","8",(CGameMir::GetMainDir()+"\\main.ini").c_str());
break;
case ID_SKIN_LunaBlue:
case ID_SKIN_Silver:
case ID_SKIN_ObsidianBlack:
case ID_SKIN_Aqua:
CTabbedPane::m_StyleTabWnd = CMFCTabCtrl::STYLE_3D;
CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2007));
CDockingManager::SetDockingMode (DT_SMART);
switch (id)
{
case ID_SKIN_LunaBlue:
CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_LunaBlue);
WritePrivateProfileString("System","AppLook","4",(CGameMir::GetMainDir()+"\\main.ini").c_str());
break;
case ID_SKIN_Silver:
CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_Silver);
WritePrivateProfileString("System","AppLook","5",(CGameMir::GetMainDir()+"\\main.ini").c_str());
break;
case ID_SKIN_ObsidianBlack:
CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);
WritePrivateProfileString("System","AppLook","6",(CGameMir::GetMainDir()+"\\main.ini").c_str());
break;
case ID_SKIN_Aqua:
CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_Aqua);
WritePrivateProfileString("System","AppLook","7",(CGameMir::GetMainDir()+"\\main.ini").c_str());
break;
}
break;
default:
ASSERT (FALSE);
}
CDockingManager* pDockManager = GetDockingManager();
if (pDockManager != NULL)
{
ASSERT_VALID (pDockManager);
pDockManager->AdjustPaneFrames();
}
CTabbedPane::ResetTabs();
RecalcLayout ();
RedrawWindow (NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
}
void CMainFrame::OnUpdateAppLook(CCmdUI* pCmdUI)
{
#if !defined _AFXDLL || defined _BCGCBPRO_STATIC_
pCmdUI->Enable(FALSE);
#endif
pCmdUI->SetCheck( m_nAppLook == pCmdUI->m_nID );
}
BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle , CWnd* pParentWnd , CCreateContext* pContext)
{
BOOL retval=CFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext);
HICON hIcon=AfxGetApp()->LoadIcon(nIDResource);
if(hIcon)
{
SetIcon(hIcon,FALSE);
SetIcon(hIcon,TRUE);
return retval;
}
else
{
return FALSE;
}
}
void CMainFrame::OnLogin()
{
CLoginDialog loginDlg;
if(loginDlg.DoModal()==IDOK)
m_Game.Login(loginDlg.ret_ServerAddress,loginDlg.ret_ServerName,loginDlg.ret_ServerPort,
loginDlg.ret_Account,loginDlg.ret_Password,loginDlg.ret_CharSelect);
}
void CMainFrame::OnUpdateLogin(CCmdUI *pCmdUI)
{
if(m_Game.m_hSocket!=INVALID_SOCKET)
{
pCmdUI->Enable(FALSE);
}
else
{
pCmdUI->Enable(TRUE);
}
}
void CMainFrame::OnDisconnect()
{
m_Game.Close();
}
void CMainFrame::OnUpdateDisconnect(CCmdUI *pCmdUI)
{
if(m_Game.m_hSocket!=INVALID_SOCKET)
{
pCmdUI->Enable(TRUE);
}
else
{
pCmdUI->Enable(FALSE);
}
}
void CMainFrame::UpdateActors(const CGameMir::sActor& actor, bool update)
{
CListCtrl &lst=m_wndActors.m_wndChild;
int cnt=lst.GetItemCount();
int i;
if ( update )
{
bool found=false;
for ( i=0; i<cnt; i++)
{
if ( static_cast<DWORD>( lst.GetItemData(i))==actor.ServerId )
{
found=true;
break;
}
}
if ( !found )
{
i=lst.InsertItem(cnt,"");
lst.SetItemData(i,actor.ServerId);
}
lst.SetItemText( i, 0, actor.Name.c_str() );
char str[32];
sprintf(str,"(%u,%u)%s",actor.xx,actor.yy,DirStr[actor.dir&7]);
lst.SetItemText( i, 1, str );
switch( actor.Type )
{
case CGameMir::AT_Human:
lst.SetItemText( i, 2, "玩家" );
break;
case CGameMir::AT_Monst:
lst.SetItemText( i, 2, "怪物" );
break;
case CGameMir::AT_Baby:
lst.SetItemText( i, 2, "宠物" );
break;
case CGameMir::AT_Merchant:
lst.SetItemText( i, 2, "商人" );
break;
case CGameMir::AT_Guard:
lst.SetItemText( i, 2, "卫士" );
break;
default:
sprintf(str,"类型%u",LOBYTE(LOWORD(actor.Feature)));
lst.SetItemText( i, 2, str );
break;
}
}
else
{
for ( i=0; i<cnt; i++)
{
if ( static_cast<DWORD>( lst.GetItemData(i))==actor.ServerId )
{
lst.DeleteItem( i );
}
}
}
m_wndLeftView.RedrawMiniMap();
}
void CMainFrame::OnPositionChange( POINT p )
{
char buf[64];
sprintf(buf,"地图:%s[%s]",m_Game.GetSelfInfo().MapTitle.c_str(),m_Game.m_Map.get_MapName().c_str());
m_wndStatusBar.SetPaneText(5,buf);
sprintf(buf,"坐标:(%d,%d)",p.x,p.y);
m_wndStatusBar.SetPaneText(6,buf);
m_wndLeftView.RedrawMiniMap();
m_wndMap.Invalidate(FALSE);
}
void CMainFrame::UpdateSelfInfo(void)
{
const char szJobName[8][8]={"武士","法士","道士","未知"};
int count=m_wndSelf.m_wndChild.GetItemCount();
char str[256];
const CGameMir::sMySelf&self=m_Game.GetSelfInfo();
ltoa(self.Gold,str,10);
m_wndStatusBar.SetPaneText(1,str);
sprintf(str,"角色:%s",self.Name.c_str());
m_wndStatusBar.SetPaneText(2,str);
sprintf(str,"职业:%s",szJobName[self.Job>3?3:self.Job]);
m_wndStatusBar.SetPaneText(3,str);
sprintf(str,"LV%02d",self.Ability.bLevel);
m_wndStatusBar.SetPaneText(4,str);
for(int i=0;i<count;i++)
{
DWORD_PTR d=m_wndSelf.m_wndChild.GetItemData(i);
switch(d)
{
case CI_NAME:
m_wndSelf.m_wndChild.SetItemText(i,1,self.Name.c_str());
break;
case CI_POS:
//sprintf(str,"%s(%u/%u)",m_CharSelf.MapTitle.c_str(),m_CharSelf.xx,m_CharSelf.yy);
//m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_SEX:
//ltoa(m_CharSelf.sex,str,10);
m_wndSelf.m_wndChild.SetItemText(i,1,"**");
break;
case CI_GOLD:
ltoa(self.Gold,str,10);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_SPOUSE:
m_wndSelf.m_wndChild.SetItemText(i,1,"无配偶");
break;
case CI_HP:
sprintf(str,"%u/%u",self.Ability.Hp,self.Ability.MaxHp);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_MP:
sprintf(str,"%u/%u",self.Ability.Mp,self.Ability.MaxMp);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_PROF:
switch(self.Job)
{
case 0:
m_wndSelf.m_wndChild.SetItemText(i,1,"武士");
break;
case 1:
m_wndSelf.m_wndChild.SetItemText(i,1,"法师");
break;
case 2:
m_wndSelf.m_wndChild.SetItemText(i,1,"道士");
break;
default:
m_wndSelf.m_wndChild.SetItemText(i,1,"未知职业");
break;
}
break;
case CI_LEVEL:
ltoa(self.Ability.bLevel,str,10);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_AC:
sprintf(str,"%u-%u",self.Ability.ACLow,self.Ability.ACHi);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_MAC:
sprintf(str,"%u-%u",self.Ability.MACLow,self.Ability.MACHi);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_DC:
sprintf(str,"%u-%u",self.Ability.DCLow,self.Ability.DCHi);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_MC:
sprintf(str,"%u-%u",self.Ability.MCLow,self.Ability.MCHi);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_SC:
sprintf(str,"%u-%u",self.Ability.SCLow,self.Ability.SCHi);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_EXP:
str[0]=static_cast<char>(0);
if ( self.Ability.MaxExp!=0 )
{
sprintf(str,"%u/%u %2.1f%%",self.Ability.Exp,self.Ability.MaxExp,((float)self.Ability.Exp*100)/((float)self.Ability.MaxExp));
}
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_BAGWEIGHT:
sprintf(str,"%u/%u",self.Ability.BagWeight,self.Ability.MaxBagWeight);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_BODYWEIGHT:
sprintf(str,"%u/%u",self.Ability.BodyWeight,self.Ability.MaxBodyWeight);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_HANDWEIGHT:
sprintf(str,"%u/%u",self.Ability.HandWeight,self.Ability.MaxHandWeight);
m_wndSelf.m_wndChild.SetItemText(i,1,str);
break;
case CI_ZHUNQUE:
case CI_MINJIE:
break;
case CI_NONE:
m_wndSelf.m_wndChild.SetItemText(i,1,"-------------");
break;
default:
m_wndSelf.m_wndChild.SetItemText(i,1,"");
break;
}
}
}
void CMainFrame::UpdateUseItem(void)
{
int count=m_wndUseItem.m_wndChild.GetItemCount();
for(int i=0;i<count;i++)
{
DWORD_PTR d=m_wndUseItem.m_wndChild.GetItemData(i);
char buf[32];
m_wndUseItem.m_wndChild.SetItemText(i,1,GetDelphiString(m_Game.GetUseItem(i).S.Name,14,buf));
}
}
void CMainFrame::UpdateBag( const sClientItem& ci, bool isAdd )
{
int cnt=m_wndBag.m_wndChild.GetItemCount();
if ( isAdd )
{
char str[16];
ZeroMemory(str,16);
strncpy(str,ci.S.Name,min(ci.S.NameLen,sizeof(ci.S.Name)));
int idx=m_wndBag.m_wndChild.InsertItem(cnt,str);
m_wndBag.m_wndChild.SetItemData(idx,ci.MakeIndex);
sprintf(str,"%u/%u",ci.Dura/1000,ci.DuraMax/1000);
m_wndBag.m_wndChild.SetItemText(idx,1,str);
}
else
{
--cnt;
for ( ; cnt>=0; --cnt )
{
bool found=false;
DWORD id=m_wndBag.m_wndChild.GetItemData( cnt );
if(id==ci.MakeIndex)
{
m_wndBag.m_wndChild.DeleteItem(cnt);
}
}
}
int c=m_Game.GetBagItemCount();
char buf[64];
sprintf(buf,"背包剩余%u",46-c);
m_wndStatusBar.SetPaneText(7,buf);
}
void CMainFrame::OnItemShow( CGameMir::sDropedItem& di )
{
int cnt=m_wndGround.m_wndChild.GetItemCount();
int idx;
char str[16];
for ( idx=0; idx<cnt; idx++ )
{
DWORD id=m_wndGround.m_wndChild.GetItemData( idx );
if ( id==di.ServerId )
{
break;
}
}
if ( idx==cnt )
{
idx=m_wndGround.m_wndChild.InsertItem(cnt,di.Name.c_str());
m_wndGround.m_wndChild.SetItemData(idx,di.ServerId);
}
else
m_wndGround.m_wndChild.SetItemText(idx,0,di.Name.c_str());
sprintf(str,"(%u,%u)",di.x,di.y);
m_wndGround.m_wndChild.SetItemText(idx,1,str);
}
void CMainFrame::OnItemHide( CGameMir::sDropedItem& di )
{
int cnt=m_wndGround.m_wndChild.GetItemCount();
--cnt;
for ( ; cnt>=0; --cnt )
{
DWORD id=m_wndGround.m_wndChild.GetItemData( cnt );
if ( id==di.ServerId )
{
m_wndGround.m_wndChild.DeleteItem(cnt);
}
}
}
void CMainFrame::OnUpdateScriptRun(CCmdUI *pCmdUI)
{
if ( m_Game.isInGame( ) )
pCmdUI->Enable( TRUE );
else
pCmdUI->Enable( FALSE );
}
void CMainFrame::OnSetting()
{
m_SettingDialog.ShowWindow(SW_SHOW);
}
void CMainFrame::OnUpdateSetting(CCmdUI *pCmdUI)
{
if ( m_Game.isInGame( ) )
pCmdUI->Enable( TRUE );
else
pCmdUI->Enable( FALSE );
}
void CMainFrame::OnAttackmodeChange()
{
}
void CMainFrame::OnAttackmode(UINT nID)
{
int mode=nID-ID_ATTACKMODE_0;
if (mode>7)
return;
m_Game.ChangeAttackMode(mode);
}
void CMainFrame::OnUpdateAttackmode(CCmdUI *pCmdUI)
{
if ( m_Game.isInGame( ) )
pCmdUI->Enable( TRUE );
else
pCmdUI->Enable( FALSE );
int mode=pCmdUI->m_nID-ID_ATTACKMODE_0;
if ( mode==m_Game.GetAttackMode() )
pCmdUI->SetCheck(1);
else
pCmdUI->SetCheck(0);
}
void CMainFrame::OnUpdateAttackmodeChange(CCmdUI *pCmdUI)
{
if ( m_Game.isInGame( ) )
pCmdUI->Enable( TRUE );
else
pCmdUI->Enable( FALSE );
}
void CMainFrame::OnUseItem()
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
m_Game.EatItem(listCtrl.GetItemData(listCtrl.m_CurSel),listCtrl.GetItemText(listCtrl.m_CurSel,0));
}
void CMainFrame::OnTimer(UINT nIDEvent)
{
switch( nIDEvent )
{
case TIMER_HP_PROTECT:
if(m_Game.isInGame())
m_Game.OnHpChange(m_Game.GetSelf().Ability.Hp,m_Game.GetSelf().Ability.MaxHp);
break;
case TIMER_MP_PROTECT:
if(m_Game.isInGame())
m_Game.OnMpChange(m_Game.GetSelf().Ability.Mp,m_Game.GetSelf().Ability.MaxMp);
break;
case TIMER_EVENT_CHECK_ATTACK_MODE:
if(m_Game.isInGame())
m_Game.CheckAttackMode();
break;
}
CFrameWndEx::OnTimer(nIDEvent);
}
CString CMainFrame::GetTooltipTextBag( LVHITTESTINFO& li,UIExtended::CColorListCtrl& ctrl,CString& retVal)
{
DWORD itemid=ctrl.GetItemData(li.iItem);
std::list<sClientItem>::iterator item=m_Game.FindItem(itemid);
CString strTemp;
char strBuf[64];
retVal.Empty();
//名称
retVal = _T("<center><font color=blue size=12pt style=b>");
retVal += GetDelphiString(item->S.Name,14,strBuf);
retVal += _T("</font></center><br><hr color = green><br>");
switch( item->S.StdMode )
{
case 0:
if( item->S.AC != 0 )
{
strTemp.Format("+%dHP<br>",item->S.AC);
retVal += strTemp;
}
if( item->S.MAC != 0 )
{
strTemp.Format("+%dMP<br>",item->S.MAC);
retVal += strTemp;
}
strTemp.Format("重量 %d<br>",item->S.Weight);
retVal += strTemp;
break;
case 1:
case 2:
case 3:
strTemp.Format("重量 %d<br>",item->S.Weight);
retVal += strTemp;
break;
case 4:
switch ( item->S.Shape )
{
case 0:
if ( m_Game.GetSelfInfo().Job==0 && m_Game.GetSelfInfo().Ability.bLevel>=item->S.DuraMax )
retVal += "武术秘技<br>";
else
retVal += "<font color=red>武术秘技</font><br>";
break;
case 1:
if ( m_Game.GetSelfInfo().Job==0 && m_Game.GetSelfInfo().Ability.bLevel>=item->S.DuraMax )
retVal += "魔法书<br>";
else
retVal += "<font color=red>魔法书</font><br>";
break;
case 2:
if ( m_Game.GetSelfInfo().Job==0 && m_Game.GetSelfInfo().Ability.bLevel>=item->S.DuraMax )
retVal += "道士秘技<br>";
else
retVal = "<font color=red>道士秘技</font><br>";
break;
}
strTemp.Format("重量 %d<br>",item->S.Weight);
retVal += strTemp;
break;
case 5:
case 6:
//名称
retVal = _T("<center><font color=blue size=12pt style=b>");
if ( (item->S.ItemDesc&1)!=0 )
{
retVal += "(*)";
}
retVal += GetDelphiString(item->S.Name,14,strBuf);
retVal += _T("</font></center><br><hr color = green><br>");
//重量
strTemp.Format("重量 %d 持久 %d/%d<br>",item->S.Weight,item->Dura / 1000,item->DuraMax / 1000);
retVal += strTemp;
//攻击力
if( item->S.DC != 0 || item->S.MaxDC != 0)
{
strTemp.Format("攻击 %d-%d<br>",item->S.DC,item->S.MaxDC);
retVal += strTemp;
}
//魔攻
if( item->S.MC != 0 || item->S.MaxMC != 0)
{
strTemp.Format("魔法 %d-%d<br>",item->S.MC,item->S.MaxMC);
retVal += strTemp;
}
//道术
if( item->S.SC != 0 || item->S.MaxSC != 0)
{
strTemp.Format("道术 %d-%d<br>",item->S.SC,item->S.MaxSC);
retVal += strTemp;
}
if ( item->S.SpecialPwr>0 && item->S.SpecialPwr<=10)
{
strTemp.Format("神圣+%d<br>",item->S.SpecialPwr);
retVal += strTemp;
}
if( item->S.MaxAC != 0)
{
strTemp.Format("准确+%d<br>",item->S.MaxAC);
retVal += strTemp;
}
if( item->S.MaxMAC > 0)
{
if( item->S.MaxMAC > 10)
strTemp.Format("攻击速度+%d<br>",item->S.MaxMAC);
else
strTemp.Format("攻击速度-%d<br>",item->S.MaxMAC);
retVal += strTemp;
}
if( ((item->S.AC)&0x80) != 0)
{
retVal += "祝";
}
if( ((item->S.AC)&0x7f) > 0)
{
strTemp.Format("幸运+%d<br>",item->S.AC&0x7f );
retVal += strTemp;
}
if( item->S.MAC > 0)
{
strTemp.Format("诅咒+%d<br>",item->S.MAC );
retVal += strTemp;
}
//条件
if( item->S.NeedLevel != 0)
{
switch( item->S.Need )
{
case 0:
strTemp.Format("需要等级 %d<br>",item->S.NeedLevel);
break;
case 1:
strTemp.Format("需要攻击力 %d<br>",item->S.NeedLevel);
break;
case 2:
strTemp.Format("需要魔法力 %d<br>",item->S.NeedLevel);
break;
case 3:
strTemp.Format("需要精神力 %d<br>",item->S.NeedLevel);
break;
default:
strTemp.Empty();
}
retVal += strTemp;
}
break;
case 7:
strTemp.Format("重量 %d<br>",item->S.Weight);
retVal += strTemp;
break;
case 8:
strTemp.Format("重量 %d<br>",item->S.Weight);
retVal += strTemp;
break;
case 10:
case 11:
//重量
strTemp.Format("重量 %d 持久 %d/%d<br>",item->S.Weight,item->Dura / 1000,item->DuraMax / 1000);
retVal += strTemp;
//防御
if( item->S.AC != 0 || item->S.MaxAC != 0)
{
strTemp.Format("防御: %d-%d<br>",item->S.AC,item->S.MaxAC);
retVal += strTemp;
}
//魔防
if( item->S.MAC != 0 || item->S.MaxMAC != 0)
{
strTemp.Format("魔防: %d-%d<br>",item->S.MAC,item->S.MaxMAC);
retVal += strTemp;
}
//攻击力
if( item->S.DC != 0 || item->S.MaxDC != 0)
{
strTemp.Format("攻击力: %d-%d<br>",item->S.DC,item->S.MaxDC);
retVal += strTemp;
}
//魔攻
if( item->S.MC != 0 || item->S.MaxMC != 0)
{
strTemp.Format("魔攻: %d-%d<br>",item->S.MC,item->S.MaxMC);
retVal += strTemp;
}
//道术
if( item->S.SC != 0 || item->S.MaxSC != 0)
{
strTemp.Format("道术: %d-%d<br>",item->S.SC,item->S.MaxSC);
retVal += strTemp;
}
//条件
if( item->S.NeedLevel != 0)
{
switch( item->S.Need )
{
case 0:
strTemp.Format("需要等级 %d<br>",item->S.NeedLevel);
break;
case 1:
strTemp.Format("需要攻击力 %d<br>",item->S.NeedLevel);
break;
case 2:
strTemp.Format("需要魔法力 %d<br>",item->S.NeedLevel);
break;
case 3:
strTemp.Format("需要精神力 %d<br>",item->S.NeedLevel);
break;
default:
strTemp.Empty();
}
retVal += strTemp;
}
break;
default:
strTemp.Format("重量 %d<br>",item->S.Weight);
retVal += strTemp;
break;
break;
}
retVal += "<hr color = blue><br>";
//类型
strTemp.Format("类型 %d<br>",item->S.StdMode);
retVal += strTemp;
//重量
strTemp.Format("重量 %d 持久 %d/%d<br>",item->S.Weight,item->Dura / 1000,item->DuraMax / 1000);
retVal += strTemp;
//防御
if( item->S.AC != 0 || item->S.MaxAC != 0)
{
strTemp.Format("防御 %d-%d<br>",item->S.AC,item->S.MaxAC);
retVal += strTemp;
}
//魔防
if( item->S.MAC != 0 || item->S.MaxMAC != 0)
{
strTemp.Format("魔防 %d-%d<br>",item->S.MAC,item->S.MaxMAC);
retVal += strTemp;
}
//攻击力
if( item->S.DC != 0 || item->S.MaxDC != 0)
{
strTemp.Format("攻击力 %d-%d<br>",item->S.DC,item->S.MaxDC);
retVal += strTemp;
}
//魔攻
if( item->S.MC != 0 || item->S.MaxMC != 0)
{
strTemp.Format("魔攻 %d-%d<br>",item->S.MC,item->S.MaxMC);
retVal += strTemp;
}
//道术
if( item->S.SC != 0 || item->S.MaxSC != 0)
{
strTemp.Format("道术 %d-%d<br>",item->S.SC,item->S.MaxSC);
retVal += strTemp;
}
//条件
if( item->S.NeedLevel != 0)
{
switch( item->S.Need )
{
case 0:
strTemp.Format("需要等级 %d<br>",item->S.NeedLevel);
break;
case 1:
strTemp.Format("需要攻击 %d<br>",item->S.NeedLevel);
break;
case 2:
strTemp.Format("需要魔法 %d<br>",item->S.NeedLevel);
break;
case 3:
strTemp.Format("需要精神力 %d<br>",item->S.NeedLevel);
break;
default:
strTemp.Empty();
}
retVal += strTemp;
}
return retVal;
}
COLORREF CMainFrame::GetCellTextColorActors ( int item, int subitem, UIExtended::CColorListCtrl& ctrl )
{
DWORD id=ctrl.GetItemData(item);
CGameMir::itActor actor=m_Game.FindActor(id);
if ( !m_Game.isOverEnd(actor) )
{
switch( actor->Type )
{
case CGameMir::AT_Human:
return RGB(0x00,0x00,0x60);
break;
case CGameMir::AT_Monst:
return crRed;
break;
case CGameMir::AT_Baby:
return crGreen;
break;
case CGameMir::AT_Guard:
case CGameMir::AT_Merchant:
return crBlue;
break;
default:
break;
}
}
return crBlack;
}
COLORREF CMainFrame::GetCellBkColorActors ( int item, int subitem, UIExtended::CColorListCtrl& ctrl )
{
DWORD id=ctrl.GetItemData(item);
CGameMir::itActor actor=m_Game.FindActor(id);
if ( !m_Game.isOverEnd(actor) )
{
switch( actor->Type )
{
case CGameMir::AT_Human:
//return RGB(0xf0,0xf0,0xf0);
break;
case CGameMir::AT_Monst:
return RGB(0xff,0xf0,0xf0);
break;
case CGameMir::AT_Baby:
return RGB(0xf0,0xff,0xf0);
break;
case CGameMir::AT_Guard:
case CGameMir::AT_Merchant:
return RGB(0xf0,0xf0,0xff);
break;
default:
break;
}
}
return crWhite;
}
void CMainFrame::OnTalkTo()
{
UIExtended::CColorListCtrl &listCtrl=m_wndActors.m_wndChild;
m_Game.ClickNPC(listCtrl.GetItemData(listCtrl.m_CurSel));
}
void CMainFrame::OnTakeOn(UINT nID)
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
DWORD idx=listCtrl.GetItemData(listCtrl.m_CurSel);
m_Game.TakeOnItem(idx,nID-ID_TAKEON_1);
}
void CMainFrame::OnDropItem()
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
DWORD idx=listCtrl.GetItemData(listCtrl.m_CurSel);
char buf[16];
m_Game.SendMsg(CM_DROPITEM,idx,0,0,0,GetDelphiString(m_Game.FindItem(idx)->S.Name,14,buf));
}
void CMainFrame::OnViewActors()
{
ShowPane (&m_wndActors,
!(m_wndActors.IsVisible ()),
FALSE, TRUE);
RecalcLayout ();
}
void CMainFrame::OnUpdateViewActors(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck (m_wndActors.IsVisible ());
}
void CMainFrame::OnViewBag()
{
ShowPane (&m_wndBag,
!(m_wndBag.IsVisible ()),
FALSE, TRUE);
RecalcLayout ();
}
void CMainFrame::OnUpdateViewBag(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck (m_wndBag.IsVisible ());
}
void CMainFrame::OnViewDebug()
{
#if !defined(PUBLIC_EDTION)
ShowPane (&m_wndDebug,
!(m_wndDebug.IsVisible ()),
FALSE, TRUE);
RecalcLayout ();
#endif
}
void CMainFrame::OnUpdateViewDebug(CCmdUI *pCmdUI)
{
#if !defined(PUBLIC_EDTION)
pCmdUI->SetCheck (m_wndDebug.IsVisible ());
#endif
}
void CMainFrame::OnViewDropeditem()
{
ShowPane (&m_wndGround,
!(m_wndGround.IsVisible ()),
FALSE, TRUE);
RecalcLayout ();
}
void CMainFrame::OnUpdateViewDropeditem(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck (m_wndGround.IsVisible ());
}
void CMainFrame::OnViewSelf()
{
ShowPane (&m_wndSelf,
!(m_wndSelf.IsVisible ()),
FALSE, TRUE);
RecalcLayout ();
}
void CMainFrame::OnUpdateViewSelf(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck (m_wndSelf.IsVisible ());
}
void CMainFrame::OnViewUseitem()
{
ShowPane (&m_wndUseItem,
!(m_wndUseItem.IsVisible ()),
FALSE, TRUE);
RecalcLayout ();
}
void CMainFrame::OnUpdateViewUseitem(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck (m_wndUseItem.IsVisible ());
}
void CMainFrame::OnViewSystemlog()
{
ShowPane (&m_wndSystemLog,
!(m_wndSystemLog.IsVisible ()),
FALSE, TRUE);
RecalcLayout ();
}
void CMainFrame::OnUpdateViewSystemlog(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck (m_wndSystemLog.IsVisible ());
}
void CMainFrame::OnRefreshBag()
{
m_Game.RefreshBag();
}
void CMainFrame::OnFightStart()
{
if ( m_Game.GetFight() )
m_Game.StopFight();
else
m_Game.OpenFight();
}
void CMainFrame::OnUpdateFightStart(CCmdUI *pCmdUI)
{
if ( m_Game.isInGame( ) )
pCmdUI->Enable( TRUE );
else
pCmdUI->Enable( FALSE );
if ( m_Game.GetFight() )
pCmdUI->SetCheck(TRUE);
else
pCmdUI->SetCheck(FALSE);
if ( m_Game.GetFight() )
pCmdUI->SetText("自动战斗\t战斗中...");
else
pCmdUI->SetText("自动战斗\t开始战斗!!");
}
void CMainFrame::OnHpChange( long Hp, long MaxHp )
{
m_wndHeroStatusBar.m_wndHPProgress.SetRange(0,MaxHp);
m_wndHeroStatusBar.m_wndHPProgress.SetPos(Hp);
m_wndHeroStatusBar.m_wndHPProgress.Invalidate();
SetProgressPos (Hp*200/MaxHp, ID_HP_PROGRESS);
}
void CMainFrame::OnMpChange( long Mp, long MaxMp )
{
m_wndHeroStatusBar.m_wndMPProgress.SetRange(0,m_Game.GetSelf().Ability.MaxMp);
m_wndHeroStatusBar.m_wndMPProgress.SetPos(m_Game.GetSelf().Ability.Mp);
m_wndHeroStatusBar.m_wndMPProgress.Invalidate();
SetProgressPos (Mp*200/MaxMp, ID_MP_PROGRESS);
}
void CMainFrame::OnExpChange( long Exp, long MaxExp )
{
m_wndHeroStatusBar.m_wndEXPProgress.SetRange(0,m_Game.GetSelf().Ability.MaxExp);
m_wndHeroStatusBar.m_wndEXPProgress.SetPos(m_Game.GetSelf().Ability.Exp);
m_wndHeroStatusBar.m_wndEXPProgress.Invalidate();
SetProgressPos (Exp*200/MaxExp, ID_EXP_PROGRESS);
}
void CMainFrame::OnWeightChange( long Wt, long MaxWt )
{
m_wndHeroStatusBar.m_wndBagProgress.SetRange(0,m_Game.GetSelf().Ability.MaxBagWeight);
m_wndHeroStatusBar.m_wndBagProgress.SetPos(m_Game.GetSelf().Ability.BagWeight);
m_wndHeroStatusBar.m_wndBagProgress.Invalidate();
}
void CMainFrame::OnShowMain()
{
if ( IsWindowVisible() )
{
m_wndLeftView.ShowWindow(SW_HIDE);
ShowWindow(SW_HIDE);
}
else
{
m_wndLeftView.ShowWindow(SW_SHOW);
ShowWindow(SW_SHOW);
}
}
void CMainFrame::OnUpdateShowMain(CCmdUI *pCmdUI)
{
if ( IsWindowVisible() )
pCmdUI->SetText("隐藏主窗口(&H)\tTeaM-D");
else
pCmdUI->SetText("显示主窗口(&H)\tTeaM-D");
}
void CMainFrame::OnViewObjectWindow()
{
if ( m_wndLeftView.IsWindowVisible() )
{
m_wndLeftView.ShowWindow(SW_HIDE);
}
else
{
m_wndLeftView.ShowWindow(SW_SHOWNA);
}
}
void CMainFrame::OnUpdateViewObjectWindow(CCmdUI *pCmdUI)
{
if ( m_wndLeftView.IsWindowVisible() )
pCmdUI->SetCheck(1);
else
pCmdUI->SetCheck(0);
}
void CMainFrame::OnHelpCommand()
{
// TODO: 在此添加命令处理程序代码
}
void CMainFrame::OnMoveTo()
{
UIExtended::CColorListCtrl &listCtrl=m_wndActors.m_wndChild;
DWORD id=listCtrl.GetItemData(listCtrl.m_CurSel);
m_Game.l_TalkNpc(m_Game.FindActor(id)->Name.c_str(),m_Game.l_GetMapName(),m_Game.FindActor(id)->xx,m_Game.FindActor(id)->yy);
}
//////////////////////////////////////////////////////////////////////////////
void CMainFrame::OnItemNopick()
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
std::string name=listCtrl.GetItemText(listCtrl.m_CurSel,0);
m_Game.m_SettingMgr.m_ItemTactic[name].PickType=PT_NOPICK;
m_Game.m_SettingMgr.SaveItems();
}
void CMainFrame::OnUpdateItemNopick(CCmdUI *pCmdUI)
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
std::string name=listCtrl.GetItemText(listCtrl.m_CurSel,0);
if ( m_Game.m_SettingMgr.m_ItemTactic.find(name)!=m_Game.m_SettingMgr.m_ItemTactic.end())
pCmdUI->SetRadio(m_Game.m_SettingMgr.m_ItemTactic[name].PickType==PT_NOPICK);
else
pCmdUI->SetRadio(FALSE);
}
//////////////////////////////////////////////////////////////////////////////
void CMainFrame::OnNormalPickup()
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
std::string name=listCtrl.GetItemText(listCtrl.m_CurSel,0);
m_Game.m_SettingMgr.m_ItemTactic[name].PickType=PT_NORMAL;
m_Game.m_SettingMgr.SaveItems();
}
void CMainFrame::OnUpdateItemNormalPickup(CCmdUI *pCmdUI)
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
std::string name=listCtrl.GetItemText(listCtrl.m_CurSel,0);
if ( m_Game.m_SettingMgr.m_ItemTactic.find(name)!=m_Game.m_SettingMgr.m_ItemTactic.end())
pCmdUI->SetRadio(m_Game.m_SettingMgr.m_ItemTactic[name].PickType==PT_NORMAL);
else
pCmdUI->SetRadio(FALSE);
}
//////////////////////////////////////////////////////////////////////////////
void CMainFrame::OnFirstPickup()
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
std::string name=listCtrl.GetItemText(listCtrl.m_CurSel,0);
m_Game.m_SettingMgr.m_ItemTactic[name].PickType=PT_PICKBETTER;
m_Game.m_SettingMgr.SaveItems();
}
void CMainFrame::OnUpdateItemFirstPickup(CCmdUI *pCmdUI)
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
std::string name=listCtrl.GetItemText(listCtrl.m_CurSel,0);
if ( m_Game.m_SettingMgr.m_ItemTactic.find(name)!=m_Game.m_SettingMgr.m_ItemTactic.end())
pCmdUI->SetRadio(m_Game.m_SettingMgr.m_ItemTactic[name].PickType==PT_PICKBETTER);
else
pCmdUI->SetRadio(FALSE);
}
//////////////////////////////////////////////////////////////////////////////
void CMainFrame::OnMustPickup()
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
std::string name=listCtrl.GetItemText(listCtrl.m_CurSel,0);
m_Game.m_SettingMgr.m_ItemTactic[name].PickType=PT_MUSTPICK;
m_Game.m_SettingMgr.SaveItems();
}
void CMainFrame::OnUpdateItemMustPickup(CCmdUI *pCmdUI)
{
UIExtended::CColorListCtrl &listCtrl=m_wndBag.m_wndChild;
std::string name=listCtrl.GetItemText(listCtrl.m_CurSel,0);
if ( m_Game.m_SettingMgr.m_ItemTactic.find(name)!=m_Game.m_SettingMgr.m_ItemTactic.end())
pCmdUI->SetRadio(m_Game.m_SettingMgr.m_ItemTactic[name].PickType==PT_MUSTPICK);
else
pCmdUI->SetRadio(FALSE);
}
void CMainFrame::OnGameMessageBox(LPCTSTR lpText,UINT uType)
{
MyMessageBox(lpText,"消息",uType);
}
int CMainFrame::MyMessageBox(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
{
CRect rect;
m_wndMsgBox.m_Text.SetWindowText(lpText);
m_wndMsgBox.SetWindowText(lpCaption);
m_wndMsgBox.ShowWindow(SW_SHOW);
GetWindowRect(rect);
int mx=(rect.left+rect.right)/2,my=(rect.top+rect.bottom)/2;
m_wndMsgBox.MoveWindow(mx-150,my-100,300,200);
m_wndMsgBox.GetClientRect(rect);
m_wndMsgBox.m_Text.MoveWindow(10,10,rect.Width()-20,rect.Height()-50);
m_wndMsgBox.m_btnOK.MoveWindow(rect.Width()/2-30,rect.Height()-40,60,30);
return 0;
}
void CMainFrame::OnUpdateInGameEnable(CCmdUI *pCmdUI)
{
if(m_Game.isInGame())
pCmdUI->Enable(TRUE);
else
pCmdUI->Enable(FALSE);
}
void CMainFrame::SetProgressPos (int nPos, UINT nID)
{
CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> ar;
m_wndRibbonBar.GetElementsByID (nID, ar);
for (int i = 0; i < ar.GetSize (); i++)
{
CMFCRibbonProgressBar* pProgress = DYNAMIC_DOWNCAST (CMFCRibbonProgressBar, ar[i]);
if (pProgress != NULL)
{
if (pProgress->GetPos () != nPos)
{
pProgress->SetPos (nPos);
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。