Example #1
0
    public string ShowGotMoney(OneGame one_game)
    {
        string money = "Get : ";

        money += one_game.take_value;
        return(money);
    }
Example #2
0
 public void ShowLeftPage()
 {
     leftPageNumber      = (currentPageNumber - 1) * 2;
     leftOneGame         = GameData.g_gamedata.one_games[leftPageNumber];
     Bill_Left_Text.text = " " + ShowDay(leftOneGame) + ShowWonNumber(leftOneGame) + "\n" + ShowPickedNumber(leftOneGame) + "\n" + ShowGotMoney(leftOneGame);
     /*Day + won number + picked number + money*/
 }
Example #3
0
 public void UpdateLastGame(OneGame updateGame)
 {
     g_gamedata.one_games[0].day_time    = updateGame.day_time;
     g_gamedata.one_games[0].picked_game = updateGame.picked_game;
     g_gamedata.one_games[0].won_numbers = updateGame.won_numbers;
     g_gamedata.one_games[0].take_value  = updateGame.take_value;
 }
Example #4
0
    public string PickedNumber(PickedNumbersToOneGame pickedgame, OneGame one_game)
    {
        string result = "";

        for (int i = 0; i < 6; i++)
        {
            result += JudgePicked(pickedgame.picked_numbers[i], one_game);
        }

        return(result);
    }
Example #5
0
    public string ShowWonNumber(OneGame one_game)
    {
        string result = "Won :  ";

        for (int i = 0; i < 6; i++)
        {
            result += one_game.won_numbers[i] + " ";
        }
        result += " + " + one_game.won_bonus_number + "\n";

        return(result);
    }
Example #6
0
 public void ShowRightPage()
 {
     RightPageNumber = 1 + (currentPageNumber - 1) * 2;
     if (GameData.g_gamedata.one_games.Count >= RightPageNumber + 1)
     {
         rightOneGame         = GameData.g_gamedata.one_games[RightPageNumber];
         Bill_Right_Text.text = " " + ShowDay(rightOneGame) + ShowWonNumber(rightOneGame) + "\n" + ShowPickedNumber(rightOneGame) + "\n" + ShowGotMoney(rightOneGame);
     }
     else
     {
         Bill_Right_Text.text = "";
     }
 }
Example #7
0
 public void AddOneGames(OneGame onegame)
 {
     //if more 10 games, delete oldest game.
     if (g_gamedata.one_games.Count >= 10)
     {
         for (int i = g_gamedata.one_games.Count - 1; i >= 9; --i)
         {
             g_gamedata.one_games.RemoveAt(i);
         }
     }
     //g_gamedata.one_games.Add(onegame);
     g_gamedata.one_games.Insert(0, onegame);
 }
Example #8
0
    public string ShowPickedNumber(OneGame one_game)
    {
        string result = "";

        for (int i = 0; i < one_game.picked_game.Count; i++)
        {
            result += (i + 1) + " Set :  " + PickedNumber(one_game.picked_game[i], one_game) + "\n";
        }
        for (int reverse = 5; reverse > one_game.picked_game.Count; reverse--)
        {
            result += "\n";
        }

        return(result);
    }
Example #9
0
 public string JudgePicked(int judgeNumber, OneGame one_game)
 {
     for (int i = 0; i < 6; i++)
     {
         if (judgeNumber == one_game.won_numbers[i])
         {
             return(" <b>" + judgeNumber.ToString("00") + "</b> ");
         }
         if (judgeNumber == one_game.won_bonus_number)
         {
             return(" <i>" + judgeNumber.ToString("00") + "</i> ");
         }
     }
     return(" " + judgeNumber.ToString("00") + " ");
 }
Example #10
0
    public void AddPickedNumbersFromPickedArray(buttonManager pickedArray)
    {
        OneGame addToOnegame = new OneGame();

        addToOnegame.day_time = DateTime.Now.ToString();
        for (int i = 0; i < pickedArray.current_enrolled_number; i++)
        {
            PickedNumbersToOneGame inst_Numbers = new PickedNumbersToOneGame();
            for (int number = 0; number < 6; number++)
            {
                inst_Numbers.picked_numbers[number] = pickedArray.pickedArrays[i].picked_numbers[number];
            }
            addToOnegame.picked_game.Add(inst_Numbers);
        }

        AddOneGames(addToOnegame);
    }
    public void ProgressTheGame()
    {
        GameData.Instance.ReadGameDataFromJson();
        thisGame = GameData.Instance.GetLastGame();

        PickWonNumbers();
        ResortWonNumbers();
        ShowWonNumbersToText();
        InputWonNumberToGameData();
        Final_calculate_WonMoney();
        ChangeWonNumberObjects();

        GameData.Instance.AddGameMoney(thisGame.take_value);
        GameData.Instance.UpdateLastGame(thisGame);

        GameData.Instance.SaveGameDataToJson();
    }
Example #12
0
        public static void PlayRecordGame(OneGame record)
        {
            Game g = new Game(record.Characters[0], record.Characters[1]);

            Console.WriteLine(" o - отдых / s - спуск / f - быстрый спуск / a - особое действие");

            int x1 = -1;
            int x2 = -1;

            foreach (Walk c in record.ListMove)
            {
                if (c.Step % 2 == 0)
                {
                    Status s1 = g.getStatus(g.Player1);
                    Console.Write(" Player 1 (Выносл: " + s1.Endurance + " / lvl: " + s1.Location + ") >>> ");
                    Console.WriteLine(c.Commmand);
                    x1 = Go(g, c.Commmand, g.Player1);
                }
                else
                {
                    Status s2 = g.getStatus(g.Player2);
                    Console.Write(" Player 1 (Выносл: " + s2.Endurance + " / lvl: " + s2.Location + ") >>> ");
                    Console.WriteLine(c.Commmand);
                    x2 = Go(g, c.Commmand, g.Player2);
                }
            }

            Console.WriteLine("Game over!");
            if (x1 > x2)
            {
                Console.WriteLine("Player 1 Win!");
            }
            else
            {
                Console.WriteLine("Player 2 Win!");
            }
            Console.WriteLine("Игра была воспроизведена.");
        }
Example #13
0
 public string ShowDay(OneGame one_game)
 {
     return("Day : " + one_game.day_time + "\n");
 }
Example #14
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to game ~Underground~");
            Console.WriteLine("Выбор персонажа:");
            Console.WriteLine(" 1 - Человек-маг / 2 - Гном-воин / 3 - Эльф-разведчик");
            Game g = ChoiceCharacters();

            int[]       characters = character;
            List <Walk> moves      = new List <Walk>();

            Console.WriteLine(" o - отдых / s - спуск / f - быстрый спуск / a - особое действие");

            Random r   = new Random();
            int    rnd = r.Next(2);

            int x1 = -1;
            int x2 = -1;

            while (x1 < 20 && x2 < 20)
            {
                if (rnd % 2 == 0)
                {
                    Status s1 = g.getStatus(g.Player1);
                    Console.Write(" Player 1 (Выносл: " + s1.Endurance + " / lvl: " + s1.Location + ") >>> ");
                    string go1 = Console.ReadLine();
                    moves.Add(new Walk(rnd, go1));
                    x1 = Go(g, go1, g.Player1);
                    rnd++;
                }
                else
                {
                    Status s2 = g.getStatus(g.Player2);
                    Console.Write(" Player 2 (Выносл: " + s2.Endurance + " / lvl: " + s2.Location + ") >>> ");
                    string go2 = Console.ReadLine();
                    moves.Add(new Walk(rnd, go2));
                    x2 = Go(g, go2, g.Player2);
                    rnd++;
                }
            }
            Console.WriteLine("Game over!");
            if (x1 > x2)
            {
                Console.WriteLine("Player 1 Win!");
            }
            else
            {
                Console.WriteLine("Player 2 Win!");
            }

            Console.WriteLine("Try connect to database...");
            Console.WriteLine("Please wait...");

            OneGame record = new OneGame {
                ListMove = moves, Characters = characters
            };

            try
            {
                using (GameContext db = new GameContext())
                {
                    db.Games.Add(record);
                    db.SaveChanges();

                    var     games    = db.Games.ToList();
                    OneGame lastGame = games[games.Count - 1];

                    Console.Write("Воспроизвести игру (yes/no): ");
                    string answ = Console.ReadLine();
                    if (answ == "yes")
                    {
                        Console.WriteLine("Запись игры:");
                        PlayRecordGame(lastGame);
                    }
                }
            }
            catch
            {
                Console.WriteLine("Connection error.");
                Console.ReadKey();
            }

            Console.ReadKey();
        }