ROAView.cpp
资源名称:ROA3.40.rar [点击查看]
上传用户:tianheyiqi
上传日期:2010-04-16
资源大小:282k
文件大小:7k
源码类别:
外挂编程
开发平台:
Visual C++
- // ROAView.cpp : implementation of the CROAView class
- //
- #include "stdafx.h"
- #include "ROA.h"
- #include "ROADoc.h"
- #include "ROAView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CROAView
- IMPLEMENT_DYNCREATE(CROAView, CRichEditView)
- BEGIN_MESSAGE_MAP(CROAView, CRichEditView)
- //{{AFX_MSG_MAP(CROAView)
- ON_COMMAND(ID_RELOAD, OnReload)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CROAView construction/destruction
- CROAView::CROAView()
- {
- // TODO: add construction code here
- }
- CROAView::~CROAView()
- {
- }
- BOOL CROAView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- cs.style |= (WS_VSCROLL);
- cs.style |= (ES_AUTOHSCROLL|WS_HSCROLL);
- cs.style |= (ES_READONLY|ES_MULTILINE);
- return(CRichEditView::PreCreateWindow(cs));
- }
- /////////////////////////////////////////////////////////////////////////////
- // CROAView drawing
- void CROAView::OnDraw(CDC* pDC)
- {
- CROADoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CROAView diagnostics
- #ifdef _DEBUG
- void CROAView::AssertValid() const
- {
- CRichEditView::AssertValid();
- }
- void CROAView::Dump(CDumpContext& dc) const
- {
- CRichEditView::Dump(dc);
- }
- CROADoc* CROAView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CROADoc)));
- return (CROADoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CROAView message handlers
- extern CROAApp theApp;
- void CROAView::OnInitialUpdate()
- {
- CRichEditView::OnInitialUpdate();
- // TODO: Add your specialized code here and/or call the base class
- m_nWordWrap = WrapNone;
- WrapChanged();
- AddMessage("创建输出信息窗口......", eLogDebug, false);
- Reload();
- theApp.Start();
- }
- void CROAView::Reload()
- {
- BOOL bDone;
- utlLogout2("载入[物品信息]......", eLogCommon, false);
- bDone = mapItem.init(ROA_MAP_ITEMS, "物品");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[物品类型信息]......", eLogCommon, false);
- bDone = mapItemType.init(ROA_MAP_ITEMTYPES, "物品类型");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[装备类型信息]......", eLogCommon, false);
- bDone = mapEquipType.init(ROA_MAP_EQUIPTYPES, "装备类型");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[怪物信息]......", eLogCommon, false);
- bDone = mapMonster.init(ROA_MAP_MONSTER, "怪物信息");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[MVP怪物信息]......", eLogCommon, false);
- bDone = mapMvpMonster.init(ROA_MAP_MVPMONSTER, "MVP怪物信息");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[地图名称信息]......", eLogCommon, false);
- bDone = mapMapName.init(ROA_MAP_MAPNAME, "地图名");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[职业名称信息]......", eLogCommon, false);
- bDone = mapJob.init(ROA_MAP_JOB , "职业");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[性别信息]......", eLogCommon, false);
- bDone = mapSex.init(ROA_MAP_SEX , "性别");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[技能信息]......", eLogCommon, false);
- bDone = mapSkill.init(ROA_MAP_SKILL, "技能");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[地面状态信息]......", eLogCommon, false);
- bDone = mapStatus011f.init(ROA_MAP_STATUS011F, "地面状态");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[角色异常状态信息]......", eLogCommon, false);
- bDone = mapStatus0119.init(ROA_MAP_STATUS0119, "角色异常状态");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[GM帐号信息]......", eLogCommon, false);
- bDone = mapAvoidAid.init(ROA_AVOID_AIDS, "GM帐号");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[属性信息]......", eLogCommon, false);
- bDone = mapElements.init(ROA_MAP_ELEMENTS, "属性");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLogout2("载入[技能状态]......", eLogCommon, false);
- bDone = mapSkillsst.init(ROA_MAP_SKILLSST, "技能状态");
- utlLogout3(bDone?"成功":"失败", eLogCommon, false);
- utlLoadBossInfo();
- }
- void CROAView::AddMessage(LPCTSTR lpszMsg, LOG_LEVEL level, BOOL bAi)
- {
- CTime time = CTime::GetCurrentTime();
- CString strMsg, strTemp;
- strMsg.Format( _T("%s[%02d/%02d %02d:%02d:%02d] %srn"), strTemp, time.GetMonth(), time.GetDay(),
- time.GetHour(), time.GetMinute(), time.GetSecond(), lpszMsg );
- COLORREF color;
- switch(level)
- {
- case eLogError:
- color = RGB(255, 0, 0);
- break;
- case eLogCommon:
- color = RGB(0, 0, 0);
- break;
- case eLogInfo:
- color = RGB(0, 128, 0);
- break;
- default:
- color = RGB(128, 128, 0);
- break;
- }
- AddColorText(strMsg, color, bAi);
- return;
- }
- void CROAView::AddMessage2(LPCTSTR lpszMsg, LOG_LEVEL level, BOOL bAi)
- {
- CTime time = CTime::GetCurrentTime();
- CString strMsg, strTemp;
- strMsg.Format( _T("%s[%02d/%02d %02d:%02d:%02d] %s"), strTemp, time.GetMonth(), time.GetDay(),
- time.GetHour(), time.GetMinute(), time.GetSecond(), lpszMsg );
- COLORREF color;
- switch(level)
- {
- case eLogError:
- color = RGB(255, 0, 0);
- break;
- case eLogCommon:
- color = RGB(0, 0, 0);
- break;
- case eLogInfo:
- color = RGB(0, 128, 0);
- break;
- default:
- color = RGB(128, 128, 0);
- break;
- }
- AddColorText(strMsg, color, bAi);
- return;
- }
- void CROAView::AddMessage3(LPCTSTR lpszMsg, LOG_LEVEL level, BOOL bAi)
- {
- CString strMsg;
- strMsg = lpszMsg;
- strMsg += "n";
- COLORREF color;
- switch(level)
- {
- case eLogError:
- color = RGB(255, 0, 0);
- break;
- case eLogCommon:
- color = RGB(0, 0, 0);
- break;
- case eLogInfo:
- color = RGB(0, 128, 0);
- break;
- default:
- color = RGB(128, 128, 0);
- break;
- }
- AddColorText(strMsg, color, bAi);
- return;
- }
- void CROAView::AddColorText(LPCTSTR lpszMsg, COLORREF color, BOOL bAi)
- {
- static CRichEditCtrl& ctrl = GetRichEditCtrl();
- if(!::IsWindow(ctrl))
- return;
- CHARFORMAT cf;
- cf.cbSize = sizeof(CHARFORMAT);
- cf.yHeight = 180;
- cf.dwMask = CFM_COLOR | CFM_SIZE | CFM_FACE | CFM_BOLD;
- cf.dwEffects = (bAi)?CFE_BOLD:0;
- cf.crTextColor = color;
- strcpy(cf.szFaceName, _T("Courie New"));
- ctrl.SetSel(ctrl.GetWindowTextLength(), ctrl.GetWindowTextLength());
- ctrl.SetSelectionCharFormat(cf);
- ctrl.ReplaceSel(lpszMsg);
- /* SCROLLINFO info;
- memset(&info, 0, sizeof(SCROLLINFO));
- info.fMask = SIF_ALL;
- if(ctrl.GetScrollInfo(SB_VERT, &info))
- {
- if(info.nMax == info.nPos)
- ctrl.LineScroll(1);
- }
- */
- return;
- }
- void CROAView::OnReload()
- {
- Reload();
- }