diff --git a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index e0f824a57..aef919e5d 100644 --- a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -1167,24 +1167,20 @@ PS_OUT PS_Spell_Drag(PS_IN In) float4 Color = float4(1.f, 1.f, 1.f, 1.f); float4 tex1 = g_Texture.Sample(DefaultSampler, In.vTexcoord); - float4 tex2 = g_Texture1.Sample(DefaultSampler, In.vTexcoord); - float4 tex2Color = g_Texture3.Sample(DefaultSampler, In.vTexcoord); + float tex2 = g_Texture1.Sample(DefaultSampler, In.vTexcoord).r; + float4 tex2Color = g_Texture2.Sample(DefaultSampler, In.vTexcoord); - Color = tex1; - tex2.rgb = tex2Color; + tex2Color.a = tex2; + Color = lerp(tex1, tex2Color, tex2Color.a); - Color = lerp(Color, tex2, tex2.a); - - float2 Imagetexpos1 = g_fImageUV.xy / g_fCurrent_Size; - float2 Imagetexsize1 = g_fImageUV.zw / g_fCurrent_Size; - float2 Imagelocal = (In.vTexcoord - Imagetexpos1) / Imagetexsize1; - bool inside1 = all(Imagelocal >= 0.0f && Imagelocal <= 1.0f); - float4 tex3 = g_Texture2.Sample(DefaultSampler, In.vTexcoord); + float2 atlasUV = g_fImageUV.xy + In.vTexcoord * (g_fImageUV.zw - g_fImageUV.xy); + //float2 center = (g_fImageUV.xy + g_fImageUV.zw) * 0.5f; + //float2 uv = atlasUV - center; + //uv *= 0.7f; + //uv += center; + float4 tex3 = g_Texture3.Sample(ClampSampler, atlasUV); - if (inside1) - { - Color = lerp(Color, tex3, tex3.a); - } + Color = lerp(Color, tex3, tex3.a); Color.a *= Alpha; diff --git a/Jusin154_Team3D/Client/Private/Spell_List.cpp b/Jusin154_Team3D/Client/Private/Spell_List.cpp index 7353cba51..671305474 100644 --- a/Jusin154_Team3D/Client/Private/Spell_List.cpp +++ b/Jusin154_Team3D/Client/Private/Spell_List.cpp @@ -159,13 +159,13 @@ void CSpell_List::SizeUpdate(_float fSizeX, _float fSizeY) void CSpell_List::Color() { - m_pVIBufferCom->Set_Index_Renge_Color(0, 3, _float4(255.f / 255.f, 255.f / 255.f, 0.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(4, 7, _float4(150.f / 255.f, 120.f / 255.f, 240.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(8, 12, _float4(190.f / 255.f, 46.f / 255.f, 34.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(13, 16, _float4(24.f / 255.f, 190.f / 255.f, 255.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(17, 19, _float4(200.f / 255.f, 220.f / 255.f, 150.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(20, 22, _float4(50.f / 255.f, 150.f / 255.f, 110.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(23, 25, _float4(24.f / 255.f, 190.f / 255.f, 255.f / 255.f, 1.f)); + m_pVIBufferCom->Set_Index_Renge_Color(0, 3, 0.f); + m_pVIBufferCom->Set_Index_Renge_Color(4, 7, 1.f); + m_pVIBufferCom->Set_Index_Renge_Color(8, 12, 2.f); + m_pVIBufferCom->Set_Index_Renge_Color(13, 16, 3.f); + m_pVIBufferCom->Set_Index_Renge_Color(17, 19, 4.f); + m_pVIBufferCom->Set_Index_Renge_Color(20, 22, 5.f); + m_pVIBufferCom->Set_Index_Renge_Color(23, 25, 3.f); } void CSpell_List::Hover(_float fTimeDelta) diff --git a/Jusin154_Team3D/Client/Private/Spell_Overlay.cpp b/Jusin154_Team3D/Client/Private/Spell_Overlay.cpp index d86062901..ba8bd55c1 100644 --- a/Jusin154_Team3D/Client/Private/Spell_Overlay.cpp +++ b/Jusin154_Team3D/Client/Private/Spell_Overlay.cpp @@ -56,7 +56,7 @@ HRESULT CSpell_Overlay::Initialize(void* pArg) void CSpell_Overlay::Compute_UI(_uint SpellID) { - _float2 fImage_Size = { 1024.f, 1536.f}; + _float2 fImage_Size = { 1024.f, 1792.f}; _uint iCountX = 4; _uint iCountY = 6; diff --git a/Jusin154_Team3D/Client/Public/PlayerInfo.h b/Jusin154_Team3D/Client/Public/PlayerInfo.h index 089fdc3d0..3a4fa0654 100644 --- a/Jusin154_Team3D/Client/Public/PlayerInfo.h +++ b/Jusin154_Team3D/Client/Public/PlayerInfo.h @@ -23,12 +23,7 @@ class CPlayerInfo final : public CBase pair<_float3, _float3> Get_CameraCoordinateSystem(); private: CGameInstance* m_pGameInstance = { nullptr }; - class C - - - - - * m_pInfoInstance = { nullptr }; + class CInfoInstance* m_pInfoInstance = { nullptr }; ID3D11Device* m_pDevice = { nullptr }; ID3D11DeviceContext* m_pContext = { nullptr }; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index e0f824a57..aef919e5d 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -1167,24 +1167,20 @@ PS_OUT PS_Spell_Drag(PS_IN In) float4 Color = float4(1.f, 1.f, 1.f, 1.f); float4 tex1 = g_Texture.Sample(DefaultSampler, In.vTexcoord); - float4 tex2 = g_Texture1.Sample(DefaultSampler, In.vTexcoord); - float4 tex2Color = g_Texture3.Sample(DefaultSampler, In.vTexcoord); + float tex2 = g_Texture1.Sample(DefaultSampler, In.vTexcoord).r; + float4 tex2Color = g_Texture2.Sample(DefaultSampler, In.vTexcoord); - Color = tex1; - tex2.rgb = tex2Color; + tex2Color.a = tex2; + Color = lerp(tex1, tex2Color, tex2Color.a); - Color = lerp(Color, tex2, tex2.a); - - float2 Imagetexpos1 = g_fImageUV.xy / g_fCurrent_Size; - float2 Imagetexsize1 = g_fImageUV.zw / g_fCurrent_Size; - float2 Imagelocal = (In.vTexcoord - Imagetexpos1) / Imagetexsize1; - bool inside1 = all(Imagelocal >= 0.0f && Imagelocal <= 1.0f); - float4 tex3 = g_Texture2.Sample(DefaultSampler, In.vTexcoord); + float2 atlasUV = g_fImageUV.xy + In.vTexcoord * (g_fImageUV.zw - g_fImageUV.xy); + //float2 center = (g_fImageUV.xy + g_fImageUV.zw) * 0.5f; + //float2 uv = atlasUV - center; + //uv *= 0.7f; + //uv += center; + float4 tex3 = g_Texture3.Sample(ClampSampler, atlasUV); - if (inside1) - { - Color = lerp(Color, tex3, tex3.a); - } + Color = lerp(Color, tex3, tex3.a); Color.a *= Alpha; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl index 593c4b16a..88deb62b4 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl @@ -17,6 +17,8 @@ float g_fAngle; float g_fFar; float g_fTime; +float4 g_UV; + struct VS_IN { float3 vPosition : POSITION; @@ -25,16 +27,19 @@ struct VS_IN float2 vSize : TEXCOORD1; float2 vPos : TEXCOORD2; float4 vUV : TEXCOORD3; - float4 vColor : TEXCOORD4; + float vBaseColor : TEXCOORD4; float bHover : TEXCOORD5; + float bSpell : TEXCOORD6; }; struct VS_OUT { float4 vPosition : SV_POSITION; float2 vTexcoord : TEXCOORD0; - float4 vColor : TEXCOORD1; - float bHover : TEXCOORD2; + float2 vUV : TEXCOORD1; + float vBaseColor : TEXCOORD2; + float bHover : TEXCOORD3; + float bSpell : TEXCOORD4; }; VS_OUT VS_MAIN(VS_IN In) @@ -55,9 +60,11 @@ VS_OUT VS_MAIN(VS_IN In) float3 vFinalWorldPos = vLocalPos + vParentPos; Out.vPosition = mul(float4(vFinalWorldPos, 1.f), matVP); - Out.vTexcoord = UV.xy + In.vTexcoord * (UV.zw - UV.xy); - Out.vColor = In.vColor; + Out.vUV = UV.xy + In.vTexcoord * (UV.zw - UV.xy); + Out.vTexcoord = In.vTexcoord; + Out.vBaseColor = In.vBaseColor; Out.bHover = In.bHover; + Out.bSpell = In.bSpell; return Out; } @@ -65,8 +72,10 @@ struct PS_IN { float4 vPosition : SV_POSITION; float2 vTexcoord : TEXCOORD0; - float4 vColor : TEXCOORD1; - float bHover : TEXCOORD2; + float2 vUV : TEXCOORD1; + float vBaseColor : TEXCOORD2; + float bHover : TEXCOORD3; + float bSpell : TEXCOORD4; }; struct PS_OUT @@ -113,6 +122,23 @@ PS_OUT PS_Alpha_Blend(PS_IN In) return Out; } +PS_OUT PS_UVAlpha_Blend(PS_IN In) +{ + PS_OUT Out; + float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; + + float4 color = g_Texture.Sample(ClampSampler, In.vUV); + + if (color.a <= 0.4f) + discard; + + color.a *= Alpha; + + Out.vColor = color; + + return Out; +} + PS_OUT PS_Megic_Meter(PS_IN In) { PS_OUT Out; @@ -191,7 +217,7 @@ PS_OUT PS_Eessential_Spell(PS_IN In) float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; float4 color = float4(1.f, 1.f, 1.f, 1.f); - float4 tex1 = g_Texture.Sample(ClampSampler, In.vTexcoord); + float4 tex1 = g_Texture.Sample(ClampSampler, In.vUV); color = tex1; @@ -208,10 +234,35 @@ PS_OUT PS_Color_Image(PS_IN In) float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; float4 color = float4(1.f, 1.f, 1.f, 1.f); + + float3 BGColor = float3(1.f, 1.f, 1.f); + switch (In.vBaseColor) + { + case 0: + BGColor = float3(255.f, 255.f, 0.f) / 255.f; + break; + case 1: + BGColor = float3(150.f, 120.f, 240.f) / 255.f; + break; + case 2: + BGColor = float3(190.f, 46., 34.f) / 255.f; + break; + case 3: + BGColor = float3(24.f, 190.f, 255.f) / 255.f; + break; + case 4: + BGColor = float3(200.f, 220.f, 150.f) / 255.f; + break; + case 5: + BGColor = float3(50.f, 150.f, 110.f) / 255.f; + break; + } + float4 tex1 = g_Texture.Sample(ClampSampler, In.vTexcoord); + color = tex1; - color *= In.vColor; + color.rgb *= BGColor; color.a *= Alpha; @@ -247,10 +298,7 @@ PS_OUT PS_Spell_Hover(PS_IN In) color.rgb = HoverOff; color.a *= 0.5f; } - - - color *= In.vColor; - + color.a *= Alpha; Out.vColor = color; @@ -281,7 +329,7 @@ PS_OUT PS_Spell_Effect(PS_IN In) //float2 maskUV = In.vTexcoord; - //maskUV.x += g_fTime * float2(0.05, 0.02); // 속도 조절 가능 + //maskUV.x += g_fTime * float2(0.05, 0.02); // ?띾룄 議곗젅 媛€?? //float2 center = float2(0.5, 0.0); //float2 uv = In.vTexcoord - center; @@ -297,14 +345,73 @@ PS_OUT PS_Spell_Effect(PS_IN In) color.a *= tex1; color.a *= mask; color.a *= Alpha; - - color *= In.vColor; Out.vColor = color; return Out; } +PS_OUT PS_Spell_Slot(PS_IN In) +{ + PS_OUT Out; + + float2 center = float2(0.5f, 0.5f); + float2 uv = In.vTexcoord - center; + uv *= sqrt(2.0f); + float2 Rotation = In.vTexcoord; + Rotation.x = uv.x * cos(g_fAngle) - uv.y * sin(g_fAngle); + Rotation.y = uv.x * sin(g_fAngle) + uv.y * cos(g_fAngle); + Rotation += center; + + float4 Color = float4(1.f, 1.f, 1.f, 1.f); + + if (In.bSpell != 0) + { + float3 BGColor = float3(1.f, 1.f, 1.f); + switch (In.vBaseColor) + { + case 0: + BGColor = float3(255.f, 255.f, 0.f) / 255.f; + break; + case 1: + BGColor = float3(150.f, 120.f, 240.f) / 255.f; + break; + case 2: + BGColor = float3(190.f, 46., 34.f) / 255.f; + break; + case 3: + BGColor = float3(24.f, 190.f, 255.f) / 255.f; + break; + case 4: + BGColor = float3(200.f, 220.f, 150.f) / 255.f; + break; + case 5: + BGColor = float3(50.f, 150.f, 110.f) / 255.f; + break; + + } + float4 tex1 = g_Texture.Sample(ClampSampler, Rotation); + tex1.rgb *= BGColor; + Color = tex1; + + float4 tex2 = g_Texture1.Sample(DefaultSampler, In.vUV); + Color = lerp(Color, tex2, tex2.a); + + float4 tex3 = g_Texture2.Sample(ClampSampler, Rotation); + Color = lerp(Color, tex3, tex3.a); + } + + else + { + float4 tex3 = g_Texture2.Sample(ClampSampler, Rotation); + Color = tex3; + } + + Out.vColor = Color; + + return Out; +} + technique11 PosTexTechnique11 { pass Default @@ -329,6 +436,17 @@ technique11 PosTexTechnique11 PixelShader = compile ps_5_0 PS_Alpha_Blend(); } + pass UVAlphaBlend + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + + VertexShader = compile vs_5_0 VS_MAIN(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_UVAlpha_Blend(); + } + pass Megic_Meter { SetRasterizerState(RS_Default); @@ -405,4 +523,15 @@ technique11 PosTexTechnique11 GeometryShader = NULL; PixelShader = compile ps_5_0 PS_Spell_Effect(); } + + pass Spell_Slot + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + + VertexShader = compile vs_5_0 VS_MAIN(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_Spell_Slot(); + } } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/Transparency.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/Transparency.png new file mode 100644 index 000000000..d350d3d8b Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Action/Transparency.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Spells/SpellMeters/Atlas_Spell.dds b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Spells/SpellMeters/Atlas_Spell.dds index dd494f042..094852933 100644 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Spells/SpellMeters/Atlas_Spell.dds and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Spells/SpellMeters/Atlas_Spell.dds differ diff --git a/Jusin154_Team3D/Editor/Private/Current_Slot_Number.cpp b/Jusin154_Team3D/Editor/Private/Current_Slot_Number.cpp index f7bb015e0..ba3100acc 100644 --- a/Jusin154_Team3D/Editor/Private/Current_Slot_Number.cpp +++ b/Jusin154_Team3D/Editor/Private/Current_Slot_Number.cpp @@ -112,7 +112,7 @@ HRESULT CCurrent_Slot_Number::Render() { return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::ALPHABLEND)))) + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIINTANCE::UVALPHABLEND)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Current_Spell_Slot.cpp b/Jusin154_Team3D/Editor/Private/Current_Spell_Slot.cpp index ceee66aaa..87566b048 100644 --- a/Jusin154_Team3D/Editor/Private/Current_Spell_Slot.cpp +++ b/Jusin154_Team3D/Editor/Private/Current_Spell_Slot.cpp @@ -3,18 +3,18 @@ #include "GameInstance.h" CCurrent_Spell_Slot::CCurrent_Spell_Slot(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) - :CElementObject(pDevice, pContext) + :CElementObject(pDevice, pContext) { } CCurrent_Spell_Slot::CCurrent_Spell_Slot(const CCurrent_Spell_Slot& rhs) - :CElementObject(rhs) + :CElementObject(rhs) { } HRESULT CCurrent_Spell_Slot::Initialize_Prototype() { - return S_OK; + return S_OK; } HRESULT CCurrent_Spell_Slot::Initialize(void* pArg) @@ -47,6 +47,10 @@ HRESULT CCurrent_Spell_Slot::Initialize(void* pArg) m_pVIBufferCom->Set_Cloned(true); m_pVIBufferCom->Set_Pos(-780.f, 340.f, m_fOffSetX, m_fOffSetY, m_iCols); m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); + m_bGetSpell = false; + Clear(-1); + static_cast(m_pOwner)->Add_Function(TEXT("Slot_Hover"), [this](void* p) {this->Set_SkillType(*reinterpret_cast<_int*>(p)); }); + static_cast(m_pOwner)->Add_Function(TEXT("Click"), [this](void* p) {this->Click_Slot(*reinterpret_cast<_bool*>(p)); }); return S_OK; } @@ -90,6 +94,23 @@ void CCurrent_Spell_Slot::Update(_float fTimeDelta) } } m_fTime += fTimeDelta * m_fTimeMult; + + Hover(); + + if (m_bClick == true && m_bHover == true) + { + m_bGetSpell = true; + } + + if (m_bGetSpell == true) + { + if (m_bClick == false && m_iSkillType != -1) + { + Get_Skill(m_iSlot_Index); + m_bGetSpell = false; + } + } + __super::Update(fTimeDelta); } @@ -112,7 +133,7 @@ HRESULT CCurrent_Spell_Slot::Render() { return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIINTANCE::DEFAULT)))) + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIINTANCE::SPELL_SLOT)))) { return E_FAIL; } @@ -152,6 +173,99 @@ void CCurrent_Spell_Slot::SizeUpdate(_float fSizeX, _float fSizeY) m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); } +void CCurrent_Spell_Slot::Hover() +{ + POINT ptMouse{}; + GetCursorPos(&ptMouse); + ScreenToClient(g_hWnd, &ptMouse); + _float2 fMouse; + fMouse.x = ptMouse.x - (g_iWinSizeX * 0.5f); + fMouse.y = -(ptMouse.y - (g_iWinSizeY * 0.5f)); + + // 엘리먼트의 월드 위치를 더해주면 엘리먼트 좌표계 기준이 됨 + fMouse.x -= m_pOwner->Get_WorldPostion().m128_f32[0]; + fMouse.y -= m_pOwner->Get_WorldPostion().m128_f32[1]; + + m_iSlot_Index = m_pVIBufferCom->Set_Mouse_Hover(fMouse); + if (m_iSlot_Index != -1) + { + m_bHover = true; + } + else + { + m_bHover = false; + m_bGetSpell = false; + } +} + +void CCurrent_Spell_Slot::Click_Slot(_bool bClick) +{ + if (bClick == true) + { + m_bClick = true; + } + else + { + m_bClick = false; + } +} + +void CCurrent_Spell_Slot::Get_Skill(_int Index) +{ + if (Index == -1) + return; + + if (m_iSpellType == -1) + return; + + _int iSlotx = 4; + + _int x = Index % iSlotx; + _int y = Index / iSlotx; + + m_iSpell[y][x] = m_iSpellType; + m_pVIBufferCom->Set_Equip_Index(Index); + m_vUV.fUV = UV(m_iSpellType); + m_pVIBufferCom->Set_Index_Color(Index, static_cast<_float>(static_cast(m_pOwner)->Get_Info(m_iSpellType).iSpell_Type)); + m_pVIBufferCom->Set_Index_ImageUV(Index, m_vUV); +} + +void CCurrent_Spell_Slot::Clear(_int iValue) +{ + for (_int i = 0; i < 4; ++i) + { + for (_int j = 0; j < 4; ++j) + { + m_iSpell[i][j] = iValue; + } + } +} + +_float4 CCurrent_Spell_Slot::UV(_int SpellID) +{ + _float2 fImage_Size = { 1024.f, 1792.f }; + + _uint iCountX = 4; + _uint iCountY = 7; + + _float iImageX = 256.f; + _float iImageY = 256.f; + + _uint iframeX = SpellID % iCountX; + _uint iframeY = SpellID / iCountX; + + _float2 UVStart; + UVStart.x = iframeX * iImageX / fImage_Size.x; + UVStart.y = iframeY * iImageY / fImage_Size.y; + + _float2 UVEnd; + UVEnd.x = UVStart.x + (iImageX / fImage_Size.x); + UVEnd.y = UVStart.y + (iImageY / fImage_Size.y); + + _float4 UV = _float4{ UVStart.x, UVStart.y, UVEnd.x, UVEnd.y }; + return UV; +} + HRESULT CCurrent_Spell_Slot::Bind_ShaderResources() { if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) @@ -170,6 +284,14 @@ HRESULT CCurrent_Spell_Slot::Bind_ShaderResources() { 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; @@ -200,7 +322,15 @@ HRESULT CCurrent_Spell_Slot::Ready_Components(void* pArg) { return E_FAIL; } - if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_ActionItemGoldleaf_4K"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_SpellType_Generic"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Atlas_Spell"), reinterpret_cast(&m_pDiffuse_TextureCom1), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_ActionItemGoldleaf_4K"), reinterpret_cast(&m_pDiffuse_TextureCom2), nullptr))) { return E_FAIL; } @@ -243,6 +373,8 @@ void CCurrent_Spell_Slot::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); } diff --git a/Jusin154_Team3D/Editor/Private/Eessential_Spell_Slot.cpp b/Jusin154_Team3D/Editor/Private/Eessential_Spell_Slot.cpp index b8fc818c2..6c1923954 100644 --- a/Jusin154_Team3D/Editor/Private/Eessential_Spell_Slot.cpp +++ b/Jusin154_Team3D/Editor/Private/Eessential_Spell_Slot.cpp @@ -91,7 +91,7 @@ void CEessential_Spell_Slot::Update(_float fTimeDelta) } } - Hover(fTimeDelta); + Hover(); m_fTime += fTimeDelta * m_fTimeMult; __super::Update(fTimeDelta); @@ -156,7 +156,7 @@ void CEessential_Spell_Slot::SizeUpdate(_float fSizeX, _float fSizeY) m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); } -void CEessential_Spell_Slot::Hover(_float fTimeDelta) +void CEessential_Spell_Slot::Hover() { POINT ptMouse{}; GetCursorPos(&ptMouse); diff --git a/Jusin154_Team3D/Editor/Private/IMGUIUI.cpp b/Jusin154_Team3D/Editor/Private/IMGUIUI.cpp index e25650f18..83df08e05 100644 --- a/Jusin154_Team3D/Editor/Private/IMGUIUI.cpp +++ b/Jusin154_Team3D/Editor/Private/IMGUIUI.cpp @@ -154,6 +154,7 @@ void CIMGUIUI::Update(_float fTimeDelta) m_fMoveSpeed = static_cast(m_pElementObject)->Get_Speed(); m_fAngle = static_cast(m_pElementObject)->Get_Angle(); m_iSpellType = static_cast(m_pElementObject)->Get_SkillType(); + m_iSkillType = static_cast(m_pElementObject)->Get_SpellType(); m_fCoolTime = static_cast(m_pElementObject)->Get_CoolTime(); } GUI::Begin("Current_PanelObject_Info"); @@ -436,6 +437,7 @@ void CIMGUIUI::Update(_float fTimeDelta) static_cast(m_pElementObject)->Set_Angle(m_fAngle); } + GUI::Text("SpellType %d", m_iSkillType); GUI::Text("SkillType %d", m_iSpellType); if (GUI::Combo("SkillType", &m_iSpellType, SpellTypeNames, itemCount)) { diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 616fba8e9..7eba695cc 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -519,7 +519,7 @@ HRESULT CLoader::Loading_For_UI() return E_FAIL; } - /*if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::UI), TEXT("Accio"), + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::UI), TEXT("Accio"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("C:\\MeshTable\\SpellAnim\\Accio\\Accio%d.png"), 151)))) { return E_FAIL; @@ -547,7 +547,7 @@ HRESULT CLoader::Loading_For_UI() CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("C:\\MeshTable\\SpellAnim\\Ancient_Magic_Throw\\Ancient_Magic_Throw%d.png"), 89)))) { return E_FAIL; - }*/ + } if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::UI), TEXT("Arresto_Momentum"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("C:\\MeshTable\\SpellAnim\\Arresto_Momentum\\Arresto_Momentum%d.png"), 120)))) @@ -555,7 +555,7 @@ HRESULT CLoader::Loading_For_UI() return E_FAIL; } - /*if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::UI), TEXT("Avada_Kedavra"), + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::UI), TEXT("Avada_Kedavra"), CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("C:\\MeshTable\\SpellAnim\\Avada_Kedavra\\Avada_Kedavra%d.png"), 208)))) { return E_FAIL; @@ -726,7 +726,7 @@ HRESULT CLoader::Loading_For_UI() CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("C:\\MeshTable\\SpellAnim\\Crucio\\Crucio%d.png"), 216)))) { return E_FAIL; - }*/ + } m_strMessage = TEXT("Model Loading.."); diff --git a/Jusin154_Team3D/Editor/Private/Spell_Anim.cpp b/Jusin154_Team3D/Editor/Private/Spell_Anim.cpp index 7462c5ddc..6eaf8ff10 100644 --- a/Jusin154_Team3D/Editor/Private/Spell_Anim.cpp +++ b/Jusin154_Team3D/Editor/Private/Spell_Anim.cpp @@ -160,15 +160,15 @@ void CSpell_Anim::Set_FadeIn() HRESULT CSpell_Anim::Change_Image(_int SpellID) { - //_wstring pImageName = static_cast(m_pOwner)->Get_Info(SpellID).pImage_Name; - //m_iTotalFrames = static_cast(m_pOwner)->Get_Info(SpellID).iAnimNum; - //if (m_pDiffuse_TextureCom) - //{ - // Remove_Component(); - // SAFE_RELEASE(m_pDiffuse_TextureCom); - //} - //if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(LEVEL::UI), pImageName, reinterpret_cast(&m_pDiffuse_TextureCom)))) - // return E_FAIL; + _wstring pImageName = static_cast(m_pOwner)->Get_Info(SpellID).pImage_Name; + m_iTotalFrames = static_cast(m_pOwner)->Get_Info(SpellID).iAnimNum; + if (m_pDiffuse_TextureCom) + { + Remove_Component(); + SAFE_RELEASE(m_pDiffuse_TextureCom); + } + if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(LEVEL::UI), pImageName, reinterpret_cast(&m_pDiffuse_TextureCom)))) + return E_FAIL; return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Spell_Drag.cpp b/Jusin154_Team3D/Editor/Private/Spell_Drag.cpp index 3902409b4..c9024e64e 100644 --- a/Jusin154_Team3D/Editor/Private/Spell_Drag.cpp +++ b/Jusin154_Team3D/Editor/Private/Spell_Drag.cpp @@ -44,6 +44,8 @@ HRESULT CSpell_Drag::Initialize(void* pArg) m_fSortZ = 0.f; m_iSkillType = ENUM_CLASS(SKILL_TYPE::ARRESTO_MOMENTUM); Compute_UI(m_iSkillType); + m_bMove = false; + m_bClick = false; static_cast(m_pOwner)->Add_Function(TEXT("Slot_Hover"), [this](void* p) {this->Set_SpellType(*reinterpret_cast<_int*>(p)); }); return S_OK; } @@ -89,26 +91,78 @@ void CSpell_Drag::Update(_float fTimeDelta) } m_fTime += fTimeDelta * m_fTimeMult; + Get_MousePos(); - if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON)) + if (m_iSpellType != -1 && m_iSpellType <= 26) { m_bHover = true; + Compute_UI(static_cast(m_pOwner)->Get_Info(m_iSpellType).iSkill_Type); + } - if (m_pGameInstance->Mouse_Up(DIM_LBUTTON)) + else { m_bHover = false; } + if (m_bHover == true) + { + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON)) + { + m_vStart_MousePos = XMVectorSet(0.f, 0.f, 0.f, 0.f); - POINT m_pPt{}; - GetCursorPos(&m_pPt); - ScreenToClient(g_hWnd, &m_pPt); - _float2 fMouse{}; - fMouse.x = m_pPt.x - (g_iWinSizeX * 0.5f); - fMouse.y = m_pPt.y - (g_iWinSizeY * 0.5f); + POINT m_pPt{}; + GetCursorPos(&m_pPt); + ScreenToClient(g_hWnd, &m_pPt); + _float2 fMouse{}; + fMouse.x = m_pPt.x - (g_iWinSizeX * 0.5f); + fMouse.y = m_pPt.y - (g_iWinSizeY * 0.5f); - MoveX(fMouse.x); - MoveY(fMouse.y); + m_vStart_MousePos = XMVectorSet(fMouse.x, fMouse.y, 0.f, 1.f); + } + + if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON)) + { + POINT pt{}; + GetCursorPos(&pt); + ScreenToClient(g_hWnd, &pt); + + float moveX = pt.x - (g_iWinSizeX * 0.5f); + float moveY = pt.y - (g_iWinSizeY * 0.5f); + + m_vMove_MousePos = XMVectorSet(moveX, moveY, 0.f, 1.f); + + _vector Dir = m_vMove_MousePos - m_vStart_MousePos; + _float fLength2 = XMVectorGetX(XMVector2Dot(Dir, Dir)); + + if (fLength2 >= 50.f) + { + m_bMove = true; + } + m_bClick = true; + + } + } + else + { + m_iSpellType = -1; + } + + if (m_bMove == true) + { + MoveX(Get_MousePos().x); + MoveY(Get_MousePos().y); + } + + + if (m_pGameInstance->Mouse_Up(DIM_LBUTTON) && m_bClick == true) + { + m_bHover = false; + m_bClick = false; + m_bMove = false; + m_iSpellType = -1; + } + + static_cast(m_pOwner)->Function_Callback(TEXT("Click"), &m_bClick); __super::Update(fTimeDelta); @@ -121,7 +175,7 @@ void CSpell_Drag::Late_Update(_float fTimeDelta) return; } if (m_bVisible) { - if (m_bHover == true) + if (m_bMove == true) { m_pGameInstance->Add_RenderGroup(RENDER::UI, this); } @@ -131,26 +185,22 @@ void CSpell_Drag::Late_Update(_float fTimeDelta) HRESULT CSpell_Drag::Render() { - if (m_bHover == true) + if (FAILED(Bind_ShaderResources())) { - if (FAILED(Bind_ShaderResources())) - { - return E_FAIL; - } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::SPELL_DRAG)))) - { - return E_FAIL; - } - if (FAILED(m_pVIBufferCom->Bind_Resources())) - { - return E_FAIL; - } - if (FAILED(m_pVIBufferCom->Render())) - { - return E_FAIL; - } + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::SPELL_DRAG)))) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) + { + return E_FAIL; } - return S_OK; } @@ -243,7 +293,7 @@ HRESULT CSpell_Drag::Ready_Components(void* pArg) { return E_FAIL; } - if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Atlas_Spell"), reinterpret_cast(&m_pDiffuse_TextureCom3), nullptr))) + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Atlas_Widget_Spell"), reinterpret_cast(&m_pDiffuse_TextureCom3), nullptr))) { return E_FAIL; } @@ -257,10 +307,10 @@ HRESULT CSpell_Drag::Ready_Components(void* pArg) void CSpell_Drag::Compute_UI(_uint SpellID) { - _float2 fImage_Size = { 1024.f, 1536.f }; + _float2 fImage_Size = { 1024.f, 1792.f }; _uint iCountX = 4; - _uint iCountY = 6; + _uint iCountY = 7; _float iImageX = 256.f; _float iImageY = 256.f; @@ -282,12 +332,20 @@ void CSpell_Drag::Compute_UI(_uint SpellID) void CSpell_Drag::Set_SpellType(_int SpellID) { - m_iSkillType = SpellID; - if (m_iSkillType != -1) - { - m_iSkillType = static_cast(m_pOwner)->Get_Info(SpellID).iSkill_Type; - Compute_UI(m_iSkillType); - } + m_iSpellType = SpellID; +} + +_float2 CSpell_Drag::Get_MousePos() +{ + POINT m_pPt{}; + GetCursorPos(&m_pPt); + ScreenToClient(g_hWnd, &m_pPt); + _float2 fMouse{}; + fMouse.x = m_pPt.x - (g_iWinSizeX * 0.5f); + fMouse.y = m_pPt.y - (g_iWinSizeY * 0.5f); + + m_vMove_MousePos = XMVectorSet(fMouse.x, fMouse.y, 0.f, 1.f); + return fMouse; } CSpell_Drag* CSpell_Drag::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) diff --git a/Jusin154_Team3D/Editor/Private/Spell_Hover.cpp b/Jusin154_Team3D/Editor/Private/Spell_Hover.cpp index 9604d77e7..153a96e8b 100644 --- a/Jusin154_Team3D/Editor/Private/Spell_Hover.cpp +++ b/Jusin154_Team3D/Editor/Private/Spell_Hover.cpp @@ -90,7 +90,11 @@ void CSpell_Hover::Update(_float fTimeDelta) } } - m_pVIBufferCom->Set_Hover_Index(m_iSpellType); + if (m_bClick == false) + { + m_pVIBufferCom->Set_Hover_Index(m_iSpellType); + } + m_fTime += fTimeDelta * m_fTimeMult; __super::Update(fTimeDelta); @@ -155,6 +159,18 @@ void CSpell_Hover::SizeUpdate(_float fSizeX, _float fSizeY) m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); } +void CSpell_Hover::Click_Slot(_bool bClick) +{ + if (bClick == true) + { + m_bClick = true; + } + else + { + m_bClick = false; + } +} + HRESULT CSpell_Hover::Bind_ShaderResources() { if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) diff --git a/Jusin154_Team3D/Editor/Private/Spell_Hover_Effect.cpp b/Jusin154_Team3D/Editor/Private/Spell_Hover_Effect.cpp index d323d9f12..9c6ad5484 100644 --- a/Jusin154_Team3D/Editor/Private/Spell_Hover_Effect.cpp +++ b/Jusin154_Team3D/Editor/Private/Spell_Hover_Effect.cpp @@ -90,7 +90,11 @@ void CSpell_Hover_Effect::Update(_float fTimeDelta) m_fAlpha = 0.f; } } - m_pVIBufferCom->Set_Hover_Index(m_iSpellType); + if (m_bClick == false) + { + m_pVIBufferCom->Set_Hover_Index(m_iSpellType); + } + m_fTime += fTimeDelta * m_fTimeMult; __super::Update(fTimeDelta); } @@ -154,6 +158,18 @@ void CSpell_Hover_Effect::SizeUpdate(_float fSizeX, _float fSizeY) m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); } +void CSpell_Hover_Effect::Click_Slot(_bool bClick) +{ + if (bClick == true) + { + m_bClick = true; + } + else + { + m_bClick = false; + } +} + HRESULT CSpell_Hover_Effect::Bind_ShaderResources() { if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) diff --git a/Jusin154_Team3D/Editor/Private/Spell_List.cpp b/Jusin154_Team3D/Editor/Private/Spell_List.cpp index 2285e0425..3afd78cd1 100644 --- a/Jusin154_Team3D/Editor/Private/Spell_List.cpp +++ b/Jusin154_Team3D/Editor/Private/Spell_List.cpp @@ -48,7 +48,9 @@ HRESULT CSpell_List::Initialize(void* pArg) m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); m_fDelayTime = 0.5f; m_iPerSpell_Slot = -1; + m_bClick = false; Color(); + static_cast(m_pOwner)->Add_Function(TEXT("Click"), [this](void* p) {this->Click_Slot(*reinterpret_cast<_bool*>(p)); }); return S_OK; } @@ -92,7 +94,11 @@ void CSpell_List::Update(_float fTimeDelta) } } m_fTime += fTimeDelta * m_fTimeMult; - Hover(fTimeDelta); + if (m_bClick == false) + { + Hover(); + } + __super::Update(fTimeDelta); } @@ -158,16 +164,16 @@ void CSpell_List::SizeUpdate(_float fSizeX, _float fSizeY) void CSpell_List::Color() { - m_pVIBufferCom->Set_Index_Renge_Color(0, 3, _float4(255.f / 255.f, 255.f / 255.f, 0.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(4, 7, _float4(150.f / 255.f, 120.f / 255.f, 240.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(8, 12, _float4(190.f / 255.f, 46.f / 255.f, 34.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(13, 16, _float4(24.f / 255.f, 190.f / 255.f, 255.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(17, 19, _float4(200.f / 255.f, 220.f / 255.f, 150.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(20, 22, _float4(50.f / 255.f, 150.f / 255.f, 110.f / 255.f, 1.f)); - m_pVIBufferCom->Set_Index_Renge_Color(23, 25, _float4(24.f / 255.f, 190.f / 255.f, 255.f / 255.f, 1.f)); + m_pVIBufferCom->Set_Index_Renge_Color(0, 3, 0.f); + m_pVIBufferCom->Set_Index_Renge_Color(4, 7, 1.f); + m_pVIBufferCom->Set_Index_Renge_Color(8, 12, 2.f); + m_pVIBufferCom->Set_Index_Renge_Color(13, 16, 3.f); + m_pVIBufferCom->Set_Index_Renge_Color(17, 19, 4.f); + m_pVIBufferCom->Set_Index_Renge_Color(20, 22, 5.f); + m_pVIBufferCom->Set_Index_Renge_Color(23, 25, 3.f); } -void CSpell_List::Hover(_float fTimeDelta) +void CSpell_List::Hover() { POINT ptMouse{}; GetCursorPos(&ptMouse); @@ -198,6 +204,18 @@ void CSpell_List::Hover(_float fTimeDelta) } +void CSpell_List::Click_Slot(_bool bClick) +{ + if (bClick == true) + { + m_bClick = true; + } + else + { + m_bClick = false; + } +} + HRESULT CSpell_List::Bind_ShaderResources() { if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) diff --git a/Jusin154_Team3D/Editor/Private/Spell_Panel.cpp b/Jusin154_Team3D/Editor/Private/Spell_Panel.cpp index 5da8db97e..5f59f6a62 100644 --- a/Jusin154_Team3D/Editor/Private/Spell_Panel.cpp +++ b/Jusin154_Team3D/Editor/Private/Spell_Panel.cpp @@ -60,6 +60,7 @@ HRESULT CSpell_Panel::Initialize(void* pArg) m_iPendingSpell = -1; m_fDelayTime = 1.f; Add_Function(TEXT("Hover"), [this](void* p) {this->Slot_Chack(p); }); + Add_Function(TEXT("Click"), [this](void* p) {this->Click_Slot(*reinterpret_cast<_bool*>(p)); }); return S_OK; } @@ -156,7 +157,22 @@ void CSpell_Panel::Slot_Chack(void* pArg) } m_iSpellType = finalHover; - Function_Callback(TEXT("Slot_Hover"), &m_iSpellType); + if (m_bHover == false) + { + Function_Callback(TEXT("Slot_Hover"), &m_iSpellType); + } +} + +void CSpell_Panel::Click_Slot(_bool bClick) +{ + if (bClick == true) + { + m_bHover = true; + } + else + { + m_bHover = false; + } } HRESULT CSpell_Panel::Bind_ShaderResources() diff --git a/Jusin154_Team3D/Editor/Private/Spell_State.cpp b/Jusin154_Team3D/Editor/Private/Spell_State.cpp index 44fdf495c..cf8f5df3c 100644 --- a/Jusin154_Team3D/Editor/Private/Spell_State.cpp +++ b/Jusin154_Team3D/Editor/Private/Spell_State.cpp @@ -46,6 +46,7 @@ HRESULT CSpell_State::Initialize(void* pArg) m_pVIBufferCom->Set_Cloned(true); m_pVIBufferCom->Set_Pos(-185.f, 375.f, m_fOffSetX, m_fOffSetY, m_iCols); m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); + static_cast(m_pOwner)->Add_Function(TEXT("Slot_Hover"), [this](void* p) {this->Set_SkillType(*reinterpret_cast<_int*>(p)); }); return S_OK; } @@ -89,7 +90,11 @@ void CSpell_State::Update(_float fTimeDelta) } } m_fTime += fTimeDelta * m_fTimeMult; - Hover(); + if (m_bClick == false) + { + m_pVIBufferCom->Set_Hover_Index(m_iSpellType); + } + __super::Update(fTimeDelta); } @@ -152,21 +157,16 @@ void CSpell_State::SizeUpdate(_float fSizeX, _float fSizeY) m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); } -void CSpell_State::Hover() +void CSpell_State::Click_Slot(_bool bClick) { - POINT ptMouse{}; - GetCursorPos(&ptMouse); - ScreenToClient(g_hWnd, &ptMouse); - _float2 fMouse; - fMouse.x = ptMouse.x - (g_iWinSizeX * 0.5f); - fMouse.y = -(ptMouse.y - (g_iWinSizeY * 0.5f)); - - // 엘리먼트의 월드 위치를 더해주면 엘리먼트 좌표계 기준이 됨 - fMouse.x -= m_pOwner->Get_WorldPostion().m128_f32[0]; - fMouse.y -= m_pOwner->Get_WorldPostion().m128_f32[1]; - - m_pVIBufferCom->Set_Mouse_Hover(fMouse); - + if (bClick == true) + { + m_bClick = true; + } + else + { + m_bClick = false; + } } HRESULT CSpell_State::Bind_ShaderResources() diff --git a/Jusin154_Team3D/Editor/Public/Current_Spell_Slot.h b/Jusin154_Team3D/Editor/Public/Current_Spell_Slot.h index 4bba09fc0..e870577c0 100644 --- a/Jusin154_Team3D/Editor/Public/Current_Spell_Slot.h +++ b/Jusin154_Team3D/Editor/Public/Current_Spell_Slot.h @@ -23,6 +23,13 @@ class CCurrent_Spell_Slot final : public CElementObject virtual void SizeUpY(_float fSizeY) override; virtual void SizeUpdate(_float fSizeX, _float fSizeY) override; +private: + void Hover(); + void Click_Slot(_bool bClick); + void Get_Skill(_int Index); + void Clear(_int iValue); + + _float4 UV(_int SpellID); private: virtual HRESULT Bind_ShaderResources() override; @@ -31,13 +38,20 @@ class CCurrent_Spell_Slot final : public CElementObject virtual HRESULT Initialize(void* pArg) override; private: - CTexture* m_pDiffuse_TextureCom = { nullptr }; - CShader* m_pShaderCom = { nullptr }; - CVIBuffer_UI_Instance* m_pVIBufferCom = { nullptr }; + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CTexture* m_pDiffuse_TextureCom1 = { nullptr }; + CTexture* m_pDiffuse_TextureCom2 = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_UI_Instance* m_pVIBufferCom = { nullptr }; - _float m_fOffSetX{}; - _float m_fOffSetY{}; - _uint m_iCols{}; + _float m_fOffSetX{}; + _float m_fOffSetY{}; + _uint m_iCols{}; + + _bool m_bGetSpell = { false }; + _int m_iSlot_Index{}; + _int m_iSpell[4][4]{}; + CVIBuffer_UI_Instance::UI_ATLAS_DESC m_vUV{}; public: static CCurrent_Spell_Slot* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index c1bbe2c31..15455d2c4 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -27,8 +27,8 @@ namespace Editor enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, TRAIL_BLUR , TRAIL_BLOOM, 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,END }; - enum class SHADER_PASS_UIEDITOR { DEFAULT, ALPHABLEND, CLAMP, CURSOR, LODING, HOLD_ROTATION, MISSION, QUESTYPE, UVMULT, NINECLICE, ROTATION, SLOT, TYPE, HPBAR, MAGIC_METER, MAGIC_ICON, REMOVEUV, REVELIO, POTION, MAGIC_ITEM, SPELL_PREVIEW, SPELL_HEADER, SPELL_HEADER_LINE, SPELL_DRAG, END }; - enum class SHADER_PASS_UIINTANCE { DEFAULT, ALPHABLEND, MAGIC_METER, SPELL_LIST, EESSENTIAL_SPELL_SOLT, EESSENTIAL_SPELL, COLOR, SPELL_HOVER, SPELL_SLOT_EFFECT, END }; + enum class SHADER_PASS_UIEDITOR { DEFAULT, ALPHABLEND,CLAMP, CURSOR, LODING, HOLD_ROTATION, MISSION, QUESTYPE, UVMULT, NINECLICE, ROTATION, SLOT, TYPE, HPBAR, MAGIC_METER, MAGIC_ICON, REMOVEUV, REVELIO, POTION, MAGIC_ITEM, SPELL_PREVIEW, SPELL_HEADER, SPELL_HEADER_LINE, SPELL_DRAG, END }; + enum class SHADER_PASS_UIINTANCE { DEFAULT, ALPHABLEND, UVALPHABLEND, MAGIC_METER, SPELL_LIST, EESSENTIAL_SPELL_SOLT, EESSENTIAL_SPELL, COLOR, SPELL_HOVER, SPELL_SLOT_EFFECT, SPELL_SLOT, END }; diff --git a/Jusin154_Team3D/Editor/Public/Eessential_Spell_Slot.h b/Jusin154_Team3D/Editor/Public/Eessential_Spell_Slot.h index 5ce4f508f..a99fea74a 100644 --- a/Jusin154_Team3D/Editor/Public/Eessential_Spell_Slot.h +++ b/Jusin154_Team3D/Editor/Public/Eessential_Spell_Slot.h @@ -25,7 +25,7 @@ class CEessential_Spell_Slot final : public CElementObject private: - void Hover(_float fTimeDelta); + void Hover(); private: virtual HRESULT Bind_ShaderResources() override; diff --git a/Jusin154_Team3D/Editor/Public/IMGUIUI.h b/Jusin154_Team3D/Editor/Public/IMGUIUI.h index 77f8ef5fe..b930ebdff 100644 --- a/Jusin154_Team3D/Editor/Public/IMGUIUI.h +++ b/Jusin154_Team3D/Editor/Public/IMGUIUI.h @@ -49,6 +49,7 @@ class CIMGUIUI final : public CGameObject _float2 m_UV{}; _int m_iSpellType{}; + _int m_iSkillType{}; _vector m_vLerpPosition{}; _float m_fLerpX{}; diff --git a/Jusin154_Team3D/Editor/Public/Spell_Drag.h b/Jusin154_Team3D/Editor/Public/Spell_Drag.h index a304f1925..cf2c58df2 100644 --- a/Jusin154_Team3D/Editor/Public/Spell_Drag.h +++ b/Jusin154_Team3D/Editor/Public/Spell_Drag.h @@ -29,6 +29,7 @@ class CSpell_Drag final : public CElementObject private: void Compute_UI(_uint SpellID); virtual void Set_SpellType(_int SpellID) override; + _float2 Get_MousePos(); private: CTexture* m_pDiffuse_TextureCom = { nullptr }; @@ -38,8 +39,12 @@ class CSpell_Drag final : public CElementObject CShader* m_pShaderCom = { nullptr }; CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + _vector m_vStart_MousePos{}; + _vector m_vMove_MousePos{}; _float4 m_vUV{}; - _float2 m_fCenter{}; + + _bool m_bMove = { false }; + _bool m_bClick = { false }; public: static CSpell_Drag* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; diff --git a/Jusin154_Team3D/Editor/Public/Spell_Hover.h b/Jusin154_Team3D/Editor/Public/Spell_Hover.h index 7aeeca08a..b6ceb64fb 100644 --- a/Jusin154_Team3D/Editor/Public/Spell_Hover.h +++ b/Jusin154_Team3D/Editor/Public/Spell_Hover.h @@ -28,7 +28,7 @@ class CSpell_Hover final : public CElementObject virtual void SizeUpdate(_float fSizeX, _float fSizeY) override; private: - void Hover(); + void Click_Slot(_bool bClick); private: virtual HRESULT Bind_ShaderResources() override; diff --git a/Jusin154_Team3D/Editor/Public/Spell_Hover_Effect.h b/Jusin154_Team3D/Editor/Public/Spell_Hover_Effect.h index 2216e07f9..64dd364f2 100644 --- a/Jusin154_Team3D/Editor/Public/Spell_Hover_Effect.h +++ b/Jusin154_Team3D/Editor/Public/Spell_Hover_Effect.h @@ -27,6 +27,9 @@ class CSpell_Hover_Effect final : public CElementObject virtual void SizeUpY(_float fSizeY) override; virtual void SizeUpdate(_float fSizeX, _float fSizeY) override; +private: + void Click_Slot(_bool bClick); + private: virtual HRESULT Bind_ShaderResources() override; virtual HRESULT Ready_Components(void* pArg) override; diff --git a/Jusin154_Team3D/Editor/Public/Spell_List.h b/Jusin154_Team3D/Editor/Public/Spell_List.h index a74245592..35f9f082a 100644 --- a/Jusin154_Team3D/Editor/Public/Spell_List.h +++ b/Jusin154_Team3D/Editor/Public/Spell_List.h @@ -29,7 +29,8 @@ class CSpell_List final : public CElementObject private: void Color(); - void Hover(_float fTimeDelta); + void Hover(); + void Click_Slot(_bool bClick); private: virtual HRESULT Bind_ShaderResources() override; @@ -49,6 +50,7 @@ class CSpell_List final : public CElementObject _int m_iPerSpell_Slot{}; _float m_fHoverTime{}; + public: static CSpell_List* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; diff --git a/Jusin154_Team3D/Editor/Public/Spell_Panel.h b/Jusin154_Team3D/Editor/Public/Spell_Panel.h index 591b21546..c6159b5be 100644 --- a/Jusin154_Team3D/Editor/Public/Spell_Panel.h +++ b/Jusin154_Team3D/Editor/Public/Spell_Panel.h @@ -29,7 +29,7 @@ class CSpell_Panel final : public CPanelObject private: void Slot_Chack(void* pArg); - + void Click_Slot(_bool Click); private: virtual HRESULT Bind_ShaderResources() override; diff --git a/Jusin154_Team3D/Editor/Public/Spell_State.h b/Jusin154_Team3D/Editor/Public/Spell_State.h index ae6d7a509..09f34bacf 100644 --- a/Jusin154_Team3D/Editor/Public/Spell_State.h +++ b/Jusin154_Team3D/Editor/Public/Spell_State.h @@ -28,7 +28,7 @@ class CSpell_State final : public CElementObject virtual void SizeUpdate(_float fSizeX, _float fSizeY) override; private: - void Hover(); + void Click_Slot(_bool bClick); private: virtual HRESULT Bind_ShaderResources() override; diff --git a/Jusin154_Team3D/Engine/Private/PanelObject.cpp b/Jusin154_Team3D/Engine/Private/PanelObject.cpp index 73c36b4f2..d41593c87 100644 --- a/Jusin154_Team3D/Engine/Private/PanelObject.cpp +++ b/Jusin154_Team3D/Engine/Private/PanelObject.cpp @@ -45,7 +45,7 @@ void CPanelObject::Update(_float fTimeDelta) 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], - 0.f, 1.f)); + m_fSortZ, 1.f)); m_fCurrent_Position = XMVectorSet(m_fX, m_fY, 0.f, 1.f); diff --git a/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp b/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp index 57426e437..b99dbdb0d 100644 --- a/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp +++ b/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp @@ -119,8 +119,9 @@ HRESULT CVIBuffer_UI_Instance::Initialize_Prototype(const INSTANCE_DESC* pInstan m_pInstanceVertices[i].fSize = _float2(1.f, 1.f); // 기본 크기 m_pInstanceVertices[i].fPos = _float2(0.f, 0.f); // 기본 위치 m_pInstanceVertices[i].fUV = _float4(0.f, 0.f, 1.f, 1.f); // 전체 텍스처 영역 - m_pInstanceVertices[i].vColor = _float4(1.f, 1.f, 1.f, 1.f); // 기본 흰색 + m_pInstanceVertices[i].vColor = 0; // 기본 흰색 m_pInstanceVertices[i].bHover = 0; + m_pInstanceVertices[i].bSpell = 0; } m_InstanceInitialDesc.pSysMem = m_pInstanceVertices; @@ -249,7 +250,20 @@ void CVIBuffer_UI_Instance::Set_ImageUV(UI_ATLAS_DESC* AtlasUV) m_pContext->Unmap(m_pVBInstance, 0); } -void CVIBuffer_UI_Instance::Set_Index_Renge_Color(_uint StartIndex, _uint EndIndex, _float4 vColor) +void CVIBuffer_UI_Instance::Set_Index_ImageUV(_int Index, UI_ATLAS_DESC AtlasUV) +{ + D3D11_MAPPED_SUBRESOURCE SubResource{}; + + m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource); + + VTX_INSTANCE_UI* pVertices = static_cast(SubResource.pData); + + pVertices[Index].fUV = AtlasUV.fUV; + + m_pContext->Unmap(m_pVBInstance, 0); +} + +void CVIBuffer_UI_Instance::Set_Index_Renge_Color(_uint StartIndex, _uint EndIndex, _float Color) { D3D11_MAPPED_SUBRESOURCE SubResource{}; @@ -259,12 +273,25 @@ void CVIBuffer_UI_Instance::Set_Index_Renge_Color(_uint StartIndex, _uint EndInd for (size_t i = StartIndex; i <= EndIndex; i++) { - pVertices[i].vColor = vColor; + pVertices[i].vColor = Color; } m_pContext->Unmap(m_pVBInstance, 0); } +void CVIBuffer_UI_Instance::Set_Index_Color(_int Index, _float vColor) +{ + D3D11_MAPPED_SUBRESOURCE SubResource{}; + + m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource); + + VTX_INSTANCE_UI* pVertices = static_cast(SubResource.pData); + + pVertices[Index].vColor = vColor; + + m_pContext->Unmap(m_pVBInstance, 0); +} + _int CVIBuffer_UI_Instance::Set_Mouse_Hover(_float2 fMousePos) { D3D11_MAPPED_SUBRESOURCE SubResource{}; @@ -330,6 +357,19 @@ void CVIBuffer_UI_Instance::Set_Hover_Index(_uint iIndex) m_pContext->Unmap(m_pVBInstance, 0); } +void CVIBuffer_UI_Instance::Set_Equip_Index(_uint iIndex) +{ + D3D11_MAPPED_SUBRESOURCE SubResource{}; + + m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource); + + VTX_INSTANCE_UI* pVertices = static_cast(SubResource.pData); + + pVertices[iIndex].bSpell = 1.f; + + m_pContext->Unmap(m_pVBInstance, 0); +} + CVIBuffer_UI_Instance* CVIBuffer_UI_Instance::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const INSTANCE_DESC* pInstanceDesc) { CVIBuffer_UI_Instance* pInstance = new CVIBuffer_UI_Instance(pDevice, pContext); diff --git a/Jusin154_Team3D/Engine/Public/Engine_Struct.h b/Jusin154_Team3D/Engine/Public/Engine_Struct.h index cae318eb1..d572c6402 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Struct.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Struct.h @@ -201,8 +201,9 @@ typedef struct tagVertexInstance_UI _float2 fSize = {}; _float2 fPos = {}; _float4 fUV = _float4(0.f, 0.f, 1.f, 1.f); - _float4 vColor = _float4(1.f, 1.f, 1.f, 1.f); + _float vColor = 0; _float bHover = 0; + _float bSpell = 0; }VTX_INSTANCE_UI; typedef struct tagVertexBlock @@ -362,7 +363,7 @@ typedef struct tagVertexModelInstanceModelDesc typedef struct tagVertexInstance_UIDesc { - static constexpr unsigned int iNumElements = { 7 }; + static constexpr unsigned int iNumElements = { 8 }; static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}, @@ -370,8 +371,9 @@ typedef struct tagVertexInstance_UIDesc { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 1, 0, D3D11_INPUT_PER_INSTANCE_DATA, 1 }, { "TEXCOORD", 2, DXGI_FORMAT_R32G32_FLOAT, 1, 8, D3D11_INPUT_PER_INSTANCE_DATA, 1 }, { "TEXCOORD", 3, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 16, D3D11_INPUT_PER_INSTANCE_DATA, 1 }, - { "TEXCOORD", 4, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 32, D3D11_INPUT_PER_INSTANCE_DATA, 1 }, - { "TEXCOORD", 5, DXGI_FORMAT_R32_FLOAT, 1, 48, D3D11_INPUT_PER_INSTANCE_DATA, 1 } + { "TEXCOORD", 4, DXGI_FORMAT_R32_FLOAT, 1, 32, D3D11_INPUT_PER_INSTANCE_DATA, 1 }, + { "TEXCOORD", 5, DXGI_FORMAT_R32_FLOAT, 1, 36, D3D11_INPUT_PER_INSTANCE_DATA, 1 }, + { "TEXCOORD", 6, DXGI_FORMAT_R32_FLOAT, 1, 40, D3D11_INPUT_PER_INSTANCE_DATA, 1 } }; }VTX_POSTEX_INSTANCE_UI; diff --git a/Jusin154_Team3D/Engine/Public/UIObject.h b/Jusin154_Team3D/Engine/Public/UIObject.h index 4c73bf661..bb47c7c1e 100644 --- a/Jusin154_Team3D/Engine/Public/UIObject.h +++ b/Jusin154_Team3D/Engine/Public/UIObject.h @@ -184,7 +184,7 @@ typedef struct SlotHover _float4 m_vNine_Slice{}; _float m_fTopY{}; - + _bool m_bClick = { false }; protected: virtual HRESULT Initialize_Prototype(); virtual HRESULT Initialize(void* pArg); diff --git a/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h b/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h index c20a19ae6..257759566 100644 --- a/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h +++ b/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h @@ -32,9 +32,12 @@ class ENGINE_DLL CVIBuffer_UI_Instance final : public CVIBuffer_Instance void Set_SizeY(_float fSizeY); void Set_Cloned(_bool isCloned) { m_isCloned = isCloned; } void Set_ImageUV(UI_ATLAS_DESC* AtlasUV); - void Set_Index_Renge_Color(_uint StartIndex, _uint EndIndex, _float4 vColor); + void Set_Index_ImageUV(_int Index, UI_ATLAS_DESC AtlasUV); + void Set_Index_Renge_Color(_uint StartIndex, _uint EndIndex, _float vColor); + void Set_Index_Color(_int Index, _float vColor); _int Set_Mouse_Hover(_float2 fMousePos); void Set_Hover_Index(_uint iIndex); + void Set_Equip_Index(_uint iIndex); private: VTX_INSTANCE_UI* m_pInstanceVertices = { nullptr };