You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			71 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			71 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C#
		
	
| using Entitas;
 | |
| using Game;
 | |
| using System.Collections.Generic;
 | |
| using Articy.Unity;
 | |
| using Articy.Touhou;
 | |
| 
 | |
| /// <summary>
 | |
| /// 局内背包,局内掉落物品/货币/祝福 都在此管理
 | |
| /// </summary>
 | |
| 
 | |
| [Game]
 | |
| public class BagComponent : IComponent
 | |
| {
 | |
|     public MetaDictionary<string, int> AllBless = new MetaDictionary<string, int>();    //所有祝福
 | |
|     public List<string> ChooseBless = new List<string>(); //祝福选择界面备选项
 | |
| }
 | |
| 
 | |
| namespace Game
 | |
| {
 | |
|     public abstract partial class Util
 | |
|     {
 | |
|         //添加祝福
 | |
|         public static void AddBless(GameEntity entity, string blessId, int level = 1)
 | |
|         {
 | |
|             var bag = entity.bag;
 | |
|             var cfg = Util.GetBlessConfig(blessId);
 | |
|             bag.AllBless[blessId] = level;
 | |
|         }
 | |
|         //移除祝福
 | |
|         public static void RemoveBless(GameEntity entity, string blessId)
 | |
|         {
 | |
|             var bag = entity.bag;
 | |
|             var cfg = Util.GetBlessConfig(blessId);
 | |
|         }
 | |
|         //是否拥有祝福
 | |
|         public static bool HasBless(GameEntity entity, string blessId)
 | |
|         {
 | |
|             var bag = entity.bag;
 | |
|             return bag.AllBless.ContainsKey(blessId);
 | |
|         }
 | |
|         //获取次级祝福数量
 | |
|         public static int GetSubBlessNum(GameEntity entity)
 | |
|         {
 | |
|             var bag = entity.bag;
 | |
|             return bag.AllBless.Count;
 | |
|         }
 | |
|         //移除所有祝福
 | |
|         public static void RemoveAllBless(GameEntity entity)
 | |
|         {
 | |
|             var bag = entity.bag;
 | |
|             bag.AllBless.Clear();
 | |
|         }
 | |
|         private static bool CheckBlessGroup(GameEntity entity, ArticyObject groupObj)
 | |
|         {
 | |
|             if (groupObj == null)
 | |
|             {
 | |
|                 return true;
 | |
|             }
 | |
|             var blessGroup = (groupObj as IObjectWithFeatureBlessGroup).GetFeatureBlessGroup();
 | |
|             foreach (var blessObj in blessGroup.BlessGroup)
 | |
|             {
 | |
|                 if (Util.HasBless(entity, blessObj.TechnicalName))
 | |
|                 {
 | |
|                     return true;
 | |
|                 }
 | |
|             }
 | |
|             return false;
 | |
|         }
 | |
| 
 | |
|     }
 | |
| } |