예제 #1
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void Create()
    {
        creating = true;

        string groupName      = groupManager.activeGroup.groupName;
        string projectRefName = "(" + groupName + ") " + projectName.text;

        DataRef.Groups(groupName).GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;
            SetReference(groupName, "Project" + (snapshot.Child("Projects").ChildrenCount + 1).ToString(), projectRefName);
        });

        DataRef.Projects(projectRefName).Child("ProjectName").SetValueAsync(projectName.text).ContinueWith(async(task) => { await new WaitForUpdate(); });
        DataRef.Projects(projectRefName).Child("ProjectDescription").SetValueAsync(projectDescription.text).ContinueWith(async(task) => { await new WaitForUpdate(); });
        DataRef.Projects(projectRefName).Child("FundingGoal").SetValueAsync((int.Parse(fund) * 100).ToString()).ContinueWith(async(task) => { await new WaitForUpdate(); });
        DataRef.Projects(projectRefName).Child("FundingAmount").SetValueAsync("0").ContinueWith(async(task) => { await new WaitForUpdate(); });
        DataRef.Projects(projectRefName).Child("Group").SetValueAsync(groupName).ContinueWith(async(task) => { await new WaitForUpdate(); });
        foreach (string tag in categoryTags)
        {
            DataRef.Projects(projectRefName).Child("Tags").Child("Categories").Child(tag).SetValueAsync(tag).ContinueWith(async(task) => { await new WaitForUpdate(); });
            DataRef.Filters("Category").Child(tag).Child(projectRefName).SetValueAsync(projectRefName).ContinueWith(async(task) => { await new WaitForUpdate(); });
        }
        DataRef.Filters("Location").Child(locationText.text).Child(projectRefName).SetValueAsync(projectRefName).ContinueWith(async(task) => { await new WaitForUpdate(); });
        DataRef.Projects(projectRefName).Child("Tags").Child("Location").SetValueAsync(locationText.text).ContinueWith(async(task) => {
            await new WaitForUpdate();
            ResetFields();
            canvasScript.ToggleDoerSub(false);
            creating = false;
            groupManager.activeGroup.Populate();
        });

        activityManager.SetAlertNewProject(projectRefName, "Group_Default");
        //activityManager.Resubscribe ();
    }
예제 #2
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void PopulateList(string gName)
    {
        ClearList();

        DataRef.Groups(gName).GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            for (int i = 1; i <= snapshot.Child("Projects").ChildrenCount; i++)
            {
                InstantiateProject(/*"(" + snapshot.Child ("GroupName").Value.ToString () + ") " + */ snapshot.Child("Projects").Child("Project" + i.ToString()).Value.ToString());
            }
        });
    }
예제 #3
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void CheckForName()
    {
        if (groupName.text.Length > 5)
        {
            DataRef.Groups(groupName.text).GetValueAsync().ContinueWith(async(task) => {
                await new WaitForUpdate();
                DataSnapshot snapshot = task.Result;
                if (snapshot.Exists)
                {
                    taken = true;
                }
                else
                {
                    taken = false;
                }
            });
        }
    }
예제 #4
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void InstantiateGroup(string target)
    {
        DataRef.Groups(target).GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            string name        = snapshot.Child("GroupName").Value.ToString();
            string description = snapshot.Child("GroupDescription").Value.ToString();
            string contact     = snapshot.Child("Contact").Value.ToString();
            //string access = snapshot.Child ("AccessType").Value.ToString ();

            GameObject group = Instantiate(groupPrefab, Vector3.zero, Quaternion.identity) as GameObject;
            group.transform.SetParent(groupScrollView);
            group.transform.localScale = new Vector3(1, 1, 1);
            SortGroupScrollView();
            group.GetComponent <GroupInformation> ().SetInformation(name, description, contact, "Administrator");
        });
    }
예제 #5
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void Create()
    {
        creating = true;

        string uid = auth.CurrentUser.UserId.ToString();

        DataRef.CurrentUser().GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;
            SetReference("Group" + (snapshot.Child("Groups").ChildrenCount + 1).ToString(), groupName.text);
            snap = snapshot;
        });

        DataRef.Groups(groupName.text).Child("GroupName").SetValueAsync(groupName.text).ContinueWith(async(task) => { await new WaitForUpdate(); });
        DataRef.Groups(groupName.text).Child("GroupDescription").SetValueAsync(groupDescription.text).ContinueWith(async(task) => { await new WaitForUpdate(); });
        DataRef.Groups(groupName.text).Child("Contact").SetValueAsync(contact.text).ContinueWith(async(task) => { await new WaitForUpdate(); });
        DataRef.Groups(groupName.text).Child("Administrator").SetValueAsync(uid).ContinueWith(async(task) => {
            await new WaitForUpdate();
            ResetFields();
            dataGetSet.GetGroupInfo(snap);
            canvas.ToggleDoerSub(false);
            creating = false;
        });
    }
예제 #6
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void SetReference(string group, string refTitle, string refValue)
    {
        DataRef.Groups(group).Child("Projects").Child(refTitle).SetValueAsync(refValue).ContinueWith(async(task) => { await new WaitForUpdate(); });
    }