Пример #1
0
    public static bool Save(Wrestler wrestler, string gameID)
    {
        string filename = WrestlerManager.GetFilename(gameID) + "?tag=" + wrestler.id;

        ES2.Save(wrestler, filename);
        return(true);
    }
Пример #2
0
        public static void ShowDeleteWrestler(Guid wrestlerId)
        {
            var wrestler = WrestlerManager.Get(wrestlerId, _promotion.ID);

            DisplayHelper.ClearScreen();
            Console.WriteLine("DELETE WRESTER");
            Console.WriteLine("Are you sure you want to delete '" + wrestler.Name + "'? (y/n)");

            var choice = Console.ReadKey();

            switch (choice.KeyChar)
            {
            case 'y':
                WrestlerManager.Remove(wrestlerId, _promotion.ID);
                ShowViewWrestlers();
                break;

            case 'n':
                ShowViewWrestler(wrestler);
                break;

            default:
                ShowDeleteWrestler(wrestlerId);
                break;
            }
        }
Пример #3
0
        public static Wrestler SelectWrestlerAll(Guid promotionId)
        {
            var options = new Dictionary <int, Wrestler>();

            var wrestlers = WrestlerManager.GetList(promotionId);

            int i = 1;

            foreach (var wrestler in wrestlers)
            {
                options.Add(i, wrestler);
                i++;
            }

            foreach (var option in options)
            {
                Console.WriteLine(option.Key.ToString() + ". " + option.Value.Name);
            }

            Console.WriteLine("0. Back");

            var choice = InputHelper.GetIntCharacter(0, options.Count);

            if (choice == 0)
            {
                return(null);
            }
            else
            {
                return(options[choice]);
            }
        }
Пример #4
0
    public void DeleteSaved(SavedGame game)
    {
        GameManager.DeleteSaved(game.gameID);
        CompanyManager.DeleteSaved(game.gameID);
        WrestlerManager.DeleteSaved(game.gameID);
        VenueManager.DeleteSaved(game.gameID);

        games.Remove(game);
    }
Пример #5
0
    public static void DeleteSaved(string gameID)
    {
        string filename = WrestlerManager.GetFilename(gameID);

        if (ES2.Exists(filename))
        {
            ES2.Delete(filename);
        }

        if (WrestlerManager.Instance != null && SavedGameManager.Instance.IsGameLoaded() && gameID == SavedGameManager.Instance.CurrentGameID)
        {
            WrestlerManager.Instance.DestroyCurrentGameObjects();
        }
    }
Пример #6
0
        public static void ShowAddWrestler()
        {
            var wrestler = new Wrestler();

            DisplayHelper.ClearScreen();
            Console.WriteLine("ADD WRESTLER");

            wrestler.Name     = InputHelper.GetString("Name: ");
            wrestler.Nickname = InputHelper.GetString("Nickname: ");
            wrestler.Gender   = InputHelper.GetGender();

            Console.WriteLine("");
            Console.WriteLine("ATTRIBUTES");

            wrestler.Attributes = new Attributes();

            wrestler.Attributes.Strength     = InputHelper.GetIntRating("Strength: ");
            wrestler.Attributes.Agility      = InputHelper.GetIntRating("Agility: ");
            wrestler.Attributes.Intelligence = InputHelper.GetIntRating("Intelligence: ");
            wrestler.Attributes.Toughness    = InputHelper.GetIntRating("Toughness: ");

            if (WrestlerManager.Add(wrestler, _promotion.ID))
            {
                ShowViewWrestlers();
            }
            else
            {
                Console.WriteLine("Adding wrestler failed. What do you want to do?");
                Console.WriteLine("1. Try again");
                Console.WriteLine("2. Go back to wrestlers list");

                var choice = InputHelper.GetIntCharacter(1, 2);

                switch (choice)
                {
                case 1:
                    ShowViewWrestlers();
                    break;

                case 2:
                    ShowAddWrestler();
                    break;

                default:
                    ShowViewWrestlers();
                    break;
                }
            }
        }
Пример #7
0
    public static bool DeleteSaved(string id, string gameID)
    {
        string filename = WrestlerManager.GetFilename(gameID) + "?tag=" + id;

        if (ES2.Exists(filename))
        {
            ES2.Delete(filename);
            return(true);
        }
        else
        {
            Debug.LogError(string.Format("Unable to delete wrestler at {0}: No such file found", filename));
            return(false);
        }
    }
Пример #8
0
    public static bool Load(Wrestler wrestler, string id, string gameID)
    {
        string filename = WrestlerManager.GetFilename(gameID) + "?tag=" + id;

        if (ES2.Exists(filename))
        {
            ES2.Load <Wrestler>(filename, wrestler);
            wrestler.name = wrestler.wrestlerName;
            return(true);
        }
        else
        {
            Debug.LogError(string.Format("Unable to load wrestler from {0}: No such file found", filename));
            return(false);
        }
    }
Пример #9
0
    public void Load(string gameID)
    {
        DestroyCurrentGameObjects();

        string filename = WrestlerManager.GetFilename(gameID);

        if (ES2.Exists(filename))
        {
            string[] tags = ES2.GetTags(filename);
            foreach (string tag in tags)
            {
                Wrestler wrestler = CreateEmptyWrestler();
                Wrestler.Load(wrestler, tag, gameID);
                wrestlers.Add(wrestler);
            }
        }
    }
Пример #10
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);

            if (!wrestlerPrefab)
            {
                Debug.LogError("Unable to start Wrestler Manager: No wrestler prefab is set.");
            }
        }
        else
        {
            Destroy(gameObject);
        }
    }
Пример #11
0
        public static void ShowEditWrestler(Guid wrestlerId)
        {
            var wrestler = WrestlerManager.Get(wrestlerId, _promotion.ID);

            DisplayHelper.ClearScreen();
            Console.WriteLine("WRESTLER DETAILS");
            Console.WriteLine("1. Name: " + wrestler.Name);
            Console.WriteLine("2. Nickname: " + wrestler.Nickname);

            if (wrestler.Gender == GenderEnum.Male)
            {
                Console.WriteLine("3. Gender: Male");
            }
            else if (wrestler.Gender == GenderEnum.Female)
            {
                Console.WriteLine("3. Gender: Female");
            }

            Console.WriteLine("ATTRIBUTES");
            Console.WriteLine("4. Agility: " + wrestler.Attributes.Agility);
            Console.WriteLine("5. Intelligence: " + wrestler.Attributes.Intelligence);
            Console.WriteLine("6. Strength: " + wrestler.Attributes.Strength);
            Console.WriteLine("7. Toughness: " + wrestler.Attributes.Toughness);
            Console.WriteLine();
            Console.WriteLine("8. Back");

            var choice = InputHelper.GetIntCharacter(1, 8);

            switch (choice)
            {
            case 1:
                wrestler.Name = InputHelper.GetString("New name: ");
                WrestlerManager.Update(wrestler, _promotion.ID);
                ShowEditWrestler(wrestlerId);
                break;

            case 2:
                wrestler.Name = InputHelper.GetString("New nickname: ");
                WrestlerManager.Update(wrestler, _promotion.ID);
                ShowEditWrestler(wrestlerId);
                break;

            case 3:
                wrestler.Gender = InputHelper.GetGender("New gender (M/F): ");
                WrestlerManager.Update(wrestler, _promotion.ID);
                ShowEditWrestler(wrestlerId);
                break;

            case 4:
                wrestler.Attributes.Agility = InputHelper.GetIntRating("Agility: ");
                WrestlerManager.Update(wrestler, _promotion.ID);
                ShowEditWrestler(wrestlerId);
                break;

            case 5:
                wrestler.Attributes.Intelligence = InputHelper.GetIntRating("Intelligence: ");
                WrestlerManager.Update(wrestler, _promotion.ID);
                ShowEditWrestler(wrestlerId);
                break;

            case 6:
                wrestler.Attributes.Strength = InputHelper.GetIntRating("Strength: ");
                WrestlerManager.Update(wrestler, _promotion.ID);
                ShowEditWrestler(wrestlerId);
                break;

            case 7:
                wrestler.Attributes.Toughness = InputHelper.GetIntRating("Toughness: ");
                WrestlerManager.Update(wrestler, _promotion.ID);
                ShowEditWrestler(wrestlerId);
                break;

            case 8:
                ShowViewWrestlers();
                break;

            default:
                ShowEditWrestler(wrestlerId);
                break;
            }
        }