コード例 #1
0
 public void LoadFriendData()
 {
     _data = LoadXML(_FileLocation + "/" + _FriendDataFileName);
     if (_data.ToString() != "")
     {
         UserFriendData = (SaveFriendData)DeserializeObject(_data, "SaveFriendData");
     }
 }
コード例 #2
0
 public void Init()
 {
     Initialize     = false;
     UserFriendData = UserBlobManager.GetComponent <UserBlobManager>().UserFriendData;
     FriendName     = "";
     FriendEmail    = "";
     TextScreenName.GetComponent <InputField>().text = "";
     TextEmail.GetComponent <InputField>().text      = "";
 }
コード例 #3
0
    IEnumerator GetFriendList()
    {
        UpdateFriendList = false;
        string formText       = "";
        string URL            = UserBlobManager.GetComponent <UserBlobManager>().ServerURL + "uw.php";
        string hash           = UserBlobManager.GetComponent <UserBlobManager>().ServerHash;
        string formScreenName = UserBlobManager.GetComponent <UserBlobManager>().UserSettingsData.UserLogin;

        WWWForm form = new WWWForm();

        form.AddField("action", "get_friend_list");
        form.AddField("myform_hash", hash);
        form.AddField("myform_screenname", formScreenName);
        WWW w = new WWW(URL, form);

        yield return(w);

        if (w.error != null)
        {
            // connection error
            print(w.error);
        }
        else
        {
            formText = w.text;
            if (formText.Contains("HASH code is different from your app"))
            {
                print("Can't connect");
                w.Dispose();
            }
            else
            {
                if (formText.Contains("Cant Find Friend List Data"))
                {
                    print("No Friends Found");
                    StartCoroutine(GetFriendRequestAcceptedList());
                }
                else
                {
                    UserFriendData = (SaveFriendData)DeserializeObject(formText.ToString(), "SaveFriendData");
                    UserBlobManager.GetComponent <UserBlobManager>().UserFriendData = UserFriendData;
                    StartCoroutine(GetFriendRequestAcceptedList());
                }
            }
        }
        w.Dispose();

        StartCoroutine(GetFriendRequestList());
    }
コード例 #4
0
    public void Init()
    {
        Initialize     = false;
        UserFriendData = UserBlobManager.GetComponent <UserBlobManager>().UserFriendData;
        SelectedFriend = 0;
        UserBlobManager.GetComponent <UserBlobManager> ().CurrentFriendIndex = SelectedFriend;
        ClearScrollList();
        PopulateScrollList();

        if (UserBlobManager.GetComponent <UserBlobManager> ().UserFriendData.Friend.Length > 6)
        {
            SetScrollRectPositionFromIntWithOffset(0, 2.5, 200, UserBlobManager.GetComponent <UserBlobManager> ().UserFriendData.Friend.Length, FriendContentPanel);
        }
        else
        {
            FriendContentPanel.localPosition = new Vector3(0, 0, 0);
        }
    }
コード例 #5
0
    public void DeleteFriend()
    {
        int myIndex = UserBlobManager.GetComponent <UserBlobManager> ().CurrentFriendIndex;

        if (myIndex < UserBlobManager.GetComponent <UserBlobManager> ().UserFriendData.Friend.Length)
        {
            UserBlobManager.GetComponent <UserBlobManager> ().UserFriendData.RemoveAt(myIndex);
            UserFriendData = UserBlobManager.GetComponent <UserBlobManager>().UserFriendData;
            //UserBlobManager.GetComponent<UserBlobManager> ().SaveFriend();
            if (myIndex >= UserFriendData.Friend.Length)
            {
                myIndex = UserFriendData.Friend.Length - 1;
                UserBlobManager.GetComponent <UserBlobManager> ().CurrentFriendIndex = myIndex;
            }
            StartCoroutine(SetFriendList());
            SelectedFriend = myIndex;
            ClearScrollList();
            PopulateScrollList();
        }
    }
コード例 #6
0
    IEnumerator GetFriendRequestAcceptedList()
    {
        string formText       = "";
        string URL            = UserBlobManager.GetComponent <UserBlobManager>().ServerURL + "uw.php";
        string hash           = UserBlobManager.GetComponent <UserBlobManager>().ServerHash;
        string formScreenName = UserBlobManager.GetComponent <UserBlobManager>().UserSettingsData.UserLogin;

        WWWForm form = new WWWForm();

        form.AddField("action", "check_friend_request");
        form.AddField("myform_hash", hash);
        form.AddField("myform_ScreenName", formScreenName);
        WWW w = new WWW(URL, form);

        yield return(w);

        if (w.error != null)
        {
            // connection error
            print(w.error);
        }
        else
        {
            formText = w.text;
            if (formText.Contains("HASH code is different from your app"))
            {
                print("Can't connect");
                w.Dispose();
            }
            else
            {
                if (formText.Contains("Found No friend requests"))
                {
                    print("Found No friend requests");
                }
                else
                {
                    string[] tempArray = formText.Split('#');
                    UserFriendData = UserBlobManager.GetComponent <UserBlobManager>().UserFriendData;
                    for (int i = 1; i < tempArray.Length; i = i + 5) // start at 1 because the first entry is garbage.
                    {
                        if (tempArray[i] != "" && tempArray[i + 4] == "1")
                        {
                            FriendData tempFriend = new FriendData();
                            tempFriend.ScreenName      = tempArray[i + 1];
                            tempFriend.Email           = tempArray[i + 2];
                            tempFriend.RequestAccepted = false;
                            if (tempArray[i + 3] == "1")
                            {
                                tempFriend.RequestAccepted = true;
                            }
                            tempFriend.RequestSent = false;
                            if (tempArray[i + 4] == "1")
                            {
                                tempFriend.RequestSent = true;
                            }
                            if (tempFriend.RequestAccepted == true)
                            {
                                // check for duplicate friends
                                if (UserBlobManager.GetComponent <UserBlobManager>().FindFriendByScreenName(tempFriend.ScreenName) < 0)
                                {
                                    UserFriendData.Add(tempFriend);
                                    UserBlobManager.GetComponent <UserBlobManager>().UserFriendData = UserFriendData;
                                    //UserBlobManager.GetComponent<UserBlobManager>().SaveFriend();
                                    StartCoroutine(SetFriendList());
                                }
                            }
                            StartCoroutine(RemoveFriendRequest());
                        }
                    }
                }
            }
        }
        w.Dispose();
    }
コード例 #7
0
    IEnumerator GetFriendRequestList()
    {
        FriendRequestCount = 0;
        string formText       = "";
        string URL            = UserBlobManager.GetComponent <UserBlobManager>().ServerURL + "uw.php";
        string hash           = UserBlobManager.GetComponent <UserBlobManager>().ServerHash;
        string formScreenName = UserBlobManager.GetComponent <UserBlobManager>().UserSettingsData.UserLogin;

        WWWForm form = new WWWForm();

        form.AddField("action", "get_friend_request");
        form.AddField("myform_hash", hash);
        form.AddField("myform_ScreenName", formScreenName);
        WWW w = new WWW(URL, form);

        yield return(w);

        if (w.error != null)
        {
            // connection error
            print(w.error);

            //UIManager.GetComponent<UI_Manager>().SwitchStates("LoginState");
        }
        else
        {
            formText = w.text;
            print(formText);

            if (formText.Contains("HASH code is different from your app"))
            {
                print("Can't connect");
                w.Dispose();
            }
            else
            {
                if (formText.Contains("Found No friend requests"))
                {
                    print("Found No friend requests");
                }
                else
                {
                    string[] tempArray = formText.Split('#');
                    UserFriendData = new SaveFriendData();
                    for (int i = 1; i < tempArray.Length; i = i + 5) // start at 1 because the first entry is garbage.
                    {
                        if (tempArray[i] != "" && tempArray[i + 4] == "0")
                        {
                            FriendRequestCount++;
                        }
                    }
                    if (FriendRequestCount > 0)
                    {
                        if (PopUpActive == false)
                        {
                            PopUpOkDialog(("You have " + FriendRequestCount + " friend requests.\nClick Friend Requests to Accept or Deny"), this.gameObject.GetComponent <UI_Share>(), "FriendRequestsWaiting");
                        }
                    }
                }
            }
        }
        w.Dispose();
    }
コード例 #8
0
 // Use this for initialization
 void Start()
 {
     UserFriendData = UserBlobManager.GetComponent <UserBlobManager>().UserFriendData;
 }
コード例 #9
0
    IEnumerator GetFriendRequestList()
    {
        string formText       = "";
        string URL            = UserBlobManager.GetComponent <UserBlobManager>().ServerURL + "uw.php";
        string hash           = UserBlobManager.GetComponent <UserBlobManager>().ServerHash;
        string formScreenName = UserBlobManager.GetComponent <UserBlobManager>().UserSettingsData.UserLogin;

        WWWForm form = new WWWForm();

        form.AddField("action", "get_friend_request");
        form.AddField("myform_hash", hash);
        form.AddField("myform_ScreenName", formScreenName);
        WWW w = new WWW(URL, form);

        yield return(w);

        if (w.error != null)
        {
            // connection error
            print(w.error);

            //UIManager.GetComponent<UI_Manager>().SwitchStates("LoginState");
        }
        else
        {
            formText = w.text;
            print(formText);

            if (formText.Contains("HASH code is different from your app"))
            {
                print("Can't connect");
                w.Dispose();
            }
            else
            {
                if (formText.Contains("Found No friend requests"))
                {
                    print("Found No friend requests");
                }
                else
                {
                    string[] tempArray = formText.Split('#');
                    UserFriendData = new SaveFriendData();
                    for (int i = 1; i < tempArray.Length; i = i + 5) // start at 1 because the first entry is garbage.
                    {
                        if (tempArray[i] != "" && tempArray[i + 4] == "0")
                        {
                            FriendData tempFriend = new FriendData();
                            tempFriend.ScreenName      = tempArray[i];
                            tempFriend.Email           = tempArray[i + 2];
                            tempFriend.RequestAccepted = false;
                            if (tempArray[i + 3] == "1")
                            {
                                tempFriend.RequestAccepted = true;
                            }
                            tempFriend.RequestSent = false;
                            if (tempArray[i + 4] == "1")
                            {
                                tempFriend.RequestAccepted = true;
                            }

                            UserFriendData.Add(tempFriend);
                        }
                    }

                    PopulateScrollList();
                    if (UserBlobManager.GetComponent <UserBlobManager>().UserFriendData.Friend.Length > 6)
                    {
                        SetScrollRectPositionFromIntWithOffset(0, 2.5, 200, UserBlobManager.GetComponent <UserBlobManager>().UserFriendData.Friend.Length, FriendContentPanel);
                    }
                    else
                    {
                        FriendContentPanel.localPosition = new Vector3(0, 0, 0);
                    }
                }
            }
        }
        w.Dispose();
    }
コード例 #10
0
    // Use this for initialization
    void Awake()
    {
        VersionNumber = "1.0";

        ExerciseTypeList.Clear();
        ExerciseTypeList.Add("General");
        ExerciseTypeList.Add("Warm-Up");
        ExerciseTypeList.Add("Stretch");
        ExerciseTypeList.Add("Weights");
        ExerciseTypeList.Add("Cardio-Light");
        ExerciseTypeList.Add("Cardio-Moderate");
        ExerciseTypeList.Add("Cardio-Intense");
        ExerciseTypeList.Add("Yoga");
        ExerciseTypeList.Add("Body Weight");
        ExerciseTypeList.Add("Cross-Fit");
        ExerciseTypeList.Add("Fighting");

        WorkoutTypeList.Clear();
        WorkoutTypeList.Add("General");
        WorkoutTypeList.Add("Warm-Up");
        WorkoutTypeList.Add("Stretch");
        WorkoutTypeList.Add("Weights");
        WorkoutTypeList.Add("Cardio");
        WorkoutTypeList.Add("Yoga");
        WorkoutTypeList.Add("Fighting");
        WorkoutTypeList.Add("Cross-Fit");

        TrainingTypeList.Clear();
        TrainingTypeList.Add("General");
        TrainingTypeList.Add("Warm-Up");
        TrainingTypeList.Add("Stretch");
        TrainingTypeList.Add("Weights");
        TrainingTypeList.Add("Cardio");
        TrainingTypeList.Add("Yoga");
        TrainingTypeList.Add("Fighting");
        TrainingTypeList.Add("Cross-Fit");

        BodyPartList.Clear();
        BodyPartList.Add("Body");
        BodyPartList.Add("Arms");
        BodyPartList.Add("Abs");
        BodyPartList.Add("Back");
        BodyPartList.Add("Chest");
        BodyPartList.Add("Core");
        BodyPartList.Add("Legs");

        BodySide.Clear();
        BodySide.Add("None");
        BodySide.Add("Left");
        BodySide.Add("Right");

        NumberList.Clear();
        NumberList.Add(0);
        NumberList.Add(1);
        NumberList.Add(2);
        NumberList.Add(3);
        NumberList.Add(4);
        NumberList.Add(5);
        NumberList.Add(6);
        NumberList.Add(7);
        NumberList.Add(8);
        NumberList.Add(9);

        NumberListToFive.Clear();
        NumberListToFive.Add(0);
        NumberListToFive.Add(1);
        NumberListToFive.Add(2);
        NumberListToFive.Add(3);
        NumberListToFive.Add(4);
        NumberListToFive.Add(5);

        YesNoList.Clear();
        YesNoList.Add("Yes");
        YesNoList.Add("No");

        MonthList.Clear();
        MonthList.Add("January");
        MonthList.Add("February");
        MonthList.Add("March");
        MonthList.Add("April");
        MonthList.Add("May");
        MonthList.Add("June");
        MonthList.Add("July");
        MonthList.Add("August");
        MonthList.Add("September");
        MonthList.Add("October");
        MonthList.Add("November");
        MonthList.Add("December");

        FilterExerciseTypeList.Clear();
        FilterExerciseTypeList.Add("None");
        foreach (string item in ExerciseTypeList)
        {
            FilterExerciseTypeList.Add(item);
        }

        FilterBodyPartList.Clear();
        FilterBodyPartList.Add("None");
        foreach (string item in BodyPartList)
        {
            FilterBodyPartList.Add(item);
        }

        UIManager = GameObject.Find("UI_Manager_Prefab");

        UserDownloadTrainingData       = new SaveDownloadTrainingData();
        UserDownloadWorkoutData        = new SaveDownloadWorkoutData();
        UserDownloadExerciseData       = new SaveDownloadExerciseData();
        UserDownloadTrainingDataString = "";
        UserDownloadWorkoutDataString  = "";
        UserDownloadExerciseDataString = "";
        UserWorkoutData  = new SaveWorkoutData();
        UserExerciseData = new SaveExerciseData();
        UserFriendData   = new SaveFriendData();
        UserTrainingData = new SaveTrainingData();
        UserDayData      = new SaveDayData();

        _FileLocation = Application.persistentDataPath;
        _DownloadTrainingDataFileName = "DownloadTrainingData.xml"; // temporarily get these locally. change this to be downloaded from the server
        _DownloadWorkoutDataFileName  = "DownloadWorkoutData.xml";  // temporarily get these locally. change this to be downloaded from the server
        _DownloadExerciseDataFileName = "DownloadExerciseData.xml"; // temporarily get these locally. change this to be downloaded from the server
        _FileName             = "SaveData.xml";
        _TrainingDataFileName = "TrainingData.xml";
        _WorkoutDataFileName  = "WorkoutData.xml";
        _ExerciseDataFileName = "ExerciseData.xml";
        _DayDataFileName      = "DayData.xml";
        _SettingsDataFileName = "SettingsData.xml";
        _FriendDataFileName   = "FriendData.xml";

        myData         = new SaveData();
        mySettingsData = new SaveSettingsData();
    }