コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject infoLogObject = GameObject.Find("InfoLog");

        infoLogObject.GetComponent <Canvas>().enabled = false;
        infoLogAnimator = infoLogObject.GetComponent <Animator>();


        GameObject loginWindow = GameObject.Find("LoginWindow");

        loginLogic = loginWindow.GetComponent <LoginLogic>();
        GameObject informationWindow = GameObject.Find("InformationWindow");

        informationLogic = informationWindow.GetComponent <InformationLogic>();
        GameObject registerWindow = GameObject.Find("RegisterWindow");

        registerLogin = registerWindow.GetComponent <RegisterLogin>();
        GameObject mainMenuWindow = GameObject.Find("MainMenuWindow");

        mainMenuLogic = mainMenuWindow.GetComponent <MainMenuLogic>();
        GameObject gameCreationWindow = GameObject.Find("GameCreationWindow");

        gameCreationLogic = gameCreationWindow.GetComponent <GameCreationLogic>();
        GameObject invitationWindow = GameObject.Find("InvitationWindow");

        invitationLogic = invitationWindow.GetComponent <InvitationLogic>();
        GameObject joinAGameWindow = GameObject.Find("JoinAGameWindow");

        joinAGameLogic = joinAGameWindow.GetComponent <JoinAGameLogic>();
        connectToServer();
    }
        private void PopulateIdentifyingAreasLeaderboard()
        {
            LearningGames lg = new LearningGames();
            RegisterLogin rl = new RegisterLogin();

            mlb = lg.GetAllLeadBoardRecords(connectionString).OrderByDescending(a => a.IDENTIFYING_AREAS_PERSONAL_BEST).ToList();

            int i = 1;

            foreach (var item in mlb)
            {
                user = rl.GetUser(item.USER_LIBRARY_CARD_ID, connectionString);

                DataGridBind dgb = new DataGridBind
                {
                    POSITION = i.ToString(),
                    NAME     = user[0].USER_FNAME + " " + user[0].USER_LNAME,
                    SCORE    = item.IDENTIFYING_AREAS_PERSONAL_BEST.ToString()
                };


                dgIdentifyingAreas.Items.Add(dgb);
                i++;
            }
        }
        private void PopulateReplacingBooksLeaderboard()
        {
            LearningGames lg = new LearningGames();
            RegisterLogin rl = new RegisterLogin();

            mlb = lg.GetAllLeadBoardRecords(connectionString).OrderBy(a => a.REPLACING_BOOKS_PERSONAL_BEST).ToList();

            int i = 1;

            foreach (var item in mlb)
            {
                user = rl.GetUser(item.USER_LIBRARY_CARD_ID, connectionString);

                DataGridBind dgb = new DataGridBind
                {
                    POSITION = i.ToString(),
                    NAME     = user[0].USER_FNAME + " " + user[0].USER_LNAME,
                    SCORE    = item.REPLACING_BOOKS_PERSONAL_BEST
                };


                dgReplacingBooks.Items.Add(dgb);
                i++;
            }
        }
        private void MainMenu1_Loaded(object sender, RoutedEventArgs e)
        {
            RegisterLogin rl = new RegisterLogin();

            List <ModelRegisterLogin> getUserName = rl.GetUser(currentUser, connectionString);

            lbCurrentUser.Content = "Welcome " + getUserName[0].USER_FNAME + " !";
        }
        private void UpdateLeaderBoardPersonalBest()
        {
            try
            {
                LearningGames lg = new LearningGames();
                RegisterLogin rl = new RegisterLogin();

                ModelLeaderBoard mlb = new ModelLeaderBoard
                {
                    USER_LIBRARY_CARD_ID = currentUser
                };

                List <ModelLeaderBoard> getPersonalBest = lg.GetPersonalBestIdentifyingAreas(mlb, connectionString);


                tbPBSCore.Text = getPersonalBest[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString();



                if (getPersonalBest.Count == 1)
                {
                    tbPBSCore.Text = getPersonalBest[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString();
                }



                getAllRecords = lg.GetIdentifyingAreasChampion(connectionString);

                if (getAllRecords[0].IDENTIFYING_AREAS_PERSONAL_BEST == 0)
                {
                    tbChampionName.Text = "No Champion Yet !";
                }
                else
                {
                    tbChampScore.Text = getAllRecords[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString();

                    List <ModelLeaderBoard> getBestUserId = lg.GetChampionNameIdentifyingAreas(getAllRecords[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString(), connectionString);

                    int id = getBestUserId[0].USER_LIBRARY_CARD_ID;

                    if (id == currentUser)
                    {
                        isChamp = true;
                    }

                    List <ModelRegisterLogin> getBestUser = rl.GetUser(id, connectionString);
                    tbChampionName.Text = getBestUser[0].USER_FNAME + " " + getBestUser[0].USER_LNAME;
                }
            }
            catch (Exception)
            {
                tbChampionName.Text = "No Champion Yet !";
            }
        }
コード例 #6
0
 public IActionResult Login(RegisterLogin model, string returnUrl = null)
 {
     ViewData["ReturnUrl"] = returnUrl;
     if (ModelState.IsValid)
     {
         if (model.User == "user" && model.Password == "1234")
         {
             return(View("Welcome"));
         }
         else
         {
             ModelState.AddModelError(string.Empty, "Por favor verifique su usuario y password que alguno no es el correcto");
             return(View(model));
         }
     }
     else
     {
         ModelState.AddModelError(string.Empty, "No se pudo validar, intente mas tarde");
         return(View(model));
     }
 }
コード例 #7
0
        //Updates labels related to personal best score and champion
        private void UpdateLeaderBoardPersonalBest()
        {
            try
            {
                LearningGames lg = new LearningGames();
                RegisterLogin rl = new RegisterLogin();

                ModelLeaderBoard mlb = new ModelLeaderBoard
                {
                    USER_LIBRARY_CARD_ID = currentUser
                };

                List <ModelLeaderBoard> getPersonalBest = lg.GetPersonalBestReplacingBooks(mlb, connectionString);

                if (getPersonalBest.Count == 1)
                {
                    lbPersonalBest.Text = getPersonalBest[0].REPLACING_BOOKS_PERSONAL_BEST.ToString();
                    pb = getPersonalBest[0].REPLACING_BOOKS_PERSONAL_BEST.ToString();
                }

                getAllRecords = lg.GetAllLeadBoardRecords(connectionString);

                SelectionSortBestTime();

                lbChampTime.Text = getAllRecords[0].REPLACING_BOOKS_PERSONAL_BEST;

                List <ModelLeaderBoard> getBestUserId = lg.GetChampionNameReplacingBooks(getAllRecords[0].REPLACING_BOOKS_PERSONAL_BEST.ToString(), connectionString);

                int id = getBestUserId[0].USER_LIBRARY_CARD_ID;

                List <ModelRegisterLogin> getBestUser = rl.GetUser(id, connectionString);
                tbChampionName.Text = getBestUser[0].USER_FNAME + " " + getBestUser[0].USER_LNAME;
                ChampTime           = getAllRecords[0].REPLACING_BOOKS_PERSONAL_BEST;
            }
            catch (Exception)
            {
                tbChampionName.Text = "No Champion Yet !";
            }
        }
コード例 #8
0
    //Start is called before the first frame update
    //It gets all the unity objects needed on this script, makes the infoLog invisible
    //Get an instance of the server connection
    //set the button events
    //Executes the function to connect to the server for the first time
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        Debug.Log("Loading Message_Parser");

        GameObject infoLogObject = GameObject.Find("InfoLog");

        infoLogObject.GetComponent <Canvas>().enabled = false;
        infoLogAnimator = infoLogObject.GetComponent <Animator>();


        GameObject loginWindow = GameObject.Find("LoginWindow");

        loginLogic = loginWindow.GetComponent <LoginLogic>();
        GameObject informationWindow = GameObject.Find("InformationWindow");

        informationLogic = informationWindow.GetComponent <InformationLogic>();
        GameObject registerWindow = GameObject.Find("RegisterWindow");

        registerLogin = registerWindow.GetComponent <RegisterLogin>();
        GameObject mainMenuWindow = GameObject.Find("MainMenuWindow");

        mainMenuLogic = mainMenuWindow.GetComponent <MainMenuLogic>();
        GameObject gameCreationWindow = GameObject.Find("GameCreationWindow");

        gameCreationLogic = gameCreationWindow.GetComponent <GameCreationLogic>();
        GameObject invitationWindow = GameObject.Find("InvitationWindow");

        invitationLogic = invitationWindow.GetComponent <InvitationLogic>();
        GameObject joinAGameWindow = GameObject.Find("JoinAGameWindow");

        joinAGameLogic = joinAGameWindow.GetComponent <JoinAGameLogic>();
        GameObject scoreboardWindow = GameObject.Find("ScoreboardWindow");

        scoreBoardLogic = scoreboardWindow.GetComponent <ScoreBoardLogic>();
        GameObject personalBoardWindow = GameObject.Find("PersonalBoardWindow");

        personalBoardLogic = personalBoardWindow.GetComponent <LoginUI.PersonalBoardLogic>();
        connectToServer();
    }