Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
36个文件已修改
5个文件已删除
5 文件已复制
6个文件已添加
1 文件已重命名
| | |
| | | SelectBtn(); |
| | | } |
| | | |
| | | // 选中当前按钮 |
| | | // 选中当前按钮,只处理刷新显示 |
| | | public void SelectBtn(bool forceRefresh = false) |
| | | { |
| | | if (m_State == TitleBtnState.Click && !forceRefresh) |
| | |
| | | m_Manager.SelectButton(this); |
| | | } |
| | | |
| | | // 设置当前按钮为选中状态 |
| | | state = TitleBtnState.Click; |
| | | } |
| | | |
| | | // 更新按钮状态 |
| | |
| | | using System.Collections.Generic; |
| | | |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | /// <summary> |
| | | /// 按钮组管理器,负责管理GroupButtonEx组件的组关系和状态切换 |
| | |
| | | { |
| | | // 按钮组列表 |
| | | private List<GroupButtonEx> m_Buttons = new List<GroupButtonEx>(); |
| | | |
| | | [SerializeField] Color m_SelectedTextColor = Color.white; // 选中状态文字颜色 |
| | | |
| | | [SerializeField] Color m_SelectedTextColor = UIHelper.GetUIColor(TextColType.titleSelectColor); // 选中状态文字颜色 |
| | | public Color selectedTextColor { |
| | | get { return m_SelectedTextColor; } |
| | | set { |
| | |
| | | } |
| | | } |
| | | |
| | | [SerializeField] Color m_NormalTextColor = new Color(0.7f, 0.7f, 0.7f); // 未选中状态文字颜色 |
| | | [SerializeField] Color m_NormalTextColor = UIHelper.GetUIColor(TextColType.titleUnSelectColor); // 未选中状态文字颜色 |
| | | public Color normalTextColor { |
| | | get { return m_NormalTextColor; } |
| | | set { |
| | | m_NormalTextColor = value; |
| | | } |
| | | } |
| | | |
| | | |
| | | void OnEnable() |
| | | { |
| | | ExecuteNextFrame(); |
| | | } |
| | | |
| | | protected async void ExecuteNextFrame() |
| | | { |
| | | await UniTask.DelayFrame(1); |
| | | UpdateAllButtonsState(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | if (button == null) |
| | | return; |
| | | |
| | | button.state = TitleBtnState.Click; |
| | | // 取消其他按钮的选中状态 |
| | | foreach (var btn in m_Buttons) |
| | | { |
| | |
| | | /// </summary> |
| | | private void UpdateAllButtonsState() |
| | | { |
| | | SortBtns(); |
| | | // SortBtns(); |
| | | |
| | | foreach (var btn in m_Buttons) |
| | | { |
| | |
| | | } |
| | | |
| | | PlayerEffect(true); |
| | | SoundPlayer.Instance.PlayUIAudio(effectConfig.audio); |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | PlayerEffect(false); |
| | | } |
| | | |
| | | SoundPlayer.Instance.PlayUIAudio(effectConfig.audio); |
| | | } |
| | | |
| | | |
| | | protected override void PlaySpineEffect() |
| | | { |
| | | if (spineComp == null) |
| | | { |
| | | spineComp = gameObject.AddMissingComponent<SkeletonGraphic>(); |
| | | } |
| | | |
| | | if (spineComp.skeletonDataAsset == null) |
| | | { |
| | | //LoadAsset 已经有缓存SkeletonDataAsset |
| | |
| | | spineComp.raycastTarget = false; |
| | | spineComp.Initialize(true); |
| | | spineAnimationState = spineComp.AnimationState; |
| | | spineAnimationState.Data.DefaultMix = 0f; |
| | | spineAnimationState.Complete -= OnSpineAnimationComplete; |
| | | spineAnimationState.Complete += OnSpineAnimationComplete; |
| | | } |
| | |
| | | if (skeletonData.Animations.Count > 0) |
| | | { |
| | | string defaultAnimationName = skeletonData.Animations.Items[0].Name; |
| | | spineComp.AnimationState.SetAnimation(0, defaultAnimationName, isPlaySpineLoop); |
| | | spineAnimationState.SetAnimation(0, defaultAnimationName, isPlaySpineLoop); |
| | | } |
| | | else |
| | | { |
| | |
| | |
|
| | | // 加载配置文件
|
| | | HashSet<Type> configTypes = new HashSet<Type>() {
|
| | | typeof(ChatBubbleBoxConfig),
|
| | | typeof(ChestsAwardConfig),
|
| | | typeof(CTGConfig),
|
| | | typeof(DailyLivenessRewardConfig),
|
| | | typeof(DailyQuestConfig),
|
| | | typeof(DailyQuestOpenTimeConfig),
|
| | | typeof(DienstgradConfig),
|
| | | typeof(DirtyNameConfig),
|
| | | typeof(DirtyWordConfig),
|
| | | typeof(EffectConfig),
|
| | | typeof(EquipGSParamConfig),
|
| | | typeof(EquipPlaceMapConfig),
|
| | | typeof(FamilyEmblemConfig),
|
| | | typeof(FrameAnimationConfig),
|
| | | typeof(FuncConfigConfig),
|
| | | typeof(FuncOpenLVConfig),
|
| | | typeof(FunctionTeamSetConfig),
|
| | | typeof(GetItemWaysConfig),
|
| | | typeof(GmCmdConfig),
|
| | | typeof(HeroAwakeConfig),
|
| | | typeof(HeroConfig),
|
| | | typeof(FaceConfig),
|
| | | typeof(HeroLineupHaloConfig),
|
| | | typeof(HeroQualityAwakeConfig),
|
| | | typeof(HeroQualityBreakConfig),
|
| | | typeof(HeroQualityConfig),
|
| | | typeof(HeroQualityLVConfig),
|
| | | typeof(HeroSkinConfig),
|
| | | typeof(ItemConfig),
|
| | | typeof(KickOutReasonConfig),
|
| | | typeof(MainChapterConfig),
|
| | | typeof(MainLevelConfig),
|
| | | typeof(NPCConfig),
|
| | | typeof(NPCExConfig),
|
| | | typeof(NPCLineupConfig),
|
| | | typeof(OrderInfoConfig),
|
| | | typeof(PlayerFaceConfig),
|
| | | typeof(PlayerLVConfig),
|
| | | typeof(PlayerPropertyConfig),
|
| | | typeof(priorbundleConfig),
|
| | | typeof(RealmConfig),
|
| | | typeof(RealmLVUPTaskConfig),
|
| | | typeof(RuleConfig),
|
| | | typeof(SkillConfig),
|
| | | typeof(TaskConfig),
|
| | | typeof(StoreConfig),
|
| | | typeof(SuccessConfig),
|
| | | typeof(SysInfoConfig),
|
| | | typeof(TitleStarUpConfig),
|
| | | typeof(TreasureCntAwardConfig),
|
| | | typeof(TreasureItemLibConfig),
|
| | | typeof(TreasureSetConfig),
|
| | | typeof(TreeLVConfig),
|
| | | typeof(XBGetItemConfig)
|
| | |
| | |
|
| | | public override void Release()
|
| | | {
|
| | | // 清空 ChatBubbleBoxConfig 字典
|
| | | ClearConfigDictionary<ChatBubbleBoxConfig>();
|
| | | // 清空 ChestsAwardConfig 字典
|
| | | ClearConfigDictionary<ChestsAwardConfig>();
|
| | | // 清空 CTGConfig 字典
|
| | | ClearConfigDictionary<CTGConfig>();
|
| | | // 清空 DailyLivenessRewardConfig 字典
|
| | | ClearConfigDictionary<DailyLivenessRewardConfig>();
|
| | | // 清空 DailyQuestConfig 字典
|
| | | ClearConfigDictionary<DailyQuestConfig>();
|
| | | // 清空 DailyQuestOpenTimeConfig 字典
|
| | | ClearConfigDictionary<DailyQuestOpenTimeConfig>();
|
| | | // 清空 DienstgradConfig 字典
|
| | | ClearConfigDictionary<DienstgradConfig>();
|
| | | // 清空 DirtyNameConfig 字典
|
| | | ClearConfigDictionary<DirtyNameConfig>();
|
| | | // 清空 DirtyWordConfig 字典
|
| | | ClearConfigDictionary<DirtyWordConfig>();
|
| | | // 清空 EffectConfig 字典
|
| | | ClearConfigDictionary<EffectConfig>();
|
| | | // 清空 EquipGSParamConfig 字典
|
| | | ClearConfigDictionary<EquipGSParamConfig>();
|
| | | // 清空 EquipPlaceMapConfig 字典
|
| | | ClearConfigDictionary<EquipPlaceMapConfig>();
|
| | | // 清空 FamilyEmblemConfig 字典
|
| | | ClearConfigDictionary<FamilyEmblemConfig>();
|
| | | // 清空 FrameAnimationConfig 字典
|
| | | ClearConfigDictionary<FrameAnimationConfig>();
|
| | | // 清空 FuncConfigConfig 字典
|
| | | ClearConfigDictionary<FuncConfigConfig>();
|
| | | // 清空 FuncOpenLVConfig 字典
|
| | | ClearConfigDictionary<FuncOpenLVConfig>();
|
| | | // 清空 FunctionTeamSetConfig 字典
|
| | | ClearConfigDictionary<FunctionTeamSetConfig>();
|
| | | // 清空 GetItemWaysConfig 字典
|
| | | ClearConfigDictionary<GetItemWaysConfig>();
|
| | | // 清空 GmCmdConfig 字典
|
| | | ClearConfigDictionary<GmCmdConfig>();
|
| | | // 清空 HeroAwakeConfig 字典
|
| | | ClearConfigDictionary<HeroAwakeConfig>();
|
| | | // 清空 HeroConfig 字典
|
| | | ClearConfigDictionary<HeroConfig>();
|
| | | // 清空 FaceConfig 字典
|
| | | ClearConfigDictionary<FaceConfig>();
|
| | | // 清空 HeroLineupHaloConfig 字典
|
| | | ClearConfigDictionary<HeroLineupHaloConfig>();
|
| | | // 清空 HeroQualityAwakeConfig 字典
|
| | | ClearConfigDictionary<HeroQualityAwakeConfig>();
|
| | | // 清空 HeroQualityBreakConfig 字典
|
| | | ClearConfigDictionary<HeroQualityBreakConfig>();
|
| | | // 清空 HeroQualityConfig 字典
|
| | | ClearConfigDictionary<HeroQualityConfig>();
|
| | | // 清空 HeroQualityLVConfig 字典
|
| | | ClearConfigDictionary<HeroQualityLVConfig>();
|
| | | // 清空 HeroSkinConfig 字典
|
| | | ClearConfigDictionary<HeroSkinConfig>();
|
| | | // 清空 ItemConfig 字典
|
| | | ClearConfigDictionary<ItemConfig>();
|
| | | // 清空 KickOutReasonConfig 字典
|
| | | ClearConfigDictionary<KickOutReasonConfig>();
|
| | | // 清空 MainChapterConfig 字典
|
| | | ClearConfigDictionary<MainChapterConfig>();
|
| | | // 清空 MainLevelConfig 字典
|
| | | ClearConfigDictionary<MainLevelConfig>();
|
| | | // 清空 NPCConfig 字典
|
| | | ClearConfigDictionary<NPCConfig>();
|
| | | // 清空 NPCExConfig 字典
|
| | | ClearConfigDictionary<NPCExConfig>();
|
| | | // 清空 NPCLineupConfig 字典
|
| | | ClearConfigDictionary<NPCLineupConfig>();
|
| | | // 清空 OrderInfoConfig 字典
|
| | | ClearConfigDictionary<OrderInfoConfig>();
|
| | | // 清空 PlayerFaceConfig 字典
|
| | | ClearConfigDictionary<PlayerFaceConfig>();
|
| | | // 清空 PlayerLVConfig 字典
|
| | | ClearConfigDictionary<PlayerLVConfig>();
|
| | | // 清空 PlayerPropertyConfig 字典
|
| | | ClearConfigDictionary<PlayerPropertyConfig>();
|
| | | // 清空 priorbundleConfig 字典
|
| | | ClearConfigDictionary<priorbundleConfig>();
|
| | | // 清空 RealmConfig 字典
|
| | | ClearConfigDictionary<RealmConfig>();
|
| | | // 清空 RealmLVUPTaskConfig 字典
|
| | | ClearConfigDictionary<RealmLVUPTaskConfig>();
|
| | | // 清空 RuleConfig 字典
|
| | | ClearConfigDictionary<RuleConfig>();
|
| | | // 清空 SkillConfig 字典
|
| | | ClearConfigDictionary<SkillConfig>();
|
| | | // 清空 TaskConfig 字典
|
| | | ClearConfigDictionary<TaskConfig>();
|
| | | // 清空 StoreConfig 字典
|
| | | ClearConfigDictionary<StoreConfig>();
|
| | | // 清空 SuccessConfig 字典
|
| | | ClearConfigDictionary<SuccessConfig>();
|
| | | // 清空 SysInfoConfig 字典
|
| | | ClearConfigDictionary<SysInfoConfig>();
|
| | | // 清空 TitleStarUpConfig 字典
|
| | | ClearConfigDictionary<TitleStarUpConfig>();
|
| | | // 清空 TreasureCntAwardConfig 字典
|
| | | ClearConfigDictionary<TreasureCntAwardConfig>();
|
| | | // 清空 TreasureItemLibConfig 字典
|
| | | ClearConfigDictionary<TreasureItemLibConfig>();
|
| | | // 清空 TreasureSetConfig 字典
|
| | | ClearConfigDictionary<TreasureSetConfig>();
|
| | | // 清空 TreeLVConfig 字典
|
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2025年7月26日
|
| | | // [ Date ]: Monday, August 4, 2025
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public int ChangeOrd;
|
| | | public string Description;
|
| | | public string QualityName;
|
| | | public int QualityEchoType;
|
| | | public int LimitSTR;
|
| | | public int LimitPHY;
|
| | | public int LimitPNE;
|
| | |
| | |
|
| | | QualityName = tables[59];
|
| | |
|
| | | int.TryParse(tables[60],out QualityEchoType); |
| | | int.TryParse(tables[60],out LimitSTR); |
| | |
|
| | | int.TryParse(tables[61],out LimitSTR); |
| | | int.TryParse(tables[61],out LimitPHY); |
| | |
|
| | | int.TryParse(tables[62],out LimitPHY); |
| | | int.TryParse(tables[62],out LimitPNE); |
| | |
|
| | | int.TryParse(tables[63],out LimitPNE); |
| | | Template = tables[63];
|
| | |
|
| | | Template = tables[64];
|
| | | int.TryParse(tables[64],out DropItemPattern); |
| | |
|
| | | int.TryParse(tables[65],out DropItemPattern); |
| | | int.TryParse(tables[65],out SellTip); |
| | |
|
| | | int.TryParse(tables[66],out SellTip); |
| | | int.TryParse(tables[66],out BatchUse); |
| | |
|
| | | int.TryParse(tables[67],out BatchUse); |
| | | int.TryParse(tables[67],out Jump); |
| | |
|
| | | int.TryParse(tables[68],out Jump); |
| | |
|
| | | if (tables[69].Contains("[")) |
| | | if (tables[68].Contains("[")) |
| | | { |
| | | GetWay = JsonMapper.ToObject<int[]>(tables[69]); |
| | | GetWay = JsonMapper.ToObject<int[]>(tables[68]); |
| | | } |
| | | else |
| | | { |
| | | string[] GetWayStringArray = tables[69].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | string[] GetWayStringArray = tables[68].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | GetWay = new int[GetWayStringArray.Length]; |
| | | for (int i=0;i<GetWayStringArray.Length;i++) |
| | | { |
| | |
| | | } |
| | | }
|
| | |
|
| | | ItemTypeName = tables[70];
|
| | | ItemTypeName = tables[69];
|
| | |
|
| | | if (tables[71].Contains("[")) |
| | | if (tables[70].Contains("[")) |
| | | { |
| | | UseCondiType = JsonMapper.ToObject<int[]>(tables[71]); |
| | | UseCondiType = JsonMapper.ToObject<int[]>(tables[70]); |
| | | } |
| | | else |
| | | { |
| | | string[] UseCondiTypeStringArray = tables[71].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | string[] UseCondiTypeStringArray = tables[70].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | UseCondiType = new int[UseCondiTypeStringArray.Length]; |
| | | for (int i=0;i<UseCondiTypeStringArray.Length;i++) |
| | | { |
| | |
| | | } |
| | | }
|
| | |
|
| | | int.TryParse(tables[72],out BaseEffectID); |
| | | int.TryParse(tables[71],out BaseEffectID); |
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | |
| | | |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Threading; |
| | | using System; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | using System.Linq; |
| | | |
| | | //羁绊:武将 |
| | | public partial class HeroFetterConfig : ConfigBase<int, HeroFetterConfig> |
| | | { |
| | | private Dictionary<HeroAttrType, int> attrValues = new Dictionary<HeroAttrType, int>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | | { |
| | | base.OnConfigParseCompleted(); |
| | | |
| | | // public int[] AttrIDList; |
| | | // public int[] AttrValueList; |
| | |
| | | |
| | | attrValues.Add((HeroAttrType)AttrIDList[i], AttrValueList[i]); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | public int GetFetterAttr(HeroAttrType attrType) |
| | | { |
| | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public partial class HeroLineupHaloConfig : ConfigBase<int, HeroLineupHaloConfig> |
| | | { |
| | | // 国家 数量 |
| | | public static Dictionary<int, Dictionary<int, HeroLineupHaloConfig>> configDics = new Dictionary<int, Dictionary<int, HeroLineupHaloConfig>>(); |
| | | private static Dictionary<int, Dictionary<int, HeroLineupHaloConfig>> configDics = new Dictionary<int, Dictionary<int, HeroLineupHaloConfig>>(); |
| | | |
| | | protected override void OnConfigParseCompleted() |
| | | { |
| | |
| | | return configDics[country][count]; |
| | | } |
| | | |
| | | public static Dictionary<int, HeroLineupHaloConfig> GetAttrsByCountry(int country) |
| | | { |
| | | Dictionary<int, HeroLineupHaloConfig> attrs; |
| | | configDics.TryGetValue(country, out attrs); |
| | | |
| | | return attrs; |
| | | } |
| | | |
| | | } |
| | |
| | | return GetFullDescription(property.x, property.y); |
| | | } |
| | | |
| | | public static string GetFullDescription(int id, long value) |
| | | public static string GetFullDescription(int id, long value, string format="{0}+{1}") |
| | | { |
| | | var config = Get(id); |
| | | if (config == null) |
| | |
| | | |
| | | if (config.ShowName.Contains("%s")) |
| | | { |
| | | if (id == 52) |
| | | { |
| | | return Regex.Replace(config.ShowName, "%s", (value * 0.0001f).ToString("f2")); |
| | | } |
| | | else |
| | | // if (id == 52) |
| | | // { |
| | | // return Regex.Replace(config.ShowName, "%s", (value * 0.0001f).ToString("f2")); |
| | | // } |
| | | // else |
| | | { |
| | | return Regex.Replace(config.ShowName, "%s", value.ToString()); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return string.Format("{0} +{1}", config.ShowName, GetValueDescription(id, value)); |
| | | return string.Format(format, config.ShowName, GetValueDescription(id, value)); |
| | | } |
| | | } |
| | | |
| | |
| | | using UnityEngine; |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | using System.Linq; |
| | | |
| | | #if UNITY_EDITOR |
| | | using UnityEngine.Profiling; |
| | | #endif |
| | | |
| | | |
| | | public class GameObjectPoolManager : SingletonMonobehaviour<GameObjectPoolManager> |
| | |
| | | private bool m_ShowDebugPanel = false; |
| | | private Vector2 m_ScrollPosition = Vector2.zero; |
| | | |
| | | |
| | | private void OnGUI() |
| | | { |
| | | if (!m_ShowDebugPanel) return; |
| | |
| | | m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition, GUILayout.Width(380), GUILayout.Height(580)); |
| | | |
| | | GUILayout.Label("对象池调试面板", GUILayout.Height(30)); |
| | | LogPoolMemoryUsage(); |
| | | GUILayout.Space(10); |
| | | |
| | | foreach (var poolEntry in m_PoolDict) |
| | |
| | | Instance.m_ShowDebugPanel = !Instance.m_ShowDebugPanel; |
| | | } |
| | | } |
| | | |
| | | public void LogPoolMemoryUsage() |
| | | { |
| | | long totalMemory = 0; |
| | | long totalFreeMemory = 0; |
| | | var prefabMemoryDict = new Dictionary<string, long>(); |
| | | |
| | | foreach (var poolEntry in m_PoolDict) |
| | | { |
| | | int prefabInstanceId = poolEntry.Key; |
| | | GameObjectPool pool = poolEntry.Value; |
| | | string prefabName = pool.Prefab.name; |
| | | long prefabMemory = 0; |
| | | long freeMemory = 0; |
| | | |
| | | // 计算活跃对象的内存占用 |
| | | foreach (var gameObject in pool.m_ActiveHashSet) |
| | | { |
| | | if (gameObject != null) |
| | | { |
| | | long memory = Profiler.GetRuntimeMemorySizeLong(gameObject); |
| | | prefabMemory += memory; |
| | | } |
| | | } |
| | | |
| | | // 计算空闲对象的内存占用 |
| | | foreach (var gameObject in pool.m_FreeQueue) |
| | | { |
| | | if (gameObject != null) |
| | | { |
| | | long memory = Profiler.GetRuntimeMemorySizeLong(gameObject); |
| | | prefabMemory += memory; |
| | | freeMemory += memory; |
| | | } |
| | | } |
| | | |
| | | totalMemory += prefabMemory; |
| | | totalFreeMemory += freeMemory; |
| | | prefabMemoryDict[prefabName] = prefabMemory; |
| | | } |
| | | |
| | | // 按内存占用排序 |
| | | var sortedPrefabs = prefabMemoryDict.OrderByDescending(kv => kv.Value).Take(3).ToList(); |
| | | |
| | | GUILayout.Label($"总内存占用: {totalMemory / 1024} KB", GUILayout.Height(30)); |
| | | GUILayout.Label($"空闲内存占用: {totalFreeMemory / 1024} KB", GUILayout.Height(30)); |
| | | GUILayout.Label("占用最高的前3预制体名:", GUILayout.Height(30)); |
| | | foreach (var prefabInstance in sortedPrefabs) |
| | | { |
| | | GUILayout.BeginHorizontal("Box"); |
| | | GUILayout.Label($"{prefabInstance.Key}({prefabInstance.Value / 1024} KB)", GUILayout.Height(25)); |
| | | GUILayout.EndHorizontal(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | #endif |
| | | // 池统计数据 |
| | | public Dictionary<int, PoolStats> PoolStatistics { get; private set; } = new Dictionary<int, PoolStats>(); |
| | |
| | | public const int CrossFamilyBattleMapID = 32090; |
| | | public static int initDepotGridCount { get; private set; } |
| | | public static int maxDepotGridCount { get; private set; } |
| | | public static int initBagGridCount { get; private set; } |
| | | public static int maxBagGridCount { get; private set; } |
| | | public static int maxXBGridCount { get; private set; } |
| | | public static int playerMaxLevel { get; private set; } |
| | |
| | | // BlueEquipJumpLevel = GetInt("BlueEquipJumpLevel"); |
| | | // initDepotGridCount = GetInt("InitDepotCellCount"); |
| | | // maxDepotGridCount = GetInt("MaxDepotCellCount"); |
| | | // initBagGridCount = GetInt("InitBagCellCount"); |
| | | // maxBagGridCount = GetInt("MaxBagCellCount"); |
| | | // maxXBGridCount = GetInt("TreasureSet", 3); |
| | | |
| | |
| | | |
| | | |
| | | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | |
| | | public partial class HeroInfo |
| | | { |
| | | // 羁绊配置 |
| | | public HeroFetterConfig fetterConfig; |
| | | public HeroFetterConfig fetterConfig; |
| | | |
| | | protected int GetIFByInheritFetterPercent(HeroAttrType attrType) |
| | | |
| | | public List<int> GetActiveFetter(HeroConfig config, TeamBase teamBase) |
| | | { |
| | | // YYL TODO |
| | | int total = 0; |
| | | for (int i = 0; i < fetterInfoList.Count; i++) |
| | | { |
| | | HeroFetterInfo fetterInfo = fetterInfoList[i]; |
| | | total += fetterInfo.GetFetterAttr(attrType); |
| | | } |
| | | return total; |
| | | } |
| | | List<int> list = new List<int>(); |
| | | if (config.FetterIDList.Length == 0) |
| | | return list; |
| | | |
| | | foreach (var fetterID in config.FetterIDList) |
| | | { |
| | | HeroFetterConfig fetterConfig = HeroFetterConfig.Get(fetterID); |
| | | int count = 0; |
| | | for (int i = 0; i < teamBase.tempHeroes.Length; i++) |
| | | { |
| | | TeamHero teamHero = teamBase.tempHeroes[i]; |
| | | |
| | | if (null == teamHero) |
| | | continue; |
| | | |
| | | if (fetterConfig.HeroIDList.Contains(teamHero.heroId)) |
| | | { |
| | | count++; |
| | | } |
| | | if (count >= fetterConfig.HeroIDList.Length) |
| | | { |
| | | list.Add(fetterID); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | } |
| | |
| | | return GetStableProperties(attrType) |
| | | * GetCultivationPercent(attrType) |
| | | * GetInheritRate(attrType) |
| | | * GetInfluenceByInheritPercent(attrType); |
| | | * GetTotalPercent(attrType); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | // 被继承比例影响的百分比属性 |
| | | public int GetInfluenceByInheritPercent(HeroAttrType attrType) |
| | | public int GetTotalPercent(HeroAttrType attrType) |
| | | { |
| | | // (1+羁绊加成%+潜能加成%+天赋加成%+觉醒效果加成%) |
| | | |
| | | int IFByInheritPercent = 100; |
| | | IFByInheritPercent += GetIFByInheritFetterPercent(attrType); //羁绊加成 HeroInfo.Fetter |
| | | IFByInheritPercent += GetIFByInheritBreakPercent(attrType); //潜能加成 HeroInfo.Break |
| | | IFByInheritPercent += GetIFByInheritTalentPercent(attrType); //天赋加成 HeroInfo.Talent |
| | | IFByInheritPercent += GetIFByInheritAwakePercent(attrType); //觉醒加成 HeroInfo.Awake |
| | | // IFByInheritPercent += GetIFByInheritFetterPercent(attrType); //羁绊加成 HeroInfo.Fetter |
| | | // IFByInheritPercent += GetIFByInheritBreakPercent(attrType); //潜能加成 HeroInfo.Break |
| | | // IFByInheritPercent += GetIFByInheritTalentPercent(attrType); //天赋加成 HeroInfo.Talent |
| | | // IFByInheritPercent += GetIFByInheritAwakePercent(attrType); //觉醒加成 HeroInfo.Awake |
| | | return IFByInheritPercent; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | |
| | | public List<HeroFetterInfo> fetterInfoList = new List<HeroFetterInfo>(); |
| | | public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>(); |
| | | |
| | | |
| | |
| | | |
| | | void OnBeforePlayerDataInitialize() |
| | | { |
| | | |
| | | |
| | | heroInfoDict.Clear(); |
| | | } |
| | | |
| | |
| | | heroInfoDict.TryGetValue(guid, out heroInfo); |
| | | |
| | | heroInfoDict.Remove(guid); |
| | | |
| | | |
| | | if (null != heroInfo) |
| | | onHeroDeleteEvent?.Invoke(heroInfo); |
| | | } |
| | |
| | | { |
| | | if (job == 0 && country == 0) |
| | | return heroInfoDict.Keys.ToList(); |
| | | |
| | | return heroInfoDict.Keys.Where((x) => |
| | | |
| | | |
| | | List<string> retGuidList = new List<string>(); |
| | | foreach (string guid in heroInfoDict.Keys) |
| | | { |
| | | HeroInfo heroInfo = heroInfoDict[x]; |
| | | return heroInfo.heroConfig.Class == job && heroInfo.heroConfig.Country == country; |
| | | }).ToList(); |
| | | HeroInfo heroInfo = heroInfoDict[guid]; |
| | | //0代表全部 |
| | | if (job == 0 || country == 0) |
| | | { |
| | | if (job != 0 && job == heroInfo.heroConfig.Class) |
| | | retGuidList.Add(guid); |
| | | if (country != 0 && country == heroInfo.heroConfig.Country) |
| | | retGuidList.Add(guid); |
| | | } |
| | | else |
| | | { |
| | | if (job == heroInfo.heroConfig.Class && country == heroInfo.heroConfig.Country) |
| | | retGuidList.Add(guid); |
| | | } |
| | | } |
| | | return retGuidList; |
| | | } |
| | | |
| | | public List<HeroInfo> GetPowerfulHeroList() |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | public int GetHeroCount() |
| | | { |
| | | return heroInfoDict.Count; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | skeletonGraphic.Initialize(true); |
| | | this.transform.localScale = Vector3.one * scale; |
| | | spineAnimationState = skeletonGraphic.AnimationState; |
| | | spineAnimationState.Data.DefaultMix = 0f; |
| | | PlayAnimation(MotionName.idle, true); |
| | | spineAnimationState.Complete -= OnAnimationComplete; |
| | | spineAnimationState.Complete += OnAnimationComplete; |
| | |
| | | { |
| | | if (spineAnimationState == null) return; |
| | | |
| | | // 直接使用 ToString() 而不是调用 GetAnimationName |
| | | spineAnimationState.SetAnimation(0, motionName.ToString(), loop); |
| | | // 直接使用 ToString() 而不是调用 GetAnimationName |
| | | spineAnimationState.SetAnimation(0, motionName.ToString(), loop); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public class HeroBaseWin : FunctionsBaseWin |
| | | { |
| | | |
| | | [SerializeField] List<Image> funcSelectImgList; |
| | | [SerializeField] List<Image> funcUnSelectImgList; |
| | | [SerializeField] List<Text> titleNameList; |
| | | |
| | | /// </summary> |
| | | protected override void InitComponent() |
| | | { |
| | |
| | | protected override void OnPreOpen() |
| | | { |
| | | base.OnPreOpen(); |
| | | tabButtons[functionOrder].SelectBtn(true); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | |
| | | } |
| | | |
| | | |
| | | protected override void UpdateButtonsState() |
| | | { |
| | | for (int i = 0; i < funcSelectImgList.Count; i++) |
| | | { |
| | | if (i == functionOrder) |
| | | { |
| | | funcSelectImgList[i].SetActive(true); |
| | | funcUnSelectImgList[i].SetActive(false); |
| | | titleNameList[i].color = UIHelper.GetUIColor(TextColType.titleSelectColor); |
| | | |
| | | } |
| | | else |
| | | { |
| | | funcSelectImgList[i].SetActive(false); |
| | | funcUnSelectImgList[i].SetActive(true); |
| | | titleNameList[i].color = UIHelper.GetUIColor(TextColType.titleUnSelectColor); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected override void OpenSubUIByTabIndex() |
| | | { |
| | |
| | | [SerializeField] HeroConnectionHeadCell[] heros; |
| | | [SerializeField] Text connAttrText; |
| | | |
| | | public void Display() |
| | | public void Display(int fetterID) |
| | | { |
| | | |
| | | HeroFetterConfig heroFetterConfig = HeroFetterConfig.Get(fetterID); |
| | | for (int i = 0; i < heros.Length; i++) |
| | | { |
| | | if (i < heroFetterConfig.HeroIDList.Length) |
| | | { |
| | | heros[i].SetActive(true); |
| | | heros[i].Display(heroFetterConfig.HeroIDList[i], i); |
| | | } |
| | | else |
| | | { |
| | | heros[i].SetActive(false); |
| | | } |
| | | } |
| | | string attrStr = ""; |
| | | for (int i = 0; i < heroFetterConfig.AttrIDList.Length; i++) |
| | | { |
| | | attrStr += PlayerPropertyConfig.GetFullDescription(heroFetterConfig.AttrIDList[i], heroFetterConfig.AttrValueList[i]) + " "; |
| | | } |
| | | connAttrText.text = Language.Get("L1100", heroFetterConfig.FetterName, UIHelper.AppendColor(TextColType.lightYellow, attrStr)); |
| | | } |
| | | } |
| | | |
| | |
| | | [SerializeField] Text nameText; |
| | | [SerializeField] Image connMarkImg; //链接的锁图标,第一个不显示 |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="heroID"></param> |
| | | /// <param name="index"> 只是为了让第一个不显示锁图标用</param> |
| | | /// <param name="guid">部分界面显示不同皮肤图标</param> |
| | | public void Display(int heroID, int index, string guid = "") |
| | | { |
| | | int skinID = 0; |
New file |
| | |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | //阵型 |
| | | public class HeroFormationCell : CellView |
| | | { |
| | | [SerializeField] Image activeImg; |
| | | [SerializeField] Image countryOnImg; //上阵阵型激活国家 |
| | | [SerializeField] Image[] OnCountImgs; //上阵数量激活 |
| | | [SerializeField] RichText attrText; |
| | | |
| | | public void Display(int index) |
| | | { |
| | | Int2 result = HeroUIManager.Instance.GetMaxCountHeroCountry(HeroUIManager.Instance.selectTeamType); |
| | | |
| | | var config = HeroLineupHaloConfig.GetConfig(result.x, result.y); |
| | | bool sameCountry = result.x == (index + 1); |
| | | |
| | | activeImg.SetActive(config != null && sameCountry); |
| | | |
| | | |
| | | countryOnImg.SetSprite("heroTeamCountry" + (index + 1)); |
| | | if (config == null || !sameCountry) |
| | | { |
| | | for (int i = 0; i < OnCountImgs.Length; i++) |
| | | { |
| | | OnCountImgs[i].SetActive(false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < OnCountImgs.Length; i++) |
| | | { |
| | | if (i < result.y) |
| | | { |
| | | OnCountImgs[i].SetActive(true); |
| | | OnCountImgs[i].SetSprite("heroTeamCountryPoint" + result.x); |
| | | } |
| | | else |
| | | { |
| | | OnCountImgs[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | var attrDict = HeroLineupHaloConfig.GetAttrsByCountry(index + 1); |
| | | var countList = attrDict.Keys.ToList(); |
| | | countList.Sort(); |
| | | string text = string.Empty; |
| | | for (int k = 0; k < countList.Count; k++) |
| | | { |
| | | int count = countList[k]; |
| | | string lineText = string.Empty; |
| | | bool isActive = sameCountry && count <= result.y; |
| | | string countStr = isActive ? UIHelper.AppendColor(TextColType.Green, count.ToString()) : count.ToString(); |
| | | lineText = (k == 0 ? "" : "</r>") + Language.Get("herocard37", countStr, RichTextMsgReplaceConfig.GetRichReplace("Country", index + 1)); |
| | | var attrConfig = attrDict[count]; |
| | | for (int i = 0; i < attrConfig.AttrIDList.Length; i++) |
| | | { |
| | | string format = !isActive ? "{0}+{1}" : "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}"); |
| | | lineText += " " + PlayerPropertyConfig.GetFullDescription(attrConfig.AttrIDList[i], attrConfig.AttrValueList[i], format); |
| | | } |
| | | |
| | | text += UIHelper.AppendColor(isActive ? TextColType.NavyBrown : TextColType.Gray, lineText); |
| | | } |
| | | attrText.text = text; |
| | | } |
| | | } |
| | | |
File was renamed from Main/System/Hero/HeroFetterInfo.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 61d40aba9c2091445ae692419d4c5ebf |
| | | guid: bfc8cbe2e59ef934db88a564da0a7869 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | /// <summary> |
| | | /// 武将阵型激活界面 |
| | | /// </summary> |
| | | public class HeroFormationWin : UIBase |
| | | { |
| | | [SerializeField] Button closeBtn; |
| | | [SerializeField] ScrollerController scroller; |
| | | [SerializeField] Text totalAttrText; |
| | | |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | closeBtn.AddListener(CloseWindow); |
| | | } |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | scroller.OnRefreshCell += OnRefreshCell; |
| | | CreateScroller(); |
| | | |
| | | Int2 result = HeroUIManager.Instance.GetMaxCountHeroCountry(HeroUIManager.Instance.selectTeamType); |
| | | |
| | | var config = HeroLineupHaloConfig.GetConfig(result.x, result.y); |
| | | if (config == null) |
| | | { |
| | | totalAttrText.text = ""; |
| | | } |
| | | else |
| | | { |
| | | string lineText = string.Empty; |
| | | |
| | | for (int i = 0; i < config.AttrIDList.Length; i++) |
| | | { |
| | | string format = "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}"); |
| | | lineText += " " + PlayerPropertyConfig.GetFullDescription(config.AttrIDList[i], config.AttrValueList[i], format); |
| | | } |
| | | totalAttrText.text = Language.Get("herocard36") + lineText.Trim(); |
| | | } |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | scroller.OnRefreshCell -= OnRefreshCell; |
| | | } |
| | | |
| | | |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as HeroFormationCell; |
| | | _cell.Display(cell.index); |
| | | } |
| | | |
| | | void CreateScroller() |
| | | { |
| | | scroller.Refresh(); |
| | | for (int i = 0; i < 4; i++) |
| | | { |
| | | scroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | scroller.Restart(); |
| | | } |
| | | |
| | | } |
copy from Main/System/Hero/HeroFetterInfo.cs.meta
copy to Main/System/HeroUI/HeroFormationWin.cs.meta
File was copied from Main/System/Hero/HeroFetterInfo.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 61d40aba9c2091445ae692419d4c5ebf |
| | | guid: 93fbb2862890fb440bc497898f9935ef |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | using Cysharp.Threading.Tasks; |
| | | using System.Threading; |
| | | using System; |
| | | |
| | | /// <summary> |
| | | /// 武将布阵: 如果可以同时打开多个布阵界面 则使用 functionOrder:布阵类型 |
| | | /// 武将布阵界面 |
| | | /// </summary> |
| | | public class HeroPosWin : UIBase |
| | | { |
| | | [SerializeField] Text[] attrOnList; //上阵属性加成 |
| | | [SerializeField] Button countryOnBtn; |
| | | [SerializeField] Image countryOnImg; //上阵阵型激活国家 |
| | | [SerializeField] UIEffectPlayer countryEffect; |
| | | [SerializeField] List<Image> OnCountImgs; //上阵数量激活 |
| | | [SerializeField] List<Image> scenePosImgs; //场景布阵位置 |
| | | [SerializeField] HeroScenePosCell[] sceneHero; |
| | |
| | | [SerializeField] ScrollerController heroListScroller; |
| | | [SerializeField] Transform heroListEmpty; |
| | | [SerializeField] Toggle showConnTipToggleBtn; |
| | | private bool isToggleOn = false; |
| | | |
| | | [SerializeField] HeroSelectBehaviour fiterManager; //武将筛选 |
| | | |
| | | [SerializeField] Button oneKeyOnBtn; //一键上阵 |
| | | [SerializeField] Button saveBtn; //保存阵型 |
| | | [SerializeField] Button backBtn; //退出界面 |
| | | [SerializeField] GroupButtonEx jjcBtn; //竞技场 |
| | | [SerializeField] GroupButtonEx tttBtn; //通天塔 |
| | | // [SerializeField] GroupButtonEx tttBtn; //通天塔 |
| | | [SerializeField] GroupButtonEx mainFBBtn; //主线副本 |
| | | |
| | | //羁绊 |
| | |
| | | [SerializeField] CanvasGroup flyAlphaTween; |
| | | |
| | | Sequence sequence; |
| | | CancellationTokenSource _cts; |
| | | Queue<int> showConnectTipQueue = new Queue<int>(); |
| | | |
| | | private bool m_IsToggleOn = false; |
| | | private bool isToggleOn |
| | | { |
| | | get { return m_IsToggleOn; } |
| | | set |
| | | { |
| | | if (m_IsToggleOn != value) |
| | | { |
| | | m_IsToggleOn = value; |
| | | LocalSave.SetBool("ShowConn" + PlayerDatas.Instance.baseData.PlayerID, value); |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | attackTeamBtn.AddListener(() => |
| | | { |
| | | if (HeroUIManager.Instance.selectTeamType == TeamType.Arena) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | HeroUIManager.Instance.selectTeamType = (TeamType)HeroUIManager.Instance.GetSelectTeamTypeByAttackType(0); |
| | | Refresh(); |
| | | SelectTeamFunc((TeamType)HeroUIManager.Instance.GetSelectTeamTypeByAttackType(0)); |
| | | }); |
| | | defendTeamBtn.AddListener(() => |
| | | { |
| | | if (HeroUIManager.Instance.selectTeamType == TeamType.ArenaDefense) |
| | | { |
| | | return; |
| | | } |
| | | HeroUIManager.Instance.selectTeamType = (TeamType)HeroUIManager.Instance.GetSelectTeamTypeByAttackType(1); |
| | | Refresh(); |
| | | SelectTeamFunc((TeamType)HeroUIManager.Instance.GetSelectTeamTypeByAttackType(1)); |
| | | }); |
| | | |
| | | mainFBBtn.AddListener(() => |
| | | { |
| | | SelectTeamFunc(TeamType.Story); |
| | | }); |
| | | |
| | | jjcBtn.AddListener(() => |
| | | { |
| | | SelectTeamFunc(TeamType.Arena); |
| | | }); |
| | | // tttBtn.AddListener(() => |
| | | // { |
| | | // SelectTeamFunc(TeamType.Tower); |
| | | // }); |
| | | |
| | | showConnTipToggleBtn.AddListener((value) => |
| | | { |
| | | isToggleOn = showConnTipToggleBtn.isOn; |
| | | if (isToggleOn == false) |
| | | { |
| | | CancelCurrentTask(); |
| | | } |
| | | }); |
| | | oneKeyOnBtn.AddListener(OneKeyOnPos); |
| | | saveBtn.AddListener(SaveTeam); |
| | | |
| | | backBtn.AddListener(CloseWindow); |
| | | |
| | | countryOnBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<HeroFormationWin>(); |
| | | }); |
| | | |
| | | m_IsToggleOn = LocalSave.GetBool("ShowConn" + PlayerDatas.Instance.baseData.PlayerID, false); |
| | | } |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | HeroUIManager.Instance.SortHeroOnTeamList(); //打开界面和保存(服务端)更新阵容是刷新 |
| | | HeroUIManager.Instance.selectTeamPosJob = 0; |
| | | HeroUIManager.Instance.selectTeamPosCountry = 0; |
| | | HeroUIManager.Instance.SortHeroOnTeamList(); |
| | | heroListScroller.OnRefreshCell += OnRefreshCell; |
| | | HeroUIManager.Instance.OnTeamPosChangeEvent += TeamChangeEvent; |
| | | CreateScroller(); |
| | |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | CancelCurrentTask(); |
| | | heroListScroller.OnRefreshCell -= OnRefreshCell; |
| | | HeroUIManager.Instance.OnTeamPosChangeEvent -= TeamChangeEvent; |
| | | TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType).RestoreTeam(); |
| | | } |
| | | |
| | | |
| | |
| | | RefreshOnTeamBtn(); |
| | | RefreshTeamHero(); |
| | | RefreshFlyHead(); |
| | | RefreshConn(); |
| | | |
| | | if (HeroUIManager.Instance.heroOnTeamSortList.Count == 0) |
| | | if (HeroManager.Instance.GetHeroCount() == 0) |
| | | { |
| | | heroListEmpty.SetActive(true); |
| | | heroListScroller.SetActive(false); |
| | |
| | | |
| | | showConnTipToggleBtn.isOn = isToggleOn; |
| | | |
| | | fiterManager.Display(0, 0, 0, SelectJobCountry); |
| | | fiterManager.Display(0, HeroUIManager.Instance.selectTeamPosJob, HeroUIManager.Instance.selectTeamPosCountry, SelectJobCountry); |
| | | |
| | | |
| | | fightPowerText.text = "1234k"; |
| | | |
| | | |
| | | } |
| | | |
| | | void RefreshFlyHead() |
| | |
| | | flyHead.transform.localScale = Vector3.zero; |
| | | } |
| | | |
| | | void RefreshConn() |
| | | { |
| | | connetionForm.SetActive(false); |
| | | var canvasConn = connetionForm.GetComponent<Canvas>(); |
| | | canvasConn.sortingLayerID = canvas.sortingLayerID; |
| | | canvasConn.sortingOrder = canvas.sortingOrder + 9; |
| | | CancelCurrentTask(); |
| | | } |
| | | |
| | | void SelectJobCountry(int job, int country) |
| | | { |
| | | HeroUIManager.Instance.selectTeamPosJob = job; |
| | | HeroUIManager.Instance.selectTeamPosCountry = country; |
| | | HeroUIManager.Instance.SortHeroOnTeamList(); |
| | | CreateScroller(); |
| | | } |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | |
| | | } |
| | | |
| | | //上阵武将国家光环激活 |
| | | void RefreshOnTeamCountry() |
| | | void RefreshOnTeamCountry(bool playEffect = false) |
| | | { |
| | | Int2 result = HeroUIManager.Instance.GetMaxCountHeroCountry(HeroUIManager.Instance.selectTeamType); |
| | | |
| | | var config = HeroLineupHaloConfig.GetConfig(result.x, result.y); |
| | | if (config == null) |
| | | { |
| | | countryOnImg.SetSprite("heroTeamCountry" + result.x); |
| | | countryOnImg.SetSprite("heroTeamCountry0"); |
| | | for (int i = 0; i < OnCountImgs.Count; i++) |
| | | { |
| | | OnCountImgs[i].SetActive(false); |
| | |
| | | OnCountImgs[i].SetActive(false); |
| | | } |
| | | } |
| | | if (playEffect) |
| | | countryEffect.Play(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | void RefreshPosScale() |
| | | { |
| | | { |
| | | for (int i = 0; i < scenePosImgs.Count; i++) |
| | | { |
| | | scenePosImgs[i].transform.localScale = Vector3.one; |
| | |
| | | } |
| | | RefreshPosScale(); |
| | | heroListScroller.m_Scorller.RefreshActiveCellViews(); |
| | | RefreshOnTeamCountry(true); |
| | | |
| | | //表现飞入,连续点击不同头像触发的话则重置 |
| | | if (flyFrom > -1) |
| | |
| | | .Join(flyHead.transform.DOScale(new Vector3(0.5f, 0.5f, 0.5f), HeroUIManager.clickFlyPosTime).SetEase(Ease.OutQuad)) |
| | | .Join(flyAlphaTween.DOFade(0f, HeroUIManager.clickFlyPosTime).SetEase(Ease.OutQuad)); |
| | | sequence.onComplete = () => { flyHead.transform.localScale = Vector3.zero; }; |
| | | |
| | | if (isToggleOn) |
| | | { |
| | | ShowFetter(flyHero); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void ShowFetter(HeroInfo hero) |
| | | { |
| | | var heroConfig = hero.heroConfig; |
| | | var fetterList = hero.GetActiveFetter(heroConfig, TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType)); |
| | | for (int i = 0; i < fetterList.Count; i++) |
| | | { |
| | | if(!showConnectTipQueue.Contains(fetterList[i])) |
| | | showConnectTipQueue.Enqueue(fetterList[i]); |
| | | } |
| | | |
| | | if (_cts == null) |
| | | { |
| | | _cts = new CancellationTokenSource(); |
| | | RunTaskAsync(_cts.Token).Forget(); // Forget() 表示不等待此任务完成 |
| | | } |
| | | |
| | | } |
| | | async UniTask RunTaskAsync(CancellationToken token) |
| | | { |
| | | try |
| | | { |
| | | while (showConnectTipQueue.Count > 0) |
| | | { |
| | | await UniTask.Delay(300, cancellationToken: token); |
| | | showConnectTipQueue.TryDequeue(out int fetterID); |
| | | if (fetterID == 0) |
| | | { |
| | | continue; |
| | | } |
| | | connetionForm.SetActive(true); |
| | | connetionForm.Display(fetterID); |
| | | //显示1.5秒后关闭 |
| | | await UniTask.Delay(1500, cancellationToken: token); |
| | | connetionForm.SetActive(false); |
| | | } |
| | | |
| | | } |
| | | catch (OperationCanceledException) |
| | | { |
| | | Debug.Log("羁绊 协程被取消"); |
| | | connetionForm.SetActive(false); |
| | | } |
| | | finally |
| | | { |
| | | _cts?.Dispose(); // 释放资源 |
| | | _cts = null; // 置空避免重复取消 |
| | | showConnectTipQueue.Clear(); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 取消当前正在运行的任务 |
| | | public void CancelCurrentTask() |
| | | { |
| | | _cts?.Cancel(); // 触发取消 |
| | | _cts?.Dispose(); // 释放资源 |
| | | _cts = null; // 置空避免重复取消 |
| | | showConnectTipQueue.Clear(); |
| | | } |
| | | |
| | | void OneKeyOnPos() |
| | |
| | | var team = TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType); |
| | | team.SaveTeam(); |
| | | } |
| | | |
| | | void SelectTeamFunc(TeamType type) |
| | | { |
| | | if (HeroUIManager.Instance.selectTeamType == type) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | HeroUIManager.Instance.selectTeamPosJob = 0; |
| | | HeroUIManager.Instance.selectTeamPosCountry = 0; |
| | | HeroUIManager.Instance.SortHeroOnTeamList(); |
| | | HeroUIManager.Instance.selectTeamType = type; |
| | | Refresh(); |
| | | heroListScroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | } |
| | |
| | | heroConfig.AtkDistType == 2 && TeamConst.TeamPos1Array.Contains(index)) |
| | | { |
| | | suggestForm.SetActive(true); |
| | | jobTip.text = Language.Get("heroClass" + heroConfig.Class); |
| | | jobTip.text = RichTextMsgReplaceConfig.GetRichReplace("Class", heroConfig.Class); |
| | | posTip.text = Language.Get("heroAtkDistType" + heroConfig.AtkDistType); |
| | | } |
| | | else |
| | |
| | | [SerializeField] Button unFoldBtn; //展开按钮 |
| | | [SerializeField] GroupButtonEx[] jobsBtn; |
| | | [SerializeField] GroupButtonEx[] countrysBtn; |
| | | [SerializeField] GroupButtonExManager jobManager; |
| | | [SerializeField] GroupButtonExManager countryManager; |
| | | [SerializeField] GroupButtonExManager jobManager; |
| | | [SerializeField] GroupButtonExManager countryManager; |
| | | |
| | | int m_Job = 0; |
| | | int m_Country = 0; |
| | | int foldState = 0; //0 收起,1 展开 |
| | | |
| | | //点击按钮需通知响应外部事件 |
| | | public Action<int, int> selectAction; |
| | | |
| | | private Action<int, int> selectAction; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | unFoldForm.SetActive(foldState == 1); |
| | | foldForm.SetActive(foldState == 0); |
| | | } |
| | | |
| | | |
| | | private void LateUpdate() |
| | | { |
| | | if (foldState == 0) |
| | | return; |
| | | if (Input.GetMouseButtonDown(0)) |
| | | { |
| | | if (!RectTransformUtility.RectangleContainsScreenPoint(this.transform as RectTransform, Input.mousePosition, CameraManager.uiCamera)) |
| | | { |
| | | foldBtn.onClick.Invoke(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | #region 布阵界面 |
| | | public List<string> heroOnTeamSortList { get; private set; } = new List<string>(); //不同上阵的列表排序 |
| | | |
| | | public TeamType selectTeamType = TeamType.Story; //当前选中的是哪个阵容, 布阵相关逻辑使用 |
| | | private TeamType m_SelectTeamType = TeamType.Story; //当前选中的是哪个阵容, 布阵相关逻辑使用 |
| | | public TeamType selectTeamType |
| | | { |
| | | get { return m_SelectTeamType; } |
| | | set |
| | | { |
| | | if (m_SelectTeamType == value) |
| | | return; |
| | | //上一个阵容需要恢复到原状态 |
| | | if (m_SelectTeamType != TeamType.None) |
| | | { |
| | | TeamManager.Instance.GetTeam(m_SelectTeamType).RestoreTeam(); |
| | | } |
| | | |
| | | m_SelectTeamType = value; |
| | | } |
| | | } |
| | | |
| | | public int selectTeamPosJob = 0; //布阵界面 筛选职业 |
| | | public int selectTeamPosCountry = 0; //布阵界面 筛选国家 |
| | | |
| | |
| | | var team = TeamManager.Instance.GetTeam(teamType); |
| | | if (team != null) |
| | | { |
| | | for (int i = 0; i < team.serverHeroes.Length; i++) |
| | | for (int i = 0; i < team.tempHeroes.Length; i++) |
| | | { |
| | | if (team.serverHeroes[i] == null) |
| | | if (team.tempHeroes[i] == null) |
| | | continue; |
| | | var hero = HeroManager.Instance.GetHero(team.serverHeroes[i].guid); |
| | | if (hero != null) |
| | | { |
| | | if (!heroCountryCount.ContainsKey(hero.heroCountry)) |
| | | { |
| | | heroCountryCount.Add(hero.heroCountry, 1); |
| | | } |
| | | else |
| | | { |
| | | heroCountryCount[hero.heroCountry] += 1; |
| | | } |
| | | var country = (HeroCountry)team.tempHeroes[i].heroConfig.Country; |
| | | |
| | | if (!heroCountryCount.ContainsKey(country)) |
| | | { |
| | | heroCountryCount.Add(country, 1); |
| | | } |
| | | else |
| | | { |
| | | heroCountryCount[country] = heroCountryCount[country] + 1; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | //推荐阵容的算法逻辑 |
| | | //自动选择优先级:武将等级>突破等级>武将觉醒阶级>武将品质>武将吞噬星级>武将ID |
| | | var tmpList = HeroManager.Instance.GetHeroGuidList(); |
| | | tmpList.Sort(CmpHeroByTeamType); |
| | | tmpList.Sort(CmpHeroRecommend); |
| | | |
| | | |
| | | //推荐最多6个,存在相同heroid,则跳过 |
| | |
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item);
|
| | | if (singlePack == null) return false;
|
| | |
|
| | | int startLockIndex = singlePack.unlockedGridCount - GeneralDefine.initBagGridCount;
|
| | | int startLockIndex = singlePack.unlockedGridCount - PackManager.Instance.initBagGridCount;
|
| | | FuncConfigConfig _tagFuncModel = FuncConfigConfig.Get("OpenBagItem");
|
| | | int haveCount = packModel.GetItemCountByID(PackType.Item, itemId);
|
| | | Equation.Instance.Clear();
|
New file |
| | |
| | | using UnityEngine;
|
| | |
|
| | | /// <summary>
|
| | | /// 背包格子
|
| | | /// </summary>
|
| | | public class PackGirdCell : MonoBehaviour
|
| | | {
|
| | | [SerializeField] ItemCell itemCell;
|
| | | [SerializeField] RedpointBehaviour redPoint; // 此处红点可以用图片表示
|
| | | public void Display(int index)
|
| | | {
|
| | | var guid = PackManager.Instance.GetSinglePack(PackType.Item).itemGuidList[index];
|
| | | if (string.IsNullOrEmpty(guid))
|
| | | return;
|
| | | itemCell.Init(PackManager.Instance.GetItemByGuid(guid));
|
| | | }
|
| | | }
|
copy from Main/System/Hero/HeroFetterInfo.cs.meta
copy to Main/System/KnapSack/Logic/PackGirdCell.cs.meta
File was copied from Main/System/Hero/HeroFetterInfo.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 61d40aba9c2091445ae692419d4c5ebf |
| | | guid: 3c64a63d0c44fce40a3d1b90b18b2324 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using UnityEngine;
|
| | |
|
| | | /// <summary>
|
| | | /// 背包格子行
|
| | | /// </summary>
|
| | | public class RolePackLineCell : CellView
|
| | | {
|
| | | [SerializeField] PackGirdCell[] itemCell;
|
| | | public void Display(int index)
|
| | | {
|
| | | var itemPack = PackManager.Instance.GetSinglePack(PackType.Item);
|
| | | for (int i = 0; i < itemCell.Length; i++)
|
| | | {
|
| | | if (index + i < itemPack.itemGuidList.Count)
|
| | | {
|
| | | itemCell[i].SetActive(true);
|
| | | itemCell[i].Display(index + i);
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCell[i].SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
copy from Main/System/Hero/HeroFetterInfo.cs.meta
copy to Main/System/KnapSack/Logic/RolePackLineCell.cs.meta
File was copied from Main/System/Hero/HeroFetterInfo.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 61d40aba9c2091445ae692419d4c5ebf |
| | | guid: b5df92a5e4b691444919db543a27de21 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using System; |
| | | using UnityEngine; |
| | | |
| | | /// <summary> |
| | | /// 背包界面 |
| | | /// </summary> |
| | | public class RolePackWin : UIBase |
| | | { |
| | | |
| | | [SerializeField] ScrollerController packScroller; |
| | | [SerializeField] ScrollerController composeScroller; |
| | | [SerializeField] GroupButtonEx packBtn; |
| | | [SerializeField] GroupButtonEx composeBtn; |
| | | |
| | | |
| | | SinglePack itemPack; |
| | | bool isRefreshPack = false; //是否刷新背包 |
| | | /// </summary> |
| | | protected override void InitComponent() |
| | | { |
| | | packBtn.AddListener(() => |
| | | { |
| | | functionOrder = 0; |
| | | Refresh(); |
| | | }); |
| | | composeBtn.AddListener(() => |
| | | { |
| | | functionOrder = 1; |
| | | Refresh(); |
| | | }); |
| | | } |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | itemPack = PackManager.Instance.GetSinglePack(PackType.Item); |
| | | packScroller.OnRefreshCell += RefreshPackCell; |
| | | composeScroller.OnRefreshCell += RefreshComposeCell; |
| | | PackManager.Instance.refrechPackEvent += RefrechPackEvent; |
| | | PackManager.Instance.RefreshItemEvent += RefreshItemEvent; |
| | | |
| | | if (functionOrder == 0) |
| | | { |
| | | packBtn.SelectBtn(); |
| | | } |
| | | else |
| | | { |
| | | composeBtn.SelectBtn(); |
| | | } |
| | | SortItems(); |
| | | Refresh(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | packScroller.OnRefreshCell -= RefreshPackCell; |
| | | composeScroller.OnRefreshCell -= RefreshComposeCell; |
| | | PackManager.Instance.refrechPackEvent -= RefrechPackEvent; |
| | | } |
| | | |
| | | float cdTime = 0f; |
| | | void LateUpdate() |
| | | { |
| | | if (isRefreshPack) |
| | | { |
| | | //刷新cd0.2秒 |
| | | if (Time.time > cdTime + 0.2f) |
| | | { |
| | | SortItems(); |
| | | Refresh(); |
| | | isRefreshPack = false; |
| | | cdTime = Time.time; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | void RefrechPackEvent(PackType type) |
| | | { |
| | | if (type != PackType.Item) |
| | | { |
| | | return; |
| | | } |
| | | //延迟0.2秒刷新 设置 isRefreshPack为true |
| | | isRefreshPack = true; |
| | | |
| | | } |
| | | |
| | | void RefreshItemEvent(PackType type, int index, int itemID) |
| | | { |
| | | if (type != PackType.Item) |
| | | { |
| | | return; |
| | | } |
| | | isRefreshPack = true; |
| | | } |
| | | |
| | | |
| | | public override void Refresh() |
| | | { |
| | | |
| | | packScroller.SetActive(functionOrder == 0); |
| | | composeScroller.SetActive(functionOrder != 0); |
| | | CreatePackScroller(); |
| | | CreateComposeScroller(); |
| | | } |
| | | |
| | | void SortItems() |
| | | { |
| | | itemPack.itemGuidList.Clear(); |
| | | var itemDict = itemPack.GetAllItems(); |
| | | foreach (var itemID in itemDict.Values) |
| | | { |
| | | itemPack.itemGuidList.Add(itemID.guid); |
| | | } |
| | | itemPack.itemGuidList.Sort(CmpItem); |
| | | } |
| | | |
| | | int CmpItem(string guidA, string guidB) |
| | | { |
| | | var itemA = PackManager.Instance.GetItemByGuid(guidA); |
| | | var itemB = PackManager.Instance.GetItemByGuid(guidB); |
| | | |
| | | var typeIndexA = Array.IndexOf(PackManager.Instance.itemPackSortTyps, itemA.config.Type); |
| | | var typeIndexB = Array.IndexOf(PackManager.Instance.itemPackSortTyps, itemB.config.Type); |
| | | if (typeIndexA != typeIndexB) |
| | | { |
| | | return typeIndexA - typeIndexB; |
| | | } |
| | | |
| | | var qualityA = itemA.config.ItemColor; |
| | | var qualityB = itemB.config.ItemColor; |
| | | if (qualityA != qualityB) |
| | | { |
| | | return qualityB - qualityA; |
| | | } |
| | | |
| | | var lvA = itemA.config.LV; |
| | | var lvB = itemB.config.LV; |
| | | if (lvA != lvB) |
| | | { |
| | | return lvB - lvA; |
| | | } |
| | | |
| | | var itemIDA = itemA.config.ID; |
| | | var itemIDB = itemB.config.ID; |
| | | return itemIDA - itemIDB; |
| | | } |
| | | |
| | | void CreatePackScroller() |
| | | { |
| | | if (functionOrder != 0) |
| | | { |
| | | return; |
| | | } |
| | | packScroller.Refresh(); |
| | | for (int i = 0; i < itemPack.itemGuidList.Count; i++) |
| | | { |
| | | if (i % 5 == 0) |
| | | { |
| | | packScroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | } |
| | | packScroller.Restart(); |
| | | } |
| | | |
| | | void CreateComposeScroller() |
| | | { |
| | | if (functionOrder != 1) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | void RefreshPackCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as RolePackLineCell; |
| | | _cell.Display(cell.index); |
| | | } |
| | | |
| | | void RefreshComposeCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | } |
| | | } |
copy from Main/System/Hero/HeroFetterInfo.cs.meta
copy to Main/System/KnapSack/Logic/RolePackWin.cs.meta
File was copied from Main/System/Hero/HeroFetterInfo.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 61d40aba9c2091445ae692419d4c5ebf |
| | | guid: bbbbfd91a59637f4cb7cee421f98052c |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Collections.Generic; |
| | | |
| | | public class SinglePack |
| | | { |
| | |
| | | public int unlockedGridCount { get; private set; } //已开启背包格子数 |
| | | private Dictionary<int, ItemModel> items = new Dictionary<int, ItemModel>(); //key 物品位置索引 |
| | | private Dictionary<int, List<int>> itemIDs = new Dictionary<int, List<int>>(); //key 物品ID:物品位置索引 |
| | | |
| | | public List<string> itemGuidList = new List<string>(); //前端界面GUID排序,各个背包根据实际情况使用 |
| | | |
| | | public SinglePack(PackType type) |
| | | { |
| | | this.type = type; |
New file |
| | |
| | | using UnityEngine;
|
| | |
|
| | | /// <summary>
|
| | | /// 合成格子行
|
| | | /// </summary>
|
| | | public class composeLineCell : CellView
|
| | | {
|
| | | [SerializeField] PackGirdCell[] itemCell;
|
| | | public void Display(int index)
|
| | | {
|
| | | |
| | |
|
| | | }
|
| | | }
|
copy from Main/System/Hero/HeroFetterInfo.cs.meta
copy to Main/System/KnapSack/Logic/composeLineCell.cs.meta
File was copied from Main/System/Hero/HeroFetterInfo.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 61d40aba9c2091445ae692419d4c5ebf |
| | | guid: ff43611139197a9479fcc08c18d025f4 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | public ItemCellformat format { get { return m_Format; } set { m_Format = value; } }
|
| | |
|
| | | Image m_BgIcon;
|
| | | private Image bgIcon {
|
| | | get {
|
| | | private Image bgIcon
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_BgIcon == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_BgIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_BackGround");
|
| | | }
|
| | | return m_BgIcon;
|
| | |
| | | }
|
| | |
|
| | | Image m_ItemIcon;
|
| | | private Image itemIcon {
|
| | | get {
|
| | | private Image itemIcon
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_ItemIcon == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_ItemIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_Icon");
|
| | | }
|
| | | return m_ItemIcon;
|
| | |
| | |
|
| | |
|
| | | Image m_StateIcon;
|
| | | public Image stateIcon {
|
| | | get {
|
| | | public Image stateIcon
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_StateIcon == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_StateIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_State");
|
| | | }
|
| | | return m_StateIcon;
|
| | |
| | | }
|
| | |
|
| | | Text m_CountText;
|
| | | public Text countText {
|
| | | get {
|
| | | public Text countText
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_CountText == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_CountText = this.transform.GetComponent<Text>("Container_ItemCell/Txt_Count");
|
| | | }
|
| | | return m_CountText;
|
| | | }
|
| | | }
|
| | |
|
| | | Image m_CountryIcon;
|
| | | public Image countryIcon
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_CountryIcon == null)
|
| | | {
|
| | | m_CountryIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_Country");
|
| | | }
|
| | | return m_CountryIcon;
|
| | | }
|
| | | }
|
| | |
|
| | | Image m_PieceIcon;
|
| | | public Image pieceIcon
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_PieceIcon == null)
|
| | | {
|
| | | m_PieceIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_Piece");
|
| | | }
|
| | | return m_PieceIcon;
|
| | | }
|
| | | }
|
| | |
|
| | | Transform m_TimeForm;
|
| | | public Transform timeForm
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_TimeForm == null)
|
| | | {
|
| | | m_TimeForm = this.transform.Find("Container_ItemCell/Bg_Time");
|
| | | }
|
| | | return m_TimeForm;
|
| | | }
|
| | | }
|
| | |
|
| | | Text m_TimeText;
|
| | | public Text timeText
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_TimeText == null)
|
| | | {
|
| | | m_TimeText = this.transform.GetComponent<Text>("Container_ItemCell/Bg_Time/Txt_Time");
|
| | | }
|
| | | return m_TimeText;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | Button m_Button;
|
| | | public Button button {
|
| | | get {
|
| | | public Button button
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_Button == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | m_Button = this.GetComponent<Button>("Container_ItemCell");
|
| | | }
|
| | | return m_Button;
|
| | | }
|
| | | }
|
| | |
|
| | | // EquipSuitEffect m_SuitEffect;
|
| | | // EquipSuitEffect suitEffect {
|
| | | // get {
|
| | | // if (m_SuitEffect == null)
|
| | | // {
|
| | | // LoadPrefab();
|
| | | // //clone 会造成二次创建
|
| | | // m_SuitEffect = transform.GetComponentInChildren<EquipSuitEffect>();
|
| | | // if (m_SuitEffect == null)
|
| | | // m_SuitEffect = EquipSuitEffect.Create(transform as RectTransform);
|
| | | // }
|
| | | // return m_SuitEffect;
|
| | | // }
|
| | | // }
|
| | |
|
| | | //物品基础特效(物品表)
|
| | | ItemBaseEffect m_ItemBaseEffect;
|
| | | ItemBaseEffect itemBaseEffect {
|
| | | get {
|
| | | UIEffectPlayer m_ItemBaseEffect;
|
| | | UIEffectPlayer itemBaseEffect
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_ItemBaseEffect == null)
|
| | | {
|
| | | LoadPrefab();
|
| | | //clone 会造成二次创建
|
| | | m_ItemBaseEffect = transform.GetComponentInChildren<ItemBaseEffect>();
|
| | | if (m_ItemBaseEffect == null)
|
| | | m_ItemBaseEffect = ItemBaseEffect.Create(transform as RectTransform);
|
| | | m_ItemBaseEffect = transform.GetComponentInChildren<UIEffectPlayer>();
|
| | | }
|
| | | return m_ItemBaseEffect;
|
| | | }
|
| | | }
|
| | |
|
| | | // public bool suitEffectDirty { get; set; }
|
| | |
|
| | | GameObject cellContainer;
|
| | | protected void LoadPrefab()
|
| | |
| | | }
|
| | | if (cellContainer == null)
|
| | | {
|
| | | switch (format)
|
| | | {
|
| | | case ItemCellformat.Format_64x64:
|
| | | cellContainer = UIUtility.CreateWidget("ItemCell_64", "Container_ItemCell");
|
| | | break;
|
| | | case ItemCellformat.Format_70x70:
|
| | | cellContainer = UIUtility.CreateWidget("ItemCell_70", "Container_ItemCell");
|
| | | break;
|
| | | case ItemCellformat.Format_80x80:
|
| | | cellContainer = UIUtility.CreateWidget("ItemCell_80", "Container_ItemCell");
|
| | | break;
|
| | | case ItemCellformat.Format_84x84:
|
| | | cellContainer = UIUtility.CreateWidget("ItemCell_84", "Container_ItemCell");
|
| | | break;
|
| | | case ItemCellformat.Format_100x100:
|
| | | cellContainer = UIUtility.CreateWidget("ItemCell_100", "Container_ItemCell");
|
| | | break;
|
| | | case ItemCellformat.Format_120x120:
|
| | | cellContainer = UIUtility.CreateWidget("ItemCell_120", "Container_ItemCell");
|
| | | break;
|
| | | }
|
| | | cellContainer = UIUtility.CreateWidget("ItemCell_120", "Container_ItemCell");
|
| | |
|
| | | if (cellContainer != null)
|
| | | {
|
| | | cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one * GetScale(format));
|
| | | cellContainer.transform.SetAsFirstSibling();
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public int itemId { get; private set; }
|
| | | PackManager packModel { get { return PackManager.Instance; } }
|
| | | // EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
|
| | |
|
| | | void OnEnable()
|
| | | {
|
| | | LoadPrefab();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化数据 bool值用来判断是否需要展示评分高低或者职业限制
|
| | |
| | | bgIcon.SetActive(true);
|
| | | itemIcon.SetSprite(config.IconKey);
|
| | | ItemConfig itemConfig = ItemConfig.Get(itemId);
|
| | | bgIcon.SetItemBackGround(ItemLogicUtility.Instance.GetItemQuality(itemId, useDataDic), itemConfig.QualityEchoType);
|
| | | bgIcon.SetItemBackGround(ItemLogicUtility.Instance.GetItemQuality(itemId, useDataDic));
|
| | | if (packModel.textCountShow.ContainsKey(itemId))
|
| | | {
|
| | | countText.SetActive(true);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // suitEffect.Display(itemId, suitEffectDirty);
|
| | | // suitEffectDirty = false;
|
| | | itemBaseEffect.Display(itemId);
|
| | |
|
| | | var compareReslut = isCompare ? Compare(type, itemId, score, guid) : 0;
|
| | | switch (compareReslut)
|
| | | DisPlayEffect(config);
|
| | |
|
| | | // var compareReslut = isCompare ? Compare(type, itemId, score, guid) : 0;
|
| | | // switch (compareReslut)
|
| | | // {
|
| | | // case -1:
|
| | | // stateIcon.SetActive(true);
|
| | | // stateIcon.SetSprite("EquipDownIcon");
|
| | | // break;
|
| | | // case 0:
|
| | | // stateIcon.SetActive(false);
|
| | | // break;
|
| | | // case 1:
|
| | | // stateIcon.SetActive(true);
|
| | | // stateIcon.SetSprite("EquipUpIcon");
|
| | | // break;
|
| | | // case 99:
|
| | | // stateIcon.SetActive(true);
|
| | | // stateIcon.SetSprite("EquipForbidIcon");
|
| | | // break;
|
| | | // }
|
| | |
|
| | | if (config.Type == (int)ItemType.Hero)
|
| | | {
|
| | | case -1:
|
| | | stateIcon.SetActive(true);
|
| | | stateIcon.SetSprite("EquipDownIcon");
|
| | | break;
|
| | | case 0:
|
| | | stateIcon.SetActive(false);
|
| | | break;
|
| | | case 1:
|
| | | stateIcon.SetActive(true);
|
| | | stateIcon.SetSprite("EquipUpIcon");
|
| | | break;
|
| | | case 99:
|
| | | stateIcon.SetActive(true);
|
| | | stateIcon.SetSprite("EquipForbidIcon");
|
| | | break;
|
| | | var heroConfig = HeroConfig.Get(itemId);
|
| | | countryIcon.SetActive(true);
|
| | | countryIcon.SetSprite("herocountry" + heroConfig.Country);
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | countryIcon.SetActive(false);
|
| | | }
|
| | | // pieceIcon.SetActive(); //待策划确定
|
| | | }
|
| | |
|
| | | // / <summary>
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // int GetDogzEquipScore(int equipPlace)
|
| | | // {
|
| | | // var dogzModel = ModelCenter.Instance.GetModel<DogzModel>();
|
| | | // ItemModel putOnModel = null;
|
| | | // dogzModel.TryGetDogzEquip(dogzModel.presentSelectDogz, equipPlace, out putOnModel);
|
| | | // return putOnModel == null ? 0 : putOnModel.score;
|
| | | // }
|
| | |
|
| | | // int GetSpiritWeaponScore(int equipPlace)
|
| | | // {
|
| | | // var spiritWeaponModel = ModelCenter.Instance.GetModel<SpiritWeaponModel>();
|
| | | // var guid = spiritWeaponModel.GetSpiritWeapon((RoleEquipType)equipPlace);
|
| | | // var item = packModel.GetItemByGuid(guid);
|
| | | // return item != null ? item.score : 0;
|
| | | // }
|
| | | void DisPlayEffect(ItemConfig config)
|
| | | {
|
| | | if (config.BaseEffectID == 0)
|
| | | {
|
| | | if (itemBaseEffect != null)
|
| | | {
|
| | | itemBaseEffect.SetActive(false);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | itemBaseEffect.SetActive(true);
|
| | | itemBaseEffect.effectId = config.BaseEffectID;
|
| | | itemBaseEffect.Play();
|
| | | }
|
| | | }
|
| | | |
| | | float GetScale(ItemCellformat format)
|
| | | {
|
| | | switch (format)
|
| | | {
|
| | | case ItemCellformat.Format_120x120:
|
| | | return 1f;
|
| | | case ItemCellformat.Format_100x100:
|
| | | return 0.83f;
|
| | | case ItemCellformat.Format_84x84:
|
| | | return 0.7f;
|
| | | case ItemCellformat.Format_80x80:
|
| | | return 0.66f;
|
| | | case ItemCellformat.Format_70x70:
|
| | | return 0.58f;
|
| | | case ItemCellformat.Format_64x64:
|
| | | return 0.53f;
|
| | | default:
|
| | | return 1f;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | using System; |
| | | |
| | | |
| | | public class ItemCell : CommonItemBaisc |
| | | { |
| | | |
| | | |
| | | public override void Init(ItemModel model, bool isCompare = false) |
| | | { |
| | | if (model == null) |
| | | { |
| | | return; |
| | | } |
| | | base.Init(model, isCompare); |
| | | |
| | | } |
| | |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | using System.Text.RegularExpressions; |
| | | using System.Collections; |
| | | using System.IO; |
| | | |
| | | public class PackManager : GameSystemManager<PackManager> |
| | | //public class PackModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk |
| | | { |
| | | public Dictionary<int, int> PackMaxCountDict = new Dictionary<int, int>(); //背包类型:背包格子最大数量 |
| | | public Dictionary<int, int> PackInitCountDict = new Dictionary<int, int>(); //背包类型:初始数量 |
| | | public int initBagGridCount { get; private set; } //初始物品背包格子数 |
| | | public int[] itemPackSortTyps { get; private set; } //背包物品的按类型排序 |
| | | |
| | | public static string StrengthAttrShift_RecordKey = ""; |
| | | public const string RecordKnapsackTitle = "RecordKnapsackTitle"; |
| | | |
| | |
| | | DeleteItemDictByGUID(type, guid); |
| | | } |
| | | } |
| | | refrechPackEvent?.Invoke(type); |
| | | } |
| | | |
| | | public void RemoveItem(H0709_tagClearItem clearItem) |
| | |
| | | #region 玩家装备特殊逻辑 |
| | | void ParseConfig() |
| | | { |
| | | |
| | | |
| | | var config = FuncConfigConfig.Get("CommonShowAwards"); |
| | | commonShowAwardEvents = JsonMapper.ToObject<List<string>>(config.Numerical1); |
| | | |
| | | config= FuncConfigConfig.Get("InitBagCellCount"); |
| | | initBagGridCount = int.Parse(config.Numerical1); |
| | | PackInitCountDict = ConfigParse.ParseIntDict(config.Numerical2); |
| | | |
| | | config = FuncConfigConfig.Get("PackageSortPriority"); |
| | | itemPackSortTyps = ConfigParse.GetMultipleStr<int>(config.Numerical1); |
| | | ParsePackConfigIni(); |
| | | } |
| | | |
| | | void ParsePackConfigIni() |
| | | { |
| | | string[] lines = LoadConfigIni("MapServerConfig"); |
| | | foreach (string line in lines) |
| | | { |
| | | if (line.StartsWith("PackCnt") && line.Contains("=")) |
| | | { |
| | | string[] parts = line.Split('='); |
| | | if (parts.Length == 2 && int.TryParse(parts[1], out int count)) |
| | | { |
| | | string packTypeStr = parts[0].Replace("PackCnt", ""); |
| | | if (int.TryParse(packTypeStr, out int packTypeIndex)) |
| | | { |
| | | PackMaxCountDict[packTypeIndex] = count; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public string[] LoadConfigIni(string name) |
| | | { |
| | | string path = string.Empty; |
| | | #if UNITY_EDITOR |
| | | if (!AssetSource.isUseAssetBundle) |
| | | { |
| | | path = ResourcesPath.CONFIG_FODLER + "/" + name + ".ini"; |
| | | } |
| | | else |
| | | #endif |
| | | { |
| | | path = AssetVersionUtility.GetAssetFilePath($"Config/{name}.ini"); |
| | | } |
| | | |
| | | return File.ReadAllLines(path); |
| | | } |
| | | |
| | | |
| | | private void UpdateSecond() |
| | |
| | | public SinglePack GetSinglePack(PackType type) |
| | | { |
| | | SinglePack singlePack = null; |
| | | playerPackDict.TryGetValue(type, out singlePack); |
| | | if (!playerPackDict.TryGetValue(type, out singlePack)) |
| | | { |
| | | singlePack = new SinglePack(type); |
| | | playerPackDict.Add(type, singlePack); |
| | | } |
| | | return singlePack; |
| | | } |
| | | |
| | |
| | | public abstract class FunctionsBaseWin : UIBase |
| | | { |
| | | // 标签按钮组 |
| | | public Button[] tabButtons; |
| | | public GroupButtonEx[] tabButtons; |
| | | |
| | | // 当前打开的子界面 |
| | | protected UIBase currentSubUI; |
| | |
| | | /// </summary> |
| | | protected override void InitComponent() |
| | | { |
| | | base.InitComponent(); |
| | | |
| | | // 初始化UI组件事件 |
| | | InitButtonEvents(); |
| | | } |
| | |
| | | // 更新当前选中的标签索引 |
| | | functionOrder = index; |
| | | |
| | | // 更新按钮状态 |
| | | UpdateButtonsState(); |
| | | |
| | | // 关闭当前打开的子界面 |
| | | CloseCurrentSubUI(); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 更新按钮状态 |
| | | /// </summary> |
| | | protected abstract void UpdateButtonsState(); |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据标签索引打开对应的子界面 |
| | |
| | | //关卡 |
| | | [SerializeField] Button bossBtn; |
| | | |
| | | [SerializeField] Button changeHeroPosBtn; |
| | | |
| | | /// <summary> |
| | | /// 初始化组件 |
| | | /// </summary> |
| | |
| | | bossBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<MainBossEnterWin>(); |
| | | }); |
| | | |
| | | changeHeroPosBtn.AddListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectTeamType = TeamType.Story; |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(); |
| | | }); |
| | | } |
| | | |
| | |
| | | TaskManager.Instance.OnTaskUpdate += UpdateTask; |
| | | Refresh(); |
| | | UIManager.Instance.OpenWindow<BattleWin>(); |
| | | |
| | | taskEffect.effectId = Random.Range(1007, 1008); |
| | | taskEffect.Play(); |
| | | } |
| | | protected override void OnOpen() |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 更新按钮状态 |
| | | /// </summary> |
| | | protected override void UpdateButtonsState() |
| | | { |
| | | // 遍历所有按钮,设置选中状态 |
| | | // for (int i = 0; i < tabButtons.Length; i++) |
| | | // { |
| | | |
| | | // // bottomTabButtons[i].image.color = (i == currentTabIndex) ? Color.white : Color.gray; |
| | | // } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据标签索引打开对应的子界面 |
| | | /// </summary> |
| | |
| | | Debug.Log("打开主城界面"); |
| | | break; |
| | | case 1: |
| | | // currentSubUI = UIManager.Instance.OpenUI<CharacterUI>(); |
| | | currentSubUI = UIManager.Instance.OpenWindow<RolePackWin>(); |
| | | Debug.Log("打开内政界面"); |
| | | break; |
| | | case 2: |
| | |
| | | |
| | | public override string Analysis(string val, bool IsRich) |
| | | { |
| | | if (!Color_Start_Regex.IsMatch(val) || RichTextMgr.Inst.presentRichText == null) |
| | | { |
| | | return val; |
| | | } |
| | | int index = 0; |
| | | m_StringBuilder.Length = 0; |
| | | var _text = RichTextMgr.Inst.presentRichText; |
| | | if (_text.colorType == RichText.ColorType.Bright) |
| | | { |
| | | return val; |
| | | } |
| | | foreach (Match match in Color_Start_Regex.Matches(val)) |
| | | { |
| | | m_StringBuilder.Append(val.Substring(index, match.Groups[1].Index - index)); |
| | | m_StringBuilder.Append(GetColorMap(match.Groups[1].Value)); |
| | | index = match.Groups[1].Index + match.Groups[1].Length; |
| | | } |
| | | m_StringBuilder.Append(val.Substring(index, val.Length - index)); |
| | | return m_StringBuilder.ToString(); |
| | | return val; |
| | | // if (!Color_Start_Regex.IsMatch(val) || RichTextMgr.Inst.presentRichText == null) |
| | | // { |
| | | // return val; |
| | | // } |
| | | // int index = 0; |
| | | // m_StringBuilder.Length = 0; |
| | | // var _text = RichTextMgr.Inst.presentRichText; |
| | | // if (_text.colorType == RichText.ColorType.Bright) |
| | | // { |
| | | // return val; |
| | | // } |
| | | // foreach (Match match in Color_Start_Regex.Matches(val)) |
| | | // { |
| | | // m_StringBuilder.Append(val.Substring(index, match.Groups[1].Index - index)); |
| | | // m_StringBuilder.Append(GetColorMap(match.Groups[1].Value)); |
| | | // index = match.Groups[1].Index + match.Groups[1].Length; |
| | | // } |
| | | // m_StringBuilder.Append(val.Substring(index, val.Length - index)); |
| | | // return m_StringBuilder.ToString(); |
| | | } |
| | | |
| | | private string GetColorMap(string _value) |
| | |
| | | { |
| | | _value = _value.Substring(0, 6); |
| | | } |
| | | switch (_value.ToLower()) |
| | | { |
| | | case "109d06": |
| | | return "35e122"; |
| | | case "ff6701": |
| | | return "f8983b"; |
| | | case "006be3": |
| | | return "31cefb"; |
| | | case "ff0303": |
| | | return "fa0101"; |
| | | case "12a199": |
| | | return "13a199"; |
| | | case "686868": |
| | | return "f7f7f7"; |
| | | case "da48d5": |
| | | return "ec4bf6"; |
| | | case "f6408d": |
| | | return "ff7c7c"; |
| | | case "bb8800": |
| | | return "ffde00"; |
| | | case "666666": |
| | | return "dddddd"; |
| | | case "9460ff": |
| | | return "7999ff"; |
| | | case "0066ff": |
| | | return "00c6ff"; |
| | | case "00b337": |
| | | return "66ff00"; |
| | | case "ff6600": |
| | | return "ff9000"; |
| | | case "ff00f6": |
| | | return "f000ff"; |
| | | } |
| | | // switch (_value.ToLower()) |
| | | // { |
| | | // case "109d06": |
| | | // return "35e122"; |
| | | // case "ff6701": |
| | | // return "f8983b"; |
| | | // case "006be3": |
| | | // return "31cefb"; |
| | | // case "ff0303": |
| | | // return "fa0101"; |
| | | // case "12a199": |
| | | // return "13a199"; |
| | | // case "686868": |
| | | // return "f7f7f7"; |
| | | // case "da48d5": |
| | | // return "ec4bf6"; |
| | | // case "f6408d": |
| | | // return "ff7c7c"; |
| | | // case "bb8800": |
| | | // return "ffde00"; |
| | | // case "666666": |
| | | // return "dddddd"; |
| | | // case "9460ff": |
| | | // return "7999ff"; |
| | | // case "0066ff": |
| | | // return "00c6ff"; |
| | | // case "00b337": |
| | | // return "66ff00"; |
| | | // case "ff6600": |
| | | // return "ff9000"; |
| | | // case "ff00f6": |
| | | // return "f000ff"; |
| | | // } |
| | | return _value; |
| | | } |
| | | |
| | |
| | | tempHeroes[posNum] = hero; |
| | | } |
| | | |
| | | // 布阵接口: 恢复阵容 |
| | | public void RestoreTeam() |
| | | { |
| | | for (int i = 0; i < tempHeroes.Length; i++) |
| | | { |
| | | tempHeroes[i] = serverHeroes[i]; |
| | | } |
| | | } |
| | | |
| | | |
| | | public void AddHero(HeroInfo heroInfo, int targetPosition) |
| | | { |
| | | if (targetPosition < 0 || targetPosition >= tempHeroes.Length) |
| | |
| | | public enum TeamType |
| | | { |
| | | None = 0, |
| | | // PVE |
| | | Story = 1, |
| | | // PVP 进攻 |
| | | Arena = 2, |
| | | // PVP 防守 |
| | | ArenaDefense = 3, |
| | | Tower = 4, |
| | | Story = 1, //主线 |
| | | Arena = 2, //竞技场进攻 |
| | | ArenaDefense = 3, //竞技场防守 |
| | | } |
| | | |
| | |
| | | Equip_Wing = 113, // 翅膀 |
| | | Guard_1 = 114, // 灵守 1 |
| | | Guard_2 = 115, //灵守 2 |
| | | Hero = 150, //武将 |
| | | |
| | | } |
| | | |
| | |
| | | White = 1, |
| | | titleSelectColor = 2, |
| | | titleUnSelectColor = 3, |
| | | |
| | | lightYellow = 4, //浅黄色 |
| | | Red = 5, |
| | | Pink = 6, |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | // 基于itemColor 下,ColorEx做二级区分 |
| | | public static void SetItemBackGround(this Image _image, int itemColor, int ColorEx = 0) |
| | | public static void SetItemBackGround(this Image _image, int itemColor) |
| | | { |
| | | if (_image == null) |
| | | { |
| | | return; |
| | | } |
| | | _image.SetSprite(string.Format("Common_Public_ItemColor{0}{1}", itemColor, ColorEx)); |
| | | _image.SetSprite($"ItemBG{itemColor}"); |
| | | } |
| | | /// <summary> |
| | | /// 剩余时间 |
| | |
| | | |
| | | public static readonly Color s_NavyBrown = new Color32(110, 76, 49, 255);//6e4c31 |
| | | public static readonly Color s_Black = new Color32(0, 0, 0, 255); |
| | | public static readonly Color s_NavyYellow = new Color32(255, 239, 71, 255); |
| | | public static readonly Color s_NavyYellow = new Color32(242, 238, 2, 255); //f2ee02 |
| | | public static readonly Color s_LightGreen = new Color32(42, 227, 55, 255);//2ae337 |
| | | public static readonly Color s_LightWhite = new Color32(245, 246, 230, 255); //f5f6e6 |
| | | public static readonly Color s_Gray = new Color32(187, 187, 187, 255); //bbbbbb |
| | | public static readonly Color s_Gray = new Color32(132, 121, 123, 255); //84797b |
| | | public static readonly Color s_Gold = new Color32(255, 239, 71, 255);//ffef47 |
| | | public static readonly Color s_EarthYellow = new Color32(248, 152, 59, 255);//f8983b |
| | | |
| | |
| | | case TextColType.White: |
| | | return bright ? s_BrightWhiteColor : s_DarkWhiteColor; // s_BrightWhiteColor 是亮底灰色 |
| | | case TextColType.titleSelectColor: |
| | | return new Color32(114, 157, 228, 255); |
| | | case TextColType.titleUnSelectColor: |
| | | return new Color32(127, 65, 57, 255); |
| | | case TextColType.titleUnSelectColor: |
| | | return new Color32(110, 92, 96, 255); |
| | | case TextColType.Red: |
| | | return bright ? s_BrightRedColor : s_DarkRedColor; |
| | | case TextColType.Pink: |
| | |
| | | return s_BrightGreenColor; |
| | | case TextColType.Black: |
| | | return s_Black; |
| | | case TextColType.lightYellow: //浅黄色 |
| | | return new Color32(252, 237, 185, 255); |
| | | case TextColType.NavyYellow: |
| | | return s_NavyYellow; |
| | | case TextColType.LightGreen: |
| | |
| | | |
| | | public static string AppendColor(TextColType type, string msg, bool bright = false) |
| | | { |
| | | if (m_TextColorRegex.IsMatch(msg) && msg.ToLower().StartsWith("<color=#") |
| | | && msg.ToLower().EndsWith("</color>")) |
| | | { |
| | | Match match = m_TextColorRegex.Match(msg); |
| | | msg = match.Groups[1].Value; |
| | | } |
| | | // if (m_TextColorRegex.IsMatch(msg) && msg.ToLower().StartsWith("<color=#") |
| | | // && msg.ToLower().EndsWith("</color>")) |
| | | // { |
| | | // Match match = m_TextColorRegex.Match(msg); |
| | | // msg = match.Groups[1].Value; |
| | | // } |
| | | switch (type) |
| | | { |
| | | case TextColType.None: |
| | |
| | | case TextColType.LightGreen: |
| | | return StringUtility.Contact("<color=#", "8ddc11", ">", msg, "</color>"); |
| | | case TextColType.Gray: |
| | | return StringUtility.Contact("<color=#", "686868", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#", "84797b", ">", msg, "</color>"); |
| | | case TextColType.lightYellow: |
| | | return StringUtility.Contact("<color=#", "fcedb9", ">", msg, "</color>"); |
| | | case TextColType.NavyYellow: |
| | | return StringUtility.Contact("<color=#", "f2ee02", ">", msg, "</color>"); |
| | | } |
| | | return msg; |
| | | } |