public void saveClick()
    {
        AudioBG.ButtonSound();

        if (options.value == 0)
        {
            mat.mainTexture = bg1.texture;
        }
        else if (options.value == 1)
        {
            mat.mainTexture = bg2.texture;
        }

        SceneManager.LoadScene("Configurations");
    }
Example #2
0
    public void saveClick()
    {
        AudioBG.ButtonSound();

        if (!contains(username.text))
        {
            Login.auth.users.Add(new User(username.text, username.text, "NEW"));
            Login.WriteData();
        }
        else
        {
            invalid.text = "User Already Exists";
        }

        SceneManager.LoadScene("UserAccounts");
    }
Example #3
0
    // Start is called before the first frame update
    void Start()
    {
        free.onClick.AddListener(delegate
        {
            AudioBG.ButtonSound();


            bool found = false;
            for (int i = 0; i < Login.auth.users.Count; i++)
            {
                if (username.text == Login.auth.users[i].username)
                {
                    found = true;
                    if (Login.auth.users[i].status == "BLOCKED")
                    {
                        Login.auth.users[i].status   = "NEW";
                        Login.auth.users[i].password = username.text;
                        info.text = "User " + username.text + " is Unblocked";
                        Login.auth.users[i].LoginAttempts = 0;
                    }
                    else
                    {
                        info.text = "User " + username.text + " was never blocked";
                    }
                    break;
                }
            }

            if (!found)
            {
                info.text = "User Does Not Exist";
            }
            Login.WriteData();
        });

        exit.onClick.AddListener(delegate {
            AudioBG.ButtonSound();

            SceneManager.LoadScene("UserAccounts");
        });
    }
Example #4
0
    public void deleteClick()
    {
        AudioBG.ButtonSound();

        if (username.text == "admin")
        {
            invalid.text = "Cannot delete Admin";
            return;
        }

        if (contains(username.text))
        {
            User toRemove = getUser();
            Login.auth.users.Remove(toRemove);
            Login.WriteData();
            SceneManager.LoadScene("UserAccounts");
        }
        else
        {
            AudioBG.ButtonSound();

            invalid.text = "User Does Not Exist";
        }
    }
Example #5
0
    public void updateClick()
    {
        AudioBG.ButtonSound();

        if (Login.auth.users[Login.UserIndex].password != password.text)
        {
            Login.auth.users[Login.UserIndex].password = password.text;
            Login.WriteData();

            if (Login.isNew)
            {
                Login.isNew = false;
                SceneManager.LoadScene("Toolbar");
            }
            else
            {
                SceneManager.LoadScene("UserAccounts");
            }
        }
        else
        {
            invalid.text = "Old password cannot be same as new password";
        }
    }
Example #6
0
    // Start is called before the first frame update
    void Start()
    {
        exit.onClick.AddListener(delegate
        {
            AudioBG.ButtonSound();

            if (toolbar.isGame)
            {
                if (toolbar.game == 0)
                {
                    toolbar.isGame = false;
                    SceneManager.LoadScene("MainScene");
                }
                else
                {
                    toolbar.isGame = false;
                    SceneManager.LoadScene("GameMenu");
                }
            }
            else
            {
                toolbar.isGame = false;
                SceneManager.LoadScene("File");
            }
        });

        if (toolbar.isGame)
        {
            if (toolbar.game == 0)
            {
                GameObject h = (GameObject)Instantiate(HeaderShoot);
                h.transform.SetParent(panel.transform, false);

                for (int i = 0; i < Login.auth.users[Login.UserIndex].history.ShooterGame.dates.Count; i++)
                {
                    GameObject a = (GameObject)Instantiate(EntryShoot);
                    Text[]     t = a.GetComponentsInChildren <Text>();
                    t[0].text = Login.auth.users[Login.UserIndex].username;
                    t[1].text = Login.auth.users[Login.UserIndex].history.ShooterGame.dates[i];
                    t[2].text = Login.auth.users[Login.UserIndex].history.ShooterGame.scores[i];
                    t[3].text = Login.auth.users[Login.UserIndex].history.ShooterGame.levels[i];
                    a.transform.SetParent(panel.transform, false);
                }
            }
            else
            {
                GameObject h = (GameObject)Instantiate(HeaderGame);
                h.transform.SetParent(panel.transform, false);

                if (toolbar.game == 1)
                {
                    for (int i = 0; i < Login.auth.users[Login.UserIndex].history.AppleGame.dates.Count; i++)
                    {
                        GameObject a = (GameObject)Instantiate(EntryGame);
                        Text[]     t = a.GetComponentsInChildren <Text>();

                        t[0].text = Login.auth.users[Login.UserIndex].username;
                        t[1].text = Login.auth.users[Login.UserIndex].history.AppleGame.dates[i];
                        t[2].text = Login.auth.users[Login.UserIndex].history.AppleGame.scores[i];

                        a.transform.SetParent(panel.transform, false);
                    }
                }
                else if (toolbar.game == 2)
                {
                    for (int i = 0; i < Login.auth.users[Login.UserIndex].history.RPSGame.dates.Count; i++)
                    {
                        GameObject a = (GameObject)Instantiate(EntryGame);
                        Text[]     t = a.GetComponentsInChildren <Text>();

                        t[0].text = Login.auth.users[Login.UserIndex].username;
                        t[1].text = Login.auth.users[Login.UserIndex].history.RPSGame.dates[i];
                        t[2].text = Login.auth.users[Login.UserIndex].history.RPSGame.scores[i];

                        a.transform.SetParent(panel.transform, false);
                    }
                }
                else if (toolbar.game == 3)
                {
                    for (int i = 0; i < Login.auth.users[Login.UserIndex].history.MemoryGame.dates.Count; i++)
                    {
                        GameObject a = (GameObject)Instantiate(EntryGame);
                        Text[]     t = a.GetComponentsInChildren <Text>();

                        t[0].text = Login.auth.users[Login.UserIndex].username;
                        t[1].text = Login.auth.users[Login.UserIndex].history.MemoryGame.dates[i];
                        t[2].text = Login.auth.users[Login.UserIndex].history.MemoryGame.scores[i];

                        a.transform.SetParent(panel.transform, false);
                    }
                }
            }
        }
        else
        {
            // Admins see differently than other users
            if (toolbar.isAdmin)
            {
                GameObject h = (GameObject)Instantiate(HeaderAdmin);
                h.transform.SetParent(panel.transform, false);

                for (int i = 0; i < Login.auth.users.Count; i++)
                {
                    GameObject a = (GameObject)Instantiate(EntryAdmin);
                    Text[]     t = a.GetComponentsInChildren <Text>();
                    t[0].text = Login.auth.users[i].username;
                    //t[1].text = Login.auth.users[Login.UserIndex].history.logins[Login.auth.users[Login.UserIndex].history.logins.Count - 1];
                    //t[2].text = Login.auth.users[Login.UserIndex].history.durations[Login.auth.users[Login.UserIndex].history.durations.Count - 1];
                    t[3].text = Login.auth.users[i].status;
                    // Debug.Log(Login.auth.users[Login.UserIndex].history.logins[0]);
                    if (Login.auth.users[i].history.logins.Count == 0)
                    {
                        t[1].text = "No Previous Logins";
                        t[2].text = "No Previous Logins";
                    }
                    else if (Login.auth.users[i].history.logins.Count == 1)
                    {
                        t[1].text = Login.auth.users[i].history.logins[0];
                        t[2].text = "No previous Logins";
                    }
                    else
                    {
                        t[1].text = Login.auth.users[i].history.logins[Login.auth.users[i].history.logins.Count - 1];
                        t[2].text = Login.auth.users[i].history.durations[Login.auth.users[i].history.durations.Count - 1];
                    }

                    a.transform.SetParent(panel.transform, false);
                }
            }
            else
            {
                GameObject h = (GameObject)Instantiate(HeaderOther);
                h.transform.SetParent(panel.transform, false);

                int countLogins    = Login.auth.users[Login.UserIndex].history.logins.Count;
                int countDurations = Login.auth.users[Login.UserIndex].history.durations.Count;
                for (int i = 0; i < countLogins; i++)
                {
                    GameObject a = (GameObject)Instantiate(EntryOther);
                    Text[]     t = a.GetComponentsInChildren <Text>();

                    t[0].text = Login.auth.users[Login.UserIndex].history.logins[i];

                    if (i < countDurations)
                    {
                        t[1].text = Login.auth.users[Login.UserIndex].history.durations[i];
                    }
                    else
                    {
                        t[1].text = "In Progress";
                    }

                    a.transform.SetParent(panel.transform, false);
                }
            }
        }
    }
Example #7
0
    public void exitClick()
    {
        AudioBG.ButtonSound();

        SceneManager.LoadScene("UserAccounts");
    }
Example #8
0
 void appleClick()
 {
     AudioBG.ButtonSound();
     game = 1;
     SceneManager.LoadScene("GameMenu");
 }
Example #9
0
    public void configClick()
    {
        AudioBG.ButtonSound();

        SceneManager.LoadScene("Configurations");
    }
Example #10
0
    public void exitClick()
    {
        AudioBG.ButtonSound();

        SceneManager.LoadScene("File");
    }
Example #11
0
    public void changeClick()
    {
        AudioBG.ButtonSound();

        SceneManager.LoadScene("Change");
    }
Example #12
0
 void memoryClick()
 {
     AudioBG.ButtonSound();
     game = 3;
     SceneManager.LoadScene("GameMenu");
 }
Example #13
0
 void rpsClick()
 {
     AudioBG.ButtonSound();
     game = 2;
     SceneManager.LoadScene("GameMenu");
 }
Example #14
0
 public void ExitClick()
 {
     AudioBG.ButtonSound();
     // UnityEditor.EditorApplication.isPlaying = false;
     Application.Quit();
 }
Example #15
0
    public void historyClick()
    {
        AudioBG.ButtonSound();

        SceneManager.LoadScene("History");
    }
Example #16
0
    public void LoginClick()
    {
        AudioBG.ButtonSound();
        auth             = GetData();
        invalidText.text = "";

        for (int i = 0; i < auth.users.Count; i++)
        {
            User current = auth.users[i];

            if (current.username == UsernameField.text && current.password == PasswordField.text)
            {
                UserIndex = i;
                break;
            }
            else if (current.username == UsernameField.text && current.password != PasswordField.text)
            {
                auth.users[i].LoginAttempts++;
                WriteData();
            }
        }

        if (UserIndex < 0)
        {
            invalidText.text = "Invalid Credentials";
            return;
        }

        if (auth.users[UserIndex].LoginAttempts >= 3)
        {
            auth.users[UserIndex].status = "BLOCKED";
            WriteData();
            invalidText.text = "User " + auth.users[UserIndex].username + " Blocked";
            return;
        }

        initial = System.DateTime.Now;
        auth.users[UserIndex].history.logins.Add(System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
        auth.users[UserIndex].LoginAttempts = 0;
        WriteData();

        // If logging in for the first time
        if (auth.users[UserIndex].status == "NEW")
        {
            isNew = true;
            auth.users[UserIndex].status = "NORMAL";
            WriteData();
            SceneManager.LoadScene("Change");
        }
        else
        {
            SceneManager.LoadScene("toolbar");
        }

        /*
         * if (UserIndex < 0)
         * {
         *  invalidText.text = "Invalid Credentials";
         * }
         * else if (UserIndex >= 0 && auth.users[UserIndex].LoginAttempts >= 3)
         * {
         *  invalidText.text = "User Blocked";
         * }
         * else
         * {
         *  initial = System.DateTime.Now;
         *  auth.users[UserIndex].history.logins.Add(System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
         *  auth.users[UserIndex].LoginAttempts = 0;
         *  WriteData();
         *
         *  // If logging in for the first time
         *  if (auth.users[UserIndex].status == "NEW")
         *  {
         *      auth.users[UserIndex].status = "NORMAL";
         *      WriteData();
         *      SceneManager.LoadScene("Change");
         *  }
         *  else
         *  {
         *      SceneManager.LoadScene("toolbar");
         *  }
         *
         * }
         */
        UsernameField.text = "";
        PasswordField.text = "";
    }
Example #17
0
 void fileClick()
 {
     AudioBG.ButtonSound();
     SceneManager.LoadScene("File");
 }