示例#1
0
        private void AddUnits(int villageId, TroupType type, TroupData data)
        {
            if (!_troupDataVillage.TryGetValue(villageId, out var troupDataVillage))
            {
                _troupDataVillage.Add(villageId, new TroupDataVillage {
                    VillageId = villageId
                });
            }

            switch (type)
            {
            case TroupType.TROUP_OWN:
                _troupDataVillage[villageId].TroupOwn = data;
                break;

            case TroupType.TROUP_VILLAGE:
                _troupDataVillage[villageId].TroupVillage = data;
                break;

            case TroupType.TROUP_OUT:
                _troupDataVillage[villageId].TroupOut = data;
                break;

            case TroupType.TROUP_AWAY:
                _troupDataVillage[villageId].TroupAway = data;
                break;
            }
        }
示例#2
0
        public int GetTroupPop(TroupData data)
        {
            var pop = 0;

            pop += data.UnitSpear * _server.Local.ConfigUnits.GetConfig <int>("spear", "pop");
            pop += data.UnitSword * _server.Local.ConfigUnits.GetConfig <int>("sword", "pop");
            pop += data.UnitAxe * _server.Local.ConfigUnits.GetConfig <int>("axe", "pop");
            pop += data.UnitSpy * _server.Local.ConfigUnits.GetConfig <int>("spy", "pop");
            pop += data.UnitLight * _server.Local.ConfigUnits.GetConfig <int>("light", "pop");
            pop += data.UnitHeavy * _server.Local.ConfigUnits.GetConfig <int>("heavy", "pop");
            pop += data.UnitRam * _server.Local.ConfigUnits.GetConfig <int>("ram", "pop");
            pop += data.UnitCatapult * _server.Local.ConfigUnits.GetConfig <int>("catapult", "pop");
            pop += data.UnitKnight * _server.Local.ConfigUnits.GetConfig <int>("knight", "pop");
            pop += data.UnitSnob * _server.Local.ConfigUnits.GetConfig <int>("snob", "pop");
            return(pop);
        }