예제 #1
0
        public static void PlayerCreate(string i_name, string i_profession)
        {
            TalentPoints tem = new TalentPoints()
            {
                HP      = 0,
                Agile   = 0,
                Defense = 0,
                Power   = 0,
                Precise = 0
            };
            Player player = new Player()
            {
                Name               = i_name,
                Profession         = i_profession,
                Equipments         = new Array_Equipment(),
                Exp                = 0,
                HP                 = 0,
                PP                 = 50,
                PP_Max             = 50,
                Money              = 0,
                RemainTalentPoints = 25,
                TalentPoints       = tem
            };
            Array_Item items = new Array_Item();

            GameValue.Players.Add(player);
            GameDataWrite.GamePlayerSave(GameValue.Players,
                                         Environment.CurrentDirectory + "/Data/PlayerData/Players.txt");
            string PlayerPath = Environment.CurrentDirectory + "/Data/PlayerData/" + player.Name + "/";

            Directory.CreateDirectory(PlayerPath);
            PlayerDataWrite.PlayerItemSave(items, PlayerPath + "PlayerItem.txt");
            PlayerDataWrite.PlayerEquipmentSave(player.Equipments, PlayerPath + "PlayerEquipment.txt");
        }
예제 #2
0
 public int GetAttribute(AttributeValue Tybe)
 {
     return(Equipments.GetAdditiveTotal(Tybe)
            + TalentPoints.GetTalentPoints(Tybe) * GetLv());
 }
예제 #3
0
        public static List <Player> GamePlayerLoad(string path)
        {
            var data_input = ReadFiles.ItemRead(path, ReadFiles.ReadMode.SafeRead);

            string[]        item_tybe    = data_input.Item2;
            string[]        item_value   = data_input.Item3;
            int             i            = 0;
            List <Player>   players      = new List <Player>();
            Player          player       = new Player();
            Array_Equipment equipments   = new Array_Equipment();
            TalentPoints    talentPoints = new TalentPoints();

            foreach (string tem in item_tybe)
            {
                switch (tem)
                {
                case "player_name":
                    player       = new Player();
                    talentPoints = new TalentPoints();
                    player.Name  = item_value[i];
                    break;

                case "player_profession":
                    player.Profession = item_value[i];
                    break;

                case "player_exp":
                    player.Exp = int.Parse(item_value[i]);
                    break;

                case "player_money":
                    player.Money = int.Parse(item_value[i]);
                    break;

                case "player_pp":
                    player.PP = int.Parse(item_value[i]);
                    break;

                case "player_hp":
                    player.HP = int.Parse(item_value[i]);
                    break;

                case "player_hp_talent":
                    talentPoints.HP = int.Parse(item_value[i]);
                    break;

                case "player_power_talent":
                    talentPoints.Power = int.Parse(item_value[i]);
                    break;

                case "player_defense_talent":
                    talentPoints.Defense = int.Parse(item_value[i]);
                    break;

                case "player_agile_talent":
                    talentPoints.Agile = int.Parse(item_value[i]);
                    break;

                case "player_precise_talent":
                    talentPoints.Precise = int.Parse(item_value[i]);
                    break;

                case "player_remain_talent":
                    player.RemainTalentPoints = int.Parse(item_value[i]);
                    player.TalentPoints       = talentPoints;
                    players.Add(player);
                    break;
                }
                i++;
            }
            return(players);
        }