aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/XUI/XUI_Chat.cpp
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/Common/XUI/XUI_Chat.cpp
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/Common/XUI/XUI_Chat.cpp')
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Chat.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/Minecraft.Client/Common/XUI/XUI_Chat.cpp b/Minecraft.Client/Common/XUI/XUI_Chat.cpp
new file mode 100644
index 00000000..3e3faa77
--- /dev/null
+++ b/Minecraft.Client/Common/XUI/XUI_Chat.cpp
@@ -0,0 +1,71 @@
+#include "stdafx.h"
+#include "XUI_Chat.h"
+#include "..\..\Minecraft.h"
+#include "..\..\Gui.h"
+
+HRESULT CScene_Chat::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
+{
+ m_iPad = *(int *)pInitData->pvInitData;
+
+ MapChildControls();
+
+ this->SetTimer(0,100);
+
+ XuiElementGetPosition(m_hObj,&m_OriginalPosition);
+
+ return S_OK;
+}
+
+HRESULT CScene_Chat::OnTimer( XUIMessageTimer *pXUIMessageTimer, BOOL &bHandled)
+{
+ Minecraft *pMinecraft = Minecraft::GetInstance();
+ Gui *pGui = pMinecraft->gui;
+
+ //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) );
+ for( unsigned int i = 0; i < CHAT_LINES_COUNT; ++i )
+ {
+ float opacity = pGui->getOpacity(m_iPad, i);
+ if( opacity > 0 )
+ {
+ m_Backgrounds[i].SetOpacity(opacity);
+ m_Labels[i].SetOpacity(opacity);
+ m_Labels[i].SetText( pGui->getMessage(m_iPad,i).c_str() );
+ }
+ else
+ {
+ m_Backgrounds[i].SetOpacity(0);
+ m_Labels[i].SetOpacity(0);
+ }
+ }
+ if(pMinecraft->localplayers[m_iPad]!= NULL)
+ {
+ m_Jukebox.SetText( pGui->getJukeboxMessage(m_iPad).c_str() );
+ m_Jukebox.SetOpacity( pGui->getJukeboxOpacity(m_iPad) );
+ }
+ return S_OK;
+}
+
+HRESULT CScene_Chat::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
+{
+ bHandled=true;
+
+ app.ReloadChatScene(m_iPad, bJoining);
+
+ return S_OK;
+}
+
+HRESULT CScene_Chat::OffsetTextPosition( float xOffset, float yOffset /*= 0.0f*/ )
+{
+ D3DXVECTOR3 vPos;
+ float fWidth, fHeight;
+ XuiElementGetBounds( m_Backgrounds[0], &fWidth, &fHeight );
+ for(unsigned int i = 0; i < CHAT_LINES_COUNT; ++i)
+ {
+ XuiElementGetPosition( m_Labels[i], &vPos );
+ vPos.x = xOffset;
+ vPos.y += yOffset;
+ XuiElementSetPosition( m_Labels[i], &vPos );
+ XuiElementSetBounds( m_Labels[i], fWidth - xOffset, fHeight );
+ }
+ return S_OK;
+} \ No newline at end of file