//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, September 12, 2017 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class FairyChangeTipWin : Window { private Button notifyCancelBtn; private Button notifyChangeBtn; private InputField notifyInput; private Text notifyFreeCnt; FairyModel model { get { return ModelCenter.Instance.GetModel(); } } private void OnNotifyChangeBtn() { if (notifyInput.text != string.Empty) { if (DirtyWordConfig.IsDirtWord(notifyInput.text)) { MessageWin.Inst.ShowFixedTip(Language.Get("L1007")); return; } } int freeCnt = Mathf.Max(0, model.freeNotifyCount - (int)PlayerDatas.Instance.fairyData.fairy.Extra3); if (freeCnt < 1) { if (PlayerDatas.Instance.baseData.Gold < model.changeNotifyCost && PlayerDatas.Instance.baseData.GoldPaper < model.changeNotifyCost) { if (VersionConfig.Get().isBanShu) { SysNotifyMgr.Instance.ShowTip("GoldErr"); return; } WindowCenter.Instance.Open(); return; } ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("ChangeTipConfirm", model.changeNotifyCost), (bool isOk) => { if (isOk) { SendChangeNotify(); } }); return; } SendChangeNotify(); } private void SendChangeNotify() { LanguageVerify.Instance.VerifyFairy(notifyInput.text, 1, PlayerDatas.Instance.fairyData.fairy.FamilyName, PlayerDatas.Instance.fairyData.mine.FamilyLV, (bool ok, string result) => { if (ok) { C0F04_tagCFamilyChangeBroadcast notifyPack = new C0F04_tagCFamilyChangeBroadcast(); notifyPack.Msg = result; GameNetSystem.Instance.SendInfo(notifyPack); CloseImmediately(); try { OperationLogCollect.Instance.ChatReport(result, Language.Get("GameNotice1"), string.Empty, ChatInfoType.Fairy); } catch (Exception e) { DebugEx.Log(e.Message); } } }); } private void OnNotifyCancelBtn() { CloseImmediately(); } #region Built-in protected override void BindController() { notifyCancelBtn = transform.Find("CancelBtn").GetComponent