Files
2026-06-01 12:46:52 +02:00

2012 lines
59 KiB
C++

#include "stdafx.h"
#include "KUIDragAndDrop.h"
#include "KUIControlStatic.h"
#include "KUIWndManager.h"
#include "KUIControlButton.h"
#include "KUIControlClockBox.h"
#include "KUIControlQuickEffect.h"
#include "SUIQuickSlotWnd.h"
#include "SGameManager.h"
#include "SGameMessage.h"
//#include "SGameMessageUI.h"
#include "SGameWorldKeymapping.h"
#include "SGameOption.h"
#include "SSummonSlotMgr.h"
#include "SInventoryMgr.h"
#include "SStringDB.h"
#include "SSkillDB.h"
#include "SItemDB.h"
#include "SUIDisplayInfo.h"
#include "SSkillSlot.h"
#include "UIHelper.h"
// 2010.07.20 - prodongi
//#include "SUIUtil.h"
#include "SGameSystem.h"
extern SGameSystem * g_pCurrentGameSystem;
namespace
{
const char* c_szIconSlotName = "icon_slot";
const char* c_szIconEffecttName = "icon_effect";
const char* c_szClockSlotName = "clock_slot";
const char* c_szStaticSlotCount = "static_slotcount"; //아이템 중첩 갯수
const char* c_szStaticText = "static_text"; //단축키
// 2010.04.20 정리 - prodongi
//const char* c_szTooltipSprName = c_szDEF_SPR_NAME;
// 2010.04.20 정리 - prodongi
/*
const int c_nCreatureDelta = 60;
const int c_nCreatureHeight = 484;
*/
const float c_HighlightKeymapString = 1.0f;
const float c_DefaultKeymapString = 0.3f;
// 2010.04.20 정리 - prodongi
/*
const int c_nDifferenceHeight = 50;
int c_nOriginalPosY;
*/
};
SUIQuickSlotWnd::SUIQuickSlotWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUIWnd( pGameManager ), m_pDisplayInfo( pDisplayInfo ), m_nDragIndex(-1), m_curLayer(DEFAULT_LAYER),
m_mouseX(0), m_mouseY(0)
{
m_pSlotControlIDs = new SLOT_INFO[ SUIDisplayInfo::c_nQuickSlotCount ];
for( int n( 0 ); n < SUIDisplayInfo::c_nQuickSlotCount; ++n )
{
std::string strNum = CStringUtil::StringFormat( "%02d", n );
m_pSlotControlIDs[ n ].strIconControl = c_szIconSlotName + strNum;
m_pSlotControlIDs[ n ].strClockControl = c_szClockSlotName + strNum;
m_pSlotControlIDs[ n ].strStaticCountControl = c_szStaticSlotCount + strNum;
m_pSlotControlIDs[ n ].strIconEffectControl = c_szIconEffecttName + strNum;
m_pSlotControlIDs[ n ].strStaticText = c_szStaticText + strNum;
}
// 2010.04.20 정리 - prodongi
/*
m_nQuickSlotState = QUICKSLOTSTATE_ALL;
m_nQuickSlotOrder = QUICKSLOTORDER_A;
c_nOriginalPosY = -1;
*/
for (int i = 0; i < TOTAL_LAYER; ++i)
{
// 2010.05.18 - prodongi
sLayerAlphaInfo* info = m_layerAlphaInfo + i;
info->m_alphaLevel = 0;
info->m_alpha = levelToAlpha(info->m_alphaLevel);
//m_layerAlphaLevel[i] = 0;
//m_layerAlpha[i] = levelToAlpha(m_layerAlphaLevel[i]);
}
loadIni();
}
SUIQuickSlotWnd::~SUIQuickSlotWnd()
{
saveIni();
delete [] m_pSlotControlIDs;
// 2011.05.17 - servantes
GetGameOption().SetQuickHozX( GetRect().left );
GetGameOption().SetQuickHozY( GetRect().top );
}
bool SUIQuickSlotWnd::InitControls( KPoint kPos )
{
// SetChildShow( c_szCheckButtonDefault, true );
for( int nSlot( 0 ); nSlot < SUIDisplayInfo::c_nQuickSlotCount; ++nSlot )
{
KUIControlMultiIcon* pIconSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( m_pSlotControlIDs[ nSlot ].strIconControl.c_str() ));
if( NULL != pIconSlotControl )
{
// 아이템 multi icon 레이어 설정, 툴팁 스프라이트 설정
pIconSlotControl->SetIconLayer( 8 );
// clock 컨트롤 생성
KUIWND_CREATE_ARG ClockCreateArg( "clockbox", m_pSlotControlIDs[ nSlot ].strClockControl.c_str(), "", pIconSlotControl->GetRect(), 0, KFLAG_NO_GET_MESSAGE, this, "", c_szDEF_SPR_NAME, m_pManager );
KUIControlClockBox* pClockControl = (KUIControlClockBox*)m_pManager->CreateControl( ClockCreateArg );
pClockControl->SetColor( c_ColorClockControl );
}
}
for( int nSlot( 0 ); nSlot < SUIDisplayInfo::c_nQuickSlotCount; ++nSlot )
{
KUIControlMultiIcon* pIconSlotControl = dynamicCast<KUIControlMultiIcon*>(GetChild( m_pSlotControlIDs[ nSlot ].strIconControl.c_str() ));
if(pIconSlotControl)
{
KRect rt( pIconSlotControl->GetRect() );
//SetMovePos( CStringUtil::StringFormat( "icon_effect%02d", nSlot ).c_str(), rt.left-27, rt.top-27 );
//SetChildAsTop( CStringUtil::StringFormat( "icon_effect%02d", nSlot ).c_str() );
SetMovePos( m_pSlotControlIDs[nSlot].strIconEffectControl.c_str(), rt.left-27, rt.top-27 );
SetChildAsTop( m_pSlotControlIDs[nSlot].strIconEffectControl.c_str() );
}
//일단 키맵핑표시 text는 반투명으로..
SetChildAlpha(m_pSlotControlIDs[ nSlot ].strStaticText.c_str(),c_DefaultKeymapString);
}
m_vSkillStatus.clear();
return SUIWnd::InitControls( kPos );
}
bool SUIQuickSlotWnd::InitData( bool bReload )
{
// 2010.04.20 정리 - prodongi
//m_nCreatureQuick = 0;
m_bDraging = false;
// prodongi
// RefreshQuickSlots();
// SetQuickSlotState(QUICKSLOTSTATE_ALL, QUICKSLOTORDER_A);
initLayer();
return SUIWnd::InitData(bReload);
}
void SUIQuickSlotWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
SUIWnd::OnNotifyUIWindowOpen(bOpen);
if(bOpen == false) // 2011.05.17 - servantes
{
GetGameOption().SetQuickHozX( GetRect().left );
GetGameOption().SetQuickHozY( GetRect().top );
}
}
void* SUIQuickSlotWnd::Perform( KID id, KArg& msg )
{
_CID( UI_BEGIN_DRAG );
_CID( UI_SEND_DROP );
_CID( UI_RECV_DROP );
if ( id == id_UI_BEGIN_DRAG )
{
KUIBeginDragMessage* pBeginMsg = static_cast<KUIBeginDragMessage*>( &msg );
const char* szControlID = pBeginMsg->sDragControlID.c_str();
int nSlotIndex = GetSlotIndex( szControlID );
m_nDragIndex = nSlotIndex;
if( 0 <= nSlotIndex && nSlotIndex < SUIDisplayInfo::c_nQuickSlotCount )
{
// 비어있지 않은 슬롯만
//bool bDefault( IsDefaultSlot(szControlID) );
//QUICKSLOT_BTNSTATE ButtonState(QUICKSLOT_DEFAULT);
//if( !bDefault ) ButtonState = m_SelectedButtonState;
if( !m_pDisplayInfo->IsEmptyQuickSlot( nSlotIndex ) )
{
KUIControlMultiIcon* pWndMultiIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( szControlID ));
if( NULL != pWndMultiIcon )
{
const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0);
m_pDisplayInfo->SetUIDragInfo( new SUIQuickSlotDragInfo( nSlotIndex ) );
m_pDragAndDropIcon->SetStateIcon( pWndMultiIcon->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL );
pBeginMsg->pDragAndDropRenderer = m_pDragAndDropIcon;
}
}
}
return NULL;
}
else if ( id == id_UI_SEND_DROP )
{
KUISendRecvDropMessage* pSendMsg = static_cast<KUISendRecvDropMessage*>( &msg );
SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
if( NULL != pUIDragInfo && SUIDragInfo::DRAGTYPE_QUICKSLOT == pUIDragInfo->m_type )
{
m_nDragIndex = -1;
SUIQuickSlotDragInfo* pQuickSlotDragInfo = (SUIQuickSlotDragInfo*)pUIDragInfo;
// 동일한 창이 아닌 곳에 드롭했다면 슬롯을 비운다.
if( pSendMsg->sRecvDropParentID != std::string(GetID()) )
{
// 슬롯을 비운다.
int nSlotIndex = pQuickSlotDragInfo->m_nSlotIndex;
m_pDisplayInfo->SetQuickSlot( nSlotIndex );
m_pDisplayInfo->SaveQuickSlots();
// Drag & Drop 정보 제거
m_pDisplayInfo->SetUIDragInfo();
RefreshQuickEffect( nSlotIndex );
/* // 삭제됨-- D&D에서 버튼 release후에 메시지가 안 남으므로 비 실용적...
} else if (m_pDisplayInfo->GetBackupedQuickSlot()!=NULL) { // 같은 창 + 다른 슬롯을 덮어씌웠음
// 새로운 D&D info 추가
const char* szControlID = GetID();
KUIControlMultiIcon* pWndMultiIcon = (KUIControlMultiIcon*)GetChild( szControlID );
if( NULL != pWndMultiIcon )
{
const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0);
m_pDisplayInfo->SetUIDragInfo( new SUIQuickSlotDragInfo( pQuickSlotDragInfo->m_ButtonState, -1 ) );
m_pDragAndDropIcon->SetStateIcon( pWndMultiIcon->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL );
}
*/
}
else
{
m_pDisplayInfo->SetUIDragInfo();
}
}
return NULL;
}
else if ( id == id_UI_RECV_DROP )
{
KUISendRecvDropMessage* pRecvMsg = static_cast<KUISendRecvDropMessage*>( &msg );
m_bDraging = false;
int nDropIndex = GetSlotIndex( pRecvMsg->sRecvDropControlID.c_str() );
//bool bDefault( IsDefaultSlot(pRecvMsg->sRecvDropControlID.c_str()) ); //디폴트 슬롯에 드롭했는가?
//QUICKSLOT_BTNSTATE ButtonState(QUICKSLOT_DEFAULT);
//if( !bDefault ) ButtonState = m_SelectedButtonState;
if( 0 <= nDropIndex && nDropIndex < SUIDisplayInfo::c_nQuickSlotCount )
{
const SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo();
if( NULL != pUIDragInfo )
{
// 퀵슬롯에서 드래그 한 경우
if( SUIDragInfo::DRAGTYPE_QUICKSLOT == pUIDragInfo->m_type )
{
const SUIQuickSlotDragInfo* pQuickSlotDragInfo = (SUIQuickSlotDragInfo*)pUIDragInfo;
// 다른 슬롯에 드롭한 경우
//if( ButtonState != pQuickSlotDragInfo->m_ButtonState || nDropIndex != pQuickSlotDragInfo->m_nSlotIndex )
//문제 있음 주의바람
if( nDropIndex != pQuickSlotDragInfo->m_nSlotIndex )
// if( m_CurrentButtonState != pQuickSlotDragInfo->m_ButtonState || nDropIndex != pQuickSlotDragInfo->m_nSlotIndex )
{
//토글상태를 옮기기 위한것..
//nDropIndex 새로 갈놈..
//m_nSlotIndex 원래 자리...
KUIControlQuickEffect *pSlotEffect1 = dynamicCast<KUIControlQuickEffect*>(GetChild( m_pSlotControlIDs[ nDropIndex ].strIconEffectControl.c_str() ));
KUIControlQuickEffect *pSlotEffect2 = dynamicCast<KUIControlQuickEffect*>(GetChild( m_pSlotControlIDs[ pQuickSlotDragInfo->m_nSlotIndex ].strIconEffectControl.c_str() ));
bool t1,t2;
if(pSlotEffect1 && pSlotEffect2)
{
t1 = pSlotEffect1->IsToggleOn();
t2 = pSlotEffect2->IsToggleOn();
}
// 새 슬롯에 옮기고 기존 슬롯은 제거한다.
m_pDisplayInfo->SetQuickSlot( nDropIndex, pQuickSlotDragInfo );
m_pDisplayInfo->SaveQuickSlots();
if(pSlotEffect1 && pSlotEffect2 && !( t1 && t2) )
{
pSlotEffect1->ToggleOn(t2);
pSlotEffect2->ToggleOn(t1);
}
RefreshQuickEffect( nDropIndex );
RefreshQuickEffect( pQuickSlotDragInfo->m_nSlotIndex );
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound() );
}
}
else
{
// 퀵 슬롯 설정
m_pDisplayInfo->SetQuickSlot( nDropIndex, pUIDragInfo );
m_pDisplayInfo->SaveQuickSlots();
RefreshQuickEffect( nDropIndex );
m_pGameManager->StartSound( m_pDisplayInfo->GetDragMaterialSound(), 50 );
}
}
}
return NULL;
}
return SUIWnd::Perform( id, msg );
}
void SUIQuickSlotWnd::ToggleSkillByUser(int nSlot)
{
if( m_nDragIndex != nSlot && !m_bDraging && 0 <= nSlot && nSlot < SUIDisplayInfo::c_nQuickSlotCount )
{
const SUIQuickSlotInfo * pSlotInfo = m_pDisplayInfo->GetQuickSlot( nSlot );
if(pSlotInfo)
{
if(pSlotInfo->m_type == SUIQuickSlotInfo::QSLOTTYPE_SKILL)
{
const SUIQuickSlotSkillInfo * pSkillInfo = (const SUIQuickSlotSkillInfo *)pSlotInfo;
if(pSkillInfo->m_bPlayer)//일단 크리쳐 스킬만..
return;
int nStatus = GetSkillStatus( pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID );
if( nStatus == STATE_TOGGLE_ON || nStatus == STATE_TOGGLE_OFF )
return;
if( !m_CreatureSlotMgr.IsExistSummonedCreature( pSkillInfo->m_hTarget ) ) // 소환되지 않은 크리쳐면 실행안되게..
return;
SkillBaseEx * pSkillBase = GetSkillDB().GetSkillData( pSkillInfo->m_nSkillID );
if( pSkillBase == NULL )
return;
if( pSkillBase->IsToggle() )
return;
if( pSkillBase->IsHarmful() == false )
return;
if( pSkillBase->IsPassive() )
return;
if( !IsToggleOnByUserSkillStatus( pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID ) )
{
// UpdateSkillStatus(pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID, STATE_TOGGLE_ON_BY_USER);
UpdateSkillToggle(pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID, STATE_TOGGLE_ON_BY_USER);
UpdateEffect(pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID, STATE_TOGGLE_ON_BY_USER);
}
else
{
// UpdateSkillStatus(pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID, STATE_TOGGLE_OFF_BY_USER );
UpdateSkillToggle(pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID, STATE_TOGGLE_OFF_BY_USER);
UpdateEffect(pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID, STATE_TOGGLE_OFF_BY_USER);
}
}
}
}
}
void SUIQuickSlotWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
/* prodongi
if( 0 == ::_stricmp( "button_quickslot_up", lpszControlID ) )
SetQuickSlotState(QUICKSLOTSTATE_ALL, m_nQuickSlotOrder);
else if( 0 == ::_stricmp( "button_quickslot_down", lpszControlID ) )
SetQuickSlotState(QUICKSLOTSTATE_SINGLE, m_nQuickSlotOrder);
else if( 0 == ::_stricmp( "button_quickslot_change", lpszControlID ) )
SetQuickSlotState( m_nQuickSlotState, m_nQuickSlotOrder == QUICKSLOTORDER_A ? QUICKSLOTORDER_B : QUICKSLOTORDER_A);
*/
if (0 == _stricmp("button_quickslot_up", lpszControlID) || 0 == _stricmp("button_quickslot_down", lpszControlID))
modifyLayer();
}
break;
case KUI_MESSAGE::KICON_CLICK:
{
// m_pGameManager->StartSound( "ui_button_click.wav" );
int nSlotIndex = GetSlotIndex( lpszControlID );
if( m_nDragIndex != nSlotIndex && !m_bDraging && 0 <= nSlotIndex && nSlotIndex < SUIDisplayInfo::c_nQuickSlotCount )
{
//if( IsDefaultSlot(lpszControlID) )
// m_pDisplayInfo->UseQuickSlot( QUICKSLOT_DEFAULT, nSlotIndex );
//else m_pDisplayInfo->UseQuickSlot( m_SelectedButtonState, nSlotIndex );
m_pDisplayInfo->UseQuickSlot( nSlotIndex );
}
}
break;
case KUI_MESSAGE::KICON_RCLICK:
{
int nSlotIndex = GetSlotIndex( lpszControlID );
ToggleSkillByUser(nSlotIndex);
}
break;
case KUI_MESSAGE::KCHECK_CHANGE:
{
/*if( 0 == ::_stricmp( c_szCheckButtonAlt , lpszControlID ) ) m_SelectedButtonState = QUICKSLOT_ALT;
else if( 0 == ::_stricmp( c_szCheckButtonShift , lpszControlID ) ) m_SelectedButtonState = QUICKSLOT_SHIFT;
else if( 0 == ::_stricmp( c_szCheckButtonControl, lpszControlID ) ) m_SelectedButtonState = QUICKSLOT_CONTROL;
ChangeButtonState(m_SelectedButtonState);*/
// PostButtonSelectChangeMsg();
if (strstr(lpszControlID, "slider_titamium_quickslot_transparent"))
{
setLayerAlpha(lpszControlID, true);
//setLayerAlpha(lpszControlID, true, m_isMouseFocusOn ? false : true);
}
}
break;
case KUI_MESSAGE::KGENWND_MOVE:
{
LimitMoveWnd();
//if( ::_stricmp( lpszControlID, "quickslot_v" ) == 0 )
//{
// GetGameOption().SetQuickVerX( GetRect().left );
// GetGameOption().SetQuickVerY( GetRect().top );
//}
//else
// 2011.05.17 - servantes 움직일 때마다 계속저장 느리다. 열고 닫고 소멸자에서 저장
// if( ::_stricmp( lpszControlID, "quickslot_h" ) == 0 )
// {
// GetGameOption().SetQuickHozX( GetRect().left );
// GetGameOption().SetQuickHozY( GetRect().top );
// }
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIQuickSlotWnd::UpdateToggleEffect(AR_HANDLE caster, int nSkillID, int bToggle )
{
UpdateSkillToggle( caster, nSkillID, ((bToggle==1) ? STATE_TOGGLE_ON : STATE_TOGGLE_OFF) );
for( int nSlot( 0 ); nSlot < SUIDisplayInfo::c_nQuickSlotCount; ++nSlot )
{
const SUIQuickSlotInfo* pSlot = m_pDisplayInfo->GetQuickSlot( nSlot );
if(pSlot)
{
if(pSlot->m_type == SUIQuickSlotInfo::QSLOTTYPE_SKILL)
{
const SUIQuickSlotSkillInfo * pSkillInfo = (const SUIQuickSlotSkillInfo *)pSlot;
if(pSkillInfo->m_hTarget == caster && pSkillInfo->m_nSkillID == nSkillID)
{
/*UpdateSkillToggle( caster, nSkillID, ((bToggle==1) ? STATE_TOGGLE_ON : STATE_TOGGLE_OFF) );
//KUIControlQuickEffect * pSlotEffect = (KUIControlQuickEffect*)GetChild( CStringUtil::StringFormat( "icon_effect%02d", nSlot ).c_str() );*/
KUIControlQuickEffect * pSlotEffect = dynamicCast<KUIControlQuickEffect*>(GetChild( m_pSlotControlIDs[ nSlot ].strIconEffectControl.c_str() ));
if( pSlotEffect )
pSlotEffect->ToggleOn( bToggle );
}
}
}
}
}
const int SUIQuickSlotWnd::GetSkillStatusNumber( AR_HANDLE caster, int nSkillID )
{
for( unsigned int i(0); m_vSkillStatus.size()>i; ++i )
{
if( m_vSkillStatus[i].nSkillID == nSkillID && m_vSkillStatus[i].caster == caster)
return i;
}
return -1;
}
const int SUIQuickSlotWnd::GetSkillStatus( AR_HANDLE caster, int nSkillID )
{
for( unsigned int i(0); m_vSkillStatus.size()>i; ++i )
{
if( m_vSkillStatus[i].nSkillID == nSkillID && m_vSkillStatus[i].caster == caster)
return m_vSkillStatus[i].GetStatus();
}
//한번도 쓰지 않은 스킬들
return STATE_NONE;
}
const bool SUIQuickSlotWnd::IsToggleOnByUserSkillStatus( AR_HANDLE caster, int nSkillID )
{
for( unsigned int i(0); m_vSkillStatus.size()>i; ++i )
{
if( m_vSkillStatus[i].nSkillID == nSkillID && m_vSkillStatus[i].caster == caster)
return m_vSkillStatus[i].bToggleByUser;
}
//한번도 쓰지 않은 스킬들
return false;
}
void SUIQuickSlotWnd::UpdateSkillToggle( AR_HANDLE caster, int nSkillID, int nStatus )
{
for( unsigned int i(0); m_vSkillStatus.size()>i; ++i )
{
if( m_vSkillStatus[i].nSkillID == nSkillID && m_vSkillStatus[i].caster == caster)
{
m_vSkillStatus[i].SetStatus(nStatus);
return;
}
}
_SKILL_STATUS skill_status;
skill_status.Init();
skill_status.nSkillID = nSkillID;
skill_status.SetStatus(nStatus);
skill_status.caster = caster;
m_vSkillStatus.push_back( skill_status );
}
void SUIQuickSlotWnd::UpdateSkillStatus(AR_HANDLE caster, int nSkillID, int nStatus )
{
for( unsigned int i(0); m_vSkillStatus.size()>i; ++i )
{
if( m_vSkillStatus[i].nSkillID == nSkillID && m_vSkillStatus[i].caster == caster)
{
if( nStatus == TS_SC_SKILL::FIRE )
{
if( m_vSkillStatus[i].GetStatus() != STATE_TOGGLE_ON
&& m_vSkillStatus[i].GetStatus() != STATE_TOGGLE_ON_BY_USER )
m_vSkillStatus[i].SetStatus(STATE_FIRE);
}
else if( nStatus == TS_SC_SKILL::CASTING )
{
if( m_vSkillStatus[i].GetStatus() != STATE_TOGGLE_ON
&& m_vSkillStatus[i].GetStatus() != STATE_TOGGLE_ON_BY_USER )
m_vSkillStatus[i].SetStatus(STATE_CASTING);
}
else if( nStatus == TS_SC_SKILL::CANCEL )
{
if( m_vSkillStatus[i].GetStatus() != STATE_TOGGLE_ON
&& m_vSkillStatus[i].GetStatus() != STATE_TOGGLE_ON_BY_USER )
m_vSkillStatus[i].SetStatus(STATE_CANCEL);
}
return;
}
}
_SKILL_STATUS skill_status;
skill_status.Init();
skill_status.nSkillID = nSkillID;
skill_status.caster = caster;
if( nStatus == TS_SC_SKILL::FIRE ) skill_status.SetStatus(STATE_FIRE);
else if( nStatus == TS_SC_SKILL::CASTING ) skill_status.SetStatus(STATE_CASTING);
else if( nStatus == TS_SC_SKILL::CANCEL ) skill_status.SetStatus(STATE_CANCEL);
m_vSkillStatus.push_back( skill_status );
}
void SUIQuickSlotWnd::UpdateEffect( AR_HANDLE caster, int nSkillID, int nSkillStatus )
{
// Let's make it again (?)
for( int nSlot( 0 ); nSlot < SUIDisplayInfo::c_nQuickSlotCount; ++nSlot )
{
const SUIQuickSlotInfo* pSlot = m_pDisplayInfo->GetQuickSlot( nSlot );
if(pSlot)
{
if(pSlot->m_type == SUIQuickSlotInfo::QSLOTTYPE_SKILL)
{
const SUIQuickSlotSkillInfo * pSkillInfo = (const SUIQuickSlotSkillInfo *)pSlot;
if(pSkillInfo->m_hTarget == caster)
RefreshQuickEffect(nSlot);
}
}
}
}
void SUIQuickSlotWnd::Process(DWORD dwTime)
{
SUIWnd::Process( dwTime );
bool inWindow = isInWindow();
checkMouseFocusOn(inWindow);
updateLayerAlphaAni(dwTime - m_dwTime);
updateTextHightlight(inWindow);
m_dwTime = dwTime;
static DWORD s_dwDelay = 0;
static int nPrevSlot = 0;
if( (m_dwTime - s_dwDelay) > 3000) // AziaMafia FixSkill = if( (m_dwTime - s_dwDelay) > 3000 )
{
s_dwDelay = m_dwTime;
for( int i(0); i < SUIDisplayInfo::c_nQuickSlotCount; ++i )
{
int nSlot = nPrevSlot+i;
if(nSlot>=SUIDisplayInfo::c_nQuickSlotCount)
nSlot -= SUIDisplayInfo::c_nQuickSlotCount;
const SUIQuickSlotInfo* pSlot = m_pDisplayInfo->GetQuickSlot( nSlot );
if(pSlot)
{
if(pSlot->m_type == SUIQuickSlotInfo::QSLOTTYPE_SKILL)
{
const SUIQuickSlotSkillInfo * pSkillInfo = (const SUIQuickSlotSkillInfo *)pSlot;
if( !pSkillInfo->m_bPlayer)
{
if( m_pDisplayInfo->IsCreatureBattleMode( pSkillInfo->m_hTarget )
&& m_CreatureSkillSlotMgr.IsUseSkill(pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID) == false
&& std::find( m_vecCreatureCastingStatus.begin(), m_vecCreatureCastingStatus.end(), pSkillInfo->m_hTarget ) == m_vecCreatureCastingStatus.end() )
{
if(IsToggleOnByUserSkillStatus(pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID))
{
if(m_pDisplayInfo->UseSkillByToggle(pSkillInfo->m_nSkillID, pSkillInfo->m_nSkillLevel, pSkillInfo->m_bPlayer, pSkillInfo->m_hTarget ))
{
nPrevSlot = nSlot+1;
if( nPrevSlot >= SUIDisplayInfo::c_nQuickSlotCount )
nPrevSlot -= SUIDisplayInfo::c_nQuickSlotCount;
//s_dwDelay = m_dwTime;
break;
}
else
{
_oprint("Some shit happened\n");
}
}
}
}
}
}
}
}
}
void SUIQuickSlotWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case MSG_EQUIP_SUMMON:
{
bool bSave = false;
for( int nSlot(0); nSlot < SUIDisplayInfo::c_nQuickSlotCount; ++nSlot )
{
const SUIQuickSlotInfo* pSlot = m_pDisplayInfo->GetQuickSlot( nSlot );
if(pSlot)
{
if(pSlot->m_type == SUIQuickSlotInfo::QSLOTTYPE_SKILL)
{
const SUIQuickSlotSkillInfo * pSkillInfo = (const SUIQuickSlotSkillInfo *)pSlot;
if(!pSkillInfo->m_bPlayer)
{
if( m_CreatureSlotMgr.GetEquipedCardIndexByCreature( pSkillInfo->m_hTarget ) < 0)
{
m_pDisplayInfo->SetQuickSlot( nSlot, NULL, 0);
bSave = true;
}
}
}
}
}
RefreshQuickSlots();
if(bSave)
m_pDisplayInfo->SaveQuickSlots();
}
break;
case MSG_AURA:
{
SMSG_AURA* pAuraMsg = (SMSG_AURA*)pMsg;
UpdateToggleEffect(pAuraMsg->caster, pAuraMsg->skill_id, pAuraMsg->status );
}
break;
case MSG_SKILL_EVENT:
{
SMSG_SKILL_EVENT* pSkillEvent = (SMSG_SKILL_EVENT*)pMsg;
bool bEndCasting = false;
switch( pSkillEvent->status_type )
{
case TS_SC_SKILL::FIRE:
{
std::vector<int> vecSkillList;
//_oprint("[Skill event] FIRE\n");
if( pSkillEvent->data_owner == SMSG_SKILL_EVENT::OWNER_LOCAL_PLAYER )
m_SkillSlotMgr.GetIdenticalCoolTimeGroup( pSkillEvent->skill_id, vecSkillList );
else if( pSkillEvent->data_owner == SMSG_SKILL_EVENT::OWNER_LOCAL_CREATURE )
vecSkillList.push_back( pSkillEvent->skill_id );
//m_CreatureSkillSlotMgr.GetQuickslotID( pSkillEvent->caster, pSkillEvent->skill_id, vecSkillList );
for( int i(0); i<vecSkillList.size(); ++i )
{
UpdateSkillStatus( pSkillEvent->caster, vecSkillList[i], TS_SC_SKILL::FIRE );
UpdateEffect( pSkillEvent->caster, vecSkillList[i], TS_SC_SKILL::FIRE );
}
vecSkillList.clear();
bEndCasting = true;
}
break;
case TS_SC_SKILL::CASTING:
{
if( pSkillEvent->data_owner == SMSG_SKILL_EVENT::OWNER_LOCAL_PLAYER
|| pSkillEvent->data_owner == SMSG_SKILL_EVENT::OWNER_LOCAL_CREATURE )
{
if( pSkillEvent->cast.nErrorCode != 0 )
{
bEndCasting = true;
}
else
{
UpdateSkillStatus( pSkillEvent->caster, pSkillEvent->skill_id, TS_SC_SKILL::CASTING );
UpdateEffect( pSkillEvent->caster, pSkillEvent->skill_id, TS_SC_SKILL::CASTING );
bEndCasting = false;
}
}
}
break;
case TS_SC_SKILL::CANCEL:
{
if( pSkillEvent->data_owner == SMSG_SKILL_EVENT::OWNER_LOCAL_PLAYER
|| pSkillEvent->data_owner == SMSG_SKILL_EVENT::OWNER_LOCAL_CREATURE )
{
UpdateSkillStatus( pSkillEvent->caster, pSkillEvent->skill_id, TS_SC_SKILL::CANCEL );
UpdateEffect( pSkillEvent->caster, pSkillEvent->skill_id, TS_SC_SKILL::CANCEL );
bEndCasting = true;
}
}
break;
case TS_SC_SKILL::REGION_FIRE:
case TS_SC_SKILL::COMPLETE:
{
bEndCasting = true;
}
break;
}
/*if( pSkillEvent->caster != m_CreatureSlotMgr.GetActiveCreatureQuickSlot() )
break;*/
if( pSkillEvent->data_owner != SMSG_SKILL_EVENT::OWNER_LOCAL_CREATURE )
break;
_oprint("creature id - %d / skill id - %d / status %d \n",pSkillEvent->caster, pSkillEvent->skill_id, pSkillEvent->status_type);
std::vector< AR_HANDLE >::iterator result;
result = std::find( m_vecCreatureCastingStatus.begin(), m_vecCreatureCastingStatus.end(), pSkillEvent->caster);
if(bEndCasting)
{
if( result != m_vecCreatureCastingStatus.end())
m_vecCreatureCastingStatus.erase(result);
}
else
{
if( result == m_vecCreatureCastingStatus.end())
m_vecCreatureCastingStatus.push_back(pSkillEvent->caster);
}
}
break;
case IMSG_HOTKEY_EX:
{
SIMSG_HOTKEY_EX* pHotKey = dynamicCast<SIMSG_HOTKEY_EX*>(pMsg);
int nSlotIndex = -1;
for(int i=SLOT1_01;i<=SLOT8_12; i++)
{
if(GetGameKeymapping().GetHotKeyState(i) == KEYSTATE::DOWN)
{
nSlotIndex = i-SLOT1_01;
break;
}
}
if( nSlotIndex >= 0)
m_pDisplayInfo->UseQuickSlot( nSlotIndex );
// 2010.07.05 안쓰는 키 삭제 - prodongi
//if(GetGameKeymapping().GetHotKeyState(HOTKEYCODE::SLOTCHANGE) == KEYSTATE::DOWN)
//{
/*
if( 0 == ::_stricmp( "button_quickslot_up", lpszControlID ) )
SetQuickSlotState(QUICKSLOTSTATE_ALL, m_nQuickSlotOrder);
else if( 0 == ::_stricmp( "button_quickslot_down", lpszControlID ) )
SetQuickSlotState(QUICKSLOTSTATE_SINGLE, m_nQuickSlotOrder);
else if( 0 == ::_stricmp( "button_quickslot_change", lpszControlID ) )
SetQuickSlotState( m_nQuickSlotState, m_nQuickSlotOrder == QUICKSLOTORDER_A ? QUICKSLOTORDER_B : QUICKSLOTORDER_A);
*/
// change는 안함 - prodongi
// SetQuickSlotState( m_nQuickSlotState, m_nQuickSlotOrder == QUICKSLOTORDER_A ? QUICKSLOTORDER_B : QUICKSLOTORDER_A);
/*if(m_nQuickSlotState == QUICKSLOTSTATE_A)
SetQuickSlotState(QUICKSLOTSTATE_B);
else if(m_nQuickSlotState == QUICKSLOTSTATE_B)
SetQuickSlotState(QUICKSLOTSTATE_A);*/
//}
//else
if(GetGameKeymapping().GetHotKeyState(HOTKEYCODE::SLOTUPDOWN) == KEYSTATE::DOWN)
{
// prodongi
// SetQuickSlotState(m_nQuickSlotState == QUICKSLOTSTATE_ALL ? QUICKSLOTSTATE_SINGLE : QUICKSLOTSTATE_ALL, m_nQuickSlotOrder);
modifyLayer();
/*if(m_nQuickSlotState == QUICKSLOTSTATE_BOTH)
SetQuickSlotState(QUICKSLOTSTATE_A);
else
SetQuickSlotState(QUICKSLOTSTATE_BOTH);*/
}
}
break;
case MSG_SKILLCARD_INFO:
case IMSG_REFRESH_QUICKSLOT:
{
RefreshQuickSlots();
}
break;
case MSG_UNSUMMON:
{
/// 캐스팅 중인 크리쳐 정보 갱신
for( int nSlot(0); nSlot < SUIDisplayInfo::c_nQuickSlotCount; ++nSlot )
{
const SUIQuickSlotInfo* pSlot = m_pDisplayInfo->GetQuickSlot( nSlot );
if(pSlot)
{
if(pSlot->m_type == SUIQuickSlotInfo::QSLOTTYPE_SKILL)
{
const SUIQuickSlotSkillInfo * pSkillInfo = (const SUIQuickSlotSkillInfo *)pSlot;
if(!pSkillInfo->m_bPlayer)
{
if( m_CreatureSlotMgr.GetEquipedCardIndexByCreature( pSkillInfo->m_hTarget ) < 0)
{
std::vector< AR_HANDLE >::iterator result;
result = std::find( m_vecCreatureCastingStatus.begin(), m_vecCreatureCastingStatus.end(), pSkillInfo->m_hTarget);
if( result != m_vecCreatureCastingStatus.end())
m_vecCreatureCastingStatus.erase(result);
}
}
}
}
}
RefreshQuickSlots();
}
break;
case IMSG_UI_MOVE:
{
}
break;
case MSG_ADDED_SKILL_LIST:
//break;
case MSG_SKILL_LIST:
{
SMSG_SKILL_LIST* pSkill_List = (SMSG_SKILL_LIST*)pMsg;
/// 2011.07.04 - prodongi
if (pSkill_List->isRefresh())
{ //스킬 퀵 슬롯 삭제
// 2010.08.04 - prodongi
//m_pDisplayInfo->ClearSkillQuickSlots();
m_pDisplayInfo->ClearSkillQuickSlots(pSkill_List->target);
RefreshQuickSlots();
}
}
break;
case IMSG_UI_SEND_DATA:
{
SIMSG_UI_SEND_DATA* pSkill_List = (SIMSG_UI_SEND_DATA*)pMsg;
if( pSkill_List->m_strString == "skillup" )
{
for( int nSlot(0); nSlot < SUIDisplayInfo::c_nQuickSlotCount; ++nSlot )
{
SUIQuickSlotInfo* pSlot = (SUIQuickSlotInfo*)m_pDisplayInfo->GetQuickSlot( nSlot );
if(pSlot)
{
if(pSlot->m_type == SUIQuickSlotInfo::QSLOTTYPE_SKILL)
{
SUIQuickSlotSkillInfo * pSkillInfo = (SUIQuickSlotSkillInfo *)pSlot;
if(pSkillInfo->m_nSkillID != pSkill_List->m_nNumber.getAmount() || !pSkillInfo->m_bPlayer)
continue;
int nUseLevel = 1;
SSkillSlot* pCrrSkill = NULL;
if(pSkillInfo->m_bPlayer)
pCrrSkill = m_SkillSlotMgr.GetSkillSlot( pSkill_List->m_nNumber.getAmount() );
if( pCrrSkill )
nUseLevel = pCrrSkill->GetUseLevel();
m_pDisplayInfo->SetQuickSlotSkillLv( pSkill_List->m_nNumber.getAmount(), nUseLevel, true );
}
}
}
RefreshQuickSlots();
m_pDisplayInfo->SaveQuickSlots();
}
}
break;
case IMSG_SET_KEYMAPPING:
{
SIMSG_SET_KEYMAPPING* pSKMsg = (SIMSG_SET_KEYMAPPING*)pMsg;
for( int n( 0 ); n < SUIDisplayInfo::c_nQuickSlotCount; ++n )
{
std::string sz;
sz = "<vcenter><GLOW><top><right><#ffffff><size:8>";
sz += GetGameKeymapping().GetHotKeyStringInfo2(n+HOTKEYCODE::SLOT1_01);
//SetChildCaption( m_pSlotControlIDs[ n ].strStaticText.c_str(), sz.c_str());
KUIControl *wnd = dynamicCast<KUIControl *>(GetChild( m_pSlotControlIDs[ n ].strStaticText.c_str() ));
if(wnd)
{
wnd->SetCaption( sz.c_str() );
wnd->UpdateCaption();
}
}
//SetKeymapping();
}
break;
case IMSG_MOUSEMOVE:
{
SIMSG_MOUSEMOVE* pMouseMove = (SIMSG_MOUSEMOVE* )pMsg;
m_mouseX = ((int)(short)LOWORD(pMouseMove->lParam));
m_mouseY = ((int)(short)HIWORD(pMouseMove->lParam));
}
break;
}
}
/*
bool SUIQuickSlotWnd::IsDefaultSlot( const char* szControlID )
{
if( m_pSlotControlIDs == NULL ) return false;
for( int i(0); i<SUIDisplayInfo::c_nQuickSlotCtrCount; ++i )
{
if( ::_stricmp( m_pSlotControlIDs[i].strIconControl.c_str(), szControlID ) == 0 )
{
if( i>=12 ) return false;
}
}
return true;
}
*/
void SUIQuickSlotWnd::MovePos(int posx, int posy)
{
SUIWnd::MovePos(posx, posy);
// 2010.04.20 정리 - prodongi
/*
if(m_nQuickSlotState == QUICKSLOTSTATE_ALL)
c_nOriginalPosY = GetRect().top;
else
c_nOriginalPosY = GetRect().top - c_nDifferenceHeight;
*/
SetQuickSlotState();
// prodongi
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_QUICKSLOT_STATECHANGE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CHATTING, this->GetRect().top, m_nQuickSlotState, m_nQuickSlotOrder ) );
syncChattingWndPos();
// 2010.05.18 - prodongi
setWndRectAtLayer();
initLayerRect();
}
int SUIQuickSlotWnd::GetSlotIndex( const char* szControlID )
{
if( m_pSlotControlIDs == NULL ) return false;
for( int nIndex( 0 ); nIndex < SUIDisplayInfo::c_nQuickSlotCount; ++nIndex )
{
if( 0 == ::_stricmp( m_pSlotControlIDs[ nIndex ].strIconControl.c_str(), szControlID ) )
{
//if( nIndex >= 12 ) nIndex -= 12;
return nIndex;
}
}
return (-1);
}
void SUIQuickSlotWnd::ChangePosY(const char *control1, const char *control2)
{
KUIWnd *wnd1, *wnd2;
wnd1 = GetChild(control1);
wnd2 = GetChild(control2);
//wnd3 = NULL;
if(wnd1 && wnd2)
{
int y = wnd2->GetRect().top;
wnd2->MovePos(wnd2->GetRect().left,wnd1->GetRect().top);
wnd1->MovePos(wnd1->GetRect().left,y);
}
}
void SUIQuickSlotWnd::SetChildEnable(const char *wndname, bool enable)
{
KUIControl *twnd = dynamicCast<KUIControl *>(GetChild(wndname));
if(twnd)
{
if(enable)
twnd->Enable();
else
twnd->Disable();
}
}
void SUIQuickSlotWnd::SetChildEnableShow(const char *wndname, bool enableshow)
{
SetChildShow(wndname, enableshow);
SetChildEnable(wndname, enableshow);
}
//void SUIQuickSlotWnd::SetQuickSlotState(int u)
void SUIQuickSlotWnd::SetQuickSlotState(/*int state, int order*/)
{
setLayer(m_curLayer);
/* 2010.04.20 setLayer 함수로 대체함 - prodongi
return ;
//if(m_nQuickSlotState == u)
//if(m_nQuickSlotState == state && m_nQuickSlotOrder == order)
//return;
m_nQuickSlotState = state;
m_nQuickSlotOrder = order;
bool bChanged = false;
KUIWnd *wnd1, *wnd2, *wnd3;
wnd1 = GetChild("static_common_outframe_gold01");
wnd2 = GetChild("static_common_outframe_gold03");
wnd3 = NULL;
if(!(wnd1 && wnd2))
return;
if(wnd2->GetRect().top > wnd1->GetRect().top)
{
if(order == QUICKSLOTORDER_A
|| state == QUICKSLOTSTATE_ALL)
bChanged = true;
}
else
{
if(order == QUICKSLOTORDER_B)
bChanged = true;
}
//4개....
if(bChanged)
{
ChangePosY("static_common_outframe_gold01","static_common_outframe_gold03");
ChangePosY("static_common_outframe_gold02","static_common_outframe_gold04");
ChangePosY("static_common_inframe_linebox01","static_common_inframe_linebox03");
ChangePosY("static_common_inframe_linebox02","static_common_inframe_linebox04");
ChangePosY("static_quickslot_numberpanel01","static_quickslot_numberpanel03");
ChangePosY("static_quickslot_numberpanel02","static_quickslot_numberpanel04");
ChangePosY("static_common_inframe_blackround01","static_common_inframe_blackround03");
ChangePosY("static_common_inframe_blackround02","static_common_inframe_blackround04");
for( int n( 0 ); n < SUIDisplayInfo::c_nQuickSlotCount/2; ++n )
{
//std::string strNum = CStringUtil::StringFormat( "%02d", n );
ChangePosY(m_pSlotControlIDs[ n ].strIconControl.c_str(), m_pSlotControlIDs[ n+SUIDisplayInfo::c_nQuickSlotCount/2 ].strIconControl.c_str());
ChangePosY(m_pSlotControlIDs[ n ].strStaticCountControl.c_str(), m_pSlotControlIDs[ n+SUIDisplayInfo::c_nQuickSlotCount/2 ].strStaticCountControl.c_str());
ChangePosY(m_pSlotControlIDs[ n ].strIconEffectControl.c_str(), m_pSlotControlIDs[ n+SUIDisplayInfo::c_nQuickSlotCount/2 ].strIconEffectControl.c_str());
ChangePosY(m_pSlotControlIDs[ n ].strStaticText.c_str(), m_pSlotControlIDs[ n+SUIDisplayInfo::c_nQuickSlotCount/2 ].strStaticText.c_str());
ChangePosY(m_pSlotControlIDs[ n ].strClockControl.c_str(), m_pSlotControlIDs[ n+SUIDisplayInfo::c_nQuickSlotCount/2 ].strClockControl.c_str());
}
}
bool bViewLineA = true;
bool bViewLineB = true;
if(state == QUICKSLOTSTATE_ALL)
{
//SetChildShow("button_quickslot_change", false);
//KUIControl *twnd = (KUIControl *)GetChild("button_quickslot_change");
//if(twnd)
//twnd->Disable();
SetChildEnable("button_quickslot_change", false);
SetChildShow("button_quickslot_up", false);
SetChildShow("button_quickslot_down", true);
}
else
{
//SetChildShow("button_quickslot_change", true);
//KUIControl *twnd = (KUIControl *)GetChild("button_quickslot_change");
//if(twnd)
// twnd->Enable();
SetChildEnable("button_quickslot_change", true);
SetChildShow("button_quickslot_up", true);
SetChildShow("button_quickslot_down", false);
if(wnd2->GetRect().top < wnd1->GetRect().top)
bViewLineA = true;
else
bViewLineA = false;
bViewLineB = !bViewLineA;
}
SetChildShow("static_common_outframe_gold01", bViewLineA);
SetChildShow("static_common_outframe_gold02", bViewLineA);
SetChildShow("static_common_outframe_gold03", bViewLineB);
SetChildShow("static_common_outframe_gold04", bViewLineB);
SetChildShow("static_common_inframe_linebox01", bViewLineA);
SetChildShow("static_common_inframe_linebox02", bViewLineA);
SetChildShow("static_common_inframe_linebox03", bViewLineB);
SetChildShow("static_common_inframe_linebox04", bViewLineB);
SetChildShow("static_quickslot_numberpanel01", bViewLineA);
SetChildShow("static_quickslot_numberpanel02", bViewLineA);
SetChildShow("static_quickslot_numberpanel03", bViewLineB);
SetChildShow("static_quickslot_numberpanel04", bViewLineB);
SetChildShow("static_common_inframe_blackround01", bViewLineA);
SetChildShow("static_common_inframe_blackround02", bViewLineA);
SetChildShow("static_common_inframe_blackround03", bViewLineB);
SetChildShow("static_common_inframe_blackround04", bViewLineB);
for( int n( 0 ); n < SUIDisplayInfo::c_nQuickSlotCount; ++n )
{
bool b = bViewLineA;
if(n>=SUIDisplayInfo::c_nQuickSlotCount/2)
b = bViewLineB;
SetChildShow(m_pSlotControlIDs[ n ].strIconControl.c_str(), b);
SetChildShow(m_pSlotControlIDs[ n ].strStaticCountControl.c_str(), b);
SetChildShow(m_pSlotControlIDs[ n ].strIconEffectControl.c_str(), b);
SetChildShow(m_pSlotControlIDs[ n ].strStaticText.c_str(), b);
SetChildShow(m_pSlotControlIDs[ n ].strClockControl.c_str(), b);
}
KRect asdfrect = GetRect();
if(state == QUICKSLOTSTATE_ALL)
{
if(asdfrect.top != c_nOriginalPosY)
this->SetRect(KRect(GetRect().left, c_nOriginalPosY, GetRect().right, GetRect().bottom));
}
else
{
if(asdfrect.top == c_nOriginalPosY)
this->SetRect(KRect(GetRect().left, c_nOriginalPosY+c_nDifferenceHeight, GetRect().right, GetRect().bottom));
}
// prodongi
//m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_QUICKSLOT_STATECHANGE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CHATTING, this->GetRect().top , m_nQuickSlotState, m_nQuickSlotOrder) );
syncChattingWndPos();
RefreshQuickSlots();
*/
}
void SUIQuickSlotWnd::RefreshQuickSlots()
{
if( m_pSlotControlIDs == NULL )
return;
bool bView = false;
std::vector<bool> vec_bCanUserToggle;
for(int i=0;i<m_vSkillStatus.size();i++)
vec_bCanUserToggle.push_back(false);
for( int nSlot(0); nSlot < SUIDisplayInfo::c_nQuickSlotCount; ++nSlot )
{
bView = false;
const QUICKSLOT_DISPLAYINFO* pQuickSlotDispInfo( NULL );
const SUIQuickSlotInfo* pSlot( NULL );
int nCtrIndex(nSlot);
if( m_pDisplayInfo )
{
pQuickSlotDispInfo = m_pDisplayInfo->GetQuickSlotDisplayInfo( nSlot );
pSlot = m_pDisplayInfo->GetQuickSlot( nSlot );
}
KUIControlMultiIcon* pItemIconControl( dynamicCast<KUIControlMultiIcon*>(GetChild( m_pSlotControlIDs[ nCtrIndex ].strIconControl.c_str() )) );
if( NULL != pItemIconControl )
{
ResetMultiIcon( pItemIconControl, 0, 8 );
if( NULL != pQuickSlotDispInfo )
{
if(pItemIconControl->IsShow())
bView = true;
/// 2011.08.04 - prodongi
bool isSkillCardSet = false;
bool bIsSummonCard = false;
if (SUIQuickSlotInfo::QSLOTTYPE_ITEM == pSlot->m_type)
{
SUIQuickSlotItemInfo const* itemInfo = dynamicCast<SUIQuickSlotItemInfo const*>(pSlot);
if (itemInfo)
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( itemInfo->m_hItem );
if( pSlot )
{
if( setSkillCardIcon(pItemIconControl, pSlot->GetItemCode(), pQuickSlotDispInfo->bEquip))
isSkillCardSet = true;
//sun
if( setSummonCardIcon( pItemIconControl, pSlot ) )
bIsSummonCard = true;
}
}
}
// 2012. 3. 27 - marine 수량이 0인 소모성 아이템일 경우에는 원래 아이템 이미지, 빈아이템표시 ▧(오른쪽하단), 반투명 회색 이미지 를 사용한다.
if( SUIQuickSlotInfo::QSLOTTYPE_EMPTYITEM == pSlot->m_type)
{
pItemIconControl->SetIcon( 0, c_szDEF_SPR_NAME, pQuickSlotDispInfo->strAniName.c_str() );
pItemIconControl->SetIcon( 1, c_szDEF_SPR_NAME, "common_mark_titanium_empty_item"); // 빈 슬롯 표시
pItemIconControl->SetIcon( 2, c_szDEF_SPR_NAME, "common_panel_titanium_empty_item"); // 빈 아이템 표시(알파먹은 회색이미지)
}
else if(!isSkillCardSet && !bIsSummonCard)
{
pItemIconControl->SetIcon( 0, c_szDEF_SPR_NAME, pQuickSlotDispInfo->strAniName.c_str() );
pItemIconControl->SetIcon( 1, c_szDEF_SPR_NAME, pQuickSlotDispInfo->bEquip ? "common_mark_titanium_equipicon" : NULL );
}
else
__noop;
pItemIconControl->SetTooltip( pQuickSlotDispInfo->strTooltip.c_str() );
pItemIconControl->Enable();
pItemIconControl->ChangeAlpha(getSlotAlphaAtCurStatus(nSlot));
if( GetChild(m_pSlotControlIDs[ nSlot ].strIconControl.c_str()) )
SetChildShow( m_pSlotControlIDs[ nSlot ].strIconEffectControl.c_str(), GetChild(m_pSlotControlIDs[ nSlot ].strIconControl.c_str())->IsShow() );
if( pQuickSlotDispInfo->nCount > 0 )
{
SetChildCaption( m_pSlotControlIDs[ nCtrIndex ].strStaticCountControl.c_str(), CStringUtil::StringFormat( "%s<shadow><RIGHT><size:8>%d", S(6425), pQuickSlotDispInfo->nCount ).c_str() );
if(pItemIconControl->IsShow())
SetChildShow( m_pSlotControlIDs[ nCtrIndex ].strStaticCountControl.c_str(), pQuickSlotDispInfo->nCount.getAmount() > 0 );
}
else
{
if(pItemIconControl->IsShow())
SetChildShow( m_pSlotControlIDs[ nCtrIndex ].strStaticCountControl.c_str(), pQuickSlotDispInfo->nCount.getAmount() > 0 );
}
//sfreer 2009.03.25 소환수 스킬일경우 소환수가 소환되었는지 확인함 sfreer
if(pSlot)
{
if(pSlot->m_type == SUIQuickSlotInfo::QSLOTTYPE_SKILL)
{
SUIQuickSlotSkillInfo * pSkillInfo = (SUIQuickSlotSkillInfo *)pSlot;
if( pSkillInfo && !pSkillInfo->m_bPlayer)
{
{
int d = GetSkillStatusNumber( pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID );
if(d >=0)
vec_bCanUserToggle[d] = true;
}
//소환되지 않았다면 퀵슬롯아이콘 Disable 및 자동공격 취소할것.
if( !m_CreatureSlotMgr.IsExistSummonedCreature( pSkillInfo->m_hTarget ) )
{
pItemIconControl->Disable();
pItemIconControl->ChangeAlpha(.5);
SetChildShow( m_pSlotControlIDs[ nSlot ].strIconEffectControl.c_str(), false );
}
}
// 아래코드는 player의 스킬에 관한 코드인데, 크리쳐 스킬에서 호출되어서 else로 수정함 - prodongi
else
{
///
if (pSkillInfo->m_nSkillID==6101 || pSkillInfo->m_nSkillID==6102)
{
// 장착 부스트 아이템과 스킬이 일치하는지 검사
pSkillInfo->m_bEnable = true;
} else
if (!m_SkillSlotMgr.IsExistSkillLevel(pSkillInfo->m_nSkillID, pSkillInfo->m_nSkillLevel, pSkillInfo->m_hTarget))
{
pItemIconControl->Disable();
pItemIconControl->ChangeAlpha(.5);
pSkillInfo->m_bEnable = false;
SetChildShow( m_pSlotControlIDs[ nSlot ].strIconEffectControl.c_str(), false );
}
else
{
pSkillInfo->m_bEnable = true;
}
}
}
else if(pSlot->m_type == SUIQuickSlotInfo::QSLOTTYPE_ITEM)
{
const SUIQuickSlotItemInfo* pItemInfo = (const SUIQuickSlotItemInfo *)pSlot;
if( pItemInfo )
{
SInventorySlot* pInventorySlot( m_InventoryMgr.GetItemInfo( pItemInfo->m_hItem ) );
TS_ITEM_INFO* pInventoryItemInfo( pInventorySlot->GetItem() );
if( pInventorySlot && pInventoryItemInfo )
{
EquipItemAddtionalIconSetter icon_setter( pItemIconControl, pInventorySlot );
}
}
}
}
}
else
{
pItemIconControl->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_itemslot" );
pItemIconControl->SetTooltip( "" );
SetChildShow( m_pSlotControlIDs[ nCtrIndex ].strStaticCountControl.c_str(), false );
SetChildShow( m_pSlotControlIDs[ nCtrIndex ].strIconEffectControl.c_str(), false );
}
}
KUIControlClockBox* pClockControl = dynamicCast<KUIControlClockBox*>(GetChild( m_pSlotControlIDs[ nCtrIndex ].strClockControl.c_str() ));
if( NULL != pClockControl )
{
DWORD dwCurrentTime( NULL ),
dwMaxTime( NULL );
if( m_pDisplayInfo && m_pDisplayInfo->GetQuickSlotClockInfo( nSlot, dwCurrentTime, dwMaxTime ) )
{
pClockControl->SetShow(bView);
pClockControl->SetCurTime( dwCurrentTime );
pClockControl->SetMaxTime( dwMaxTime );
pClockControl->Begin();
}
else
pClockControl->Init();
}
}
//퀵슬롯에서 스킬 아이콘이 모두 제거 되면 그 스킬의 자동공격은 취소하도록 한다.
//이것은 그것을 위한 코드이다. sfreer 2009.04.
for(int i=0;i<vec_bCanUserToggle.size();i++)
{
if(vec_bCanUserToggle[i] == false && m_vSkillStatus[i].bToggleByUser)
{
if(m_vSkillStatus[i].GetStatus() == STATE_TOGGLE_ON_BY_USER)
m_vSkillStatus[i].SetStatus(STATE_TOGGLE_OFF_BY_USER);
m_vSkillStatus[i].bToggleByUser = false;
}
}
vec_bCanUserToggle.clear();
}
void SUIQuickSlotWnd::RefreshQuickEffect( int nSlot )
{
//큇슬롯 상태 설정
int nCtrIndex(nSlot);
//KUIControlQuickEffect * pSlotEffect = (KUIControlQuickEffect*)GetChild( CStringUtil::StringFormat( "icon_effect%02d", nCtrIndex ).c_str() );
KUIControlQuickEffect * pSlotEffect = dynamicCast<KUIControlQuickEffect*>(GetChild( m_pSlotControlIDs[ nSlot ].strIconEffectControl.c_str() ));
if( !pSlotEffect ) return;
const SUIQuickSlotInfo * pSlotInfo = m_pDisplayInfo->GetQuickSlot( nSlot );
if( pSlotInfo == NULL )
{
pSlotEffect->Cancel();
return;
}
if(pSlotInfo->m_type == SUIQuickSlotInfo::QSLOTTYPE_SKILL)
//|| pSlotInfo->m_type == SUIQuickSlotInfo::QSLOTTYPE_CREATURE_SKILL)
{
const SUIQuickSlotSkillInfo * pSkillInfo = (const SUIQuickSlotSkillInfo *)pSlotInfo;
int nStatus = GetSkillStatus( pSkillInfo->m_hTarget, pSkillInfo->m_nSkillID );
/*if(pSkillInfo->m_bPlayer)
GetSkillStatus(0, pSkillInfo->m_nSkillID );
else*/
KUIControlMultiIcon* pItemIconControl = dynamicCast<KUIControlMultiIcon*>(GetChild( m_pSlotControlIDs[ nCtrIndex ].strIconControl.c_str() ));
if( NULL != pItemIconControl )
{
if(pItemIconControl->IsShow())
pSlotEffect->SetShow( true );
}
if( nStatus == STATE_NONE )
{
pSlotEffect->Cancel();
}
else if( nStatus == STATE_CASTING )
{
if( !pSlotEffect->IsToggleOn() )
{
pSlotEffect->Cast(0);
}
}
else if( nStatus == STATE_FIRE )
{
if( !pSlotEffect->IsToggleOn() )
{
pSlotEffect->Cancel();
}
}
else if( nStatus == STATE_CANCEL )
{
if( !pSlotEffect->IsToggleOn() )
pSlotEffect->Cancel();
}
else if( nStatus == STATE_TOGGLE_ON
|| nStatus == STATE_TOGGLE_ON_BY_USER )
{
if( !pSlotEffect->IsToggleOn() )
pSlotEffect->ToggleOn(true);
}
else if( nStatus == STATE_TOGGLE_OFF
|| nStatus == STATE_TOGGLE_OFF_BY_USER)
{
pSlotEffect->ToggleOn(false);
}
}
else //아이템, 조작 아이콘등은
{
pSlotEffect->SetShow( false );
pSlotEffect->Cancel();
}
}
void SUIQuickSlotWnd::modifyLayer()
{
setLayer((m_curLayerDirUp) ? m_curLayer + 1 : m_curLayer - 1);
}
void SUIQuickSlotWnd::setLayerAlpha(char const* controlID, bool update)
{
int alphaLevel = 0;
if (strstr(controlID, "_d"))
alphaLevel = 3;
else if (strstr(controlID, "_c"))
alphaLevel = 2;
else if (strstr(controlID, "_b"))
alphaLevel = 1;
else if (strstr(controlID, "_a"))
alphaLevel = 0;
float alpha = levelToAlpha(alphaLevel);
char const* L = controlID + strlen(controlID) - 1;
int group = atoi(L) - 1;
int layer = group >> 1;
// 2010.05.18 - prodongi
setLayerAlpha(layer, alpha, update, m_layerAlphaInfo[layer].m_isMouseFocusOn ? false : true);
//setLayerAlpha(layer, alpha, update, apply);
setAlphaCheckButtonState(layer, alphaLevel);
}
void SUIQuickSlotWnd::setLayerAlpha(int layer, float alpha, bool update, bool apply)
{
if (0.0f > alpha) alpha = 0.0f;
else if (1.0f < alpha) alpha = 1.0f;
if (update)
{
// 2010.05.18 - prodongi
m_layerAlphaInfo[layer].m_alpha = alpha;
//m_layerAlpha[layer] = alpha;
}
if (apply)
setLayerFunc(layer, &SUIQuickSlotWnd::SetChildAlpha, alpha, true, c_DefaultKeymapString);
}
void SUIQuickSlotWnd::initLayer()
{
m_layerAlphaAniV = 2.0f;
// m_isMouseFocusOn = false;
// m_isLayerAlphaAni = false;
setLayer(m_curLayer);
setLayerDir(true);
for (int layer = 0; layer < TOTAL_LAYER; ++layer)
{
// 2010.05.18 - prodongi
sLayerAlphaInfo* info = m_layerAlphaInfo + layer;
setLayerAlpha(layer, info->m_alpha);
setAlphaCheckButtonState(layer, info->m_alphaLevel);
info->m_tempAlpha = 1.0f;
info->m_isMouseFocusOn = false;
info->m_isAlphaAni = false;
/*
setLayerAlpha(i, m_layerAlpha[i]);
setAlphaCheckButtonState(i, m_layerAlphaLevel[i]);
m_tempLayerAlpha[i] = 1.0f;
*/
}
}
void SUIQuickSlotWnd::setLayerDir(bool up)
{
m_curLayerDirUp = up;
if (up)
{
SetChildShow("button_quickslot_down", false);
SetChildShow("button_quickslot_up", true);
}
else
{
SetChildShow("button_quickslot_down", true);
SetChildShow("button_quickslot_up", false);
}
}
void SUIQuickSlotWnd::setLayerShow(int beginLayer, int endLayer, bool show)
{
for (int layer = beginLayer; layer < endLayer; ++layer)
{
setLayerFunc(layer, &SUIQuickSlotWnd::SetChildShow, show, false, 0.0f);
}
}
void SUIQuickSlotWnd::setLayer(int layer)
{
if (0 > layer) layer = 0;
else if (TOTAL_LAYER < layer) layer = TOTAL_LAYER - 1;
// if (layer == m_curLayer)
// return ;
m_curLayer = layer;
// show layer
setLayerShow(0, m_curLayer+1, true);
setLayerShow(m_curLayer + 1, TOTAL_LAYER, false);
// layer dir
if (TOTAL_LAYER - 1 == m_curLayer) setLayerDir(false);
else if (0 == m_curLayer) setLayerDir(true);
setLayerView();
// move chatting window position
syncChattingWndPos();
// 2010.05.18 - prodongi
setWndRectAtLayer();
RefreshQuickSlots();
}
void SUIQuickSlotWnd::setLayerView()
{
int i;
char wndName[128];
for (i = 0; i < m_curLayer+1; ++i)
{
sprintf(wndName, "guage_titamium_quickslot_view_%02d", i+1);
SetChildShow(wndName, true);
}
for (; i < TOTAL_LAYER; ++i)
{
sprintf(wndName, "guage_titamium_quickslot_view_%02d", i+1);
SetChildShow(wndName, false);
}
}
void SUIQuickSlotWnd::checkMouseFocusOn(bool inWindow)
{
// 2010.05.18 - prodongi
for (int layer = 0; layer <= m_curLayer; ++layer)
{
sLayerAlphaInfo* info = m_layerAlphaInfo + layer;
if (inWindow && info->isInRect(m_mouseX, m_mouseY))
{
if (!info->m_isMouseFocusOn)
{
info->m_isMouseFocusOn = true;
info->setLayerAlphaAni(true);
setLayerAlpha(layer, 1.0f, false);
}
}
else
{
if (info->m_isMouseFocusOn)
{
info->m_isMouseFocusOn = false;
info->setLayerAlphaAni(true);
setLayerAlpha(layer, info->m_alpha, false);
}
}
}
/*
if (inWindow)
{
if (!m_isMouseFocusOn)
{
m_isMouseFocusOn = true;
setLayerAlphaAni(true);
for (int layer = 0; layer <= m_curLayer; ++layer)
{
setLayerAlpha(layer, 1.0f, false);
}
}
}
else
{
if (m_isMouseFocusOn)
{
m_isMouseFocusOn = false;
setLayerAlphaAni(true);
for (int layer = 0; layer <= m_curLayer; ++layer)
{
// 2010.05.18 - prodongi
setLayerAlpha(layer, m_layerAlphaInfo[layer].m_alpha, false);
//setLayerAlpha(layer, m_layerAlpha[layer], false);
}
}
}
*/
}
bool SUIQuickSlotWnd::isInWindow()
{
// 2010.05.18 - prodongi
return IsInRect(m_mouseX, m_mouseY);
/*
KRect rect;
KUIWnd* wnd;
wnd = GetChild("static_common_outframe_gold01");
rect.bottom = wnd->GetRect().bottom;
rect.left = wnd->GetRect().left;
wnd = GetChild("static_common_outframe_gold02");
rect.right = wnd->GetRect().right;
char wndName[128];
sprintf(wndName, "static_common_outframe_gold%02d", layerToGroup(m_curLayer, 0)+1);
wnd = GetChild(wndName);
rect.top = wnd->GetRect().top;
return rect.IsInRect(m_mouseX, m_mouseY);
*/
}
void SUIQuickSlotWnd::setLayerAlphaAni(bool /*ani*/)
{
/*
if (ani == m_isLayerAlphaAni) return ;
m_isLayerAlphaAni = ani;
for (int layer = 1; layer < TOTAL_LAYER; ++layer)
{
if (m_isMouseFocusOn)
m_tempLayerAlpha[layer] = m_layerAlpha[layer];
else
m_tempLayerAlpha[layer] = 1.0f;
}
*/
}
void SUIQuickSlotWnd::setAlphaCheckButtonState(int layer, int alphaLevel)
{
if (0 > alphaLevel) alphaLevel = 0;
else if (3 < alphaLevel) alphaLevel = 0;
// 2010.05.18 - prodongi
m_layerAlphaInfo[layer].m_alphaLevel = alphaLevel;
//m_layerAlphaLevel[layer] = alphaLevel;
char wndName[128];
int startGroup = layerToGroup(layer, 0);
for (int group = 0; group < LAYER_GROUP_NUM; ++group)
{
for (int level = 0; level < 4; ++level)
{
sprintf(wndName, "slider_titamium_quickslot_transparent_%c%02d", 'a'+level, startGroup + group + 1);
setCheckBox(this, wndName, false);
}
}
sprintf(wndName, "slider_titamium_quickslot_transparent_%c%02d", 'a'+alphaLevel, startGroup+1);
setCheckBox(this, wndName, true);
sprintf(wndName, "slider_titamium_quickslot_transparent_%c%02d", 'a'+alphaLevel, startGroup+2);
setCheckBox(this, wndName, true);
}
void SUIQuickSlotWnd::syncChattingWndPos() const
{
char wndName[128];
sprintf(wndName, "static_common_outframe_gold%02d", layerToGroup(m_curLayer, 0)+1);
KUIWnd* wnd = GetChild(wndName);
if (!wnd)
{
assert(0 && "failed static_common_outframe_gold GetChild");
return ;
}
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_QUICKSLOT_STATECHANGE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CHATTING, wnd->GetRect().top , 0, 0) );
}
// 2010.05.18 - prodongi
void SUIQuickSlotWnd::setWndRectAtLayer()
{
KRect newRect = GetRect();
char wndName[128];
KUIWnd* wnd;
// top
sprintf(wndName, "static_common_outframe_gold%02d", layerToGroup(m_curLayer, 0)+1);
wnd = GetChild(wndName);
newRect.top = wnd->GetRect().top;
// bottom
sprintf(wndName, "static_common_outframe_gold%02d", layerToGroup(0, 0)+1);
wnd = GetChild(wndName);
newRect.bottom = wnd->GetRect().bottom;
SetRect(newRect);
}
void SUIQuickSlotWnd::initLayerRect()
{
char wndName[128];
KRect mainRect = GetRect();
for (int layer = 0; layer < TOTAL_LAYER; ++layer)
{
sLayerAlphaInfo* info = m_layerAlphaInfo + layer;
sprintf(wndName, "static_common_outframe_gold%02d", layerToGroup(layer, 0)+1);
KUIWnd* wnd = GetChild(wndName);
if (wnd)
{
info->m_rect.left = mainRect.left;
info->m_rect.right = mainRect.right;
info->m_rect.top = wnd->GetRect().top;
info->m_rect.bottom = wnd->GetRect().bottom;
}
}
}
void SUIQuickSlotWnd::updateLayerAlphaAni(DWORD elapsedtime)
{
// if (!m_isLayerAlphaAni) return ;
//bool end = true;
float t = (float)elapsedtime * 0.001f;
float s = m_layerAlphaAniV * t;
for (int layer = 1; layer <= m_curLayer/*TOTAL_LAYER*/; ++layer)
{
// 2010.05.18 - prodongi
sLayerAlphaInfo* info = m_layerAlphaInfo + layer;
if (!info->m_isAlphaAni)
continue;
bool end = true;
float& tempAlpha = info->m_tempAlpha;
//float& tempAlpha = m_tempLayerAlpha[layer];
if (info->m_isMouseFocusOn)
//if (m_isMouseFocusOn)
{
tempAlpha += s;
if (tempAlpha >= 1.0f) tempAlpha = 1.0f;
else end = false;
}
else
{
tempAlpha -= s;
// 2010.05.18 - prodongi
if (tempAlpha <= info->m_alpha) tempAlpha = info->m_alpha;
else end = false;
/*
if (tempAlpha <= m_layerAlpha[layer]) tempAlpha = m_layerAlpha[layer];
else end = false;
*/
}
setLayerAlpha(layer, tempAlpha, false);
// 2010.05.18 - prodongi
if (end)
info->setLayerAlphaAni(false);
}
// if (end)
// setLayerAlphaAni(false);
}
void SUIQuickSlotWnd::updateTextHightlight(bool inWindow)
{
// 2010.05.18 - prodongi
if(inWindow)
{
int slotCount = 0;
for (int layer = 0; layer < TOTAL_LAYER; ++layer)
{
if (!m_layerAlphaInfo[layer].isInRect(m_mouseX, m_mouseY))
{
slotCount += LAYER_GROUP_NUM * c_nQuickSlotCount;
continue;
}
for (int group = 0; group < LAYER_GROUP_NUM; ++group)
{
for (int slot = 0; slot < c_nQuickSlotCount; ++slot, ++slotCount)
{
KUIControl *wnd = dynamicCast<KUIControl *>(GetChild( m_pSlotControlIDs[ slotCount ].strStaticText.c_str() ));
if(wnd)
{
if(wnd->IsInRect(m_mouseX, m_mouseY))
wnd->ChangeAlpha(c_HighlightKeymapString);
else
{
if (m_layerAlphaInfo[layer].m_isAlphaAni)
{
// 2010.05.18 - prodongi
float a = m_layerAlphaInfo[layer].m_tempAlpha;
// float a = m_tempLayerAlpha[layer];
if (c_DefaultKeymapString < a) a = c_DefaultKeymapString;
wnd->ChangeAlpha(a);
}
else
{
wnd->ChangeAlpha(c_DefaultKeymapString);
}
}
}
}
}
}
/*
for(int n( 0 ); n < SUIDisplayInfo::c_nQuickSlotCount; ++n )
{
KUIControl *wnd = (KUIControl *)GetChild( m_pSlotControlIDs[ n ].strStaticText.c_str() );
if(wnd)
{
if(wnd->IsInRect(m_mouseX, m_mouseY))
wnd->ChangeAlpha(c_HighlightKeymapString);
else
{
if (m_isLayerAlphaAni)
{
int layer = groupToLayer(n/c_nQuickSlotCount);
// 2010.05.18 - prodongi
float a = m_layerAlphaInfo[layer].m_tempAlpha;
// float a = m_tempLayerAlpha[layer];
if (c_DefaultKeymapString < a) a = c_DefaultKeymapString;
wnd->ChangeAlpha(a);
}
else
{
wnd->ChangeAlpha(c_DefaultKeymapString);
}
}
}
}
*/
}
}
void SUIQuickSlotWnd::saveIni()
{
FILE* file = fopen ("quickslot.ini", "w");
if (file)
{
char buffer[MAX_PATH];
// 2010.06.14 - prodongi
sprintf(buffer, "%d %d %d %d %d", m_curLayer, m_layerAlphaInfo[0].m_alphaLevel, m_layerAlphaInfo[1].m_alphaLevel,
m_layerAlphaInfo[2].m_alphaLevel, m_layerAlphaInfo[3].m_alphaLevel);
/*
// 2010.05.18 - prodongi
sprintf(buffer, "%d %d %d %d %d", m_curLayer, m_layerAlphaInfo[0].m_alpha, m_layerAlphaInfo[1].m_alpha,
m_layerAlphaInfo[2].m_alpha, m_layerAlphaInfo[3].m_alpha);
*/
/*
sprintf(buffer, "%d %d %d %d %d", m_curLayer, m_layerAlphaLevel[0], m_layerAlphaLevel[1],
m_layerAlphaLevel[2], m_layerAlphaLevel[3]);
*/
fwrite(buffer, strlen(buffer), 1, file);
fclose(file);
}
}
void SUIQuickSlotWnd::loadIni()
{
FILE* file = fopen ("quickslot.ini", "r");
if (file)
{
char buffer[MAX_PATH];
fread(buffer, MAX_PATH, 1, file);
// 2010.05.18 - prodongi
sscanf(buffer, "%d %d %d %d %d", &m_curLayer, &m_layerAlphaInfo[0].m_alphaLevel, &m_layerAlphaInfo[1].m_alphaLevel,
&m_layerAlphaInfo[2].m_alphaLevel, &m_layerAlphaInfo[3].m_alphaLevel);
/*
sscanf(buffer, "%d %d %d %d %d", &m_curLayer, &m_layerAlphaLevel[0], &m_layerAlphaLevel[1],
&m_layerAlphaLevel[2], &m_layerAlphaLevel[3]);
*/
fclose(file);
for (int i = 0; i < TOTAL_LAYER; ++i)
{
// 2010.05.18 - prodongi
m_layerAlphaInfo[i].m_alpha = levelToAlpha(m_layerAlphaInfo[i].m_alphaLevel);
// m_layerAlpha[i] = levelToAlpha(m_layerAlphaLevel[i]);
}
}
}
float SUIQuickSlotWnd::levelToAlpha(int alphaLevel) const
{
switch (alphaLevel)
{
case 0: return 1.0f;
case 1: return 0.5f;
case 2: return 0.1f;
case 3: return 0.0f;
}
return 1.0f;
}
float SUIQuickSlotWnd::getSlotAlphaAtCurStatus(int slot) const
{
// 2010.05.18 - prodongi
int layer = slotToLayer(slot);
return m_layerAlphaInfo[layer].getSlotAlphaAtCurStatus();
/*
float alpha;
if (m_isMouseFocusOn)
{
if (m_isLayerAlphaAni) alpha = m_tempLayerAlpha[slotToLayer(slot)];
else alpha = 1.0f;
}
else
{
if (m_isLayerAlphaAni) alpha = m_tempLayerAlpha[slotToLayer(slot)];
else alpha = m_layerAlpha[slotToLayer(slot)];
}
return alpha;
*/
}
void SUIHQuickSlotWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch(nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
}
break;
}
SUIQuickSlotWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIVQuickSlotWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch(nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
}
break;
}
SUIQuickSlotWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}