예제 #1
0
        public GameConfigRepository()
        {
            _entities = new Dictionary <string, DynamicDataList>();

            var jsonFiles = Directory.GetFiles(".\\Content\\GameMetaData", "Config.*.json");

            foreach (var jsonFile in jsonFiles)
            {
                var fileName   = Path.GetFileNameWithoutExtension(jsonFile);
                var entityName = fileName.Split('.')[1];

                var jsonString = File.ReadAllText(jsonFile);
                var list       = DynamicDataList.Create($"{entityName}s", jsonString);
                _entities.Add(entityName, list);
            }
        }
예제 #2
0
        public static DynamicDataList GetActionsThatApplyToAll()
        {
            if (_actionsThatApplyToAll is null)
            {
                var list = DynamicDataList.Create("Actions");

                var gameConfigCache = CallContext <GameConfigCache> .GetData("GameConfigCache");

                var actionIds = gameConfigCache.GetActionConfigIds();

                foreach (var actionId in actionIds)
                {
                    var action = gameConfigCache.GetActionConfigById(actionId);
                    if (action.AppliesToAll)
                    {
                        list.Add(action);
                    }
                }

                _actionsThatApplyToAll = list;
            }

            return(_actionsThatApplyToAll);
        }