301 lines
10 KiB
C++
301 lines
10 KiB
C++
|
|
#pragma once
|
|
//#include "SUIWnd.h"
|
|
#include "STitleMgr.h"
|
|
class SGameManager;
|
|
using namespace TITLEMGR;
|
|
class SUITitleWnd : public SUIWnd
|
|
{
|
|
public:
|
|
SUITitleWnd(SGameManager* pGameManager,SUIDisplayInfo* pDisplayInfo);
|
|
virtual ~SUITitleWnd()
|
|
{
|
|
m_vAllSlot.clear();
|
|
m_vMainSlot.clear();
|
|
m_vSubSlot.clear();
|
|
}
|
|
|
|
// 모든 호칭 슬롯에서 동일하게 사용된다.
|
|
enum TITLE_SLOT{
|
|
BACK =0,
|
|
BOOKMARK,
|
|
NAME,
|
|
USING,
|
|
GAIN
|
|
};
|
|
|
|
enum SLOT_KIND
|
|
{
|
|
NONE_SLOT = -1,
|
|
MAIN_SLOT = 0,
|
|
SUB_SLOT,
|
|
ALL_SLOT
|
|
};
|
|
|
|
// 기본 구조...
|
|
struct stBaseSlot
|
|
{
|
|
stBaseSlot() : m_pBack(NULL),m_pName(NULL),m_pUsing(NULL),m_iID(-1),m_bSelected(false){}
|
|
KUIControlStatic* m_pBack; // 뒷배경
|
|
KUIControlStatic* m_pName; // 이름
|
|
KUIControlSimpleButton* m_pUsing; // 사용여부
|
|
|
|
bool m_bSelected;
|
|
int m_iID;
|
|
|
|
bool IsInRect(int x, int y);
|
|
void SetSelectFlag(bool bFlag);
|
|
|
|
// slot의 뒷 배경의 ani를 변경해주는 함수들...
|
|
virtual void ChangeBar( bool bEquip ) = 0; // ani변경
|
|
virtual bool IsSelectSlot();
|
|
|
|
void ChangeEquipBtn( bool bEquip ); // 장착버튼 상태변경
|
|
void ChangeTitleName( const char* sz) // 이름 변경
|
|
{ m_pName->SetCaption( CStringUtil::StringFormat("<font:font_02><hcenter><vcenter><#ffffff><size:9>%s",sz).c_str() ); }
|
|
|
|
int SelectBar( bool bSelect ,bool bEquip = false); // 선택
|
|
int GetTitleID(){ return m_iID; }
|
|
void SetTitleIDReset(){ m_iID = NONE_SLOT; }
|
|
KRect GetRect() const { return m_pBack->GetRect(); }
|
|
};
|
|
|
|
// 전체 호칭 리스트 컨트롤
|
|
struct stAllSlot : public stBaseSlot
|
|
{
|
|
stAllSlot(): m_pBookMark(NULL), m_pGain(NULL){}
|
|
|
|
KUIControlStatic* m_pGain; // 획득 여부
|
|
KUIControlCheck * m_pBookMark; // 즐겨찾기
|
|
void SetSlot(bool bGain, bool Bookmark, bool bUsing, int id, int nStringID, bool bNew);
|
|
virtual bool IsSelectSlot();
|
|
void SetEmptySlot();
|
|
|
|
virtual void ChangeBar( bool bEquip );
|
|
void ChangeBookmark(bool bCheck);
|
|
void ChangeGain(bool bGain,bool bNew);
|
|
void ChangeControlState(bool bEnable);
|
|
void ShowControl(bool bShow);
|
|
};
|
|
|
|
// 사용중인 리스트 컨트롤
|
|
struct stSubSlot : public stBaseSlot
|
|
{
|
|
stSubSlot(): m_pBookMark(NULL){}
|
|
KUIControlStatic* m_pBookMark;
|
|
|
|
virtual void SetSlot(bool Bookmark, bool bUsing, int id, int nStringID);
|
|
virtual void SetShowSlot(bool bEnable);
|
|
virtual void ChangeBar( bool bEquip );
|
|
void SetEmptySlot();
|
|
void SetBookmark(bool bBookmark);
|
|
void SetStringInfo(bool bShow);
|
|
};
|
|
|
|
struct stMainSlot : public stSubSlot
|
|
{
|
|
stMainSlot(): stSubSlot(){}
|
|
|
|
virtual void SetShowSlot(bool bEnable);
|
|
virtual void ChangeBar( bool bEquip );
|
|
void SetSlot(bool Bookmark, bool bUsing, int id, int nStringID);
|
|
void SetBtnState(bool bActivate)
|
|
{ (bActivate)? m_pUsing->Enable() : m_pUsing->Disable(); }; // 버튼 상태를 바꿔준다.
|
|
};
|
|
|
|
struct stInfoSlot{
|
|
stInfoSlot():m_pBack(NULL),m_pName(NULL),m_pBookMark(NULL),m_pUsing(NULL),m_pText(NULL),m_curID(-1){}
|
|
KUIControlStatic* m_pBack; // 뒷배경
|
|
KUIControlStatic* m_pName; // 이름
|
|
KUIControlStatic * m_pBookMark; // 즐겨찾기
|
|
KUIControlStatic* m_pUsing; // 사용여부
|
|
KUIControlStatic* m_pText;
|
|
KUIControlStatic* m_pEmptyText; // 빈거 선택시 뿌려줄놈..
|
|
KUIControlVScrollSmallEx* m_pScrollInfo;
|
|
int m_curID;
|
|
|
|
void SetShow(bool bShow);
|
|
void SetInfo(const TITLEMGR::stTitleUI *ptitle);
|
|
void SetDetailText(std::string str);
|
|
void SetShowText(int pos);
|
|
bool IsSameId(int id);
|
|
std::vector<std::string> m_vString;
|
|
|
|
};
|
|
|
|
protected:
|
|
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
|
|
virtual void OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd = true );
|
|
virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam );
|
|
virtual DWORD OnMouseMessage(DWORD dwMessage, int x, int y);
|
|
//virtual bool InitData( bool bReload = false );
|
|
virtual bool InitControls( KPoint kPos );
|
|
virtual void Process(DWORD dwTime);
|
|
void InitAllSlot();
|
|
void InitUsingSlot();
|
|
void initInfoSlot();
|
|
void InitAniName();
|
|
void InitScroll();
|
|
void InitCoolTime();
|
|
|
|
void IsSlotClick(DWORD x, DWORD y); // 클릭한 위치에 슬롯이 있는지 찾아서 셀렉트 호출
|
|
bool IsInSlotRect(DWORD _x, DWORD _y, int &nKind, int &nSlotNum); // 마우스위치가 슬롯 안인지 아닌지 판단하고, 있다면 슬롯의 종류와 인덱스 저장
|
|
void IsSlotOver(DWORD x, DWORD y); // 마우스 위치에 슬롯이 있는지 체크하고 있다면 호칭 정보 갱신
|
|
void SetSlotInfo(int nKind, int nSlotNum, bool refresh = false);
|
|
void SetSlotInfoWithID(int nId, bool refresh = false);
|
|
|
|
void MoveSelectBar(int kind, int nSlot = 0); // 선택됐을 때 선택바를 이동시킨다.
|
|
void SetInfoSelect(int Kind, int nSlot = 0); // 호칭 정보 슬롯과 상세정보창의 정보를 채운다.
|
|
bool IsEmptySlot( int kind, int nSlot ); // 비어있는 슬롯인지 체크
|
|
void Refresh(); // 모든 슬롯 refresh
|
|
void RefreshAllSlot(); // 전체호칭 슬롯 refresh
|
|
void RefreshEquipSlot(); // 장착호칭 슬롯 refresh
|
|
|
|
int GetTitleID(int nKind, int nSlot);
|
|
void SetSorting(int nKind, std::string strCtrl); // 소팅
|
|
void ChangeSmall(int nKind, int nState,std::string strCtrl);
|
|
void InitList();
|
|
void SetCoolTime(int nMaxTime, int nRemain); // 쿨타임
|
|
void SetInstallSlot();
|
|
void MoveInstallSloat(int nKind, int nSlotNum = 0 );
|
|
void PumpUpTitleBtn(LPCSTR lpszID);
|
|
void SetListScrollRange(int count);
|
|
|
|
bool GetDetailInfoString(int nID, std::string& strDetailInfo);
|
|
std::string getOptionString(stTitleRes res);
|
|
std::string getGainConditionString(stTitleRes res);
|
|
|
|
void InitToolTip();
|
|
void RefreshAllSlotUnit(int id);
|
|
void SetScroll(LPCSTR lpszControlID, DWORD lparam); // 스크롤 처리
|
|
void SetAchieveCountText(); // 획득수 텍스트 처리
|
|
void SetSubTitleString(int index); // 보조호칭의 스트링 처리
|
|
private:
|
|
std::vector<stAllSlot> m_vAllSlot; // 전체 호칭 슬롯 벡터
|
|
std::vector<stSubSlot> m_vSubSlot; // 부호칭 슬롯 벡터
|
|
std::vector<stMainSlot> m_vMainSlot; // 주호칭 슬롯 벡터
|
|
stInfoSlot m_InfoSlot; // 정보 슬롯
|
|
|
|
SUIDisplayInfo* m_pDisplayInfo;
|
|
|
|
int m_iEmptySlotKind; // 현재 비어있는 인덱스와 종류
|
|
int m_iEmptySlotIndex;
|
|
|
|
KUIControlVScrollSmallEx* m_pScrollAll;
|
|
KUIControlVScrollSmallEx* m_pScrollInfo;
|
|
KUIControlStatic* m_pStaticSortDes;
|
|
KUIControlStatic* m_pStaticSortAse;
|
|
KUIControlStatic* m_pStaticInstallSlot;
|
|
KUIControlStatic* m_pListAreaCheck; // 전체 호칭 리스트 영역
|
|
KUIControlStatic* m_pEquipAeraCheck; // 장착(주,부) 리스트 영역
|
|
KUIControlStatic* m_pInfoAreaCheck; // 정보 영역
|
|
KUIControlStatic* m_pAchieveCount;
|
|
|
|
KUIControlClockBox* m_pCooltime; // 쿨타임 컨트롤
|
|
bool m_CooltimeCheck;
|
|
DWORD m_dwCooltimeRemain;
|
|
DWORD m_dwBeforeTime;
|
|
|
|
bool m_bScrollRefresh;
|
|
bool m_bFirstOpen;
|
|
int m_ScrollPos;
|
|
int m_InfoScrollPos;
|
|
int m_MouseX;
|
|
int m_MouseY;
|
|
|
|
cClassParamFuncP<SUITitleWnd, SGameMessage*, int> m_msgFp;
|
|
|
|
//gmpbigsun( 20130305 ) : 쿨타임 계산용
|
|
unsigned int m_uiReceivedTime;
|
|
|
|
public:
|
|
void fpSetMainTitle(SGameMessage *pMsg); // 주 호칭 장착, 해제
|
|
void fpSetSubTitle(SGameMessage *pMsg); // 부 호칭 장착, 해제
|
|
void fpSetAchieveTitle(SGameMessage *pMsg ); // 호칭 획득
|
|
void fpSetOpenTitle(SGameMessage *pMsg ); // 호칭 오픈
|
|
void fpSetBookmarkTitle(SGameMessage *pMsg ); // 즐겨찾기 등록 ,해제
|
|
void fpSetConditionTitle(SGameMessage *pMsg ); // 상태변경
|
|
void fpSetCooltime(SGameMessage *pMsg ); // 주호칭 해제 가능한 쿨타임
|
|
void fpMouseMove(SGameMessage *pMsg); // 마우스 위치 저장..
|
|
void fpNewTitleNotify(SGameMessage *pMsg); // 새로운 호칭 알림/ 새로운 호칭 없어짐 알림
|
|
void fpWndOpen(SGameMessage *pMsg); // 윈도우 오픈 알림 처리
|
|
void fpReset(SGameMessage *pMsg); // 리셋
|
|
|
|
void MovePosCustom(KSize size)
|
|
{
|
|
// 가운데 위치
|
|
MovePos( (size.width-GetRect().GetWidth())/2 , (size.height-GetRect().GetHeight())/2 );
|
|
}
|
|
|
|
static int m_iSelectedKind; // 이전에 선택된 슬롯의 종류
|
|
static int m_iSelectedSlot; // 이전에 선택된 슬롯번호
|
|
static int m_iSelcetedID; // 이전에 선택된 호칭 아이디
|
|
|
|
static void setSelectedSlot( int slot ) { m_iSelectedSlot = slot; }
|
|
static void setSelectedID(int id) { m_iSelcetedID = id; }
|
|
static void setSelectiedKind(int kind) { m_iSelectedKind = kind; }
|
|
|
|
void OpenTitleWnd(); // 윈도우를 닫기전에 처리할것을 처리하고 닫는다.
|
|
};
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
namespace{
|
|
enum TITLE_DATA{
|
|
STATE_WAIT = 0, // 대기 상태
|
|
STATE_SHOW = 1, // 보여지고 있는 상태
|
|
STATE_FADE = 2, // 페이드 아웃인 상태
|
|
};
|
|
|
|
enum TITLE_ALPHA
|
|
{
|
|
ALPHA_DEC, // 감소 시킨다.
|
|
ALPHA_1, // 알파값 1.0
|
|
};
|
|
|
|
const std::string c_strTitleNotifyTag = "<font:font_02><out><size:16><hcenter><#05c5d1>"; // 앞부분 캡션
|
|
const DWORD c_dwShowTime = 4000; // 알림창 유지 시간 millisecond 단위
|
|
const float c_fFadeSpeed = 2.0f; // 페이드 속도
|
|
|
|
struct stTitleList{
|
|
stTitleList()
|
|
:strTitleName(""),dwBeforeTime(0),nState(TITLE_DATA::STATE_WAIT){}
|
|
|
|
std::string strTitleName;
|
|
DWORD dwBeforeTime;
|
|
int nState;
|
|
};
|
|
|
|
};
|
|
|
|
class SUITitleGainResultWnd : public SUIWnd
|
|
{
|
|
public:
|
|
SUITitleGainResultWnd(SGameManager* pGameManager);
|
|
virtual ~SUITitleGainResultWnd(){}
|
|
|
|
virtual bool InitData( bool bReload /* = false */ );
|
|
|
|
protected:
|
|
|
|
virtual void Process(DWORD dwTime);
|
|
virtual void ProcMsgAtStatic( SGameMessage* pMsg );
|
|
|
|
private:
|
|
|
|
KUIControlStatic* m_pShowText; // 출력 스트링
|
|
KUIControlStatic* m_pOutFrame; // 배경
|
|
std::vector<stTitleList> m_vTitle;
|
|
|
|
float m_fTitleAlpha;
|
|
DWORD m_dwStartTime;
|
|
public:
|
|
|
|
bool IsTitleRemain();
|
|
void PushTitle( std::string str );
|
|
|
|
void SetAlpha(int type, DWORD dwTime = 0);
|
|
float AlphaTimeCal(DWORD dwTime);
|
|
void MovePosCustom(KSize size);
|
|
//void ShowTitleResultNUI();
|
|
};
|