diff --git a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index c4aaf44f6..5c51ddefb 100644 --- a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -64,15 +64,19 @@ Texture2D g_DiffuseTexture; Texture2D g_MaskingTexture; int g_iHover; +int g_iBoosterOn; +int g_iBoosterOff; int g_iClick; int g_iColor; int g_Count; +int g_ChaseCount; int g_iStep1 = 0; int g_iStep2 = 0; int g_iStep3 = 0; -float2 g_Trail[1000]; +float2 g_Trail[200]; +float2 g_ChaseTrail[200]; struct VS_IN @@ -1800,7 +1804,7 @@ PS_OUT PS_SpellLearnColor(PS_IN In) Color.rgb *= tex1.rgb; - float2 rectPos = g_fPosition - float2(256.f,259.f); + float2 rectPos = g_fPosition - float2(256.f, 259.f); float2 rectSize = g_fCurrent_Size; float2 itemPos = g_fItemPosition1; @@ -1831,13 +1835,74 @@ PS_OUT PS_SpellLearnColor(PS_IN In) pixelPos.y >= trailCenter.y - halfHeight && pixelPos.y <= trailCenter.y + halfHeight) { - Color.rgb = float3(0.f, 144.f, 248.f) / 255.f; + Color.rgb = float3(20.f, 100.f, 180.f) / 255.f; + break; + } + } + + for (int j = 0; j < g_ChaseCount; ++j) + { + float2 ChaseTopLeft = g_ChaseTrail[j]; + float2 ChaseCenter = ChaseTopLeft + itemSize / 2.0f; + + float halfWidth = itemSize.x * 0.7f; + float halfHeight = itemSize.y * 0.7f; + + if (pixelPos.x >= ChaseCenter.x - halfWidth && + pixelPos.x <= ChaseCenter.x + halfWidth && + pixelPos.y >= ChaseCenter.y - halfHeight && + pixelPos.y <= ChaseCenter.y + halfHeight) + { + Color.rgb = float3(110.f, 5.f, 5.f) / 255.f; break; } } - Color. - a *= Alpha; + Color.a *= Alpha; + Out.vColor = Color; + return Out; +} + +PS_OUT PS_SpellLearnBooster(PS_IN In) +{ + PS_OUT Out; + float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; + + float4 Color = float4(1.f, 1.f, 1.f, 1.f); + float4 tex = g_Texture.Sample(DefaultSampler, In.vTexcoord); + + Color = tex; + + float2 Imagetexpos1 = g_fImageSipos1.xy / g_fCurrent_Size; + float2 Imagetexsize1 = g_fImageSipos1.zw / g_fCurrent_Size; + float2 Imagelocal = (In.vTexcoord - Imagetexpos1) / Imagetexsize1; + bool inside1 = all(Imagelocal >= 0.0f && Imagelocal <= 1.0f); + + if (g_iBoosterOn == 0 && g_iBoosterOff == 0) + { + if (inside1) + { + float4 tex1 = g_Texture1.Sample(DefaultSampler, Imagelocal); + Color = lerp(Color, tex1, tex1.a); + } + } + else if (g_iBoosterOn != 0 && g_iBoosterOff == 0) + { + + float4 tex3 = g_Texture3.Sample(DefaultSampler, In.vTexcoord); + Color = lerp(Color, tex3, tex3.a); + } + else if (g_iBoosterOn == 0 && g_iBoosterOff != 0) + { + float4 tex2 = g_Texture2.Sample(DefaultSampler, In.vTexcoord); + + tex2.rgb *= float3(1.f, 0.f, 0.f); + Color = tex; + + Color = lerp(Color, tex2, tex2.a); + } + + Color.a *= Alpha; Out.vColor = Color; return Out; } @@ -2432,6 +2497,16 @@ technique11 PosTexTechnique11 PixelShader = compile ps_5_0 PS_SpellLearnColor(); } + pass SpellLearnBooster + { + 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(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_SpellLearnBooster(); + } + pass Enemy_Detection { SetRasterizerState(RS_Nocull); diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 6cab1a64e..9037c9d0b 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -164,11 +164,16 @@ call Update_Resources.bat + + + + + @@ -382,11 +387,16 @@ call Update_Resources.bat + + + + + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 2c5421783..bd20d183c 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -637,7 +637,7 @@ 02.GameObjects\Effect\Effects\Lightning\LightningSide - + 04.Mechanic\State\State_Combat\State_FireSweep @@ -674,6 +674,21 @@ 02.GameObjects\UI\SpellLearn_Canvas + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Slot + + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Overlay + + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLeam_LookPointer + + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_ChaserPointer + + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Booster + @@ -1407,6 +1422,21 @@ {69f95207-1e94-42f2-9690-d3e34e4ff5a9} + + {d9c0bcb6-64f6-4b58-a68d-ff04c91b9861} + + + {61024044-17a9-45ed-a6f9-73385290846d} + + + {b512f128-fcec-4db4-8cd2-08abfc56e000} + + + {2af08f38-aff0-4632-acb8-492111ff88f2} + + + {dd7d2910-1d3d-42c4-9390-ac60685357ee} + @@ -2028,6 +2058,21 @@ 02.GameObjects\UI\SpellLearn_Canvas + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Slot + + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Overlay + + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLeam_LookPointer + + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_ChaserPointer + + + 02.GameObjects\UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Booster + diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 25f7c8bd3..1ded5fe9f 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -118,6 +118,11 @@ #include "SpellLearn_Name.h" #include "SpellLearn.h" #include "SpellLearn_MovePointer.h" +#include "SpellLearn_ChaserPointer.h" +#include "SpellLearn_LookPointer.h" +#include "SpellLearn_Booster.h" +#include "SpellLearn_Slot.h" +#include "SpellLearn_Overlay.h" #include "Interaction_Key.h" @@ -2129,6 +2134,31 @@ HRESULT CLoader::Loading_For_GamePlay() { return E_FAIL; } + /* For.Prototype_GameObject_SpellLearn_ChaserPointer*/ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_ChaserPointer::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + /* For.Prototype_GameObject_SpellLearn_SpellLearn_LookPointer*/ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_LookPointer::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + /* For.Prototype_GameObject_SpellLearn_SpellLearn_Booster*/ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_Booster::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + /* For.Prototype_GameObject_SpellLearn_SpellLearn_Slot*/ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_Slot::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + /* For.Prototype_GameObject_SpellLearn_SpellLearn_Overlay*/ + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_Overlay::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } /* For.Prototype_GameObject_Interaction_Key*/ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CInteraction_Key::Create(m_pDevice, m_pContext)))) diff --git a/Jusin154_Team3D/Client/Private/SpellLearn.cpp b/Jusin154_Team3D/Client/Private/SpellLearn.cpp index 884254d57..0a5a69e9d 100644 --- a/Jusin154_Team3D/Client/Private/SpellLearn.cpp +++ b/Jusin154_Team3D/Client/Private/SpellLearn.cpp @@ -1,6 +1,8 @@ #include "pch.h" #include "SpellLearn.h" #include "GameInstance.h" +#include "SpellLearn_MovePointer.h" +#include "SpellLearn_ChaserPointer.h" #include "InfoInstance.h" CSpellLearn::CSpellLearn(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -39,8 +41,12 @@ HRESULT CSpellLearn::Initialize(void* pArg) } m_fTimeMult = 3.f; - m_fAlpha = 1.f; + m_fAlpha = 0.f; m_fAlphaTime = 5.f; + m_iTrailIndex = 0; + m_fSortZ = 0.02f; + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); + static_cast(m_pOwner)->Add_Function(TEXT("OverrlayClear"), [this](void* p) {this->Set_FadeOut(); }); Change_Image(0); Visible(false); return S_OK; @@ -87,7 +93,44 @@ void CSpellLearn::Update(_float fTimeDelta) } } - m_fTime += fTimeDelta * m_fTimeMult; + if (m_bReset == true) + { + m_Trail.clear(); + m_ChaseTrail.clear(); + m_bReset = false; + } + + if (m_bHover == false) + { + fill(m_Trail.begin(), m_Trail.end(), _float2(-9999.f, -9999.f)); + fill(m_ChaseTrail.begin(), m_ChaseTrail.end(), _float2(-9999.f, -9999.f)); + m_bReset = true; + } + + if (m_pPointer != nullptr) + { + if (m_pPointer->Get_MoveStart() == true) + { + m_bHover = true; + m_vPointerPosition = m_pPointer->Get_Position(); + m_vPointerScale = m_pPointer->Get_Current_Size(); + + m_vChasePosition = m_pChasePointer->Get_Position(); + m_vChaseScale = m_pChasePointer->Get_Current_Size(); + + m_fTime += fTimeDelta * m_fTimeMult; + if (m_fTime >= 0.3f) + { + m_fTime = 0.f; + m_Trail.push_back(m_vPointerPosition); + m_iTrailIndex++; + m_ChaseTrail.push_back(m_vChasePosition); + m_iChaseiTrailIndex++; + } + } + } + + __super::Update(fTimeDelta); } @@ -108,7 +151,7 @@ HRESULT CSpellLearn::Render() if (FAILED(Bind_ShaderResources())) { return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::COLOR)))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::SPELLLEARNCOLOR)))) { return E_FAIL; } if (FAILED(m_pVIBufferCom->Bind_Resources())) { @@ -168,6 +211,34 @@ HRESULT CSpellLearn::Bind_ShaderResources() { return E_FAIL; } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fItemImageSizes1", &m_vPointerScale, 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_fPosition", &m_fCurrent_Position, sizeof(_float2)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_Trail", m_Trail.data(), sizeof(_float2) * _uint(m_Trail.size())))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_Count", &m_iTrailIndex, sizeof(_int)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_ChaseTrail", m_ChaseTrail.data(), sizeof(_float2) * _uint(m_Trail.size())))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_ChaseCount", &m_iChaseiTrailIndex, sizeof(_int)))) + { + return E_FAIL; + } return S_OK; } @@ -195,9 +266,14 @@ HRESULT CSpellLearn::Ready_Components(void* pArg) HRESULT CSpellLearn::Change_Image(_int SpellID) { + m_bHover = false; + m_ChaseTrail.push_back(_float2(-9999.f, -9999.f)); + m_Trail.push_back(_float2(-9999.f, -9999.f)); + m_iTrailIndex = 0; + m_iChaseiTrailIndex = 0; _wstring pName = TEXT("Prototype_Texture_"); _wstring pImageName = pName + m_pInfoInstance->Get_SpellLearn(SpellID).pImageName; - + m_MoveLine = m_pInfoInstance->Get_SpellLearn(SpellID).Lines; if (m_pDiffuse_TextureCom) { Remove_Component(); @@ -206,9 +282,21 @@ HRESULT CSpellLearn::Change_Image(_int SpellID) if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, pImageName, reinterpret_cast(&m_pDiffuse_TextureCom)))) return E_FAIL; + Set_FadeIn(); return S_OK; } +void CSpellLearn::Set_Pointer(CSpellLearn_MovePointer* Pointer, CSpellLearn_ChaserPointer* Chase) +{ + m_pPointer = Pointer; + m_pChasePointer = Chase; +} + +void CSpellLearn::Clear() +{ + fill(m_ChaseTrail.begin(), m_ChaseTrail.end(), _float2(-9999.f, -9999.f)); +} + CSpellLearn* CSpellLearn::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CSpellLearn* pInstance = new CSpellLearn(pDevice, pContext); diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_Booster.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_Booster.cpp new file mode 100644 index 000000000..ecb3ae787 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/SpellLearn_Booster.cpp @@ -0,0 +1,321 @@ +#include "pch.h" +#include "SpellLearn_Booster.h" +#include "GameInstance.h" +#include "InfoInstance.h" + +CSpellLearn_Booster::CSpellLearn_Booster(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpellLearn_Booster::CSpellLearn_Booster(const CSpellLearn_Booster& rhs) + :CElementObject(rhs), + m_pInfoInstance(CInfoInstance::GetInstance()) +{ +} + +HRESULT CSpellLearn_Booster::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpellLearn_Booster::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 476.f; + Desc.fY = -253.f; + Desc.fSizeX = 64.f; + Desc.fSizeY = 64.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 = 5.f; + m_fAngle = XMConvertToRadians(0); + m_bHover = true; + m_fImagePosi = _float4(16.f, 16.f, 32.f, 32.f); + static_cast(m_pOwner)->Add_Function(TEXT("BoosterOn"), [this](void* p) {this->BoosterOn(p); }); + static_cast(m_pOwner)->Add_Function(TEXT("BoosterOff"), [this](void* p) {this->BoosterOff(p); }); + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); + Visible(true); + return S_OK; +} + +void CSpellLearn_Booster::BoosterOn(void* pArg) +{ + Booster* State = static_cast(pArg); + if (State->iBoosterIndex != m_iIndex) + return; + + m_bBoosterOn = true; + m_bBoosterOff = false; +} + +void CSpellLearn_Booster::BoosterOff(void* pArg) +{ + Booster* State = static_cast(pArg); + + if (m_bBoosterOn == true) + return; + + if (State->iBoosterIndex != m_iIndex) + return; + + m_bBoosterOff = true; + static_cast(m_pOwner)->Function_Callback(TEXT("ChaseBooster")); +} + +void CSpellLearn_Booster::Set_Index(_int iIndex) +{ + m_iIndex = iIndex; +} + +void CSpellLearn_Booster::Reset() +{ + m_bBoosterOn = false; + m_bBoosterOff = false; + Set_FadeIn(); +} + +void CSpellLearn_Booster::Clear() +{ + Set_FadeOut(); +} + +void CSpellLearn_Booster::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpellLearn_Booster::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bFadeIn == true) + { + if (m_fAlpha <= 1.f) + { + m_fAlpha += fTimeDelta * m_fAlphaTime; + } + + if (m_fAlpha >= 1.f) + { + m_bFadeIn = false; + m_fAlpha = 1.f; + } + } + + if (m_bFadeOut == true) + { + if (m_fAlpha >= 0.f) + m_fAlpha -= fTimeDelta * m_fAlphaTime;; + + if (m_fAlpha <= 0.f) + { + m_bFadeOut = false; + m_fAlpha = 0.f; + } + } + + m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); +} + +void CSpellLearn_Booster::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + __super::Late_Update(fTimeDelta); + } +} + +HRESULT CSpellLearn_Booster::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::SPELLLEARNBOOSTER)))) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) { + return E_FAIL; + } + + return S_OK; +} + +_vector CSpellLearn_Booster::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CSpellLearn_Booster::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_pDiffuse_TextureCom3->Bind_ShaderResource(m_pShaderCom, "g_Texture3", 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_fCurrent_Size", &m_vScale, sizeof(_float2)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fImageSipos1", &m_fImagePosi, sizeof(_float4)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_iHover", &m_bHover, sizeof(_bool)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_iBoosterOn", &m_bBoosterOn, sizeof(_bool)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_iBoosterOff", &m_bBoosterOff, sizeof(_bool)))) + { + return E_FAIL; + } + return S_OK; +} + +HRESULT CSpellLearn_Booster::Ready_Components(void* pArg) +{ + if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_UI_T_SU_ButtonCalloutRing"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_Mouse_LeftClick"), reinterpret_cast(&m_pDiffuse_TextureCom1), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_UI_T_SpellMinigame_SpeedBurstFail"), reinterpret_cast(&m_pDiffuse_TextureCom2), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_VFX_T_Speck_HighCoverage_D"), reinterpret_cast(&m_pDiffuse_TextureCom3), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +CSpellLearn_Booster* CSpellLearn_Booster::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpellLearn_Booster* pInstance = new CSpellLearn_Booster(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpellLearn_Booster"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpellLearn_Booster::Clone(void* pArg, CGameObject* pOwner) +{ + CSpellLearn_Booster* pInstance = new CSpellLearn_Booster(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpellLearn_Booster"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpellLearn_Booster::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pDiffuse_TextureCom1); + SAFE_RELEASE(m_pDiffuse_TextureCom2); + SAFE_RELEASE(m_pDiffuse_TextureCom3); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +#ifdef _DEBUG +void CSpellLearn_Booster::Describe_Entity() +{ +} +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_ChaserPointer.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_ChaserPointer.cpp new file mode 100644 index 000000000..05a2bcc0a --- /dev/null +++ b/Jusin154_Team3D/Client/Private/SpellLearn_ChaserPointer.cpp @@ -0,0 +1,294 @@ +#include "pch.h" +#include "SpellLearn_ChaserPointer.h" +#include "GameInstance.h" +#include "SpellLearn_MovePointer.h" +#include "InfoInstance.h" + +CSpellLearn_ChaserPointer::CSpellLearn_ChaserPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpellLearn_ChaserPointer::CSpellLearn_ChaserPointer(const CSpellLearn_ChaserPointer& rhs) + :CElementObject(rhs), + m_pInfoInstance(CInfoInstance::GetInstance()) +{ +} + +HRESULT CSpellLearn_ChaserPointer::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpellLearn_ChaserPointer::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 476.f; + Desc.fY = -253.f; + Desc.fSizeX = 32.f; + Desc.fSizeY = 32.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 = 0.f; + m_fAlphaTime = 5.f; + m_fMoveSpeed = 165.f; + static_cast(m_pOwner)->Add_Function(TEXT("ChaseBooster"), [this](void* p) {this->SpeedUp(); }); + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); + Set_SpellLearn(0); + Visible(false); + return S_OK; +} + +void CSpellLearn_ChaserPointer::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpellLearn_ChaserPointer::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bFadeIn == true) + { + if (m_fAlpha <= 1.f) + { + m_fAlpha += fTimeDelta * m_fAlphaTime; + } + + if (m_fAlpha >= 1.f) + { + m_bFadeIn = false; + m_fAlpha = 1.f; + } + } + + if (m_bFadeOut == true) + { + if (m_fAlpha >= 0.f) + m_fAlpha -= fTimeDelta * m_fAlphaTime;; + + if (m_fAlpha <= 0.f) + { + m_bFadeOut = false; + m_fAlpha = 0.f; + } + } + + if (m_bMoveStart == true) + { + Line(fTimeDelta); + } + + if (m_fMoveSpeed >= 165.f) + { + m_fMoveSpeed -= fTimeDelta; + } + + m_fTime += fTimeDelta * m_fTimeMult; + + + __super::Update(fTimeDelta); +} + +void CSpellLearn_ChaserPointer::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + __super::Late_Update(fTimeDelta); + } +} + +HRESULT CSpellLearn_ChaserPointer::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::DEFAULT)))) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) { + return E_FAIL; + } + + return S_OK; +} + +_vector CSpellLearn_ChaserPointer::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +void CSpellLearn_ChaserPointer::Set_SpellLearn(_int Index) +{ + m_fAlpha = 0.f; + m_bHover = false; + m_bMoveStart = false; + m_fTime = 0.f; + m_iLineIndex = _int(m_pInfoInstance->Get_SpellLearn(Index).Lines.size()); + m_MoveLine = m_pInfoInstance->Get_SpellLearn(Index).Lines; + m_iCurrentLine = 0; + m_fX = m_pInfoInstance->Get_SpellLearn(Index).fStartPosition.x; + m_fY = m_pInfoInstance->Get_SpellLearn(Index).fStartPosition.y; + m_fMoveSpeed = 165.f; +} + +void CSpellLearn_ChaserPointer::Set_Move() +{ + m_bHover = true; + m_bMoveStart = true; +} + +void CSpellLearn_ChaserPointer::Line(_float fTime) +{ + m_vLerp_Position = m_MoveLine[m_iCurrentLine]; + + if (Start_Lerp(fTime) == true) + { + if (m_iCurrentLine < m_iLineIndex - 1) + { + ++m_iCurrentLine; + } + else + { + m_bMoveStart = false; + } + } + +} + +void CSpellLearn_ChaserPointer::SpeedUp() +{ + m_fMoveSpeed = 190.f; +} + +void CSpellLearn_ChaserPointer::Clear() +{ + m_fMoveSpeed = 0.f; + Set_FadeOut(); +} + +HRESULT CSpellLearn_ChaserPointer::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_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; + } + return S_OK; +} + +HRESULT CSpellLearn_ChaserPointer::Ready_Components(void* pArg) +{ + if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_UI_T_SpellMinigame_SpeedBurstDropBack"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +CSpellLearn_ChaserPointer* CSpellLearn_ChaserPointer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpellLearn_ChaserPointer* pInstance = new CSpellLearn_ChaserPointer(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpellLearn_ChaserPointer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpellLearn_ChaserPointer::Clone(void* pArg, CGameObject* pOwner) +{ + CSpellLearn_ChaserPointer* pInstance = new CSpellLearn_ChaserPointer(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpellLearn_ChaserPointer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpellLearn_ChaserPointer::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +#ifdef _DEBUG +void CSpellLearn_ChaserPointer::Describe_Entity() +{ +} +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_Data.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_Data.cpp index 0f4d1a4aa..cdfd5f9e0 100644 --- a/Jusin154_Team3D/Client/Private/SpellLearn_Data.cpp +++ b/Jusin154_Team3D/Client/Private/SpellLearn_Data.cpp @@ -50,12 +50,34 @@ HRESULT CSpellLearn_Data::Load_SpellInfo(const _char* pFilePath) // 속성 읽기 Info.pSpellName = CMyTools::ToWstring(pName->Attribute("SpellName")); Info.pImageName = CMyTools::ToWstring(pName->Attribute("ImageName")); + pName->QueryIntAttribute("SpellID", &Info.iSpellID); + pName->QueryIntAttribute("SpellType", &Info.iSpellType); pName->QueryFloatAttribute("Size", &Info.fSpellSize); _float fX{}, fY{}; pName->QueryFloatAttribute("x", &fX); pName->QueryFloatAttribute("y", &fY); Info.fStartPosition = _float2(fX, fY); + _float endx{}, endy{}; + pName->QueryFloatAttribute("endx", &endx); + pName->QueryFloatAttribute("endy", &endy); + Info.fEndPosition = _float2(endx, endy); + + tinyxml2::XMLElement* pBooster = pName->FirstChildElement("Booster"); + while (pBooster) + { + tinyxml2::XMLElement* pPos = pBooster->FirstChildElement("Pos"); + if (pPos) + { + _float px{}, py{}; + pPos->QueryFloatAttribute("x", &px); + pPos->QueryFloatAttribute("y", &py); + Info.Booster.push_back(XMVectorSet(px, py, 0.f, 1.f)); + } + + // 다음 Position으로 이동 + pBooster = pBooster->NextSiblingElement("Booster"); + } // Position 요소 반복 tinyxml2::XMLElement* pPosition = pName->FirstChildElement("Position"); diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_LookPointer.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_LookPointer.cpp new file mode 100644 index 000000000..57e1deea0 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/SpellLearn_LookPointer.cpp @@ -0,0 +1,255 @@ +#include "pch.h" +#include "SpellLearn_LookPointer.h" +#include "GameInstance.h" + +CSpellLearn_LookPointer::CSpellLearn_LookPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpellLearn_LookPointer::CSpellLearn_LookPointer(const CSpellLearn_LookPointer& rhs) + :CElementObject(rhs) +{ +} + +HRESULT CSpellLearn_LookPointer::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpellLearn_LookPointer::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 100.f; + Desc.fY = 100.f; + Desc.fSizeX = 80.f; + Desc.fSizeY = 80.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 = 5.f; + m_fMoveSpeed = 130.f; + Set_SpellLearn(0); + m_fAngle = XMConvertToRadians(0); + Visible(true); + m_localX = 0.f; + m_localY = 20.f; + return S_OK; +} + +void CSpellLearn_LookPointer::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpellLearn_LookPointer::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bFadeIn == true) + { + if (m_fAlpha <= 1.f) + { + m_fAlpha += fTimeDelta * m_fAlphaTime; + } + + if (m_fAlpha >= 1.f) + { + m_bFadeIn = false; + m_fAlpha = 1.f; + } + } + + if (m_bFadeOut == true) + { + if (m_fAlpha >= 0.f) + m_fAlpha -= fTimeDelta * m_fAlphaTime;; + + if (m_fAlpha <= 0.f) + { + m_bFadeOut = false; + m_fAlpha = 0.f; + } + } + + m_fAngle = XMConvertToRadians(static_cast(m_pOwner)->Get_Angle()); + + float cosA = cos(m_fAngle); + float sinA = sin(m_fAngle); + + float rotatedX = m_localX * cosA - m_localY * sinA; + float rotatedY = m_localX * sinA + m_localY * cosA; + + MoveX(rotatedX); + MoveY(rotatedY); + + m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); +} + +void CSpellLearn_LookPointer::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + __super::Late_Update(fTimeDelta); + } +} + +HRESULT CSpellLearn_LookPointer::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::ROTATION)))) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) { + return E_FAIL; + } + + return S_OK; +} + +_vector CSpellLearn_LookPointer::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CSpellLearn_LookPointer::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_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_fMapAngle", &m_fAngle, sizeof(_float)))) + { + return E_FAIL; + } + return S_OK; +} + +HRESULT CSpellLearn_LookPointer::Ready_Components(void* pArg) +{ + if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_UI_T_SU_CursorArrow"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +void CSpellLearn_LookPointer::Set_SpellLearn(_int Index) +{ + m_bMoveStart = false; + m_iLineIndex = _int(static_cast(m_pOwner)->Get_Learninfo(Index).Lines.size()); + m_MoveLine = static_cast(m_pOwner)->Get_Learninfo(Index).Lines; + m_iCurrentLine = 0; + m_fX = static_cast(m_pOwner)->Get_Learninfo(Index).fStartPosition.x; + m_fY = static_cast(m_pOwner)->Get_Learninfo(Index).fStartPosition.y; +} + +CSpellLearn_LookPointer* CSpellLearn_LookPointer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpellLearn_LookPointer* pInstance = new CSpellLearn_LookPointer(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpellLearn_LookPointer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpellLearn_LookPointer::Clone(void* pArg, CGameObject* pOwner) +{ + CSpellLearn_LookPointer* pInstance = new CSpellLearn_LookPointer(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpellLearn_LookPointer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpellLearn_LookPointer::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +#ifdef _DEBUG +void CSpellLearn_LookPointer::Describe_Entity() +{ +} +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_MovePointer.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_MovePointer.cpp index 4e817c981..306ace767 100644 --- a/Jusin154_Team3D/Client/Private/SpellLearn_MovePointer.cpp +++ b/Jusin154_Team3D/Client/Private/SpellLearn_MovePointer.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include "SpellLearn_MovePointer.h" #include "GameInstance.h" +#include "SpellLearn_LookPointer.h" #include "InfoInstance.h" CSpellLearn_MovePointer::CSpellLearn_MovePointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -38,41 +39,69 @@ HRESULT CSpellLearn_MovePointer::Initialize(void* pArg) return E_FAIL; } - m_fTimeMult = 3.f; - m_fAlpha = 1.f; + m_fTimeMult = 10.f; + m_fAlpha = 0.f; m_fAlphaTime = 5.f; - m_fMoveSpeed = 15.f; + m_fMoveSpeed = 105.f; Set_SpellLearn(0); m_fAngle = XMConvertToRadians(0); + static_cast(m_pOwner)->Add_Function(TEXT("Booster"), [this](void* p) {this->Set_Booster(p); }); Visible(false); return S_OK; } void CSpellLearn_MovePointer::Set_SpellLearn(_int Index) { + m_bMoveStart = false; + m_bHover = true; m_iLineIndex = _int(m_pInfoInstance->Get_SpellLearn(Index).Lines.size()); + m_Boosters = m_pInfoInstance->Get_SpellLearn(Index).Booster; m_MoveLine = m_pInfoInstance->Get_SpellLearn(Index).Lines; m_iCurrentLine = 0; m_fX = m_pInfoInstance->Get_SpellLearn(Index).fStartPosition.x; m_fY = m_pInfoInstance->Get_SpellLearn(Index).fStartPosition.y; + m_iCurrentLine = 0; + m_Booster.iBoosterIndex = -1; + m_Booster.bBoosterOn = false; + Set_FadeIn(); +} + +_int CSpellLearn_MovePointer::Get_SpellTrail() +{ + return m_iCurrentLine; +} + +_bool CSpellLearn_MovePointer::Get_MoveStart() +{ + return m_bMoveStart; } void CSpellLearn_MovePointer::Line(_float fTime, _float2 fMouse) { m_vLerp_Position = m_MoveLine[m_iCurrentLine]; - if (Start_Lerp(m_fMoveSpeed * fTime) == true) + if (Start_Lerp_Speed(fTime, fMouse) == true) { if (m_iCurrentLine < m_iLineIndex - 1) { ++m_iCurrentLine; + m_fPerPosition = _float2(m_MoveLine[m_iCurrentLine - 1].m128_f32[0], m_MoveLine[m_iCurrentLine - 1].m128_f32[1]); } else { m_bMoveStart = false; + Set_FadeOut(); + static_cast(m_pOwner)->Function_Callback(TEXT("LearnClear")); } } +} +void CSpellLearn_MovePointer::Set_Booster(void* pArg) +{ + Booster* Info = static_cast(pArg); + m_Booster.iBoosterIndex = Info->iBoosterIndex; + m_Booster.bBoosterOn = Info->bBoosterOn; + m_bBooster = true; } void CSpellLearn_MovePointer::Priority_Update(_float fTimeDelta) @@ -130,6 +159,8 @@ void CSpellLearn_MovePointer::Update(_float fTimeDelta) if (m_pGameInstance->Key_Down(DIK_L)) { m_bMoveStart = true; + m_bBooster = false; + m_fMoveSpeed = 105.f; } if (m_bMoveStart == true) @@ -139,6 +170,21 @@ void CSpellLearn_MovePointer::Update(_float fTimeDelta) m_fAngle = atan2(-fFinalMouse.x, fFinalMouse.y); + if (m_bBooster == true) + { + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON)) + { + m_bBooster = false; + m_fMoveSpeed = 160.f; + static_cast(m_pOwner)->Function_Callback(TEXT("BoosterOn"), &m_Booster); + } + } + + if (m_fMoveSpeed >= 105.f) + { + m_fMoveSpeed -= fTimeDelta * m_fTimeMult; + } + m_fTime += fTimeDelta * m_fTimeMult; __super::Update(fTimeDelta); } @@ -150,7 +196,8 @@ void CSpellLearn_MovePointer::Late_Update(_float fTimeDelta) return; } if (m_bVisible) { - m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + if (m_bHover == true) + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); __super::Late_Update(fTimeDelta); } } @@ -239,6 +286,10 @@ HRESULT CSpellLearn_MovePointer::Ready_Components(void* pArg) return E_FAIL; } + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLeam_LookPointer)))) + { + return E_FAIL; + } return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_Overlay.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_Overlay.cpp new file mode 100644 index 000000000..c97dfdcf8 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/SpellLearn_Overlay.cpp @@ -0,0 +1,391 @@ +#include "pch.h" +#include "SpellLearn_Overlay.h" +#include "GameInstance.h" +#include "InfoInstance.h" + +CSpellLearn_Overlay::CSpellLearn_Overlay(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpellLearn_Overlay::CSpellLearn_Overlay(const CSpellLearn_Overlay& rhs) + :CElementObject(rhs), + m_pInfoInstance(CInfoInstance::GetInstance()) +{ +} + +HRESULT CSpellLearn_Overlay::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpellLearn_Overlay::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 380.f; + Desc.fY = -30.f; + Desc.fSizeX = 105.f; + Desc.fSizeY = 105.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_iImageFrameX = 8; + m_iImageFrameY = 8; + m_fFrame = 0.2f; + m_fTimeMult = 3.f; + m_fAngle = XMConvertToRadians(-135.f); + m_fAlpha = 1.f; + m_fAlphaTime = 1.f; + m_vUVScale.x = 1.f; + m_vUVScale.y = 1.f; + m_fCoolTime = 5.f; + m_fSortZ = 0.01f; + m_fMoveSpeed = 10.f; + m_fLerpX = 600.f; + m_fLerpY = 100.f; + m_iSpellType = ENUM_CLASS(SPELLTYPE::CONTROL); + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); + Compute_UI(5); + return S_OK; +} + +void CSpellLearn_Overlay::Set_SpellLearn(_int Index) +{ + Compute_UI(m_pInfoInstance->Get_SpellLearn(Index).iSpellID); + m_vUVScale.y = 0.f; + m_fTrail = 0.f; + m_iSpellType = m_pInfoInstance->Get_SpellLearn(Index).iSpellType; + m_fSpellLearn = _float(m_pInfoInstance->Get_SpellLearn(Index).Lines.size()); + MoveX(m_pInfoInstance->Get_SpellLearn(Index).fEndPosition.x); + MoveY(m_pInfoInstance->Get_SpellLearn(Index).fEndPosition.y); + SizeUpdate(m_fOrigin_Size.x, m_fOrigin_Size.y); + m_fSizeUp = false; + m_bClear = false; +} + +void CSpellLearn_Overlay::Set_Count(_int Index) +{ + m_fTrail = _float(Index); +} + +void CSpellLearn_Overlay::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpellLearn_Overlay::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + + if (m_bFadeIn == true) + { + if (m_fAlpha <= 1.f) + m_fAlpha += fTimeDelta * m_fAlphaTime; + + if (m_fAlpha >= 1.f) + { + m_bFadeIn = false; + m_fAlpha = 1.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; + } + } + + Update_Trail(fTimeDelta); + + if (m_bClear == true) + { + SizeUp(fTimeDelta * m_fTimeMult * m_fMoveSpeed); + } + + if (m_fSizeUp == true) + { + if (Start_Lerp(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) + { + m_fSizeUp = false; + } + } + + m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); +} + +void CSpellLearn_Overlay::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + } + __super::Late_Update(fTimeDelta); +} + +HRESULT CSpellLearn_Overlay::Render() +{ + if (FAILED(Bind_ShaderResources())) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::TYPE)))) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) + { + return E_FAIL; + } + + return S_OK; +} + +_vector CSpellLearn_Overlay::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CSpellLearn_Overlay::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_pDiffuse_TextureCom3->Bind_ShaderResource(m_pShaderCom, "g_Texture3", 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_fFrame", &m_fFrame, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fAngle", &m_fAngle, 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_iSpellType", &m_iSpellType, sizeof(_int)))) + { + 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_iImageCountX", &m_iImageFrameX, sizeof(_int)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_iImageCountY", &m_iImageFrameY, sizeof(_int)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fDeltaU", &m_vUVScale.x, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fDeltaV", &m_vUVScale.y, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fCoolTime", &m_fCoolTime, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fImageUV", &m_vUV, sizeof(_float4)))) + { + return E_FAIL; + } + return S_OK; +} + +HRESULT CSpellLearn_Overlay::Ready_Components(void* pArg) +{ + if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_UI_T_ActionItemBack_4K"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_UI_T_spellmeter_Generic"), reinterpret_cast(&m_pDiffuse_TextureCom1), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_Atlas_Spell"), reinterpret_cast(&m_pDiffuse_TextureCom2), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_UI_T_tillingSmokes"), reinterpret_cast(&m_pDiffuse_TextureCom3), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +void CSpellLearn_Overlay::Clear() +{ + m_vUVScale.y = 1.2f; + m_bClear = true; +} + +void CSpellLearn_Overlay::Compute_UI(_uint SpellID) +{ + _float2 fImage_Size = { 1024.f, 1792.f }; + + _uint iCountX = 4; + _uint iCountY = 6; + + _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 }; + m_vUV = UV; +} + +void CSpellLearn_Overlay::Update_Trail(_float fTimeaDalta) +{ + m_vUVScale.y = CMyTools::Lerp_f1D(m_vUVScale.y, m_fTrail / m_fSpellLearn * 1.05f, fTimeaDalta * m_fMoveSpeed); +} + +void CSpellLearn_Overlay::SizeUp(_float fSizeX) +{ + m_fSizeX += fSizeX; + m_fSizeY += fSizeX; + + if (160.f <= m_fSizeX + fSizeX) + { + m_fSizeX = 160.f; + m_fSizeY = 160.f; + m_bClear = false; + m_fSizeUp = true; + static_cast(m_pOwner)->Function_Callback(TEXT("OverrlayClear")); + } +} + +CSpellLearn_Overlay* CSpellLearn_Overlay::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpellLearn_Overlay* pInstance = new CSpellLearn_Overlay(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpellLearn_Overlay"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpellLearn_Overlay::Clone(void* pArg, CGameObject* pOwner) +{ + CSpellLearn_Overlay* pInstance = new CSpellLearn_Overlay(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpell_Overlay"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpellLearn_Overlay::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pDiffuse_TextureCom1); + SAFE_RELEASE(m_pDiffuse_TextureCom2); + SAFE_RELEASE(m_pDiffuse_TextureCom3); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +#ifdef _DEBUG +void CSpellLearn_Overlay::Describe_Entity() +{ +} +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_Panel.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_Panel.cpp index ff5a40be3..d0eab7597 100644 --- a/Jusin154_Team3D/Client/Private/SpellLearn_Panel.cpp +++ b/Jusin154_Team3D/Client/Private/SpellLearn_Panel.cpp @@ -4,7 +4,11 @@ #include "SpellLearn_Name.h" #include "SpellLearn.h" #include "SpellLearn_MovePointer.h" +#include "SPellLearn_ChaserPointer.h" #include "SpellLearn_Data.h" +#include "SpellLearn_Booster.h" +#include "SpellLearn_Slot.h" +#include "SpellLearn_Overlay.h" #include "InfoInstance.h" CSpellLearn_Panel::CSpellLearn_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -47,11 +51,45 @@ HRESULT CSpellLearn_Panel::Initialize(void* pArg) m_fCanvasAlpha = 1.f; m_fSortZ = 0.05f; m_fDelayTime = 1.f; + static_cast(m_pSpellLearn)->Set_Pointer( + static_cast(m_pSpellLearn_MovePointer), + static_cast(m_pSpellLearn_ChaserPointer)); + + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + static_cast(m_pBooster[i])->Move(m_pInfoInstance->Get_SpellLearn(Index).Booster[i].m128_f32[0], + m_pInfoInstance->Get_SpellLearn(Index).Booster[i].m128_f32[1]); + } + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + m_PointerStates.push_back(m_State); + m_ChaseStates.push_back(m_State); + } + static_cast(m_pSpellLearn_Overlay)->Set_SpellLearn(0); + static_cast(m_pSpellLearn_Slot)->Set_SpellLearn(0); Visible(true); ElementAllVisible(true); return S_OK; } +void CSpellLearn_Panel::Set_Learn(_int Index) +{ + m_fTime = 0.f; + static_cast(m_pSpellLearn)->Change_Image(Index); + static_cast(m_pSpellLearn_MovePointer)->Set_SpellLearn(Index); + static_cast(m_pSpellLearn_ChaserPointer)->Set_SpellLearn(Index); + static_cast(m_pSpellLearn_Name)->Set_Name(Index); + static_cast(m_pSpellLearn_Overlay)->Set_SpellLearn(Index); + static_cast(m_pSpellLearn_Slot)->Set_SpellLearn(Index); + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + static_cast(m_pBooster[i])->Move( + m_pInfoInstance->Get_SpellLearn(Index).Booster[i].m128_f32[0], + m_pInfoInstance->Get_SpellLearn(Index).Booster[i].m128_f32[1]); + static_cast(m_pBooster[i])->Reset(); + } +} + void CSpellLearn_Panel::Priority_Update(_float fTimeDelta) { if (!__super::Chack_Visible()) @@ -70,7 +108,7 @@ void CSpellLearn_Panel::Update(_float fTimeDelta) if (m_pGameInstance->Key_Down(DIK_M)) { - if (Index >= m_pInfoInstance->Get_SpellLearnIndex() - 1) + if (Index > m_Info.size() - 1) { Index = 0; } @@ -78,11 +116,90 @@ void CSpellLearn_Panel::Update(_float fTimeDelta) { Index++; } - static_cast(m_pSpellLearn)->Change_Image(Index); - static_cast(m_pSpellLearn_MovePointer)->Set_SpellLearn(Index); - static_cast(m_pSpellLearn_Name)->Set_Name(Index); + Set_Learn(Index); } + if (static_cast(m_pSpellLearn_MovePointer)->Get_MoveStart() == true) + { + m_fTime += fTimeDelta; + + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + m_PointerStates[i].bPerHit = m_PointerStates[i].bHit; + + _bool bPointer = Chack_Element(static_cast(m_pBooster[i])->Get_Position(), + static_cast(m_pSpellLearn_MovePointer)->Get_Position(), + static_cast(m_pSpellLearn_MovePointer)->Get_Current_Size().x, + static_cast(m_pSpellLearn_MovePointer)->Get_Current_Size().x); + + m_PointerStates[i].bHit = bPointer; + + if (m_PointerStates[i].bHit == true && m_PointerStates[i].bPerHit == false) + { + m_Booster.iBoosterIndex = _int(i); + m_Booster.bBoosterOn = true; + Function_Callback(TEXT("Booster"), &m_Booster); + } + + if (m_PointerStates[i].bHit == false && m_PointerStates[i].bPerHit == true) + { + m_Booster.iBoosterIndex = _int(i); + m_Booster.bBoosterOn = false; + Function_Callback(TEXT("Booster"), &m_Booster); + } + } + + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + m_ChaseStates[i].bPerHit = m_ChaseStates[i].bHit; + + _bool bPointer = Chack_Element(static_cast(m_pBooster[i])->Get_Position(), + static_cast(m_pSpellLearn_ChaserPointer)->Get_Position(), + static_cast(m_pSpellLearn_ChaserPointer)->Get_Current_Size().x, + static_cast(m_pSpellLearn_ChaserPointer)->Get_Current_Size().x); + + m_ChaseStates[i].bHit = bPointer; + + if (m_ChaseStates[i].bHit == true && m_ChaseStates[i].bPerHit == false) + { + m_Booster.iBoosterIndex = _int(i); + m_Booster.bBoosterOn = true; + Function_Callback(TEXT("BoosterOff"), &m_Booster); + } + + static_cast(m_pSpellLearn_Overlay)->Set_Count( + static_cast(m_pSpellLearn_MovePointer)->Get_SpellTrail()); + + } + + if (m_fTime >= 1.f) + { + static_cast(m_pSpellLearn_ChaserPointer)->Set_FadeIn(); + } + + if (m_fTime >= 2.f) + { + static_cast(m_pSpellLearn_ChaserPointer)->Set_Move(); + + if (_bool bPointer = Chack_Element(static_cast(m_pSpellLearn_MovePointer)->Get_Position(), + static_cast(m_pSpellLearn_ChaserPointer)->Get_Position(), + static_cast(m_pSpellLearn_MovePointer)->Get_Current_Size().x, + static_cast(m_pSpellLearn_ChaserPointer)->Get_Current_Size().x) == true) + { + Set_Learn(Index); + + m_Booster.iBoosterIndex = _int(-1); + m_Booster.bBoosterOn = false; + Function_Callback(TEXT("Booster"), &m_Booster); + for (size_t i = 0; i < m_PointerStates.size(); ++i) + { + m_PointerStates[i].bPerHit = false; + m_PointerStates[i].bHit = false; + } + } + + } + } __super::Update(fTimeDelta); } @@ -204,6 +321,36 @@ HRESULT CSpellLearn_Panel::Ready_Element(void* pArg) } Add_Element(TEXT("SpellLearn_MovePointer"), m_pSpellLearn_MovePointer); + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLearn_ChaserPointer)))) + { + return E_FAIL; + } + Add_Element(TEXT("SPellLeam_ChaserPointer"), m_pSpellLearn_ChaserPointer); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLearn_Slot)))) + { + return E_FAIL; + } + Add_Element(TEXT("SpellLearn_Slot"), m_pSpellLearn_Slot); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLearn_Overlay)))) + { + return E_FAIL; + } + Add_Element(TEXT("SpellLearn_Overlay"), m_pSpellLearn_Overlay); + + for (_int i = 0; i < 3; ++i) + { + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLearn_Booster)))) + { + return E_FAIL; + } + + static_cast(m_pSpellLearn_Booster)->Set_Index(i); + + m_pBooster.push_back(m_pSpellLearn_Booster); + } + return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/SpellLearn_Slot.cpp b/Jusin154_Team3D/Client/Private/SpellLearn_Slot.cpp new file mode 100644 index 000000000..5fcebb92a --- /dev/null +++ b/Jusin154_Team3D/Client/Private/SpellLearn_Slot.cpp @@ -0,0 +1,287 @@ +#include "pch.h" +#include "SpellLearn_Slot.h" +#include "GameInstance.h" +#include "InfoInstance.h" + +CSpellLearn_Slot::CSpellLearn_Slot(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpellLearn_Slot::CSpellLearn_Slot(const CSpellLearn_Slot& rhs) + :CElementObject(rhs), + m_pInfoInstance(CInfoInstance::GetInstance()) +{ +} + +HRESULT CSpellLearn_Slot::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpellLearn_Slot::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 380.f; + Desc.fY = -30.f; + Desc.fSizeX = 105.f; + Desc.fSizeY = 105.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_fAngle = XMConvertToRadians(135.f); + m_fAlpha = 1.f; + m_fAlphaTime = 1.f; + m_fMoveSpeed = 10.f; + m_fLerpX = 600.f; + m_fLerpY = 100.f; + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); + return S_OK; +} + +void CSpellLearn_Slot::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpellLearn_Slot::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + + if (m_bFadeIn == true) + { + if (m_fAlpha <= 1.f) + m_fAlpha += fTimeDelta * m_fAlphaTime; + + if (m_fAlpha >= 1.f) + { + m_bFadeIn = false; + m_fAlpha = 1.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; + } + } + + if (m_bClear == true) + { + SizeUp(fTimeDelta * m_fTimeMult * m_fMoveSpeed); + } + + if (m_fSizeUp == true) + { + if (Start_Lerp(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) + { + m_fSizeUp = false; + } + } + + m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); +} + +void CSpellLearn_Slot::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + } + __super::Late_Update(fTimeDelta); +} + +HRESULT CSpellLearn_Slot::Render() +{ + if (FAILED(Bind_ShaderResources())) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::SLOT)))) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) + { + return E_FAIL; + } + + return S_OK; +} + +_vector CSpellLearn_Slot::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CSpellLearn_Slot::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_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_fAngle", &m_fAngle, 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_iSpellType", &m_iSpellType, sizeof(_int)))) + { + 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_fAngle", &m_fAngle, sizeof(_float)))) + { + return E_FAIL; + } + return S_OK; +} + +HRESULT CSpellLearn_Slot::Ready_Components(void* pArg) +{ + if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Texture_UI_T_ActionItemGoldleaf_4K"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +void CSpellLearn_Slot::Set_SpellLearn(_int Index) +{ + MoveX(m_pInfoInstance->Get_SpellLearn(Index).fEndPosition.x); + MoveY(m_pInfoInstance->Get_SpellLearn(Index).fEndPosition.y); + SizeUpdate(m_fOrigin_Size.x, m_fOrigin_Size.y); + m_fSizeUp = false; + m_bClear = false; +} + +void CSpellLearn_Slot::Clear() +{ + m_bClear = true; +} + +void CSpellLearn_Slot::SizeUp(_float fSizeX) +{ + m_fSizeX += fSizeX; + m_fSizeY += fSizeX; + + if (160.f <= m_fSizeX + fSizeX) + { + m_fSizeX = 160.f; + m_fSizeY = 160.f; + m_bClear = false; + m_fSizeUp = true; + } +} + +CSpellLearn_Slot* CSpellLearn_Slot::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpellLearn_Slot* pInstance = new CSpellLearn_Slot(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpellLearn_Slot"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpellLearn_Slot::Clone(void* pArg, CGameObject* pOwner) +{ + CSpellLearn_Slot* pInstance = new CSpellLearn_Slot(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpellLearn_Slot"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpellLearn_Slot::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +#ifdef _DEBUG +void CSpellLearn_Slot::Describe_Entity() +{ +} +#endif // _DEBUG diff --git a/Jusin154_Team3D/Client/Public/Client_Enum.h b/Jusin154_Team3D/Client/Public/Client_Enum.h index 6e2141e7b..0c0d402b4 100644 --- a/Jusin154_Team3D/Client/Public/Client_Enum.h +++ b/Jusin154_Team3D/Client/Public/Client_Enum.h @@ -19,8 +19,8 @@ namespace Client REVELIO, POTION, MAGIC_ITEM, SPELL_PREVIEW, SPELL_HEADER, SPELL_HEADER_LINE, SPELL_DRAG, CAMERA_LOCKON, LODING_SCREEN, ENEMY_HPBAR, BOSS_HPBAR, QUEST_BORDER, QUEST_INFO, QUEST_STATUS, BROOMSTICK, - SPELL_LEARN, - ENEMY_DETECTION, INTERACTION_OBJECT, END }; + SPELL_LEARN, SPELLLEARNCOLOR, SPELLLEARNBOOSTER, + ENEMY_DETECTION, INTERACTION_OBJECT, 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, SPELL_LOCK, QUEST_SLOT, END }; enum class SHADER_PASS_NPC_PBR_ANIM { diff --git a/Jusin154_Team3D/Client/Public/Client_Struct.h b/Jusin154_Team3D/Client/Public/Client_Struct.h index b610406bc..a9e6cc991 100644 --- a/Jusin154_Team3D/Client/Public/Client_Struct.h +++ b/Jusin154_Team3D/Client/Public/Client_Struct.h @@ -93,10 +93,14 @@ namespace Client typedef struct tagSpellLearnInfo { - _wstring pSpellName{}; - _wstring pImageName{}; - _float fSpellSize{}; - _float2 fStartPosition{}; + _wstring pSpellName{}; + _wstring pImageName{}; + _int iSpellID{}; + _int iSpellType{}; + _float fSpellSize{}; + _float2 fStartPosition{}; + _float2 fEndPosition{}; + vector<_vector> Booster; vector<_vector> Lines; }SPELLLEARNINFO; diff --git a/Jusin154_Team3D/Client/Public/SpellLearn.h b/Jusin154_Team3D/Client/Public/SpellLearn.h index 2e8e8f361..9f05f27b6 100644 --- a/Jusin154_Team3D/Client/Public/SpellLearn.h +++ b/Jusin154_Team3D/Client/Public/SpellLearn.h @@ -33,6 +33,10 @@ class CSpellLearn final : public CElementObject public: HRESULT Change_Image(_int SpellID); + void Set_Pointer(class CSpellLearn_MovePointer* Pointer, class CSpellLearn_ChaserPointer* Chase); + +private: + void Clear(); private: CInfoInstance* m_pInfoInstance = { nullptr }; @@ -42,6 +46,25 @@ class CSpellLearn final : public CElementObject CShader* m_pShaderCom = { nullptr }; CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + class CSpellLearn_MovePointer* m_pPointer = { nullptr }; + class CSpellLearn_ChaserPointer* m_pChasePointer = { nullptr }; + + _float2 m_vPointerPosition{}; + _float3 m_vPointerScale{}; + + _float2 m_vChasePosition{}; + _float3 m_vChaseScale{}; + + _bool m_bReset{}; + + _int m_iIndex{}; + _int m_iTrailIndex{}; + vector<_float2> m_Trail; + + _int m_iChaseiTrailIndex{}; + vector<_float2> m_ChaseTrail; + vector<_vector> m_MoveLine; + public: static CSpellLearn* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; diff --git a/Jusin154_Team3D/Client/Public/SpellLearn_Booster.h b/Jusin154_Team3D/Client/Public/SpellLearn_Booster.h new file mode 100644 index 000000000..14d8dcabc --- /dev/null +++ b/Jusin154_Team3D/Client/Public/SpellLearn_Booster.h @@ -0,0 +1,72 @@ +#pragma once + +#include "Client_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Engine) +class CTexture; +class CShader; +class CVIBuffer_Rect; +NS_END + +NS_BEGIN(Client) + +class CSpellLearn_Booster final : public CElementObject +{ +private: + struct Booster + { + _bool bBoosterOn = { false }; + _int iBoosterIndex{}; + }; +private: + CSpellLearn_Booster(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_Booster(const CSpellLearn_Booster& rhs); + virtual ~CSpellLearn_Booster() = 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 BoosterOn(void* pArg); + void BoosterOff(void* pArg); + + void Set_Index(_int iIndex); + void Reset(); + +private: + void Clear(); + +private: + CInfoInstance* m_pInfoInstance = { nullptr }; + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CTexture* m_pDiffuse_TextureCom1 = { nullptr }; + CTexture* m_pDiffuse_TextureCom2 = { nullptr }; + CTexture* m_pDiffuse_TextureCom3 = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + _bool m_bBoosterOn = { false }; + _bool m_bBoosterOff = { false }; + _float4 m_fImagePosi{}; + _int m_iIndex{}; +public: + static CSpellLearn_Booster* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/SpellLearn_ChaserPointer.h b/Jusin154_Team3D/Client/Public/SpellLearn_ChaserPointer.h new file mode 100644 index 000000000..985b4bb2d --- /dev/null +++ b/Jusin154_Team3D/Client/Public/SpellLearn_ChaserPointer.h @@ -0,0 +1,65 @@ +#pragma once + +#include "Client_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Engine) +class CTexture; +class CShader; +class CVIBuffer_Rect; +NS_END + +NS_BEGIN(Client) + +class CSpellLearn_ChaserPointer final : public CElementObject +{ +private: + CSpellLearn_ChaserPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_ChaserPointer(const CSpellLearn_ChaserPointer& rhs); + virtual ~CSpellLearn_ChaserPointer() = 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 Set_SpellLearn(_int Index); + void Set_Move(); +private: + void Line(_float fTime); + void SpeedUp(); + void Clear(); + +private: + CInfoInstance* m_pInfoInstance = { nullptr }; + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + + _bool m_bMoveStart = { false }; + + _int m_iLineIndex{}; + _int m_iCurrentLine{}; + vector<_vector> m_MoveLine; + +public: + static CSpellLearn_ChaserPointer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/SpellLearn_LookPointer.h b/Jusin154_Team3D/Client/Public/SpellLearn_LookPointer.h new file mode 100644 index 000000000..34d128575 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/SpellLearn_LookPointer.h @@ -0,0 +1,59 @@ +#pragma once + +#include "Client_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Engine) +class CTexture; +class CShader; +class CVIBuffer_Rect; +NS_END + +NS_BEGIN(Client) + +class CSpellLearn_LookPointer final : public CElementObject +{ +private: + CSpellLearn_LookPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_LookPointer(const CSpellLearn_LookPointer& rhs); + virtual ~CSpellLearn_LookPointer() = 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 Set_SpellLearn(_int Index); + +private: + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + + _bool m_bMoveStart = { false }; + + _int m_iLineIndex{}; + _int m_iCurrentLine{}; + vector<_vector> m_MoveLine; + _float m_localX{}; + _float m_localY{}; +public: + static CSpellLearn_LookPointer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/SpellLearn_MovePointer.h b/Jusin154_Team3D/Client/Public/SpellLearn_MovePointer.h index b2754a919..b1ed7965d 100644 --- a/Jusin154_Team3D/Client/Public/SpellLearn_MovePointer.h +++ b/Jusin154_Team3D/Client/Public/SpellLearn_MovePointer.h @@ -13,6 +13,12 @@ NS_BEGIN(Client) class CSpellLearn_MovePointer final : public CElementObject { +private: + struct Booster + { + _bool bBoosterOn = { false }; + _int iBoosterIndex{}; + }; private: CSpellLearn_MovePointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CSpellLearn_MovePointer(const CSpellLearn_MovePointer& rhs); @@ -33,9 +39,13 @@ class CSpellLearn_MovePointer final : public CElementObject public: void Set_SpellLearn(_int Index); + _int Get_SpellTrail(); + _bool Get_MoveStart(); private: void Line(_float fTime, _float2 fMouse); + void Set_Booster(void* pArg); + private: CInfoInstance* m_pInfoInstance = { nullptr }; @@ -43,11 +53,17 @@ class CSpellLearn_MovePointer final : public CElementObject CShader* m_pShaderCom = { nullptr }; CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + class SpellLearm_LookPointer* m_pSpellLeam_LookPointer = { nullptr }; + _bool m_bMoveStart = { false }; + _bool m_bBooster = { false }; + + Booster m_Booster; _int m_iLineIndex{}; _int m_iCurrentLine{}; vector<_vector> m_MoveLine; + vector<_vector> m_Boosters; public: static CSpellLearn_MovePointer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Client/Public/SpellLearn_Overlay.h b/Jusin154_Team3D/Client/Public/SpellLearn_Overlay.h new file mode 100644 index 000000000..578c725b7 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/SpellLearn_Overlay.h @@ -0,0 +1,72 @@ +#pragma once + +#include "Client_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Engine) +class CTexture; +class CShader; +class CVIBuffer_Rect; +NS_END + +NS_BEGIN(Client) + +class CSpellLearn_Overlay final : public CElementObject +{ +private: + CSpellLearn_Overlay(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_Overlay(const CSpellLearn_Overlay& rhs); + virtual ~CSpellLearn_Overlay() = 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 Set_SpellLearn(_int Index); + void Set_Count(_int Index); + +private: + void Clear(); + void Compute_UI(_uint SpellID); + void Update_Trail(_float fTimeaDalta); + void SizeUp(_float fSizeX); +private: + CInfoInstance* m_pInfoInstance = { nullptr }; + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CTexture* m_pDiffuse_TextureCom1 = { nullptr }; + CTexture* m_pDiffuse_TextureCom2 = { nullptr }; + CTexture* m_pDiffuse_TextureCom3 = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + _int m_iImageFrameX{}; + _int m_iImageFrameY{}; + _float m_fFrame{}; + _float4 m_vUV{}; + + _float m_fSpellLearn{}; + _float m_fTrail{}; + _float m_fTargetTrail{}; + _bool m_bClear = { false }; + _bool m_fSizeUp = { false }; +public: + static CSpellLearn_Overlay* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/SpellLearn_Panel.h b/Jusin154_Team3D/Client/Public/SpellLearn_Panel.h index 4d6a891bf..79535e13b 100644 --- a/Jusin154_Team3D/Client/Public/SpellLearn_Panel.h +++ b/Jusin154_Team3D/Client/Public/SpellLearn_Panel.h @@ -13,7 +13,17 @@ NS_BEGIN(Client) class CSpellLearn_Panel final : public CPanelObject { - +private: + struct Booster + { + _bool bBoosterOn = { false }; + _int iBoosterIndex{}; + }; + struct State + { + _bool bHit = { false }; + _bool bPerHit = { false }; + }; private: CSpellLearn_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CSpellLearn_Panel(const CSpellLearn_Panel& rhs); @@ -33,6 +43,9 @@ class CSpellLearn_Panel final : public CPanelObject virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; +public: + void Set_Learn(_int Index); + private: CTexture* m_pDiffuse_TextureCom = { nullptr }; CTexture* m_pDiffuse_TextureCom1 = { nullptr }; @@ -46,10 +59,18 @@ class CSpellLearn_Panel final : public CPanelObject CGameObject* m_pSpellLearn_Name = { nullptr }; CGameObject* m_pSpellLearn = { nullptr }; CGameObject* m_pSpellLearn_MovePointer = { nullptr }; + CGameObject* m_pSpellLearn_ChaserPointer = { nullptr }; CGameObject* m_pSpellLearn_Data = { nullptr }; + CGameObject* m_pSpellLearn_Booster = { nullptr }; + CGameObject* m_pSpellLearn_Slot = { nullptr }; + CGameObject* m_pSpellLearn_Overlay = { nullptr }; _int Index{}; - + vector m_pBooster; + Booster m_Booster; + State m_State; + vector m_PointerStates; + vector m_ChaseStates; public: static CSpellLearn_Panel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; diff --git a/Jusin154_Team3D/Client/Public/SpellLearn_Slot.h b/Jusin154_Team3D/Client/Public/SpellLearn_Slot.h new file mode 100644 index 000000000..e9a1e3e56 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/SpellLearn_Slot.h @@ -0,0 +1,58 @@ +#pragma once + +#include "Client_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Engine) +class CTexture; +class CShader; +class CVIBuffer_Rect; +NS_END + +NS_BEGIN(Client) + +class CSpellLearn_Slot final : public CElementObject +{ +private: + CSpellLearn_Slot(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_Slot(const CSpellLearn_Slot& rhs); + virtual ~CSpellLearn_Slot() = 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 Set_SpellLearn(_int Index); + void Clear(); + +private: + void SizeUp(_float fSizeX); +private: + CInfoInstance* m_pInfoInstance = { nullptr }; + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + _bool m_bClear = { false }; + _bool m_fSizeUp = { false }; +public: + static CSpellLearn_Slot* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // _DEBUG +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/UI/SpellLearn.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/UI/SpellLearn.xml index a09c28f29..920bb4764 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/UI/SpellLearn.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/UI/SpellLearn.xml @@ -1,6 +1,15 @@  - + + + + + + + + + + @@ -125,7 +134,16 @@ - + + + + + + + + + + @@ -223,7 +241,16 @@ - + + + + + + + + + + @@ -288,9 +315,60 @@ - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -359,7 +437,58 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -445,10 +574,58 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index c4aaf44f6..5c51ddefb 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -64,15 +64,19 @@ Texture2D g_DiffuseTexture; Texture2D g_MaskingTexture; int g_iHover; +int g_iBoosterOn; +int g_iBoosterOff; int g_iClick; int g_iColor; int g_Count; +int g_ChaseCount; int g_iStep1 = 0; int g_iStep2 = 0; int g_iStep3 = 0; -float2 g_Trail[1000]; +float2 g_Trail[200]; +float2 g_ChaseTrail[200]; struct VS_IN @@ -1800,7 +1804,7 @@ PS_OUT PS_SpellLearnColor(PS_IN In) Color.rgb *= tex1.rgb; - float2 rectPos = g_fPosition - float2(256.f,259.f); + float2 rectPos = g_fPosition - float2(256.f, 259.f); float2 rectSize = g_fCurrent_Size; float2 itemPos = g_fItemPosition1; @@ -1831,13 +1835,74 @@ PS_OUT PS_SpellLearnColor(PS_IN In) pixelPos.y >= trailCenter.y - halfHeight && pixelPos.y <= trailCenter.y + halfHeight) { - Color.rgb = float3(0.f, 144.f, 248.f) / 255.f; + Color.rgb = float3(20.f, 100.f, 180.f) / 255.f; + break; + } + } + + for (int j = 0; j < g_ChaseCount; ++j) + { + float2 ChaseTopLeft = g_ChaseTrail[j]; + float2 ChaseCenter = ChaseTopLeft + itemSize / 2.0f; + + float halfWidth = itemSize.x * 0.7f; + float halfHeight = itemSize.y * 0.7f; + + if (pixelPos.x >= ChaseCenter.x - halfWidth && + pixelPos.x <= ChaseCenter.x + halfWidth && + pixelPos.y >= ChaseCenter.y - halfHeight && + pixelPos.y <= ChaseCenter.y + halfHeight) + { + Color.rgb = float3(110.f, 5.f, 5.f) / 255.f; break; } } - Color. - a *= Alpha; + Color.a *= Alpha; + Out.vColor = Color; + return Out; +} + +PS_OUT PS_SpellLearnBooster(PS_IN In) +{ + PS_OUT Out; + float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; + + float4 Color = float4(1.f, 1.f, 1.f, 1.f); + float4 tex = g_Texture.Sample(DefaultSampler, In.vTexcoord); + + Color = tex; + + float2 Imagetexpos1 = g_fImageSipos1.xy / g_fCurrent_Size; + float2 Imagetexsize1 = g_fImageSipos1.zw / g_fCurrent_Size; + float2 Imagelocal = (In.vTexcoord - Imagetexpos1) / Imagetexsize1; + bool inside1 = all(Imagelocal >= 0.0f && Imagelocal <= 1.0f); + + if (g_iBoosterOn == 0 && g_iBoosterOff == 0) + { + if (inside1) + { + float4 tex1 = g_Texture1.Sample(DefaultSampler, Imagelocal); + Color = lerp(Color, tex1, tex1.a); + } + } + else if (g_iBoosterOn != 0 && g_iBoosterOff == 0) + { + + float4 tex3 = g_Texture3.Sample(DefaultSampler, In.vTexcoord); + Color = lerp(Color, tex3, tex3.a); + } + else if (g_iBoosterOn == 0 && g_iBoosterOff != 0) + { + float4 tex2 = g_Texture2.Sample(DefaultSampler, In.vTexcoord); + + tex2.rgb *= float3(1.f, 0.f, 0.f); + Color = tex; + + Color = lerp(Color, tex2, tex2.a); + } + + Color.a *= Alpha; Out.vColor = Color; return Out; } @@ -2432,6 +2497,16 @@ technique11 PosTexTechnique11 PixelShader = compile ps_5_0 PS_SpellLearnColor(); } + pass SpellLearnBooster + { + 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(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_SpellLearnBooster(); + } + pass Enemy_Detection { SetRasterizerState(RS_Nocull); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/UI_T_SU_CursorArrow.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/UI_T_SU_CursorArrow.png index 9df5cba6e..1cfceb4d7 100644 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/UI_T_SU_CursorArrow.png and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/UI_T_SU_CursorArrow.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/UI_T_SpellMinigame_SpeedBurstFail.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/UI_T_SpellMinigame_SpeedBurstFail.png new file mode 100644 index 000000000..f8b24e389 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/UI_T_SpellMinigame_SpeedBurstFail.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/VFX_T_Speck_HighCoverage_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/VFX_T_Speck_HighCoverage_D.png new file mode 100644 index 000000000..60dfbbad3 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/SpellUnlock/VFX_T_Speck_HighCoverage_D.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Spells/Atlas_Widget_Spell.dds b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Spells/Atlas_Widget_Spell.dds index 66d912ed0..ca819de01 100644 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Spells/Atlas_Widget_Spell.dds and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Spells/Atlas_Widget_Spell.dds 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 094852933..d202a99fd 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/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 03ef1f6ee..c8df5f139 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -197,13 +197,17 @@ call Update_Shaders.bat - + + + + + @@ -422,13 +426,17 @@ call Update_Shaders.bat - + + + + + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index b90865562..213478813 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -634,6 +634,18 @@ {54a92f0d-26f1-49bf-a13b-ab11995968c7} + + {ea002e2c-481e-4f1f-a16f-4e47e3a48d37} + + + {933a90c2-8fce-4e6d-89e7-74e88cbc7f45} + + + {5bab4bbf-253e-4d66-a0d2-8a6328ae244b} + + + {268e67a6-fa77-4a34-84d9-b3e6f6e46a00} + @@ -1260,9 +1272,21 @@ 50.UI\SpellLearn_Data - + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_ChaserPointer + + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLeam_LookPointer + + + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Booster + + + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Overlay + + + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Slot + @@ -1891,9 +1915,21 @@ 50.UI\SpellLearn_Data - + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SPellLeam_ChaserPointer + + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLeam_LookPointer + + + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Booster + + + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Overlay + + + 50.UI\SpellLearn_Canvas\SpellLearn_Panel\SpellLearn_Slot + diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 12f65afd1..56563d913 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -118,7 +118,11 @@ #include "SpellLearn_Name.h" #include "SpellLearn.h" #include "SpellLearn_MovePointer.h" -#include "SPellLeam_ChaserPointer.h" +#include "SpellLearn_ChaserPointer.h" +#include "SpellLearn_LookPointer.h" +#include "SpellLearn_Booster.h" +#include "SpellLearn_Slot.h" +#include "SpellLearn_Overlay.h" #include "IMGUIUI.h" @@ -1214,6 +1218,7 @@ HRESULT CLoader::Loading_For_UI() { return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_Canvas::Create(m_pDevice, m_pContext)))) { return E_FAIL; @@ -1234,7 +1239,23 @@ HRESULT CLoader::Loading_For_UI() { return E_FAIL; } - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSPellLeam_ChaserPointer::Create(m_pDevice, m_pContext)))) + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_ChaserPointer::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_LookPointer::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_Booster::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_Slot::Create(m_pDevice, m_pContext)))) + { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CSpellLearn_Overlay::Create(m_pDevice, m_pContext)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn.cpp index 19b1d6244..5798d5f0d 100644 --- a/Jusin154_Team3D/Editor/Private/SpellLearn.cpp +++ b/Jusin154_Team3D/Editor/Private/SpellLearn.cpp @@ -2,6 +2,7 @@ #include "SpellLearn.h" #include "GameInstance.h" #include "SpellLearn_MovePointer.h" +#include "SpellLearn_ChaserPointer.h" CSpellLearn::CSpellLearn(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CElementObject(pDevice, pContext) @@ -38,9 +39,12 @@ HRESULT CSpellLearn::Initialize(void* pArg) } m_fTimeMult = 3.f; - m_fAlpha = 1.f; + m_fAlpha = 0.f; m_fAlphaTime = 5.f; m_iTrailIndex = 0; + m_fSortZ = 0.02f; + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); + static_cast(m_pOwner)->Add_Function(TEXT("OverrlayClear"), [this](void* p) {this->Set_FadeOut(); }); Change_Image(0); Visible(false); return S_OK; @@ -87,26 +91,43 @@ void CSpellLearn::Update(_float fTimeDelta) } } + if (m_bReset == true) + { + m_Trail.clear(); + m_ChaseTrail.clear(); + m_bReset = false; + } + + if (m_bHover == false) + { + fill(m_Trail.begin(), m_Trail.end(), _float2(-9999.f, -9999.f)); + fill(m_ChaseTrail.begin(), m_ChaseTrail.end(), _float2(-9999.f, -9999.f)); + m_bReset = true; + } + if (m_pPointer != nullptr) { - if (m_pPointer->Get_bMoveStart() == true) + if (m_pPointer->Get_MoveStart() == true) { + m_bHover = true; m_vPointerPosition = m_pPointer->Get_Position(); m_vPointerScale = m_pPointer->Get_Current_Size(); + m_vChasePosition = m_pChasePointer->Get_Position(); + m_vChaseScale = m_pChasePointer->Get_Current_Size(); + m_fTime += fTimeDelta * m_fTimeMult; - if (m_fTime >= 1.f) + if (m_fTime >= 0.3f) { + m_fTime = 0.f; m_Trail.push_back(m_vPointerPosition); m_iTrailIndex++; + m_ChaseTrail.push_back(m_vChasePosition); + m_iChaseiTrailIndex++; } } - else - { - - } } - + __super::Update(fTimeDelta); } @@ -189,10 +210,6 @@ HRESULT CSpellLearn::Bind_ShaderResources() { return E_FAIL; } - if (FAILED(m_pShaderCom->Bind_RawValue("g_fItemPosition1", &m_vPointerPosition, sizeof(_float2)))) - { - return E_FAIL; - } if (FAILED(m_pShaderCom->Bind_RawValue("g_fItemImageSizes1", &m_vPointerScale, sizeof(_float2)))) { return E_FAIL; @@ -213,7 +230,11 @@ HRESULT CSpellLearn::Bind_ShaderResources() { return E_FAIL; } - if (FAILED(m_pShaderCom->Bind_RawValue("g_iHover", &m_bHover, sizeof(_bool)))) + if (FAILED(m_pShaderCom->Bind_RawValue("g_ChaseTrail", m_ChaseTrail.data(), sizeof(_float2) * _uint(m_Trail.size())))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_ChaseCount", &m_iChaseiTrailIndex, sizeof(_int)))) { return E_FAIL; } @@ -244,9 +265,11 @@ HRESULT CSpellLearn::Ready_Components(void* pArg) HRESULT CSpellLearn::Change_Image(_int SpellID) { - m_Trail.clear(); - m_Trail.push_back(_float2(0.f,0.f)); + m_bHover = false; + m_ChaseTrail.push_back(_float2(-9999.f, -9999.f)); + m_Trail.push_back(_float2(-9999.f, -9999.f)); m_iTrailIndex = 0; + m_iChaseiTrailIndex = 0; _wstring pName = TEXT("Prototype_Texture_"); _wstring pImageName = pName + static_cast(m_pOwner)->Get_Learninfo(SpellID).pImageName; m_MoveLine = static_cast(m_pOwner)->Get_Learninfo(SpellID).Lines; @@ -258,12 +281,19 @@ HRESULT CSpellLearn::Change_Image(_int SpellID) if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(LEVEL::UI), pImageName, reinterpret_cast(&m_pDiffuse_TextureCom)))) return E_FAIL; + Set_FadeIn(); return S_OK; } -void CSpellLearn::Set_Pointer(CSpellLearn_MovePointer* Pointer) +void CSpellLearn::Set_Pointer(CSpellLearn_MovePointer* Pointer, CSpellLearn_ChaserPointer* Chase) { m_pPointer = Pointer; + m_pChasePointer = Chase; +} + +void CSpellLearn::Clear() +{ + fill(m_ChaseTrail.begin(), m_ChaseTrail.end(), _float2(-9999.f, -9999.f)); } CSpellLearn* CSpellLearn::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_Booster.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_Booster.cpp new file mode 100644 index 000000000..df6f02a4a --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_Booster.cpp @@ -0,0 +1,317 @@ +#include "pch.h" +#include "SpellLearn_Booster.h" +#include "GameInstance.h" + +CSpellLearn_Booster::CSpellLearn_Booster(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpellLearn_Booster::CSpellLearn_Booster(const CSpellLearn_Booster& rhs) + :CElementObject(rhs) +{ +} + +HRESULT CSpellLearn_Booster::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpellLearn_Booster::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 476.f; + Desc.fY = -253.f; + Desc.fSizeX = 64.f; + Desc.fSizeY = 64.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 = 5.f; + m_fAngle = XMConvertToRadians(0); + m_bHover = true; + m_fImagePosi = _float4(16.f, 16.f, 32.f, 32.f); + static_cast(m_pOwner)->Add_Function(TEXT("BoosterOn"), [this](void* p) {this->BoosterOn(p); }); + static_cast(m_pOwner)->Add_Function(TEXT("BoosterOff"), [this](void* p) {this->BoosterOff(p); }); + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); + Visible(true); + return S_OK; +} + +void CSpellLearn_Booster::BoosterOn(void* pArg) +{ + Booster* State = static_cast(pArg); + if (State->iBoosterIndex != m_iIndex) + return; + + m_bBoosterOn = true; + m_bBoosterOff = false; +} + +void CSpellLearn_Booster::BoosterOff(void* pArg) +{ + Booster* State = static_cast(pArg); + + if (m_bBoosterOn == true) + return; + + if (State->iBoosterIndex != m_iIndex) + return; + + m_bBoosterOff = true; + static_cast(m_pOwner)->Function_Callback(TEXT("ChaseBooster")); +} + +void CSpellLearn_Booster::Set_Index(_int iIndex) +{ + m_iIndex = iIndex; +} + +void CSpellLearn_Booster::Reset() +{ + m_bBoosterOn = false; + m_bBoosterOff = false; + Set_FadeIn(); +} + +void CSpellLearn_Booster::Clear() +{ + Set_FadeOut(); +} + +void CSpellLearn_Booster::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpellLearn_Booster::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bFadeIn == true) + { + if (m_fAlpha <= 1.f) + { + m_fAlpha += fTimeDelta * m_fAlphaTime; + } + + if (m_fAlpha >= 1.f) + { + m_bFadeIn = false; + m_fAlpha = 1.f; + } + } + + if (m_bFadeOut == true) + { + if (m_fAlpha >= 0.f) + m_fAlpha -= fTimeDelta * m_fAlphaTime;; + + if (m_fAlpha <= 0.f) + { + m_bFadeOut = false; + m_fAlpha = 0.f; + } + } + + m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); +} + +void CSpellLearn_Booster::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + __super::Late_Update(fTimeDelta); + } +} + +HRESULT CSpellLearn_Booster::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::SPELLLEARNBOOSTER)))) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) { + return E_FAIL; + } + + return S_OK; +} + +_vector CSpellLearn_Booster::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CSpellLearn_Booster::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_pDiffuse_TextureCom3->Bind_ShaderResource(m_pShaderCom, "g_Texture3", 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_fCurrent_Size", &m_vScale, sizeof(_float2)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fImageSipos1", &m_fImagePosi, sizeof(_float4)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_iHover", &m_bHover, sizeof(_bool)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_iBoosterOn", &m_bBoosterOn, sizeof(_bool)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_iBoosterOff", &m_bBoosterOff, sizeof(_bool)))) + { + return E_FAIL; + } + return S_OK; +} + +HRESULT CSpellLearn_Booster::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_UI_T_SU_ButtonCalloutRing"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Mouse_LeftClick"), reinterpret_cast(&m_pDiffuse_TextureCom1), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_SpellMinigame_SpeedBurstFail"), reinterpret_cast(&m_pDiffuse_TextureCom2), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_VFX_T_Speck_HighCoverage_D"), reinterpret_cast(&m_pDiffuse_TextureCom3), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +CSpellLearn_Booster* CSpellLearn_Booster::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpellLearn_Booster* pInstance = new CSpellLearn_Booster(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpellLearn_Booster"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpellLearn_Booster::Clone(void* pArg, CGameObject* pOwner) +{ + CSpellLearn_Booster* pInstance = new CSpellLearn_Booster(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpellLearn_Booster"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpellLearn_Booster::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pDiffuse_TextureCom1); + SAFE_RELEASE(m_pDiffuse_TextureCom2); + SAFE_RELEASE(m_pDiffuse_TextureCom3); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +void CSpellLearn_Booster::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/SPellLeam_ChaserPointer.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_ChaserPointer.cpp similarity index 63% rename from Jusin154_Team3D/Editor/Private/SPellLeam_ChaserPointer.cpp rename to Jusin154_Team3D/Editor/Private/SpellLearn_ChaserPointer.cpp index aceebd8a7..5c760c82f 100644 --- a/Jusin154_Team3D/Editor/Private/SPellLeam_ChaserPointer.cpp +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_ChaserPointer.cpp @@ -1,24 +1,24 @@ #include "pch.h" -#include "SPellLeam_ChaserPointer.h" +#include "SpellLearn_ChaserPointer.h" #include "GameInstance.h" #include "SpellLearn_MovePointer.h" -CSPellLeam_ChaserPointer::CSPellLeam_ChaserPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +CSpellLearn_ChaserPointer::CSpellLearn_ChaserPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CElementObject(pDevice, pContext) { } -CSPellLeam_ChaserPointer::CSPellLeam_ChaserPointer(const CSPellLeam_ChaserPointer& rhs) +CSpellLearn_ChaserPointer::CSpellLearn_ChaserPointer(const CSpellLearn_ChaserPointer& rhs) :CElementObject(rhs) { } -HRESULT CSPellLeam_ChaserPointer::Initialize_Prototype() +HRESULT CSpellLearn_ChaserPointer::Initialize_Prototype() { return S_OK; } -HRESULT CSPellLeam_ChaserPointer::Initialize(void* pArg) +HRESULT CSpellLearn_ChaserPointer::Initialize(void* pArg) { CUIObject::UIOBJECT_DESC Desc{}; @@ -38,15 +38,17 @@ HRESULT CSPellLeam_ChaserPointer::Initialize(void* pArg) } m_fTimeMult = 3.f; - m_fAlpha = 1.f; + m_fAlpha = 0.f; m_fAlphaTime = 5.f; - m_fMoveSpeed = 140.f; + m_fMoveSpeed = 165.f; + static_cast(m_pOwner)->Add_Function(TEXT("ChaseBooster"), [this](void* p) {this->SpeedUp(); }); + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); Set_SpellLearn(0); Visible(false); return S_OK; } -void CSPellLeam_ChaserPointer::Priority_Update(_float fTimeDelta) +void CSpellLearn_ChaserPointer::Priority_Update(_float fTimeDelta) { if (!__super::Chack_Visible()) { @@ -55,7 +57,7 @@ void CSPellLeam_ChaserPointer::Priority_Update(_float fTimeDelta) __super::Priority_Update(fTimeDelta); } -void CSPellLeam_ChaserPointer::Update(_float fTimeDelta) +void CSpellLearn_ChaserPointer::Update(_float fTimeDelta) { if (!__super::Chack_Visible()) { @@ -87,64 +89,36 @@ void CSPellLeam_ChaserPointer::Update(_float fTimeDelta) } } - 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); - - _float2 fFinalMouse{}; - fFinalMouse.x = fMouse.x - m_fX; - fFinalMouse.y = fMouse.y - m_fY; - - if (m_pGameInstance->Key_Down(DIK_L)) - { - m_bMoveStart = true; - } - if (m_bMoveStart == true) { - m_fTime += fTimeDelta * m_fTimeMult; - if (m_fTime >= 1.f) - { - m_bHover = true; - Line(fTimeDelta); - } + Line(fTimeDelta); } - if (m_bHover == true) + if (m_fMoveSpeed >= 165.f) { - _float Dir = XMVectorGetX( - XMVector3Length( - XMVectorSubtract(m_pPointer->Get_Current_Position(), m_fCurrent_Position))); - - if (Dir <= 16.f) - { - _int a = 10; - } + m_fMoveSpeed -= fTimeDelta; } - m_fAngle = atan2(-fFinalMouse.x, fFinalMouse.y); + m_fTime += fTimeDelta * m_fTimeMult; + + __super::Update(fTimeDelta); } -void CSPellLeam_ChaserPointer::Late_Update(_float fTimeDelta) +void CSpellLearn_ChaserPointer::Late_Update(_float fTimeDelta) { if (!__super::Chack_Visible()) { return; } if (m_bVisible) { - if (m_bHover == true) - { - m_pGameInstance->Add_RenderGroup(RENDER::UI, this); - } + + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); __super::Late_Update(fTimeDelta); } } -HRESULT CSPellLeam_ChaserPointer::Render() +HRESULT CSpellLearn_ChaserPointer::Render() { if (FAILED(Bind_ShaderResources())) { return E_FAIL; @@ -162,13 +136,14 @@ HRESULT CSPellLeam_ChaserPointer::Render() return S_OK; } -_vector CSPellLeam_ChaserPointer::Get_WorldPostion() +_vector CSpellLearn_ChaserPointer::Get_WorldPostion() { return m_pTransformCom->Get_State(STATE::POSITION); } -void CSPellLeam_ChaserPointer::Set_SpellLearn(_int Index) +void CSpellLearn_ChaserPointer::Set_SpellLearn(_int Index) { + m_fAlpha = 0.f; m_bHover = false; m_bMoveStart = false; m_fTime = 0.f; @@ -177,14 +152,16 @@ void CSPellLeam_ChaserPointer::Set_SpellLearn(_int Index) m_iCurrentLine = 0; m_fX = static_cast(m_pOwner)->Get_Learninfo(Index).fStartPosition.x; m_fY = static_cast(m_pOwner)->Get_Learninfo(Index).fStartPosition.y; + m_fMoveSpeed = 165.f; } -void CSPellLeam_ChaserPointer::Set_Pointer(CSpellLearn_MovePointer* Pointer) +void CSpellLearn_ChaserPointer::Set_Move() { - m_pPointer = Pointer; + m_bHover = true; + m_bMoveStart = true; } -void CSPellLeam_ChaserPointer::Line(_float fTime) +void CSpellLearn_ChaserPointer::Line(_float fTime) { m_vLerp_Position = m_MoveLine[m_iCurrentLine]; @@ -202,7 +179,18 @@ void CSPellLeam_ChaserPointer::Line(_float fTime) } -HRESULT CSPellLeam_ChaserPointer::Bind_ShaderResources() +void CSpellLearn_ChaserPointer::SpeedUp() +{ + m_fMoveSpeed = 190.f; +} + +void CSpellLearn_ChaserPointer::Clear() +{ + m_fMoveSpeed = 0.f; + Set_FadeOut(); +} + +HRESULT CSpellLearn_ChaserPointer::Bind_ShaderResources() { if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { @@ -244,7 +232,7 @@ HRESULT CSPellLeam_ChaserPointer::Bind_ShaderResources() return S_OK; } -HRESULT CSPellLeam_ChaserPointer::Ready_Components(void* pArg) +HRESULT CSpellLearn_ChaserPointer::Ready_Components(void* pArg) { if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) { @@ -262,33 +250,33 @@ HRESULT CSPellLeam_ChaserPointer::Ready_Components(void* pArg) return S_OK; } -CSPellLeam_ChaserPointer* CSPellLeam_ChaserPointer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +CSpellLearn_ChaserPointer* CSpellLearn_ChaserPointer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { - CSPellLeam_ChaserPointer* pInstance = new CSPellLeam_ChaserPointer(pDevice, pContext); + CSpellLearn_ChaserPointer* pInstance = new CSpellLearn_ChaserPointer(pDevice, pContext); if (FAILED(pInstance->Initialize_Prototype())) { - MSG_BOX("Failed to Created : CSPellLeam_ChaserPointer"); + MSG_BOX("Failed to Created : CSpellLearn_ChaserPointer"); SAFE_RELEASE(pInstance); } return pInstance; } -CGameObject* CSPellLeam_ChaserPointer::Clone(void* pArg, CGameObject* pOwner) +CGameObject* CSpellLearn_ChaserPointer::Clone(void* pArg, CGameObject* pOwner) { - CSPellLeam_ChaserPointer* pInstance = new CSPellLeam_ChaserPointer(*this); + CSpellLearn_ChaserPointer* pInstance = new CSpellLearn_ChaserPointer(*this); pInstance->m_pOwner = pOwner; if (FAILED(pInstance->Initialize(pArg))) { - MSG_BOX("Failed to Cloned : CSPellLeam_ChaserPointer"); + MSG_BOX("Failed to Cloned : CSpellLearn_ChaserPointer"); SAFE_RELEASE(pInstance); } return pInstance; } -void CSPellLeam_ChaserPointer::Free() +void CSpellLearn_ChaserPointer::Free() { __super::Free(); @@ -297,6 +285,6 @@ void CSPellLeam_ChaserPointer::Free() SAFE_RELEASE(m_pVIBufferCom); } -void CSPellLeam_ChaserPointer::Describe_Entity() +void CSpellLearn_ChaserPointer::Describe_Entity() { } diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_Data.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_Data.cpp index da293f8fe..2456abd27 100644 --- a/Jusin154_Team3D/Editor/Private/SpellLearn_Data.cpp +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_Data.cpp @@ -41,12 +41,34 @@ HRESULT CSpellLearn_Data::Initialize(void* pArg) // 속성 읽기 Info.pSpellName = CMyTools::ToWstring(pName->Attribute("SpellName")); Info.pImageName = CMyTools::ToWstring(pName->Attribute("ImageName")); + pName->QueryIntAttribute("SpellID", &Info.iSpellID); + pName->QueryIntAttribute("SpellType", &Info.iSpellType); pName->QueryFloatAttribute("Size", &Info.fSpellSize); _float fX{}, fY{}; pName->QueryFloatAttribute("x", &fX); pName->QueryFloatAttribute("y", &fY); Info.fStartPosition = _float2(fX, fY); + _float endx{}, endy{}; + pName->QueryFloatAttribute("endx", &endx); + pName->QueryFloatAttribute("endy", &endy); + Info.fEndPosition = _float2(endx, endy); + + tinyxml2::XMLElement* pBooster = pName->FirstChildElement("Booster"); + while (pBooster) + { + tinyxml2::XMLElement* pPos = pBooster->FirstChildElement("Pos"); + if (pPos) + { + _float px{}, py{}; + pPos->QueryFloatAttribute("x", &px); + pPos->QueryFloatAttribute("y", &py); + Info.Booster.push_back(XMVectorSet(px, py, 0.f, 1.f)); + } + + // 다음 Position으로 이동 + pBooster = pBooster->NextSiblingElement("Booster"); + } // Position 요소 반복 tinyxml2::XMLElement* pPosition = pName->FirstChildElement("Position"); diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_LookPointer.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_LookPointer.cpp new file mode 100644 index 000000000..1db84a47b --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_LookPointer.cpp @@ -0,0 +1,253 @@ +#include "pch.h" +#include "SpellLearn_LookPointer.h" +#include "GameInstance.h" + +CSpellLearn_LookPointer::CSpellLearn_LookPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpellLearn_LookPointer::CSpellLearn_LookPointer(const CSpellLearn_LookPointer& rhs) + :CElementObject(rhs) +{ +} + +HRESULT CSpellLearn_LookPointer::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpellLearn_LookPointer::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 100.f; + Desc.fY = 100.f; + Desc.fSizeX = 80.f; + Desc.fSizeY = 80.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 = 5.f; + m_fMoveSpeed = 130.f; + Set_SpellLearn(0); + m_fAngle = XMConvertToRadians(0); + Visible(true); + m_localX = 0.f; + m_localY = 20.f; + return S_OK; +} + +void CSpellLearn_LookPointer::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpellLearn_LookPointer::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bFadeIn == true) + { + if (m_fAlpha <= 1.f) + { + m_fAlpha += fTimeDelta * m_fAlphaTime; + } + + if (m_fAlpha >= 1.f) + { + m_bFadeIn = false; + m_fAlpha = 1.f; + } + } + + if (m_bFadeOut == true) + { + if (m_fAlpha >= 0.f) + m_fAlpha -= fTimeDelta * m_fAlphaTime;; + + if (m_fAlpha <= 0.f) + { + m_bFadeOut = false; + m_fAlpha = 0.f; + } + } + + m_fAngle = XMConvertToRadians(static_cast(m_pOwner)->Get_Angle()); + + float cosA = cos(m_fAngle); + float sinA = sin(m_fAngle); + + float rotatedX = m_localX * cosA - m_localY * sinA; + float rotatedY = m_localX * sinA + m_localY * cosA; + + MoveX(rotatedX); + MoveY(rotatedY); + + m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); +} + +void CSpellLearn_LookPointer::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + __super::Late_Update(fTimeDelta); + } +} + +HRESULT CSpellLearn_LookPointer::Render() +{ + if (FAILED(Bind_ShaderResources())) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::ROTATION)))) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) { + return E_FAIL; + } + + return S_OK; +} + +_vector CSpellLearn_LookPointer::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CSpellLearn_LookPointer::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_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_fMapAngle", &m_fAngle, sizeof(_float)))) + { + return E_FAIL; + } + return S_OK; +} + +HRESULT CSpellLearn_LookPointer::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_UI_T_SU_CursorArrow"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +void CSpellLearn_LookPointer::Set_SpellLearn(_int Index) +{ + m_bMoveStart = false; + m_iLineIndex = _int(static_cast(m_pOwner)->Get_Learninfo(Index).Lines.size()); + m_MoveLine = static_cast(m_pOwner)->Get_Learninfo(Index).Lines; + m_iCurrentLine = 0; + m_fX = static_cast(m_pOwner)->Get_Learninfo(Index).fStartPosition.x; + m_fY = static_cast(m_pOwner)->Get_Learninfo(Index).fStartPosition.y; +} + +CSpellLearn_LookPointer* CSpellLearn_LookPointer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpellLearn_LookPointer* pInstance = new CSpellLearn_LookPointer(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpellLearn_LookPointer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpellLearn_LookPointer::Clone(void* pArg, CGameObject* pOwner) +{ + CSpellLearn_LookPointer* pInstance = new CSpellLearn_LookPointer(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpellLearn_LookPointer"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpellLearn_LookPointer::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +void CSpellLearn_LookPointer::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_MovePointer.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_MovePointer.cpp index 9376cc97d..ea257f75e 100644 --- a/Jusin154_Team3D/Editor/Private/SpellLearn_MovePointer.cpp +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_MovePointer.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include "SpellLearn_MovePointer.h" #include "GameInstance.h" +#include "SpellLearn_LookPointer.h" CSpellLearn_MovePointer::CSpellLearn_MovePointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CElementObject(pDevice, pContext) @@ -36,12 +37,13 @@ HRESULT CSpellLearn_MovePointer::Initialize(void* pArg) return E_FAIL; } - m_fTimeMult = 3.f; - m_fAlpha = 1.f; + m_fTimeMult = 10.f; + m_fAlpha = 0.f; m_fAlphaTime = 5.f; - m_fMoveSpeed = 130.f; + m_fMoveSpeed = 105.f; Set_SpellLearn(0); m_fAngle = XMConvertToRadians(0); + static_cast(m_pOwner)->Add_Function(TEXT("Booster"), [this](void* p) {this->Set_Booster(p); }); Visible(false); return S_OK; } @@ -49,11 +51,16 @@ HRESULT CSpellLearn_MovePointer::Initialize(void* pArg) void CSpellLearn_MovePointer::Set_SpellLearn(_int Index) { m_bMoveStart = false; + m_bHover = true; m_iLineIndex = _int(static_cast(m_pOwner)->Get_Learninfo(Index).Lines.size()); m_MoveLine = static_cast(m_pOwner)->Get_Learninfo(Index).Lines; + m_Boosters = static_cast(m_pOwner)->Get_Learninfo(Index).Booster; m_iCurrentLine = 0; m_fX = static_cast(m_pOwner)->Get_Learninfo(Index).fStartPosition.x; m_fY = static_cast(m_pOwner)->Get_Learninfo(Index).fStartPosition.y; + m_Booster.iBoosterIndex = -1; + m_Booster.bBoosterOn = false; + Set_FadeIn(); } _int CSpellLearn_MovePointer::Get_SpellTrail() @@ -61,7 +68,7 @@ _int CSpellLearn_MovePointer::Get_SpellTrail() return m_iCurrentLine; } -_bool CSpellLearn_MovePointer::Get_bMoveStart() +_bool CSpellLearn_MovePointer::Get_MoveStart() { return m_bMoveStart; } @@ -80,9 +87,18 @@ void CSpellLearn_MovePointer::Line(_float fTime, _float2 fMouse) else { m_bMoveStart = false; + Set_FadeOut(); + static_cast(m_pOwner)->Function_Callback(TEXT("LearnClear")); } } +} +void CSpellLearn_MovePointer::Set_Booster(void* pArg) +{ + Booster* Info = static_cast(pArg); + m_Booster.iBoosterIndex = Info->iBoosterIndex; + m_Booster.bBoosterOn = Info->bBoosterOn; + m_bBooster = true; } void CSpellLearn_MovePointer::Priority_Update(_float fTimeDelta) @@ -140,6 +156,8 @@ void CSpellLearn_MovePointer::Update(_float fTimeDelta) if (m_pGameInstance->Key_Down(DIK_L)) { m_bMoveStart = true; + m_bBooster = false; + m_fMoveSpeed = 105.f; } if (m_bMoveStart == true) @@ -149,6 +167,21 @@ void CSpellLearn_MovePointer::Update(_float fTimeDelta) m_fAngle = atan2(-fFinalMouse.x, fFinalMouse.y); + if (m_bBooster == true) + { + if (m_pGameInstance->Mouse_Down(DIM_LBUTTON)) + { + m_bBooster = false; + m_fMoveSpeed = 160.f; + static_cast(m_pOwner)->Function_Callback(TEXT("BoosterOn"), &m_Booster); + } + } + + if (m_fMoveSpeed >= 105.f) + { + m_fMoveSpeed -= fTimeDelta * m_fTimeMult; + } + m_fTime += fTimeDelta * m_fTimeMult; __super::Update(fTimeDelta); } @@ -160,7 +193,8 @@ void CSpellLearn_MovePointer::Late_Update(_float fTimeDelta) return; } if (m_bVisible) { - m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + if (m_bHover == true) + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); __super::Late_Update(fTimeDelta); } } @@ -249,6 +283,10 @@ HRESULT CSpellLearn_MovePointer::Ready_Components(void* pArg) return E_FAIL; } + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLeam_LookPointer)))) + { + return E_FAIL; + } return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_Overlay.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_Overlay.cpp new file mode 100644 index 000000000..7c04ff286 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_Overlay.cpp @@ -0,0 +1,387 @@ +#include "pch.h" +#include "SpellLearn_Overlay.h" +#include "GameInstance.h" + +CSpellLearn_Overlay::CSpellLearn_Overlay(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpellLearn_Overlay::CSpellLearn_Overlay(const CSpellLearn_Overlay& rhs) + :CElementObject(rhs) +{ +} + +HRESULT CSpellLearn_Overlay::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpellLearn_Overlay::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 380.f; + Desc.fY = -30.f; + Desc.fSizeX = 105.f; + Desc.fSizeY = 105.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_iImageFrameX = 8; + m_iImageFrameY = 8; + m_fFrame = 0.2f; + m_fTimeMult = 3.f; + m_fAngle = XMConvertToRadians(-135.f); + m_fAlpha = 1.f; + m_fAlphaTime = 1.f; + m_vUVScale.x = 1.f; + m_vUVScale.y = 1.f; + m_fCoolTime = 5.f; + m_fSortZ = 0.01f; + m_fMoveSpeed = 10.f; + m_fLerpX = 600.f; + m_fLerpY = 100.f; + m_iSpellType = ENUM_CLASS(SPELLTYPE::CONTROL); + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); + Compute_UI(5); + return S_OK; +} + +void CSpellLearn_Overlay::Set_SpellLearn(_int Index) +{ + Compute_UI(static_cast(m_pOwner)->Get_Learninfo(Index).iSpellID); + m_vUVScale.y = 0.f; + m_fTrail = 0.f; + m_iSpellType = static_cast(m_pOwner)->Get_Learninfo(Index).iSpellType; + m_fSpellLearn = _float(static_cast(m_pOwner)->Get_Learninfo(Index).Lines.size()); + MoveX(static_cast(m_pOwner)->Get_Learninfo(Index).fEndPosition.x); + MoveY(static_cast(m_pOwner)->Get_Learninfo(Index).fEndPosition.y); + SizeUpdate(m_fOrigin_Size.x, m_fOrigin_Size.y); + m_fSizeUp = false; + m_bClear = false; +} + +void CSpellLearn_Overlay::Set_Count(_int Index) +{ + m_fTrail = _float(Index); +} + +void CSpellLearn_Overlay::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpellLearn_Overlay::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + + if (m_bFadeIn == true) + { + if (m_fAlpha <= 1.f) + m_fAlpha += fTimeDelta * m_fAlphaTime; + + if (m_fAlpha >= 1.f) + { + m_bFadeIn = false; + m_fAlpha = 1.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; + } + } + + Update_Trail(fTimeDelta); + + if (m_bClear == true) + { + SizeUp(fTimeDelta * m_fTimeMult * m_fMoveSpeed); + } + + if (m_fSizeUp == true) + { + if (Start_Lerp(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) + { + m_fSizeUp = false; + } + } + + m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); +} + +void CSpellLearn_Overlay::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + } + __super::Late_Update(fTimeDelta); +} + +HRESULT CSpellLearn_Overlay::Render() +{ + if (FAILED(Bind_ShaderResources())) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::TYPE)))) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) + { + return E_FAIL; + } + + return S_OK; +} + +_vector CSpellLearn_Overlay::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CSpellLearn_Overlay::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_pDiffuse_TextureCom3->Bind_ShaderResource(m_pShaderCom, "g_Texture3", 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_fFrame", &m_fFrame, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fAngle", &m_fAngle, 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_iSpellType", &m_iSpellType, sizeof(_int)))) + { + 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_iImageCountX", &m_iImageFrameX, sizeof(_int)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_iImageCountY", &m_iImageFrameY, sizeof(_int)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fDeltaU", &m_vUVScale.x, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fDeltaV", &m_vUVScale.y, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fCoolTime", &m_fCoolTime, sizeof(_float)))) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fImageUV", &m_vUV, sizeof(_float4)))) + { + return E_FAIL; + } + return S_OK; +} + +HRESULT CSpellLearn_Overlay::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_UI_T_ActionItemBack_4K"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_spellmeter_Generic"), reinterpret_cast(&m_pDiffuse_TextureCom1), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_Atlas_Spell"), reinterpret_cast(&m_pDiffuse_TextureCom2), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(ENUM_CLASS(LEVEL::UI), TEXT("Prototype_Texture_UI_T_tillingSmokes"), reinterpret_cast(&m_pDiffuse_TextureCom3), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +void CSpellLearn_Overlay::Clear() +{ + m_vUVScale.y = 1.2f; + m_bClear = true; +} + +void CSpellLearn_Overlay::Compute_UI(_uint SpellID) +{ + _float2 fImage_Size = { 1024.f, 1792.f }; + + _uint iCountX = 4; + _uint iCountY = 6; + + _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 }; + m_vUV = UV; +} + +void CSpellLearn_Overlay::Update_Trail(_float fTimeaDalta) +{ + m_vUVScale.y = CMyTools::Lerp_f1D(m_vUVScale.y, m_fTrail / m_fSpellLearn * 1.05f, fTimeaDalta * m_fMoveSpeed); +} + +void CSpellLearn_Overlay::SizeUp(_float fSizeX) +{ + m_fSizeX += fSizeX; + m_fSizeY += fSizeX; + + if (160.f <= m_fSizeX + fSizeX) + { + m_fSizeX = 160.f; + m_fSizeY = 160.f; + m_bClear = false; + m_fSizeUp = true; + static_cast(m_pOwner)->Function_Callback(TEXT("OverrlayClear")); + } +} + +CSpellLearn_Overlay* CSpellLearn_Overlay::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpellLearn_Overlay* pInstance = new CSpellLearn_Overlay(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpellLearn_Overlay"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpellLearn_Overlay::Clone(void* pArg, CGameObject* pOwner) +{ + CSpellLearn_Overlay* pInstance = new CSpellLearn_Overlay(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpell_Overlay"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpellLearn_Overlay::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pDiffuse_TextureCom1); + SAFE_RELEASE(m_pDiffuse_TextureCom2); + SAFE_RELEASE(m_pDiffuse_TextureCom3); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +void CSpellLearn_Overlay::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_Panel.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_Panel.cpp index 3eb0832a6..be6ab523c 100644 --- a/Jusin154_Team3D/Editor/Private/SpellLearn_Panel.cpp +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_Panel.cpp @@ -4,8 +4,11 @@ #include "SpellLearn_Name.h" #include "SpellLearn.h" #include "SpellLearn_MovePointer.h" -#include "SPellLeam_ChaserPointer.h" +#include "SPellLearn_ChaserPointer.h" #include "SpellLearn_Data.h" +#include "SpellLearn_Booster.h" +#include "SpellLearn_Slot.h" +#include "SpellLearn_Overlay.h" CSpellLearn_Panel::CSpellLearn_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CPanelObject(pDevice, pContext) @@ -46,8 +49,22 @@ HRESULT CSpellLearn_Panel::Initialize(void* pArg) m_fCanvasAlpha = 1.f; m_fSortZ = 0.05f; m_fDelayTime = 1.f; - static_cast(m_pSpellLearn)->Set_Pointer(static_cast(m_pSpellLearn_MovePointer)); - static_cast(m_pSPellLeam_ChaserPointer)->Set_Pointer(static_cast(m_pSpellLearn_MovePointer)); + static_cast(m_pSpellLearn)->Set_Pointer( + static_cast(m_pSpellLearn_MovePointer), + static_cast(m_pSpellLearn_ChaserPointer)); + + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + static_cast(m_pBooster[i])->Move(Get_Learninfo(Index).Booster[i].m128_f32[0], + Get_Learninfo(Index).Booster[i].m128_f32[1]); + } + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + m_PointerStates.push_back(m_State); + m_ChaseStates.push_back(m_State); + } + static_cast(m_pSpellLearn_Overlay)->Set_SpellLearn(0); + static_cast(m_pSpellLearn_Slot)->Set_SpellLearn(0); Visible(true); ElementAllVisible(true); return S_OK; @@ -58,6 +75,23 @@ const CUIObject::SPELLLEARNINFO CSpellLearn_Panel::Get_Learninfo(_int Index) return static_cast(m_pSpellLearn_Data)->Get_SpellLearn(Index); } +void CSpellLearn_Panel::Set_Learn(_int Index) +{ + m_fTime = 0.f; + static_cast(m_pSpellLearn)->Change_Image(Index); + static_cast(m_pSpellLearn_MovePointer)->Set_SpellLearn(Index); + static_cast(m_pSpellLearn_ChaserPointer)->Set_SpellLearn(Index); + static_cast(m_pSpellLearn_Name)->Set_Name(Index); + static_cast(m_pSpellLearn_Overlay)->Set_SpellLearn(Index); + static_cast(m_pSpellLearn_Slot)->Set_SpellLearn(Index); + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + static_cast(m_pBooster[i])->Move(Get_Learninfo(Index).Booster[i].m128_f32[0], + Get_Learninfo(Index).Booster[i].m128_f32[1]); + static_cast(m_pBooster[i])->Reset(); + } +} + void CSpellLearn_Panel::Priority_Update(_float fTimeDelta) { if (!__super::Chack_Visible()) @@ -84,12 +118,90 @@ void CSpellLearn_Panel::Update(_float fTimeDelta) { Index++; } - static_cast(m_pSpellLearn)->Change_Image(Index); - static_cast(m_pSpellLearn_MovePointer)->Set_SpellLearn(Index); - static_cast(m_pSPellLeam_ChaserPointer)->Set_SpellLearn(Index); - static_cast(m_pSpellLearn_Name)->Set_Name(Index); + Set_Learn(Index); } + if (static_cast(m_pSpellLearn_MovePointer)->Get_MoveStart() == true) + { + m_fTime += fTimeDelta; + + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + m_PointerStates[i].bPerHit = m_PointerStates[i].bHit; + + _bool bPointer = Chack_Element(static_cast(m_pBooster[i])->Get_Position(), + static_cast(m_pSpellLearn_MovePointer)->Get_Position(), + static_cast(m_pSpellLearn_MovePointer)->Get_Current_Size().x, + static_cast(m_pSpellLearn_MovePointer)->Get_Current_Size().x); + + m_PointerStates[i].bHit = bPointer; + + if (m_PointerStates[i].bHit == true && m_PointerStates[i].bPerHit == false) + { + m_Booster.iBoosterIndex = _int(i); + m_Booster.bBoosterOn = true; + Function_Callback(TEXT("Booster"), &m_Booster); + } + + if (m_PointerStates[i].bHit == false && m_PointerStates[i].bPerHit == true) + { + m_Booster.iBoosterIndex = _int(i); + m_Booster.bBoosterOn = false; + Function_Callback(TEXT("Booster"), &m_Booster); + } + } + + for (size_t i = 0; i < m_pBooster.size(); ++i) + { + m_ChaseStates[i].bPerHit = m_ChaseStates[i].bHit; + + _bool bPointer = Chack_Element(static_cast(m_pBooster[i])->Get_Position(), + static_cast(m_pSpellLearn_ChaserPointer)->Get_Position(), + static_cast(m_pSpellLearn_ChaserPointer)->Get_Current_Size().x, + static_cast(m_pSpellLearn_ChaserPointer)->Get_Current_Size().x); + + m_ChaseStates[i].bHit = bPointer; + + if (m_ChaseStates[i].bHit == true && m_ChaseStates[i].bPerHit == false) + { + m_Booster.iBoosterIndex = _int(i); + m_Booster.bBoosterOn = true; + Function_Callback(TEXT("BoosterOff"), &m_Booster); + } + + static_cast(m_pSpellLearn_Overlay)->Set_Count( + static_cast(m_pSpellLearn_MovePointer)->Get_SpellTrail()); + + } + + if (m_fTime >= 1.f) + { + static_cast(m_pSpellLearn_ChaserPointer)->Set_FadeIn(); + } + + if (m_fTime >= 2.f) + { + static_cast(m_pSpellLearn_ChaserPointer)->Set_Move(); + + if (_bool bPointer = Chack_Element(static_cast(m_pSpellLearn_MovePointer)->Get_Position(), + static_cast(m_pSpellLearn_ChaserPointer)->Get_Position(), + static_cast(m_pSpellLearn_MovePointer)->Get_Current_Size().x, + static_cast(m_pSpellLearn_ChaserPointer)->Get_Current_Size().x) == true) + { + Set_Learn(Index); + + m_Booster.iBoosterIndex = _int(-1); + m_Booster.bBoosterOn = false; + Function_Callback(TEXT("Booster"), &m_Booster); + for (size_t i = 0; i < m_PointerStates.size(); ++i) + { + m_PointerStates[i].bPerHit = false; + m_PointerStates[i].bHit = false; + } + } + + } + } __super::Update(fTimeDelta); } @@ -216,11 +328,35 @@ HRESULT CSpellLearn_Panel::Ready_Element(void* pArg) } Add_Element(TEXT("SpellLearn_MovePointer"), m_pSpellLearn_MovePointer); - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSPellLeam_ChaserPointer)))) + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLearn_ChaserPointer)))) { return E_FAIL; } - Add_Element(TEXT("SPellLeam_ChaserPointer"), m_pSPellLeam_ChaserPointer); + Add_Element(TEXT("SPellLeam_ChaserPointer"), m_pSpellLearn_ChaserPointer); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLearn_Slot)))) + { + return E_FAIL; + } + Add_Element(TEXT("SpellLearn_Slot"), m_pSpellLearn_Slot); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLearn_Overlay)))) + { + return E_FAIL; + } + Add_Element(TEXT("SpellLearn_Overlay"), m_pSpellLearn_Overlay); + + for (_int i = 0; i < 3; ++i) + { + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pSpellLearn_Booster)))) + { + return E_FAIL; + } + + static_cast(m_pSpellLearn_Booster)->Set_Index(i); + + m_pBooster.push_back(m_pSpellLearn_Booster); + } return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/SpellLearn_Slot.cpp b/Jusin154_Team3D/Editor/Private/SpellLearn_Slot.cpp new file mode 100644 index 000000000..f7d879eaf --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/SpellLearn_Slot.cpp @@ -0,0 +1,283 @@ +#include "pch.h" +#include "SpellLearn_Slot.h" +#include "GameInstance.h" + +CSpellLearn_Slot::CSpellLearn_Slot(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + :CElementObject(pDevice, pContext) +{ +} + +CSpellLearn_Slot::CSpellLearn_Slot(const CSpellLearn_Slot& rhs) + :CElementObject(rhs) +{ +} + +HRESULT CSpellLearn_Slot::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CSpellLearn_Slot::Initialize(void* pArg) +{ + CUIObject::UIOBJECT_DESC Desc{}; + + Desc.fX = 380.f; + Desc.fY = -30.f; + Desc.fSizeX = 105.f; + Desc.fSizeY = 105.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_fAngle = XMConvertToRadians(135.f); + m_fAlpha = 1.f; + m_fAlphaTime = 1.f; + m_fMoveSpeed = 10.f; + m_fLerpX = 600.f; + m_fLerpY = 100.f; + static_cast(m_pOwner)->Add_Function(TEXT("LearnClear"), [this](void* p) {this->Clear(); }); + return S_OK; +} + +void CSpellLearn_Slot::Priority_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + __super::Priority_Update(fTimeDelta); +} + +void CSpellLearn_Slot::Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + + if (m_bFadeIn == true) + { + if (m_fAlpha <= 1.f) + m_fAlpha += fTimeDelta * m_fAlphaTime; + + if (m_fAlpha >= 1.f) + { + m_bFadeIn = false; + m_fAlpha = 1.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; + } + } + + if (m_bClear == true) + { + SizeUp(fTimeDelta * m_fTimeMult * m_fMoveSpeed); + } + + if (m_fSizeUp == true) + { + if (Start_Lerp(fTimeDelta * m_fTimeMult * m_fMoveSpeed) == true) + { + m_fSizeUp = false; + } + } + + m_fTime += fTimeDelta * m_fTimeMult; + __super::Update(fTimeDelta); +} + +void CSpellLearn_Slot::Late_Update(_float fTimeDelta) +{ + if (!__super::Chack_Visible()) + { + return; + } + if (m_bVisible) { + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); + } + __super::Late_Update(fTimeDelta); +} + +HRESULT CSpellLearn_Slot::Render() +{ + if (FAILED(Bind_ShaderResources())) + { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::SLOT)))) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Bind_Resources())) + { + return E_FAIL; + } + if (FAILED(m_pVIBufferCom->Render())) + { + return E_FAIL; + } + + return S_OK; +} + +_vector CSpellLearn_Slot::Get_WorldPostion() +{ + return m_pTransformCom->Get_State(STATE::POSITION); +} + +HRESULT CSpellLearn_Slot::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_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_fAngle", &m_fAngle, 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_iSpellType", &m_iSpellType, sizeof(_int)))) + { + 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_fAngle", &m_fAngle, sizeof(_float)))) + { + return E_FAIL; + } + return S_OK; +} + +HRESULT CSpellLearn_Slot::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_UI_T_ActionItemGoldleaf_4K"), reinterpret_cast(&m_pDiffuse_TextureCom), nullptr))) + { + return E_FAIL; + } + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + return S_OK; +} + +void CSpellLearn_Slot::Set_SpellLearn(_int Index) +{ + MoveX(static_cast(m_pOwner)->Get_Learninfo(Index).fEndPosition.x); + MoveY(static_cast(m_pOwner)->Get_Learninfo(Index).fEndPosition.y); + SizeUpdate(m_fOrigin_Size.x, m_fOrigin_Size.y); + m_fSizeUp = false; + m_bClear = false; +} + +void CSpellLearn_Slot::Clear() +{ + m_bClear = true; +} + +void CSpellLearn_Slot::SizeUp(_float fSizeX) +{ + m_fSizeX += fSizeX; + m_fSizeY += fSizeX; + + if (160.f <= m_fSizeX + fSizeX) + { + m_fSizeX = 160.f; + m_fSizeY = 160.f; + m_bClear = false; + m_fSizeUp = true; + } +} + +CSpellLearn_Slot* CSpellLearn_Slot::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CSpellLearn_Slot* pInstance = new CSpellLearn_Slot(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CSpellLearn_Slot"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CSpellLearn_Slot::Clone(void* pArg, CGameObject* pOwner) +{ + CSpellLearn_Slot* pInstance = new CSpellLearn_Slot(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CSpellLearn_Slot"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CSpellLearn_Slot::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pVIBufferCom); +} + +void CSpellLearn_Slot::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index bf3d4a12a..ec3bf8873 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -34,7 +34,7 @@ namespace Editor REVELIO, POTION, MAGIC_ITEM, SPELL_PREVIEW, SPELL_HEADER, SPELL_HEADER_LINE, SPELL_DRAG, CAMERA_LOCKON, LODING_SCREEN, ENEMY_HPBAR, BOSS_HPBAR, QUEST_BORDER, QUEST_INFO, QUEST_STATUS, BROOMSTICK, - SPELL_LEARN, SPELLLEARNCOLOR, + SPELL_LEARN, SPELLLEARNCOLOR, SPELLLEARNBOOSTER, ENEMY_DETECTION, INTERACTION_OBJECT, 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 ,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, SPELL_LOCK, QUEST_SLOT, END }; diff --git a/Jusin154_Team3D/Editor/Public/SpellLearn.h b/Jusin154_Team3D/Editor/Public/SpellLearn.h index 2a82b0b7e..478448067 100644 --- a/Jusin154_Team3D/Editor/Public/SpellLearn.h +++ b/Jusin154_Team3D/Editor/Public/SpellLearn.h @@ -27,7 +27,11 @@ class CSpellLearn final : public CElementObject public: HRESULT Change_Image(_int SpellID); - void Set_Pointer(class CSpellLearn_MovePointer* Pointer); + void Set_Pointer(class CSpellLearn_MovePointer* Pointer, class CSpellLearn_ChaserPointer* Chase); + +private: + void Clear(); + private: CTexture* m_pDiffuse_TextureCom = { nullptr }; CTexture* m_pDiffuse_TextureCom1 = { nullptr }; @@ -35,13 +39,22 @@ class CSpellLearn final : public CElementObject CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; class CSpellLearn_MovePointer* m_pPointer = { nullptr }; + class CSpellLearn_ChaserPointer* m_pChasePointer = { nullptr }; _float2 m_vPointerPosition{}; _float3 m_vPointerScale{}; + _float2 m_vChasePosition{}; + _float3 m_vChaseScale{}; + + _bool m_bReset{}; + _int m_iIndex{}; - vector<_float2> m_Trail; _int m_iTrailIndex{}; + vector<_float2> m_Trail; + + _int m_iChaseiTrailIndex{}; + vector<_float2> m_ChaseTrail; vector<_vector> m_MoveLine; public: diff --git a/Jusin154_Team3D/Editor/Public/SpellLearn_Booster.h b/Jusin154_Team3D/Editor/Public/SpellLearn_Booster.h new file mode 100644 index 000000000..6020654e3 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/SpellLearn_Booster.h @@ -0,0 +1,63 @@ +#pragma once + +#include "Editor_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Editor) + +class CSpellLearn_Booster final : public CElementObject +{ +private: + struct Booster + { + _bool bBoosterOn = { false }; + _int iBoosterIndex{}; + }; +private: + CSpellLearn_Booster(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_Booster(const CSpellLearn_Booster& rhs); + virtual ~CSpellLearn_Booster() = 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 BoosterOn(void* pArg); + void BoosterOff(void* pArg); + + void Set_Index(_int iIndex); + void Reset(); + +private: + void Clear(); + +private: + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CTexture* m_pDiffuse_TextureCom1 = { nullptr }; + CTexture* m_pDiffuse_TextureCom2 = { nullptr }; + CTexture* m_pDiffuse_TextureCom3 = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + _bool m_bBoosterOn = { false }; + _bool m_bBoosterOff = { false }; + _float4 m_fImagePosi{}; + _int m_iIndex{}; +public: + static CSpellLearn_Booster* 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/SPellLeam_ChaserPointer.h b/Jusin154_Team3D/Editor/Public/SpellLearn_ChaserPointer.h similarity index 68% rename from Jusin154_Team3D/Editor/Public/SPellLeam_ChaserPointer.h rename to Jusin154_Team3D/Editor/Public/SpellLearn_ChaserPointer.h index eb92440ff..319b5109d 100644 --- a/Jusin154_Team3D/Editor/Public/SPellLeam_ChaserPointer.h +++ b/Jusin154_Team3D/Editor/Public/SpellLearn_ChaserPointer.h @@ -5,12 +5,12 @@ NS_BEGIN(Editor) -class CSPellLeam_ChaserPointer final : public CElementObject +class CSpellLearn_ChaserPointer final : public CElementObject { private: - CSPellLeam_ChaserPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); - CSPellLeam_ChaserPointer(const CSPellLeam_ChaserPointer& rhs); - virtual ~CSPellLeam_ChaserPointer() = default; + CSpellLearn_ChaserPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_ChaserPointer(const CSpellLearn_ChaserPointer& rhs); + virtual ~CSpellLearn_ChaserPointer() = default; public: virtual void Priority_Update(_float fTimeDelta); @@ -27,17 +27,15 @@ class CSPellLeam_ChaserPointer final : public CElementObject public: void Set_SpellLearn(_int Index); - void Set_Pointer(class CSpellLearn_MovePointer* Pointer); - + void Set_Move(); private: void Line(_float fTime); - - + void SpeedUp(); + void Clear(); private: CTexture* m_pDiffuse_TextureCom = { nullptr }; CShader* m_pShaderCom = { nullptr }; CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; - class CSpellLearn_MovePointer* m_pPointer = { nullptr }; _bool m_bMoveStart = { false }; @@ -47,7 +45,7 @@ class CSPellLeam_ChaserPointer final : public CElementObject vector<_vector> m_MoveLine; public: - static CSPellLeam_ChaserPointer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + static CSpellLearn_ChaserPointer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; virtual void Free() override; void Describe_Entity() override; diff --git a/Jusin154_Team3D/Editor/Public/SpellLearn_LookPointer.h b/Jusin154_Team3D/Editor/Public/SpellLearn_LookPointer.h new file mode 100644 index 000000000..ca0580012 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/SpellLearn_LookPointer.h @@ -0,0 +1,51 @@ +#pragma once + +#include "Editor_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Editor) + +class CSpellLearn_LookPointer final : public CElementObject +{ +private: + CSpellLearn_LookPointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_LookPointer(const CSpellLearn_LookPointer& rhs); + virtual ~CSpellLearn_LookPointer() = 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 Set_SpellLearn(_int Index); + +private: + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + + _bool m_bMoveStart = { false }; + + _int m_iLineIndex{}; + _int m_iCurrentLine{}; + vector<_vector> m_MoveLine; + _float m_localX{}; + _float m_localY{}; +public: + static CSpellLearn_LookPointer* 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/SpellLearn_MovePointer.h b/Jusin154_Team3D/Editor/Public/SpellLearn_MovePointer.h index 57d2677f8..5a7c44978 100644 --- a/Jusin154_Team3D/Editor/Public/SpellLearn_MovePointer.h +++ b/Jusin154_Team3D/Editor/Public/SpellLearn_MovePointer.h @@ -7,6 +7,12 @@ NS_BEGIN(Editor) class CSpellLearn_MovePointer final : public CElementObject { +private: + struct Booster + { + _bool bBoosterOn = { false }; + _int iBoosterIndex{}; + }; private: CSpellLearn_MovePointer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CSpellLearn_MovePointer(const CSpellLearn_MovePointer& rhs); @@ -28,23 +34,28 @@ class CSpellLearn_MovePointer final : public CElementObject public: void Set_SpellLearn(_int Index); _int Get_SpellTrail(); - _bool Get_bMoveStart(); + _bool Get_MoveStart(); private: void Line(_float fTime, _float2 fMouse); + void Set_Booster(void* pArg); private: CTexture* m_pDiffuse_TextureCom = { nullptr }; CShader* m_pShaderCom = { nullptr }; CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + class SpellLearm_LookPointer* m_pSpellLeam_LookPointer = { nullptr }; _bool m_bMoveStart = { false }; + _bool m_bBooster = { false }; + + Booster m_Booster; _int m_iLineIndex{}; _int m_iCurrentLine{}; vector<_vector> m_MoveLine; - + vector<_vector> m_Boosters; public: static CSpellLearn_MovePointer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; diff --git a/Jusin154_Team3D/Editor/Public/SpellLearn_Overlay.h b/Jusin154_Team3D/Editor/Public/SpellLearn_Overlay.h new file mode 100644 index 000000000..a8f0d2a5e --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/SpellLearn_Overlay.h @@ -0,0 +1,63 @@ +#pragma once + +#include "Editor_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Editor) + +class CSpellLearn_Overlay final : public CElementObject +{ +private: + CSpellLearn_Overlay(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_Overlay(const CSpellLearn_Overlay& rhs); + virtual ~CSpellLearn_Overlay() = 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 Set_SpellLearn(_int Index); + void Set_Count(_int Index); + +private: + void Clear(); + void Compute_UI(_uint SpellID); + void Update_Trail(_float fTimeaDalta); + void SizeUp(_float fSizeX); +private: + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CTexture* m_pDiffuse_TextureCom1 = { nullptr }; + CTexture* m_pDiffuse_TextureCom2 = { nullptr }; + CTexture* m_pDiffuse_TextureCom3 = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + _int m_iImageFrameX{}; + _int m_iImageFrameY{}; + _float m_fFrame{}; + _float4 m_vUV{}; + + _float m_fSpellLearn{}; + _float m_fTrail{}; + _float m_fTargetTrail{}; + _bool m_bClear = { false }; + _bool m_fSizeUp = { false }; +public: + static CSpellLearn_Overlay* 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/SpellLearn_Panel.h b/Jusin154_Team3D/Editor/Public/SpellLearn_Panel.h index c0dca3d7d..6e2fd4bd5 100644 --- a/Jusin154_Team3D/Editor/Public/SpellLearn_Panel.h +++ b/Jusin154_Team3D/Editor/Public/SpellLearn_Panel.h @@ -11,7 +11,17 @@ NS_BEGIN(Editor) class CSpellLearn_Panel final : public CPanelObject { - +private: + struct Booster + { + _bool bBoosterOn = { false }; + _int iBoosterIndex{}; + }; + struct State + { + _bool bHit = { false }; + _bool bPerHit = { false }; + }; private: CSpellLearn_Panel(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CSpellLearn_Panel(const CSpellLearn_Panel& rhs); @@ -34,6 +44,8 @@ class CSpellLearn_Panel final : public CPanelObject public: virtual const SPELLLEARNINFO Get_Learninfo(_int Index) override; + void Set_Learn(_int Index); + private: CTexture* m_pDiffuse_TextureCom = { nullptr }; CTexture* m_pDiffuse_TextureCom1 = { nullptr }; @@ -45,11 +57,19 @@ class CSpellLearn_Panel final : public CPanelObject CGameObject* m_pSpellLearn_Name = { nullptr }; CGameObject* m_pSpellLearn = { nullptr }; CGameObject* m_pSpellLearn_MovePointer = { nullptr }; - CGameObject* m_pSPellLeam_ChaserPointer = { nullptr }; + CGameObject* m_pSpellLearn_ChaserPointer = { nullptr }; CGameObject* m_pSpellLearn_Data = { nullptr }; + CGameObject* m_pSpellLearn_Booster = { nullptr }; + CGameObject* m_pSpellLearn_Slot= { nullptr }; + CGameObject* m_pSpellLearn_Overlay = { nullptr }; _int Index{}; + vector m_pBooster; + Booster m_Booster; + State m_State; + vector m_PointerStates; + vector m_ChaseStates; public: static CSpellLearn_Panel* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; diff --git a/Jusin154_Team3D/Editor/Public/SpellLearn_Slot.h b/Jusin154_Team3D/Editor/Public/SpellLearn_Slot.h new file mode 100644 index 000000000..d8b8382e6 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/SpellLearn_Slot.h @@ -0,0 +1,49 @@ +#pragma once + +#include "Editor_Define.h" +#include "ElementObject.h" + +NS_BEGIN(Editor) + +class CSpellLearn_Slot final : public CElementObject +{ +private: + CSpellLearn_Slot(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CSpellLearn_Slot(const CSpellLearn_Slot& rhs); + virtual ~CSpellLearn_Slot() = 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 Set_SpellLearn(_int Index); + void Clear(); + +private: + void SizeUp(_float fSizeX); +private: + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + + _bool m_bClear = { false }; + _bool m_fSizeUp = { false }; +public: + static CSpellLearn_Slot* 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/Engine/Private/ElementObject.cpp b/Jusin154_Team3D/Engine/Private/ElementObject.cpp index 7d2df1d4d..3e70c723b 100644 --- a/Jusin154_Team3D/Engine/Private/ElementObject.cpp +++ b/Jusin154_Team3D/Engine/Private/ElementObject.cpp @@ -186,7 +186,6 @@ _bool CElementObject::Start_Lerp_Speed(_float fTimeDelta, _float2 MousePoint) else { - m_fPerPosition = _float2(m_fX, m_fY); XMVECTOR DirNorm = XMVector3Normalize(Dir); m_fX = (Pos + DirNorm * move).m128_f32[0]; m_fY = (Pos + DirNorm * move).m128_f32[1]; @@ -194,6 +193,11 @@ _bool CElementObject::Start_Lerp_Speed(_float fTimeDelta, _float2 MousePoint) } } +_bool CElementObject::Set_Trgger() +{ + return _bool(); +} + void CElementObject::Reset_Pos(_float fTimeDelta) { _vector Pos = m_fCurrent_Position; diff --git a/Jusin154_Team3D/Engine/Private/PanelObject.cpp b/Jusin154_Team3D/Engine/Private/PanelObject.cpp index ea19fd18c..df16b10e4 100644 --- a/Jusin154_Team3D/Engine/Private/PanelObject.cpp +++ b/Jusin154_Team3D/Engine/Private/PanelObject.cpp @@ -183,6 +183,19 @@ _bool CPanelObject::Chack_Visible() return m_bVisible; } +_bool CPanelObject::Chack_Element(_float2 Position, _float2 Target, _float Scale, _float TargetScale) +{ + _vector vPos = XMVectorSet(Position.x, Position.y, 0.f, 1.f); + _vector vTarget = XMVectorSet(Target.x, Target.y, 0.f, 1.f); + + _float Dir = XMVectorGetX(XMVector3Length(XMVectorSubtract(vTarget, vPos))); + + if (Dir <= (Scale * 0.5f) + (TargetScale * 0.5f)) + return true; + + return false; +} + CGameObject* CPanelObject::Find_Element(const wstring& Name) { auto iter = m_Elements_map.find(Name); diff --git a/Jusin154_Team3D/Engine/Private/RenderTarget.cpp b/Jusin154_Team3D/Engine/Private/RenderTarget.cpp index 39aeceb80..a87c26739 100644 --- a/Jusin154_Team3D/Engine/Private/RenderTarget.cpp +++ b/Jusin154_Team3D/Engine/Private/RenderTarget.cpp @@ -16,8 +16,6 @@ HRESULT CRenderTarget::Initialize(_uint iSizeX, _uint iSizeY, DXGI_FORMAT ePixel { D3D11_TEXTURE2D_DESC TextureDesc{}; - m_vTargetSize.x = (_float)iSizeX; - m_vTargetSize.y = (_float)iSizeY; TextureDesc.Width = iSizeX; TextureDesc.Height = iSizeY; TextureDesc.MipLevels = 1; diff --git a/Jusin154_Team3D/Engine/Public/ElementObject.h b/Jusin154_Team3D/Engine/Public/ElementObject.h index acf454950..363435267 100644 --- a/Jusin154_Team3D/Engine/Public/ElementObject.h +++ b/Jusin154_Team3D/Engine/Public/ElementObject.h @@ -32,6 +32,7 @@ class ENGINE_DLL CElementObject abstract : public CUIObject virtual _bool Start_Lerp(_float fTimeDelta) override; virtual _bool Start_Lerp_Speed(_float fTimeDelta, _float2 MousePoint) override; + virtual _bool Set_Trgger(); virtual void Reset_Pos(_float fTimeDelta)override; virtual void Start_Size_Lerp(_float fTimeDelta) override; virtual void Reset_Size_Lerp(_float fTimeDelta) override; @@ -44,6 +45,9 @@ class ENGINE_DLL CElementObject abstract : public CUIObject _float m_fBezierTime = 0; + vector<_vector> m_vector; + + public: virtual void Free() override; }; diff --git a/Jusin154_Team3D/Engine/Public/PanelObject.h b/Jusin154_Team3D/Engine/Public/PanelObject.h index c661f9c47..9e790d547 100644 --- a/Jusin154_Team3D/Engine/Public/PanelObject.h +++ b/Jusin154_Team3D/Engine/Public/PanelObject.h @@ -33,10 +33,12 @@ class ENGINE_DLL CPanelObject abstract : public CUIObject virtual void Add_Function(wstring Name, function Evnet) override; virtual void Function_Callback(wstring Name, void* pArg = nullptr) override; + protected: virtual void Add_Element(wstring Name, class CGameObject* pElement); virtual _bool Chack_Visible() override; + virtual _bool Chack_Element(_float2 Position, _float2 Target, _float Scale, _float TargetScale); protected: vector m_Elements; // 패널이 엘리먼츠를 관리하기 위해 만듬 vector m_ElementName; // 엘리멘트들의 이름을 전해주기 위해서 diff --git a/Jusin154_Team3D/Engine/Public/UIObject.h b/Jusin154_Team3D/Engine/Public/UIObject.h index e00286dcd..019f8e113 100644 --- a/Jusin154_Team3D/Engine/Public/UIObject.h +++ b/Jusin154_Team3D/Engine/Public/UIObject.h @@ -76,10 +76,14 @@ typedef struct tagCurrentQeustSerectInfo typedef struct tagSpellLearnInfo { - _wstring pSpellName{}; - _wstring pImageName{}; - _float fSpellSize{}; - _float2 fStartPosition{}; + _wstring pSpellName{}; + _wstring pImageName{}; + _int iSpellID{}; + _int iSpellType{}; + _float fSpellSize{}; + _float2 fStartPosition{}; + _float2 fEndPosition{}; + vector<_vector> Booster; vector<_vector> Lines; }SPELLLEARNINFO;