1 文件已重命名
9个文件已修改
1个文件已删除
5 文件已复制
6个文件已添加
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | |
| | | /// <summary> |
| | | /// 支持渐变效果的文本组件 |
| | | /// </summary> |
| | | public class GradientText : Text |
| | | { |
| | | [Header("渐变设置")] |
| | | [SerializeField] |
| | | private GradientType m_GradientType = GradientType.Horizontal; |
| | | |
| | | [SerializeField] |
| | | private Color m_TopLeftColor = Color.white; |
| | | |
| | | [SerializeField] |
| | | private Color m_TopRightColor = Color.white; |
| | | |
| | | [SerializeField] |
| | | private Color m_BottomLeftColor = Color.white; |
| | | |
| | | [SerializeField] |
| | | private Color m_BottomRightColor = Color.white; |
| | | |
| | | [SerializeField] |
| | | private bool m_UseGradient = true; |
| | | |
| | | public enum GradientType |
| | | { |
| | | Horizontal, // 水平渐变 |
| | | Vertical, // 垂直渐变 |
| | | Diagonal, // 对角线渐变 |
| | | Radial, // 径向渐变 |
| | | Custom // 自定义四角颜色 |
| | | } |
| | | |
| | | public GradientType gradientType |
| | | { |
| | | get { return m_GradientType; } |
| | | set |
| | | { |
| | | if (m_GradientType != value) |
| | | { |
| | | m_GradientType = value; |
| | | SetVerticesDirty(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Color topLeftColor |
| | | { |
| | | get { return m_TopLeftColor; } |
| | | set |
| | | { |
| | | if (m_TopLeftColor != value) |
| | | { |
| | | m_TopLeftColor = value; |
| | | SetVerticesDirty(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Color topRightColor |
| | | { |
| | | get { return m_TopRightColor; } |
| | | set |
| | | { |
| | | if (m_TopRightColor != value) |
| | | { |
| | | m_TopRightColor = value; |
| | | SetVerticesDirty(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Color bottomLeftColor |
| | | { |
| | | get { return m_BottomLeftColor; } |
| | | set |
| | | { |
| | | if (m_BottomLeftColor != value) |
| | | { |
| | | m_BottomLeftColor = value; |
| | | SetVerticesDirty(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Color bottomRightColor |
| | | { |
| | | get { return m_BottomRightColor; } |
| | | set |
| | | { |
| | | if (m_BottomRightColor != value) |
| | | { |
| | | m_BottomRightColor = value; |
| | | SetVerticesDirty(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public bool useGradient |
| | | { |
| | | get { return m_UseGradient; } |
| | | set |
| | | { |
| | | if (m_UseGradient != value) |
| | | { |
| | | m_UseGradient = value; |
| | | SetVerticesDirty(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置水平渐变颜色 |
| | | /// </summary> |
| | | public void SetHorizontalGradient(Color leftColor, Color rightColor) |
| | | { |
| | | m_GradientType = GradientType.Horizontal; |
| | | m_TopLeftColor = leftColor; |
| | | m_BottomLeftColor = leftColor; |
| | | m_TopRightColor = rightColor; |
| | | m_BottomRightColor = rightColor; |
| | | SetVerticesDirty(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置垂直渐变颜色 |
| | | /// </summary> |
| | | public void SetVerticalGradient(Color topColor, Color bottomColor) |
| | | { |
| | | m_GradientType = GradientType.Vertical; |
| | | m_TopLeftColor = topColor; |
| | | m_TopRightColor = topColor; |
| | | m_BottomLeftColor = bottomColor; |
| | | m_BottomRightColor = bottomColor; |
| | | SetVerticesDirty(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置对角线渐变颜色 |
| | | /// </summary> |
| | | public void SetDiagonalGradient(Color topLeftColor, Color bottomRightColor) |
| | | { |
| | | m_GradientType = GradientType.Diagonal; |
| | | m_TopLeftColor = topLeftColor; |
| | | m_BottomRightColor = bottomRightColor; |
| | | |
| | | // 计算中间颜色 |
| | | m_TopRightColor = Color.Lerp(topLeftColor, bottomRightColor, 0.5f); |
| | | m_BottomLeftColor = Color.Lerp(topLeftColor, bottomRightColor, 0.5f); |
| | | SetVerticesDirty(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置径向渐变颜色 |
| | | /// </summary> |
| | | public void SetRadialGradient(Color centerColor, Color edgeColor) |
| | | { |
| | | m_GradientType = GradientType.Radial; |
| | | m_TopLeftColor = edgeColor; |
| | | m_TopRightColor = edgeColor; |
| | | m_BottomLeftColor = edgeColor; |
| | | m_BottomRightColor = edgeColor; |
| | | // 径向渐变需要在顶点着色器中处理 |
| | | SetVerticesDirty(); |
| | | } |
| | | |
| | | protected override void OnPopulateMesh(VertexHelper vh) |
| | | { |
| | | base.OnPopulateMesh(vh); |
| | | |
| | | if (!m_UseGradient) |
| | | return; |
| | | |
| | | if (!IsActive()) |
| | | return; |
| | | |
| | | // 获取顶点数据 |
| | | var vertexCount = vh.currentVertCount; |
| | | if (vertexCount == 0) |
| | | return; |
| | | |
| | | // 计算文本的边界框 |
| | | var vertices = new List<UIVertex>(); |
| | | vh.GetUIVertexStream(vertices); |
| | | |
| | | var bounds = new Bounds(vertices[0].position, Vector3.zero); |
| | | for (int i = 1; i < vertices.Count; i++) |
| | | { |
| | | bounds.Encapsulate(vertices[i].position); |
| | | } |
| | | |
| | | // 应用渐变颜色 |
| | | for (int i = 0; i < vertices.Count; i++) |
| | | { |
| | | var vertex = vertices[i]; |
| | | var pos = vertex.position; |
| | | |
| | | // 计算相对于边界框的归一化坐标 |
| | | var normalizedX = (pos.x - bounds.min.x) / bounds.size.x; |
| | | var normalizedY = (pos.y - bounds.min.y) / bounds.size.y; |
| | | |
| | | Color color = CalculateGradientColor(normalizedX, normalizedY); |
| | | vertex.color = color; |
| | | |
| | | vertices[i] = vertex; |
| | | } |
| | | |
| | | vh.Clear(); |
| | | vh.AddUIVertexTriangleStream(vertices); |
| | | } |
| | | |
| | | private Color CalculateGradientColor(float x, float y) |
| | | { |
| | | switch (m_GradientType) |
| | | { |
| | | case GradientType.Horizontal: |
| | | return Color.Lerp(m_TopLeftColor, m_TopRightColor, x); |
| | | |
| | | case GradientType.Vertical: |
| | | return Color.Lerp(m_TopLeftColor, m_BottomLeftColor, y); |
| | | |
| | | case GradientType.Diagonal: |
| | | return Color.Lerp(m_TopLeftColor, m_BottomRightColor, (x + y) * 0.5f); |
| | | |
| | | case GradientType.Radial: |
| | | var center = new Vector2(0.5f, 0.5f); |
| | | var distance = Vector2.Distance(new Vector2(x, y), center); |
| | | return Color.Lerp(m_TopLeftColor, m_BottomRightColor, distance * 2f); |
| | | |
| | | case GradientType.Custom: |
| | | // 双线性插值 |
| | | var topColor = Color.Lerp(m_TopLeftColor, m_TopRightColor, x); |
| | | var bottomColor = Color.Lerp(m_BottomLeftColor, m_BottomRightColor, x); |
| | | return Color.Lerp(topColor, bottomColor, y); |
| | | |
| | | default: |
| | | return color; |
| | | } |
| | | } |
| | | |
| | | protected override void Awake() |
| | | { |
| | | base.Awake(); |
| | | |
| | | // 设置默认颜色 |
| | | if (m_TopLeftColor == Color.white && m_TopRightColor == Color.white && |
| | | m_BottomLeftColor == Color.white && m_BottomRightColor == Color.white) |
| | | { |
| | | // 设置默认的渐变颜色 |
| | | m_TopLeftColor = Color.red; |
| | | m_TopRightColor = Color.blue; |
| | | m_BottomLeftColor = Color.green; |
| | | m_BottomRightColor = Color.yellow; |
| | | } |
| | | } |
| | | } |
copy from Main/Component/UI/Core/OutlineColor.cs.meta
copy to Main/Component/UI/Core/GradientText.cs.meta
| File was copied from Main/Component/UI/Core/OutlineColor.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 73475911b65888b44a39a57cca0bcac3 |
| | | guid: 9a20b8661160f064e9c0f1c76e41a05e |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2025年8月5日
|
| | | // [ Date ]: 2025年11月9日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public int GainGold;
|
| | | public int GainGoldPaper;
|
| | | public int FirstGoldPaperPrize;
|
| | | public string GainItemList;
|
| | | public int[][] GainItemList;
|
| | | public int[][] SelectItemInfo;
|
| | | public string Icon;
|
| | | public int PayType;
|
| | |
| | |
|
| | | int.TryParse(tables[10],out FirstGoldPaperPrize);
|
| | |
|
| | | GainItemList = tables[11];
|
| | | GainItemList = JsonMapper.ToObject<int[][]>(tables[11].Replace("(", "[").Replace(")", "]")); |
| | |
|
| | | SelectItemInfo = JsonMapper.ToObject<int[][]>(tables[12].Replace("(", "[").Replace(")", "]"));
|
| | |
|
| New file |
| | |
| | | using System; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | public class BattlePassBaseCell : CellView |
| | | { |
| | | [SerializeField] Image bg; |
| | | [SerializeField] Image word; |
| | | [SerializeField] RedpointBehaviour redPoint; |
| | | [SerializeField] Button btn; |
| | | |
| | | |
| | | |
| | | public void Display(int type) |
| | | { |
| | | bg.SetSprite("BattlePassBG" + type); |
| | | word.SetSprite("BattlePassWord" + type); |
| | | redPoint.redpointId = MainRedDot.RedPoint_FundKey * 100 + type; |
| | | btn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<BattlePassCommonWin>(type); |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| File was renamed from Main/Component/UI/Core/OutlineColor.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 73475911b65888b44a39a57cca0bcac3 |
| | | guid: 2e63901b40440a649acfb3f7757bbd02 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| New file |
| | |
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | //基金入口
|
| | | public class BattlePassBaseWin : UIBase
|
| | | {
|
| | | [SerializeField] ScrollerController scroller;
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | scroller.OnRefreshCell += OnRefreshCell;
|
| | | CreateScroller();
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | scroller.OnRefreshCell -= OnRefreshCell;
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | void CreateScroller()
|
| | | {
|
| | | scroller.Refresh();
|
| | | foreach(var type in BattlePassManager.Instance.battlePassTypeSortList)
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen(BattlePassManager.Instance.typeToFuncIDDict[type]))
|
| | | {
|
| | | continue;
|
| | | }
|
| | | scroller.AddCell(ScrollerDataType.Header, type);
|
| | | }
|
| | | scroller.Restart();
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | void OnRefreshCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | var _cell = cell as BattlePassBaseCell;
|
| | | _cell.Display(cell.index);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
copy from Main/Component/UI/Core/OutlineColor.cs.meta
copy to Main/System/BattlePass/BattlePassBaseWin.cs.meta
| File was copied from Main/Component/UI/Core/OutlineColor.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 73475911b65888b44a39a57cca0bcac3 |
| | | guid: 99d1228c0c974fc488759c06716cb89c |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| New file |
| | |
| | | using System; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | public class BattlePassCommonCell : CellView |
| | | { |
| | | [SerializeField] ItemCell baseAward; |
| | | [SerializeField] Transform baseGotRect; |
| | | [SerializeField] Transform baseCanGetAwardRect; |
| | | [SerializeField] Transform upProcssBGRect; |
| | | [SerializeField] Transform upProcessRect; |
| | | [SerializeField] Transform downProcssBGRect; |
| | | [SerializeField] Transform downProcessRect; |
| | | [SerializeField] Text valueText; |
| | | [SerializeField] ItemCell[] betterAwards; |
| | | [SerializeField] Transform[] betterGotRects; |
| | | [SerializeField] Transform[] betterCanGetAwardRects; |
| | | [SerializeField] Transform[] betterLockRects; |
| | | |
| | | [SerializeField] Transform mask; |
| | | |
| | | int bpID; |
| | | public void Display(int id, BattlePassData battlePassData) |
| | | { |
| | | bpID = id; |
| | | var config = ZhanlingConfig.Get(id); |
| | | int freeItemID = config.FreeRewardItemList[0][0]; |
| | | baseAward.Init(new ItemCellModel(freeItemID, false, config.FreeRewardItemList[0][1])); |
| | | var totalValue = BattlePassManager.Instance.GetTotalValue(config.ZhanlingType); |
| | | var baseAwardState = BattlePassManager.Instance.GetBPCellAwardState(battlePassData, totalValue, config.NeedValue, 0); |
| | | baseAward.button.AddListener(() => |
| | | { |
| | | GetAward(battlePassData, baseAwardState, freeItemID); |
| | | }); |
| | | |
| | | |
| | | baseGotRect.SetActive(baseAwardState == 2); |
| | | baseCanGetAwardRect.SetActive(baseAwardState == 1); |
| | | mask.SetActive(baseAwardState == 0); |
| | | |
| | | var ids = ZhanlingConfig.GetTypeToIDDict(config.ZhanlingType).Values.ToList(); |
| | | ids.Sort(); |
| | | upProcssBGRect.SetActive(ids[0] != id); |
| | | upProcessRect.SetActive(baseAwardState != 0); |
| | | |
| | | downProcssBGRect.SetActive(ids[ids.Count - 1] != id); |
| | | var nextConfig = ZhanlingConfig.Get(id + 1); |
| | | if (nextConfig != null) |
| | | { |
| | | downProcessRect.SetActive(totalValue >= nextConfig.NeedValue); |
| | | } |
| | | else |
| | | { |
| | | downProcessRect.SetActive(false); |
| | | } |
| | | |
| | | if (config.ZhanlingType == (int)BattlePassType.MainLine) |
| | | { |
| | | |
| | | valueText.text = config.NeedValue/100 + "-" + config.NeedValue%100; |
| | | } |
| | | else |
| | | { |
| | | valueText.text = config.NeedValue.ToString(); |
| | | } |
| | | |
| | | var betterAwardState = BattlePassManager.Instance.GetBPCellAwardState(battlePassData, totalValue, config.NeedValue, 1); |
| | | for (int i = 0; i < betterAwards.Length; i++) |
| | | { |
| | | int itemID = config.ZLRewardItemList[i][0]; |
| | | betterAwards[i].Init(new ItemCellModel(itemID, false, config.ZLRewardItemList[i][1])); |
| | | betterAwards[i].button.AddListener(() => |
| | | { |
| | | GetAward(battlePassData, betterAwardState, itemID); |
| | | }); |
| | | betterGotRects[i].SetActive(betterAwardState == 2); |
| | | betterCanGetAwardRects[i].SetActive(betterAwardState == 1); |
| | | betterLockRects[i].SetActive(battlePassData.isActivite == 0); |
| | | } |
| | | } |
| | | |
| | | void GetAward(BattlePassData battlePassData, int awardState, int itemID) |
| | | { |
| | | if (awardState != 1) |
| | | { |
| | | ItemTipUtility.Show(itemID); |
| | | return; |
| | | } |
| | | var config = ZhanlingConfig.Get(bpID); |
| | | var totalValue = BattlePassManager.Instance.GetTotalValue(config.ZhanlingType); |
| | | BattlePassManager.Instance.GetAllAward(battlePassData, config.ZhanlingType, totalValue); |
| | | } |
| | | } |
| | | |
| | | |
copy from Main/Component/UI/Core/OutlineColor.cs.meta
copy to Main/System/BattlePass/BattlePassCommonCell.cs.meta
| File was copied from Main/Component/UI/Core/OutlineColor.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 73475911b65888b44a39a57cca0bcac3 |
| | | guid: e29202cc898b4164e962fff7c1737ee7 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| New file |
| | |
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | //通用战令
|
| | | public class BattlePassCommonWin : UIBase
|
| | | {
|
| | | [SerializeField] Text titleText;
|
| | | [SerializeField] Text welfarePerText; //福利百分比 |
| | | [SerializeField] Text itemNameText; //额外奖励
|
| | | [SerializeField] Text totalActivityText;
|
| | | [SerializeField] Text tabNameText;
|
| | | [SerializeField] Transform lockRect;
|
| | | [SerializeField] ScrollerController scroller;
|
| | | [SerializeField] Transform rechargeRect;
|
| | | [SerializeField] ItemCell itemCell;
|
| | | [SerializeField] Button buyBtn;
|
| | | [SerializeField] Text buyText;
|
| | |
|
| | | BattlePassData battlePassData;
|
| | |
|
| | | int battlePasstype;
|
| | |
|
| | | protected override void InitComponent()
|
| | | {
|
| | | buyBtn.AddListener(() =>
|
| | | {
|
| | | RechargeManager.Instance.CTG(BattlePassManager.Instance.GetCTGIDByType(battlePasstype));
|
| | | });
|
| | | }
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | battlePasstype = functionOrder;
|
| | | battlePassData = BattlePassManager.Instance.GetBattlePassData(battlePasstype);
|
| | | if (battlePassData == null) return;
|
| | | scroller.OnRefreshCell += OnRefreshCell;
|
| | | BattlePassManager.Instance.BattlePassDataUpdateEvent += BattlePassDataUpdateEvent;
|
| | | PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataRefresh;
|
| | | BlessLVManager.Instance.OnBlessLVUpdateEvent += OnBlessLVUpdateEvent;
|
| | | CreateScroller();
|
| | | ShowStaticUI();
|
| | | Display();
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | scroller.OnRefreshCell -= OnRefreshCell;
|
| | | BattlePassManager.Instance.BattlePassDataUpdateEvent -= BattlePassDataUpdateEvent;
|
| | | PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataRefresh;
|
| | | BlessLVManager.Instance.OnBlessLVUpdateEvent -= OnBlessLVUpdateEvent;
|
| | |
|
| | | }
|
| | |
|
| | | void OnPlayerDataRefresh(PlayerDataType type)
|
| | | {
|
| | | if (type == PlayerDataType.LV || type == PlayerDataType.ExAttr1)
|
| | | {
|
| | | Display();
|
| | | }
|
| | | }
|
| | |
|
| | | void OnBlessLVUpdateEvent()
|
| | | {
|
| | | Display();
|
| | | }
|
| | |
|
| | |
|
| | | void BattlePassDataUpdateEvent(int type)
|
| | | {
|
| | | if (type == battlePasstype)
|
| | | {
|
| | | Display();
|
| | | }
|
| | | }
|
| | |
|
| | | void ShowStaticUI()
|
| | | {
|
| | | var ctgID = BattlePassManager.Instance.GetCTGIDByType(battlePasstype);
|
| | | var config = CTGConfig.Get(ctgID);
|
| | | welfarePerText.text = config.Percentage + "%";
|
| | | if (!config.GainItemList.IsNullOrEmpty() && config.GainItemList.Length >= 2)
|
| | | {
|
| | | //约定第二个物品
|
| | | itemNameText.text = Language.Get("BattlePass8", config.GainItemList[1][1], ItemConfig.Get(config.GainItemList[1][0]).ItemName);
|
| | | }
|
| | |
|
| | | tabNameText.text = Language.Get("BattlePassTab" + battlePasstype);
|
| | | titleText.text = Language.Get("BattlePassTitle" + battlePasstype);
|
| | | }
|
| | |
|
| | |
|
| | | void Display()
|
| | | {
|
| | | ShowTotalValueStr();
|
| | |
|
| | | lockRect.SetActive(battlePassData.isActivite == 0);
|
| | | scroller.m_Scorller.RefreshActiveCellViews();
|
| | |
|
| | | if (battlePassData.isActivite == 0)
|
| | | {
|
| | | rechargeRect.SetActive(true);
|
| | | var ctgID = BattlePassManager.Instance.GetCTGIDByType(battlePasstype);
|
| | | RechargeManager.Instance.TryGetOrderInfo(ctgID, out var orderInfoConfig);
|
| | | buyText.text = Language.Get("PayMoneyNum", orderInfoConfig.PayRMBNumOnSale);
|
| | |
|
| | | var config = CTGConfig.Get(ctgID);
|
| | | //约定第一个武将物品
|
| | | int itemID = config.GainItemList[0][0];
|
| | | itemCell.Init(new ItemCellModel(itemID, false, config.GainItemList[0][1]));
|
| | | itemCell.button.AddListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemID);
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | rechargeRect.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | void ShowTotalValueStr()
|
| | | {
|
| | | var totalValue = BattlePassManager.Instance.GetTotalValue(battlePasstype);
|
| | | switch ((BattlePassType)battlePasstype)
|
| | | {
|
| | | case BattlePassType.LV:
|
| | | case BattlePassType.BlessLV:
|
| | | case BattlePassType.GuBao:
|
| | | case BattlePassType.Arena:
|
| | | {
|
| | | totalActivityText.text = Language.Get("BattlePassValue" + battlePasstype, totalValue);
|
| | | break;
|
| | | }
|
| | | case BattlePassType.MainLine:
|
| | | {
|
| | | totalActivityText.text = Language.Get("BattlePassValue3", totalValue / 100, totalValue % 100);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | void CreateScroller()
|
| | | {
|
| | | scroller.Refresh();
|
| | | var values = ZhanlingConfig.GetTypeToIDDict(battlePasstype).Values.ToList();
|
| | | values.Sort();
|
| | | for (int i = 0; i < values.Count; i++)
|
| | | {
|
| | | scroller.AddCell(ScrollerDataType.Header, values[i]);
|
| | | }
|
| | | scroller.Restart();
|
| | |
|
| | | var totalValue = BattlePassManager.Instance.GetTotalValue(battlePasstype);
|
| | | scroller.JumpIndex(BattlePassManager.Instance.JumpIndex(battlePassData, battlePasstype, totalValue));
|
| | | }
|
| | |
|
| | |
|
| | | void OnRefreshCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | var _cell = cell as BattlePassCommonCell;
|
| | | _cell.Display(cell.index, battlePassData);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
copy from Main/Component/UI/Core/OutlineColor.cs.meta
copy to Main/System/BattlePass/BattlePassCommonWin.cs.meta
| File was copied from Main/Component/UI/Core/OutlineColor.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 73475911b65888b44a39a57cca0bcac3 |
| | | guid: 9ccc81dd25c7a8c4e9fe71b015a3e955 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using System; |
| | | using System.Linq; |
| | | |
| | | //通用基金界面战令 |
| | | public partial class BattlePassManager : GameSystemManager<BattlePassManager> |
| | | { |
| | | |
| | | //战令类型:红点 通用基金界面 |
| | | Dictionary<int, Redpoint> redpointCommonDict = new Dictionary<int, Redpoint>(); |
| | | |
| | | //通用战令对应的功能id |
| | | public Dictionary<int, int> typeToFuncIDDict = new Dictionary<int, int>() |
| | | { |
| | | {1, 40}, |
| | | {2, 40}, |
| | | {3, 40}, |
| | | {4, 28}, |
| | | {5, 27}, |
| | | }; |
| | | |
| | | public int[] battlePassTypeSortList; |
| | | |
| | | |
| | | //1-主公等级;2-祝福等级;3-主线关卡;4-古宝数量;5-演武场次数; |
| | | void UpdateCommonBPRedpoint(int _type) |
| | | { |
| | | if (!redpointCommonDict.ContainsKey(_type)) |
| | | { |
| | | return; |
| | | } |
| | | if (!FuncOpen.Instance.IsFuncOpen(typeToFuncIDDict[_type])) |
| | | { |
| | | return; |
| | | } |
| | | redpointCommonDict[_type].state = RedPointState.None; |
| | | battlePassDataDict.TryGetValue(_type, out BattlePassData battlePassData); |
| | | if (battlePassData == null) return; |
| | | int totalValue = 0; |
| | | switch ((BattlePassType)_type) |
| | | { |
| | | case BattlePassType.LV: |
| | | { |
| | | totalValue = PlayerDatas.Instance.baseData.LV; |
| | | break; |
| | | } |
| | | case BattlePassType.BlessLV: |
| | | { |
| | | totalValue = BlessLVManager.Instance.m_TreeLV; |
| | | break; |
| | | } |
| | | case BattlePassType.MainLine: |
| | | { |
| | | totalValue = PlayerDatas.Instance.baseData.ExAttr1 / 100; |
| | | break; |
| | | } |
| | | case BattlePassType.GuBao: |
| | | { |
| | | totalValue = (int)battlePassData.value1; |
| | | break; |
| | | } |
| | | case BattlePassType.Arena: |
| | | { |
| | | totalValue = (int)battlePassData.value1; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (HasAnyAward(_type, totalValue)) |
| | | { |
| | | redpointCommonDict[_type].state = RedPointState.Simple; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
copy from Main/Component/UI/Core/OutlineColor.cs.meta
copy to Main/System/BattlePass/BattlePassManager.Common.cs.meta
| File was copied from Main/Component/UI/Core/OutlineColor.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 73475911b65888b44a39a57cca0bcac3 |
| | | guid: b1c1b8cb5fd4f9d42b87cdadae0dcce5 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | //周战令 |
| | | public partial class BattlePassManager : GameSystemManager<BattlePassManager> |
| | | { |
| | | public const int WeekBattlePassType = 6; |
| | | |
| | | Redpoint redpoint = new Redpoint(MainRedDot.RedPoint_DailyKey, MainRedDot.RedPoint_WeekBPFuncKey); |
| | | void UpdateWeekRedPoint() |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.DayMission)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | redpoint.state = RedPointState.None; |
| | | //购买,活跃 |
| | | battlePassDataDict.TryGetValue(WeekBattlePassType, out BattlePassData battlePassData); |
| | | battlePassDataDict.TryGetValue((int)BattlePassType.Week, out BattlePassData battlePassData); |
| | | if (battlePassData == null) return; |
| | | |
| | | |
| | | if (HasAnyAward(WeekBattlePassType, (int)battlePassData.value1)) |
| | | if (HasAnyAward((int)BattlePassType.Week, (int)battlePassData.value1)) |
| | | { |
| | | redpoint.state = RedPointState.Simple; |
| | | } |
| | |
| | | using UnityEngine; |
| | | using System; |
| | | using System.Linq; |
| | | using LitJson; |
| | | |
| | | |
| | | public partial class BattlePassManager : GameSystemManager<BattlePassManager> |
| | |
| | | Dictionary<int, BattlePassData> battlePassDataDict = new Dictionary<int, BattlePassData>(); |
| | | public event Action<int> BattlePassDataUpdateEvent; |
| | | |
| | | |
| | | Dictionary<int, int[]> buyZhanlingTypeDict = new Dictionary<int, int[]>(); |
| | | |
| | | |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; |
| | | PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataRefresh; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk; |
| | | BlessLVManager.Instance.OnBlessLVUpdateEvent += OnBlessLVUpdateEvent; |
| | | ParseConfig(); |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize; |
| | | PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataRefresh; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk; |
| | | BlessLVManager.Instance.OnBlessLVUpdateEvent -= OnBlessLVUpdateEvent; |
| | | } |
| | | |
| | | void OnBeforePlayerDataInitialize() |
| | |
| | | { |
| | | var config = FuncConfigConfig.Get("Zhanling"); |
| | | buyZhanlingTypeDict = ConfigParse.ParseIntArrayDict(config.Numerical1); |
| | | battlePassTypeSortList = JsonMapper.ToObject<int[]>(config.Numerical5); |
| | | |
| | | foreach (var type in battlePassTypeSortList) |
| | | { |
| | | redpointCommonDict[type] = new Redpoint(MainRedDot.RedPoint_FundKey, MainRedDot.RedPoint_FundKey * 100 + type); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | HB120_tagMCZhanlingInfo.tagMCZhanling reward = netPack.RewardList[i]; |
| | | if (!battlePassData.battlePassCellDict.ContainsKey((int)reward.NeedValue)) |
| | | { |
| | | battlePassData.battlePassCellDict[(int)reward.NeedValue] = new BattlePassCell(); |
| | | battlePassData.battlePassCellDict[(int)reward.NeedValue] = new BattlePassAwardState(); |
| | | } |
| | | |
| | | BattlePassCell battlePassCell = battlePassData.battlePassCellDict[(int)reward.NeedValue]; |
| | | BattlePassAwardState battlePassCell = battlePassData.battlePassCellDict[(int)reward.NeedValue]; |
| | | battlePassCell.freeRewardState = reward.FreeRewardState; |
| | | battlePassCell.zlRewardState = reward.ZLRewardState; |
| | | battlePassCell.zlRewardStateH = reward.ZLRewardStateH; |
| | |
| | | BattlePassDataUpdateEvent?.Invoke(netPack.ZhanlingType); |
| | | } |
| | | |
| | | #region 红点 |
| | | |
| | | void UpdateRedpoint(int type) |
| | | void OnBlessLVUpdateEvent() |
| | | { |
| | | UpdateCommonBPRedpoint(2); |
| | | } |
| | | |
| | | void OnPlayerDataRefresh(PlayerDataType type) |
| | | { |
| | | switch (type) |
| | | { |
| | | case WeekBattlePassType: |
| | | case PlayerDataType.LV: |
| | | case PlayerDataType.ExAttr1: |
| | | { |
| | | UpdateCommonBPRedpoint(1); |
| | | UpdateCommonBPRedpoint(3); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void OnPlayerLoginOk() |
| | | { |
| | | foreach (var type in battlePassTypeSortList) |
| | | { |
| | | UpdateCommonBPRedpoint(type); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | void UpdateRedpoint(int type) |
| | | { |
| | | switch ((BattlePassType)type) |
| | | { |
| | | case BattlePassType.LV: |
| | | case BattlePassType.BlessLV: |
| | | case BattlePassType.MainLine: |
| | | case BattlePassType.GuBao: |
| | | case BattlePassType.Arena: |
| | | { |
| | | UpdateCommonBPRedpoint(type); |
| | | break; |
| | | } |
| | | case BattlePassType.Week: |
| | | { |
| | | UpdateWeekRedPoint(); |
| | | break; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | //是否有任何奖励可以领取 |
| | | public bool HasAnyAward(int type, int totalValue) |
| | | { |
| | |
| | | } |
| | | return index; |
| | | } |
| | | |
| | | //是否全部完成(奖励全领取) |
| | | public bool IsAllFinish(int type) |
| | | { |
| | | battlePassDataDict.TryGetValue(type, out BattlePassData battlePassData); |
| | | if (battlePassData == null) |
| | | return false; |
| | | if (battlePassData.allFinishTime != 0) |
| | | return true; |
| | | return false; |
| | | } |
| | | |
| | | public int GetTotalValue(int _type) |
| | | { |
| | | battlePassDataDict.TryGetValue(_type, out BattlePassData battlePassData); |
| | | switch ((BattlePassType)_type) |
| | | { |
| | | case BattlePassType.LV: |
| | | { |
| | | return PlayerDatas.Instance.baseData.LV; |
| | | } |
| | | case BattlePassType.BlessLV: |
| | | { |
| | | return BlessLVManager.Instance.m_TreeLV; |
| | | } |
| | | case BattlePassType.MainLine: |
| | | { |
| | | return PlayerDatas.Instance.baseData.ExAttr1 / 100; |
| | | } |
| | | case BattlePassType.GuBao: |
| | | { |
| | | return (int)battlePassData.value1; |
| | | } |
| | | case BattlePassType.Arena: |
| | | { |
| | | return (int)battlePassData.value1; |
| | | } |
| | | case BattlePassType.Week: |
| | | { |
| | | return (int)battlePassData.value1; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | public class BattlePassCell |
| | | public class BattlePassAwardState |
| | | { |
| | | public byte freeRewardState; // 免费战令奖励是否已领取 |
| | | public byte zlRewardState; // 普通战令奖励是否已领取 |
| | |
| | | public uint allFinishTime; // 全部奖励领取完毕的时间戳,未完毕时该值为0,后端会在0点过天时检查可否重置,前端自行做倒计时表现即可 |
| | | public uint value1; // 战令对应的自定义值,可选,如登录战令代表开始计算日期时间戳 |
| | | |
| | | public Dictionary<int, BattlePassCell> battlePassCellDict = new Dictionary<int, BattlePassCell>(); |
| | | public Dictionary<int, BattlePassAwardState> battlePassCellDict = new Dictionary<int, BattlePassAwardState>(); |
| | | } |
| | | |
| | | public enum BattlePassType |
| | | { |
| | | LV = 1, //等级 |
| | | BlessLV = 2, //祝福等级 |
| | | MainLine = 3, //主线关卡 |
| | | GuBao = 4, //古宝 |
| | | Arena = 5, //演武场 |
| | | Week = 6, //周战令 |
| | | } |
| | |
| | | baseCanGetAwardRect.SetActive(baseAwardState == 1); |
| | | mask.SetActive(baseAwardState == 0); |
| | | |
| | | var ids = ZhanlingConfig.GetTypeToIDDict(BattlePassManager.WeekBattlePassType).Values.ToList(); |
| | | var ids = ZhanlingConfig.GetTypeToIDDict((int)BattlePassType.Week).Values.ToList(); |
| | | ids.Sort(); |
| | | upProcssBGRect.SetActive(ids[0] != id); |
| | | upProcessRect.SetActive(baseAwardState != 0); |
| | |
| | | return; |
| | | } |
| | | |
| | | BattlePassManager.Instance.GetAllAward(battlePassData, BattlePassManager.WeekBattlePassType, (int)battlePassData.value1); |
| | | BattlePassManager.Instance.GetAllAward(battlePassData, (int)BattlePassType.Week, (int)battlePassData.value1); |
| | | } |
| | | } |
| | | |
| | |
| | | {
|
| | | buyBtn.AddListener(() =>
|
| | | {
|
| | | RechargeManager.Instance.CTG(BattlePassManager.Instance.GetCTGIDByType(BattlePassManager.WeekBattlePassType));
|
| | | RechargeManager.Instance.CTG(BattlePassManager.Instance.GetCTGIDByType((int)BattlePassType.Week));
|
| | | });
|
| | | }
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | battlePassData = BattlePassManager.Instance.GetBattlePassData(BattlePassManager.WeekBattlePassType);
|
| | | battlePassData = BattlePassManager.Instance.GetBattlePassData((int)BattlePassType.Week);
|
| | | if (battlePassData == null) return;
|
| | | scroller.OnRefreshCell += OnRefreshCell;
|
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
|
| | |
| | |
|
| | | void BattlePassDataUpdateEvent(int type)
|
| | | {
|
| | | if (type == BattlePassManager.WeekBattlePassType)
|
| | | if (type == (int)BattlePassType.Week)
|
| | | {
|
| | | Display();
|
| | | }
|
| | |
| | |
|
| | | if (battlePassData.isActivite == 0)
|
| | | {
|
| | | var ctgID = BattlePassManager.Instance.GetCTGIDByType(BattlePassManager.WeekBattlePassType);
|
| | | var ctgID = BattlePassManager.Instance.GetCTGIDByType((int)BattlePassType.Week);
|
| | | RechargeManager.Instance.TryGetOrderInfo(ctgID, out var orderInfoConfig);
|
| | | buyText.text = Language.Get("PayMoneyNum", orderInfoConfig.PayRMBNumOnSale);
|
| | | buyBtn.SetInteractable(true);
|
| | |
| | | void CreateScroller()
|
| | | {
|
| | | scroller.Refresh();
|
| | | var values = ZhanlingConfig.GetTypeToIDDict(BattlePassManager.WeekBattlePassType).Values.ToList();
|
| | | var values = ZhanlingConfig.GetTypeToIDDict((int)BattlePassType.Week).Values.ToList();
|
| | | values.Sort();
|
| | | for (int i = 0; i < values.Count; i++)
|
| | | {
|
| | |
| | | }
|
| | | scroller.Restart();
|
| | |
|
| | | scroller.JumpIndex(BattlePassManager.Instance.JumpIndex(battlePassData, BattlePassManager.WeekBattlePassType, (int)battlePassData.value1));
|
| | | scroller.JumpIndex(BattlePassManager.Instance.JumpIndex(battlePassData, (int)BattlePassType.Week, (int)battlePassData.value1));
|
| | | }
|
| | |
|
| | |
|
| | |
| | | [SerializeField] Button storeBtn; |
| | | [SerializeField] Button monthCardBtn; |
| | | [SerializeField] Button dayMissionBtn; |
| | | [SerializeField] Button battlePassBtn; |
| | | |
| | | static string listenWindowName = ""; //监听关闭时再显示 |
| | | |
| | |
| | | ListenWindow("DayMissionBaseWin"); |
| | | UIManager.Instance.OpenWindow<DayMissionBaseWin>(); |
| | | }); |
| | | |
| | | battlePassBtn.AddListener(() => |
| | | { |
| | | //用于监听界面,打开时缩进右边功能栏,关闭时显示 |
| | | ListenWindow("BattlePassBaseWin"); |
| | | UIManager.Instance.OpenWindow<BattlePassBaseWin>(); |
| | | }); |
| | | } |
| | | |
| | | void ShowBtns() |
| | | { |
| | | storeBtn.SetActive(FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)); |
| | | dayMissionBtn.SetActive(FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.DayMission)); |
| | | battlePassBtn.SetActive(FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BattlePass)); |
| | | } |
| | | |
| | | |
| | |
| | | {
|
| | | #endif
|
| | | var ctg = CTGConfig.Get(configs[i].CTGID);
|
| | | var _itemArray = LitJson.JsonMapper.ToObject<int[][]>(ctg.GainItemList);
|
| | | var _itemArray = ctg.GainItemList;
|
| | | if (_itemArray != null && _itemArray.Length > 0)
|
| | | {
|
| | | var _itemList = new List<Item>();
|
| | |
| | | public const int RedPoint_WeekBPFuncKey = 1042; //周奖励(战令)
|
| | | public const int RedPoint_MainMissionKey = 1043; //主线任务奖励(成就)
|
| | |
|
| | |
|
| | | //基金(战令)
|
| | | public const int RedPoint_FundKey = 105;
|
| | | public Redpoint redPointFund = new Redpoint(RightFuncRedpoint, RedPoint_FundKey);
|
| | | //武将卡
|
| | | public const int HeroCardRedpoint = 200;
|
| | | public Redpoint HeroListRedpoint = new Redpoint(MainHerosRedpoint, HeroCardRedpoint);
|
| | |
| | | Chat = 19,//聊天 |
| | | AutoFight = 20,//自动战斗 |
| | | Recharge = 22,//充值 |
| | | BattlePass = 40, //基金(战令) |
| | | |
| | | } |
| | | |