コード例 #1
0
ファイル: UnitsController.cs プロジェクト: guyt101z/Core
        public IActionResult GetUnitsForGroup(int groupId)
        {
            var units = new List <UnitJson>();
            var group = _departmentGroupsService.GetGroupById(groupId);

            if (group == null || group.DepartmentId != DepartmentId)
            {
                Unauthorized();
            }

            var savedUnits = _unitsService.GetAllUnitsForGroup(groupId);

            foreach (var unit in savedUnits)
            {
                var unitJson = new UnitJson();
                unitJson.UnitId = unit.UnitId;
                unitJson.Name   = unit.Name;
                unitJson.Type   = unit.Type;

                if (unit.StationGroup != null)
                {
                    unitJson.Station = unit.StationGroup.Name;
                }

                units.Add(unitJson);
            }

            return(Json(units));
        }
コード例 #2
0
        public UnitJson ToDomainObject(EfUnit entity)
        {
            UnitJson _UnitJson = new UnitJson();

            _UnitJson.Title        = entity.Title;
            _UnitJson.ID           = entity.ID.ToString();
            _UnitJson.AccessGroups = entity.AccessGroups;
            return(_UnitJson);
        }
コード例 #3
0
    public PlayerCharacter(PlayerCharacter target)
    {
        info                    = new UnitJson();
        info.id                 = target.info.id;
        info.name               = target.info.name;
        info.description        = target.info.description;
        info.faceImgPath        = target.info.faceImgPath;
        info.learnedSkills      = target.info.learnedSkills;
        info.modelImgPath       = target.info.modelImgPath;
        info.race               = target.info.race;
        info.totalSkills        = target.info.totalSkills;
        info.type               = target.info.type;
        info.stats              = new UnitStatJson();
        info.stats.hp           = target.info.stats.hp;
        info.stats.mp           = target.info.stats.mp;
        info.stats.strength     = target.info.stats.strength;
        info.stats.dexterity    = target.info.stats.dexterity;
        info.stats.intelligence = target.info.stats.intelligence;
        info.stats.vitality     = target.info.stats.vitality;
        info.stats.endurance    = target.info.stats.endurance;
        info.stats.wisdom       = target.info.stats.wisdom;
        info.stats.level        = target.info.stats.level;
        info.stats.fireRes      = target.info.stats.fireRes;
        info.stats.lightningRes = target.info.stats.lightningRes;
        info.stats.iceRes       = target.info.stats.iceRes;
        info.stats.holyRes      = target.info.stats.holyRes;
        info.stats.darkRes      = target.info.stats.darkRes;
        if (target.weapon != null && target.weapon.weapon != null)
        {
            weapon = new PlayerWeapon(target.weapon.weapon.id);
        }
        armors = new List <PlayerArmor>();
        for (int i = 0; i < target.armors.Count; i++)
        {
            if (target.armors[i] != null && target.armors[i].armor != null)
            {
                armors.Add(new PlayerArmor(target.armors[i].armor.id));
            }
        }

        level      = target.level;
        experience = target.experience;

        bodyPower = target.bodyPower;

        availableAttributes  = target.availableAttributes;
        availableSkillPoints = target.availableSkillPoints;

        CalculateBattleStat();
        RefreshStatus();
    }
コード例 #4
0
    public PlayerCharacter(CharacterJson json, int targetLevel)
    {
        info = new UnitJson
        {
            id            = json.id,
            name          = json.name,
            description   = json.description,
            race          = json.race,
            type          = json.type,
            learnedSkills = json.learnedSkills,
            totalSkills   = json.totalSkills,
            modelImgPath  = json.modelImgPath,
            faceImgPath   = json.faceImgPath,
            stats         = new UnitStatJson()
        };

        weaponTypes = json.weaponTypes;

        //if (!String.IsNullOrEmpty(json.weaponID))
        //{
        weapon = new PlayerWeapon(json.weaponID);
        //}

        // (json.armorIDs.Length > 0)
        //{
        armors = new List <PlayerArmor>();
        for (int i = 0; i < json.armorIDs.Length; i++)
        {
            armors.Add(new PlayerArmor(json.armorIDs[i]));
        }
        //}

        SetStatByLevel(targetLevel, json);

        bodyPower = 0;

        availableAttributes  = 0;
        availableSkillPoints = 0;

        CalculateBattleStat();
        RefreshStatus();
    }
コード例 #5
0
ファイル: UnitsController.cs プロジェクト: guyt101z/Core
        public IActionResult GetUnits()
        {
            var units      = new List <UnitJson>();
            var savedUnits = _unitsService.GetUnitsForDepartment(DepartmentId);

            foreach (var unit in savedUnits)
            {
                var unitJson = new UnitJson();
                unitJson.UnitId = unit.UnitId;
                unitJson.Name   = unit.Name;
                unitJson.Type   = unit.Type;

                if (unit.StationGroup != null)
                {
                    unitJson.Station = unit.StationGroup.Name;
                }

                units.Add(unitJson);
            }

            return(Json(units));
        }