多语言增加西班牙语

This commit is contained in:
hahwu 2026-02-06 10:29:09 +08:00
parent fb4367080d
commit 69cbb39221
4 changed files with 51 additions and 54 deletions

View File

@ -27,6 +27,8 @@ func GetLanguage(lang msg.LANG_TYPE, key string) string {
return gamedata.GetStringValue(data, "pt_BR")
case msg.LANG_TYPE_LANG_CN:
return gamedata.GetStringValue(data, "zh_CN")
case msg.LANG_TYPE_LANG_ES_LATAM:
return gamedata.GetStringValue(data, "es_LATAM")
default:
return key
}

View File

@ -485,25 +485,6 @@ func ReqGmCommand_(player *Player, Command string) error {
EndTime: EndTime,
Num: int32(Times),
})
case "sendMail":
MailMod := player.PlayMod.getMailMod()
title := `MMM圣诞节奖励`
content := `测试`
MailMod.Send(title, "副标题", content, title, "副标题", content, []*item.Item{
{
Id: item.ITEM_DIAMOND_ID,
Num: 10,
},
{
Id: item.ITEM_ENERGY_ID,
Num: 10,
},
{
Id: item.ITEM_STAR_ID,
Num: 10,
},
}, 2)
player.PushClientRes(MailMod.BackData())
case "resetNpc":
FriendMod := player.PlayMod.getFriendMod()
FriendMod.Npc = []int{}

View File

@ -380,9 +380,16 @@ func (p *Player) handle(m *msg.Msg) error {
MailMod := p.PlayMod.getMailMod()
mt, mc, mt_en, mc_en := mailCfg.GetChargeSendMail(PlayerSimpleData.Name)
Items := p.ChargeItem(C.ChargeId)
MailId := MailMod.Send(mt, "", mc, mt_en, "", mc_en, Items, mail.MAIL_TYPE_GIFT)
p.AddLog(m.From, friend.LOG_TYPE_CHARGE_SEND, fmt.Sprintf("%d", MailId), m.SendT)
p.PushClientRes(MailMod.NotifyMail(MailId))
mailId := MailMod.SendMail(&mail.MailStruct{
Title: mt,
Content: mc,
TitleEn: mt_en,
ContentEn: mc_en,
Items: Items,
Type: mail.MAIL_TYPE_GIFT,
})
p.AddLog(m.From, friend.LOG_TYPE_CHARGE_SEND, fmt.Sprintf("%d", mailId), m.SendT)
p.PushClientRes(MailMod.NotifyMail(mailId))
case msg.HANDLE_TYPE_CHARGE_RECEIVE: // 收到好友的感谢信
Content, ok := m.Extra.(string)
if !ok {
@ -391,9 +398,15 @@ func (p *Player) handle(m *msg.Msg) error {
PlayerSimpleData := G_GameLogicPtr.GetResSimplePlayerByUid(m.From)
MailMod := p.PlayMod.getMailMod()
mt, mc, mt_en, mc_en := mailCfg.GetChargeReceiveMail(PlayerSimpleData.Name, Content)
MailId := MailMod.Send(mt, "", mc, mt_en, "", mc_en, nil, mail.MAIL_TYPE_NORMAL)
p.AddLog(m.From, friend.LOG_TYPE_CHARGE_RECEIVE, fmt.Sprintf("%d", MailId), m.SendT)
p.PushClientRes(MailMod.NotifyMail(MailId))
mailId := MailMod.SendMail(&mail.MailStruct{
Title: mt,
Content: mc,
TitleEn: mt_en,
ContentEn: mc_en,
Type: mail.MAIL_TYPE_NORMAL,
})
p.AddLog(m.From, friend.LOG_TYPE_CHARGE_RECEIVE, fmt.Sprintf("%d", mailId), m.SendT)
p.PushClientRes(MailMod.NotifyMail(mailId))
case msg.HANDLE_TYPE_WISHLIST_SEND: // 发送愿望单请求
FriendMod := p.PlayMod.getFriendMod()
FriendMod.AddWishApply(int64(m.From))

View File

@ -36,6 +36,10 @@ type MailInfo struct {
TitlePtBr string
SubTitlePtBr string
ContentPtBr string
// 西班牙语 拉丁美洲
TitleEsLatam string
SubTitleEsLatam string
ContentEsLatam string
Items []*item.Item // 邮件道具
Type int //邮件类型
@ -63,6 +67,11 @@ type MailStruct struct {
SubTitlePtBr string
ContentPtBr string
// 西班牙语 拉丁美洲
TitleEsLatam string
SubTitleEsLatam string
ContentEsLatam string
Items []*item.Item
Type int
}
@ -84,6 +93,9 @@ func (m *MailMod) SendMail(mail *MailStruct) int {
TitlePtBr: mail.TitlePtBr,
SubTitlePtBr: mail.SubTitlePtBr,
ContentPtBr: mail.ContentPtBr,
TitleEsLatam: mail.TitleEsLatam,
SubTitleEsLatam: mail.SubTitleEsLatam,
ContentEsLatam: mail.ContentEsLatam,
Items: mail.Items,
Send: GoUtil.Now(),
Type: mail.Type,
@ -92,23 +104,6 @@ func (m *MailMod) SendMail(mail *MailStruct) int {
return m.AutoId
}
// 发送邮件
func (m *MailMod) Send(Title, SubTitle, Content, TitleEn, SubTitleEn, ContentEn string, Items []*item.Item, t int) int {
m.AutoId++
m.List[m.AutoId] = &MailInfo{
Title: Title,
SubTitle: SubTitle,
Content: Content,
TitleEn: TitleEn,
SubTitleEn: SubTitleEn,
ContentEn: ContentEn,
Items: Items,
Send: GoUtil.Now(),
Type: t,
}
return m.AutoId
}
// 阅读邮件
func (m *MailMod) Read(id int) error {
v, ok := m.List[id]
@ -167,10 +162,13 @@ func (m *MailMod) BackData() *msg.ResMailList {
TitlePtBr: v.TitlePtBr,
SubTitlePtBr: v.SubTitlePtBr,
ContentPtBr: v.ContentPtBr,
TitleEsLa: v.TitleEsLatam,
SubTitleEsLa: v.SubTitleEsLatam,
ContentEsLa: v.ContentEsLatam,
Type: int32(v.Type),
Items: item.ItemToMsg(v.Items),
Status: int32(v.Status),
Time: int32(v.Send),
Type: int32(v.Type),
}
}
return res
@ -192,6 +190,9 @@ func (m *MailMod) NotifyMail(Id int) *msg.MailNotify {
SubTitlePtBr: mailInfo.SubTitlePtBr,
ContentPtBr: mailInfo.ContentPtBr,
TitleEsLa: mailInfo.TitleEsLatam,
SubTitleEsLa: mailInfo.SubTitleEsLatam,
ContentEsLa: mailInfo.ContentEsLatam,
Type: int32(mailInfo.Type),
Items: item.ItemToMsg(mailInfo.Items),
Status: int32(mailInfo.Status),