[Tutorial]Emoji in TextLine

Ghiduri şi tutoriale despre cum să vă îmbunătăţiţi serverul/clientul dv. de metin2.
Conectat
Avatar utilizator
trus7
Nivel 1

Nivel 1
Mesaje: 103
Membru din: 23 Noi 2014, 21:19
Status: Sunt bine mersi ^.^
Regat: Jinno
Autentificat prin: iPhone
Mulţumiri acordate: 55  
Mulţumiri primite: 0

[Tutorial]Emoji in TextLine

Mesaj de trus7 » 18 Noi 2020, 17:15

Am observat ca sunt postate cateva tutoriale dar nu sunt complete sau nu ofera suport
Asa ca uitati aici Tutorialul Full
Sursa: Trebuie să fii logat sau înregistrat pentru a vedea acest link.
1.) Open EterLib/TextTag.h and add the new tags into the enum there:
TEXT_TAG_EMOJI_START, // |E
TEXT_TAG_EMOJI_END, // |e ex) |Epath/filename|h
2.1.) Open the EterLib/TextTag.cpp and extend the GetTextTag function with the following statements:
else if (*-cenzurat- == L'E') // emoji |Epath/emo|e
{
tagLen = 2;
return TEXT_TAG_EMOJI_START;
}
else if (*-cenzurat- == L'e') // end of emoji
{
tagLen = 2;
return TEXT_TAG_EMOJI_END;
}
2.2.) Extend the GetTextTagOutputString function with the following statements:
else if (tag == TEXT_TAG_EMOJI_START)
hyperlinkStep = 1;
else if (tag == TEXT_TAG_EMOJI_END)
hyperlinkStep = 0;
2.3.) Repeat the 2.2. in the GetTextTagInternalPosFromRenderPos function:
else if (tag == TEXT_TAG_EMOJI_START)
hyperlinkStep = 1;
else if (tag == TEXT_TAG_EMOJI_END)
hyperlinkStep = 0;
2.4.) Repeat again in the GetTextTagOutputLen function too:
else if (tag == TEXT_TAG_EMOJI_START)
hyperlinkStep = 1;
else if (tag == TEXT_TAG_EMOJI_END)
hyperlinkStep = 0;
3.1.) Open EterLib/GrpTextInstance.h and add the following line at the top of the file where the includes are:
#include "GrpImageInstance.h"
3.2.) Add the following struct below of the SHyperlink struct:
struct SEmoji
{
short x;
CGraphicImageInstance * pInstance;

SEmoji() : x(0)
{
pInstance = NULL;
}
};
3.3.) Below of the m_hyperlinkVector declaration declare a new variable:
std::vector<SEmoji> m_emojiVector;
4.1.) Open EterLib/GrpTextInstance.cpp and add the following line at the top of the file, where the includes are:
#include "ResourceManager.h"
4.2.) In the CGraphicTextInstance::Update function add the following below of this line: m_hyperlinkVector.clear();
if (m_emojiVector.size() != 0)
{
for (std::vector<SEmoji>::iterator itor = m_emojiVector.begin(); itor != m_emojiVector.end(); ++itor)
{
SEmoji & rEmo = *itor;
if (rEmo.pInstance)
{
CGraphicImageInstance::Delete(rEmo.pInstance);
rEmo.pInstance = NULL;
}
}
}
m_emojiVector.clear();
4.3.) This is a bit complicated, so first of all look for this line:
else // ľĆ¶řżÜ ´Ů¸Ą ÁöżŞ.
This is the else for the Arabic codepage, I could not test it, so I didn't make it to arab rtl style.

4.4.) Add the following below of this line: std::wstring hyperlinkBuffer;
SEmoji kEmoji;
int emojiStep = 0;
std::wstring emojiBuffer;
4.5.) Replace this:
if (hyperlinkStep == 1)
hyperlinkBuffer.append(1, wText);

With this:

if (hyperlinkStep == 1)
hyperlinkBuffer.append(1, wText);
else if (emojiStep == 1)
emojiBuffer.append(1, wText);

4.6.) Then add the new processor for the new tags:
else if (ret == TEXT_TAG_EMOJI_START)
{
emojiStep = 1;
emojiBuffer = L"";
}
else if (ret == TEXT_TAG_EMOJI_END)
{
kEmoji.x = x;

char retBuf[1024];
int retLen = Ymir_WideCharToMultiByte(GetDefaultCodePage(), 0, emojiBuffer.c_str(), emojiBuffer.length(), retBuf, sizeof(retBuf) - 1, NULL, NULL);
retBuf[retLen] = '\0';

char szPath[255];
snprintf(szPath, sizeof(szPath), "icon/%s.tga", retBuf);
if (CResourceManager::Instance().IsFileExist(szPath))
{
CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(szPath);
kEmoji.pInstance = CGraphicImageInstance::New();
kEmoji.pInstance->SetImagePointer(pImage);
m_emojiVector.push_back(kEmoji);
memset(&kEmoji, 0, sizeof(SEmoji));
for (int i = 0; i < pImage->GetWidth() / (pSpaceInfo->width-1); ++i)
x += __DrawCharacter(pFontTexture, dataCodePage, ' ', dwColor);
if (pImage->GetWidth() % (pSpaceInfo->width - 1) > 1)
x += __DrawCharacter(pFontTexture, dataCodePage, ' ', dwColor);
}
emojiStep = 0;
emojiBuffer = L"";
}

4.7.) Add the following code to the end of the CGraphicTextInstance::Render function:
if (m_emojiVector.size() != 0)
{
for (std::vector<SEmoji>::iterator itor = m_emojiVector.begin(); itor != m_emojiVector.end(); ++itor)
{
SEmoji & rEmo = *itor;
if (rEmo.pInstance)
{
rEmo.pInstance->SetPosition(fStanX + rEmo.x, (fStanY + 7.0) - (rEmo.pInstance->GetHeight() / 2));
rEmo.pInstance->Render();
}
}
}

4.8.) Add the following into the CGraphicTextInstance::Destroy function:

if (m_emojiVector.size() != 0)
{
for (std::vector<SEmoji>::iterator itor = m_emojiVector.begin(); itor != m_emojiVector.end(); ++itor)
{
SEmoji & rEmo = *itor;
if (rEmo.pInstance)
{
CGraphicImageInstance::Delete(rEmo.pInstance);
rEmo.pInstance = NULL;
}
}
}
m_emojiVector.clear();

Majoritatea au avut probleme la GrpTextInstance.cpp , asa ca uitati un exemplu de cum trebuie aranjat la punctul 4.6:
Imagine
In uichat.py cauti def __SendChatPacket si inlocuiesti cu:

Cod: Selectaţi tot

https://pastebin.com/97nqKsN4
Folderul emoji din arhiva se pune in icon/
Parola arhiva: Just4metin
Trebuie să fii logat sau înregistrat pentru a vedea acest link.
Ultima oară modificat 18 Noi 2020, 18:11 de către trus7, modificat 1 dată în total.

Neconectat
Avatar utilizator
[Reizo]
Membru Club

Membru Club
Mesaje: 1183
Membru din: 22 Oct 2019, 15:44
Reputație: .
◅--------------------------▻
- Membru Club
- Moderator
- S. Moderator
◅--------------------------▻
- Discord: Reizo#6271
◅--------------------------▻
Status: conquering the earth
Server Metin2: SAPPHIRE2
Regat: Chunjo
Rang personalizat: Little Lucifer
Mulţumiri acordate: 366  
Mulţumiri primite: 2027  
Discord: Reizo#6271
Contact:

Re: [Tutorial]Emoji in TextLine

Mesaj de [Reizo] » 18 Noi 2020, 17:38

Mai e postat mane, macar de l traduceai faceai cv.
Imagine

Conectat
Avatar utilizator
JustBalvin
Nivel 1

Nivel 1
Mesaje: 81
Membru din: 05 Iul 2018, 13:51
Status: Tot mereu pe treaba.
Regat: Jinno
Mulţumiri acordate: 138  
Mulţumiri primite: 3  
Discord: Adi#8809
Contact:

Re: [Tutorial]Emoji in TextLine

Mesaj de JustBalvin » 18 Noi 2020, 18:10

Parola la arhiva?

Neconectat
Avatar utilizator
[A]ivory
Membru Club

Membru Club
Mesaje: 2207
Membru din: 06 Mar 2015, 18:33
Reputație: #===============#
Nume anterior: ZyuX, SoLuS
#===============#


==================
[FOST] Moderator
===================
[FOST] Trial Moderator
==================
[FOST] Helper Avansat
===================
[FOST] Fost Lider Helperi
===================
[FOST] Fost Lider Trial Helperi
===================
[FOST] Helperi
===================
[FOST] Trial Helper
===================
Membru Clubul Just4Metin
===================
Status: Prefer să fiu criticat pentru ceea sunt!
Server Metin2: Pandora2
Regat: Jinno
Mulţumiri acordate: 139  
Mulţumiri primite: 1046  
Discord: TWIX#5290

Re: [Tutorial]Emoji in TextLine

Mesaj de [A]ivory » 18 Noi 2020, 18:44

Prietenas, mai este postat odata si te asigur eu ca este complet.

sursa/emoji-textline-t86746.html
Imagine

Neconectat
Avatar utilizator
RandyShadow
Nou Venit

Nou Venit
Mesaje: 2
Membru din: 05 Noi 2018, 19:45
Status: Hi !
Server Metin2: RandyCore
Regat: Jinno
Mulţumiri acordate: 91  
Mulţumiri primite: 0

Re: [Tutorial]Emoji in TextLine

Mesaj de RandyShadow » 21 Noi 2020, 13:28

[A]ivory scrie:
18 Noi 2020, 18:44
Prietenas, mai este postat odata si te asigur eu ca este complet.

Da, "pretenas" dar tot ce ai facut tu e sa dai c-p de pe dev :)) :)) :))

Neconectat
Avatar utilizator
RandyShadow
Nou Venit

Nou Venit
Mesaje: 2
Membru din: 05 Noi 2018, 19:45
Status: Hi !
Server Metin2: RandyCore
Regat: Jinno
Mulţumiri acordate: 91  
Mulţumiri primite: 0

Re: [Tutorial]Emoji in TextLine

Mesaj de RandyShadow » 21 Noi 2020, 13:28

[A]ivory scrie:
18 Noi 2020, 18:44
Prietenas, mai este postat odata si te asigur eu ca este complet.

Da, "pretenas" dar tot ce ai facut tu e sa dai c-p de pe dev :)) :)) :))

Scrie răspuns

Înapoi la “Ghiduri şi Tutoriale”