| | |
| | | using Snxxz.UI; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using TableConfig; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | namespace Snxxz.UI |
| | | { |
| | | public class MountStoneTipsWin : Window |
| | | { |
| | | ItemTipsModel _itemTipsModel; |
| | | ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } } |
| | | |
| | | PlayerPackModel _playerPack; |
| | | PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } |
| | | RoleParticularModel m_RoleParticularModel; |
| | | RoleParticularModel roleParticularModel { get { return m_RoleParticularModel ?? (m_RoleParticularModel = ModelCenter.Instance.GetModel<RoleParticularModel>()); } } |
| | | //坐骑魂石面板 |
| | | [SerializeField] |
| | | ScrollerController m_ScrollerController; |
| | | [SerializeField] Button CloseBtn; |
| | | [SerializeField] GameObject m_Text_Power; |
| | | [SerializeField] Text m_PowerNum; |
| | | private Dictionary<int, int> tag_Item = new Dictionary<int, int>();//坐骑魂石存 |
| | | Dictionary<string, ItemConfig> tagCIM = new Dictionary<string, TableConfig.ItemConfig>(); |
| | | private List<int> ListID = new List<int>(); |
| | | PlayerMountDatas m_HorseModel; |
| | | PlayerMountDatas horsemodel |
| | | { |
| | | get |
| | | { |
| | | return m_HorseModel ?? (m_HorseModel = ModelCenter.Instance.GetModel<PlayerMountDatas>()); |
| | | } |
| | | } |
| | | protected override void BindController() |
| | | { |
| | | tag_Item = horsemodel._DicMountItem; |
| | | } |
| | | |
| | | |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | CloseBtn.onClick.AddListener(CloseButton); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | GetPetPower(); |
| | | ListId(); |
| | | ListSortId();//排序 |
| | | m_ScrollerController.OnRefreshCell += OnRefreshGridCell; |
| | | |
| | | OnCreateGridLineCell(m_ScrollerController); |
| | | m_ScrollerController.JumpIndex(JumpIndex()); |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | PlayerMountDatas.Event_MountHA339U += HA339; |
| | | roleParticularModel.PowerUpdate += PowerUpdate; |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | horsemodel.MountStoneItemId = 0; |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | m_ScrollerController.OnRefreshCell -= OnRefreshGridCell; |
| | | PlayerMountDatas.Event_MountHA339U -= HA339; |
| | | roleParticularModel.PowerUpdate -= PowerUpdate; |
| | | } |
| | | |
| | | private void PowerUpdate() |
| | | { |
| | | GetPetPower(); |
| | | } |
| | | private void GetPetPower() |
| | | { |
| | | ulong PetPower = roleParticularModel.GetFuncFightPower((int)FuncPowerType.HorseSoul); |
| | | if (PetPower > 0) |
| | | { |
| | | m_Text_Power.SetActive(true); |
| | | m_PowerNum.gameObject.SetActive(true); |
| | | m_PowerNum.text = "+" + PetPower; |
| | | } |
| | | else |
| | | { |
| | | m_Text_Power.SetActive(false); |
| | | m_PowerNum.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | void OnCreateGridLineCell(ScrollerController gridCtrl)//预制体创建 |
| | | { |
| | | gridCtrl.Refresh(); |
| | | for (int i = 0; i < ListID.Count; i++) |
| | | { |
| | | gridCtrl.AddCell(ScrollerDataType.Header, ListID[i]); |
| | | } |
| | | gridCtrl.Restart(); |
| | | } |
| | | void CloseButton() |
| | | { |
| | | Close(); |
| | | } |
| | | |
| | | private void OnRefreshGridCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | int _id = cell.index; |
| | | MountStoneItem _MountStoneItem = cell.GetComponent<MountStoneItem>(); |
| | | ItemConfig _item = ConfigManager.Instance.GetTemplate<ItemConfig>(_id.ToString()); |
| | | if (ConfigManager.Instance.GetTemplate<ItemConfig>(_id) == null) |
| | | return; |
| | | _MountStoneItem.m_BGMItem.SetItemBackGround(_item.ItemColor); |
| | | _MountStoneItem.Item.SetSprite(_item.IconKey); |
| | | _MountStoneItem.ItemButton.GetComponent<Button>().RemoveAllListeners(); |
| | | _MountStoneItem.ItemButton.GetComponent<Button>().AddListener(() => |
| | | { |
| | | ItemAttrData attrData = new ItemAttrData(_item.ID); |
| | | itemTipsModel.SetItemTipsModel(attrData); |
| | | |
| | | }); |
| | | int hs_number = playerPack.GetItemCountByID(PackType.rptItem, _id);//魂石数量 |
| | | List<int> bagIndex = null; |
| | | if (hs_number <= 0) |
| | | { |
| | | _MountStoneItem.UserBtn.interactable = false; |
| | | _MountStoneItem.UserBtn.GetComponent<ImageEx>().gray = true; |
| | | _MountStoneItem.m_UseTxt.color = UIHelper.GetUIColor(TextColType.White); |
| | | _MountStoneItem.ItemNum.text = " <color=#ff2828>" + hs_number.ToString() + "</color>" + "/1"; |
| | | } |
| | | else |
| | | { |
| | | _MountStoneItem.UserBtn.interactable = true; |
| | | _MountStoneItem.UserBtn.GetComponent<ImageEx>().gray = false; |
| | | _MountStoneItem.m_UseTxt.color = UIHelper.GetUIColor(TextColType.NavyBrown); |
| | | _MountStoneItem.ItemNum.text = hs_number.ToString() + "/1"; |
| | | bagIndex = playerPack.GetSinglePackModel(PackType.rptItem).ItemIndexlist(_id, 1); |
| | | } |
| | | int _maxuse = ConfigManager.Instance.GetTemplate<AttrFruitConfig>(_id.ToString()).MaxUseCnt; |
| | | _MountStoneItem.PetExpNum.text = tag_Item[_id].ToString() + "/" + _maxuse.ToString(); |
| | | _MountStoneItem.Slider.value = (float)Math.Round((float)tag_Item[_id] / _maxuse, 2, MidpointRounding.AwayFromZero); |
| | | SpiritBeastsText(_id.ToString(), _MountStoneItem.Some_text, tag_Item[_id]); |
| | | if (tag_Item[_id] >= _maxuse) |
| | | _MountStoneItem.UserBtn.gameObject.SetActive(false); |
| | | else |
| | | _MountStoneItem.UserBtn.gameObject.SetActive(true); |
| | | _MountStoneItem.UserBtn.RemoveAllListeners(); |
| | | _MountStoneItem.UserBtn.AddListener(() => |
| | | { |
| | | C0702_tagCUseItem _tagUse = new C0702_tagCUseItem(); |
| | | DesignDebug.LogWarning(bagIndex[0]); |
| | | _tagUse.ItemIndex = (byte)bagIndex[0]; |
| | | GameNetSystem.Instance.SendInfo(_tagUse); |
| | | |
| | | }); |
| | | } |
| | | void SpiritBeastsText(string _id, Text _text, int _max)//兽魂文本的判定赋值 |
| | | { |
| | | Dictionary<int, int> _dic = new Dictionary<int, int>(); |
| | | var config = ConfigManager.Instance.GetTemplate<ItemConfig>(_id); |
| | | |
| | | if (config.Effect1 != 0) |
| | | _dic.Add(config.Effect1, config.EffectValueA1); |
| | | if (config.Effect2 != 0) |
| | | _dic.Add(config.Effect2, config.EffectValueA2); |
| | | if (config.Effect3 != 0) |
| | | _dic.Add(config.Effect3, config.EffectValueA3); |
| | | if (config.Effect4 != 0) |
| | | _dic.Add(config.Effect4, config.EffectValueA4); |
| | | if (config.Effect5 != 0) |
| | | _dic.Add(config.Effect5, config.EffectValueA5); |
| | | |
| | | if (_dic.Count == 0) |
| | | return; |
| | | |
| | | int textNumber = 0; |
| | | if (_dic.Count > 3) |
| | | { |
| | | string val = string.Empty; |
| | | foreach (var item in _dic.Keys) |
| | | { |
| | | textNumber += 1; |
| | | val += ConfigManager.Instance.GetTemplate<PlayerPropertyConfig>(item).Name; |
| | | if (item == 15 || item == 16) |
| | | { |
| | | val += "<color=#109d06> +" + (_dic[item] * _max) / 100 + "% </color>"; |
| | | } |
| | | else |
| | | { |
| | | val += "<color=#109d06> +" + (_dic[item] * _max).ToString() + " </color>"; |
| | | } |
| | | if (textNumber == 3) |
| | | { |
| | | val += "\n"; |
| | | } |
| | | |
| | | } |
| | | _text.text = val; |
| | | } |
| | | else |
| | | { |
| | | string val = string.Empty; |
| | | foreach (var item in _dic.Keys) |
| | | { |
| | | var propertyConfig = ConfigManager.Instance.GetTemplate<PlayerPropertyConfig>(item); |
| | | val += propertyConfig.Name; |
| | | |
| | | switch (propertyConfig.ISPercentage) |
| | | { |
| | | case 0: |
| | | val += "<color=#009f3c> +" + (_dic[item] * _max) + " </color>"; |
| | | break; |
| | | case 1: |
| | | val += "<color=#009f3c> +" + (_dic[item] * _max) / 100 + "% </color>"; |
| | | break; |
| | | case 2: |
| | | val += "<color=#009f3c> +" + (_dic[item] * _max) + "% </color>"; |
| | | break; |
| | | } |
| | | } |
| | | _text.text = val; |
| | | } |
| | | _dic.Clear(); |
| | | } |
| | | |
| | | void HA339(HA339_tagMCAttrFruitEatCntList info) |
| | | { |
| | | tag_Item = horsemodel._DicMountItem; |
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见 |
| | | } |
| | | |
| | | |
| | | private void ListId() |
| | | { |
| | | if (ListID.Count <= 0) |
| | | { |
| | | foreach (var key in horsemodel._DicMountItem.Keys) |
| | | { |
| | | ListID.Add(key); |
| | | } |
| | | } |
| | | } |
| | | private int JumpIndex() |
| | | { |
| | | SuccessConfig successConfig = ConfigManager.Instance.GetTemplate<SuccessConfig>(AchievementGoto.guideAchievementId); |
| | | if (successConfig != null) |
| | | { |
| | | int[] StoneId = successConfig.Condition; |
| | | if (StoneId.Length > 0) |
| | | { |
| | | if (ListID.Contains(StoneId[0])) |
| | | { |
| | | |
| | | if (playerPack.GetItemCountByID(PackType.rptItem, StoneId[0]) <= 0) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("MountStone_1"); |
| | | } |
| | | return ListID.IndexOf(StoneId[0]); |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (ListID.Contains(horsemodel.MountStoneItemId)) |
| | | { |
| | | return ListID.IndexOf(horsemodel.MountStoneItemId); |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (ListID.Contains(horsemodel.MountStoneItemId)) |
| | | { |
| | | return ListID.IndexOf(horsemodel.MountStoneItemId); |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | private void ListSortId()//排序 |
| | | { |
| | | ListID.Sort(Compare); |
| | | } |
| | | private int Compare(int x, int y) |
| | | { |
| | | bool havex = IsUse(x); |
| | | bool havey = IsUse(y); |
| | | if (havex.CompareTo(havey) != 0) |
| | | { |
| | | return -havex.CompareTo(havey); |
| | | } |
| | | if (x.CompareTo(y) != 0) |
| | | { |
| | | return x.CompareTo(y); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | private bool IsUse(int Id) |
| | | { |
| | | int hs_number = playerPack.GetItemCountByID(PackType.rptItem, Id);//魂石数量 |
| | | int _maxuse = ConfigManager.Instance.GetTemplate<AttrFruitConfig>(Id.ToString()).MaxUseCnt; |
| | | if (tag_Item.ContainsKey(Id)) |
| | | { |
| | | if (hs_number > 0 && _maxuse > tag_Item[Id]) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |
| | | using Snxxz.UI;
|
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using TableConfig;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class MountStoneTipsWin : Window
|
| | | {
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } }
|
| | |
|
| | | PlayerPackModel _playerPack;
|
| | | PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } }
|
| | | RoleParticularModel m_RoleParticularModel;
|
| | | RoleParticularModel roleParticularModel { get { return m_RoleParticularModel ?? (m_RoleParticularModel = ModelCenter.Instance.GetModel<RoleParticularModel>()); } }
|
| | | //坐骑魂石面板
|
| | | [SerializeField]
|
| | | ScrollerController m_ScrollerController;
|
| | | [SerializeField] Button CloseBtn;
|
| | | [SerializeField] GameObject m_Text_Power;
|
| | | [SerializeField] Text m_PowerNum;
|
| | | private Dictionary<int, int> tag_Item = new Dictionary<int, int>();//坐骑魂石存
|
| | | Dictionary<string, ItemConfig> tagCIM = new Dictionary<string, TableConfig.ItemConfig>();
|
| | | private List<int> ListID = new List<int>();
|
| | | PlayerMountDatas m_HorseModel;
|
| | | PlayerMountDatas horsemodel
|
| | | {
|
| | | get
|
| | | {
|
| | | return m_HorseModel ?? (m_HorseModel = ModelCenter.Instance.GetModel<PlayerMountDatas>());
|
| | | }
|
| | | }
|
| | | protected override void BindController()
|
| | | {
|
| | | tag_Item = horsemodel._DicMountItem;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | CloseBtn.onClick.AddListener(CloseButton);
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | GetPetPower();
|
| | | ListId();
|
| | | ListSortId();//排序
|
| | | m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
|
| | |
|
| | | OnCreateGridLineCell(m_ScrollerController);
|
| | | m_ScrollerController.JumpIndex(JumpIndex());
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | PlayerMountDatas.Event_MountHA339U += HA339;
|
| | | roleParticularModel.PowerUpdate += PowerUpdate;
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | horsemodel.MountStoneItemId = 0;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
|
| | | PlayerMountDatas.Event_MountHA339U -= HA339;
|
| | | roleParticularModel.PowerUpdate -= PowerUpdate;
|
| | | }
|
| | |
|
| | | private void PowerUpdate()
|
| | | {
|
| | | GetPetPower();
|
| | | }
|
| | | private void GetPetPower()
|
| | | {
|
| | | ulong PetPower = roleParticularModel.GetFuncFightPower((int)FuncPowerType.HorseSoul);
|
| | | if (PetPower > 0)
|
| | | {
|
| | | m_Text_Power.SetActive(true);
|
| | | m_PowerNum.gameObject.SetActive(true);
|
| | | m_PowerNum.text = "+" + PetPower;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Text_Power.SetActive(false);
|
| | | m_PowerNum.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | | void OnCreateGridLineCell(ScrollerController gridCtrl)//预制体创建
|
| | | {
|
| | | gridCtrl.Refresh();
|
| | | for (int i = 0; i < ListID.Count; i++)
|
| | | {
|
| | | gridCtrl.AddCell(ScrollerDataType.Header, ListID[i]);
|
| | | }
|
| | | gridCtrl.Restart();
|
| | | }
|
| | | void CloseButton()
|
| | | {
|
| | | Close();
|
| | | }
|
| | |
|
| | | private void OnRefreshGridCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | int _id = cell.index;
|
| | | MountStoneItem _MountStoneItem = cell.GetComponent<MountStoneItem>();
|
| | | ItemConfig _item = Config.Instance.Get<ItemConfig>(_id.ToString());
|
| | | if (Config.Instance.Get<ItemConfig>(_id) == null)
|
| | | return;
|
| | | _MountStoneItem.m_BGMItem.SetItemBackGround(_item.ItemColor);
|
| | | _MountStoneItem.Item.SetSprite(_item.IconKey);
|
| | | _MountStoneItem.ItemButton.GetComponent<Button>().RemoveAllListeners();
|
| | | _MountStoneItem.ItemButton.GetComponent<Button>().AddListener(() =>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(_item.ID);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | |
|
| | | });
|
| | | int hs_number = playerPack.GetItemCountByID(PackType.rptItem, _id);//魂石数量
|
| | | List<int> bagIndex = null;
|
| | | if (hs_number <= 0)
|
| | | {
|
| | | _MountStoneItem.UserBtn.interactable = false;
|
| | | _MountStoneItem.UserBtn.GetComponent<ImageEx>().gray = true;
|
| | | _MountStoneItem.m_UseTxt.color = UIHelper.GetUIColor(TextColType.White);
|
| | | _MountStoneItem.ItemNum.text = " <color=#ff2828>" + hs_number.ToString() + "</color>" + "/1";
|
| | | }
|
| | | else
|
| | | {
|
| | | _MountStoneItem.UserBtn.interactable = true;
|
| | | _MountStoneItem.UserBtn.GetComponent<ImageEx>().gray = false;
|
| | | _MountStoneItem.m_UseTxt.color = UIHelper.GetUIColor(TextColType.NavyBrown);
|
| | | _MountStoneItem.ItemNum.text = hs_number.ToString() + "/1";
|
| | | bagIndex = playerPack.GetSinglePackModel(PackType.rptItem).ItemIndexlist(_id, 1);
|
| | | }
|
| | | int _maxuse = Config.Instance.Get<AttrFruitConfig>(_id.ToString()).MaxUseCnt;
|
| | | _MountStoneItem.PetExpNum.text = tag_Item[_id].ToString() + "/" + _maxuse.ToString();
|
| | | _MountStoneItem.Slider.value = (float)Math.Round((float)tag_Item[_id] / _maxuse, 2, MidpointRounding.AwayFromZero);
|
| | | SpiritBeastsText(_id.ToString(), _MountStoneItem.Some_text, tag_Item[_id]);
|
| | | if (tag_Item[_id] >= _maxuse)
|
| | | _MountStoneItem.UserBtn.gameObject.SetActive(false);
|
| | | else
|
| | | _MountStoneItem.UserBtn.gameObject.SetActive(true);
|
| | | _MountStoneItem.UserBtn.RemoveAllListeners();
|
| | | _MountStoneItem.UserBtn.AddListener(() =>
|
| | | {
|
| | | C0702_tagCUseItem _tagUse = new C0702_tagCUseItem();
|
| | | DebugEx.LogWarning(bagIndex[0]);
|
| | | _tagUse.ItemIndex = (byte)bagIndex[0];
|
| | | GameNetSystem.Instance.SendInfo(_tagUse);
|
| | |
|
| | | });
|
| | | }
|
| | | void SpiritBeastsText(string _id, Text _text, int _max)//兽魂文本的判定赋值
|
| | | {
|
| | | Dictionary<int, int> _dic = new Dictionary<int, int>();
|
| | | var config = Config.Instance.Get<ItemConfig>(_id);
|
| | |
|
| | | if (config.Effect1 != 0)
|
| | | _dic.Add(config.Effect1, config.EffectValueA1);
|
| | | if (config.Effect2 != 0)
|
| | | _dic.Add(config.Effect2, config.EffectValueA2);
|
| | | if (config.Effect3 != 0)
|
| | | _dic.Add(config.Effect3, config.EffectValueA3);
|
| | | if (config.Effect4 != 0)
|
| | | _dic.Add(config.Effect4, config.EffectValueA4);
|
| | | if (config.Effect5 != 0)
|
| | | _dic.Add(config.Effect5, config.EffectValueA5);
|
| | |
|
| | | if (_dic.Count == 0)
|
| | | return;
|
| | |
|
| | | int textNumber = 0;
|
| | | if (_dic.Count > 3)
|
| | | {
|
| | | string val = string.Empty;
|
| | | foreach (var item in _dic.Keys)
|
| | | {
|
| | | textNumber += 1;
|
| | | val += Config.Instance.Get<PlayerPropertyConfig>(item).Name;
|
| | | if (item == 15 || item == 16)
|
| | | {
|
| | | val += "<color=#109d06> +" + (_dic[item] * _max) / 100 + "% </color>";
|
| | | }
|
| | | else
|
| | | {
|
| | | val += "<color=#109d06> +" + (_dic[item] * _max).ToString() + " </color>";
|
| | | }
|
| | | if (textNumber == 3)
|
| | | {
|
| | | val += "\n";
|
| | | }
|
| | |
|
| | | }
|
| | | _text.text = val;
|
| | | }
|
| | | else
|
| | | {
|
| | | string val = string.Empty;
|
| | | foreach (var item in _dic.Keys)
|
| | | {
|
| | | var propertyConfig = Config.Instance.Get<PlayerPropertyConfig>(item);
|
| | | val += propertyConfig.Name;
|
| | |
|
| | | switch (propertyConfig.ISPercentage)
|
| | | {
|
| | | case 0:
|
| | | val += "<color=#009f3c> +" + (_dic[item] * _max) + " </color>";
|
| | | break;
|
| | | case 1:
|
| | | val += "<color=#009f3c> +" + (_dic[item] * _max) / 100 + "% </color>";
|
| | | break;
|
| | | case 2:
|
| | | val += "<color=#009f3c> +" + (_dic[item] * _max) + "% </color>";
|
| | | break;
|
| | | }
|
| | | }
|
| | | _text.text = val;
|
| | | }
|
| | | _dic.Clear();
|
| | | }
|
| | |
|
| | | void HA339(HA339_tagMCAttrFruitEatCntList info)
|
| | | {
|
| | | tag_Item = horsemodel._DicMountItem;
|
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | |
|
| | |
|
| | | private void ListId()
|
| | | {
|
| | | if (ListID.Count <= 0)
|
| | | {
|
| | | foreach (var key in horsemodel._DicMountItem.Keys)
|
| | | {
|
| | | ListID.Add(key);
|
| | | }
|
| | | }
|
| | | }
|
| | | private int JumpIndex()
|
| | | {
|
| | | SuccessConfig successConfig = Config.Instance.Get<SuccessConfig>(AchievementGoto.guideAchievementId);
|
| | | if (successConfig != null)
|
| | | {
|
| | | int[] StoneId = successConfig.Condition;
|
| | | if (StoneId.Length > 0)
|
| | | {
|
| | | if (ListID.Contains(StoneId[0]))
|
| | | {
|
| | |
|
| | | if (playerPack.GetItemCountByID(PackType.rptItem, StoneId[0]) <= 0)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("MountStone_1");
|
| | | }
|
| | | return ListID.IndexOf(StoneId[0]);
|
| | | }
|
| | | else
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (ListID.Contains(horsemodel.MountStoneItemId))
|
| | | {
|
| | | return ListID.IndexOf(horsemodel.MountStoneItemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (ListID.Contains(horsemodel.MountStoneItemId))
|
| | | {
|
| | | return ListID.IndexOf(horsemodel.MountStoneItemId);
|
| | | }
|
| | | else
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | }
|
| | | }
|
| | | private void ListSortId()//排序
|
| | | {
|
| | | ListID.Sort(Compare);
|
| | | }
|
| | | private int Compare(int x, int y)
|
| | | {
|
| | | int index_x = MaxSortIndex(x);
|
| | | int index_y = MaxSortIndex(y);
|
| | | bool havex = IsUse(x);
|
| | | bool havey = IsUse(y);
|
| | | bool IsFull_x = IsFull(x);
|
| | | bool IsFull_y = IsFull(y);
|
| | | if (havex.CompareTo(havey) != 0)
|
| | | {
|
| | | return -havex.CompareTo(havey);
|
| | | }
|
| | | if (IsFull_x.CompareTo(IsFull_y) != 0)
|
| | | {
|
| | | return -IsFull_x.CompareTo(IsFull_y);
|
| | | }
|
| | | if (index_x.CompareTo(index_y) != 0)
|
| | | {
|
| | | return -index_x.CompareTo(index_y);
|
| | | } |
| | | if (x.CompareTo(y) != 0)
|
| | | {
|
| | | return x.CompareTo(y);
|
| | | }
|
| | | return 1;
|
| | | }
|
| | |
|
| | | private int MaxSortIndex(int sortId)
|
| | | {
|
| | | int index = 0;
|
| | | var AttrFruitconfig = Config.Instance.Get<AttrFruitConfig>(sortId);
|
| | | if (AttrFruitconfig != null)
|
| | | {
|
| | | index = AttrFruitconfig.Sort;
|
| | | }
|
| | | return index;
|
| | | }
|
| | |
|
| | | private bool IsUse(int Id)
|
| | | {
|
| | | int hs_number = playerPack.GetItemCountByID(PackType.rptItem, Id);//魂石数量
|
| | | int _maxuse = Config.Instance.Get<AttrFruitConfig>(Id.ToString()).MaxUseCnt;
|
| | | if (tag_Item.ContainsKey(Id))
|
| | | {
|
| | | if (hs_number > 0 && _maxuse > tag_Item[Id])
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | }
|
| | | return false;
|
| | | }
|
| | | private bool IsFull(int Id)
|
| | | {
|
| | | bool IsBool = true;
|
| | | int _maxuse = Config.Instance.Get<AttrFruitConfig>(Id.ToString()).MaxUseCnt;
|
| | | if (tag_Item.ContainsKey(Id))
|
| | | {
|
| | | if (tag_Item[Id] >= _maxuse)
|
| | | {
|
| | | IsBool = false;
|
| | | }
|
| | | }
|
| | | return IsBool;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|