Exemplo n.º 1
0
        //Method for getting Player Info
        static PO_Player PlayerInfo()
        {
            PO_Player Player = new PO_Player();

            Console.WriteLine("Player UserName");
            Player.PlayerName = Console.ReadLine();

            Console.WriteLine("Player First Name");
            Player.PlayerFirstName = Console.ReadLine();

            Console.WriteLine("Player Last Name");
            Player.PlayerLastName = Console.ReadLine();

            Console.WriteLine("What City are you from?");
            Player.PlayerCity = Console.ReadLine();

            Console.WriteLine("What State are you from?");
            Player.PlayerState = Console.ReadLine();

            Console.WriteLine("How old are you?");
            Player.PlayerAge = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter a Password?");
            Player.PlayerPassword = Console.ReadLine();

            Console.WriteLine("What is your RoleID number?(If not assisgned please enter '1')");
            Player.FKRoleID = Convert.ToInt32(Console.ReadLine());

            return(Player);
        }
Exemplo n.º 2
0
    public PO_Player GetPlayer()
    {
        foreach (PowerObject po in objects.Values)
        {
            GameObject go = po.gameObject;
            PO_Player  p  = go.GetComponentInChildren <PO_Player>();
            if (p != null)
            {
                return(p);
            }
        }

        return(null);
    }
Exemplo n.º 3
0
    private void SetSeed(int seed, PO_Player player, PO_Sentinel sentinel)
    {
        _sentinelGridPosition = Vector3.positiveInfinity;
        _seed = seed;

        _player = player;
        if (_player != null)
        {
            _player.ON_ABSORBED.AddListener(OnPlayerAbsorbed);
            _player.ON_GRID_POSITION_CHANGE.AddListener(OnPlayerGridPositionChanged);
        }

        _sentinel = sentinel;
        if (_sentinel != null)
        {
            _sentinel.ON_ABSORBED.AddListener(OnSentinelAbsorbed);
        }
    }
Exemplo n.º 4
0
 public void PopulatePlayer()
 {
     if (robot && player)
     {
         PowerObject newRobot = GeneratePowerObject(typeof(PO_Robot), null);
         if (newRobot)
         {
             GameObject newObj = InstantiateObject(player, newRobot.transform.root.transform.position, Quaternion.identity);
             if (newObj)
             {
                 PO_Player newPlayer = newObj.transform.root.GetComponent <PO_Player>();
                 if (newPlayer)
                 {
                     newPlayer.PosessBody(newRobot);
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            //create a new instance of DataAccessLayer class
            DataAccess data   = new DataAccess();
            DataAccess delete = new DataAccess();
            //Creating new instances of the LogicLayer Class
            TeamsLogic TLogic = new TeamsLogic();
            StatsLogic SLogic = new StatsLogic();

            string yes;

            do
            {
                // create a console menu for the user
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("(A) Add something");
                Console.WriteLine("(D) Delete something");
                Console.WriteLine("(U) update something");
                Console.WriteLine("(V) View something");
                Console.WriteLine("(L) Leave Team");
                Console.WriteLine("(J) Join Team");

                //String left "Empty"
                string PST = "Empty";

                //create a variable for CRUD, Team
                //ToUpper to Convert User Input to UpperCase
                string CRUD = Console.ReadLine().ToUpper().Trim();
                if (CRUD.Equals("L") && CRUD.Equals("J"))
                {
                    //Only applies to the Teams Data
                }
                else
                {
                    PST = whichtable();
                }
                bool success = false;
                //create a switch case to determine which method will be applied
                switch (CRUD)
                {
                //Adding Case
                case "A":
                    switch (PST)
                    {
                    //"P" to add a Player to the DB
                    case "P":
                        success = data.AddPlayer(_mapper.Map(PlayerInfo()));
                        //indicate wheather a record was created based on the bool above
                        if (success)
                        {
                            Console.WriteLine("You have added a new Player!");
                        }
                        else
                        {
                            Console.WriteLine("Sorry, Something went wrong. No Player Was Added.");
                        }
                        break;

                    case "S":

                        PO_Stats NewStats = StatsInfo();
                        success = SLogic.AddStats(_LLMap.map(_mapper.Map(NewStats)));

                        //indicate wheather a record was created based on the bool above
                        if (success)
                        {
                            Console.WriteLine("You have added a new Stats!");
                        }
                        else
                        {
                            Console.WriteLine("Sorry, Something went wrong. No Stats Were Added.");
                        }
                        break;

                    case "T":
                        success = data.AddTeams(_mapper.Map(TeamsInfo()));
                        //indicate wheather a record was created based on the bool above
                        if (success)
                        {
                            Console.WriteLine("You have added a new Team!");
                        }
                        else
                        {
                            Console.WriteLine("Sorry, Something went wrong. No Team Was Added.");
                        }
                        break;
                    }
                    break;

                //this case deletes
                case "D":
                    switch (PST)
                    {
                    //this is to delete a book
                    case "P":
                        success = data.DeletePlayer(Name("PlayerName"));
                        if (success)
                        {
                            Console.WriteLine("The Player was successfully deleted.");
                        }
                        else
                        {
                            Console.WriteLine("Sorry, Something went wrong.");
                        }
                        break;

                    case "S":
                        success = data.DeleteStats(Name("PlayerName"));
                        if (success)
                        {
                            Console.WriteLine("The Stat was successfully deleted.");
                        }
                        else
                        {
                            Console.WriteLine("Sorry, Something went wrong.");
                        }
                        break;

                    case "T":
                        success = data.DeleteTeam(Name("Team"));
                        if (success)
                        {
                            Console.WriteLine("The Team was successfully deleted.");
                        }
                        else
                        {
                            Console.WriteLine("Sorry, Something went wrong.");
                        }
                        break;
                    }
                    break;

                //this case updates
                case "U":
                    switch (PST)
                    {
                    case "P":
                        PO_Player updatePlayer = PlayerInfo();
                        updatePlayer.PlayerName = Name("PlayerName");
                        success = data.UpdatePlayer(_mapper.Map(updatePlayer));
                        if (success)
                        {
                            Console.WriteLine("The Player was successfully Updated.");
                        }
                        else
                        {
                            Console.WriteLine("Sorry, Something went wrong.");
                        }
                        break;

                    case "S":
                        PO_Stats updateStats = StatsInfo();
                        updateStats.FKPlayerName = Name("PlayerName");
                        success = data.UpdateStats(_mapper.Map(updateStats));
                        if (success)
                        {
                            Console.WriteLine("The Stat was successfully Updated.");
                        }
                        else
                        {
                            Console.WriteLine("Sorry, Something went wrong.");
                        }
                        break;

                    case "T":
                        PO_Teams updateTeam = TeamsInfo();
                        updateTeam.TeamName = Name("TeamName");
                        success             = data.UpdateTeams(_mapper.Map(updateTeam));
                        if (success)
                        {
                            Console.WriteLine("The Team was successfully Updated.");
                        }
                        else
                        {
                            Console.WriteLine("Sorry, Something went wrong.");
                        }
                        break;
                    }
                    break;

                //this case Views
                case "V":
                    switch (PST)
                    {
                    case "P":
                        List <PO_Player> PlayerToView = new List <PO_Player>();
                        PlayerToView = _mapper.Map(data.GetAllPlayers());
                        foreach (PO_Player singlePlayer in PlayerToView)
                        {
                            Console.WriteLine(singlePlayer.PlayerID + " | Player Name: " + singlePlayer.PlayerName + " | First Name: "
                                              + singlePlayer.PlayerFirstName + " | Last Name: " + singlePlayer.PlayerLastName +
                                              " | City: " + singlePlayer.PlayerCity + " | State: " + singlePlayer.PlayerState + " | Age: " +
                                              singlePlayer.PlayerAge);
                        }
                        break;

                    case "S":

                        List <PO_Stats> StatsToView = new List <PO_Stats>();
                        StatsToView = _mapper.Map(data.GetAllStats());
                        foreach (PO_Stats SingleStat in StatsToView)
                        {
                            Console.WriteLine(" | Player Name: " + SingleStat.FKPlayerName + " | Kills: " + SingleStat.Kills +
                                              " | Deaths: " + SingleStat.Deaths + " | Average: " + SingleStat.Average);
                        }
                        break;

                    case "T":
                        List <PO_Teams> TeamsToView = new List <PO_Teams>();
                        TeamsToView = _mapper.Map(data.GetAllTeams());
                        foreach (PO_Teams SingleTeam in TeamsToView)
                        {
                            Console.WriteLine("|` Team name:" + SingleTeam.TeamName + "|  Description: " + SingleTeam.TeamDescription +
                                              "| Open Slots: " + SingleTeam.PositionsAvaliable + "| Filled Spots:" + SingleTeam.PositionsTaken +
                                              "| Team Members:" + SingleTeam.FKPlayerName);
                        }
                        break;
                    }
                    break;

                // this case checks in
                case "L":

                    // Get TeamName to find what team to Leave
                    string   LeaveTeam    = Name("Teams");
                    TeamsDAO LeaveTeamDAO = data.viewSingleTeam(LeaveTeam);

                    // Makes sure there is is a position to leave
                    if (LeaveTeamDAO.PositionsTaken > 0)
                    {
                        success = TLogic._LeaveTeam(_LLMap.map(LeaveTeamDAO));
                    }

                    if (success)
                    {
                        Console.WriteLine("You have left the team.");
                    }
                    else
                    {
                        Console.WriteLine("Sorry,Something happend. You were unable to leave the team.");
                    }

                    break;

                case "J":

                    // Get Team Name to find the team wanting to be joined
                    string   JoinTeam    = Name("Teams");
                    TeamsDAO JoinTeamDAO = data.viewSingleTeam(JoinTeam);

                    // Makes sure there is a position to join
                    if (JoinTeamDAO.PositionsAvaliable > 0)
                    {
                        success = TLogic._JoinTeam(_LLMap.map(JoinTeamDAO));
                    }

                    if (success)
                    {
                        Console.WriteLine("You have successfully Joined the Team! Welcome!.");
                    }
                    else
                    {
                        Console.WriteLine("Sorry The position you are trying to Join is unavaliable. You were Unable to Join the team.");
                    }

                    break;
                }


                Console.WriteLine("Do you wish to continue? Y/N");
                yes = Console.ReadLine().ToUpper().Trim();
            }while (yes.Equals("Y"));
            Console.ReadLine();
        }