备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
public interface IUIRedPoint
{
public void SetRedPointState(bool state)
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 127da98406a892041a5bd1d59d3607f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,100 @@
using asap.core;
using System.Collections.Generic;
using System.Linq;
public class RedPointManager
{
private static RedPointManager instance;
public static RedPointManager Instance
{
get
{
if (instance == null)
{
instance = new RedPointManager();
}
return instance;
}
}
public void Init()
{
redPointDic.Clear();
redPointStateDic.Clear();
redPointCountDic.Clear();
}
Dictionary<string, IUIRedPoint> redPointDic = new Dictionary<string, IUIRedPoint>();
Dictionary<string, Dictionary<string, bool>> redPointStateDic = new Dictionary<string, Dictionary<string, bool>>();
Dictionary<string, int> redPointCountDic = new Dictionary<string, int>();
public void AddRedPoint(string key, IUIRedPoint uiRedPoint)
{
if (redPointDic.ContainsKey(key))
{
GameDebug.LogWarning("key is already exist");
}
redPointDic[key] = uiRedPoint;
}
public void RemoveRedPoint(string key)
{
if (!redPointDic.ContainsKey(key))
{
GameDebug.LogWarning("key is not exist");
return;
}
redPointDic.Remove(key);
}
public bool GetRedPointState(string key)
{
if (!redPointStateDic.ContainsKey(key))
{
return false;
}
return redPointStateDic[key].Values.Contains(true);
}
public int GetRedPointCount(string key)
{
if (!redPointCountDic.ContainsKey(key))
{
return 0;
}
return redPointCountDic[key];
}
public void SetRedPointState(string key, bool state, int count = 0)
{
if (string.IsNullOrEmpty(key))
{
GameDebug.LogError("key is null");
return;
}
redPointCountDic[key] = count;
if (!redPointStateDic.ContainsKey(key))
{
redPointStateDic[key] = new Dictionary<string, bool>();
}
redPointStateDic[key][key] = state;
if (redPointDic.ContainsKey(key))
{
redPointDic[key].SetRedPointState(GetRedPointState(key));
}
string[] keys = key.Split('.');
if (keys.Length > 1)
{
string parentKey = keys[0];
for (int i = 0; i < keys.Length - 1; i++)
{
if (!redPointStateDic.ContainsKey(parentKey))
{
redPointStateDic[parentKey] = new Dictionary<string, bool>();
}
redPointStateDic[parentKey][parentKey] = state;
redPointStateDic[parentKey][parentKey + "." + keys[i + 1]] = state;
if (redPointDic.ContainsKey(parentKey))
{
redPointDic[parentKey].SetRedPointState(GetRedPointState(parentKey));
}
parentKey += "." + keys[i + 1];
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e3172267461eb6740a515ba87e6a1d0d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
public struct RedPointName
{
public const string Home_Rod = "Home.Rod";
public const string Home_Task = "Home.Task";
public const string Home_BattlePass= "Home.BattlePass";
public const string Home_BattlePass_Task= "Home.BattlePass.Task";
public const string Home_BattlePass_Reward= "Home.BattlePass.Reward";
public const string Home_Turntable = "Home.Turntable";
public const string Home_Showdown = "Home.Showdown";
//public const string RodUp = "RodUp";
//public const string RodLevelUp = "RodLevelUp";
public const string RedPeak_Btn = "RedPeak.Btn";
public const string Home_Gift2 = "Home.Gift2";
public const string Home_Album = "Home.Album";
public const string Home_Map = "Home.Map";
public const string Home_Album_New = "Home.Album.New";
public const string Home_Album_ID = "Home.Album.ID";
public const string Home_Album_Exchange = "Home.Album.Exchange";
public const string Home_Build = "Home.Build";
public const string Home_Skyscraper = "Home.Skyscraper";
public const string Home_Shop_Item = "Home.Shop.Item";
public const string Home_Welfare_FishCard= "Home.Welfare.FishCard";
public const string Home_Welfare_DailyPack= "Home.Welfare.DailyPack";
public const string Home_Welfare_ChainPack= "Home.Welfare.ChainPack";
public const string Home_Welfare_MonthCard = "Home.Welfare.MonthCard";
public const string ApplyList = "ApplyList";
public const string Home_Club = "Home.Social.Club";
public const string HomeShopItemShop="Home.Shop.ItemShop";
public const string HomeShopDiamondShop = "Home.Shop.DiamondShop";
public const string Unread_Mail = "menu.unread_mail";
public const string AIHelp_Msg = "menu.setting.aihelp_msg";
public const string Setting = "menu.setting";
public const string Announcement = "menu.ann";
public const string Home_Washing = "Home.Washing";
public const string Home_Invite = "Home.Social.Friend.Invite";
public const string Home_Friend_Add = "Home.Social.Friend.Add";
public const string Home_Potion = "Home.Potion";
public const string Home_Pinball = "Home.Pinball";
public const string Home_ScratchTicket = "Home.ScratchTicket";
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f0dbf7e45d1d1aa45a125a968ffc6058
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,98 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UIRedPoint : MonoBehaviour, IUIRedPoint
{
public string key;
public Image image;
public GameObject redPoint;
public GameObject redpoint_big;
public TMP_Text text_redpoint_big;
private void Awake()
{
if (string.IsNullOrEmpty(key))
{
return;
}
RedPointManager.Instance.AddRedPoint(key, this);
}
public void SetKey(string _key)
{
if (!string.IsNullOrEmpty(key))
{
RedPointManager.Instance.RemoveRedPoint(key);
}
key = _key;
RedPointManager.Instance.AddRedPoint(key, this);
if (redPoint != null)
{
redPoint.SetActive(RedPointManager.Instance.GetRedPointState(key));
}
if (image != null)
{
image.enabled = RedPointManager.Instance.GetRedPointState(key);
}
}
private void OnEnable()
{
if (string.IsNullOrEmpty(key))
{
return;
}
SetRedPointState(RedPointManager.Instance.GetRedPointState(key));
}
public void SetRedPointState(bool state)
{
if (string.IsNullOrEmpty(key))
{
return;
}
if (redpoint_big != null && text_redpoint_big != null)
{
if (!state)
{
redpoint_big.SetActive(false);
}
else
{
int count = RedPointManager.Instance.GetRedPointCount(key);
if (count > 1)
{
redpoint_big.SetActive(true);
if (count > 99)
{
text_redpoint_big.text = "99+";
}
else
{
text_redpoint_big.text = count.ToString();
}
state = false;
}
else
{
redpoint_big.SetActive(false);
}
}
}
if (redPoint != null)
{
redPoint.SetActive(state);
}
if (image != null)
{
image.enabled = state;
}
}
private void OnDestroy()
{
if (string.IsNullOrEmpty(key))
{
return;
}
RedPointManager.Instance.RemoveRedPoint(key);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4b275ee1a78100b47914f35d0170cc56
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: