| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Linq; |
| | | using Snxxz.UI; |
| | | using System.Text.RegularExpressions; |
| | | using TableConfig; |
| | | |
| | | public enum MailState |
| | | { |
| | | Read, |
| | | NoRead, |
| | | Delete, |
| | | Receive, |
| | | } |
| | | |
| | | public class MailPanel : MonoBehaviour |
| | | { |
| | | |
| | | #region 成员变量 |
| | | [SerializeField] |
| | | private Text _senderMessagerText; |
| | | [SerializeField] |
| | | private Text _titleMessageText; |
| | | [SerializeField] |
| | | private Text _theTotalTitleText; |
| | | [SerializeField] |
| | | private GameObject _buddyBlueAG; |
| | | [SerializeField] |
| | | private GameObject _buddyBlueBG; |
| | | [SerializeField] |
| | | private GameObject _buddyBlueCG; |
| | | [SerializeField] |
| | | private GameObject _buddyBlueDG; |
| | | [SerializeField] |
| | | private GameObject _buddyBlueEG; |
| | | [SerializeField] |
| | | private GameObject _goldBox; |
| | | [SerializeField] |
| | | private Text _goldText; |
| | | [SerializeField] |
| | | private GameObject _drillBox; |
| | | [SerializeField] |
| | | private Text _drillBoxeText; |
| | | [SerializeField] |
| | | private GameObject _fairyJadeBox; |
| | | [SerializeField] |
| | | private Text _fairyJadeBoxText; |
| | | [SerializeField] |
| | | private Toggle _allSelectToggle; |
| | | [SerializeField] |
| | | private Button _receiveBtn; |
| | | [SerializeField] |
| | | private Button _deleteBtn; |
| | | [SerializeField] |
| | | private ScrollerController _mailCellCtrl; |
| | | |
| | | #endregion |
| | | |
| | | private MailState _mailState = MailState.NoRead; |
| | | private bool _isDeletePromp = true; |
| | | private List<MailInfo> _chooseMailList; |
| | | public Dictionary<string, MailInfo> _isChooseMailDict = new Dictionary<string, MailInfo>(); |
| | | private List<GameObject> _reciveItemParent = new List<GameObject>(); |
| | | private List<MailInfo> mailModellist; |
| | | private MailInfo _currentMailInfo; |
| | | private int curMail = 0; |
| | | |
| | | RuneModel _runeModel; |
| | | RuneModel runeModel |
| | | { |
| | | get { return _runeModel ?? (_runeModel = ModelCenter.Instance.GetModel<RuneModel>()); } |
| | | } |
| | | |
| | | ItemTipsModel _itemTipsModel; |
| | | ItemTipsModel itemTipsModel |
| | | { |
| | | get |
| | | { |
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); |
| | | } |
| | | } |
| | | |
| | | PlayerPackModel _playerPack; |
| | | PlayerPackModel playerPack |
| | | { |
| | | get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } |
| | | } |
| | | |
| | | PackModelInterface _modelInterface; |
| | | PackModelInterface modelInterface |
| | | { |
| | | get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } |
| | | } |
| | | |
| | | private void Awake() |
| | | { |
| | | Init(); |
| | | } |
| | | |
| | | public void Init() |
| | | { |
| | | _senderMessagerText.text = ""; |
| | | _titleMessageText.text = ""; |
| | | _theTotalTitleText.text = ""; |
| | | _reciveItemParent.Add(_buddyBlueAG); |
| | | _reciveItemParent.Add(_buddyBlueBG); |
| | | _reciveItemParent.Add(_buddyBlueCG); |
| | | _reciveItemParent.Add(_buddyBlueDG); |
| | | _reciveItemParent.Add(_buddyBlueEG); |
| | | _mailCellCtrl.OnRefreshCell += RefreshMailCell; |
| | | _allSelectToggle.isOn = false; |
| | | _allSelectToggle.onValueChanged.AddListener( |
| | | |
| | | delegate (bool isOn) |
| | | { |
| | | OnAllSelectToggle(isOn); |
| | | } |
| | | |
| | | ); |
| | | } |
| | | |
| | | private void OnEnable() |
| | | { |
| | | |
| | | curMail = 0; |
| | | CreateMailCell(); |
| | | MailAllModel.Instance.GetNewMailEvent += GetNewMail; |
| | | MailAllModel.Instance.CallBackReceiveEvent += OnGetReceiveResult; |
| | | MailAllModel.Instance.DeleteMailEvent += OnGetDeleteResult; |
| | | } |
| | | |
| | | private void OnDisable() |
| | | { |
| | | MailAllModel.Instance.GetNewMailEvent -= GetNewMail; |
| | | MailAllModel.Instance.CallBackReceiveEvent -= OnGetReceiveResult; |
| | | MailAllModel.Instance.DeleteMailEvent -= OnGetDeleteResult; |
| | | } |
| | | |
| | | private void CreateMailCell() |
| | | { |
| | | mailModellist = MailAllModel.Instance.GetTimeOrderMaillist(); |
| | | if (mailModellist == null) |
| | | return; |
| | | |
| | | _mailCellCtrl.Refresh(); |
| | | int mailCount = 0; |
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++) |
| | | { |
| | | _mailCellCtrl.AddCell(ScrollerDataType.Header, mailCount); |
| | | } |
| | | _mailCellCtrl.Restart(); |
| | | |
| | | if (mailModellist.Count < 1) |
| | | { |
| | | ResetUI(); |
| | | } |
| | | } |
| | | |
| | | private void GetNewMail() |
| | | { |
| | | mailModellist = MailAllModel.Instance.GetTimeOrderMaillist(); |
| | | curMail += MailAllModel.Instance.addMailCnt; |
| | | |
| | | _mailCellCtrl.Refresh(); |
| | | int mailCount = 0; |
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++) |
| | | { |
| | | _mailCellCtrl.AddCell(ScrollerDataType.Header, mailCount); |
| | | } |
| | | _mailCellCtrl.Restart(); |
| | | |
| | | |
| | | if (curMail >= mailModellist.Count) |
| | | { |
| | | ResetUI(); |
| | | } |
| | | } |
| | | |
| | | private void ResetUI() |
| | | { |
| | | _theTotalTitleText.text = ""; |
| | | _titleMessageText.text = ""; |
| | | _senderMessagerText.text = ""; |
| | | _goldBox.SetActive(false); |
| | | _drillBox.SetActive(false); |
| | | _fairyJadeBox.SetActive(false); |
| | | int giftCount = 0; |
| | | for (giftCount = 0; giftCount < _reciveItemParent.Count; giftCount++) |
| | | { |
| | | _reciveItemParent[giftCount].SetActive(false); |
| | | } |
| | | _deleteBtn.interactable = false; |
| | | _receiveBtn.interactable = false; |
| | | } |
| | | |
| | | |
| | | |
| | | private void RefreshMailCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | MailCell mailCell = cell.GetComponent<MailCell>(); |
| | | MailInfo info = mailModellist[cell.index]; |
| | | MailAllModel.Instance.GetReciveMailContent(info); |
| | | mailCell.cellToggel.group = _mailCellCtrl.GetComponent<ToggleGroup>(); |
| | | mailCell.chooseToggle.onValueChanged.RemoveAllListeners(); |
| | | mailCell.cellToggel.onValueChanged.RemoveAllListeners(); |
| | | |
| | | mailCell.cellToggel.isOn = false; |
| | | mailCell.noticeText.text = MailAllModel.Instance.mailTitleStr; |
| | | mailCell.dateText.text = info.CreateTime; |
| | | if (info.IsRead == 0) |
| | | { |
| | | mailCell.noReadIcon.gameObject.SetActive(true); |
| | | mailCell.readIcon.gameObject.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | mailCell.noReadIcon.gameObject.SetActive(false); |
| | | mailCell.readIcon.gameObject.SetActive(true); |
| | | } |
| | | |
| | | if (info.Count > 0 || info.Gold > 0 || info.GoldPaper > 0 |
| | | || info.Silver > 0) |
| | | mailCell.giftIcon.gameObject.SetActive(true); |
| | | else |
| | | mailCell.giftIcon.gameObject.SetActive(false); |
| | | |
| | | mailCell.chooseToggle.isOn = info.isChoose; |
| | | if (curMail == cell.index) |
| | | { |
| | | mailCell.cellToggel.isOn = true; |
| | | OnClickMailCell(true, info, cell); |
| | | } |
| | | |
| | | |
| | | mailCell.chooseToggle.onValueChanged.AddListener((bool isOn) => { OnClickChooseToggle(isOn, info); }); |
| | | mailCell.cellToggel.onValueChanged.AddListener((bool isOn) => { OnClickMailCell(isOn, info, cell); }); |
| | | } |
| | | |
| | | public void OnAllSelectToggle(bool isOn) |
| | | { |
| | | if (isOn) |
| | | { |
| | | int mailCount = 0; |
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++) |
| | | { |
| | | mailModellist[mailCount].isChoose = true; |
| | | if (mailModellist[mailCount].Count > 0 || mailModellist[mailCount].Gold > 0 |
| | | || mailModellist[mailCount].GoldPaper > 0 |
| | | || mailModellist[mailCount].Silver > 0) |
| | | { |
| | | ChangeRightBtnUI(mailModellist[mailCount]); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | int mailCount = 0; |
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++) |
| | | { |
| | | mailModellist[mailCount].isChoose = false; |
| | | } |
| | | } |
| | | CreateMailCell(); |
| | | } |
| | | |
| | | private Dictionary<string, MailInfo> chooseMailDict = new Dictionary<string, MailInfo>(); |
| | | private void OnClickChooseToggle(bool isOn, MailInfo info) |
| | | { |
| | | info.isChoose = isOn; |
| | | if (isOn) |
| | | { |
| | | if (!chooseMailDict.ContainsKey(info.GUID)) |
| | | { |
| | | chooseMailDict.Add(info.GUID, info); |
| | | } |
| | | else |
| | | { |
| | | chooseMailDict[info.GUID] = info; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (chooseMailDict.ContainsKey(info.GUID)) |
| | | { |
| | | chooseMailDict.Remove(info.GUID); |
| | | } |
| | | } |
| | | |
| | | foreach (var value in chooseMailDict.Values) |
| | | { |
| | | if (value.Count > 0 || value.Gold > 0 |
| | | || value.GoldPaper > 0 |
| | | || value.Silver > 0) |
| | | { |
| | | ChangeRightBtnUI(value); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | ChangeRightBtnUI(_currentMailInfo); |
| | | } |
| | | |
| | | private void OnClickMailCell(bool isOn, MailInfo info, CellView cell) |
| | | { |
| | | if (isOn) |
| | | { |
| | | _deleteBtn.interactable = true; |
| | | _deleteBtn.RemoveAllListeners(); |
| | | _deleteBtn.onClick.AddListener(OnClickDeleteBtn); |
| | | |
| | | curMail = cell.index; |
| | | _currentMailInfo = info; |
| | | MailAllModel.Instance.GetReciveMailContent(info); |
| | | _senderMessagerText.text = MailAllModel.Instance.mailSendPersonStr; |
| | | _titleMessageText.text = MailAllModel.Instance.mailTitleStr; |
| | | _theTotalTitleText.text = MailAllModel.Instance.mailContentstr; |
| | | Image noReadIcon = cell.transform.Find("NoReadIcon").GetComponent<Image>(); |
| | | Image readIcon = cell.transform.Find("ReadIcon").GetComponent<Image>(); |
| | | |
| | | #region 刷新右边Ui信息 |
| | | int giftCount = 0; |
| | | for (giftCount = 0; giftCount < _reciveItemParent.Count; giftCount++) |
| | | { |
| | | ItemCell itemCell = _reciveItemParent[giftCount].transform.Find("ItemCell").GetComponent<ItemCell>(); |
| | | if (info.Count > 0 || info.Gold > 0 || info.GoldPaper > 0 || info.Silver > 0) |
| | | { |
| | | _reciveItemParent[giftCount].SetActive(true); |
| | | _goldBox.SetActive(true); |
| | | _drillBox.SetActive(true); |
| | | _fairyJadeBox.SetActive(true); |
| | | if (giftCount < info.Count) |
| | | { |
| | | itemCell.gameObject.SetActive(true); |
| | | MailItemModel itemModel = info.Items[giftCount]; |
| | | ItemCellModel cellModel = new ItemCellModel((int)itemModel.ItemID, false, (ulong)itemModel.Count, |
| | | itemModel.IsBind,"",PackType.rptDeleted, false, ConfigParse.Analysis(itemModel.UserData)); |
| | | itemCell.Init(cellModel); |
| | | itemCell.cellBtn.onClick.RemoveAllListeners(); |
| | | itemCell.cellBtn.onClick.AddListener(() => |
| | | { |
| | | ItemAttrData attrData = new ItemAttrData((int)itemModel.ItemID, false, (ulong)itemModel.Count, -1, itemModel.IsBind, true, PackType.rptDeleted, "", ConfigParse.Analysis(itemModel.UserData)); |
| | | itemTipsModel.SetItemTipsModel(attrData); |
| | | } |
| | | ); |
| | | } |
| | | else |
| | | { |
| | | itemCell.gameObject.SetActive(false); |
| | | } |
| | | _goldText.text = modelInterface.OnChangeCoinsUnit(info.Silver).ToString(); |
| | | _drillBoxeText.text = modelInterface.OnChangeCoinsUnit(info.GoldPaper).ToString(); |
| | | _fairyJadeBoxText.text = modelInterface.OnChangeCoinsUnit(info.Gold).ToString(); |
| | | |
| | | } |
| | | else |
| | | { |
| | | _reciveItemParent[giftCount].SetActive(false); |
| | | _goldBox.SetActive(false); |
| | | _drillBox.SetActive(false); |
| | | _fairyJadeBox.SetActive(false); |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | if (info.IsRead == 0) |
| | | { |
| | | noReadIcon.gameObject.SetActive(false); |
| | | readIcon.gameObject.SetActive(true); |
| | | info.IsRead = 1; |
| | | MailAllModel.Instance.SendReadMailQuest(info.GUID); |
| | | } |
| | | |
| | | int mailCount = 0; |
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++) |
| | | { |
| | | if (mailModellist[mailCount].isChoose) |
| | | { |
| | | if (mailModellist[mailCount].Count > 0 || mailModellist[mailCount].Gold > 0 |
| | | || mailModellist[mailCount].GoldPaper > 0 |
| | | || mailModellist[mailCount].Silver > 0) |
| | | { |
| | | ChangeRightBtnUI(mailModellist[mailCount]); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | ChangeRightBtnUI(info); |
| | | } |
| | | } |
| | | |
| | | public void ChangeRightBtnUI(MailInfo info) |
| | | { |
| | | if (info.Count > 0 || info.Gold > 0 || info.GoldPaper > 0 |
| | | || info.Silver > 0) |
| | | { |
| | | _receiveBtn.interactable = true; |
| | | _receiveBtn.onClick.RemoveAllListeners(); |
| | | _receiveBtn.onClick.AddListener( |
| | | delegate |
| | | { |
| | | OnClickReceiveBtn(); |
| | | } |
| | | ); |
| | | } |
| | | |
| | | else |
| | | { |
| | | _receiveBtn.onClick.RemoveAllListeners(); |
| | | _receiveBtn.interactable = false; |
| | | } |
| | | |
| | | } |
| | | |
| | | public void OnClickReceiveBtn() |
| | | { |
| | | #region 得到领取的邮件 |
| | | _isChooseMailDict.Clear(); |
| | | int mailCount = 0; |
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++) |
| | | { |
| | | if (mailModellist[mailCount].isChoose) |
| | | { |
| | | if (!_isChooseMailDict.ContainsKey(mailModellist[mailCount].GUID)) |
| | | { |
| | | _isChooseMailDict.Add(mailModellist[mailCount].GUID, mailModellist[mailCount]); |
| | | } |
| | | } |
| | | } |
| | | if (_currentMailInfo != null) |
| | | { |
| | | if (!_isChooseMailDict.ContainsKey(_currentMailInfo.GUID)) |
| | | { |
| | | _isChooseMailDict.Add(_currentMailInfo.GUID, _currentMailInfo); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | _chooseMailList = _isChooseMailDict.Values.ToList(); |
| | | DesignDebug.Log("OnClickReceiveBtn" + _chooseMailList.Count); |
| | | if (_chooseMailList.Count > 0) |
| | | { |
| | | ReceiveAllChooseMail(0, _chooseMailList[0]); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void OnClickDeleteBtn() |
| | | { |
| | | #region 得到删除的邮件 |
| | | |
| | | _isChooseMailDict.Clear(); |
| | | int mailCount = 0; |
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++) |
| | | { |
| | | if (mailModellist[mailCount].isChoose) |
| | | { |
| | | if (!_isChooseMailDict.ContainsKey(mailModellist[mailCount].GUID)) |
| | | { |
| | | _isChooseMailDict.Add(mailModellist[mailCount].GUID, mailModellist[mailCount]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (_currentMailInfo != null) |
| | | { |
| | | if (!_isChooseMailDict.ContainsKey(_currentMailInfo.GUID)) |
| | | { |
| | | _isChooseMailDict.Add(_currentMailInfo.GUID, _currentMailInfo); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | _chooseMailList = _isChooseMailDict.Values.ToList(); |
| | | |
| | | if (_chooseMailList.Count > 0) |
| | | { |
| | | _isDeletePromp = true; |
| | | DeleteAllChooseMail(0, _chooseMailList[0]); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | //使用递归发送请求 |
| | | public void DeleteAllChooseMail(int index, MailInfo deleteCell) |
| | | { |
| | | |
| | | DesignDebug.Log(index + "比较" + _chooseMailList.Count); |
| | | _mailState = MailState.Delete; |
| | | if (index >= _chooseMailList.Count) |
| | | { |
| | | _allSelectToggle.isOn = false; |
| | | OnAllSelectToggle(false); |
| | | return; |
| | | } |
| | | |
| | | if (_isDeletePromp) |
| | | { |
| | | if (deleteCell.Count > 0 || (int)deleteCell.Gold > 0 || (int)deleteCell.GoldPaper > 0 |
| | | || (int)deleteCell.Silver > 0) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("Mail102"), (bool isOk) => |
| | | { |
| | | if (isOk) |
| | | { |
| | | SendAskDelete(deleteCell.GUID); |
| | | _isDeletePromp = false; |
| | | index += 1; |
| | | if (index < _chooseMailList.Count) |
| | | { |
| | | DeleteAllChooseMail(index, _chooseMailList[index]); |
| | | } |
| | | else |
| | | { |
| | | DeleteAllChooseMail(index, null); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _allSelectToggle.isOn = false; |
| | | OnAllSelectToggle(false); |
| | | } |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | SendAskDelete(deleteCell.GUID); |
| | | index += 1; |
| | | if (index < _chooseMailList.Count) |
| | | { |
| | | DesignDebug.Log("递归" + index); |
| | | DeleteAllChooseMail(index, _chooseMailList[index]); |
| | | } |
| | | else |
| | | { |
| | | DeleteAllChooseMail(index, null); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | SendAskDelete(deleteCell.GUID); |
| | | index += 1; |
| | | if (index < _chooseMailList.Count) |
| | | { |
| | | DesignDebug.Log("递归" + index); |
| | | DeleteAllChooseMail(index, _chooseMailList[index]); |
| | | } |
| | | else |
| | | { |
| | | DeleteAllChooseMail(index, null); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private int _nextReceiveIndex = 0; |
| | | private int preReceiveIndex = 0; |
| | | public void ReceiveAllChooseMail(int index, MailInfo receiveCell) |
| | | { |
| | | _mailState = MailState.Receive; |
| | | preReceiveIndex = index; |
| | | if (receiveCell.Count > 0 || receiveCell.Gold > 0 |
| | | || receiveCell.GoldPaper > 0 || receiveCell.Silver > 0) |
| | | { |
| | | DesignDebug.Log("领取邮件:" + index); |
| | | SendAskReceive(receiveCell.GUID); |
| | | } |
| | | |
| | | index += 1; |
| | | if (index >= _chooseMailList.Count) |
| | | { |
| | | _allSelectToggle.isOn = false; |
| | | OnAllSelectToggle(false); |
| | | return; |
| | | } |
| | | _nextReceiveIndex = index; |
| | | if (receiveCell.Count <= 0 && receiveCell.Gold <= 0 |
| | | && receiveCell.GoldPaper <= 0 && receiveCell.Silver <= 0) |
| | | { |
| | | ReceiveAllChooseMail(_nextReceiveIndex, _chooseMailList[_nextReceiveIndex]); |
| | | } |
| | | |
| | | } |
| | | |
| | | //由于服务端删除邮件可能有冷却时间所以造成返回的次数不准确 |
| | | public void OnGetReceiveResult(string guId, int result) |
| | | { |
| | | DesignDebug.Log("OnGetReceiveResult" + result); |
| | | if (result == 1) |
| | | { |
| | | if (_mailState == MailState.Receive) |
| | | { |
| | | if (preReceiveIndex != _nextReceiveIndex) |
| | | { |
| | | if(_chooseMailList != null && _chooseMailList.Count > _nextReceiveIndex) |
| | | { |
| | | ReceiveAllChooseMail(_nextReceiveIndex, _chooseMailList[_nextReceiveIndex]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Mail103")); |
| | | } |
| | | } |
| | | |
| | | public void OnGetDeleteResult() |
| | | { |
| | | curMail = 0; |
| | | CreateMailCell(); |
| | | } |
| | | |
| | | public void SendAskReceive(string id) |
| | | { |
| | | MailInfo mailInfo = MailAllModel.Instance.GetMailInfo(id); |
| | | int i = 0; |
| | | int getBagItemCount = 0; |
| | | int getRuneCount = 0; |
| | | ItemConfig tagChinItem = null; |
| | | for (i = 0; i < mailInfo.Count; i++) |
| | | { |
| | | tagChinItem = ConfigManager.Instance.GetTemplate<ItemConfig>((int)mailInfo.Items[i].ItemID); |
| | | if (tagChinItem != null) |
| | | { |
| | | if (tagChinItem.Type == RuneModel.RUNE_TYPE || tagChinItem.Type == RuneModel.RUNE_CREAMTYPE) |
| | | { |
| | | getRuneCount += 1; |
| | | } |
| | | else |
| | | { |
| | | getBagItemCount += 1; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (getBagItemCount > playerPack.GetReaminGridCount(PackType.rptItem)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("BagFull"); |
| | | return; |
| | | } |
| | | else if (getRuneCount > runeModel.SurplusRunePackCnt) |
| | | { |
| | | |
| | | SysNotifyMgr.Instance.ShowTip("RuneBagFull"); |
| | | return; |
| | | } |
| | | |
| | | CA53B_tagCMRequestCompensation askRecive = new CA53B_tagCMRequestCompensation(); |
| | | askRecive.GUID = id; |
| | | GameNetSystem.Instance.SendInfo(askRecive); |
| | | } |
| | | |
| | | public void SendAskDelete(string id) |
| | | { |
| | | CA9A7_tagCGDelCompensation askDelete = new CA9A7_tagCGDelCompensation(); |
| | | askDelete.GUID = id; |
| | | GameNetSystem.Instance.SendInfo(askDelete); |
| | | } |
| | | |
| | | } |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | using System.Linq;
|
| | | using Snxxz.UI;
|
| | | using System.Text.RegularExpressions;
|
| | | using TableConfig;
|
| | |
|
| | | public enum MailState
|
| | | {
|
| | | Read,
|
| | | NoRead,
|
| | | Delete,
|
| | | Receive,
|
| | | }
|
| | |
|
| | | public class MailPanel : MonoBehaviour
|
| | | {
|
| | |
|
| | | #region 成员变量
|
| | | [SerializeField]
|
| | | private Text _senderMessagerText;
|
| | | [SerializeField]
|
| | | private Text _titleMessageText;
|
| | | [SerializeField]
|
| | | private Text _theTotalTitleText;
|
| | | [SerializeField]
|
| | | private GameObject _buddyBlueAG;
|
| | | [SerializeField]
|
| | | private GameObject _buddyBlueBG;
|
| | | [SerializeField]
|
| | | private GameObject _buddyBlueCG;
|
| | | [SerializeField]
|
| | | private GameObject _buddyBlueDG;
|
| | | [SerializeField]
|
| | | private GameObject _buddyBlueEG;
|
| | | [SerializeField]
|
| | | private GameObject _goldBox;
|
| | | [SerializeField]
|
| | | private Text _goldText;
|
| | | [SerializeField]
|
| | | private GameObject _drillBox;
|
| | | [SerializeField]
|
| | | private Text _drillBoxeText;
|
| | | [SerializeField]
|
| | | private GameObject _fairyJadeBox;
|
| | | [SerializeField]
|
| | | private Text _fairyJadeBoxText;
|
| | | [SerializeField]
|
| | | private Toggle _allSelectToggle;
|
| | | [SerializeField]
|
| | | private Button _receiveBtn;
|
| | | [SerializeField]
|
| | | private Button _deleteBtn;
|
| | | [SerializeField]
|
| | | private ScrollerController _mailCellCtrl;
|
| | |
|
| | | #endregion
|
| | |
|
| | | private MailState _mailState = MailState.NoRead;
|
| | | private bool _isDeletePromp = true;
|
| | | private List<MailInfo> _chooseMailList;
|
| | | public Dictionary<string, MailInfo> _isChooseMailDict = new Dictionary<string, MailInfo>();
|
| | | private List<GameObject> _reciveItemParent = new List<GameObject>();
|
| | | private List<MailInfo> mailModellist;
|
| | | private MailInfo _currentMailInfo;
|
| | | private int curMail = 0;
|
| | |
|
| | | RuneModel _runeModel;
|
| | | RuneModel runeModel
|
| | | {
|
| | | get { return _runeModel ?? (_runeModel = ModelCenter.Instance.GetModel<RuneModel>()); }
|
| | | }
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel
|
| | | {
|
| | | get
|
| | | {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | |
|
| | | PlayerPackModel _playerPack;
|
| | | PlayerPackModel playerPack
|
| | | {
|
| | | get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
| | | }
|
| | |
|
| | | PackModelInterface _modelInterface;
|
| | | PackModelInterface modelInterface
|
| | | {
|
| | | get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); }
|
| | | }
|
| | |
|
| | | private void Awake()
|
| | | {
|
| | | Init();
|
| | | }
|
| | |
|
| | | public void Init()
|
| | | {
|
| | | _senderMessagerText.text = "";
|
| | | _titleMessageText.text = "";
|
| | | _theTotalTitleText.text = "";
|
| | | _reciveItemParent.Add(_buddyBlueAG);
|
| | | _reciveItemParent.Add(_buddyBlueBG);
|
| | | _reciveItemParent.Add(_buddyBlueCG);
|
| | | _reciveItemParent.Add(_buddyBlueDG);
|
| | | _reciveItemParent.Add(_buddyBlueEG);
|
| | | _mailCellCtrl.OnRefreshCell += RefreshMailCell;
|
| | | _allSelectToggle.isOn = false;
|
| | | _allSelectToggle.onValueChanged.AddListener(
|
| | |
|
| | | delegate (bool isOn)
|
| | | {
|
| | | OnAllSelectToggle(isOn);
|
| | | }
|
| | |
|
| | | );
|
| | | }
|
| | |
|
| | | private void OnEnable()
|
| | | {
|
| | |
|
| | | curMail = 0;
|
| | | CreateMailCell();
|
| | | MailAllModel.Instance.GetNewMailEvent += GetNewMail;
|
| | | MailAllModel.Instance.CallBackReceiveEvent += OnGetReceiveResult;
|
| | | MailAllModel.Instance.DeleteMailEvent += OnGetDeleteResult;
|
| | | }
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | MailAllModel.Instance.GetNewMailEvent -= GetNewMail;
|
| | | MailAllModel.Instance.CallBackReceiveEvent -= OnGetReceiveResult;
|
| | | MailAllModel.Instance.DeleteMailEvent -= OnGetDeleteResult;
|
| | | }
|
| | |
|
| | | private void CreateMailCell()
|
| | | {
|
| | | mailModellist = MailAllModel.Instance.GetTimeOrderMaillist();
|
| | | if (mailModellist == null)
|
| | | return;
|
| | |
|
| | | _mailCellCtrl.Refresh();
|
| | | int mailCount = 0;
|
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++)
|
| | | {
|
| | | _mailCellCtrl.AddCell(ScrollerDataType.Header, mailCount);
|
| | | }
|
| | | _mailCellCtrl.Restart();
|
| | |
|
| | | if (mailModellist.Count < 1)
|
| | | {
|
| | | ResetUI();
|
| | | }
|
| | | }
|
| | |
|
| | | private void GetNewMail()
|
| | | {
|
| | | mailModellist = MailAllModel.Instance.GetTimeOrderMaillist();
|
| | | curMail += MailAllModel.Instance.addMailCnt;
|
| | |
|
| | | _mailCellCtrl.Refresh();
|
| | | int mailCount = 0;
|
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++)
|
| | | {
|
| | | _mailCellCtrl.AddCell(ScrollerDataType.Header, mailCount);
|
| | | }
|
| | | _mailCellCtrl.Restart();
|
| | |
|
| | |
|
| | | if (curMail >= mailModellist.Count)
|
| | | {
|
| | | ResetUI();
|
| | | }
|
| | | }
|
| | |
|
| | | private void ResetUI()
|
| | | {
|
| | | _theTotalTitleText.text = "";
|
| | | _titleMessageText.text = "";
|
| | | _senderMessagerText.text = "";
|
| | | _goldBox.SetActive(false);
|
| | | _drillBox.SetActive(false);
|
| | | _fairyJadeBox.SetActive(false);
|
| | | int giftCount = 0;
|
| | | for (giftCount = 0; giftCount < _reciveItemParent.Count; giftCount++)
|
| | | {
|
| | | _reciveItemParent[giftCount].SetActive(false);
|
| | | }
|
| | | _deleteBtn.interactable = false;
|
| | | _receiveBtn.interactable = false;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | private void RefreshMailCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | MailCell mailCell = cell.GetComponent<MailCell>();
|
| | | MailInfo info = mailModellist[cell.index];
|
| | | MailAllModel.Instance.GetReciveMailContent(info);
|
| | | mailCell.cellToggel.group = _mailCellCtrl.GetComponent<ToggleGroup>();
|
| | | mailCell.chooseToggle.onValueChanged.RemoveAllListeners();
|
| | | mailCell.cellToggel.onValueChanged.RemoveAllListeners();
|
| | |
|
| | | mailCell.cellToggel.isOn = false;
|
| | | mailCell.noticeText.text = MailAllModel.Instance.mailTitleStr;
|
| | | mailCell.dateText.text = info.CreateTime;
|
| | | if (info.IsRead == 0)
|
| | | {
|
| | | mailCell.noReadIcon.gameObject.SetActive(true);
|
| | | mailCell.readIcon.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | mailCell.noReadIcon.gameObject.SetActive(false);
|
| | | mailCell.readIcon.gameObject.SetActive(true);
|
| | | }
|
| | |
|
| | | if (info.Count > 0 || info.Gold > 0 || info.GoldPaper > 0
|
| | | || info.Silver > 0)
|
| | | mailCell.giftIcon.gameObject.SetActive(true);
|
| | | else
|
| | | mailCell.giftIcon.gameObject.SetActive(false);
|
| | |
|
| | | mailCell.chooseToggle.isOn = info.isChoose;
|
| | | if (curMail == cell.index)
|
| | | {
|
| | | mailCell.cellToggel.isOn = true;
|
| | | OnClickMailCell(true, info, cell);
|
| | | }
|
| | |
|
| | |
|
| | | mailCell.chooseToggle.onValueChanged.AddListener((bool isOn) => { OnClickChooseToggle(isOn, info); });
|
| | | mailCell.cellToggel.onValueChanged.AddListener((bool isOn) => { OnClickMailCell(isOn, info, cell); });
|
| | | }
|
| | |
|
| | | public void OnAllSelectToggle(bool isOn)
|
| | | {
|
| | | if (isOn)
|
| | | {
|
| | | int mailCount = 0;
|
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++)
|
| | | {
|
| | | mailModellist[mailCount].isChoose = true;
|
| | | if (mailModellist[mailCount].Count > 0 || mailModellist[mailCount].Gold > 0
|
| | | || mailModellist[mailCount].GoldPaper > 0
|
| | | || mailModellist[mailCount].Silver > 0)
|
| | | {
|
| | | ChangeRightBtnUI(mailModellist[mailCount]);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | int mailCount = 0;
|
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++)
|
| | | {
|
| | | mailModellist[mailCount].isChoose = false;
|
| | | }
|
| | | }
|
| | | CreateMailCell();
|
| | | }
|
| | |
|
| | | private Dictionary<string, MailInfo> chooseMailDict = new Dictionary<string, MailInfo>();
|
| | | private void OnClickChooseToggle(bool isOn, MailInfo info)
|
| | | {
|
| | | info.isChoose = isOn;
|
| | | if (isOn)
|
| | | {
|
| | | if (!chooseMailDict.ContainsKey(info.GUID))
|
| | | {
|
| | | chooseMailDict.Add(info.GUID, info);
|
| | | }
|
| | | else
|
| | | {
|
| | | chooseMailDict[info.GUID] = info;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (chooseMailDict.ContainsKey(info.GUID))
|
| | | {
|
| | | chooseMailDict.Remove(info.GUID);
|
| | | }
|
| | | }
|
| | |
|
| | | foreach (var value in chooseMailDict.Values)
|
| | | {
|
| | | if (value.Count > 0 || value.Gold > 0
|
| | | || value.GoldPaper > 0
|
| | | || value.Silver > 0)
|
| | | {
|
| | | ChangeRightBtnUI(value);
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | ChangeRightBtnUI(_currentMailInfo);
|
| | | }
|
| | |
|
| | | private void OnClickMailCell(bool isOn, MailInfo info, CellView cell)
|
| | | {
|
| | | if (isOn)
|
| | | {
|
| | | _deleteBtn.interactable = true;
|
| | | _deleteBtn.RemoveAllListeners();
|
| | | _deleteBtn.onClick.AddListener(OnClickDeleteBtn);
|
| | |
|
| | | curMail = cell.index;
|
| | | _currentMailInfo = info;
|
| | | MailAllModel.Instance.GetReciveMailContent(info);
|
| | | _senderMessagerText.text = MailAllModel.Instance.mailSendPersonStr;
|
| | | _titleMessageText.text = MailAllModel.Instance.mailTitleStr;
|
| | | _theTotalTitleText.text = MailAllModel.Instance.mailContentstr;
|
| | | Image noReadIcon = cell.transform.Find("NoReadIcon").GetComponent<Image>();
|
| | | Image readIcon = cell.transform.Find("ReadIcon").GetComponent<Image>();
|
| | |
|
| | | #region 刷新右边Ui信息
|
| | | int giftCount = 0;
|
| | | for (giftCount = 0; giftCount < _reciveItemParent.Count; giftCount++)
|
| | | {
|
| | | ItemCell itemCell = _reciveItemParent[giftCount].transform.Find("ItemCell").GetComponent<ItemCell>();
|
| | | if (info.Count > 0 || info.Gold > 0 || info.GoldPaper > 0 || info.Silver > 0)
|
| | | {
|
| | | _reciveItemParent[giftCount].SetActive(true);
|
| | | _goldBox.SetActive(true);
|
| | | _drillBox.SetActive(true);
|
| | | _fairyJadeBox.SetActive(true);
|
| | | if (giftCount < info.Count)
|
| | | {
|
| | | itemCell.gameObject.SetActive(true);
|
| | | MailItemModel itemModel = info.Items[giftCount];
|
| | | ItemCellModel cellModel = new ItemCellModel((int)itemModel.ItemID, false, (ulong)itemModel.Count,
|
| | | itemModel.IsBind,"",PackType.rptDeleted, false, ConfigParse.Analysis(itemModel.UserData));
|
| | | itemCell.Init(cellModel);
|
| | | itemCell.cellBtn.onClick.RemoveAllListeners();
|
| | | itemCell.cellBtn.onClick.AddListener(() =>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData((int)itemModel.ItemID, false, (ulong)itemModel.Count, -1, itemModel.IsBind, true, PackType.rptDeleted, "", ConfigParse.Analysis(itemModel.UserData));
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | }
|
| | | );
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCell.gameObject.SetActive(false);
|
| | | }
|
| | | _goldText.text = modelInterface.OnChangeCoinsUnit(info.Silver).ToString();
|
| | | _drillBoxeText.text = modelInterface.OnChangeCoinsUnit(info.GoldPaper).ToString();
|
| | | _fairyJadeBoxText.text = modelInterface.OnChangeCoinsUnit(info.Gold).ToString();
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | _reciveItemParent[giftCount].SetActive(false);
|
| | | _goldBox.SetActive(false);
|
| | | _drillBox.SetActive(false);
|
| | | _fairyJadeBox.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | | #endregion
|
| | |
|
| | | if (info.IsRead == 0)
|
| | | {
|
| | | noReadIcon.gameObject.SetActive(false);
|
| | | readIcon.gameObject.SetActive(true);
|
| | | info.IsRead = 1;
|
| | | MailAllModel.Instance.SendReadMailQuest(info.GUID);
|
| | | }
|
| | |
|
| | | int mailCount = 0;
|
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++)
|
| | | {
|
| | | if (mailModellist[mailCount].isChoose)
|
| | | {
|
| | | if (mailModellist[mailCount].Count > 0 || mailModellist[mailCount].Gold > 0
|
| | | || mailModellist[mailCount].GoldPaper > 0
|
| | | || mailModellist[mailCount].Silver > 0)
|
| | | {
|
| | | ChangeRightBtnUI(mailModellist[mailCount]);
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | | ChangeRightBtnUI(info);
|
| | | }
|
| | | }
|
| | |
|
| | | public void ChangeRightBtnUI(MailInfo info)
|
| | | {
|
| | | if (info.Count > 0 || info.Gold > 0 || info.GoldPaper > 0
|
| | | || info.Silver > 0)
|
| | | {
|
| | | _receiveBtn.interactable = true;
|
| | | _receiveBtn.onClick.RemoveAllListeners();
|
| | | _receiveBtn.onClick.AddListener(
|
| | | delegate
|
| | | {
|
| | | OnClickReceiveBtn();
|
| | | }
|
| | | );
|
| | | }
|
| | |
|
| | | else
|
| | | {
|
| | | _receiveBtn.onClick.RemoveAllListeners();
|
| | | _receiveBtn.interactable = false;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public void OnClickReceiveBtn()
|
| | | {
|
| | | #region 得到领取的邮件
|
| | | _isChooseMailDict.Clear();
|
| | | int mailCount = 0;
|
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++)
|
| | | {
|
| | | if (mailModellist[mailCount].isChoose)
|
| | | {
|
| | | if (!_isChooseMailDict.ContainsKey(mailModellist[mailCount].GUID))
|
| | | {
|
| | | _isChooseMailDict.Add(mailModellist[mailCount].GUID, mailModellist[mailCount]);
|
| | | }
|
| | | }
|
| | | }
|
| | | if (_currentMailInfo != null)
|
| | | {
|
| | | if (!_isChooseMailDict.ContainsKey(_currentMailInfo.GUID))
|
| | | {
|
| | | _isChooseMailDict.Add(_currentMailInfo.GUID, _currentMailInfo);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | _chooseMailList = _isChooseMailDict.Values.ToList();
|
| | | DebugEx.Log("OnClickReceiveBtn" + _chooseMailList.Count);
|
| | | if (_chooseMailList.Count > 0)
|
| | | {
|
| | | ReceiveAllChooseMail(0, _chooseMailList[0]);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public void OnClickDeleteBtn()
|
| | | {
|
| | | #region 得到删除的邮件
|
| | |
|
| | | _isChooseMailDict.Clear();
|
| | | int mailCount = 0;
|
| | | for (mailCount = 0; mailCount < mailModellist.Count; mailCount++)
|
| | | {
|
| | | if (mailModellist[mailCount].isChoose)
|
| | | {
|
| | | if (!_isChooseMailDict.ContainsKey(mailModellist[mailCount].GUID))
|
| | | {
|
| | | _isChooseMailDict.Add(mailModellist[mailCount].GUID, mailModellist[mailCount]);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (_currentMailInfo != null)
|
| | | {
|
| | | if (!_isChooseMailDict.ContainsKey(_currentMailInfo.GUID))
|
| | | {
|
| | | _isChooseMailDict.Add(_currentMailInfo.GUID, _currentMailInfo);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | _chooseMailList = _isChooseMailDict.Values.ToList();
|
| | |
|
| | | if (_chooseMailList.Count > 0)
|
| | | {
|
| | | _isDeletePromp = true;
|
| | | DeleteAllChooseMail(0, _chooseMailList[0]);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | //使用递归发送请求
|
| | | public void DeleteAllChooseMail(int index, MailInfo deleteCell)
|
| | | {
|
| | |
|
| | | DebugEx.Log(index + "比较" + _chooseMailList.Count);
|
| | | _mailState = MailState.Delete;
|
| | | if (index >= _chooseMailList.Count)
|
| | | {
|
| | | _allSelectToggle.isOn = false;
|
| | | OnAllSelectToggle(false);
|
| | | return;
|
| | | }
|
| | |
|
| | | if (_isDeletePromp)
|
| | | {
|
| | | if (deleteCell.Count > 0 || (int)deleteCell.Gold > 0 || (int)deleteCell.GoldPaper > 0
|
| | | || (int)deleteCell.Silver > 0)
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("Mail102"), (bool isOk) =>
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | SendAskDelete(deleteCell.GUID);
|
| | | _isDeletePromp = false;
|
| | | index += 1;
|
| | | if (index < _chooseMailList.Count)
|
| | | {
|
| | | DeleteAllChooseMail(index, _chooseMailList[index]);
|
| | | }
|
| | | else
|
| | | {
|
| | | DeleteAllChooseMail(index, null);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | _allSelectToggle.isOn = false;
|
| | | OnAllSelectToggle(false);
|
| | | }
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | SendAskDelete(deleteCell.GUID);
|
| | | index += 1;
|
| | | if (index < _chooseMailList.Count)
|
| | | {
|
| | | DebugEx.Log("递归" + index);
|
| | | DeleteAllChooseMail(index, _chooseMailList[index]);
|
| | | }
|
| | | else
|
| | | {
|
| | | DeleteAllChooseMail(index, null);
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | SendAskDelete(deleteCell.GUID);
|
| | | index += 1;
|
| | | if (index < _chooseMailList.Count)
|
| | | {
|
| | | DebugEx.Log("递归" + index);
|
| | | DeleteAllChooseMail(index, _chooseMailList[index]);
|
| | | }
|
| | | else
|
| | | {
|
| | | DeleteAllChooseMail(index, null);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private int _nextReceiveIndex = 0;
|
| | | private int preReceiveIndex = 0;
|
| | | public void ReceiveAllChooseMail(int index, MailInfo receiveCell)
|
| | | {
|
| | | _mailState = MailState.Receive;
|
| | | preReceiveIndex = index;
|
| | | if (receiveCell.Count > 0 || receiveCell.Gold > 0
|
| | | || receiveCell.GoldPaper > 0 || receiveCell.Silver > 0)
|
| | | {
|
| | | DebugEx.Log("领取邮件:" + index);
|
| | | SendAskReceive(receiveCell.GUID);
|
| | | }
|
| | |
|
| | | index += 1;
|
| | | if (index >= _chooseMailList.Count)
|
| | | {
|
| | | _allSelectToggle.isOn = false;
|
| | | OnAllSelectToggle(false);
|
| | | return;
|
| | | }
|
| | | _nextReceiveIndex = index;
|
| | | if (receiveCell.Count <= 0 && receiveCell.Gold <= 0
|
| | | && receiveCell.GoldPaper <= 0 && receiveCell.Silver <= 0)
|
| | | {
|
| | | ReceiveAllChooseMail(_nextReceiveIndex, _chooseMailList[_nextReceiveIndex]);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | //由于服务端删除邮件可能有冷却时间所以造成返回的次数不准确
|
| | | public void OnGetReceiveResult(string guId, int result)
|
| | | {
|
| | | DebugEx.Log("OnGetReceiveResult" + result);
|
| | | if (result == 1)
|
| | | {
|
| | | if (_mailState == MailState.Receive)
|
| | | {
|
| | | if (preReceiveIndex != _nextReceiveIndex)
|
| | | {
|
| | | if(_chooseMailList != null && _chooseMailList.Count > _nextReceiveIndex)
|
| | | {
|
| | | ReceiveAllChooseMail(_nextReceiveIndex, _chooseMailList[_nextReceiveIndex]);
|
| | | } |
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | MessageWin.Inst.ShowFixedTip(Language.Get("Mail103"));
|
| | | }
|
| | | }
|
| | |
|
| | | public void OnGetDeleteResult()
|
| | | {
|
| | | curMail = 0;
|
| | | CreateMailCell();
|
| | | }
|
| | |
|
| | | public void SendAskReceive(string id)
|
| | | {
|
| | | MailInfo mailInfo = MailAllModel.Instance.GetMailInfo(id);
|
| | | int i = 0;
|
| | | int getBagItemCount = 0;
|
| | | int getRuneCount = 0;
|
| | | ItemConfig tagChinItem = null;
|
| | | for (i = 0; i < mailInfo.Count; i++)
|
| | | {
|
| | | tagChinItem = ConfigManager.Instance.GetTemplate<ItemConfig>((int)mailInfo.Items[i].ItemID);
|
| | | if (tagChinItem != null)
|
| | | {
|
| | | if (tagChinItem.Type == RuneModel.RUNE_TYPE || tagChinItem.Type == RuneModel.RUNE_CREAMTYPE)
|
| | | {
|
| | | getRuneCount += 1;
|
| | | }
|
| | | else
|
| | | {
|
| | | getBagItemCount += 1;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (getBagItemCount > playerPack.GetReaminGridCount(PackType.rptItem))
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("BagFull");
|
| | | return;
|
| | | }
|
| | | else if (getRuneCount > runeModel.SurplusRunePackCnt)
|
| | | {
|
| | |
|
| | | SysNotifyMgr.Instance.ShowTip("RuneBagFull");
|
| | | return;
|
| | | }
|
| | |
|
| | | CA53B_tagCMRequestCompensation askRecive = new CA53B_tagCMRequestCompensation();
|
| | | askRecive.GUID = id;
|
| | | GameNetSystem.Instance.SendInfo(askRecive);
|
| | | }
|
| | |
|
| | | public void SendAskDelete(string id)
|
| | | {
|
| | | CA9A7_tagCGDelCompensation askDelete = new CA9A7_tagCGDelCompensation();
|
| | | askDelete.GUID = id;
|
| | | GameNetSystem.Instance.SendInfo(askDelete);
|
| | | }
|
| | |
|
| | | }
|