73 lines
2.7 KiB
C#
73 lines
2.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class NickChange : BackKeyAdd
|
|
{
|
|
public static List<Action<string>> actChangeNick = new List<Action<string>>();
|
|
|
|
public UIInput m_Input;
|
|
public UILabel text_warning, label_price;
|
|
int price = 1000;
|
|
|
|
public override void Set()
|
|
{
|
|
base.Set();
|
|
text_warning.text = "";
|
|
price = ServerInfo.Ins.m_ServerData.Get_Common(eCommon.NickChange) == 0 ? 0 : 1000;
|
|
label_price.text = ServerInfo.Ins.m_ServerData.Get_Common(eCommon.NickChange) == 0 ? table_localtext.Ins.Get_Text(152) : price.ToString();
|
|
}
|
|
|
|
public void OnClick_Change()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
if (sdata.Check_ItemAmount(eItem.Gem, price))
|
|
{
|
|
if (m_Input.value.Equals(ServerInfo.Ins.UserName))
|
|
text_warning.text = table_localtext.Ins.Get_Text(153);
|
|
else if (string.IsNullOrEmpty(m_Input.value))
|
|
text_warning.text = table_localtext.Ins.Get_Text(154);
|
|
else if (m_Input.value.Contains(" "))
|
|
text_warning.text = table_localtext.Ins.Get_Text(155);
|
|
else if (!DSUtil.IsValidString(m_Input.value))
|
|
text_warning.text = table_localtext.Ins.Get_Text(156);
|
|
else if (m_Input.value.Length < 3 || m_Input.value.Length > 12)
|
|
text_warning.text = table_localtext.Ins.Get_Text(157);
|
|
else if (ChattingCheckWords.ConvertNickname(m_Input.value).IndexOf('*') > -1)
|
|
text_warning.text = table_localtext.Ins.Get_Text(158);
|
|
else
|
|
{
|
|
sdata.Use_Item(eItem.Gem, price);
|
|
sdata.Add_Common(eCommon.NickChange);
|
|
ServerInfo.Ins.UpdateUserTitleDisplayName(m_Input.value,
|
|
() =>
|
|
{
|
|
//NewGameUI.Ins.m_GuideQuestUI.Add_GuideQuest(ePurpose.NickChange);
|
|
ServerInfo.Ins.Write(() =>
|
|
{
|
|
text_warning.text = "";
|
|
for (int i = 0; i < actChangeNick.Count; i++)
|
|
{
|
|
if (actChangeNick[i] != null)
|
|
actChangeNick[i](m_Input.value);
|
|
}
|
|
OnClick_Back();
|
|
ToastUI.Ins.Set(150);
|
|
});
|
|
},
|
|
NameError_FromServer);
|
|
}
|
|
}
|
|
}
|
|
|
|
void NameError_FromServer()
|
|
{
|
|
text_warning.text = table_localtext.Ins.Get_Text(151);
|
|
}
|
|
|
|
public override void OnClick_Back()
|
|
{
|
|
base.OnClick_Back();
|
|
}
|
|
} |