284 lines
7.3 KiB
C#
284 lines
7.3 KiB
C#
/*
|
||
* @Author: 白哉
|
||
* @Description: 渲染更新管理器
|
||
* @Date: 2025年04月01日 星期二 11:04:52
|
||
* @Modify:
|
||
*/
|
||
|
||
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using RuntimeData;
|
||
|
||
namespace Logic
|
||
{
|
||
//用于存储battleRender信息
|
||
public struct BattleRenderDataPack
|
||
{
|
||
|
||
public UnitData A, B;
|
||
public UnitData[] splash;
|
||
public int dmgA, dmgB, hpA, hpB;
|
||
public bool counter;
|
||
}
|
||
|
||
|
||
public class RenderUpdateManager
|
||
{
|
||
List<int> unitRUList; //存储哪些UnitId需要UpdateRender
|
||
List<int> cityRUList; //存储需要更新的cityId
|
||
List<Vector2Int> tileRUList; //存储需要更新的tilepos,和city是区分开的
|
||
List<int> cityBuildingRUList; //存储需要更新building的cityId
|
||
List<int> playerTerritoryRUList; //存储需要更新领土的playerId
|
||
|
||
bool techTreeRU = false; //存储科技树是否需要刷新
|
||
bool playerTopBarRU = false; //存储是否需要更新topbar
|
||
bool centerMessageRU = false; //存储是否需要更新中央message
|
||
string centerMessageTitle; //存储中央messageTitle
|
||
string centerMessageContent; //存储中央messageContent
|
||
|
||
|
||
List<int> techIdRUList; //存储是否因为更新了科技而要更新别的什么,目前主要用于tilemap的Resource层的显示
|
||
int highlightMapRU = -1; //存储是否要更新highlightMap,-1表示不用更新,0表示消除
|
||
|
||
//特效渲染部分
|
||
List<Vector2Int> mistClearEffectRUList; //存储烟雾消散特效队列
|
||
|
||
//UI部分
|
||
List<int> cityUpgradeActionRUList; //存储city升级后弹出升级窗口的排队列表
|
||
|
||
public static RenderUpdateManager Instance { get; private set; }
|
||
|
||
public RenderUpdateManager() //创建单例
|
||
{
|
||
Instance = this;
|
||
unitRUList = new List<int>();
|
||
cityRUList = new List<int>();
|
||
tileRUList = new List<Vector2Int>();
|
||
cityBuildingRUList = new List<int>();
|
||
mistClearEffectRUList = new List<Vector2Int>();
|
||
cityUpgradeActionRUList = new List<int>();
|
||
techIdRUList = new List<int>();
|
||
}
|
||
|
||
public void ClearUnitRUList()
|
||
{
|
||
unitRUList.Clear();
|
||
}
|
||
|
||
public void AddUnitRUList(int unitId)
|
||
{
|
||
unitRUList.Add(unitId);
|
||
}
|
||
|
||
public List<int> GetUnitRUList()
|
||
{
|
||
return unitRUList;
|
||
}
|
||
|
||
public void ClearTileRUList()
|
||
{
|
||
tileRUList.Clear();
|
||
}
|
||
|
||
public void AddTileRUList(Vector2Int t)
|
||
{
|
||
tileRUList.Add(t);
|
||
}
|
||
|
||
public List<Vector2Int> GetTileRUList()
|
||
{
|
||
return tileRUList;
|
||
}
|
||
|
||
|
||
public void ClearTechTreeRU()
|
||
{
|
||
techTreeRU = false;
|
||
}
|
||
|
||
public void SetTechTreeRU()
|
||
{
|
||
techTreeRU = true;
|
||
}
|
||
|
||
public bool GetTechTreeRU()
|
||
{
|
||
return techTreeRU;
|
||
}
|
||
|
||
public void SetPlayerTopBarRU()
|
||
{
|
||
playerTopBarRU = true;
|
||
}
|
||
|
||
public void ClearPlayerTopBarRU()
|
||
{
|
||
playerTopBarRU = false;
|
||
}
|
||
|
||
public bool GetPlayerTopBarRU()
|
||
{
|
||
return playerTopBarRU;
|
||
}
|
||
|
||
public void SetCenterMessageRU(string title, string content)
|
||
{
|
||
centerMessageRU = true;
|
||
centerMessageTitle = title;
|
||
centerMessageContent = content;
|
||
}
|
||
|
||
public void ClearCenterMessageRU()
|
||
{
|
||
centerMessageRU = false;
|
||
}
|
||
|
||
public bool GetCenterMessageRU()
|
||
{
|
||
return centerMessageRU;
|
||
}
|
||
|
||
public string GetCenterMessageRUTitle()
|
||
{
|
||
return centerMessageTitle;
|
||
}
|
||
|
||
public string GetCenterMessageRUContent()
|
||
{
|
||
return centerMessageContent;
|
||
}
|
||
|
||
|
||
public void ClearCityRUList()
|
||
{
|
||
cityRUList.Clear();
|
||
}
|
||
|
||
public void AddCityRUList(int cityId)
|
||
{
|
||
cityRUList.Add(cityId);
|
||
}
|
||
|
||
public List<int> GetCityRUList()
|
||
{
|
||
return cityRUList;
|
||
}
|
||
|
||
public void ClearCityBuildingRUList()
|
||
{
|
||
cityBuildingRUList.Clear();
|
||
}
|
||
|
||
public void AddCityBuildingRUList(int cityId)
|
||
{
|
||
cityBuildingRUList.Add(cityId);
|
||
}
|
||
|
||
public List<int> GetCityBuildingRUList()
|
||
{
|
||
return cityBuildingRUList;
|
||
}
|
||
|
||
public void SetHighlightMapRU(int t)
|
||
{
|
||
highlightMapRU = t;
|
||
}
|
||
|
||
public int GetHighlighMapRU()
|
||
{
|
||
return highlightMapRU;
|
||
}
|
||
|
||
public void ClearHighlightMapRU()
|
||
{
|
||
highlightMapRU = -1;
|
||
}
|
||
|
||
public void AddTechIdRU(int techId)
|
||
{
|
||
techIdRUList.Add(techId);
|
||
}
|
||
|
||
public List<int> GetTechIdRU()
|
||
{
|
||
return techIdRUList;
|
||
}
|
||
|
||
public void ClearTechIdRU()
|
||
{
|
||
techIdRUList.Clear();
|
||
}
|
||
|
||
|
||
//----------------------------------------------------------特效部分----------------------------------------------------------
|
||
public void ClearMistClearEffectRUList()
|
||
{
|
||
mistClearEffectRUList.Clear();
|
||
}
|
||
|
||
public void AddMistClearEffectRUList(Vector2Int pos)
|
||
{
|
||
mistClearEffectRUList.Add(pos);
|
||
}
|
||
|
||
public List<Vector2Int> GetMistClearEffectRUList()
|
||
{
|
||
return mistClearEffectRUList;
|
||
}
|
||
|
||
|
||
|
||
//----------------------------------------------------------动画部分----------------------------------------------------------
|
||
//battle动画
|
||
|
||
|
||
bool hasBattle = false;
|
||
BattleRenderDataPack battleRenderDataPack = new BattleRenderDataPack();
|
||
|
||
public void SetBattleRU(UnitData A, UnitData B, int dmgAR, int dmgBR, int hpAR, int hpBR, bool counterR)
|
||
{
|
||
hasBattle = true;
|
||
battleRenderDataPack.A = A;
|
||
battleRenderDataPack.B = B;
|
||
battleRenderDataPack.dmgA = dmgAR;
|
||
battleRenderDataPack.dmgB = dmgBR;
|
||
battleRenderDataPack.hpA = hpAR;
|
||
battleRenderDataPack.hpB = hpBR;
|
||
battleRenderDataPack.counter = counterR;
|
||
}
|
||
|
||
public bool GetBattleRU()
|
||
{
|
||
return hasBattle;
|
||
}
|
||
|
||
public BattleRenderDataPack GetBattleRenderDataPackRU()
|
||
{
|
||
return battleRenderDataPack;
|
||
}
|
||
|
||
public void ClearBattleRU()
|
||
{
|
||
hasBattle = false;
|
||
}
|
||
|
||
|
||
//------------------------------------------------------------UI部分--------------------------------------------------------
|
||
public int GetLastCityUpgradeActionRUList()
|
||
{
|
||
if (cityUpgradeActionRUList.Count > 0) return cityUpgradeActionRUList[cityUpgradeActionRUList.Count - 1];
|
||
else return -1;
|
||
}
|
||
|
||
public void AddCityUpgradeActionRUList(int cityId)
|
||
{
|
||
cityUpgradeActionRUList.Add(cityId);
|
||
}
|
||
|
||
public void RemoveLastCityUpgradeActionRUList()
|
||
{
|
||
if (cityUpgradeActionRUList.Count > 0) cityUpgradeActionRUList.RemoveAt(cityUpgradeActionRUList.Count - 1);
|
||
}
|
||
}
|
||
} |