| | |
| | | { |
| | | seeAttrBtn.AddListener(() => |
| | | { |
| | | // UIManager.Instance.OpenWindow<BeautyMMAttrWin>(); |
| | | AttributeManager.Instance.OpenTotalAttributeWin(BeautyMMManager.Instance.allMMTalentAttr); |
| | | }); |
| | | allMMBtn.AddListener(() => |
| | | { |
| | |
| | | |
| | | if (m_Result == 5) |
| | | { |
| | | isClickDoor = false; //不需要帮忘记自动重置了 |
| | | isClickDoor = false; //不需要帮玩家自动重置了 |
| | | } |
| | | |
| | | for (int i = 0; i < netPack.GridCnt; i++) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | //游历体力 |
| | | public int GetMaxEnergy() |
| | | { |
| | | var value = allMMTalentEffect.ContainsKey((int)TalentEffectType.Travel) ? allMMTalentEffect[(int)TalentEffectType.Travel] : 0; |
| | | return baseTravelEnergy + value; |
| | | return baseTravelEnergy + GetTalentEffectByType(TalentEffectType.Travel); |
| | | } |
| | | |
| | | |
| | |
| | | public int recoverTravelEnergyTime = 0; // 数值2:恢复1点体力所需时间,分钟 |
| | | public int[] travelRowCol = new int[2]; // 数值3:游历行列数 行|列 |
| | | |
| | | public Dictionary<int, int> allMMTalentAttr = new Dictionary<int, int>(); |
| | | public Dictionary<int, long> allMMTalentAttr = new Dictionary<int, long>(); |
| | | public Dictionary<int, int> allMMTalentEffect = new Dictionary<int, int>(); |
| | | |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | public int GetMMLV(int mmID) |
| | | { |
| | | if (beautyMMDataDict.ContainsKey(mmID)) |
| | | { |
| | | return beautyMMDataDict[mmID].LV; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public int GetUsedSkinID(int mmID) |
| | | { |
| | | if (beautyMMDataDict.ContainsKey(mmID)) |
| | |
| | | } |
| | | |
| | | // 获取MM天赋属性属性, defaultAttr 是否使用默认属性 |
| | | public Dictionary<int, int> GetMMTalentAttrForUI(int mmID, bool defaultAttr = false) |
| | | public Dictionary<int, long> GetMMTalentAttrForUI(int mmID, bool defaultAttr = false) |
| | | { |
| | | var _dict = new Dictionary<int, int>(); |
| | | var _dict = new Dictionary<int, long>(); |
| | | if (beautyMMDataDict.ContainsKey(mmID)) |
| | | { |
| | | var _beauty = beautyMMDataDict[mmID]; |
| | |
| | | return _dict; |
| | | } |
| | | |
| | | // 真实属性 |
| | | public Dictionary<int, int> GetMMTalentAttr(int mmID) |
| | | |
| | | public int GetTalentEffectByType(TalentEffectType type) |
| | | { |
| | | var _dict = new Dictionary<int, int>(); |
| | | var value = allMMTalentEffect.ContainsKey((int)type) ? allMMTalentEffect[(int)type] : 0; |
| | | return value; |
| | | } |
| | | |
| | | |
| | | // 真实天赋属性 |
| | | public Dictionary<int, long> GetMMTalentAttr(int mmID) |
| | | { |
| | | var _dict = new Dictionary<int, long>(); |
| | | if (beautyMMDataDict.ContainsKey(mmID)) |
| | | { |
| | | var _beauty = beautyMMDataDict[mmID]; |
| | |
| | | return new Dictionary<int, int>(); |
| | | } |
| | | |
| | | Dictionary<int, long> GetMMLVUPAttr(int mmID) |
| | | { |
| | | var mmConfig = BeautyConfig.Get(mmID); |
| | | //升级获得的属性 |
| | | var _dict = new Dictionary<int, long>(); |
| | | var lv = GetMMLV(mmID); |
| | | BeautyQualityLVConfig config; |
| | | for (int i = 1; i <= lv; i++) |
| | | { |
| | | BeautyQualityLVConfig.TryGetBeautyQualityLVConfig(mmConfig.BeautyQuality, lv, out config); |
| | | if (config != null) |
| | | { |
| | | for (int j = 0; j < config.AttrIDList.Length; j++) |
| | | { |
| | | if (_dict.ContainsKey(config.AttrIDList[j])) |
| | | { |
| | | _dict[config.AttrIDList[j]] += config.AttrValueList[j]; |
| | | } |
| | | else |
| | | { |
| | | _dict.Add(config.AttrIDList[j], config.AttrValueList[j]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return _dict; |
| | | |
| | | } |
| | | |
| | | void RefreshAllTalen() |
| | | { |
| | |
| | | allMMTalentAttr.Add(_key, _dict[_key]); |
| | | } |
| | | } |
| | | |
| | | //升级属性 |
| | | var _dict1 = GetMMLVUPAttr(key); |
| | | //加到allMMTalentAttr |
| | | foreach (var _key in _dict1.Keys) |
| | | { |
| | | if (allMMTalentAttr.ContainsKey(_key)) |
| | | { |
| | | allMMTalentAttr[_key] += _dict1[_key]; |
| | | } |
| | | else |
| | | { |
| | | allMMTalentAttr.Add(_key, _dict1[_key]); |
| | | } |
| | | } |
| | | |
| | | |
| | | var _dict2 = GetMMTalentEffect(key); |
| | | //加到allMMTalentEffect |
| | | foreach (var _key in _dict2.Keys) |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | seeAttrBtn.AddListener(() => |
| | | { |
| | | // UIManager.Instance.OpenWindow<BeautyMMAttrWin>(); |
| | | UIManager.Instance.OpenWindow<BeautyMMTalentWin>(mmID); |
| | | }); |
| | | |
| | | activeBtn.AddListener(ActiveMM); |
| | |
| | | BeautyMMManager.Instance.OnBeautyMMDataUpdate += OnBeautyMMDataUpdate; |
| | | PackManager.Instance.RefreshItemEvent += OnRefreshItemEvent; |
| | | |
| | | Display(); |
| | | Display(true); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | void Display() |
| | | void Display(bool isOpen = false) |
| | | { |
| | | mmConfig = BeautyConfig.Get(mmID); |
| | | qualityImg.SetSprite($"mmMark{mmConfig.BeautyQuality}"); |
| | |
| | | fullRect.SetActive(false); |
| | | } |
| | | |
| | | itemlist = BeautyMMManager.Instance.loveItemIDs.ToList(); |
| | | if (isOpen) |
| | | { |
| | | BeautyMMManager.Instance.selectLoveItemID = itemlist[0]; |
| | | } |
| | | CreateScroller(); |
| | | |
| | | } |
| | |
| | | void CreateScroller() |
| | | { |
| | | loveScroller.Refresh(); |
| | | itemlist = BeautyMMManager.Instance.loveItemIDs.ToList(); |
| | | BeautyMMManager.Instance.selectLoveItemID = itemlist[0]; |
| | | |
| | | if (mmConfig.ExclusiveItemID > 0) |
| | | { |
| | | itemlist.Add(mmConfig.ExclusiveItemID); //专属信物 |
| New file |
| | |
| | | using System; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | public class BeautyMMTalentAttrCell : CellView |
| | | { |
| | | [SerializeField] Text lvText; |
| | | [SerializeField] Text nameText; |
| | | [SerializeField] Text valueText; |
| | | public void Display(int lv, int mmID) |
| | | { |
| | | var lvValue = BeautyMMManager.Instance.GetMMLV(mmID); |
| | | bool isLVActive = false; |
| | | if (lvValue >= lv) |
| | | { |
| | | isLVActive = true; |
| | | } |
| | | var mmConfig = BeautyConfig.Get(mmID); |
| | | BeautyQualityLVConfig config; |
| | | BeautyQualityLVConfig.TryGetBeautyQualityLVConfig(mmConfig.BeautyQuality, lv, out config); |
| | | var id = config.AttrIDList[0]; |
| | | if (!isLVActive) |
| | | { |
| | | lvText.text = UIHelper.AppendColor(TextColType.NavyGray, Language.Get($"L1113", index)); |
| | | nameText.text = UIHelper.AppendColor(TextColType.NavyGray, PlayerPropertyConfig.Get(id).Name); |
| | | valueText.text = UIHelper.AppendColor(TextColType.NavyGray, PlayerPropertyConfig.GetValueDescription(id, config.AttrValueList[0])); |
| | | } |
| | | else |
| | | { |
| | | lvText.text = Language.Get($"L1113", index); |
| | | nameText.text = PlayerPropertyConfig.Get(id).Name; |
| | | valueText.text = PlayerPropertyConfig.GetValueDescription(id, config.AttrValueList[0]); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 83dafad1a1945144aac0539cdfe807e7 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | public class BeautyMMTalentAttrNameCell : CellView |
| | | { |
| | | [SerializeField] Text nameText; |
| | | public void Display(int index) |
| | | { |
| | | nameText.text = Language.Get($"BeautyMMLVName{index + 1}"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c694d5be398d45246b40dfd5392e4d4b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | public class BeautyMMTalentEffectCell : CellView |
| | | { |
| | | [SerializeField] Text lvText; |
| | | [SerializeField] ImageEx lvBGImg; |
| | | [SerializeField] Text nameText; |
| | | [SerializeField] Text[] talentTexts; |
| | | [SerializeField] Image activeImg; |
| | | public void Display(int rank, int mmID) |
| | | { |
| | | lvText.text = (rank*BeautyMMManager.Instance.needLVForTalent).ToString(); |
| | | var lvValue = BeautyMMManager.Instance.GetMMLV(mmID); |
| | | var isActive = BeautyMMManager.Instance.isActiveMM(mmID); |
| | | bool isRankActive = false; |
| | | if (isActive && lvValue/BeautyMMManager.Instance.needLVForTalent >= rank) |
| | | { |
| | | isRankActive = true; |
| | | } |
| | | lvBGImg.gray = !isRankActive; |
| | | ShowTalent(mmID, rank, isRankActive); |
| | | activeImg.SetActive(isRankActive && lvValue/BeautyMMManager.Instance.needLVForTalent == rank); |
| | | nameText.text = isRankActive ? Language.Get($"BeautyMMLVName{rank + 1}") : UIHelper.AppendColor(TextColType.NavyGray, Language.Get($"BeautyMMLVName{rank}")); |
| | | } |
| | | |
| | | |
| | | void ShowTalent(int mmID, int rank, bool isRankActive) |
| | | { |
| | | var mmConfig = BeautyConfig.Get(mmID); |
| | | //先显示天赋属性,再显示天赋特性 |
| | | var attrs = GetMMTalentAttrForUI(mmConfig, rank); |
| | | int talentIndex = 0; |
| | | if (attrs.IsNullOrEmpty()) |
| | | { |
| | | talentIndex = 0; |
| | | } |
| | | else |
| | | { |
| | | foreach (var attr in attrs) |
| | | { |
| | | if (talentIndex < talentTexts.Length) |
| | | { |
| | | talentTexts[talentIndex].SetActive(true); |
| | | string format = "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}"); |
| | | talentTexts[talentIndex].text = PlayerPropertyConfig.GetFullDescription(attr.Key, attr.Value, format); |
| | | } |
| | | else |
| | | { |
| | | break; |
| | | } |
| | | talentIndex++; |
| | | } |
| | | } |
| | | |
| | | |
| | | var talentValue = GetMMTalentEffectForUI(mmConfig, rank); |
| | | for (int i = talentIndex; i < talentTexts.Length; i++) |
| | | { |
| | | if (i == talentIndex && mmConfig.EffType != 0) |
| | | { |
| | | //天赋效果约定最多一个 |
| | | talentTexts[talentIndex].SetActive(true); |
| | | switch (mmConfig.EffType) |
| | | { |
| | | case 1: |
| | | talentTexts[i].text = Language.Get($"BeautyMMTalent1", talentValue); |
| | | break; |
| | | case 2: |
| | | talentTexts[i].text = Language.Get($"BeautyMMTalent2", talentValue / 100, ItemConfig.Get(mmConfig.EffTypeValue).ItemName); |
| | | break; |
| | | case 3: |
| | | talentTexts[i].text = Language.Get($"BeautyMMTalent3", talentValue); |
| | | break; |
| | | case 4: |
| | | talentTexts[i].text = Language.Get($"BeautyMMTalent4", ItemConfig.Get(mmConfig.EffTypeValue).ItemName, talentValue); |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | talentTexts[i].SetActive(false); |
| | | } |
| | | } |
| | | |
| | | //置灰 |
| | | if (!isRankActive) |
| | | { |
| | | for (int i = 0; i < talentTexts.Length; i++) |
| | | { |
| | | talentTexts[i].text = UIHelper.AppendColor(TextColType.NavyGray, talentTexts[i].text); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | Dictionary<int, long> GetMMTalentAttrForUI(BeautyConfig config, int rank) |
| | | { |
| | | var _dict = new Dictionary<int, long>(); |
| | | //初始天赋属性 |
| | | for (int i = 0; i < config.TalentAttrIDList.Length; i++) |
| | | { |
| | | _dict[config.TalentAttrIDList[i]] = config.TalentAttrValueList[i]; |
| | | } |
| | | |
| | | //按x级好感度提升一级天赋效果 |
| | | if (rank > 0) |
| | | { |
| | | for (int i = 0; i < config.TalentAttrIDList.Length; i++) |
| | | { |
| | | _dict[config.TalentAttrIDList[i]] += rank * config.TalentPerLVAddList[i]; |
| | | } |
| | | } |
| | | return _dict; |
| | | } |
| | | |
| | | int GetMMTalentEffectForUI(BeautyConfig config, int rank) |
| | | { |
| | | //初始天赋效果 |
| | | int _effect = config.EffValue; |
| | | if (rank > 0) |
| | | { |
| | | _effect += rank * config.EffPerLVAdd; |
| | | } |
| | | return _effect; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a29a345cf77504d419511ea3c4f7b522 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | public class BeautyMMTalentWin : UIBase |
| | | { |
| | | [SerializeField] Text titleText; |
| | | [SerializeField] ScrollerController attrScroller; |
| | | [SerializeField] ScrollerController talentScroller; |
| | | [SerializeField] GroupButtonEx attrBtn; |
| | | [SerializeField] GroupButtonEx talentBtn; |
| | | |
| | | int selectTab = 0; |
| | | int mmID = 0; |
| | | protected override void InitComponent() |
| | | { |
| | | |
| | | attrBtn.AddListener(() => |
| | | { |
| | | selectTab = 0; |
| | | Display(); |
| | | }); |
| | | talentBtn.AddListener(() => |
| | | { |
| | | selectTab = 1; |
| | | Display(); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | |
| | | selectTab = 0; |
| | | mmID = functionOrder; |
| | | attrScroller.OnRefreshCell += OnRefreshAttrCell; |
| | | talentScroller.OnRefreshCell += OnRefreshTalentCell; |
| | | CreateScroller(); |
| | | Display(); |
| | | } |
| | | |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | attrScroller.OnRefreshCell -= OnRefreshAttrCell; |
| | | talentScroller.OnRefreshCell -= OnRefreshTalentCell; |
| | | } |
| | | |
| | | void CreateScroller() |
| | | { |
| | | var mmConfig = BeautyConfig.Get(mmID); |
| | | var maxLV = BeautyQualityLVConfig.GetBeautyQualityMaxLV(mmConfig.BeautyQuality); |
| | | attrScroller.Refresh(); |
| | | talentScroller.Refresh(); |
| | | for (int i = 0; i < maxLV; i++) |
| | | { |
| | | if (i % 20 == 0) |
| | | { |
| | | attrScroller.AddCell(ScrollerDataType.Header, i / 20); |
| | | talentScroller.AddCell(ScrollerDataType.Header, i / 20); |
| | | } |
| | | |
| | | attrScroller.AddCell(ScrollerDataType.Normal, i + 1); |
| | | |
| | | } |
| | | attrScroller.Restart(); |
| | | talentScroller.Restart(); |
| | | } |
| | | |
| | | |
| | | void OnRefreshAttrCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | if (type == ScrollerDataType.Header) |
| | | { |
| | | var _cell1 = cell as BeautyMMTalentAttrNameCell; |
| | | _cell1.Display(cell.index); |
| | | } |
| | | else |
| | | { |
| | | var _cell = cell as BeautyMMTalentAttrCell; |
| | | _cell.Display(cell.index, mmID); |
| | | } |
| | | } |
| | | |
| | | void OnRefreshTalentCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as BeautyMMTalentEffectCell; |
| | | _cell.Display(cell.index, mmID); |
| | | } |
| | | |
| | | |
| | | void Display() |
| | | { |
| | | if (selectTab == 0) |
| | | { |
| | | attrScroller.SetActive(true); |
| | | talentScroller.SetActive(false); |
| | | attrBtn.SelectBtn(); |
| | | attrScroller.JumpIndex(BeautyMMManager.Instance.GetMMLV(mmID) - 10); |
| | | titleText.text = Language.Get("BeautyMM2"); |
| | | } |
| | | else |
| | | { |
| | | attrScroller.SetActive(false); |
| | | talentScroller.SetActive(true); |
| | | talentBtn.SelectBtn(); |
| | | titleText.text = Language.Get("BeautyMM4"); |
| | | talentScroller.JumpIndex(BeautyMMManager.Instance.GetMMLV(mmID)/BeautyMMManager.Instance.needLVForTalent); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e028690447cf54e438d8ae323e263655 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | |
| | | public void Display(int index) |
| | | { |
| | | restartTween.Stop(); |
| | | restartTween.SetEndState(); |
| | | Int2 girdPos = BeautyMMManager.Instance.ChangeIndexToGrid(index); |
| | | var grid = BeautyMMManager.Instance.GetGrid(girdPos); |
| | | |
| | |
| | | // 大于200 对应表里的 物品 |
| | | void ClickGird(Int2 girdPos, TravelGrid grid) |
| | | { |
| | | if (Time.time - restartTime < 0.5f) |
| | | { |
| | | return; |
| | | } |
| | | ////状态:0-未点击;1-已开启;2-裂纹 |
| | | if (grid.State == 0 || grid.State == 2) |
| | | { |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | float restartTime = 0; |
| | | public void RestartAnim() |
| | | { |
| | | restartTween.Play(); |
| | | restartTime = Time.time; |
| | | } |
| | | } |
| | |
| | | [SerializeField] Image[] whatImgs; |
| | | [SerializeField] Image[] rightImgs; |
| | | [SerializeField] Image[] wrongImgs; |
| | | [SerializeField] UIEffectPlayer[] pointEffects; |
| | | |
| | | float gridWidth = 0; |
| | | float gridHeight = 0; |
| | |
| | | boomColEffect.transform.localPosition = new Vector3((BeautyMMManager.Instance.clickGirdPos.y - 1) * gridWidth + gridWidth / 2, boomColEffect.transform.localPosition.y, 0); |
| | | boomColEffect.Play(); |
| | | } |
| | | |
| | | DisplayBuildResult(); |
| | | |
| | | // 重置开始要在显示后处理动画 |
| | | if (result == 5) |
| | | { |
| | | for (int i = 0; i < girds.Count; i++) |
| | | { |
| | | girds[i].RestartAnim(); |
| | | } |
| | | } |
| | | else if (result == 4 && BeautyMMManager.Instance.m_SceneryLVInfo == 0) |
| | | { |
| | | SoundPlayer.Instance.PlayUIAudio(23); |
| | | } |
| | | } |
| | | |
| | | void Display() |
| | |
| | | |
| | | var startEffectID = buildEffectDic[BeautyMMManager.Instance.m_SceneryType] + GetSuccessCnt(); |
| | | buildResultEffect.effectId = startEffectID; |
| | | buildResultEffect.isPlaySpineLoop = false; |
| | | buildResultEffect.onComplete = () => |
| | | { |
| | | buildResultEffect.isPlaySpineLoop = true; |
| | | buildResultEffect.Play(1); |
| | | }; |
| | | buildResultEffect.Play(0); |
| | | |
| | | //public uint m_SceneryLVInfo; //景观升级信息:0-还未处理景观升级;个位数-第1次升级成功与否,1-成功,2-失败;十位-第2次 ... |
| | | int effectPointIndex = -1; |
| | | |
| | | for (int i = 0; i < whatImgs.Length; i++) |
| | | { |
| | | //0显示问号 1 成功 2 失败 |
| | |
| | | whatImgs[i].SetActive(result == 0); |
| | | rightImgs[i].SetActive(result == 1); |
| | | wrongImgs[i].SetActive(result == 2); |
| | | |
| | | if (result == 0 && effectPointIndex == -1) |
| | | { |
| | | effectPointIndex = i; |
| | | } |
| | | } |
| | | if (effectPointIndex != -1 && effectPointIndex != 0) |
| | | { |
| | | pointEffects[effectPointIndex - 1].Play(); |
| | | } |
| | | else if (effectPointIndex == -1 && BeautyMMManager.Instance.m_SceneryLVInfo != 0) |
| | | { |
| | | pointEffects[whatImgs.Length - 1].Play(); |
| | | } |
| | | } |
| | | |
| | |
| | | List<Item> showItems = new List<Item>(); |
| | | foreach (var item in result.itemInfo) |
| | | { |
| | | Item tempItem = new Item(item.ItemID, item.Count); |
| | | Item tempItem = new Item(item.ItemID, item.Count, _useType: item.BeautyEx + 1); |
| | | showItems.Add(tempItem); |
| | | } |
| | | ItemLogicUtility.Instance.ShowGetItem(showItems); |
| | | ItemLogicUtility.Instance.ShowGetItem(showItems, isMergeItem: false); |
| | | } |
| | | |
| | | public class ItemInfo |
| | | { |
| | | public int ItemID { get; set; } |
| | | public int Count { get; set; } |
| | | public int BeautyEx { get; set; } |
| | | } |
| | | |
| | | public class ChallengeResultData |
| | |
| | | public int id; |
| | | public long countEx; |
| | | public int quality; |
| | | public int bind; //绑定 或者 拍卖 交易 |
| | | public int useType; //用途定义:0 无 1 预留 2 红颜增加 |
| | | |
| | | public Item(int _id, long _count) |
| | | { |
| | | this.id = _id; |
| | | this.quality = 0; |
| | | this.bind = 0; |
| | | this.useType = 0; |
| | | this.countEx = _count; |
| | | } |
| | | |
| | |
| | | { |
| | | this.id = _id; |
| | | this.quality = _quality; |
| | | this.bind = 0; |
| | | this.useType = 0; |
| | | this.countEx = _count; |
| | | } |
| | | |
| | | public Item(int _id, long _count, int _bind = 0, int _quality = 0) |
| | | public Item(int _id, long _count, int _useType = 0, int _quality = 0) |
| | | { |
| | | this.id = _id; |
| | | this.quality = _quality; |
| | | this.bind = _bind; |
| | | this.useType = _useType; |
| | | this.countEx = _count; |
| | | } |
| | | |
| | |
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | public class CommonGetItem : MonoBehaviour
|
| | | {
|
| | | [SerializeField] ItemCell itemCell;
|
| | | [SerializeField] TextEx txtItemName;
|
| | | [SerializeField] Image beautyExImg;
|
| | |
|
| | | public void Display(int itemID)
|
| | | public void Display(int itemID, int useType)
|
| | | {
|
| | | txtItemName.SetActive(ItemLogicUtility.Instance.isNameShow);
|
| | | if (!ItemLogicUtility.Instance.totalShowItems.ContainsKey(itemID))
|
| | |
|
| | | Int2 idInfo = new Int2(itemID, useType);
|
| | | if (!ItemLogicUtility.Instance.totalShowItems.ContainsKey(idInfo))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | var item = ItemLogicUtility.Instance.totalShowItems[itemID];
|
| | | var item = ItemLogicUtility.Instance.totalShowItems[idInfo];
|
| | | itemCell.Init(new ItemCellModel(itemID, false, item.countEx));
|
| | | txtItemName.text = ItemConfig.Get(itemID).ItemName;
|
| | | itemCell.button.SetListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemID);
|
| | | });
|
| | |
|
| | | beautyExImg.SetActive(item.useType == 2);
|
| | | }
|
| | | }
|
| | |
| | | if (index + i < showItems.Count)
|
| | | {
|
| | | int itemId = showItems[index + i].id;
|
| | | commonGetItems[i].Display(itemId);
|
| | | commonGetItems[i].Display(itemId, showItems[index + i].useType);
|
| | | commonGetItems[i].SetActive(true);
|
| | | }
|
| | | else
|
| | |
| | | public bool isNameShow { get; private set; } // 是否展示物品名字
|
| | |
|
| | | // 如果同时有多种奖励封包,同一个事件归集,不同事件直接顶掉显示最新
|
| | | public Dictionary<int, Item> totalShowItems = new Dictionary<int, Item>();
|
| | | public Dictionary<Int2, Item> totalShowItems = new Dictionary<Int2, Item>(); //Int2 物品ID+useType
|
| | | public event Action OnGetItemShowEvent;
|
| | | private string getItemEventName;
|
| | | public string sourceTip; //领奖原因
|
| | |
|
| | |
|
| | | // isMergeItem 是否合并相同ID的物品 默认合并
|
| | | // 通用显示获得的物品
|
| | | public void ShowGetItem(List<Item> items, string eventName = "default", bool isNameShow = true)
|
| | | public void ShowGetItem(List<Item> items, string eventName = "default", bool isNameShow = true, bool isMergeItem = true)
|
| | | {
|
| | | if (getItemEventName != eventName)
|
| | | {
|
| | |
| | | for (int i = 0; i < items.Count; i++)
|
| | | {
|
| | | var id = items[i].id;
|
| | | if (totalShowItems.ContainsKey(id))
|
| | |
|
| | | var useType = isMergeItem ? 0 : items[i].useType;
|
| | | Int2 idInfo = new Int2(id, useType);
|
| | |
|
| | | if (totalShowItems.ContainsKey(idInfo))
|
| | | {
|
| | | totalShowItems[id] = new Item(id, items[i].countEx + totalShowItems[id].countEx, items[i].bind, items[i].quality);
|
| | | totalShowItems[idInfo] = new Item(id, items[i].countEx + totalShowItems[idInfo].countEx, useType, items[i].quality);
|
| | | }
|
| | | else
|
| | | {
|
| | | totalShowItems.Add(id, items[i]);
|
| | | totalShowItems.Add(idInfo, new Item(id, items[i].countEx, useType, items[i].quality));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | if (GeneralDefine.commonAwardTipDict.ContainsKey(eventName))
|
| | |
| | | }
|
| | |
|
| | | //可以指定打开的窗口
|
| | | public void ShowGetItemEx<T>(List<Item> items, string info = "", int seconds = 3, string btnName = "", Action func = null, bool isNameShow = true, string eventName = "default") where T : UIBase
|
| | | {
|
| | | if (getItemEventName != eventName)
|
| | | {
|
| | | if (UIManager.Instance.IsOpenedInList<T>())
|
| | | {
|
| | | //----------------------记得改立即关闭
|
| | | UIManager.Instance.CloseWindow<T>();
|
| | | }
|
| | | // public void ShowGetItemEx<T>(List<Item> items, string info = "", int seconds = 3, string btnName = "", Action func = null, bool isNameShow = true, string eventName = "default") where T : UIBase
|
| | | // {
|
| | | // if (getItemEventName != eventName)
|
| | | // {
|
| | | // if (UIManager.Instance.IsOpenedInList<T>())
|
| | | // {
|
| | | // //----------------------记得改立即关闭
|
| | | // UIManager.Instance.CloseWindow<T>();
|
| | | // }
|
| | |
|
| | | totalShowItems.Clear();
|
| | | getItemEventName = eventName;
|
| | | }
|
| | | // totalShowItems.Clear();
|
| | | // getItemEventName = eventName;
|
| | | // }
|
| | |
|
| | | //相同ID 合并数量显示
|
| | | for (int i = 0; i < items.Count; i++)
|
| | | {
|
| | | var id = items[i].id;
|
| | | if (totalShowItems.ContainsKey(id))
|
| | | {
|
| | | totalShowItems[id] = new Item(id, items[i].countEx + totalShowItems[id].countEx, items[i].bind, items[i].quality);
|
| | | }
|
| | | else
|
| | | {
|
| | | totalShowItems.Add(id, items[i]);
|
| | | }
|
| | | }
|
| | | // //相同ID 合并数量显示
|
| | | // for (int i = 0; i < items.Count; i++)
|
| | | // {
|
| | | // var id = items[i].id;
|
| | | // if (totalShowItems.ContainsKey(id))
|
| | | // {
|
| | | // totalShowItems[id] = new Item(id, items[i].countEx + totalShowItems[id].countEx, items[i].useType, items[i].quality);
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // totalShowItems.Add(id, items[i]);
|
| | | // }
|
| | | // }
|
| | |
|
| | |
|
| | | getItemInfo = info;
|
| | | OnGetItem = func;
|
| | | if (btnName == "")
|
| | | btnName = Language.Get("PopConfirmWin_OK");
|
| | | getItemBtnText = btnName;
|
| | | closeSeconds = seconds;
|
| | | this.isNameShow = isNameShow;
|
| | | OnGetItemShowEvent?.Invoke();
|
| | | if (!UIManager.Instance.IsOpenedInList<T>())
|
| | | {
|
| | | UIManager.Instance.OpenWindow<T>();
|
| | | }
|
| | | // getItemInfo = info;
|
| | | // OnGetItem = func;
|
| | | // if (btnName == "")
|
| | | // btnName = Language.Get("PopConfirmWin_OK");
|
| | | // getItemBtnText = btnName;
|
| | | // closeSeconds = seconds;
|
| | | // this.isNameShow = isNameShow;
|
| | | // OnGetItemShowEvent?.Invoke();
|
| | | // if (!UIManager.Instance.IsOpenedInList<T>())
|
| | | // {
|
| | | // UIManager.Instance.OpenWindow<T>();
|
| | | // }
|
| | |
|
| | | ShowHeroLHWin(items);//有传奇以上英雄显示立绘
|
| | | }
|
| | | // ShowHeroLHWin(items);//有传奇以上英雄显示立绘
|
| | | // }
|
| | | public void ClearGetItem()
|
| | | {
|
| | | //不清理物品,下次收到数据会自动清理,只改事件方便打开界面测试
|
| | |
| | | if (config.DailyBootyUpperList[i][0] == itemID) |
| | | { |
| | | maxValue = config.DailyBootyUpperList[i][1]; |
| | | if (maxValue < 1000000000) |
| | | { |
| | | maxValue += (int)(maxValue * (BeautyMMManager.Instance.GetTalentEffectByType(TalentEffectType.MainLine) *1f/100)); |
| | | } |
| | | break; |
| | | } |
| | | } |