diff --git a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index 5495075f9..60c0ef454 100644 --- a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -2426,6 +2426,100 @@ PS_OUT PS_BoosterHpBar(PS_IN In) return Out; } +PS_OUT PS_DialogueChoice(PS_IN In) +{ + PS_OUT Out = (PS_OUT) 0; + float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; + float4 Color = float4(1.f, 1.f, 1.f, 0.f); + float2 uv = In.vTexcoord; + float2 CurrentPixelPosition = uv * g_fCurrent_Size; + float OriginLeft = g_fNine_Slice.x; + float OriginRight = g_fNine_Slice.y; + float OriginTop = g_fNine_Slice.z; + float OriginBottom = g_fNine_Slice.w; + + float CurrentLeft = OriginLeft; + float CurrentRight = g_fCurrent_Size.x - (g_fOrigin_Size.x - OriginRight); + float CurrentTop = OriginTop; + float CurrentBottom = g_fCurrent_Size.y - (g_fOrigin_Size.y - OriginBottom); + + float2 Finaluv = In.vTexcoord; + + if (CurrentPixelPosition.x < CurrentLeft) + { + Finaluv.x = CurrentPixelPosition.x / g_fOrigin_Size.x; + } + else if (CurrentPixelPosition.x > CurrentRight) + { + float dist = CurrentPixelPosition.x - CurrentRight; + Finaluv.x = (OriginRight + dist) / g_fOrigin_Size.x; + } + else + { + float scale = (CurrentPixelPosition.x - CurrentLeft) / (CurrentRight - CurrentLeft); + Finaluv.x = (OriginLeft / g_fOrigin_Size.x) + scale * ((OriginRight - OriginLeft) / g_fOrigin_Size.x); + } + + if (CurrentPixelPosition.y < CurrentTop) + { + Finaluv.y = CurrentPixelPosition.y / g_fOrigin_Size.y; + } + else if (CurrentPixelPosition.y > CurrentBottom) + { + float dist = CurrentPixelPosition.y - CurrentBottom; + Finaluv.y = (OriginBottom + dist) / g_fOrigin_Size.y; + } + else + { + float scale = (CurrentPixelPosition.y - CurrentTop) / (CurrentBottom - CurrentTop); + Finaluv.y = (OriginTop / g_fOrigin_Size.y) + scale * ((OriginBottom - OriginTop) / g_fOrigin_Size.y); + } + + + if (g_iHover != 0) + { + float4 tex = g_Texture.Sample(ClampSampler, Finaluv); + Color = tex; + + float2 ImgaePos1 = g_fImageSipos1.xy; + float2 ImgaeSize1 = g_fImageSipos1.zw; + float2 ImgaePixel = Finaluv * g_fOrigin_Size; + float2 localUV = (ImgaePixel - ImgaePos1) / ImgaeSize1; + bool inside = all(localUV >= 0.0f && localUV <= 1.0f); + if (inside) + { + float4 tex2 = g_Texture1.Sample(ClampSampler, localUV); + Color = lerp(Color, tex2, tex2.a); + } + + float2 ImgaePos2 = g_fImageSipos2.xy; + float2 ImgaeSize2 = g_fImageSipos2.zw; + float2 ImgaePixe2 = Finaluv * g_fOrigin_Size; + float2 ReverseUV = (ImgaePixe2 - ImgaePos2) / ImgaeSize2; + bool inside2 = all(ReverseUV >= 0.0f && ReverseUV <= 1.0f); + if (inside2) + { + ReverseUV.y = 1.f - ReverseUV.y; + float4 tex2 = g_Texture1.Sample(ClampSampler, ReverseUV); + Color = lerp(Color, tex2, tex2.a); + } + } + + float2 ImgaePos3 = g_fImageSipos3.xy / g_fCurrent_Size; + float2 ImgaeSize3 = g_fImageSipos3.zw / g_fCurrent_Size; + float2 localUV2 = (In.vTexcoord - ImgaePos3) / ImgaeSize3; + bool inside3 = all(localUV2 >= 0.0f && localUV2 <= 1.0f); + if (inside3) + { + float4 tex2 = g_Texture2.Sample(ClampSampler, localUV2); + Color = lerp(Color, tex2, tex2.a); + } + + Color.a *= Alpha; + Out.vColor = Color; + return Out; +} + struct VS_IN3D { float3 vPosition : POSITION; @@ -3206,6 +3300,16 @@ technique11 PosTexTechnique11 PixelShader = compile ps_5_0 PS_BoosterHpBar(); } + pass DialogueChoice + { + SetRasterizerState(RS_Nocull); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_MAIN(); + + PixelShader = compile ps_5_0 PS_DialogueChoice(); + } + pass Enemy_Detection { SetRasterizerState(RS_Nocull); diff --git a/Jusin154_Team3D/Client/Private/Dialogue.cpp b/Jusin154_Team3D/Client/Private/Dialogue.cpp index aa0095f1a..861f45413 100644 --- a/Jusin154_Team3D/Client/Private/Dialogue.cpp +++ b/Jusin154_Team3D/Client/Private/Dialogue.cpp @@ -181,7 +181,6 @@ void CDialogue::SizeUpdate(_wstring pName, _wstring pText) void CDialogue::Set_Time(_float fTime) { - m_bHover = true; m_fTime = fTime; } diff --git a/Jusin154_Team3D/Client/Private/Dialogue_Data.cpp b/Jusin154_Team3D/Client/Private/Dialogue_Data.cpp index f71bc98f4..ce8d72c9f 100644 --- a/Jusin154_Team3D/Client/Private/Dialogue_Data.cpp +++ b/Jusin154_Team3D/Client/Private/Dialogue_Data.cpp @@ -44,9 +44,7 @@ HRESULT CDialogue_Data::Load_SpellInfo(const _char* pFilePath) DialogueInfo line{}; pLine->QueryIntAttribute("ID", &line.iLineID); - int type = 0; - pLine->QueryIntAttribute("Type", &type); - line.bType = (type == 1); + pLine->QueryIntAttribute("Type", &line.iTextType); const char* text = pLine->Attribute("Text"); if (text) line.pText = CMyTools::ToWstring(text); @@ -81,7 +79,7 @@ HRESULT CDialogue_Data::Load_SpellInfo(const _char* pFilePath) return S_OK; } -const NPCDIALOGUEINFO& CDialogue_Data::Get_Info(_wstring NpcName) const +const CURRENTDIALOGUEINFO& CDialogue_Data::Get_Info(_wstring NpcName, _int iTextID) const { auto iter = m_DialogueInfo.find(NpcName); if (iter == m_DialogueInfo.end()) @@ -89,7 +87,13 @@ const NPCDIALOGUEINFO& CDialogue_Data::Get_Info(_wstring NpcName) const return Dummy; } - return iter->second; + auto Text = iter->second.Info.find(iTextID); + if (Text == iter->second.Info.end()) + { + return Dummy; + } + + return Text->second; } CDialogue_Data* CDialogue_Data::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) diff --git a/Jusin154_Team3D/Client/Private/Dialogue_Font.cpp b/Jusin154_Team3D/Client/Private/Dialogue_Font.cpp index 6ce9e85f9..a3ed45d57 100644 --- a/Jusin154_Team3D/Client/Private/Dialogue_Font.cpp +++ b/Jusin154_Team3D/Client/Private/Dialogue_Font.cpp @@ -23,9 +23,9 @@ HRESULT CDialogue_Font::Initialize_Prototype() HRESULT CDialogue_Font::Initialize(void* pArg) { m_pInfoInstance->Add_Event(TEXT("Dialogue"), [this](void* p) {this->Add_Text(p); }); - m_pInfoInstance->Add_Event(TEXT("NpcInteract"), [this](void* p) {this->NpcInteract(*reinterpret_cast<_bool*>(p)); }); m_pInfoInstance->Add_Event(TEXT("NPCInteractionOn"), [this](void* p) {this->NpcInfo(p); }); + m_pInfoInstance->Add_Event(TEXT("NPCDialogue"), [this](void* p) {this->NpcDialogue(reinterpret_cast(p)); }); for (_int i = 0; i < 5; ++i) { @@ -46,6 +46,38 @@ void CDialogue_Font::Priority_Update(_float fTimeDelta) void CDialogue_Font::Update(_float fTimeDelta) { + if (m_bNpcInteract == false) + { + if (m_bCurrentInteract == true) + m_bCurrentInteract = false; + } + + if (m_bNpcInteract != m_bCurrentInteract) + { + m_bCurrentInteract = m_bNpcInteract; + NpcDialogue(); + Npc_Dialogue(m_Info); + } + + if (m_bCurrentInteract == true) + { + if (m_pGameInstance->Key_Down(DIK_RETURN)) + { + switch (m_iType) + { + case 0: + NextText(); + break; + case 1: + CHoice(); + break; + default: + break; + } + } + + } + if (!m_pCurrentDialogue.empty()) { for (auto it = m_pCurrentDialogue.begin(); it != m_pCurrentDialogue.end();) @@ -62,24 +94,11 @@ void CDialogue_Font::Update(_float fTimeDelta) } } } - - if (m_bNpcInteract != m_bCurrentInteract) - { - m_bCurrentInteract = m_bNpcInteract; - m_pInfoInstance->Get_Dialogue(m_pNpcName); - } - - if (m_bNpcInteract == false) - { - if (m_bCurrentInteract == true) - m_bCurrentInteract = false; - } - } void CDialogue_Font::Late_Update(_float fTimeDelta) { - if (!m_DialoguInfo.empty()) + if (!m_pCurrentDialogue.empty()) { m_pGameInstance->Add_RenderGroup(RENDER::UI_OVERLAY, this); } @@ -136,6 +155,35 @@ void CDialogue_Font::Add_Text(void* pArg) Dialogue->SizeUpdate(pInfo.pName, pInfo.pText); Dialogue->Visible(true); Dialogue->Set_Time(pInfo.fTime); + Dialogue->Set_Hover(true); + + m_pCurrentDialogue.push_front(Dialogue); +} + +void CDialogue_Font::Npc_Dialogue(DIALOGUEINFO Info) +{ + if (m_DialoguInfo.empty() == true) + return; + + if (m_pCurrentDialogue.size() >= 5) + { + CDialogue* old = m_pCurrentDialogue.back(); + m_pCurrentDialogue.pop_back(); + m_DialoguInfo.push_back(old); + } + + CDialogue* Dialogue = m_DialoguInfo.back(); + m_DialoguInfo.pop_back(); + + for (auto& it : m_pCurrentDialogue) + { + it->Up(); + } + + Dialogue->SizeUpdate(Info.pName, Info.pText); + Dialogue->Visible(true); + Dialogue->Set_Time(Info.fTime); + Dialogue->Set_Hover(true); m_pCurrentDialogue.push_front(Dialogue); } @@ -152,6 +200,63 @@ void CDialogue_Font::NpcInteract(_bool bInteract) m_bNpcInteract = bInteract; } +void CDialogue_Font::NpcDialogue() +{ + auto Info = m_pInfoInstance->Get_Dialogue(m_pNpcName, m_iTextID); + m_Info.pName = m_pNpcName; + m_Info.pText = Info.pText; + m_Info.fTime = 99999.f; + m_iType = Info.iTextType; + m_iNextID = Info.NextTextID; +} + +void CDialogue_Font::NpcDialogue(CNPCStat* Stat) +{ + auto Info = m_pInfoInstance->Get_Dialogue(Stat->Get_Stat().pName, 0); + m_Info.pName = Stat->Get_Stat().pNpc_Name; + m_Info.pText = Info.pText; + m_Info.fTime = 3.f; + m_iType = Info.iTextType; + m_iNextID = Info.NextTextID; + Npc_Dialogue(m_Info); +} + +void CDialogue_Font::CHoice() +{ + auto Info = m_pInfoInstance->Get_Dialogue(m_pNpcName, m_iTextID); + // Info.ChoiceInfo.size(); +} + +void CDialogue_Font::Shop() +{ +} + +void CDialogue_Font::SpellLearn() +{ +} + +void CDialogue_Font::NextText() +{ + if (m_iNextID == -1) + { + m_pCurrentDialogue[0]->Set_Hover(false); + _bool Interact = false; + m_pInfoInstance->Event_CallBack(TEXT("NpcInteract"), &Interact); + m_pCurrentDialogue[0]->Set_Hover(true); + } + else + { + m_pCurrentDialogue[0]->Set_Hover(false); + m_iTextID = m_iNextID; + NpcDialogue(); + Npc_Dialogue(m_Info); + if (m_iNextID == -1) + { + m_bEndText = true; + } + } +} + CDialogue_Font* CDialogue_Font::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CDialogue_Font* pInstance = new CDialogue_Font(pDevice, pContext); diff --git a/Jusin154_Team3D/Client/Private/InfoInstance.cpp b/Jusin154_Team3D/Client/Private/InfoInstance.cpp index edac1466e..e84b4abf8 100644 --- a/Jusin154_Team3D/Client/Private/InfoInstance.cpp +++ b/Jusin154_Team3D/Client/Private/InfoInstance.cpp @@ -36,7 +36,6 @@ void CInfoInstance::Change_Level() m_pMapInfo->Change_Level(); m_pSkillInfo->Change_Level(); m_pInteractiveInfo->Change_Level(); - UI_Event.clear(); } CStat* CInfoInstance::Get_PlayerStatPtr() @@ -348,9 +347,9 @@ _int CInfoInstance::Get_SpellLearnIndex() // m_pDialogue_Font->Add_Text(pArg); //} -const NPCDIALOGUEINFO& CInfoInstance::Get_Dialogue(_wstring NpcName) const +const CURRENTDIALOGUEINFO& CInfoInstance::Get_Dialogue(_wstring NpcName, _int iTextID) const { - return m_pDialogue_Data->Get_Info(NpcName); + return m_pDialogue_Data->Get_Info(NpcName, iTextID); } HRESULT CInfoInstance::Regist_ActiveInteractive(CMapElement_Interactable* pInteractive) diff --git a/Jusin154_Team3D/Client/Private/Level_Field.cpp b/Jusin154_Team3D/Client/Private/Level_Field.cpp index 4820a3961..5cb600dfe 100644 --- a/Jusin154_Team3D/Client/Private/Level_Field.cpp +++ b/Jusin154_Team3D/Client/Private/Level_Field.cpp @@ -61,6 +61,9 @@ HRESULT CLevel_Field::Initialize(void* pArg) return E_FAIL; } + m_bLevel = true; + m_pInfoInstance->Event_CallBack(TEXT("UIManagerFadeIn")); + return S_OK; } @@ -85,6 +88,16 @@ void CLevel_Field::Update(_float fTimeDelta) return; } } + + + if (m_bLevel != m_bCurrentLevel) + { + m_bCurrentLevel = m_bLevel; + UI_STATE eState = UI_STATE::GAMEPLAYER; + m_pInfoInstance->Event_CallBack(TEXT("Canvas_Change"), &eState); + } + + } HRESULT CLevel_Field::Render() @@ -158,7 +171,7 @@ HRESULT CLevel_Field::Ready_Lights() _float4 vDiffuse = _float4(0.745f, 0.797f, 0.8f, 0.f); _float4 vAmbient = _float4(0.1f, 0.13f, 0.13f, 0.f); _float4 vSpecular = _float4(0.05f, 0.05f, 0.05f, 0.f); - + #if gimch || 진우 vDiffuse = _float4(0.361f, 0.451f, 0.451f, 0.204f); vAmbient = _float4(0.161f, 0.161f, 0.161f, 0.0f); @@ -166,7 +179,7 @@ HRESULT CLevel_Field::Ready_Lights() #endif // gimch - + pLight->Get_Component()->Set_Color(vDiffuse, vAmbient, vSpecular); diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 49cd0d828..de14f73e4 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -116,10 +116,13 @@ HRESULT CLevel_GamePlay::Initialize(void* pArg) if (FAILED(Ready_Layer_Monster())) { return E_FAIL; } - - if(FAILED(m_pInfoInstance->Late_Initialize())) + + if (FAILED(m_pInfoInstance->Late_Initialize())) return E_FAIL; + m_bLevel = true; + m_pInfoInstance->Event_CallBack(TEXT("UIManagerFadeIn")); + return S_OK; } @@ -131,6 +134,7 @@ HRESULT CLevel_GamePlay::Initialize() void CLevel_GamePlay::Update(_float fTimeDelta) { + if (m_pGameInstance->Key_Pressing(DIK_0)) { if (m_pGameInstance->Key_Up(DIK_1)) { @@ -142,6 +146,10 @@ void CLevel_GamePlay::Update(_float fTimeDelta) if (true == m_pGameInstance->Check_LevelShouldChange()) { m_pInfoInstance->Change_Level(); + + UI_STATE eState = UI_STATE::LEVELCHANGE; + m_pInfoInstance->Event_CallBack(TEXT("Canvas_Change"), &eState); + if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::FIELD)))) { return; } @@ -220,7 +228,7 @@ HRESULT CLevel_GamePlay::Ready_Lights() HRESULT CLevel_GamePlay::Ready_Volumetric() { // Volumetric 설정 - if(m_isDay) + if (m_isDay) { m_pGameInstance->Setting_Volumetirc( 1.251f, // 밀도 @@ -271,7 +279,7 @@ HRESULT CLevel_GamePlay::Ready_Background() if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::STATIC), NEXT_LEVEL, LAYER_BACKGROUND, &Terrain_Desc))) { return E_FAIL; } - + /* 물 오브젝트 */ if (FAILED(CInfoInstance::GetInstance()->Load_WaterElemet("Element_Water_Info"))) { return E_FAIL; @@ -314,9 +322,9 @@ HRESULT CLevel_GamePlay::Ready_Background() #endif // _DEBUG - + /* Map Containters */ - if(false == isReady_Background) + if (false == isReady_Background) { /* 테스트용 맵 */ CInfoInstance::GetInstance()->Load_MapObjects("Map1215", LAYER_HOGSMEADE); @@ -341,10 +349,12 @@ HRESULT CLevel_GamePlay::Ready_Background() return E_FAIL; } + + if (FAILED(Ready_IntstanceProp())) return E_FAIL; } - + return S_OK; } @@ -823,7 +833,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) #endif // Bin #endif // _DEBUG - if(true == isLoad_NPC) + if (true == isLoad_NPC) { { CNPC_Ollivander::NPCDESC NPCDesc{}; @@ -859,6 +869,13 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) } } } + + CPlayer::PLAYERDESC playerDesc = {}; + playerDesc.vPos = _float4(-21.f, 0.f, -14.f, 1.f); + playerDesc.vRotQ = _float4(0.f, 0.f, 0.f, 1.f); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &playerDesc))) { + return E_FAIL; + } } CHuman_Duelist::DUELISTDESC DuelistDesc = {}; DuelistDesc.vPos = _float4(-21.f, 0.f, -16.f, 1.f); @@ -964,7 +981,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Monster() HRESULT CLevel_GamePlay::Ready_Layer_Manager(const _wstring& strLayerTag) { - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag,nullptr,nullptr,&m_pBroomRaceManager))) { + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, nullptr, nullptr, &m_pBroomRaceManager))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/RandomNpc.cpp b/Jusin154_Team3D/Client/Private/RandomNpc.cpp index f52a30626..217e8d4bc 100644 --- a/Jusin154_Team3D/Client/Private/RandomNpc.cpp +++ b/Jusin154_Team3D/Client/Private/RandomNpc.cpp @@ -82,6 +82,38 @@ void CRandomNpc::Update(_float fTimeDelta) m_pRigidBody->Set_Position(m_pTransformCom->Get_State(STATE::POSITION), true); m_pInfoInstance->Set_PlayerPos(m_pTransformCom->Get_State(STATE::POSITION)); + + _vector vCurrentPos = Get_WorldPostion(); + pair pairTarget = m_pInfoInstance->Get_NearestPlayerAlly(vCurrentPos); + if (nullptr != pairTarget.first) { + Set_Target(*pairTarget.first, *pairTarget.second); + } + if (nullptr != m_pTarget && m_pTarget->isDead()) { + SAFE_RELEASE(m_pTarget); + m_fTargetDistance = { FLT_MAX }; + } + + if (m_fTargetDistance <= 5.f && m_bInteract == false) + { + m_pInfoInstance->Event_CallBack(TEXT("NPCDialogue"), m_pNpcStat); + m_bInteract = true; + } + + if (m_bInteract != m_bPreviousInteract) + { + m_bPreviousInteract = m_bInteract; + m_fInteractTime = 0.f; + } + else + { + m_fInteractTime += fTimeDelta; + } + + if (m_fInteractTime >= 5.f) + { + m_bInteract = false; + m_fInteractTime = 0.f; + } } void CRandomNpc::Late_Update(_float fTimeDelta) @@ -96,6 +128,7 @@ void CRandomNpc::Late_Update(_float fTimeDelta) Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius())); + __super::Late_Update(fTimeDelta); } @@ -193,6 +226,25 @@ _wstring CRandomNpc::Get_Name() return m_pNpcStat->Get_Stat().pNpc_Name; } +_wstring CRandomNpc::Get_NpcName() +{ + return m_pNpcStat->Get_Stat().pName; +} + +void CRandomNpc::Set_Target(CUnit& pTarget, CTransform& pTransform) +{ + SAFE_RELEASE(m_pTarget); + m_pTarget = &pTarget; + SAFE_ADDREF(m_pTarget); + + _vector vTargetPos = pTransform.Get_State(STATE::POSITION); + _vector vToTargetDir = vTargetPos - Get_WorldPostion(); + XMStoreFloat4(&m_vTargetPos, vTargetPos); + XMStoreFloat3(&m_vToTargetDir, XMVector3Normalize(vToTargetDir)); + m_fTargetDistance = XMVectorGetX(XMVector3Length(vToTargetDir)); +} + + HRESULT CRandomNpc::Bind_ShaderResources() { if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { @@ -227,7 +279,7 @@ HRESULT CRandomNpc::Bind_ShaderParameters(_uint iMeshOrder) _float fMixerFactor = { FLT_MAX }; _uint iColorMixerMethod = { 0 }; - switch (m_pModelCom->Get_UsingPass(iMeshOrder,m_pShaderCom)) + switch (m_pModelCom->Get_UsingPass(iMeshOrder, m_pShaderCom)) { case 23: if (m_strModelPrototypeTag == TEXT("Prototype_Component_F_Student_Model")) @@ -272,7 +324,7 @@ HRESULT CRandomNpc::Ready_Components(void* pArg) if (FAILED(__super::Ready_Components(&Desc))) { return E_FAIL; } - + switch (m_iIndex) { case 0: @@ -316,7 +368,7 @@ HRESULT CRandomNpc::Ready_Components(void* pArg) if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("ELF"), (CComponent**)&m_pNpcStat))) { return E_FAIL; } - break; + break; case 7: m_strModelPrototypeTag = TEXT("Prototype_Component_BaiHowin_Model"); if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("BAIHOWIN"), (CComponent**)&m_pNpcStat))) { @@ -418,6 +470,7 @@ void CRandomNpc::Free() SAFE_RELEASE(m_pCharacter_Controller); SAFE_RELEASE(m_pNpcStat); SAFE_RELEASE(m_pRigidBody); + SAFE_RELEASE(m_pTarget); if (nullptr != m_pInfoInstance) { CInfoInstance* pInfo = m_pInfoInstance; m_pInfoInstance = nullptr; diff --git a/Jusin154_Team3D/Client/Private/Ride_Info.cpp b/Jusin154_Team3D/Client/Private/Ride_Info.cpp index 3a960bd86..149771879 100644 --- a/Jusin154_Team3D/Client/Private/Ride_Info.cpp +++ b/Jusin154_Team3D/Client/Private/Ride_Info.cpp @@ -64,6 +64,7 @@ void CRide_Info::Set_Hover(_bool bVisible) m_bHover = true; m_fTime = 0.f; m_fAlpha = 1.f; + m_bFadeOut = false; } void CRide_Info::Priority_Update(_float fTimeDelta) diff --git a/Jusin154_Team3D/Client/Private/Ride_InfoBG.cpp b/Jusin154_Team3D/Client/Private/Ride_InfoBG.cpp index 18569970b..4c9b7bfc9 100644 --- a/Jusin154_Team3D/Client/Private/Ride_InfoBG.cpp +++ b/Jusin154_Team3D/Client/Private/Ride_InfoBG.cpp @@ -49,6 +49,7 @@ void CRide_InfoBG::Set_Hover(_bool bVisible) m_bHover = true; m_fTime = 0.f; m_fAlpha = 1.f; + m_bFadeOut = false; } void CRide_InfoBG::Priority_Update(_float fTimeDelta) diff --git a/Jusin154_Team3D/Client/Private/UI_Manager.cpp b/Jusin154_Team3D/Client/Private/UI_Manager.cpp index 181b8224f..b928d8a1b 100644 --- a/Jusin154_Team3D/Client/Private/UI_Manager.cpp +++ b/Jusin154_Team3D/Client/Private/UI_Manager.cpp @@ -59,6 +59,7 @@ HRESULT CUI_Manager::Initialize(void* pArg) m_pInfoInstance->Set_UISTATE(m_eType); m_pInfoInstance->Add_Event(TEXT("Canvas_Change"), [this](void* p) {this->Canvas_Change(*reinterpret_cast(p)); }); m_pInfoInstance->Add_Event(TEXT("NpcInteract"), [this](void* p) {this->NpcInteract(*reinterpret_cast<_bool*>(p)); }); + m_pInfoInstance->Add_Event(TEXT("UIManagerFadeIn"), [this](void* p) {this->Set_Fade(); }); return S_OK; } @@ -77,8 +78,6 @@ void CUI_Manager::Canvas_Change(UI_STATE eType) static_cast(m_pSpellLearn_Canvas)->Visible(false); static_cast(m_pInteraction_Key)->Set_Visible(true); static_cast(m_pNPCInteraction)->Set_Visible(true); - static_cast(m_pBroom_TargetGate)->Set_Visible(true); - static_cast(m_pDamage_Font)->Set_Visible(true); break; case UI_STATE::SPELL: @@ -118,6 +117,19 @@ void CUI_Manager::Canvas_Change(UI_STATE eType) static_cast(m_pDamage_Font)->Set_Visible(false); break; + case UI_STATE::LEVELCHANGE: + m_pMouse_Cursor->Set_Visible(false); + m_pCamera_LockOn->Set_Visible(false); + static_cast(m_pGamePlay_Canves)->Visible(false); + static_cast(m_pSpell_Canvas)->Visible(false); + static_cast(m_pQuest_Canvas)->Visible(false); + static_cast(m_pSpellLearn_Canvas)->Visible(false); + static_cast(m_pInteraction_Key)->Set_Visible(false); + static_cast(m_pNPCInteraction)->Set_Visible(false); + static_cast(m_pBroom_TargetGate)->Set_Visible(false); + static_cast(m_pDamage_Font)->Set_Visible(false); + break; + default: return; } @@ -210,21 +222,26 @@ void CUI_Manager::Update(_float fTimeDelta) if (m_eType == UI_STATE::GAMEPLAYER && m_bNPCInteract == true) { + if (m_bCurrentNPCInteract != m_bNPCInteract) + m_bCurrentNPCInteract = m_bNPCInteract; + if (m_eType == UI_STATE::GAMEPLAYER) { Canvas_Change(UI_STATE::NPC_INTERACT); } + } - else + if (m_bCurrentNPCInteract == true && m_bNPCInteract == false) + { + m_bCurrentNPCInteract = m_bNPCInteract; + + if (m_bActive == false) { - if (m_bActive == false) + m_bActive = true; + m_bAlphaZero = true; + if (m_eType == UI_STATE::NPC_INTERACT) { - m_bActive = true; - m_bAlphaZero = true; - if (m_eType == UI_STATE::GAMEPLAYER) - { - m_eType = UI_STATE::NPC_INTERACT; - } + m_eType = UI_STATE::GAMEPLAYER; } } } @@ -404,7 +421,7 @@ HRESULT CUI_Manager::Ready_Components(void* pArg) } Add_Canvas(TEXT("NPCInteraction"), m_pNPCInteraction); - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, g_iStaticLevel, LAYER_UI, nullptr, this, reinterpret_cast (&m_pBroom_TargetGate)))) + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast (&m_pBroom_TargetGate)))) { return E_FAIL; } @@ -445,6 +462,14 @@ void CUI_Manager::NpcInteract(_bool bInteract) m_bNPCInteract = bInteract; } +void CUI_Manager::Set_Fade() +{ + m_fAlpha = 1.5f; + m_bActive = true; + m_bHover = true; + m_bCgangede = true; +} + CUI_Manager* CUI_Manager::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CUI_Manager* pInstance = new CUI_Manager(pDevice, pContext); diff --git a/Jusin154_Team3D/Client/Public/Client_Enum.h b/Jusin154_Team3D/Client/Public/Client_Enum.h index 4f9e75bc9..a5ceaad2d 100644 --- a/Jusin154_Team3D/Client/Public/Client_Enum.h +++ b/Jusin154_Team3D/Client/Public/Client_Enum.h @@ -36,10 +36,12 @@ namespace Client PLAYER_HAIR_DAOTHV_ToSRO, PLAYER_Suit_DSRON_ToSRO, PLAYER_EyeLash_DAOTHV_ToSRO, PLAYER_Eye_ToSRO, PLAYER_Robe_ToMRO, SHADOW, SHADOW_LEGACY , END }; - enum class UI_STATE { GAMEPLAYER, SPELL, QUEST, INVENTORY, SPELLLNEARN, NPC_INTERACT, END }; + enum class UI_STATE { GAMEPLAYER, SPELL, QUEST, INVENTORY, SPELLLNEARN, + NPC_INTERACT, LEVELCHANGE, END }; enum class QUESTTYPE { MAIN, SUB, END }; enum class QUESTSTATE {NONE, ACCEPTED, CLEARED, END }; + enum class NPCTEXTTYPE {NEXTTEXT, CHOICETEXT, SHOPTEXT, QUESTTEXT, SPELLLEAN, END}; enum class EFFECT_TYPE { EFFECT, TRAIL, END }; diff --git a/Jusin154_Team3D/Client/Public/Client_Struct.h b/Jusin154_Team3D/Client/Public/Client_Struct.h index f397d777f..c3bc574a0 100644 --- a/Jusin154_Team3D/Client/Public/Client_Struct.h +++ b/Jusin154_Team3D/Client/Public/Client_Struct.h @@ -1,8 +1,8 @@ #pragma once NS_BEGIN(Engine) - class CModel; - class CRigidBody_Static; - class CUnit; +class CModel; +class CRigidBody_Static; +class CUnit; NS_END namespace Client @@ -39,7 +39,7 @@ namespace Client typedef struct DialogueChoice { - _int eType = {false}; + _int eType = { false }; _wstring pText; _int NextTypeID{}; }DIALOGUECHOICEINFO; @@ -47,7 +47,7 @@ namespace Client typedef struct DialogueInfo { _int iLineID{}; - _bool bType = {false}; + _int iTextType{}; _wstring pText; _int NextTextID{}; vector ChoiceInfo; @@ -57,7 +57,7 @@ namespace Client { _wstring pNpcName; _int iNpcID{}; - unordered_map<_int, CURRENTDIALOGUEINFO> Info; + map<_int, CURRENTDIALOGUEINFO> Info; }NPCDIALOGUEINFO; typedef struct tagLockOnInfo { @@ -68,7 +68,7 @@ namespace Client typedef struct tegNPCInteractionInfo { - CGameObject* pOwner = { nullptr }; + CGameObject* pOwner = { nullptr }; _wstring pNPCName; _wstring pName; _float4 fNPCPosition{}; @@ -285,7 +285,7 @@ namespace Client _float4 vPadding5 = {}; _float4 vPadding6 = {}; }EFFECT_INFO; - + typedef struct tagTrailInfo { EFFECT_TYPE eEffectType = { EFFECT_TYPE::TRAIL }; diff --git a/Jusin154_Team3D/Client/Public/Dialogue_Data.h b/Jusin154_Team3D/Client/Public/Dialogue_Data.h index 0e33c3d1e..55e6eeb8b 100644 --- a/Jusin154_Team3D/Client/Public/Dialogue_Data.h +++ b/Jusin154_Team3D/Client/Public/Dialogue_Data.h @@ -25,14 +25,14 @@ class CDialogue_Data final : public CBase HRESULT Load_SpellInfo(const _char* pFilePath); public: - const NPCDIALOGUEINFO& Get_Info(_wstring NpcName) const; + const CURRENTDIALOGUEINFO& Get_Info(_wstring NpcName, _int iTextID) const; private: CInfoInstance* m_pInfoInstance = { nullptr }; _int m_iDialogue_Count{}; map<_wstring, NPCDIALOGUEINFO> m_DialogueInfo; - NPCDIALOGUEINFO Dummy{}; + CURRENTDIALOGUEINFO Dummy{}; private: HRESULT Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex); diff --git a/Jusin154_Team3D/Client/Public/Dialogue_Font.h b/Jusin154_Team3D/Client/Public/Dialogue_Font.h index 0f36f010b..6a89809c2 100644 --- a/Jusin154_Team3D/Client/Public/Dialogue_Font.h +++ b/Jusin154_Team3D/Client/Public/Dialogue_Font.h @@ -8,6 +8,7 @@ NS_BEGIN(Engine) class CTexture; class CShader; class CVIBuffer_Rect; +class CNPCStat; NS_END NS_BEGIN(Client) @@ -40,23 +41,39 @@ class CDialogue_Font final : public CGameObject public: void Add_Text(void* pArg); - + void Npc_Dialogue(DIALOGUEINFO Info); private: void NpcInfo(void* pArg); void NpcInteract(_bool bInteract); + void NpcDialogue(); + void NpcDialogue(CNPCStat* Stat); + + void CHoice(); + + void Shop(); + void SpellLearn(); + void NextText(); private: CInfoInstance* m_pInfoInstance = { nullptr }; class CDialogue* m_pDialogue = { nullptr }; + DIALOGUEINFO m_Info; + vector m_DialoguInfo; deque m_pCurrentDialogue; _bool m_bNpcInteract = { false }; _bool m_bCurrentInteract = { false }; + _bool m_bEndText = { false }; + _bool m_bNextText = { false }; + _wstring m_pNpcName; _int m_iTextID{}; + _int m_iNextID{}; + _int m_iType{}; + public: static CDialogue_Font* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Client/Public/InfoInstance.h b/Jusin154_Team3D/Client/Public/InfoInstance.h index 654c9123b..cc3505e0c 100644 --- a/Jusin154_Team3D/Client/Public/InfoInstance.h +++ b/Jusin154_Team3D/Client/Public/InfoInstance.h @@ -89,7 +89,7 @@ DECLARE_SINGLETON(CInfoInstance) #pragma endregion #pragma region Dialogue_Font //void Set_Font(void* pArg); - const NPCDIALOGUEINFO& Get_Dialogue(_wstring NpcName) const; + const CURRENTDIALOGUEINFO& Get_Dialogue(_wstring NpcName, _int iTextID) const; #pragma endregion HRESULT Regist_ActiveInteractive(class CMapElement_Interactable* pInteractive); HRESULT Deregist_ActiveInteractive(class CMapElement_Interactable* pInteractive); diff --git a/Jusin154_Team3D/Client/Public/Level_Field.h b/Jusin154_Team3D/Client/Public/Level_Field.h index 978ec5d8b..df9d3463f 100644 --- a/Jusin154_Team3D/Client/Public/Level_Field.h +++ b/Jusin154_Team3D/Client/Public/Level_Field.h @@ -19,6 +19,9 @@ class CLevel_Field final : public CLevel private: class CInfoInstance* m_pInfoInstance = { nullptr }; + _bool m_bLevel = { false }; + _bool m_bCurrentLevel = { false }; + private: virtual HRESULT Initialize() override; HRESULT Initialize(void* pArg); diff --git a/Jusin154_Team3D/Client/Public/Level_GamePlay.h b/Jusin154_Team3D/Client/Public/Level_GamePlay.h index c000598e7..18c4f67c7 100644 --- a/Jusin154_Team3D/Client/Public/Level_GamePlay.h +++ b/Jusin154_Team3D/Client/Public/Level_GamePlay.h @@ -21,6 +21,10 @@ class CLevel_GamePlay final : public CLevel class CBroomRaceManager* m_pBroomRaceManager = { nullptr }; _bool m_isDay = { true }; + + _bool m_bLevel = { false }; + _bool m_bCurrentLevel = { false }; + private: virtual HRESULT Initialize() override; HRESULT Initialize(void* pArg); diff --git a/Jusin154_Team3D/Client/Public/RandomNpc.h b/Jusin154_Team3D/Client/Public/RandomNpc.h index c3ebef544..3f63c55d1 100644 --- a/Jusin154_Team3D/Client/Public/RandomNpc.h +++ b/Jusin154_Team3D/Client/Public/RandomNpc.h @@ -27,6 +27,9 @@ class CRandomNpc final : public CUnit virtual void OnRayCollision(CGameObject* pCaster, _uint iCastedOrder, _float fDistance, _float3 vCastedWorldPos)override; virtual _wstring Get_Name() override; + virtual _wstring Get_NpcName() override; + + void Set_Target(CUnit& pTarget, CTransform& pTransform); protected: CInfoInstance* m_pInfoInstance = { nullptr }; CCharacter_Controller* m_pCharacter_Controller = { nullptr }; @@ -37,12 +40,24 @@ class CRandomNpc final : public CUnit CRandomNpc* m_pNPC_Ollivander = { nullptr }; /*class CNPCInteraction* m_pNPCInteraction = { nullptr };*/ + CUnit* m_pTarget = { nullptr }; + _float4 m_vTargetPos = { }; + _float3 m_vToTargetDir = { }; + _float m_fTargetDistance = { FLT_MAX }; + _float m_fDegree = {}; + _float m_fCross = {}; CNPCStat* m_pNpcStat = { nullptr }; _int m_iEntered = { 0 }; _float2 m_vEnteringTimer = { 0.f, 1.f }; _float m_fEncounterDistance = { 8.f }; _int m_iIndex = {}; + + + _bool m_bInteract = { false }; + _bool m_bPreviousInteract = { false }; + _float m_fInteractTime{}; + protected: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; diff --git a/Jusin154_Team3D/Client/Public/UI_Manager.h b/Jusin154_Team3D/Client/Public/UI_Manager.h index 3f7fb53a7..f4e386529 100644 --- a/Jusin154_Team3D/Client/Public/UI_Manager.h +++ b/Jusin154_Team3D/Client/Public/UI_Manager.h @@ -47,6 +47,8 @@ class CUI_Manager final : public CUIObject void NpcInteract(_bool bInteract); + void Set_Fade(); + private: CInfoInstance* m_pInfoInstance = { nullptr }; CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; @@ -79,6 +81,7 @@ class CUI_Manager final : public CUIObject _bool m_bSpellLearn = { false }; _bool m_bNPCInteract = { false }; + _bool m_bCurrentNPCInteract = { false }; _bool m_bAlphaZero = { false }; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Dialogue/Dialogue.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Dialogue/Dialogue.xml index bf2fec570..0504c04da 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Dialogue/Dialogue.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Dialogue/Dialogue.xml @@ -1,8 +1,8 @@  - - - + + + @@ -10,19 +10,18 @@ - + - - - - + + + - - + + @@ -31,13 +30,7 @@ - - - - - - - + @@ -49,11 +42,30 @@ - + - + + + + + + + + + + + + + + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/NpcStat.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/NpcStat.xml index 0d078b45f..51f3f40ac 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/NpcStat.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/NpcStat.xml @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index 5495075f9..60c0ef454 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -2426,6 +2426,100 @@ PS_OUT PS_BoosterHpBar(PS_IN In) return Out; } +PS_OUT PS_DialogueChoice(PS_IN In) +{ + PS_OUT Out = (PS_OUT) 0; + float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; + float4 Color = float4(1.f, 1.f, 1.f, 0.f); + float2 uv = In.vTexcoord; + float2 CurrentPixelPosition = uv * g_fCurrent_Size; + float OriginLeft = g_fNine_Slice.x; + float OriginRight = g_fNine_Slice.y; + float OriginTop = g_fNine_Slice.z; + float OriginBottom = g_fNine_Slice.w; + + float CurrentLeft = OriginLeft; + float CurrentRight = g_fCurrent_Size.x - (g_fOrigin_Size.x - OriginRight); + float CurrentTop = OriginTop; + float CurrentBottom = g_fCurrent_Size.y - (g_fOrigin_Size.y - OriginBottom); + + float2 Finaluv = In.vTexcoord; + + if (CurrentPixelPosition.x < CurrentLeft) + { + Finaluv.x = CurrentPixelPosition.x / g_fOrigin_Size.x; + } + else if (CurrentPixelPosition.x > CurrentRight) + { + float dist = CurrentPixelPosition.x - CurrentRight; + Finaluv.x = (OriginRight + dist) / g_fOrigin_Size.x; + } + else + { + float scale = (CurrentPixelPosition.x - CurrentLeft) / (CurrentRight - CurrentLeft); + Finaluv.x = (OriginLeft / g_fOrigin_Size.x) + scale * ((OriginRight - OriginLeft) / g_fOrigin_Size.x); + } + + if (CurrentPixelPosition.y < CurrentTop) + { + Finaluv.y = CurrentPixelPosition.y / g_fOrigin_Size.y; + } + else if (CurrentPixelPosition.y > CurrentBottom) + { + float dist = CurrentPixelPosition.y - CurrentBottom; + Finaluv.y = (OriginBottom + dist) / g_fOrigin_Size.y; + } + else + { + float scale = (CurrentPixelPosition.y - CurrentTop) / (CurrentBottom - CurrentTop); + Finaluv.y = (OriginTop / g_fOrigin_Size.y) + scale * ((OriginBottom - OriginTop) / g_fOrigin_Size.y); + } + + + if (g_iHover != 0) + { + float4 tex = g_Texture.Sample(ClampSampler, Finaluv); + Color = tex; + + float2 ImgaePos1 = g_fImageSipos1.xy; + float2 ImgaeSize1 = g_fImageSipos1.zw; + float2 ImgaePixel = Finaluv * g_fOrigin_Size; + float2 localUV = (ImgaePixel - ImgaePos1) / ImgaeSize1; + bool inside = all(localUV >= 0.0f && localUV <= 1.0f); + if (inside) + { + float4 tex2 = g_Texture1.Sample(ClampSampler, localUV); + Color = lerp(Color, tex2, tex2.a); + } + + float2 ImgaePos2 = g_fImageSipos2.xy; + float2 ImgaeSize2 = g_fImageSipos2.zw; + float2 ImgaePixe2 = Finaluv * g_fOrigin_Size; + float2 ReverseUV = (ImgaePixe2 - ImgaePos2) / ImgaeSize2; + bool inside2 = all(ReverseUV >= 0.0f && ReverseUV <= 1.0f); + if (inside2) + { + ReverseUV.y = 1.f - ReverseUV.y; + float4 tex2 = g_Texture1.Sample(ClampSampler, ReverseUV); + Color = lerp(Color, tex2, tex2.a); + } + } + + float2 ImgaePos3 = g_fImageSipos3.xy / g_fCurrent_Size; + float2 ImgaeSize3 = g_fImageSipos3.zw / g_fCurrent_Size; + float2 localUV2 = (In.vTexcoord - ImgaePos3) / ImgaeSize3; + bool inside3 = all(localUV2 >= 0.0f && localUV2 <= 1.0f); + if (inside3) + { + float4 tex2 = g_Texture2.Sample(ClampSampler, localUV2); + Color = lerp(Color, tex2, tex2.a); + } + + Color.a *= Alpha; + Out.vColor = Color; + return Out; +} + struct VS_IN3D { float3 vPosition : POSITION; @@ -3206,6 +3300,16 @@ technique11 PosTexTechnique11 PixelShader = compile ps_5_0 PS_BoosterHpBar(); } + pass DialogueChoice + { + SetRasterizerState(RS_Nocull); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_MAIN(); + + PixelShader = compile ps_5_0 PS_DialogueChoice(); + } + pass Enemy_Detection { SetRasterizerState(RS_Nocull); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/Dialogue_Chice.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/Dialogue_Chice.png new file mode 100644 index 000000000..b146ba0a0 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/Dialogue_Chice.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_Icon_InteractType_Straight.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_Icon_InteractType_Straight.png similarity index 100% rename from Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_Icon_InteractType_Straight.png rename to Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_Icon_InteractType_Straight.png diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_InteractSelectionBracket.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_InteractSelectionBracket.png new file mode 100644 index 000000000..f31219fd0 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/UI_T_InteractSelectionBracket.png differ diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 2b600576c..afae6e31f 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -187,6 +187,9 @@ call Update_Shaders.bat + + + @@ -466,6 +469,9 @@ call Update_Shaders.bat + + + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index e1f70fe22..d99f17de4 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -769,6 +769,15 @@ {7a345ef7-8e16-45df-9bc3-e8fc665f729f} + + {a5413132-f824-4e59-b3bb-1e6ad539b274} + + + {54dbea26-acfa-49be-9a97-1e2408cbd9b2} + + + {0201d2a8-9187-468c-aa2f-491bd3ae6ae1} + @@ -1557,6 +1566,15 @@ 02.GameObjects\Layer_Effect\Effect_Editor\Effect\Monster_Effect\Ranrok\DeadImpact + + 50.UI\Dialogue_Canvas\Dialogue_Panel + + + 50.UI\Dialogue_Canvas + + + 50.UI\Dialogue_Canvas\Dialogue_Panel\Dialogue_Choice + @@ -2353,6 +2371,15 @@ 02.GameObjects\Layer_Effect\Effect_Editor\Effect\Monster_Effect\Ranrok\DeadImpact + + 50.UI\Dialogue_Canvas\Dialogue_Panel + + + 50.UI\Dialogue_Canvas + + + 50.UI\Dialogue_Canvas\Dialogue_Panel\Dialogue_Choice + diff --git a/Jusin154_Team3D/Editor/Private/Dialogue_Canvas.cpp b/Jusin154_Team3D/Editor/Private/Dialogue_Canvas.cpp new file mode 100644 index 000000000..919fc4d6a --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Dialogue_Canvas.cpp @@ -0,0 +1,137 @@ +#include "pch.h" +#include "Dialogue_Canvas.h" +#include "GameInstance.h" +#include "UI_Manager.h" +#include "Dialogue_Panel.h" + +CDialogue_Canvas::CDialogue_Canvas(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CCanvasObject(pDevice, pContext) +{ +} + +CDialogue_Canvas::CDialogue_Canvas(const CDialogue_Canvas& rhs) + :CCanvasObject(rhs) +{ +} + +HRESULT CDialogue_Canvas::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CDialogue_Canvas::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 0.f; + Desc.fY = 0.f; + Desc.fSizeX = 1920.f; + Desc.fSizeY = 1080.f; + + if (FAILED(__super::Initialize(&Desc))) + { + return E_FAIL; + } + if (FAILED(Ready_Components(pArg))) + { + return E_FAIL; + } + if (FAILED(Ready_Panel(pArg))) + { + return E_FAIL; + } + Visible(true); + return S_OK; +} + +void CDialogue_Canvas::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); +} + +void CDialogue_Canvas::Update(_float fTimeDelta) +{ + __super::Update(fTimeDelta); +} + +void CDialogue_Canvas::Late_Update(_float fTimeDelta) +{ + if (m_bVisible) { + } + __super::Late_Update(fTimeDelta); +} + +HRESULT CDialogue_Canvas::Render() +{ + return S_OK; +} + +_vector CDialogue_Canvas::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CDialogue_Canvas::Bind_ShaderResources() +{ + return S_OK; +} + +HRESULT CDialogue_Canvas::Ready_Components(void* pArg) +{ + if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) { + return E_FAIL; + } + + return S_OK; +} +HRESULT CDialogue_Canvas::Ready_Panel(void* pArg) +{ + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pDialogue_Panel)))) + { + return E_FAIL; + } + Add_Panel(TEXT("Dialogue_Panel"), m_pDialogue_Panel); + + return S_OK; +} + +void CDialogue_Canvas::Clear_Penel() +{ +} + +CDialogue_Canvas* CDialogue_Canvas::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CDialogue_Canvas* pInstance = new CDialogue_Canvas(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CDialogue_Canvas"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CDialogue_Canvas::Clone(void* pArg, CGameObject* pOwner) +{ + CDialogue_Canvas* pInstance = new CDialogue_Canvas(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CDialogue_Canvas"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CDialogue_Canvas::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pVIBufferCom); +} + +void CDialogue_Canvas::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/Dialogue_Choice.cpp b/Jusin154_Team3D/Editor/Private/Dialogue_Choice.cpp new file mode 100644 index 000000000..23c36a73f --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Dialogue_Choice.cpp @@ -0,0 +1,317 @@ +#include "pch.h" +#include "Dialogue_Choice.h" +#include "GameInstance.h" + +CDialogue_Choice::CDialogue_Choice(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CDialogue_Choice::CDialogue_Choice(const CDialogue_Choice& rhs) + :CElementObject(rhs) +{ +} + +HRESULT CDialogue_Choice::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CDialogue_Choice::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = -100.f; + Desc.fY = -200.f; + Desc.fSizeX = 100.f; + Desc.fSizeY = 65.f; + + m_pRect = { long(Desc.fX - Desc.fSizeX * 0.5f), long(Desc.fY - Desc.fSizeY * 0.5f), long(Desc.fX + Desc.fSizeX * 0.5f), long(Desc.fY + Desc.fSizeY * 0.5f) }; + + if (FAILED(__super::Initialize(&Desc))) + { + return E_FAIL; + } + if (FAILED(Ready_Components(pArg))) + { + return E_FAIL; + } + + m_fTimeMult = 3.f; + m_fAlpha = 1.f; + m_fAlphaTime = 3.f; + m_vNine_Slice = _float4(20.f, 100.f, 0.f, 65.f); + m_vImagePosi1 = _float4(0.f, 0.f, 90.f, 20.f); + m_vImagePosi2 = _float4(0.f, 45.f, 90.f, 20.f); + m_vImagePosi3 = _float4(15.f, 12.5f, 40.f, 40.f); + m_fFontX = 370.f; + m_fFontY = 607.5f; + m_iHover = 0; + SizeUpX(400.f); + return S_OK; +} + +void CDialogue_Choice::Mouse_Hover() +{ + POINT ptMouse{}; + GetCursorPos(&ptMouse); + ScreenToClient(g_hWnd, &ptMouse); // 윈도우 왼쪽 상단 (0,0) 기준 + + // 윈도우 실제 내부 크기를 '직접' 가져옵니다. (g_iWinSize 대신) + RECT rc; + GetClientRect(g_hWnd, &rc); + _float fWidth = (_float)(rc.right - rc.left); + _float fHeight = (_float)(rc.bottom - rc.top); + + _float2 fMouse; + // 캔버스 배치 로직(Update)과 마우스 변환 로직을 완벽하게 일치시킵니다. + fMouse.x = (_float)ptMouse.x - (fWidth * 0.5f); + fMouse.y = -((_float)ptMouse.y - (fHeight * 0.494f)); // Y축 뒤집기 + + POINT pt = { (long)fMouse.x, (long)fMouse.y }; + + Hover(PtInRect(&m_pRect, pt)); +} + +void CDialogue_Choice::Hover(_bool iHover) +{ + m_iHover = iHover; + if (m_iHover != 0) + { + m_fFontX = 390.f; + m_vImagePosi3 = _float4(35.f, 12.5f, 40.f, 40.f); + } + else + { + m_fFontX = 370.f; + m_vImagePosi3 = _float4(15.f, 12.5f, 40.f, 40.f); + } +} + +void CDialogue_Choice::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CDialogue_Choice::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + + if (m_bFadeIn == true) + { + if (m_fAlpha <= 7.f) + m_fAlpha += fTimeDelta * m_fAlphaTime; + + if (m_fAlpha >= 7.f) + { + m_bFadeIn = false; + m_fAlpha = 7.f; + } + } + + if (m_bFadeOut == true) + { + if (m_fAlpha >= 0.f) + m_fAlpha -= fTimeDelta; + + if (m_fAlpha <= 0.f) + { + m_bFadeOut = false; + m_fAlpha = 0.f; + } + } + + Mouse_Hover(); + + m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); +} + +void CDialogue_Choice::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + __super::Late_Update(fTimeDelta); + } +} + +HRESULT CDialogue_Choice::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::DIALOGUECHOICE)))) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) { + return E_FAIL; + } + + m_pGameInstance->Render_Text(TEXT("Font_size20"), TEXT("아아"), _float2(m_fFontX + m_fX, m_fFontY - m_fY), XMVectorSet((208.f / 255.f) * m_fAlpha, (177.f / 255.f) * m_fAlpha, (52.f / 255.f) * m_fAlpha, m_fAlpha)); + + return S_OK; +} + +_vector CDialogue_Choice::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CDialogue_Choice::Bind_ShaderResources() +{ + if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix))) + { + return E_FAIL; + } + if (FAILED(m_pDiffuse_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_Texture", 0))) + { + return E_FAIL; + } + if (FAILED(m_pDiffuse_TextureCom1->Bind_ShaderResource(m_pShaderCom, "g_Texture1", 0))) + { + return E_FAIL; + } + if (FAILED(m_pDiffuse_TextureCom2->Bind_ShaderResource(m_pShaderCom, "g_Texture2", 0))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fTime", &m_fTime, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fAlpha", &m_fAlpha, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fOwnerAlpha", &m_fOwnerAlpha, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fCanvasAlpha", &m_fCanvasAlpha, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fOrigin_Size", &m_fOrigin_Size, sizeof(_float2)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fCurrent_Size", &m_vScale, sizeof(_float2)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fNine_Slice", &m_vNine_Slice, sizeof(_float4)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fImageSipos1", &m_vImagePosi1, sizeof(_float4)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fImageSipos2", &m_vImagePosi2, sizeof(_float4)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fImageSipos3", &m_vImagePosi3, sizeof(_float4)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_iHover", &m_iHover, sizeof(_int)))) + { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CDialogue_Choice::Ready_Components(void* pArg) +{ + if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Dialogue_Chice"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_InteractSelectionBracket"), reinterpret_cast(&m_pDiffuse_TextureCom1), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_Icon_InteractType_Straight"), reinterpret_cast(&m_pDiffuse_TextureCom2), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +CDialogue_Choice* CDialogue_Choice::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CDialogue_Choice* pInstance = new CDialogue_Choice(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CDialogue_Choice"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CDialogue_Choice::Clone(void* pArg, CGameObject* pOwner) +{ + CDialogue_Choice* pInstance = new CDialogue_Choice(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CDialogue_Choice"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CDialogue_Choice::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pDiffuse_TextureCom1); + SAFE_RELEASE(m_pDiffuse_TextureCom2); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +void CDialogue_Choice::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/Dialogue_Panel.cpp b/Jusin154_Team3D/Editor/Private/Dialogue_Panel.cpp new file mode 100644 index 000000000..2fc59c31b --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Dialogue_Panel.cpp @@ -0,0 +1,149 @@ +#include "pch.h" +#include "Dialogue_Panel.h" +#include "GameInstance.h" +#include "Dialogue_Choice.h" + +CDialogue_Panel::CDialogue_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CPanelObject(pDevice, pContext) +{ +} + +CDialogue_Panel::CDialogue_Panel(const CDialogue_Panel& rhs) + :CPanelObject(rhs) +{ +} + +HRESULT CDialogue_Panel::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CDialogue_Panel::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 500.f; + Desc.fY = -625.f; + Desc.fSizeX = 750.f; + Desc.fSizeY = 410.f; + + if (FAILED(__super::Initialize(&Desc))) + { + return E_FAIL; + } + if (FAILED(Ready_Components(pArg))) + { + return E_FAIL; + } + if (FAILED(Ready_Element(pArg))) + { + return E_FAIL; + } + + m_fCanvasAlpha = 1.f; + Visible(true); + ElementAllVisible(true); + return S_OK; +} + +void CDialogue_Panel::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CDialogue_Panel::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + + __super::Update(fTimeDelta); +} + +void CDialogue_Panel::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + + if (m_bVisible) { + __super::Late_Update(fTimeDelta); + } +} + +HRESULT CDialogue_Panel::Render() +{ + return S_OK; +} + +_vector CDialogue_Panel::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CDialogue_Panel::Bind_ShaderResources() +{ + return S_OK; +} + +HRESULT CDialogue_Panel::Ready_Components(void* pArg) +{ + if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) + { + return E_FAIL; + } + return S_OK; +} + +HRESULT CDialogue_Panel::Ready_Element(void* pArg) +{ + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pDialogue_Choice)))) + { + return E_FAIL; + } + Add_Element(TEXT("Dialogue_Choice"), m_pDialogue_Choice); + return S_OK; +} + +CDialogue_Panel* CDialogue_Panel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CDialogue_Panel* pInstance = new CDialogue_Panel(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CDialogue_Panel"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CDialogue_Panel::Clone(void* pArg, CGameObject* pOwner) +{ + CDialogue_Panel* pInstance = new CDialogue_Panel(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CDialogue_Panel"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CDialogue_Panel::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pVIBufferCom); +} + +void CDialogue_Panel::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/GamePlay_Canvas.cpp b/Jusin154_Team3D/Editor/Private/GamePlay_Canvas.cpp index aed21bd50..c453da583 100644 --- a/Jusin154_Team3D/Editor/Private/GamePlay_Canvas.cpp +++ b/Jusin154_Team3D/Editor/Private/GamePlay_Canvas.cpp @@ -48,7 +48,7 @@ HRESULT CGamePlay_Canvas::Initialize(void* pArg) { return E_FAIL; } - Visible(true); + Visible(false); return S_OK; } @@ -155,6 +155,8 @@ HRESULT CGamePlay_Canvas::Ready_Panel(void* pArg) } Add_Panel(TEXT("Ride_Panel"), m_pRide_Panel); + + return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index d604865b4..d7dc7d19c 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -145,6 +145,10 @@ #include "Ride_HpBar.h" #include "Ride_HpSlot.h" +#include "Dialogue_Canvas.h" +#include "Dialogue_Panel.h" +#include "Dialogue_Choice.h" + #include "NPCInteraction.h" #include "Dialogue.h" @@ -1263,8 +1267,21 @@ HRESULT CLoader::Loading_For_UI() { return E_FAIL; } + + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDialogue_Canvas::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDialogue_Panel::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDialogue_Choice::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } - if(FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CNPCInteraction::Create(m_pDevice, m_pContext)))) + if(FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CNPCInteraction::Create(m_pDevice, m_pContext)))) { return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/Potion.cpp b/Jusin154_Team3D/Editor/Private/Potion.cpp index b573fd073..ddd100b2a 100644 --- a/Jusin154_Team3D/Editor/Private/Potion.cpp +++ b/Jusin154_Team3D/Editor/Private/Potion.cpp @@ -135,7 +135,7 @@ HRESULT CPotion::Render() return E_FAIL; } - m_pGameInstance->Render_Text(TEXT("UI_size15"), m_strPotion.c_str(), _float2((m_fFontX + m_fX) - m_fFontOffSet, m_fFontY + m_fY), XMVectorSet((208.f / 255.f) * m_fAlpha, (177.f / 255.f) * m_fAlpha, (52.f / 255.f)* m_fAlpha, m_fAlpha)); + m_pGameInstance->Render_Text(TEXT("UI_size15"), m_strPotion.c_str(), _float2((m_fFontX + m_fX) - m_fFontOffSet, m_fFontY - m_fY), XMVectorSet((208.f / 255.f) * m_fAlpha, (177.f / 255.f) * m_fAlpha, (52.f / 255.f)* m_fAlpha, m_fAlpha)); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/UI_Manager.cpp b/Jusin154_Team3D/Editor/Private/UI_Manager.cpp index 8510b5409..4b166ef47 100644 --- a/Jusin154_Team3D/Editor/Private/UI_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/UI_Manager.cpp @@ -8,6 +8,7 @@ #include "Mouse_Cursor.h" #include "CameraLockOn.h" #include "Loding_Canvas.h" +#include "Dialogue_Canvas.h" #include "tinyxml2.h" CUI_Manager::CUI_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -321,6 +322,11 @@ HRESULT CUI_Manager::Ready_Components(void* pArg) } Add_Canvas(TEXT("SpellLearn_Canvas"), m_pSpellLearn_Canvas); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, g_iStaticLevel, LAYER_UI, nullptr, this, reinterpret_cast(&m_pDialogue_Canvas)))) { + return E_FAIL; + } + Add_Canvas(TEXT("Dialogue_Canvas"), m_pDialogue_Canvas); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, g_iStaticLevel, LAYER_UI, nullptr, this, reinterpret_cast(&m_pMouse_Cursor)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Public/Dialogue_Canvas.h b/Jusin154_Team3D/Editor/Public/Dialogue_Canvas.h new file mode 100644 index 000000000..6b47e828d --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Dialogue_Canvas.h @@ -0,0 +1,47 @@ +#pragma once + +#include "Editor_Define.h" +#include "CanvasObject.h" + +NS_BEGIN(Engine) +class CGameObject; +NS_END + +NS_BEGIN(Editor) + +class CDialogue_Canvas final : public CCanvasObject +{ +private: + CDialogue_Canvas(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CDialogue_Canvas(const CDialogue_Canvas& rhs); + virtual ~CDialogue_Canvas() = default; + +public: + virtual void Priority_Update(_float fTimeDelta); + virtual void Update(_float fTimeDelta); + virtual void Late_Update(_float fTimeDelta); + virtual HRESULT Render() override; + virtual _vector Get_WorldPostion() override; + +private: + virtual HRESULT Bind_ShaderResources() override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Ready_Panel(void* pArg) override; + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + +public: + void Clear_Penel(); + +private: + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + CGameObject* m_pDialogue_Panel = { nullptr }; + +public: + static CDialogue_Canvas* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Dialogue_Choice.h b/Jusin154_Team3D/Editor/Public/Dialogue_Choice.h new file mode 100644 index 000000000..0e9276e17 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Dialogue_Choice.h @@ -0,0 +1,55 @@ +#pragma once + +#include "Editor_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Editor) + +class CDialogue_Choice final : public CElementObject +{ +private: + CDialogue_Choice(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CDialogue_Choice(const CDialogue_Choice& rhs); + virtual ~CDialogue_Choice() = default; + +public: + virtual void Priority_Update(_float fTimeDelta); + virtual void Update(_float fTimeDelta); + virtual void Late_Update(_float fTimeDelta); + virtual HRESULT Render() override; + virtual _vector Get_WorldPostion() override; + + +private: + virtual HRESULT Bind_ShaderResources() override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + +public: + void Mouse_Hover(); + +private: + void Hover(_bool iHover); + +private: + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CTexture* m_pDiffuse_TextureCom1 = { nullptr }; + CTexture* m_pDiffuse_TextureCom2 = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + _float4 m_vImagePosi1{}; + _float4 m_vImagePosi2{}; + _float4 m_vImagePosi3{}; + + _int m_iHover{}; + +public: + static CDialogue_Choice* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Dialogue_Panel.h b/Jusin154_Team3D/Editor/Public/Dialogue_Panel.h new file mode 100644 index 000000000..a79fa6644 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Dialogue_Panel.h @@ -0,0 +1,47 @@ +#pragma once + +#include "Editor_Define.h" +#include "PanelObject.h" + +NS_BEGIN(Engine) +class CGameObject; +NS_END + +NS_BEGIN(Editor) + +class CDialogue_Panel final : public CPanelObject +{ +private: + CDialogue_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CDialogue_Panel(const CDialogue_Panel& rhs); + virtual ~CDialogue_Panel() = default; + +public: + virtual void Priority_Update(_float fTimeDelta); + virtual void Update(_float fTimeDelta); + virtual void Late_Update(_float fTimeDelta); + virtual HRESULT Render() override; + virtual _vector Get_WorldPostion() override; + +private: + virtual HRESULT Bind_ShaderResources() override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Ready_Element(void* pArg) override; + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + +private: + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + + CGameObject* m_pDialogue_Choice = { nullptr }; + +public: + static CDialogue_Panel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 5001520c7..1842ef9b0 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -44,7 +44,7 @@ namespace Editor ENEMY_HPBAR, BOSS_HPBAR, QUEST_BORDER, QUEST_INFO, QUEST_STATUS, BROOMSTICK, SPELL_LEARN, SPELLLEARNCOLOR, SPELLLEARNBOOSTER, NPCINTERACTION, CANVASFADE, FLAGWAVE, BROOMCIRCLE, RIDE_INFO_KEY, RIDE_INFO, RIDE_HPSLOT, BOOSTERGAUGE, - BOOSTERHPBAR, + BOOSTERHPBAR, DIALOGUECHOICE, ENEMY_DETECTION, INTERACTION_OBJECT, INTERACTION_NPC, BROOMTARGETGATE, END }; enum class SHADER_PASS_INSTANCE_MODEL { DEFAULT, NON_NOMALMAP, BLUR, WEIGHTBLEND, NON_WORLD, NON_WORLD_BLUR, BLEND, BLEND_NOWORLD, BLOOM, BLOOM_NOWORLD, BLUR_NO_EMMISVE, BLUR_NO_WORLD_NO_EMISSIVE, WEIGHTBLEND_FOR_BLEND, DEPTH_STOP, WB_CULLING, SCREEN_FX , DISTORTION , NONPOS , NONPOS_BLUR, BLUR_MESH, BLUR_CULLING , BLUR_CULLING_NO_EMISSIVE, BLOOM_CULLING , DEFAULT_NONPOS , NONWB_NONPOS, DECAL, DECAL_WB, DECAL_BLUR, BLEND_CULLING, DECAL_BLEND, END}; diff --git a/Jusin154_Team3D/Editor/Public/GamePlay_Canvas.h b/Jusin154_Team3D/Editor/Public/GamePlay_Canvas.h index 6db90f1fb..30443d3e3 100644 --- a/Jusin154_Team3D/Editor/Public/GamePlay_Canvas.h +++ b/Jusin154_Team3D/Editor/Public/GamePlay_Canvas.h @@ -42,6 +42,7 @@ class CGamePlay_Canvas final : public CCanvasObject CGameObject* m_pEnemy_Panel = { nullptr }; CGameObject* m_pBroom_Panel = { nullptr }; CGameObject* m_pRide_Panel = { nullptr }; + CGameObject* m_pDialogue_Panel = { nullptr }; _bool m_bRide = { false }; diff --git a/Jusin154_Team3D/Editor/Public/UI_Manager.h b/Jusin154_Team3D/Editor/Public/UI_Manager.h index 4953e8c16..49caec491 100644 --- a/Jusin154_Team3D/Editor/Public/UI_Manager.h +++ b/Jusin154_Team3D/Editor/Public/UI_Manager.h @@ -59,6 +59,7 @@ class CUI_Manager final : public CUIObject CGameObject* m_pLoding_Canvas= { nullptr }; CGameObject* m_pQuest_Canves= { nullptr }; CGameObject* m_pSpellLearn_Canvas = { nullptr }; + CGameObject* m_pDialogue_Canvas = { nullptr }; CGameObject* m_pMouse_Cursor = { nullptr }; CGameObject* m_pCamera_LockOn = { nullptr }; _bool m_bCanvas_Change = { false }; diff --git a/Jusin154_Team3D/Engine/Private/ElementObject.cpp b/Jusin154_Team3D/Engine/Private/ElementObject.cpp index f06ff23ee..f0dca55bb 100644 --- a/Jusin154_Team3D/Engine/Private/ElementObject.cpp +++ b/Jusin154_Team3D/Engine/Private/ElementObject.cpp @@ -43,18 +43,28 @@ void CElementObject::Update(_float fTimeDelta) m_vScale = _float3(m_fSizeX, m_fSizeY, 1.f); m_pTransformCom->Set_Scale(m_vScale); - m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet( - m_fX + m_pOwner->Get_WorldPostion().m128_f32[0], - m_fY + m_pOwner->Get_WorldPostion().m128_f32[1], - m_fSortZ, 1.f)); + // 1. 최종 월드 좌표 계산 (부모 좌표 + 내 로컬 좌표) + _float fFinalX = m_fX + m_pOwner->Get_WorldPostion().m128_f32[0]; + _float fFinalY = m_fY + m_pOwner->Get_WorldPostion().m128_f32[1]; - m_pRect = - { - long((m_fX + m_pOwner->Get_WorldPostion().m128_f32[0]) - m_fSizeX * 0.5f), - long((m_fY + m_pOwner->Get_WorldPostion().m128_f32[1]) - m_fSizeY * 0.5f), - long((m_fX + m_pOwner->Get_WorldPostion().m128_f32[0]) + m_fSizeX * 0.5f), - long((m_fY + m_pOwner->Get_WorldPostion().m128_f32[1]) + m_fSizeY * 0.5f) - }; + // 2. Transform 업데이트 + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(fFinalX, fFinalY, m_fSortZ, 1.f)); + + // 3. m_pRect 업데이트 (마우스 호버용) + // float 오차를 줄이기 위해 floor(내림) 또는 round(반올림)를 사용하는 것이 좋습니다. + _float fLeft = fFinalX - m_fSizeX * 0.5f; + _float fRight = fFinalX + m_fSizeX * 0.5f; + _float fTop = fFinalY - m_fSizeY * 0.5f; + _float fBottom = fFinalY + m_fSizeY * 0.5f; + + m_pRect.left = (long)fLeft; + m_pRect.right = (long)fRight; + + // 중요: 현재 좌표계가 Y축이 위로 갈수록 +인 수학 좌표계라면, + // 실제 화면상 '위'에 해당하는 좌표값(fTop)이 숫자가 더 작아야 PtInRect가 작동합니다. + // 만약 살짝 어긋난다면 여기서 min, max로 안전하게 잡아줍니다. + m_pRect.top = (long)min(fTop, fBottom); + m_pRect.bottom = (long)max(fTop, fBottom); m_fCurrent_Position = _float4(m_fX, m_fY, 0.f, 1.f); m_vLerp_Position = _float4(m_fLerpX, m_fLerpY, 0.f, 1.f);