| System/KnapSack/Logic/ItemTipsModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/KnapSack/New/KingTreasureShowModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/KnapSack/New/KingTreasureShowModel.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/KnapSack/New/KingTreasureShowWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/KnapSack/New/KingTreasureShowWin.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Treasure/TreasureModelDrag.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Treasure/TreasureUIEvent.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Utility/EnumHelper.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
System/KnapSack/Logic/ItemTipsModel.cs
@@ -668,6 +668,10 @@ case ItemWinType.GatherSoul: WindowCenter.Instance.Open<GatherSoulTipWin>(); break; case ItemWinType.KingTreasure: var kingTreasureShow = ModelCenter.Instance.GetModel<KingTreasureShowModel>(); kingTreasureShow.SetInitData(curAttrData.itemConfig.EffectValueA1,0); break; } } @@ -2964,6 +2968,9 @@ case "GatherSoul": winType = ItemWinType.GatherSoul; break; case "KingTreasureShow": winType = ItemWinType.KingTreasure; break; default: DebugEx.Log("没有此物品的弹框类型" + this.itemConfig.Template.Trim()); break; System/KnapSack/New/KingTreasureShowModel.cs
New file @@ -0,0 +1,105 @@ using UnityEngine; using System; using TableConfig; using System.Collections.Generic; namespace Snxxz.UI { [XLua.LuaCallCSharp] [XLua.Hotfix] public class KingTreasureShowModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk { KingTreasureModel kingTreasureModel { get { return ModelCenter.Instance.GetModel<KingTreasureModel>(); } } public string effectDes { get; private set;} public int treasureId { get; private set; } public string treasureSource { get; private set;} public override void Init() { } public void OnBeforePlayerDataInitialize() { } public void OnPlayerLoginOk() { } public override void UnInit() { } public void SetTreasureSource(string treasureSource) { this.treasureSource = treasureSource; } public void SetInitData(int treasureId, int rewardLv) { this.treasureId = treasureId; effectDes = string.Empty; KingTreasureModel.Division division; bool isDivision = kingTreasureModel.TryGetDivision(treasureId,rewardLv, out division); if(isDivision) { SetEffectDes(division.basePropertys); SetEffectDes(division.specialPropertys); WindowCenter.Instance.Open<KingTreasureShowWin>(); } } private void SetEffectDes(Dictionary<int, int> attrDict) { if (attrDict == null) return; foreach (var key in attrDict.Keys) { var attrValue = attrDict[key]; var propertyConfig = Config.Instance.Get<PlayerPropertyConfig>(key); if (propertyConfig != null) { string attrDes = StringUtility.Contact(propertyConfig.Name, "+", GetProValueTypeStr(propertyConfig, attrValue)); switch(propertyConfig.type) { case 2: attrDes = StringUtility.Contact("<color=#ec4bf6>", attrDes, "</color>"); break; default: attrDes = StringUtility.Contact("<color=#fff4cd>", attrDes, "</color>"); break; } if (string.IsNullOrEmpty(effectDes)) { effectDes = attrDes; } else { effectDes = StringUtility.Contact(effectDes, "\n", attrDes); } } } } private string GetProValueTypeStr(PlayerPropertyConfig playerproModel, int value) { string s = ""; if (playerproModel.ISPercentage == 0) { s = value.ToString(); } else if (playerproModel.ISPercentage == 1) { s = (float)Math.Round(value / 100f, 1) + "%"; } else if (playerproModel.ISPercentage == 2) { s = ((float)Math.Round(value / 100f, 1)).ToString(); } return s; } } } System/KnapSack/New/KingTreasureShowModel.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 514af269e1765fa4cacdef0ea0b71606 timeCreated: 1545902416 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/KnapSack/New/KingTreasureShowWin.cs
New file @@ -0,0 +1,81 @@ using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class KingTreasureShowWin : Window { [SerializeField] Text nameText; [SerializeField] Image treasureIcon; [SerializeField] Button closeBtn; [SerializeField] Text fightNumText; [SerializeField] Text treasureEffectText; [SerializeField] Text sourceText; [SerializeField] GameObject fightBg; [SerializeField] ModelShowPerfab modelShow; TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } KingTreasureShowModel kingShowModel { get { return ModelCenter.Instance.GetModel<KingTreasureShowModel>(); } } KingTreasureModel kingModel { get { return ModelCenter.Instance.GetModel<KingTreasureModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { closeBtn.AddListener(CloseClick); } protected override void OnPreOpen() { SetDisplay(); } protected override void OnAfterOpen() { } protected override void OnAfterClose() { } protected override void OnPreClose() { } #endregion public void SetDisplay() { TreasureConfig treasureConfig = Config.Instance.Get<TreasureConfig>(kingShowModel.treasureId); if (treasureConfig == null) return; nameText.text = treasureConfig.Name; treasureIcon.SetSprite(treasureConfig.Icon); treasureEffectText.text = kingShowModel.effectDes.ToString(); sourceText.text = kingShowModel.treasureSource; int fightNum = kingModel.GetSeasonScore(kingShowModel.treasureId); if (fightNum > 0) { fightBg.SetActive(true); fightNumText.gameObject.SetActive(true); fightNumText.text = Language.Get("KingTreasureScore",fightNum); } else { fightBg.SetActive(false); fightNumText.gameObject.SetActive(false); } modelShow.SetModelShow(kingShowModel.treasureId, ModelShowType.treasure, Language.Get("TreasureEffect103")); } } } System/KnapSack/New/KingTreasureShowWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 20b107d558355834e8e3000597b79f3c timeCreated: 1545902103 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Treasure/TreasureModelDrag.cs
@@ -3,7 +3,8 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class TreasureModelDrag : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IPointerUpHandler, IDragHandler, IPointerClickHandler public class TreasureModelDrag : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IPointerDownHandler, IPointerUpHandler, IDragHandler, IPointerClickHandler { Vector2 m_Start; bool m_Drag = false; @@ -51,15 +52,21 @@ return; } PassEvent(eventData, ExecuteEvents.pointerClickHandler); } } public void OnPointerDown(PointerEventData eventData) { PassEvent(eventData, ExecuteEvents.pointerDownHandler); } public void OnPointerUp(PointerEventData eventData) { if (m_Drag && OnDragComplete != null) { OnDragComplete(); } m_Drag = false; m_Drag = false; PassEvent(eventData, ExecuteEvents.pointerUpHandler); } void PassEvent<T>(PointerEventData data, ExecuteEvents.EventFunction<T> function) where T : IEventSystemHandler System/Treasure/TreasureUIEvent.cs
@@ -6,11 +6,38 @@ using UnityEngine.EventSystems; namespace Snxxz.UI { public class TreasureUIEvent : MonoBehaviour, IPointerClickHandler public class TreasureUIEvent : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler { public event UnityAction onClick; [SerializeField] Vector2 delta = Vector2.zero; Vector2 start = Vector2.zero; Vector2 end = Vector2.zero; public void OnPointerDown(PointerEventData eventData) { start = eventData.position; } public void OnPointerUp(PointerEventData eventData) { end = eventData.position; } public void OnPointerClick(PointerEventData eventData) { if (!delta.Equals(Vector2.zero)) { var _delta = end - start; if (Mathf.Abs(_delta.x) > Mathf.Abs(delta.x)) { return; } if (Mathf.Abs(_delta.y) > Mathf.Abs(delta.y)) { return; } } if (onClick != null) { onClick(); Utility/EnumHelper.cs
@@ -1572,6 +1572,7 @@ petMatWin, //解锁宠物和坐骑道具弹框 buyPetMatWin, //购买解锁宠物和坐骑道具弹框 GatherSoul,//聚魂 KingTreasure, //王者法宝 } public enum ItemTipChildType