Exemple #1
0
        // create user
        public void CreateUser(GameObject _insider)
        {
            Text[] allText = new Text[0];
            allText = _insider.GetComponentsInChildren <Text>();            // get all
            for (int i = 0; i < allText.Length; i++)
            {
                if (allText[i].name == "name_text")
                {
                    nameText = allText[i];
                }
                else if (allText[i].name == "age_text")
                {
                    ageText = allText[i];
                }
            }
            bool     result   = int.TryParse(ageText.text, out output);       //i now = 108
            Dropdown dropDown = _insider.GetComponentInChildren <Dropdown>(); // get the dropdown value
            string   dropDownValue;

            if (dropDown.value == 0)
            {
                dropDownValue = "male";
            }
            else
            {
                dropDownValue = "female";
            }
            // emty check
            if (nameText.text == string.Empty || nameText.text == " " &&
                ageText.text == string.Empty || !result)
            {
                ShowPopups(sm_instance.errorPopup_parents_page); // trigger error popup
            }
            else
            {
                ShowPopups(sm_instance.newUserPopup);                             // close pop up
                _gc.m_SaveManager.SaveUser(nameText.text, output, dropDownValue); // save user name from input text name
                screenFiller = GetScreenFiller(sm_instance.userScreen);
                if (screenFiller.screenTextFiller)
                {
                    screenFiller.screenTextFiller.text = nameText.text;
                }
                if (screenFiller.ageTextFiller)
                {
                    screenFiller.ageTextFiller.text = ageText.text;
                }
                if (screenFiller.genderTextFiller)
                {
                    screenFiller.genderTextFiller.text = dropDownValue;
                }
                screenFiller.screenID = _gc.m_SaveManager.userDatas.Count - 1;
                SwitchScreen(sm_instance.userScreen, true); // go to user screen
            }
        }
Exemple #2
0
 public void EditName(Text _inputText)
 {
     if (_inputText.text == string.Empty || _inputText.text == " ")
     {
         ShowPopups(sm_instance.errorPopup_user_page);
     }
     else
     {
         screenFiller = GetScreenFiller(sm_instance.userScreen);
         int screen_id = screenFiller.screenID; // grab screen filler screen ID
         _gc.m_SaveManager.ModifyUser(_user_id: screen_id, _value: _inputText.text, _type: "name");
         screenFiller.screenTextFiller.text = _inputText.text;
         ShowPopups(sm_instance.editUserNamePopup);
     }
 }
Exemple #3
0
        public void EditAge(Text _inputText)
        {
            bool result = int.TryParse(_inputText.text, out output); //i now = 108

            if (_inputText.text == string.Empty || !result)
            {
                ShowPopups(sm_instance.errorPopup_user_page);
            }
            else
            {
                screenFiller = GetScreenFiller(sm_instance.userScreen);
                int screen_id = screenFiller.screenID; // grab screen filler screen ID
                _gc.m_SaveManager.ModifyUser(_user_id: screen_id, _value: _inputText.text, _type: "age");
                screenFiller.ageTextFiller.text = _inputText.text;
                ShowPopups(sm_instance.editUserAgePopup);
            }
        }
Exemple #4
0
        public void EditGender(Dropdown _dropdown)
        {
            string dropDownValue;

            if (_dropdown.value == 0)
            {
                dropDownValue = "male";
            }
            else
            {
                dropDownValue = "female";
            }
            screenFiller = GetScreenFiller(sm_instance.userScreen);
            int screen_id = screenFiller.screenID; // grab screen filler screen ID

            _gc.m_SaveManager.ModifyUser(_user_id: screen_id, _value: dropDownValue, _type: "gender");
            screenFiller.genderTextFiller.text = dropDownValue;
            ShowPopups(sm_instance.editUserGenderPopup);
        }
Exemple #5
0
 // create album
 public void CreateAlbum(Text _inputText)
 {
     if (_inputText.text == string.Empty || _inputText.text == " ")
     {
         ShowPopups(sm_instance.errorPopup_parents_page); // trigger error popup
     }
     else
     {
         ShowPopups(sm_instance.newAlbumPopup);   // close the pop ups
         _gc.m_SaveManager.SaveAlbum(_inputText); // save the albums
         screenFiller = GetScreenFiller(sm_instance.customAlbumScreen);
         if (screenFiller.screenTextFiller)
         {
             screenFiller.screenTextFiller.text = _inputText.text;
         }
         screenFiller.screenID = _gc.m_SaveManager.albumDatas.Count - 1;
         SwitchScreen(sm_instance.customAlbumScreen, true); // go to custom album screen
     }
 }
Exemple #6
0
        // album button behavior
        public void GoToAlbum(UISnapScrolling _snapScrolling)
        {
            int albumID = _snapScrolling.SelectedPanID; // get album ID
            // grab next screen and populate
            AlbumData currentAlbum = _gc.m_SaveManager.albumDatas[albumID];

            if (albumID == 0 || albumID == 1)
            {
                screenFiller = GetScreenFiller(sm_instance.albumScreen);

                instImage = new GameObject[_gc.m_SaveManager.albumDatas[albumID].imagePath.Count];
                for (int i = 0; i < _gc.m_SaveManager.albumDatas[albumID].imagePath.Count; i++)
                {
                    instImage[i] = Instantiate(_gc.m_SaveManager.m_imagePrefab, albumContainer.transform, false);
                    AlbumFiller albumFiller = instImage[i].GetComponent <AlbumFiller>();
                    if (albumFiller.frameText)
                    {
                        albumFiller.frameText.text = _gc.m_SaveManager.albumDatas[albumID].imageName[i];
                    }
                    albumFiller.frameID = _gc.m_SaveManager.albumDatas[albumID].imageName.IndexOf(_gc.m_SaveManager.albumDatas[albumID].imageName[i]);

                    var texture = Resources.Load <Texture2D>("defaultalbum/" +
                                                             _gc.m_SaveManager.albumDatas[albumID].imagePath[i]);
                    if (albumFiller.frameImage)
                    {
                        albumFiller.frameImage.texture = texture;
                    }
                }
                SwitchScreen(sm_instance.albumScreen, true);
            }
            else
            {
                screenFiller = GetScreenFiller(sm_instance.customAlbumScreen);
                // load texture from gallery
                SwitchScreen(sm_instance.customAlbumScreen, true);
            }
            if (screenFiller.screenTextFiller)
            {
                screenFiller.screenTextFiller.text = currentAlbum.albumName;
            }
            screenFiller.screenID = _gc.m_SaveManager.albumDatas[albumID]._id;
        }
Exemple #7
0
        // profile button behaviour
        public void GoToProfile(UISnapScrolling _snapScrolling)
        {
            int profileID = _snapScrolling.SelectedPanID; // get album ID
            // grab next screen and populate
            UserData currentProfile = _gc.m_SaveManager.userDatas[profileID];

            screenFiller = GetScreenFiller(sm_instance.userScreen);
            if (screenFiller.screenTextFiller)
            {
                screenFiller.screenTextFiller.text = currentProfile.userName;
            }
            if (screenFiller.ageTextFiller)
            {
                screenFiller.ageTextFiller.text = currentProfile.age.ToString();
            }
            if (screenFiller.genderTextFiller)
            {
                screenFiller.genderTextFiller.text = currentProfile.gender;
            }
            screenFiller.screenID = profileID;
            SwitchScreen(sm_instance.userScreen, true);
        }