상속: MonoBehaviour
예제 #1
1
        public void MouseClicked(int x, int y, ref GameType gameType)
        {
            mouseClick = new Rectangle(x, y, 10, 10);

            if (mouseClick.Intersects(Bouton_host))
            {
                c = new Client();
                Thread t = new Thread(new ThreadStart(Program2.Mainq));
                t.Start();
                t.IsBackground = true;
            }
            if (mouseClick.Intersects(Bouton_Exit))
            {
                Game1.GetGame().Exit();
            }
            else if (mouseClick.Intersects(Bouton_Options))
            {
                gameType = GameType.Menu_Option_Type;
            }
            else if (mouseClick.Intersects(Bouton_Multi))
            {
                gameType = GameType.Menu_Play_Multi_Type2;
            }
            else if (mouseClick.Intersects(Bouton_Play))
            {
                gameType = GameType.Menu_Play_Type;
            }
            else if (mouseClick.Intersects(Bouton_Solo))
            {
                gameType = GameType.Menu_Play_Solo_Type;
            }
        }
예제 #2
0
        void MouseClicked(int x, int y, ref GameType gameType)
        {
            mouseClick = new Rectangle(x, y, 10, 10);

            if (mouseClick.Intersects(Bouton_Play))
            {
                gameType = GameType.Menu_Play_Type;
            }
            if (mouseClick.Intersects(Bouton_Exit))
            {
                Game1.GetGame().Exit();
            }
            if (mouseClick.Intersects(Bouton_Options))
            {
                gameType = GameType.Menu_Option_Type;
            }

            if (mouseClick.Intersects(Bouton_Solo))
            {
                gameType = GameType.Menu_Play_Solo_Type;
            }
            if (mouseClick.Intersects(host))
            {
                System.Diagnostics.Process.Start("C:/Users/epita/Desktop/Final/zbra/bin/Debug/zbra.exe");
            }
            if (mouseClick.Intersects(join))
            {
                System.Diagnostics.Process.Start("C:/Users/epita/Desktop/Final/Client/bin/Debug/Client.exe");
            }
            if (mouseClick.Intersects(local))
            {
                gameType = GameType.Menu_Play_Multi_Type;
            }
        }
예제 #3
0
파일: score.cs 프로젝트: Clancey/Facetroids
 public score(int score,int level,GameType gameType,DateTime date)
 {
     Score = score;
     Level = level;
     GameType = gameType;
     Date = date;
 }
예제 #4
0
 public Game(string name, GameType type, string gameOwnerId)
 {
     Id = Guid.NewGuid();
     Name = name;
     Type = type;
     GameOwnerId = gameOwnerId;
 }
        internal static ICollection<IPlayer> CreatePlayers(GameType gameType, IMessageLogger messageLogger)
        {
            logger = messageLogger;
            ICollection<IPlayer> players = new List<IPlayer>();

            switch (gameType)
            {
                case GameType.SinglePlayer:
                    var humanPlayer = CreateHumanPlayer();
                    var computerPlayer = CreateComputerPlayer();
                    players.Add(humanPlayer);
                    players.Add(computerPlayer);
                    break;

                case GameType.MultiPlayer:
                    var firstPlayer = CreateHumanPlayer();
                    var secondPlayer = CreateHumanPlayer();
                    players.Add(firstPlayer);
                    players.Add(secondPlayer);
                    break;
                default:
                    BullsAndCowsException.GameTypeException();
                    break;
            }

            return players;
        }
예제 #6
0
        public ScreenManager(GameType gametype, Game1 game)
        {
            menubase = new Menu_Base(Content_Manager.getInstance().Textures["menubase"]);
            menuoptions = new Menu_Options(Content_Manager.getInstance().Textures["menuoptions"]);
            menuplay = new Menu_Play(Content_Manager.getInstance().Textures["menuplay"]);
            menuSolo = new Menu_Play_Solo(Content_Manager.getInstance().Textures["menusolo"]);
            menusolo1 = new Menu_Play_Solo_World1(Content_Manager.getInstance().Textures["solo1"]);
            menusolo2 = new Menu_Play_Solo_World2(Content_Manager.getInstance().Textures["solo2"]);
            menuMulti = new Menu_Play_Multi(Content_Manager.getInstance().Textures["menumulti"]);
            menupauseoption = new Menu_Pause_Options(Content_Manager.getInstance().Textures["menupauseoption"]);
            casper = new Casper(Content_Manager.getInstance().Textures["Casper"], new Rectangle(0, 0, 16, 34));
            player2 = new Casper(Content_Manager.getInstance().Textures["Casper"], new Rectangle(50, 50, 16, 34));
            casper2 = new Casper(Content_Manager.getInstance().Textures["Player1"], new Rectangle(50, 50, 0, 0));
            controls = new Controls(casper.Position, casper.Velocity, casper.Speed, Keys.W, Keys.A, Keys.D, Keys.S);
            controlsPlayer2 = new Controls(player2.Position, player2.Velocity, player2.Speed, Keys.Up, Keys.Left, Keys.Right, Keys.Down);
            controlsWorld2 = new Controls(casper2.Position, casper2.Velocity, casper2.Speed, Keys.Up, Keys.Left, Keys.Right, Keys.Down);
            world2vert1 = new Decors(Content_Manager.getInstance().Textures["vert"], new Rectangle(-1680, 0, 1680, 1050));
            world2vert2 = new Decors(Content_Manager.getInstance().Textures["vert"], new Rectangle(1680, 0, 1680, 1050));

            camera = new Camera(Game1.GetGame().GraphicsDevice.Viewport);
            game.casperr = casper;
            decors = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(0, 0, 1680, 1050));
            decors1 = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(1680, 0, 1680, 1050));
            decors2 = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(-1680, 0, 1680, 1050));
            world2 = new Decors(Content_Manager.getInstance().Textures["world2"], new Rectangle(0, 0, 1680, 1050));
            menupause = new Menu_Pause(Content_Manager.getInstance().Textures["menupause"]);
            level1 = new Level1(new Vector2(0, 0));
            obstacles = new Obstacles(level1.getList());
            previousgametype = GameType.Exit;

            this.gametype = gametype;
        }
예제 #7
0
        public ActionResult Create(string gameName, GameType gameType, string gameOwner)
        {
            var message = string.Format("The game \"{0}\" has been created.", gameName);
            _repository.SaveGame(new Game(gameName, gameType, gameOwner));

            return View(model: message);
        }
        public ActionResult Index(GameType? gameType)
        {
            ViewBag.SelectedPage = "Home_Page";
            var userId = GetUserId();

            if (userId == null)
                return Redirect("/signin");

            var existingGame = _gameRepository.TryGetGame(userId);

            if (existingGame != null)
            {
                var question = existingGame.GetQuestion();

                var questionVm = new ImageQuestionModel
                {
                    imageUrl = question.Picture.ImageUrl,
                    answerVersions = question.GetAnswers().AsEnumerable()
                };

                return View(questionVm);
            }
            else
            {
                var questionVm = CreateNewGame(userId, gameType??GameType.Styles);
                return View(questionVm);
            }
        }
예제 #9
0
 void MouseClicked(int x, int y, ref GameType gametype)
 {
     mouseClick = new Rectangle(x, y, 10, 10);
     if (mouseClick.Intersects(Bouton_Play))
     {
         gametype = GameType.Menu_Play_Type;
     }
     else if (mouseClick.Intersects(Bouton_Exit))
     {
         Game1.GetGame().Exit();
     }
     else if (mouseClick.Intersects(Bouton_Res))
     {
         gametype = GameType.Menu_Option_Type;
     }
     else if (mouseClick.Intersects(Bouton_Full))
     {
         Game1.GetGame().IsFullScreen = !Game1.GetGame().IsFullScreen;
     }
     else if (mouseClick.Intersects(Bouton_Sound))
     {
         SoundEffect.MasterVolume = 1.0f - SoundEffect.MasterVolume;
         MediaPlayer.Volume = 1.0f - MediaPlayer.Volume;
     }
 }
 public TableCreatedEvent(string tableId, DateTime tableCreationTime, int playerCapacity, GameType gameType)
 {
     TableId = tableId;
     PlayerCapacity = playerCapacity;
     GameType = gameType;
     TableCreationTime = tableCreationTime;
 }
예제 #11
0
        public void Print(List<Player> pl, GameType t)
        {
            players = pl;
            type = t;

            if (players.Count <= maxPlayersInOneRow)
            {
                printInOneRow = true;
                linesToPrint = players.Count;
            }
            else
            {
                printInOneRow = false;
                linesToPrint = (players.Count + 1) / 2;
            }

            if (previewControl != null)
            {
                previewControl.Document = doc;
                previewControl.InvalidatePreview();
            }
            else
            {
                previewDialog.Width = 600;
                previewDialog.Height = 800;
                previewDialog.Document = doc;
                previewDialog.ShowDialog();
            }
        }
예제 #12
0
 public static int eval(this Game o, Draw d, GameType gt, PrizeCategory pc)
 {
     if(gt == GameType.Undefined || pc == PrizeCategory.Undefined)
         return 0;
     o.notNull(); d.notNull();
     return o.Playslips.Sum(playslip => eval((Playslip)playslip, d, gt, pc));
 }
예제 #13
0
파일: Move.cs 프로젝트: alexjneves/Neuromon
 public Move(string name, GameType type, int pp, int damage)
 {
     Name = name;
     Type = type;
     Pp = pp;
     Damage = damage;
 }
        public SectorActionsSupporting(SectorItem sector, GameType gameType, bool isActivePlayer)
        {
            this.sector = sector;

              supportEntries.Add(SectorActions.StraightAllCards,
            sector.Behavior == SectorBehavior.StaticFree && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.ChangeAllCardsCharacteristics,
            sector.Behavior == SectorBehavior.StaticFree && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.CreatePawn,
            sector.Behavior == SectorBehavior.StaticFree && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.Shuffle,
            sector.Behavior == SectorBehavior.Simple && sector.CardsVisibility == SectorCardsVisibility.Hidden && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.Mulligan,
            sector.Code == SystemSectors.HAND.ToString() && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.MoveCards,
            (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.MoveCardsToDefaultSector,
            (sector.Behavior == SectorBehavior.Simple || sector.Behavior == SectorBehavior.CollapsableFlow) && !string.IsNullOrEmpty(sector.DefaultTarget) && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.MoveTopCards,
             sector.Behavior == SectorBehavior.Simple && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.MoveRandomCards,
            sector.Behavior == SectorBehavior.CollapsableFlow && sector.CardsVisibility != SectorCardsVisibility.Visibile && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.MoveAllCards,
            (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.ShowTop,
            sector.Behavior == SectorBehavior.Simple && sector.CardsVisibility != SectorCardsVisibility.Visibile && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.ShowRandomCards,
            sector.Behavior == SectorBehavior.CollapsableFlow && sector.CardsVisibility != SectorCardsVisibility.Visibile && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.Show,
            sector.CardsVisibility != SectorCardsVisibility.Visibile && (gameType == GameType.Solitaire || isActivePlayer));
              supportEntries.Add(SectorActions.Watch,
            sector.Behavior == SectorBehavior.Simple && (gameType == GameType.Solitaire || isActivePlayer || sector.CardsVisibility == SectorCardsVisibility.Visibile));
              supportEntries.Add(SectorActions.KeepUncovered,
            sector.CardsVisibility == SectorCardsVisibility.Hidden && (gameType == GameType.Solitaire || isActivePlayer));
        }
예제 #15
0
 public void SelectedGameWithoutHint()
 {
     currentGame = GameType.GameWithoutHint;
     gameScript.gameType = currentGame;
     setupCanvas.enabled = false;
     gameScript.enabled = true;
 }
예제 #16
0
 public void SelectedLearning()
 {
     currentGame = GameType.Learning;
     gameScript.gameType = currentGame;
     setupCanvas.enabled = false;
     gameScript.enabled = true;
 }
 public ReplayLinkCollection(string name, GameType gametype, List<int> downloadids, string downloadUrlFormat)
 {
     SourceName = name;
     GameType = gametype;
     _listofdownloadids = downloadids;
     _downloadUrlFormat = downloadUrlFormat;
 }
        public Card PlayCard(string gameId, string playerId, GameType gt)
        {
            var data = new DataProxy();
            var game = data.Get(gameId);
            switch(gt)
            {
                case GameType.Euker:

                    var ai = new Models.Euker.AiSimulation();
                    var card = ai.PlayCard(game.CurrentHand, game.Players.Find(p => p.Id == playerId));
                    game.CurrentHand.CardsInPlay.Add(card);
                    return card;
                case GameType.Spades:
                    throw new NotImplementedException();
                case GameType.Hearts:
                    throw new NotImplementedException();
                case GameType.GoFish:
                    throw new NotImplementedException();
                case GameType.GinRummy:
                    throw new NotImplementedException();
                case GameType.SpiteAndMalice:
                    throw new NotImplementedException();
            }
            throw new NotImplementedException();
        }
예제 #19
0
        public OscilatorGame(GameType gameType, int maxGenerations)
            : base(maxGenerations)
        {
            Type = gameType;
            if (gameType == GameType.Blinker)
            {
                grid = new Grid(5, 5);
                grid.ToggleCell(2, 1, true);
                grid.ToggleCell(2, 2, true);
                grid.ToggleCell(2, 3, true);
            }

            if (gameType == GameType.Toad)
            {
                grid = new Grid(6, 6);
                grid.ToggleCell(2, 1, true);
                grid.ToggleCell(3, 1, true);
                grid.ToggleCell(4, 2, true);
                grid.ToggleCell(1, 3, true);
                grid.ToggleCell(2, 4, true);
                grid.ToggleCell(3, 4, true);
            }
            if (gameType == GameType.Beacon)
            {
                grid = new Grid(6, 6);
                grid.ToggleCell(1, 1, true);
                grid.ToggleCell(1, 2, true);
                grid.ToggleCell(2, 1, true);
                grid.ToggleCell(2, 2, true);
                grid.ToggleCell(3, 3, true);
                grid.ToggleCell(3, 4, true);
                grid.ToggleCell(4, 3, true);
                grid.ToggleCell(4, 4, true);
            }
            if (gameType == GameType.Pulsar)
            {
                grid = new Grid(17, 17);
                for (int i = 0; i < 17; i++)
                {
                    for (int j = 0; j < 17; j++)
                    {
                        if (i == 2 || i == 7 || i == 9 || i == 14)
                        {
                            if (j == 4 || j == 5 || j == 6 || j == 10 || j == 11 || j == 12)
                            {
                                grid.ToggleCell(i, j, true);
                            }
                        }
                        if ((i >= 4 && i <= 6) || (i >= 10 && i <= 12))
                        {
                            if (j == 2 || j == 7 || j == 9 || j == 14)
                            {
                                grid.ToggleCell(i, j, true);
                            }

                        }
                    }
                }
            }
        }
예제 #20
0
        public MainForm()
        {
            InitializeComponent();
            string dbPath = RegistrySettings.GetLatestOpenedDatabase();

            currentSortType = RegistrySettings.GetSortType();
            UpdateSortTypeButtons();

            currentRateType = RegistrySettings.GetGameType();
            UpdateRateTypeButtons();

            showInactivePlayers = RegistrySettings.GetShowInactivePlayersOption();
            UpdateShowInactivePlayersMenuItem();

            playersListRight.Dock = DockStyle.Fill;
            playersListRight.OnItemDoubleClick += new PlayersList.MouseDoubleClickEvent(this.OnPlayerDoubleClick);
            playersListRight.OnItemMouseRightClick += new PlayersList.MouseRightClickEvent(this.OnPlayerMouseRightClick);
            playersListRight.OnColumnHeaderClick += new PlayersList.ColumnHeadertClickEvent(this.OnSortTypeChange);

            playersListLeft.Dock  = DockStyle.Fill;
            playersListLeft.OnItemDoubleClick += new PlayersList.MouseDoubleClickEvent(this.OnPlayerDoubleClick);
            playersListLeft.OnItemMouseRightClick += new PlayersList.MouseRightClickEvent(this.OnPlayerMouseRightClick);
            playersListLeft.OnColumnHeaderClick += new PlayersList.ColumnHeadertClickEvent(this.OnSortTypeChange);

            this.splitContainer.Panel1.Controls.Add(playersListLeft);
            this.splitContainer.Panel2.Controls.Add(playersListRight);

            printPageSettings = RegistrySettings.GetPageSettings();

            if(dbPath != null && dbPath.Length != 0)
            {
                InitListView(dbPath);
            }
        }
예제 #21
0
        public Game Create(
            GameType type,
            User user,
            string name,
            int timeoutInSeconds,
            string mapTemplate, 
            int numberOfPlayersPerTeam, 
            int numberOfTeams, 
            IEnumerable<VictoryConditionType> victoryConditions,
            IEnumerable<VisibilityModifierType> visibilityModifier)
        {
            // Check if user is allowed to create games
            if (!user.CanCreateGame)
            {
                throw new DomainException(ErrorCode.NotEnoughSlots, "User does not have enough available slots to create game");
            }

            // Check if name is not already taken
            if (this.gameRepository.FindByName(name) != null)
            {
                throw new DomainException(ErrorCode.NameAlreadyTaken, "Name for this game is already taken");
            }

            // Create game
            return new Game(user, type, name, mapTemplate, timeoutInSeconds, numberOfTeams, numberOfPlayersPerTeam, victoryConditions, visibilityModifier);
        }
예제 #22
0
 public void SetValues(string s, GameType g)
 {
     if (g == GameType.Text) {
         stringValue = s;
         GetComponentInChildren<Text>().text = s;
     }
 }
예제 #23
0
파일: Main.cs 프로젝트: Jungjin-Lee/JJ_DCU4
 public void OnClick3Card()
 {
     GameType = GameType.Game_3Card;
     Delaer.perMoney = 1000;
     WaitingRoom.gameObject.SetActive(false);
     PlayingRoom.gameObject.SetActive(true);
 }
예제 #24
0
        public void MouseClicked(int x, int y, ref GameType gameType)
        {
            mouseClick = new Rectangle(x, y, 10, 10);

            if (mouseClick.Intersects(Bouton_Exit))
            {
                Game1.GetGame().Exit();
            }
            else if (mouseClick.Intersects(Bouton_Options))
            {
                gameType = GameType.Menu_Option_Type;
            }
            else if (mouseClick.Intersects(Bouton_Multi))
            {
                gameType = GameType.Menu_Play_Multi_Type;
            }
            else if (mouseClick.Intersects(Bouton_Play))
            {
                gameType = GameType.Menu_Play_Type;
            }
            else if (mouseClick.Intersects(Bouton_World1))
            {
                gameType = GameType.Menu_Play_Solo_World1_Type;
            }
            else if (mouseClick.Intersects(Bouton_World2))
            {
                gameType = GameType.Menu_Play_Solo_World2_Type;
            }
            else if (mouseClick.Intersects(Bouton_Solo))
            {
                gameType = GameType.Menu_Play_Solo_Type;
            }
        }
 public static string GetDisplayName(GameType gameType)
 {
     switch (gameType)
     {
         case GameType.NoLimitHoldem:
             return "No Limit Holdem";
         case GameType.FixedLimitHoldem:
             return "Fixed Limit Holdem";
         case GameType.PotLimitOmaha:
             return "Pot Limit Omaha";
         case GameType.PotLimitOmahaHiLo:
             return "Pot Limit Omaha Hi-Lo";
         case GameType.FixedLimitOmahaHiLo:
             return "Fixed Limit Omaha Hi-Lo";
         case GameType.PotLimitHoldem:
             return "Pot Limit Holdem";
         case GameType.Any:
             return "Any";
         case GameType.CapNoLimitHoldem:
             return "Cap NL Holdem";
         case GameType.CapPotLimitOmaha:
             return "Cap Pot Limit Omaha";
         case GameType.Unknown:
             return "Unknown";
         default:
             return gameType.ToString();
     }
 }
예제 #26
0
 public Neuromon(string name, int health, GameType type, MoveSet moveSet)
 {
     Type = type;
     Name = name;
     Health = health;
     MoveSet = moveSet;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public PauseMenuScreen(GameType currentGameType, Difficulty currentDifficulty)
     : base("Paused", Color.RoyalBlue)
 {
     IsPopup = true;
     KinectDependencies.Add(KinectDependency.Skeleton);
     gameType = currentGameType;
     gameDiff = currentDifficulty;
 }
        /// <param name="host">The IP address or the hostname of the gameserver</param>
        /// <param name="port">The port of the gameserver</param>
        /// <param name="type">The gameserver type</param>
        public GameServer( string host, int port, GameType type )
        {
            _host = host;
            _port = port;
            _type = type;

            CheckServerType();
        }
        public Screen LaunchGameScreen(GameType type, Difficulty diff)
        {
            if (type == GameType.Classic)
                return new Screens.ClassicGameScreen(diff);

            else
                return new Screens.QuadrantGameScreen( Screens.QuadrantExcercises.NumbersOne);
        }
        public IGame GetNewGame(string userName, GameType gameType, long? parameter)
        {
            var game = this._gameFactory.CreateGame(gameType, parameter);

            this._games.AddOrUpdate(userName, game, (username, oldGame) => game);

            return game;
        }
예제 #31
0
 public void setToDefaultGameType()
 {
     gt = GameType.Main;
 }
예제 #32
0
        protected override void Initialize()
        {
            int ans, var, total;

            gametype = (GameType)random.Next((int)GameType.Total);

            switch (gametype)
            {
            case GameType.Machine:
                var      = 2 + random.Next(5);
                total    = 50 + random.Next(100);
                question = String.Format(
                    Translations.GetPluralString("We have a {0} meter piece of fabric.", "We have a {0} meters piece of fabric.", total),
                    total);
                question += " ";
                question += String.Format(
                    Translations.GetPluralString("A machine takes {0} second to cut 1 meter of this fabric. How many seconds does the machine take to cut the entire piece of fabric into 1 meter pieces?",
                                                 "A machine takes {0} seconds to cut 1 meter of this fabric. How many seconds does the machine take to cut the entire piece of fabric into 1 meter pieces?"
                                                 , var), var);
                answer = String.Format(
                    Translations.GetPluralString("With the cut number {0}, the machine creates two 1 meter pieces.",
                                                 "With the cut number {0}, the machine creates two 1 meter pieces.", total - 1),
                    total - 1);

                ans = (total - 1) * var;
                break;

            case GameType.Fence:
                total    = 20 + random.Next(20);
                ans      = 4 * total - 4;
                question = String.Format(
                    // Translators: {0} is a number
                    Translations.GetPluralString(
                        "A fence is built to enclose a square shaped region. {0} fence pole is used in each side of the square. How many fence poles are used in total?",
                        "A fence is built to enclose a square shaped region. {0} fence poles are used in each side of the square. How many fence poles are used in total?",
                        total),
                    total);
                // Translators: {0} is a number
                answer = String.Format(
                    Translations.GetPluralString(
                        "There is {0} fence pole since the poles on the corners of the square are shared.",
                        "There are {0} fence poles since the poles on the corners of the square are shared.",
                        ans)
                    , ans);
                break;

            case GameType.Present:
                int present = 5 + random.Next(20);
                total    = present + 2;
                ans      = total;
                question = String.Format(
                    // Translators: {0} is a number
                    Translations.GetPluralString(
                        "Wrapping an anniversary present costs one monetary unit. The anniversary present costs {0} monetary unit more than the cost to wrap it. How much does it cost to both purchase and wrap the present?",
                        "Wrapping an anniversary present costs one monetary unit. The anniversary present costs {0} monetary units more than the cost to wrap it. How much does it cost to both purchase and wrap the present?",
                        present),
                    present);

                answer = String.Format(
                    Translations.GetPluralString(
                        "It is the cost of the present, {0} monetary unit, plus one monetary unit of the wrapping.",
                        "It is the cost of the present, {0} monetary units, plus one monetary unit of the wrapping.",
                        present + 1), present + 1);
                break;

            default:
                throw new Exception("Unexpected value");
            }

            Answer.Correct = (ans).ToString();
        }
예제 #33
0
 public CashTableKey(decimal bigBlind, TableTypeDescription tableTypeDescription, GameType gameType, int seats, decimal buyin)
 {
     BigBlind             = bigBlind;
     TableTypeDescription = tableTypeDescription;
     GameType             = gameType;
     Seats = seats;
     Buyin = buyin;
 }
예제 #34
0
        public NesGame(string gamesDirectory, string nesFileName, bool?ignoreMapper, ref bool?needPatch, NeedPatchDelegate needPatchCallback, Form parentForm = null, byte[] rawRomData = null)
        {
            uint crc32;

            if (!Path.GetExtension(nesFileName).ToLower().Equals(".fds"))
            {
                NesFile nesFile;
                if (rawRomData != null)
                {
                    nesFile = new NesFile(rawRomData);
                }
                else
                {
                    nesFile = new NesFile(nesFileName);
                }
                nesFile.CorrectRom();
                crc32    = nesFile.CRC32;
                Code     = GenerateCode(crc32);
                GamePath = Path.Combine(gamesDirectory, Code);
                Args     = DefaultArgs;
                Type     = GameType.Cartridge;
                NesPath  = Path.Combine(GamePath, Code + ".nes");
                var patchesDirectory = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "patches");
                Directory.CreateDirectory(patchesDirectory);
                Directory.CreateDirectory(GamePath);
                var patches = Directory.GetFiles(patchesDirectory, string.Format("{0:X8}*.ips", crc32), SearchOption.AllDirectories);
                if (patches.Length > 0 && needPatch != false)
                {
                    if (needPatch == true || ((needPatchCallback != null) && needPatchCallback(parentForm, Path.GetFileName(nesFileName)))) /*MessageBox.Show(parentForm, string.Format(Resources.PatchQ, Path.GetFileName(nesFileName)), Resources.PatchAvailable, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes*/
                    {
                        needPatch = true;
                        var patch = patches[0];
                        if (rawRomData == null)
                        {
                            rawRomData = File.ReadAllBytes(nesFileName);
                        }
                        Debug.WriteLine(string.Format("Patching {0}", nesFileName));
                        IpsPatcher.Patch(patch, ref rawRomData);
                        nesFile = new NesFile(rawRomData);
                    }
                    else
                    {
                        needPatch = false;
                    }
                }

                if (nesFile.Mapper == 71)
                {
                    nesFile.Mapper = 2;                       // games by Codemasters/Camerica - this is UNROM clone. One exception - Fire Hawk
                }
                if (nesFile.Mapper == 88)
                {
                    nesFile.Mapper = 4;                       // Compatible with MMC3... sometimes
                }
                if (nesFile.Mapper == 95)
                {
                    nesFile.Mapper = 4;                       // Compatible with MMC3
                }
                if (nesFile.Mapper == 206)
                {
                    nesFile.Mapper = 4;                        // Compatible with MMC3
                }
                if (!supportedMappers.Contains(nesFile.Mapper) && (ignoreMapper != true))
                {
                    Directory.Delete(GamePath, true);
                    if (ignoreMapper != false)
                    {
                        throw new UnsupportedMapperException(nesFile);
                    }
                    else
                    {
                        Debug.WriteLine(string.Format("Game {0} has mapper #{1}, skipped", nesFileName, nesFile.Mapper));
                        return;
                    }
                }
                if ((nesFile.Mirroring == NesFile.MirroringType.FourScreenVram) && (ignoreMapper != true))
                {
                    Directory.Delete(GamePath, true);
                    if (ignoreMapper != false)
                    {
                        throw new UnsupportedFourScreenException(nesFile);
                    }
                    else
                    {
                        Debug.WriteLine(string.Format("Game {0} has four-screen mirroring, skipped", nesFileName, nesFile.Mapper));
                        return;
                    }
                }
                // TODO: Make trainer check. I think that NES Mini doesn't support it.

                ConfigPath = Path.Combine(GamePath, Code + ".desktop");
                nesFile.Save(NesPath);
            }
            else
            {
                byte[] fdsData;
                if (rawRomData != null)
                {
                    fdsData = rawRomData;
                }
                else
                {
                    fdsData = File.ReadAllBytes(nesFileName);
                }
                if (Encoding.ASCII.GetString(fdsData, 0, 3) == "FDS") // header? cut it!
                {
                    var fdsDataNoHeader = new byte[fdsData.Length - 0x10];
                    Array.Copy(fdsData, 0x10, fdsDataNoHeader, 0, fdsDataNoHeader.Length);
                    fdsData = fdsDataNoHeader;
                }
                crc32    = CRC32(fdsData);
                Code     = GenerateCode(crc32);
                GamePath = Path.Combine(gamesDirectory, Code);
                Args     = DefaultArgs + " --fds-auto-disk-side-switch-on-keypress"; // seems like need to make it default
                Type     = GameType.FDS;
                Directory.CreateDirectory(GamePath);
                ConfigPath = Path.Combine(GamePath, Code + ".desktop");
                NesPath    = Path.Combine(GamePath, Code + ".fds");
                File.WriteAllBytes(NesPath, fdsData);
            }

            Name        = Path.GetFileNameWithoutExtension(nesFileName);
            Players     = 1;
            ReleaseDate = DefaultReleaseDate;
            Publisher   = DefaultPublisher;
            if (nesFileName.Contains("(J)"))
            {
                Region = "Japan";
            }

            TryAutofill(crc32);

            Name          = Regex.Replace(Name, @" ?\(.*?\)", string.Empty).Trim();
            Name          = Regex.Replace(Name, @" ?\[.*?\]", string.Empty).Trim();
            Name          = Name.Replace("_", " ").Replace("  ", " ") /*.Replace(", The", "")*/.Trim();
            IconPath      = Path.Combine(GamePath, Code + ".png");
            SmallIconPath = Path.Combine(GamePath, Code + "_small.png");
            GameGeniePath = Path.Combine(GamePath, GameGenieFileName);

            // Trying to find cover file
            Image cover = null;

            if (!string.IsNullOrEmpty(nesFileName))
            {
                var imagePath = Path.Combine(Path.GetDirectoryName(nesFileName), Path.GetFileNameWithoutExtension(nesFileName) + ".png");
                if (File.Exists(imagePath))
                {
                    cover = LoadBitmap(imagePath);
                }
                imagePath = Path.Combine(Path.GetDirectoryName(nesFileName), Path.GetFileNameWithoutExtension(nesFileName) + ".jpg");
                if (File.Exists(imagePath))
                {
                    cover = LoadBitmap(imagePath);
                }
                var artDirectory = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "art");
                Directory.CreateDirectory(artDirectory);
                imagePath = Path.Combine(artDirectory, Path.GetFileNameWithoutExtension(nesFileName) + ".png");
                if (File.Exists(imagePath))
                {
                    cover = LoadBitmap(imagePath);
                }
                imagePath = Path.Combine(artDirectory, Path.GetFileNameWithoutExtension(nesFileName) + ".jpg");
                if (File.Exists(imagePath))
                {
                    cover = LoadBitmap(imagePath);
                }
                var covers = Directory.GetFiles(artDirectory, string.Format("{0:X8}*.*", crc32), SearchOption.AllDirectories);
                if (covers.Length > 0)
                {
                    cover = LoadBitmap(covers[0]);
                }
            }
            if (cover != null)
            {
                SetImage(cover, ConfigIni.EightBitPngCompression);
            }
            else
            {
                SetImage(null, ConfigIni.EightBitPngCompression);
            }
            Save();
        }
예제 #35
0
 public void CreateGame(GameType gameType, Passenger opponent)
 {
     SendNewGameToAPI(CreateGameDTO(gameType, opponent));
 }
 public string GetGameTypeHandHistoryText(PokerFormat pokerFormat, SiteName siteName, GameType gameType)
 {
     return(GetHandText(pokerFormat, siteName, "GameTypeTests", gameType.ToString()));
 }
예제 #37
0
 public void SetGameType(NetIncomingMessage msg)
 {
     _serverGameType = (GameType)msg.ReadByte();
 }
예제 #38
0
        // Creating the List of enemies for next rounds
        public void GenerateGameSequence(GameType gametype)
        {
            if (gametype == GameType.History)
            {
                for (int i = 1; i <= 10; i++)
                {
                    List <PreLoadEnemy> battle = new List <PreLoadEnemy>();
                    if (i <= 4)
                    {
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Weak", i, Team.Bad));
                    }

                    if (i == 5)
                    {
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Enemy", 2, Team.Bad));
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Weak", 1, Team.Bad));
                    }

                    if (i == 6)
                    {
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Enemy", 3, Team.Bad));
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Weak", 1, Team.Bad));
                    }
                    if (i == 7)
                    {
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Enemy", 3, Team.Bad));
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Weak", 2, Team.Bad));
                    }


                    if (i == 8)
                    {
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Serious", 9, Team.Bad));
                    }

                    if (i == 9)
                    {
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Heavy", 5, Team.Bad));
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Weak", 2, Team.Bad));
                    }

                    if (i == 10)
                    {
                        battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "BadAss", 12, Team.Bad));
                    }
                    GameSequence.Add(battle);
                }
            }

            else if (gametype == GameType.OnePLayerTeam)
            {
                for (int i = 1; i <= 40; i++)
                {
                    List <PreLoadEnemy> battle = new List <PreLoadEnemy>();
                    battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "TeamMate", i, Team.Good));
                    battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Enemy#1", i, Team.Bad));
                    battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Enemy#2", i, Team.Bad));
                    this.GameSequence.Add(battle);
                }
            }

            else if (gametype == GameType.Skirmish)
            {
                for (int i = 1; i <= 40; i++)
                {
                    List <PreLoadEnemy> battle = new List <PreLoadEnemy>();
                    battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), Team.Bad.ToString(), i, Team.Bad));
                    battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), Team.Alien.ToString(), i, Team.Alien));
                    battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), Team.SWAT.ToString(), i, Team.SWAT));
                    this.GameSequence.Add(battle);
                }
            }

            else if (gametype == GameType.TwoVsTwo)
            {
                for (int i = 1; i <= 40; i++)
                {
                    List <PreLoadEnemy> battle = new List <PreLoadEnemy>();
                    battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Enemy#1", i, Team.Bad));
                    battle.Add(new PreLoadEnemy((PlayerType)rnd.Next(0, 4), "Enemy#2", i + 1, Team.Bad));
                    this.GameSequence.Add(battle);
                }
            }
        }
예제 #39
0
        public void GameTypeIsParsedTest(string handHistoryFile, GameType gameType)
        {
            var handHistory = ParseHandHistory(handHistoryFile);

            Assert.That(handHistory.GameDescription.GameType, Is.EqualTo(gameType));
        }
 public void Training()
 {
     Button.Play();
     gameType = GameType.TRAINING;
     showCharacters();
 }
 public void CPUMode()
 {
     Button.Play();
     gameType = GameType.CPUMODE;
     showCharacters();
 }
 public void twoPlayer()
 {
     Button.Play();
     gameType = GameType.TWOPLAYER;
     showCharacters();
 }
 public GameFinder_GameResult(Games game, FileSystemPath installLocation, GameType gameType, Action <FileSystemPath, object> handledAction = null, object handledParameter = null) : base(installLocation, handledAction, handledParameter, game.GetGameInfo().DisplayName)
 {
     Game     = game;
     GameType = gameType;
 }
예제 #44
0
 public static CashTableKey From(decimal bigBlind, decimal buyin, TableTypeDescription tableTypeDescription, GameType gameType, int seats)
 {
     return(new CashTableKey(bigBlind, tableTypeDescription, gameType, seats, buyin));
 }
예제 #45
0
    // Update is called once per frame
    void Update()
    {
        if (gt == GameType.Main)
        {
            if (Input.GetMouseButtonDown(0))
            {
                clickTarget = Physics2D.Raycast(new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, -1f).transform;
                if (clickTarget != null)
                {
                    clickLocation       = new Vector2((Input.mousePosition.x), (Input.mousePosition.y));
                    itemGrabbedPosition = clickTarget.position;
                    if (clickTarget.tag == "InventoryItem")
                    {
                        didClickItem = true;
                    }
                }
            }
            else if (Input.GetMouseButton(0))
            {
                if (didClickItem && CheckMouseMoved(clickLocation, Input.mousePosition))
                {
                    Vector3 camPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                    camPos.z             = clickTarget.position.z;
                    clickTarget.position = camPos;
                }
            }
            else if (Input.GetMouseButtonUp(0))
            {
                releaseLocation = new Vector2((Input.mousePosition.x), (Input.mousePosition.y));
                didMouseMove    = CheckMouseMoved(clickLocation, releaseLocation);

                if (!didMouseMove)
                {
                    switch (clickTarget.tag)
                    {
                    case "InventoryItem":
                    case "WorldItem":
                        HandleItem(clickTarget.GetComponent <Item>());
                        break;

                    case "Door":
                        HandleDoor(clickTarget.GetComponent <Door>());
                        break;

                    case "Character":
                        HandleCharacter(clickTarget.GetComponent <Character>());
                        break;
                    }
                }
                else if (didMouseMove && didClickItem)
                {
                    clickTarget.gameObject.SetActive(false);
                    releaseTarget = Physics2D.Raycast(new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, 0f).transform;
                    clickTarget.gameObject.SetActive(true);
                    if (releaseTarget != null)
                    {
                        if (GetPropID(clickTarget) == GetPropLinkedItem(releaseTarget))
                        {
                            HandleCombo(clickTarget.GetComponent <Item>(), releaseTarget);
                        }
                        else
                        {
                            clickTarget.position = itemGrabbedPosition;
                        }
                    }
                    else
                    {
                        clickTarget.position = itemGrabbedPosition;
                    }
                }
                else if (didClickItem)
                {
                    clickTarget.position = itemGrabbedPosition;
                }
                didClickItem = false;
            }
        }
        else if (gt == GameType.Message)
        {
            if (Input.GetMouseButtonDown(0))
            {
                GetComponentInParent <MessageSystem>().closeMessage();
                gt = GameType.Main;
            }
        }
    }
예제 #46
0
        protected override List <HandAction> ParseHandActions(string[] handLines, GameType gameType = GameType.Unknown)
        {
            // this is needed for future uncalledbet fixes
            var handHistory = new HandHistory();

            ParseExtraHandInformation(handLines, handHistory);

            var actions = new List <HandAction>(handLines.Length);
            // TODO: implement
            int startIndex = FindHandActionsStart(handLines);

            startIndex = ParseBlindActions(handLines, ref actions, startIndex);

            Street currentStreet = Street.Preflop;

            for (int i = startIndex; i < handLines.Length; i++)
            {
                var line = handLines[i];

                if (IsChatLine(line))
                {
                    continue;
                }

                if (IsUncalledBetLine(line))
                {
                    actions.Add(ParseUncalledBet(line, currentStreet));
                    ParseShowDown(handLines, ref actions, i + 1, gameType);
                    return(FixUncalledBets(actions, handHistory.TotalPot, handHistory.Rake));
                }

                if (line.Contains(" shows ["))
                {
                    ParseShowDown(handLines, ref actions, i, GameType.Unknown);

                    return(FixUncalledBets(actions, handHistory.TotalPot, handHistory.Rake));
                }

                var lastChar = line[line.Length - 1];

                HandAction action;

                switch (lastChar)
                {
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    action = ParseActionWithAmount(line, currentStreet);
                    if (action != null)
                    {
                        actions.Add(action);
                    }
                    continue;

                //theking881 calls $138, and is all in
                //draggstar sits down
                case 'n':
                    if (line.FastEndsWith("and is all in"))
                    {
                        action = ParseActionWithAmount(line.Remove(line.Length - 15), currentStreet, true);    //", and is all in".Length
                        if (action != null)
                        {
                            actions.Add(action);
                        }
                    }
                    continue;

                case ')':
                    action = ParseWinActionOrStreet(line, ref currentStreet);
                    if (action != null)
                    {
                        actions.Add(action);
                    }
                    break;

                //jobetzu checks
                //jobetzu folds
                //theking881 mucks
                case 's':
                    action = ParseFoldCheckLine(line, currentStreet);
                    if (action != null)
                    {
                        actions.Add(action);
                    }
                    continue;

                // 02nina20 calls $0.04, and is capped
                case 'd':
                    if (line[line.Length - 3] == 'p')
                    {
                        action = ParseActionWithAmount(line.Remove(line.LastIndexOf(',')), currentStreet);
                        if (action != null)
                        {
                            actions.Add(action);
                        }
                    }
                    continue;

                //*** SHOW DOWN ***
                //*** SUMMARY ***
                case '*':
                    ParseShowDown(handLines, ref actions, i, GameType.Unknown);

                    return(FixUncalledBets(actions, handHistory.TotalPot, handHistory.Rake));

                //Dealt to FT_Hero [Qh 5c]
                //Postrail shows [Qs Ah]
                case ']':
                    if (line.IndexOf(" shows [", StringComparison.Ordinal) != -1)
                    {
                        ParseShowDown(handLines, ref actions, i, GameType.Unknown);
                        return(FixUncalledBets(actions, handHistory.TotalPot, handHistory.Rake));
                    }
                    continue;

                //Opponent3 has requested TIME
                //jobetzu has 15 seconds left to act
                default:
                    continue;
                }
            }

            return(FixUncalledBets(actions, handHistory.TotalPot, handHistory.Rake));
        }
예제 #47
0
 private void displayGameType(GameType value)
 {
     modeTypeInfo.Type = value;
 }
예제 #48
0
 public GameCreate(IGameConfiguration configuration, GameType gameType)
 {
     Configuration    = configuration;
     CreatingGameType = gameType;
 }
예제 #49
0
 public Game Create(GameType type)
 {
     return(_constructorByGameType[type]());
 }
예제 #50
0
 public void playMiniGame(GameType gameType) //나중에 컨트롤러에서 호출
 {
     _game = Game.Create(gameType);
 }
예제 #51
0
        public NesGame(string path)
        {
            GamePath   = path;
            Code       = Path.GetFileNameWithoutExtension(path);
            ConfigPath = Path.Combine(path, Code + ".desktop");
            NesPath    = Path.Combine(path, Code + ".nes");
            if (File.Exists(NesPath))
            {
                Type = GameType.Cartridge;
            }
            else
            {
                var fdsPath = Path.Combine(path, Code + ".fds");
                if (File.Exists(fdsPath))
                {
                    NesPath = fdsPath;
                    Type    = GameType.FDS;
                }
                else
                {
                    throw new Exception("ROM not found: " + path);
                }
            }
            IconPath      = Path.Combine(path, Code + ".png");
            SmallIconPath = Path.Combine(path, Code + "_small.png");
            GameGeniePath = Path.Combine(path, GameGenieFileName);
            if (!File.Exists(ConfigPath))
            {
                throw new FileNotFoundException("Invalid game directory: " + path);
            }

            Name         = Code;
            Players      = 1;
            Simultaneous = false;
            ReleaseDate  = DefaultReleaseDate;
            Args         = DefaultArgs;
            Publisher    = DefaultPublisher;

            var configLines = File.ReadAllLines(ConfigPath);

            foreach (var line in configLines)
            {
                int pos = line.IndexOf('=');
                if (pos <= 0)
                {
                    continue;
                }
                var param = line.Substring(0, pos).Trim().ToLower();
                var value = line.Substring(pos + 1).Trim();
                switch (param)
                {
                case "exec":
                    Args = line;
                    if (Args.Contains(".nes"))
                    {
                        Args = Args.Substring(Args.IndexOf(".nes") + 4).Trim();
                    }
                    else if (Args.Contains(".fds"))
                    {
                        Args = Args.Substring(Args.IndexOf(".fds") + 4).Trim();
                    }
                    else
                    {
                        Args = "";
                    }
                    break;

                case "name":
                    Name = value;
                    break;

                case "players":
                    Players = byte.Parse(value);
                    break;

                case "simultaneous":
                    Simultaneous = value != "0";
                    break;

                case "releasedate":
                    ReleaseDate = value;
                    break;

                case "sortrawpublisher":
                    Publisher = value;
                    break;
                }
            }
            if (File.Exists(GameGeniePath))
            {
                GameGenie = File.ReadAllText(GameGeniePath);
            }
            hasUnsavedChanges = false;
        }
 public static void GameTypeChosen(GameType gameType)
 {
     Console.Clear();
     Console.WriteLine("-------------You have chosen {0}-------------\n", gameType);
 }
예제 #53
0
 private NewGameDTO CreateGameDTO(GameType gameType, Passenger opponent)
 {
     return(new NewGameDTO(LoginSingleton.passenger.PassengerId, opponent.PassengerId, gameType));
 }
예제 #54
0
        protected override List <HandAction> ParseHandActions(string[] handLines, GameType gameType = GameType.Unknown)
        {
            List <HandAction> handActions = new List <HandAction>();

            Street currentStreet = Street.Null;

            for (int i = 3; i < handLines.Length - 1; i++)
            {
                string  handLine = handLines[i];
                string  name     = string.Empty;
                decimal amount   = 0;

                if (string.IsNullOrWhiteSpace(handLine))
                {
                    continue;
                }

                if (currentStreet == Street.Null)
                {
                    if (handLine.StartsWith("Dealer:"))
                    {
                        currentStreet = Street.Preflop;
                    }
                    continue;
                }

                if (handLine.Contains(" didn't show hand"))
                {
                    currentStreet = Street.Showdown;
                    continue;
                }
                if (handLine.Contains(" shows: "))
                {
                    int firstSpaceIndexOf = handLine.IndexOf(' ');
                    name          = handLine.Substring(0, firstSpaceIndexOf);
                    currentStreet = Street.Showdown;
                    handActions.Add(new HandAction(name, HandActionType.SHOW, 0, currentStreet));
                    continue;
                }
                if (handLine.Contains(" wins: "))
                {
                    //stook wins:                 EUR 23.04
                    currentStreet = Street.Showdown;
                    int firstSpaceIndexOf = handLine.IndexOf(' ');
                    int lastSpaceIndex    = handLine.LastIndexOf(' ');

                    name   = handLine.Substring(0, firstSpaceIndexOf);
                    amount = decimal.Parse(handLine.Substring(lastSpaceIndex + 1, handLine.Length - lastSpaceIndex - 1), System.Globalization.CultureInfo.InvariantCulture);

                    handActions.Add(new WinningsAction(name, HandActionType.WINS, amount, 0));
                    continue;
                }

                if (handLine.StartsWith("Flop "))
                {
                    currentStreet = Street.Flop;
                    continue;
                }
                if (handLine.StartsWith("Turn "))
                {
                    currentStreet = Street.Turn;
                    continue;
                }
                if (handLine.StartsWith("River "))
                {
                    currentStreet = Street.River;
                    continue;
                }
                if (handLine.StartsWith("Rake: "))
                {
                    break;
                }

                int firstSpaceIndex  = handLine.IndexOf(' ');
                int openParenIndex   = handLine.IndexOf('(');
                int spaceAfterAction = handLine.IndexOf(' ', 28);
                if (spaceAfterAction == -1)
                {
                    spaceAfterAction = handLine.Length;
                }
                int colonIndex = handLine.IndexOf(':');

                if (openParenIndex != -1)
                {
                    amount = decimal.Parse(handLine.Substring(openParenIndex + 1, handLine.Length - openParenIndex - 2), System.Globalization.CultureInfo.InvariantCulture);
                }

                if (currentStreet == Street.Preflop)
                {
                    // Check for lines like:
                    //  Small Blind:                wELMA       (0.50)
                    //  Big Blind:                  Vrddhi      (1.00)
                    if (colonIndex != -1)
                    {
                        name = handLine.Substring(28, spaceAfterAction - 28);
                        if (handLine[0] == 'S')
                        {
                            handActions.Add(new HandAction(name, HandActionType.SMALL_BLIND, amount, currentStreet));
                            continue;
                        }
                        if (handLine[0] == 'B')
                        {
                            handActions.Add(new HandAction(name, HandActionType.BIG_BLIND, amount, currentStreet));
                            continue;
                        }

                        throw new HandActionException(handLine, "Unrecognized preflop action.");
                    }
                }

                string action = handLine.Substring(28, spaceAfterAction - 28);
                name = handLine.Substring(0, firstSpaceIndex);

                switch (action)
                {
                case "Raise":
                    handActions.Add(new HandAction(name, HandActionType.RAISE, amount, currentStreet));
                    continue;

                case "Check":
                    handActions.Add(new HandAction(name, HandActionType.CHECK, amount, currentStreet));
                    continue;

                case "Fold":
                    handActions.Add(new HandAction(name, HandActionType.FOLD, amount, currentStreet));
                    continue;

                case "Bet":
                    handActions.Add(new HandAction(name, HandActionType.BET, amount, currentStreet));
                    continue;

                case "Call":
                    handActions.Add(new HandAction(name, HandActionType.CALL, amount, currentStreet));
                    continue;

                case "Payback":
                    handActions.Add(new HandAction(name, HandActionType.UNCALLED_BET, amount, currentStreet));
                    continue;

                case "All-In":
                    handActions.Add(new AllInAction(name, amount, currentStreet, false));
                    continue;
                }

                throw new HandActionException(handLine, "Unrecognized preflop action.");
            }


            return(handActions);
        }
예제 #55
0
        protected override List <HandAction> ParseHandActions(string[] handLines, GameType gameType, out List <WinningsAction> winners)
        {
            // this is needed for future uncalledbet fixes
            var handHistory = new HandHistory();

            ParseExtraHandInformation(handLines, handHistory);

            int actionsIndex = GetFirstActionIndex(handLines);

            List <HandAction> handActions = new List <HandAction>();

            winners = new List <WinningsAction>();
            Street currentStreet = Street.Preflop;

            actionsIndex = ParseBlindActions(handLines, handActions, actionsIndex);

            for (int i = actionsIndex; i < handLines.Length; i++)
            {
                string handLine = handLines[i];

                if (handLine.StartsWithFast("Seat ")) // done with actions once we reach the seat line again
                {
                    break;
                }

                bool isAllIn = handLine.EndsWithFast("all in]");
                if (isAllIn)
                {
                    handLine = handLine.Substring(0, handLine.Length - 9);
                }

                if (handLine[0] == '-')
                {
                    if (handLine == "---")
                    {
                        continue;
                    }

                    // check for a line such as:
                    //  --- Dealing flop [3d, 8h, 6d]
                    // note: We can have players with - so hence the digit check to check for lines like
                    //   ---ich--- raises $21.42 to $22.92 [all in]
                    if (handLine[handLine.Length - 1] == ']' &&
                        char.IsDigit(handLine[handLine.Length - 2]) == false)
                    {
                        char streetIdentifierChar = handLine[12];
                        switch (streetIdentifierChar)
                        {
                        case 'f':
                            currentStreet = Street.Flop;
                            continue;

                        case 't':
                            currentStreet = Street.Turn;
                            continue;

                        case 'r':
                            currentStreet = Street.River;
                            continue;
                        }
                    }
                }

                //Dealing line may be "Dealing pocket cards"
                //or "Dealing to {PlayerName}: [ Xy, Xy ]"
                if (currentStreet == Street.Preflop &&
                    handLine.StartsWithFast("Dealing"))
                {
                    continue;
                }

                if (handLine[handLine.Length - 1] == ':') // check for Summary: line
                {
                    currentStreet = Street.Showdown;
                    actionsIndex  = i;
                    break;
                }

                handActions.Add(ParseRegularActionLine(handLine, currentStreet, isAllIn));
            }
            if (currentStreet == Street.Showdown)
            {
                ParseShowdownActions(handLines, actionsIndex, winners);
            }

            return(handActions);
        }
예제 #56
0
 public bool IsSame(GameType gameType)
 {
     return(GameConfig != null && GameConfig.GameType == gameType);
 }
예제 #57
0
        // 7 lane lanes
        //  -3500 |   -2500 -1500  1500   2500    3500 4500 5500 | 6500
        public static List <BeatmapObjectData> GetTurnSelectionBeatmapObjects(float time, List <int> spaces, PlayerType playerType, GameType game)
        {
            List <BeatmapObjectData> result = new List <BeatmapObjectData>();

            foreach (int i in spaces)
            {
                if (game == GameType.TicTacToe)
                {
                    ColorType     type  = playerType == PlayerType.First ? ColorType.ColorA : ColorType.ColorB;
                    int           index = ColForNum(i, playerType);
                    NoteLineLayer layer = RowForNum(i, playerType);
                    result.Add(new GameNote(playerType, i, time, index, layer, layer, type, NoteCutDirection.Any, 0f, 0f));
                }
                else if (game == GameType.ConnectFour)
                {
                    ColorType type = i < 4 ? ColorType.ColorA : i > 4 ? ColorType.ColorB : playerType == PlayerType.First ? ColorType.ColorA : ColorType.ColorB;
                    result.Add(new GameNote(playerType, i, time, IndexForColumn(i), NoteLineLayer.Base, NoteLineLayer.Base, type, NoteCutDirection.Any, 0f, 0f));
                }
            }


            return(result);
        }
예제 #58
0
        public void ParseShowDown(string[] handLines, ref List <HandAction> actions, int lineIndex, GameType gametype)
        {
            for (int i = lineIndex; i < handLines.Length; i++)
            {
                var line = handLines[i];

                if (line.EndsWith(" mucks"))
                {
                    actions.Add(new HandAction(line.Remove(line.Length - 6), HandActionType.MUCKS, 0m, Street.Showdown));
                }

                else if (line.Contains(" wins "))
                {
                    int nameEndIndex = -1;
                    nameEndIndex = line.IndexOf(" wins the pot (", StringComparison.Ordinal);
                    if (nameEndIndex == -1)
                    {
                        nameEndIndex = line.IndexOf(" wins pot 1 (", StringComparison.Ordinal);
                    }

                    if (nameEndIndex == -1)
                    {
                        continue;
                    }

                    string playerName = ObtainPlayerNameFromShowdownLine(handLines, i);
                    if (string.IsNullOrWhiteSpace(playerName))
                    {
                        playerName = line.Remove(nameEndIndex);
                    }

                    int amountStartIndex = line.IndexOf('(', nameEndIndex) + 1;
                    int amountEndString  = line.IndexOf(')', amountStartIndex);

                    string  amountString = line.Substring(amountStartIndex, amountEndString - amountStartIndex);
                    decimal amount       = decimal.Parse(amountString, NumberStyles.AllowCurrencySymbol | NumberStyles.Number, NumberFormatInfo);

                    actions.Add(new WinningsAction(playerName, HandActionType.WINS, amount, 0));
                }
                else if (line.Contains(" shows ["))
                {
                    int    nameEndIndex = line.IndexOf(" shows [", StringComparison.Ordinal);
                    string playerName   = line.Remove(nameEndIndex);

                    actions.Add(new HandAction(playerName, HandActionType.SHOW, 0m, Street.Showdown));
                }

#warning duplicate parse winning actions
                //We already parse winning actions, or is this a better way to parse winning actions even though it's slower?
                //
                //else if (line.Contains(" and won "))
                //{
                //    // as it's not absolutely clear what the name is, we grab the name out of the seating list
                //    //    Seat 6: Psipsis showed [Ad 5d] and won ($0.51) with a pair of Aces
                //    //    Seat 6: Psipsis (big blind) showed [Ad 5d] and won ($0.51) with a pair of Aces
                //    // -> Seat 6: Psipsis ($0.85)
                //    string playerName = ObtainPlayerNameFromShowdownLine(handLines, i);
                //    if (string.IsNullOrWhiteSpace(playerName)) continue;

                //    int amountStartIndex = line.IndexOf('(', line.IndexOf(" and won ", StringComparison.Ordinal)) + 1;
                //    int amountEndString = line.IndexOf(')', amountStartIndex);

                //    string amountString = line.Substring(amountStartIndex, amountEndString - amountStartIndex);
                //    decimal amount = decimal.Parse(amountString, NumberStyles.AllowCurrencySymbol | NumberStyles.Number, NumberFormatInfo);

                //    actions.Add(new WinningsAction(playerName, HandActionType.WINS, amount, 0));

                //}
                else if (line.Contains(" collected ("))
                {
                    if (actions.Any(a => a.IsWinningsAction))
                    {
                        continue;
                    }
                    // as it's not absolutely clear what the name is, we grab the name out of the seating list
                    // Seat 2: dude6974 (small blind) collected ($0.10), mucked
                    // Seat 7: tatskie100 collected ($3.35)
                    string playerName = ObtainPlayerNameFromShowdownLine(handLines, i);
                    if (string.IsNullOrWhiteSpace(playerName))
                    {
                        continue;
                    }

                    int amountStartIndex = line.LastIndexOf('(') + 1;
                    int amountEndString  = line.IndexOf(')', amountStartIndex);

                    string  amountString = line.Substring(amountStartIndex, amountEndString - amountStartIndex);
                    decimal amount       = decimal.Parse(amountString, NumberStyles.AllowCurrencySymbol | NumberStyles.Number, NumberFormatInfo);

                    actions.Add(new WinningsAction(playerName, HandActionType.WINS, amount, 0));
                }
            }
        }
 public TPlayer InstantiatePlayer <TPlayer>(PlayerType type, GameType gameType, Vector3 pos, Quaternion rotation = default(Quaternion), Transform parent = null) where TPlayer : INetPlayer
 {
     return(InstantiatePlayer(type, gameType, pos, rotation, parent).GetComponent <TPlayer>());
 }
예제 #60
0
        // 7 lane lanes
        //  -3500 |   -2500 -1500  1500   2500    3500 4500 5500 | 6500
        public static List <BeatmapObjectData> GetPlayerSelectionBeatmapObjects(float time, GameType game, float gameEndTime)
        {
            List <BeatmapObjectData> result = new List <BeatmapObjectData>();

            if (game == GameType.TicTacToe)
            {
                result.Add(new GameNote(PlayerType.First, -1, time, 1, NoteLineLayer.Base, NoteLineLayer.Base, ColorType.ColorA, NoteCutDirection.Any, 0f, 0f));
                result.Add(new GameNote(PlayerType.Second, -1, time, 2, NoteLineLayer.Base, NoteLineLayer.Base, ColorType.ColorB, NoteCutDirection.Any, 0f, 0f));
            }
            else if (game == GameType.ConnectFour)
            {
                result.Add(new GameNote(PlayerType.First, -1, time, 1500, NoteLineLayer.Base, NoteLineLayer.Base, ColorType.ColorA, NoteCutDirection.Any, 0f, 0f));
                result.Add(new GameNote(PlayerType.Second, -1, time, 3500, NoteLineLayer.Base, NoteLineLayer.Base, ColorType.ColorB, NoteCutDirection.Any, 0f, 0f));
                for (int i = 1; i < 9; ++i)
                {
                    result.Add(new GameObstacle(time, IndexForColumn(i), 0, gameEndTime - time, 1050, 1100));
                }
            }
            return(result);
        }