using Entitas; using Game; using System.Collections.Generic; using Articy.Unity; using Articy.Touhou; /// /// 局内背包,局内掉落物品/货币/祝福 都在此管理 /// [Game] public class BagComponent : IComponent { public MetaDictionary AllBless = new MetaDictionary(); //所有祝福 public List ChooseBless = new List(); //祝福选择界面备选项 } 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; } } }