| System/ItemTip/ItemTipUtility.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/ItemTip/TipOperateButton.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/KnapSack/Logic/ItemLogicUtility.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/KnapSack/Logic/PackModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/KnapSack/New/RoleEquipWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Role/LingShiChange.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Role/LingShiChange.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Utility/EnumHelper.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
System/ItemTip/ItemTipUtility.cs
@@ -909,6 +909,9 @@ case ItemOperateType.exchange: WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.ExchangeActiveToken); break; case ItemOperateType.lsExchange: WindowCenter.Instance.Open<LingShiChange>(); break; } } @@ -1749,19 +1752,23 @@ { var config = ItemConfig.Get(itemId); var operates = new List<ItemOperateType>(); if (config.CanSell == 1) var lsItemID = 150; if (config.CanSell == 1 && itemId != lsItemID) { operates.Add(ItemOperateType.sell); } if (itemCount > 1) if (itemCount > 1 && itemId != lsItemID) { operates.Add(ItemOperateType.split); } if (config.UseTag == 1) { operates.Add(ItemOperateType.makeUse); if (itemId != lsItemID) operates.Add(ItemOperateType.makeUse); else operates.Add(ItemOperateType.lsExchange); } if (config.Type == 25 || config.Effect1 == 225) System/ItemTip/TipOperateButton.cs
@@ -77,6 +77,9 @@ case ItemOperateType.exchange: this.m_Title.text = "兑换"; break; case ItemOperateType.lsExchange: this.m_Title.text = "灵石兑换"; break; case ItemOperateType.renewal: this.m_Title.text = "前往购买"; break; System/KnapSack/Logic/ItemLogicUtility.cs
@@ -16,9 +16,12 @@ Dictionary<int, int> specialSpiritPropertyMaxLevels; private int[] preciousItemTypes; private int[] preciousItemIDs; // 不展示的物品ID private int[] drugIDs; private int[] onekeySellTypes; private int[] pushItemIds; private int lsItemCnt; // 背包中的灵石数量 private List<int> equipBaseProperties = new List<int>(); private Dictionary<int, int> promptUseLimitDict; @@ -66,11 +69,13 @@ equipBaseProperties.Add(int.Parse(baseAttr[i].ToString())); } } lsItemCnt = int.Parse(FuncConfigConfig.Get("LingshiShowCount").Numerical1); preciousItemTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("ItemPush").Numerical1); promptUseLimitDict = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("NoPromptUsetItem").Numerical1); preciousItemIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("ItemPush").Numerical3); drugIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("LifePotionlist").Numerical1); onekeySellTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("OneKeySellItemType").Numerical1); pushItemIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical1); @@ -419,16 +424,22 @@ public event Action<PackType, string> GetExpItemEvent; //得到经验物品 value 物品的实例ID public void RecommendItem(ItemModel item) { if (!preciousItemTypes.Contains(item.config.Type)) { return; } if (item.packType != PackType.Item) { return; } if (!preciousItemTypes.Contains(item.config.Type)) { return; } if (preciousItemIDs != null && preciousItemIDs.Contains(item.config.ID)) { return; } if (item.config.ID == packModel.lsItemID && packModel.GetItemCountByID(PackType.Item, packModel.lsItemID) < lsItemCnt) { return; } //if (item.isAuction) //{ // return; @@ -458,6 +469,7 @@ } if (item.config.Type == 13) { // 经验丹特殊处理,优先显示 if (GetExpItemEvent != null) { GetExpItemEvent(item.packType, item.guid); System/KnapSack/Logic/PackModel.cs
@@ -26,6 +26,9 @@ AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } } ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } public int lsItemID = 150; //可兑换的灵石物品ID int lsItemCnt = int.Parse(FuncConfigConfig.Get("LingshiShowCount").Numerical1); UIEffect lingshiEffect; //灵石特效 public override void Init() { @@ -350,6 +353,8 @@ { refreshItemCountEvent(type, itemModel.gridIndex, itemModel.itemId); } UpdateLSRedpoint(type, itemModel.itemId); } } @@ -853,7 +858,32 @@ #region 红点逻辑判断 const int ITEMPACK_REDKEY = 102011003; Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY); Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY); const int LS_REDKEY = 102011015; Redpoint redpointLS = new Redpoint(MainRedDot.RedPoint_BagFuncKey, LS_REDKEY); private void UpdateLSRedpoint(PackType type, int itemID) { var singlePack = GetSinglePack(type); if (singlePack == null) { return; } if (type != PackType.Item) return; if (itemID != lsItemID) return; if (GetItemCountByID(PackType.Item, lsItemID) < lsItemCnt) { redpointLS.state = RedPointState.None; } else { redpointLS.state = RedPointState.Simple; } } private void UpdatePackRedpoint(PackType type) { @@ -875,6 +905,14 @@ { redpointItemPack.state = RedPointState.None; } if (GetItemCountByID(PackType.Item, lsItemID) < lsItemCnt) { redpointLS.state = RedPointState.None; } else { redpointLS.state = RedPointState.Simple; } break; case PackType.Warehouse: if (singlePack.GetEmptyGridCount() <= 0) System/KnapSack/New/RoleEquipWin.cs
@@ -29,6 +29,7 @@ [SerializeField] private Text m_BindDiamond; [SerializeField] private Button m_EquBtn; [SerializeField] Button m_SpiritButton; [SerializeField] Button LingshiChange; #endregion @@ -48,6 +49,7 @@ m_Sort.SetListener(OnClickSortBtn); m_EquBtn.SetListener(OnEquBtnDown); m_SpiritButton.SetListener(GotoSpiritWeaponWin); LingshiChange.SetListener(()=>WindowCenter.Instance.Open<LingShiChange>()); } protected override void OnPreOpen() System/Role/LingShiChange.cs
New file @@ -0,0 +1,194 @@ using System.Collections; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class LingShiChange : Window { // 1. 界面 2. 物品获得调整背包 3. 物品使用改兑换 4. 灵石名称和描述 5. 红点 [SerializeField] Text Money; [SerializeField] Text ItemName; [SerializeField] Button sureBtn; [SerializeField] Button closeBtn; [SerializeField] Text m_Count; [SerializeField] Button m_Add; [SerializeField] Button m_Sub; [SerializeField] Button m_Max; [SerializeField] ItemCell m_Itemcell; [SerializeField] Text HaveCount; PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } Coroutine m_Coroutine = null; bool isPointAdd = false; bool isPointSub = false; int point = 0; int m_itemId = 150; int m_haveCnt = 0; static WaitForSeconds waitSpeedSlow = new WaitForSeconds(0.2f); private void ShowMoney() { m_Count.text = point.ToString(); Money.text = (int.Parse(m_Count.text) * 10).ToString(); } private void ShowItem() { var Item = ItemConfig.Get(m_itemId); ItemCellModel cellModel = new ItemCellModel(m_itemId, true, 1); m_Itemcell.Init(cellModel); ItemName.text = Item.ItemName; } private void UseItem() { var itemModels = packModel.GetItemsById(PackType.Item, m_itemId); if (itemModels != null && itemModels.Count > 0 && point > 0) { ItemOperateUtility.Instance.UseItem(itemModels[0].guid, point); } CloseClick(); } private void ShowItemCount() { m_haveCnt = packModel.GetItemCountByID(PackType.Item, m_itemId); HaveCount.text = "拥有数量:" + UIHelper.AppendColor(m_haveCnt == 0 ? TextColType.Red : TextColType.Green, m_haveCnt.ToString(), true); //SetColorful m_Add.SetInteractable(null, m_haveCnt > 0); m_Sub.SetInteractable(null, m_haveCnt > 0); m_Max.SetInteractable(null, m_haveCnt > 0); } #region Built-in protected override void BindController() { } protected override void AddListeners() { sureBtn.AddListener(UseItem); closeBtn.AddListener(CloseClick); } protected override void OnPreOpen() { packModel.refreshItemCountEvent += OnItemCountRefresh; UIEventTrigger.Get(m_Sub.gameObject).OnDown = OnSubDown; UIEventTrigger.Get(m_Sub.gameObject).OnUp = OnSubUp; UIEventTrigger.Get(m_Add.gameObject).OnDown = OnAddDown; UIEventTrigger.Get(m_Add.gameObject).OnUp = OnAddUp; m_Max.AddListener(OnMax); point = packModel.GetItemCountByID(PackType.Item, m_itemId); ShowItem(); ShowItemCount(); ShowMoney(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { point = 0; packModel.refreshItemCountEvent -= OnItemCountRefresh; } protected override void OnAfterClose() { } #endregion private void OnItemCountRefresh(PackType type, int index, int itemId) { if (type == PackType.Item && itemId == m_itemId) { ShowItemCount(); } } public void Dispose() { if (m_Coroutine != null) { StopCoroutine(m_Coroutine); } isPointAdd = false; isPointSub = false; } private void OnAddDown(GameObject go) { isPointAdd = true; if (m_Coroutine != null) { StopCoroutine(m_Coroutine); } m_Coroutine = StartCoroutine(Co_PointRefresh(true)); } private void OnAddUp(GameObject go) { isPointAdd = false; if (m_Coroutine != null) { StopCoroutine(m_Coroutine); } } private void OnSubDown(GameObject go) { if (m_Coroutine != null) { StopCoroutine(m_Coroutine); } isPointSub = true; m_Coroutine = StartCoroutine(Co_PointRefresh(false)); } private void OnSubUp(GameObject go) { isPointSub = false; if (m_Coroutine != null) { StopCoroutine(m_Coroutine); } } private void OnMax() { point = m_haveCnt; ShowMoney(); } IEnumerator Co_PointRefresh(bool pointUp) { while (pointUp ? isPointAdd : isPointSub) { if (pointUp && m_haveCnt > 0 && point < m_haveCnt) { point += 1; } else if (!pointUp && point > 0) { point -= 1; } ShowMoney(); yield return waitSpeedSlow; } } } } System/Role/LingShiChange.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 4d6f949ee165f1e47890b3f95a60f3ab timeCreated: 1573120326 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Utility/EnumHelper.cs
@@ -1504,6 +1504,7 @@ inlay, //镶嵌 train,//洗炼 star,//升星 lsExchange, //灵石兑换 } [XLua.LuaCallCSharp]