Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
156 lines
3.6 KiB
C++
156 lines
3.6 KiB
C++
// DlgTriggerProperty.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "worldcreator.h"
|
|
#include "DlgTriggerProperty.h"
|
|
#include <BaseDataDefine.h>
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
|
|
const char * strEventMusicPlay = "Play Music";
|
|
const char * strEventMusicPlayOnce = "Play Music Once";
|
|
const char * strEventShowMessage = "Show Message";
|
|
const char * strEventShowEffect = "Show Effect";
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDlgTriggerProperty dialog
|
|
|
|
|
|
CDlgTriggerProperty::CDlgTriggerProperty(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDlgTriggerProperty::IDD, pParent)
|
|
, m_iCurSel( 0 )
|
|
, m_iEventType( -1 )
|
|
{
|
|
//{{AFX_DATA_INIT(CDlgTriggerProperty)
|
|
m_strEventArg = _T("");
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CDlgTriggerProperty::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDlgTriggerProperty)
|
|
DDX_Control(pDX, IDC_COMBO_EVENTTYPE, m_EventType);
|
|
DDX_Text(pDX, IDC_EDIT_EVENTARG, m_strEventArg);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
int CDlgTriggerProperty::EventType()
|
|
{
|
|
int curSel = m_EventType.GetCurSel();
|
|
|
|
if( curSel == CB_ERR )
|
|
return -1;
|
|
|
|
CString str;
|
|
m_EventType.GetLBText( curSel, str );
|
|
|
|
if( str == strEventMusicPlay )
|
|
{
|
|
return 0;
|
|
}
|
|
else if( str == strEventShowMessage )
|
|
{
|
|
return 1;
|
|
}
|
|
else if( str == strEventMusicPlayOnce )
|
|
{
|
|
return 2;
|
|
}
|
|
else if( str == strEventShowEffect )
|
|
{
|
|
return 3;
|
|
}
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
void CDlgTriggerProperty::SetEventType( int eventType )
|
|
{
|
|
m_iCurSel = eventType;
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CDlgTriggerProperty, CDialog)
|
|
//{{AFX_MSG_MAP(CDlgTriggerProperty)
|
|
ON_BN_CLICKED(IDC_BUTTON_BROWSE, OnButtonBrowse)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDlgTriggerProperty message handlers
|
|
|
|
void CDlgTriggerProperty::ConfirmSoundDirectory( CString & strFilename, CString & strFilenameSrc )
|
|
{
|
|
char szPathName[256], szSoundFilePath[256];
|
|
strcpy( szPathName, strFilenameSrc );
|
|
strlwr( szPathName );
|
|
strcpy( szSoundFilePath, SOUNDFILEPATH );
|
|
strlwr( szSoundFilePath );
|
|
|
|
char * pFinded = strstr( szPathName, szSoundFilePath );
|
|
|
|
if( pFinded == NULL )
|
|
{
|
|
char szMsg[256];
|
|
sprintf( szMsg, "사운드 화일은 %s의 하위 디렉토리에 있어야만 합니다.", szSoundFilePath );
|
|
MessageBox( szMsg );
|
|
}
|
|
else
|
|
{
|
|
pFinded += strlen( szSoundFilePath );
|
|
strFilename = pFinded;
|
|
}
|
|
}
|
|
|
|
void CDlgTriggerProperty::OnButtonBrowse()
|
|
{
|
|
const char * filter = "All Files (*.*)|*.*|Effect Script Files (*.esf)|*.esf|Wave Files (*.wav)|*.wav|OGG Files (*.ogg)|*.ogg||";
|
|
|
|
CFileDialog FileDlg( TRUE, "*.*", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter, this );
|
|
|
|
FileDlg.m_ofn.lpstrInitialDir = SOUNDFILEPATH;
|
|
|
|
if( FileDlg.DoModal() == IDOK )
|
|
{
|
|
CString ext = FileDlg.GetFileExt();
|
|
ext.MakeLower();
|
|
if( ext == "wav" || ext == "ogg" )
|
|
ConfirmSoundDirectory( m_strEventArg, FileDlg.GetPathName() );
|
|
else
|
|
m_strEventArg = FileDlg.GetFileName();
|
|
|
|
UpdateData( FALSE );
|
|
}
|
|
}
|
|
|
|
BOOL CDlgTriggerProperty::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
m_EventType.AddString( strEventMusicPlay );
|
|
m_EventType.AddString( strEventShowMessage );
|
|
m_EventType.AddString( strEventMusicPlayOnce );
|
|
m_EventType.AddString( strEventShowEffect );
|
|
|
|
m_EventType.SetCurSel( m_iCurSel );
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CDlgTriggerProperty::OnOK()
|
|
{
|
|
m_iEventType = EventType();
|
|
|
|
CDialog::OnOK();
|
|
}
|