コード例 #1
0
        //Helper method for SelectionState
        private void UpdateSelected(Player player, int playerNumber)
        {
            CharPortrait current = null;

            player.UpdateSelect();
            for (int i = 0; i < portraits.Count; i++)
            {
                if (portraits[i].IsSelected[playerNumber - 1])
                {
                    current = portraits[i];
                }
            }
            if (player.SelectLeft)
            {
                current.IsSelected[playerNumber - 1] = false;
                current = current.Left;
                current.IsSelected[playerNumber - 1] = true;
            }
            else if (player.SelectRight)
            {
                current.IsSelected[playerNumber - 1] = false;
                current = current.Right;
                current.IsSelected[playerNumber - 1] = true;
            }
            else if (player.SelectUp || player.SelectDown)
            {
                current.IsSelected[playerNumber - 1] = false;
                current = current.Vertical;
                current.IsSelected[playerNumber - 1] = true;
            }

            switch (current.Type)
            {
            case PlayerType.Caveman:
                info[playerNumber - 1] = caveInfo;
                break;

            case PlayerType.Cowboy:
                info[playerNumber - 1] = cowInfo;
                break;

            case PlayerType.GentleMan:
                info[playerNumber - 1] = gInfo;
                break;

            case PlayerType.Knight:
                info[playerNumber - 1] = kInfo;
                break;

            default:
                break;
            }
            types[playerNumber - 1] = current.Type;
        }
コード例 #2
0
        //Resets the portraits on the select screen
        public void ResetPortraits(int playerNum)
        {
            portrait1 = new CharPortrait(portraitTexture[0], select, new Rectangle(portraitHalfScreen - (10 + (portraitWidth / 2)), 240 - (portraitHeight + 10), portraitWidth, portraitHeight), true, 1, playerNum);
            portrait2 = new CharPortrait(portraitTexture[1], select, new Rectangle(portraitHalfScreen + (portraitWidth / 2), 240 - (portraitHeight + 10), portraitWidth, portraitHeight), true, 2, playerNum);
            portrait3 = new CharPortrait(portraitTexture[2], select, new Rectangle(portraitHalfScreen - (10 + (portraitWidth / 2)), 250, portraitWidth, portraitHeight), false, 3, playerNum);
            portrait4 = new CharPortrait(portraitTexture[3], select, new Rectangle(portraitHalfScreen + (portraitWidth / 2), 250, portraitWidth, portraitHeight), false, 4, playerNum);

            SetNeighbors();

            portrait1.IsSelected = new List <bool> {
                true, true, true, true
            };
            portraits = new List <CharPortrait>();
            portraits.Add(portrait1);
            portraits.Add(portrait2);
            portraits.Add(portrait3);
            portraits.Add(portrait4);
        }