399 lines
11 KiB
C++
399 lines
11 KiB
C++
#pragma once
|
|
|
|
//#include "SUIWnd.h"
|
|
#include "SUIDefine.h"
|
|
//#include "Util.h"
|
|
|
|
class SUIQuickSlotWnd : public SUIWnd
|
|
{
|
|
public:
|
|
SUIQuickSlotWnd( class SGameManager* pGameManager, class SUIDisplayInfo* pDisplayInfo );
|
|
virtual ~SUIQuickSlotWnd();
|
|
|
|
virtual bool InitControls( KPoint kPos );
|
|
virtual bool InitData( bool bReload = false );
|
|
virtual void* Perform( KID id, KArg& msg );
|
|
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
|
|
virtual void ProcMsgAtStatic( struct SGameMessage* pMsg );
|
|
virtual void OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd = true );
|
|
virtual void Process(DWORD dwTime);
|
|
void ToggleSkillByUser(int nSlot);
|
|
|
|
// 2010.04.20 정리 - prodongi
|
|
/*
|
|
int GetQuickSlotOrder() { return m_nQuickSlotOrder; }
|
|
int GetQuickSlotState() { return m_nQuickSlotState; }
|
|
void SetQuickSlotState() { SetQuickSlotState(m_nQuickSlotState, m_nQuickSlotOrder); }
|
|
*/
|
|
// 2010.04.20 state, order 삭제 - prodongi
|
|
void SetQuickSlotState(/*int state, int order*/);
|
|
|
|
virtual void MovePos(int posx, int posy);
|
|
|
|
protected:
|
|
class SUIDisplayInfo* m_pDisplayInfo;
|
|
|
|
/// 아이템 슬롯 정보 표현용 control들의 ID
|
|
struct SLOT_INFO
|
|
{
|
|
std::string strIconControl;
|
|
std::string strClockControl;
|
|
std::string strStaticCountControl;
|
|
std::string strIconEffectControl;
|
|
std::string strStaticText;
|
|
};
|
|
SLOT_INFO* m_pSlotControlIDs;
|
|
|
|
//QUICKSLOT_BTNSTATE m_SelectedButtonState;
|
|
//QUICKSLOT_BTNSTATE m_OldSelectedButtonState;
|
|
//bool m_bCSDown, m_bShiftKeyDown, m_bControlKeyDown, m_bAltKeyDown;
|
|
|
|
// 2010.04.20 정리 - prodongi
|
|
//int m_nCreatureQuick;
|
|
bool m_bDraging;
|
|
|
|
//bool IsDefaultSlot( const char* szControlID );
|
|
int GetSlotIndex( const char* szControlID );
|
|
|
|
void UpdateEffect(AR_HANDLE caster, int nSkillID, int nStatus);
|
|
void UpdateToggleEffect(AR_HANDLE caster, int nSkillID, int nStatus);
|
|
|
|
//virtual void PostButtonSelectChangeMsg() = 0;
|
|
virtual void RefreshCreatureQuickSlots(){};
|
|
|
|
void RefreshQuickSlots();
|
|
|
|
//void ChangeButtonState( /*QUICKSLOT_BTNSTATE CurrentState */);
|
|
//void ChangeButtonStateForSometime();
|
|
//void SetSubSlotText( /*QUICKSLOT_BTNSTATE State */);
|
|
|
|
//void ReSetQuickSlots();
|
|
|
|
enum
|
|
{
|
|
c_nQuickSlotCount = 12,
|
|
};
|
|
|
|
enum
|
|
{
|
|
STATE_NONE = 0, ///< 상태 없음
|
|
STATE_CASTING, ///< 캐스팅
|
|
STATE_FIRE, ///< 화이어
|
|
STATE_CANCEL, ///< 취소
|
|
STATE_TOGGLE_ON, ///< 토글 On
|
|
STATE_TOGGLE_OFF, ///< 토글 Off
|
|
STATE_TOGGLE_ON_BY_USER,
|
|
STATE_TOGGLE_OFF_BY_USER
|
|
|
|
};
|
|
|
|
typedef struct _skill_status
|
|
{
|
|
int nSkillID;
|
|
//int nStatus;
|
|
AR_HANDLE caster;
|
|
bool bToggleByUser;
|
|
|
|
void SetStatus(int n)
|
|
{
|
|
nSkillStatus = n;
|
|
if(nSkillStatus == STATE_TOGGLE_ON_BY_USER)
|
|
bToggleByUser = true;
|
|
else //if(nSkillStatus == STATE_TOGGLE_OFF_BY_USER)
|
|
bToggleByUser = false;
|
|
}
|
|
|
|
int GetStatus()
|
|
{
|
|
return nSkillStatus;
|
|
}
|
|
|
|
void Init()
|
|
{
|
|
bToggleByUser=false;
|
|
}
|
|
|
|
int nSkillStatus;
|
|
|
|
} _SKILL_STATUS;
|
|
|
|
|
|
const int GetSkillStatus( AR_HANDLE caster, int nSkillID );
|
|
const int GetSkillStatusNumber( AR_HANDLE caster, int nSkillID );
|
|
const bool IsToggleOnByUserSkillStatus( AR_HANDLE caster, int nSkillID );
|
|
void UpdateSkillStatus( AR_HANDLE caster, int nSkillID, int nStatus );
|
|
void UpdateSkillToggle( AR_HANDLE caster, int nSkillID, int nStatus );
|
|
void RefreshQuickEffect( /*QUICKSLOT_BTNSTATE nBtnState,*/ int nSlot );
|
|
|
|
int m_nDragIndex;
|
|
std::vector< _SKILL_STATUS > m_vSkillStatus;
|
|
|
|
void ChangePosY(const char *control1, const char *control2);
|
|
void SetChildEnable(const char *wndname, bool enable = true);
|
|
void SetChildEnableShow(const char *wndname, bool enableshow = true);
|
|
|
|
DWORD m_dwTime;
|
|
|
|
std::vector<AR_HANDLE> m_vecCreatureCastingStatus;
|
|
|
|
/** prodongi */
|
|
protected:
|
|
/// @brief layer 초기화
|
|
void initLayer();
|
|
/// @brief SetQuickSlotState의 대용으로 만듬, 퀵 슬롯의 레이어 설정
|
|
/// @brief 초기화 할때는 refresh를 하지 않는다
|
|
void setLayer(int layer);
|
|
/// @brief beginLayer와 endLayer범위의 layer를 show/hide한다
|
|
void setLayerShow(int beginLayer, int endLayer, bool show);
|
|
/// @brief layer up/down 방향 버튼 설정
|
|
void setLayerDir(bool up);
|
|
/// @brief layer 상태를 변환해 준다
|
|
void modifyLayer();
|
|
/// @brief layer의 알파값을 변경해준다
|
|
void setLayerAlpha(char const* controlID, bool update = true);
|
|
/// @brief 마우스 포커스가 on 瑛뻑?알파를 조절하는 경우에는 update를 하지 않는다
|
|
void setLayerAlpha(int layer, float alpha, bool update = true, bool apply = true);
|
|
/// @brief 현재 layer상태를 보여준다
|
|
void setLayerView();
|
|
/// @brief 마우스가 퀵슬롯 영역에 in/out인지 체크, OnMouseFocusOnNotify로 처리 할려고 했으나, 컨트롤들이 여러개라서
|
|
/// 뚤리는 경우가 생기기 때문에 함수를 따로 만듬,,,
|
|
void checkMouseFocusOn(bool inWindow);
|
|
/// @brief layer의 알파를 업데이트 시킨다
|
|
void updateLayerAlphaAni(DWORD elapsedtime);
|
|
/// @brief
|
|
void setLayerAlphaAni(bool ani);
|
|
/// @brief 레이어의 알파 버튼의 체크 상태 설정
|
|
void setAlphaCheckButtonState(int layer, int alphaLevel);
|
|
/// @brief 채팅 윈도우 위치를 퀵슬롯 위치에 맞춰준다
|
|
void syncChattingWndPos() const;
|
|
/// @brief 레이어의 단계에 따라서 윈도우의 rect를 변경해준다
|
|
void setWndRectAtLayer();
|
|
bool isInWindow();
|
|
/// @brief 마우스를 퀵슬롯 위에 올렸을때 발동되는 텍스트 하이라이트 업데이트
|
|
void updateTextHightlight(bool inWindow);
|
|
void loadIni();
|
|
void saveIni();
|
|
float levelToAlpha(int alphaLevel) const;
|
|
/// @brief 현재의 모든 상태에 따른 슬롯의 알파값을 구한다
|
|
float getSlotAlphaAtCurStatus(int slot) const;
|
|
/// @brief 레이어의 위치 설정
|
|
void initLayerRect();
|
|
|
|
int layerToGroup(int layer, int count) const
|
|
{
|
|
assert(layer >= 0);
|
|
assert(count >= 0);
|
|
return layer * LAYER_GROUP_NUM + count;
|
|
}
|
|
int groupToLayer(int group) const
|
|
{
|
|
assert(group >= 0);
|
|
return group / LAYER_GROUP_NUM;
|
|
}
|
|
int slotToLayer(int slot) const
|
|
{
|
|
assert(slot >= 0);
|
|
return slot/(c_nQuickSlotCount * LAYER_GROUP_NUM);
|
|
}
|
|
|
|
template <class F, class M> void setLayerFunc(int layer, F func, M member, bool alphaFunc, float maxTextAlpha);
|
|
void changeSlotAlphaHelp(char const* wndName, float member)
|
|
{
|
|
float value = member;
|
|
KUIControl *wnd = dynamicCast<KUIControl *>(GetChild(wndName));
|
|
if (wnd)
|
|
{
|
|
if (wnd->IsDisable() && member > 0.5f) value = 0.5f;
|
|
wnd->ChangeAlpha(value);
|
|
}
|
|
}
|
|
|
|
protected:
|
|
/*
|
|
LAYER 3 (GROUP6, GROUP7)
|
|
LAYER 2 (GROUP4, GROUP5)
|
|
LAYER 1 (GROUP2, GROUP3)
|
|
LAYER 0 (GROUP0, GROUP1)
|
|
*/
|
|
enum { TOTAL_LAYER = 4 };
|
|
enum { TOTAL_GROUP = 8 };
|
|
/// @brief 한개의 그룹에는 c_nQuickSlotCount만클의 슬롯이 있고, 한개의 Layer에는 LAYER_GROUP_NUM만큰의 그룹이 있다.
|
|
enum { LAYER_GROUP_NUM = 2 };
|
|
// 2010.06.14 - prodongi
|
|
enum { DEFAULT_LAYER = 1 };
|
|
|
|
// 2010.05.17- prodongi
|
|
struct sLayerAlphaInfo
|
|
{
|
|
bool isInRect(int x, int y) const { return m_rect.IsInRect(x, y); }
|
|
void setLayerAlphaAni(bool ani)
|
|
{
|
|
if (ani == m_isAlphaAni) return ;
|
|
|
|
m_isAlphaAni = ani;
|
|
if (m_isMouseFocusOn) m_tempAlpha = m_alpha;
|
|
else m_tempAlpha = 1.0f;
|
|
}
|
|
float getSlotAlphaAtCurStatus() const
|
|
{
|
|
float alpha;
|
|
if (m_isMouseFocusOn)
|
|
{
|
|
if (m_isAlphaAni) alpha = m_tempAlpha;
|
|
else alpha = 1.0f;
|
|
}
|
|
else
|
|
{
|
|
if (m_isAlphaAni) alpha = m_tempAlpha;
|
|
else alpha = m_alpha;
|
|
}
|
|
return alpha;
|
|
}
|
|
float m_alpha;
|
|
float m_tempAlpha;
|
|
/// @brief 알파 애니메이션을 위한 임시 layer 배열
|
|
int m_alphaLevel;
|
|
|
|
bool m_isAlphaAni;
|
|
bool m_isMouseFocusOn;
|
|
KRect m_rect;
|
|
|
|
};
|
|
sLayerAlphaInfo m_layerAlphaInfo[TOTAL_LAYER];
|
|
|
|
int m_curLayer;
|
|
/// @brief layer 증감 방향
|
|
bool m_curLayerDirUp;
|
|
/// @brief 마우스가 퀵슬롯 윈도우에 있는지 없는지
|
|
// bool m_isMouseFocusOn;
|
|
// float m_layerAlpha[TOTAL_LAYER];
|
|
/// @brief 알파 애니메이션을 위한 임시 layer 배열
|
|
// float m_tempLayerAlpha[TOTAL_LAYER];
|
|
// int m_layerAlphaLevel[TOTAL_LAYER];
|
|
// bool m_isLayerAlphaAni;
|
|
float m_layerAlphaAniV;
|
|
int m_mouseX, m_mouseY;
|
|
};
|
|
|
|
|
|
/// 가로로 누운 퀵
|
|
class SUIHQuickSlotWnd : public SUIQuickSlotWnd
|
|
{
|
|
public:
|
|
SUIHQuickSlotWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
|
|
: SUIQuickSlotWnd( pGameManager, pDisplayInfo ) { }
|
|
|
|
void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
|
|
|
|
private:
|
|
//void PostButtonSelectChangeMsg();
|
|
};
|
|
|
|
/// 세로로 선 퀵
|
|
class SUIVQuickSlotWnd : public SUIQuickSlotWnd
|
|
{
|
|
public:
|
|
SUIVQuickSlotWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
|
|
: SUIQuickSlotWnd( pGameManager, pDisplayInfo ) { }
|
|
|
|
void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
|
|
|
|
private:
|
|
//void PostButtonSelectChangeMsg();
|
|
|
|
};
|
|
|
|
|
|
/// @param maxTextAlpha func가 SUIQuickSlotWnd::*childAlphaFunc일때 텍스트의 최대 알파값
|
|
template <class F, class M>
|
|
void SUIQuickSlotWnd::setLayerFunc(int layer, F func, M member, bool alphaFunc, float maxTextAlpha)
|
|
{
|
|
M textValue = member;
|
|
if (alphaFunc)
|
|
{
|
|
if ((float)textValue > maxTextAlpha) textValue = maxTextAlpha;
|
|
}
|
|
|
|
char wndName[128];
|
|
int groupNum, wlongNum, slotNum;
|
|
for (int group = 0; group < LAYER_GROUP_NUM; ++group)
|
|
{
|
|
groupNum = layerToGroup(layer, group);
|
|
|
|
sprintf(wndName, "static_common_outframe_gold%02d", groupNum+1);
|
|
(this->*func)(wndName, member);
|
|
|
|
sprintf(wndName, "static_common_inframe_linebox%02d", groupNum+1);
|
|
(this->*func)(wndName, member);
|
|
|
|
sprintf(wndName, "static_common_inframe_blackround%02d", groupNum+1);
|
|
(this->*func)(wndName, member);
|
|
|
|
sprintf(wndName, "static_quickslot_numberpanel%02d", groupNum+1);
|
|
(this->*func)(wndName, member);
|
|
|
|
sprintf(wndName, "slider_titamium_quickslot_transparent%02d", groupNum+1);
|
|
(this->*func)(wndName, member);
|
|
|
|
sprintf(wndName, "layout_titamium_gold_light_height%02d", groupNum+1);
|
|
(this->*func)(wndName, member);
|
|
|
|
for (int temp = 0; temp < 4; ++temp)
|
|
{
|
|
sprintf(wndName, "slider_titamium_quickslot_transparent_%c%02d", 'a'+temp, groupNum+1);
|
|
(this->*func)(wndName, member);
|
|
}
|
|
|
|
for (int w = 0; w < 2; ++w)
|
|
{
|
|
wlongNum = groupNum * 2 + w;
|
|
sprintf(wndName, "layout_titamium_gold_light_wlong%02d", wlongNum+1);
|
|
(this->*func)(wndName, member);
|
|
}
|
|
|
|
if (alphaFunc)
|
|
{
|
|
for (int qcount = 0; qcount < c_nQuickSlotCount; ++qcount)
|
|
{
|
|
slotNum = groupNum * c_nQuickSlotCount + qcount;
|
|
|
|
sprintf(wndName, "static_slotcount%02d", slotNum);
|
|
changeSlotAlphaHelp(wndName, member);
|
|
|
|
sprintf(wndName, "icon_effect%02d", slotNum);
|
|
changeSlotAlphaHelp(wndName, member);
|
|
|
|
sprintf(wndName, "icon_slot%02d", slotNum);
|
|
changeSlotAlphaHelp(wndName, member);
|
|
|
|
sprintf(wndName, "clock_slot%02d", slotNum);
|
|
changeSlotAlphaHelp(wndName, member);
|
|
|
|
sprintf(wndName, "static_text%02d", slotNum);
|
|
(this->*func)(wndName, textValue);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int qcount = 0; qcount < c_nQuickSlotCount; ++qcount)
|
|
{
|
|
slotNum = groupNum * c_nQuickSlotCount + qcount;
|
|
|
|
sprintf(wndName, "static_slotcount%02d", slotNum);
|
|
(this->*func)(wndName, member);
|
|
|
|
sprintf(wndName, "icon_effect%02d", slotNum);
|
|
(this->*func)(wndName, member);
|
|
|
|
sprintf(wndName, "icon_slot%02d", slotNum);
|
|
(this->*func)(wndName, member);
|
|
|
|
sprintf(wndName, "clock_slot%02d", slotNum);
|
|
(this->*func)(wndName, member);
|
|
|
|
sprintf(wndName, "static_text%02d", slotNum);
|
|
(this->*func)(wndName, textValue);
|
|
}
|
|
}
|
|
}
|
|
} |