DragonNest/Server/ServiceManagerEx/StateView.cpp

149 lines
3.9 KiB
C++
Raw Permalink Normal View History

// StateView.cpp : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
//
#include "stdafx.h"
#include "ServiceManagerEx.h"
#include "StateView.h"
#include "ItemData.h"
// CStateView
IMPLEMENT_DYNCREATE(CStateView, CView)
CStateView::CStateView()
: m_pProperty(NULL)
{
}
CStateView::~CStateView()
{
delete m_pProperty;
}
BEGIN_MESSAGE_MAP(CStateView, CView)
ON_WM_SIZE()
END_MESSAGE_MAP()
// CStateView <20>׸<EFBFBD><D7B8><EFBFBD><EFBFBD>Դϴ<D4B4>.
void CStateView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: <20><><EFBFBD><20>׸<EFBFBD><D7B8><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
UNUSED_ALWAYS(pDoc);
}
void CStateView::OnInitialUpdate()
{
CView::OnInitialUpdate();
// TODO: <20><><EFBFBD>⿡ Ư<><C6AF>ȭ<EFBFBD><C8AD> <20>ڵ带 <20>߰<EFBFBD> <20><>/<2F>Ǵ<EFBFBD> <20>⺻ Ŭ<><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȣ<><C8A3><EFBFBD>մϴ<D5B4>.
CRect rect;
GetClientRect(&rect);
m_pProperty = new CPropertyGrid();
m_pProperty->Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, rect, this, IDC_PROPERTYGRID_STATE);
const ViewConfig* pViewConfig = ((CServiceManagerExApp*)::AfxGetApp())->GetConfigEx().GetViewConfig(L"State");
if (pViewConfig)
{
m_pProperty->SetTitleColor(RGB(0, 0, 0));
m_pProperty->SetBackColor(pViewConfig->GetBgColor());
m_pProperty->SetTextColor(pViewConfig->GetDefaultFontColor());
m_pProperty->SetDisabledColor(pViewConfig->GetDefaultFontColor());
}
else
{
m_pProperty->SetTitleColor(RGB(0, 0, 0));
m_pProperty->SetBackColor(RGB(0, 0, 0));
m_pProperty->SetTextColor(RGB(192, 192, 192));
m_pProperty->SetDisabledColor(RGB(192, 192, 192));
}
}
// CStateView <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
#ifdef _DEBUG
void CStateView::AssertValid() const
{
CView::AssertValid();
}
#ifndef _WIN32_WCE
void CStateView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif
#endif //_DEBUG
void CStateView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: <20><><EFBFBD><20>޽<EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
if (m_pProperty)
m_pProperty->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOMOVE);
}
void CStateView::RefreshView()
{
if (!m_pProperty)
return;
// clear
m_pProperty->ResetContents();
m_propertyItems.clear();
m_propertyItems.resize(CStateView::Max, 0);
// build property grid
HSECTION section = m_pProperty->AddSection(L"Basic Information");
m_propertyItems[CStateView::Type] = m_pProperty->AddStringItem(section, L"Type", L"", false);
m_propertyItems[CStateView::Name] = m_pProperty->AddStringItem(section, L"Name", L"", false);
m_propertyItems[CStateView::Id] = m_pProperty->AddStringItem(section, L"ID", L"", false);
m_propertyItems[CStateView::World] = m_pProperty->AddStringItem(section, L"World ID(s)", L"", false);
section = m_pProperty->AddSection(L"State Information");
m_propertyItems[CStateView::State] = m_pProperty->AddStringItem(section, L"State", L"", false);
m_propertyItems[CStateView::Version] = m_pProperty->AddStringItem(section, L"Version", L"", false);
m_propertyItems[CStateView::Final] = m_pProperty->AddStringItem(section, L"Final", L"", false);
}
void CStateView::OnSelectedServerItem(const ItemData* pData)
{
if (!pData || !m_pProperty)
{
ASSERT(0);
return;
}
CString strId;
strId.Format(L"%d", pData->id);
m_pProperty->SetItemValue(m_propertyItems[CStateView::Type], ItemData::TypeToString(pData->type));
m_pProperty->SetItemValue(m_propertyItems[CStateView::Name], pData->name.c_str());
m_pProperty->SetItemValue(m_propertyItems[CStateView::Id], strId.GetBuffer());
m_pProperty->SetItemValue(m_propertyItems[CStateView::World], pData->world.c_str());
m_pProperty->SetItemValue(m_propertyItems[CStateView::State], ItemData::StateToString(pData->state));
m_pProperty->SetItemValue(m_propertyItems[CStateView::Version], pData->version.c_str());
m_pProperty->SetItemValue(m_propertyItems[CStateView::Final], ItemData::FinalToString(pData->final));
// Ư<><C6AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̰<EFBFBD>.
if (pData->type == ItemData::Server)
{
if (pData->name.compare(L"Master") == 0)
{
}
else if (pData->name.compare(L"DB") == 0)
{
}
else if (pData->name.compare(L"Village") == 0)
{
}
}
}
;