Exemple #1
0
    public XPlugin() : base()
    {
        // e.g. check for API support
        if (Utilities.Versions.XPLMVersion < 303)
        {
            throw new NotSupportedException("TCAS override not supported.");
        }

        // Example: finds datarefs
        _overrideTcas = DataRef.Find("sim/operation/override/override_TCAS") !;
        DataRef
            bearing  = DataRef.Find("sim/cockpit2/tcas/indicators/relative_bearing_degs") !,
            distance = DataRef.Find("sim/cockpit2/tcas/indicators/relative_distance_mtrs") !,
            altitude = DataRef.Find("sim/cockpit2/tcas/indicators/relative_altitude_mtrs") !;

        // Example: registers my flight loop
        _myLoop = new FlightLoop(FlightLoopPhase.AfterFlightModel, (elapsedSinceLastCall, elapsedTimeSinceLastFlightLoop, counter) =>
        {
            // TODO: set number of planes
            var count           = 2;
            Span <float> values = stackalloc float[count];
            // TODO: set bearings
            bearing.AsFloatVector(0).Write(values);
            // TODO: set distances
            distance.AsFloatVector(0).Write(values);
            // TODO: set altitudes
            altitude.AsFloatVector(0).Write(values);
            // Schedules for one second later
            return(1);
        });
    }
Exemple #2
0
        public void Process(string data)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return;
            }

            Match match = Regex.Match(data, Evaluator);

            string rawType  = match.Groups[1].Value;
            string name     = match.Groups[2].Value;
            string rawValue = match.Groups[3].Value;

            Type    type    = DataRef.ParseType(rawType);
            object  value   = DataRef.ParseValue(rawValue, type);
            DataRef dataRef = DataRefRepository.Get(name, type);

            dataRef.SetValue(value);
#if DEBUG
            var oldColor = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("{0}: {1}", dataRef.Name, value);
            Console.ForegroundColor = oldColor;
#endif
        }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void PopulateReCheck()
    {
        if (commentsContent.childCount > 0)
        {
            foreach (Transform child in commentsContent)
            {
                Destroy(child.gameObject);
            }
        }

        DataRef.Circles(circlesManager.activeCircleRef).Child("Comments").GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            foreach (DataSnapshot comment in snapshot.Children)
            {
                string ts      = comment.Child("Timestamp").Value.ToString();
                string userRef = comment.Child("User").Value.ToString();
                string d       = comment.Child("Date").Value.ToString();
                string c       = comment.Child("Comment").Value.ToString();
                InstantiateComment(ts, userRef, d, c);
            }

            OrganiseList();

            StartCoroutine(CheckForNewComments(0.1f));
        });
    }
        public void Process(string data)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return;
            }

            Match match = Regex.Match(data, Evaluator);

            string rawType  = match.Groups[1].Value;
            string name     = match.Groups[2].Value;
            string rawValue = match.Groups[3].Value;

            Type    type    = DataRef.ParseType(rawType);
            object  value   = DataRef.ParseValue(rawValue, type);
            DataRef dataRef = DataRefRepository.Get(name, type);

            //if (dataRef == null)
            //{

            //    dataRef = DataRefRepository.Get(name, typeof(string));
            //    var dfdsf = "sdfdsf";
            //}



            dataRef.SetValue(value);
        }
Exemple #5
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void GetBucketTeamProject()
    {
        DataRef.Projects("(Bucket NZ) Bucket Team").GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            string pName             = snapshot.Child("ProjectName").Value.ToString();
            string gName             = snapshot.Child("Group").Value.ToString();
            string pRef              = "(" + gName + ") " + pName;
            string description       = snapshot.Child("ProjectDescription").Value.ToString();
            string fundingGoal       = snapshot.Child("FundingGoal").Value.ToString();
            string fundingAmount     = snapshot.Child("FundingAmount").Value.ToString();
            string location          = snapshot.Child("Tags").Child("Location").Value.ToString();
            string pictureID         = snapshot.Child("PictureID").Value.ToString();
            List <string> categories = new List <string> ();
            foreach (DataSnapshot snap in snapshot.Child("Tags").Child("Categories").Children)
            {
                categories.Add(snap.Value.ToString());
            }
            List <string> goalTitles = new List <string> ();
            foreach (DataSnapshot s2 in snapshot.Child("Measurements").Children)
            {
                goalTitles.Add(s2.Child("Title").Value.ToString());
            }
            List <string> goalValues = new List <string> ();
            foreach (DataSnapshot s3 in snapshot.Child("Measurements").Children)
            {
                goalValues.Add(s3.Child("Value").Value.ToString());
            }

            bucketTeam.SetInformation(pRef, gName, pName, description, fundingGoal, fundingAmount, location, categories, goalTitles, goalValues, pictureID);
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void GetUserInfo()
    {
        print(DateTime.Now.ToString("MMMM") + " " + DateTime.Now.Day.ToString() + " at " + DateTime.Now.ToString("hh") + ":" + DateTime.Now.Minute.ToString() + " " + DateTime.Now.ToString("tt"));

        //debug.message = "Process Starting (Get User Info)";
        debug.message = FirebaseDatabase.DefaultInstance.RootReference.ToString();
        DataRef.CurrentUser().GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsCanceled || task.IsFaulted)
            {
                return;
            }
            DataSnapshot snapshot = task.Result;
            username.text         = snapshot.Child("Username").Value.ToString();
            currentUsername       = snapshot.Child("Username").Value.ToString();
            DateTime tempDate     = Convert.ToDateTime(snapshot.Child("CreatedDate").Value.ToString());
            string month          = tempDate.ToString("MMMM");
            string year           = tempDate.Year.ToString();
            createdDate.text      = "Member Since " + month + " " + year;
            userPermissions       = snapshot.Child("Permissions").Value.ToString();
            menuNav.SetComingSoon(userPermissions);
            topUp.target  = (int.Parse(snapshot.Child("Balance").Value.ToString())) / 100;
            topUp.balance = (int.Parse(snapshot.Child("Balance").Value.ToString())) / 100;
            pictureManager.DisplayPicture(snapshot.Child("PictureID").Value.ToString());
            pictureManager.RevealProfileInfo();

            transform.GetComponent <UserAuthentication> ().loading = false;

            GetGroupInfo(snapshot);

            activityManager.StartActivityProcess();
            circlesManager.StartCircleProcess();
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void GetCircle(string circleRef, string projectRef, int donation, string uid)
    {
        DataRef.Circles(circleRef).GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                print(task.Exception);
                return;
            }
            DataSnapshot snapshot = task.Result;

            int totalDonated = int.Parse(snapshot.Child("TotalDonated").Value.ToString());
            int newTotal     = totalDonated + donation;
            SetCircleTotal(circleRef, newTotal.ToString());

            SetDonationReferences(circleRef, projectRef, uid);

            if (snapshot.Child("Projects").Child(projectRef).Child("DonationTotal").Exists)
            {
                int donationTotal = int.Parse(snapshot.Child("Projects").Child(projectRef).Child("DonationTotal").Value.ToString());
                int newDonation   = donationTotal + donation;
                SetProjectTotal(circleRef, projectRef, newDonation.ToString());
            }
            else
            {
                SetProjectTotal(circleRef, projectRef, donation.ToString());
            }
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void PopulateCircleList(int index)
    {
        StartCoroutine(FadeLoad(1.0f, true, 1.0f));
        loading = true;

        if (circlesContent.childCount > 0)
        {
            foreach (Transform child in circlesContent)
            {
                Destroy(child.gameObject);
            }
        }

        DataRef.CurrentUser().Child("Circles").GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            foreach (DataSnapshot circle in snapshot.Children)
            {
                string circleRef = circle.Value.ToString();
                InstantiateCircle(circleRef);
            }

            OrganiseCirclesList();

            foreach (Transform child in circlesContent)
            {
                child.GetComponent <Button> ().interactable = true;
            }
            circlesContent.GetChild(index).GetComponent <Button> ().interactable = false;

            GetCircleInformation(circlesContent.GetChild(index).gameObject.name);
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void PopulateMembers()
    {
        if (membersContent.childCount > 0)
        {
            foreach (Transform child in membersContent)
            {
                Destroy(child.gameObject);
            }
        }

        DataRef.Circles(activeCircleRef).Child("Members").GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            foreach (DataSnapshot member in snapshot.Children)
            {
                string userRef = member.Value.ToString();
                InstantiateMember(userRef);
            }

            membersCount.text = membersContent.childCount.ToString() + " Members";
            GetMemberBalances();
            OrganiseMembersList();
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void StartMemberCheck()
    {
        if (breakCycle == true)
        {
            breakCycle = false;
            PopulateMemberReCheck();
        }
        else
        {
            //debug.UpdateReport ("Member Check", "Member Check: Starting search for members...", debug.orange);
            DataRef.Circles(activeCircleRef).Child("Members").GetValueAsync().ContinueWith(async(task) => {
                if (task.IsFaulted || task.IsCanceled)
                {
                    await new WaitForUpdate();
                    //debug.UpdateReport ("Member Check", "Member Check: Failed to access members.", debug.red);
                }
                await new WaitForUpdate();
                DataSnapshot snapshot = task.Result;

                //debug.UpdateReport ("Member Check", "Member Check: Found members...", debug.orange);

                if (int.Parse(snapshot.ChildrenCount.ToString()) != membersContent.childCount)
                {
                    PopulateMemberReCheck();
                }
                else
                {
                    StartCoroutine(CheckForMemberChanges(0.1f));
                }
            });
        }
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void PopulateMemberReCheck()
    {
        if (membersContent.childCount > 0)
        {
            foreach (Transform child in membersContent)
            {
                Destroy(child.gameObject);
            }
        }

        DataRef.Circles(activeCircleRef).Child("Members").GetValueAsync().ContinueWith(async(task) => {
            if (task.IsFaulted || task.IsCanceled)
            {
                await new WaitForUpdate();
                //debug.UpdateReport ("Member Check", "Member Check: Failed to access members.", debug.red);
            }
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            foreach (DataSnapshot member in snapshot.Children)
            {
                string userRef = member.Value.ToString();
                InstantiateMember(userRef);
            }

            membersCount.text = membersContent.childCount.ToString() + " Members";
            OrganiseMembersList();

            //debug.UpdateReport ("Member Check", "Member Check: Populated members list", debug.green);

            StartCoroutine(FadeLoad(0.0f, false, 1.0f));

            StartCoroutine(CheckForMemberChanges(0.1f));
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void RemoveUserFromCircle(string circleRef, string userRef)
    {
        DataRef.User(userRef).Child("Circles").Child(circleRef).RemoveValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                print(task.Exception);
                return;
            }
        });

        DataRef.Circles(circleRef).Child("Members").Child(userRef).RemoveValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                print(task.Exception);
                return;
            }
        });

        DataRef.Circles(circleRef).Child("TotalMembers").GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                print(task.Exception);
                return;
            }
            DataSnapshot snapshot = task.Result;

            int currentMembers = int.Parse(snapshot.Value.ToString());
            int newMembers     = currentMembers - 1;

            SetTotalMembers(circleRef, newMembers);
        });
    }
Exemple #13
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void PopulateReCheck()
    {
        if (projectsContent.childCount > 0)
        {
            foreach (Transform child in projectsContent)
            {
                Destroy(child.gameObject);
            }
        }

        DataRef.Circles(circlesManager.activeCircleRef).GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            foreach (DataSnapshot project in snapshot.Child("Projects").Children)
            {
                int donationsMoney   = int.Parse(project.Child("DonationTotal").Value.ToString());
                int donationsMembers = int.Parse(project.Child("Members").ChildrenCount.ToString());
                string projectRef    = project.Child("Reference").Value.ToString();
                InstantiateProject(donationsMembers, donationsMoney, snapshot, projectRef);
            }

            OrganiseList();

            StartCoroutine(CheckForNewComments(0.1f));
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    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 ();
    }
Exemple #15
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void GetLink(string type, string reference)
    {
        messageType = type;
        referenceID = reference;

        if (type == "Project")
        {
            DataRef.Projects(reference).GetValueAsync().ContinueWith(async(task) => {
                await new WaitForUpdate();
                DataSnapshot snapshot = task.Result;

                referenceName = snapshot.Child("ProjectName").Value.ToString();

                SetMessageInfo();
            });
        }
        else if (type == "Circle")
        {
            DataRef.Circles(reference).GetValueAsync().ContinueWith(async(task) => {
                await new WaitForUpdate();
                DataSnapshot snapshot = task.Result;

                referenceName = snapshot.Child("Name").Value.ToString();

                SetMessageInfo();
            });
        }
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void HandleValueChanged(object sender, ValueChangedEventArgs args)
    {
        if (args.DatabaseError != null)
        {
            confirmation.transform.GetChild(1).GetChild(1).GetComponent <Text> ().text = "An error has been encountered (#1).";
            confirmation.transform.GetChild(2).gameObject.SetActive(false);
            return;
        }
        // Do stuff

        string status = args.Snapshot.Child("status").Value.ToString();

        if (status == "inProgress" || status == null)
        {
            return;
        }
        else
        {
            DataRef.CurrentUser().Child("stripe").Child("charges").Child(activePushID).ValueChanged -= HandleValueChanged;
        }

        if (status == "error")
        {
            confirmation.transform.GetChild(1).GetChild(1).GetComponent <Text> ().text = "An error has been encountered (#2).";
            confirmation.transform.GetChild(2).gameObject.SetActive(false);
        }
        else if (status == "succeeded")
        {
            confirmation.transform.GetChild(2).gameObject.SetActive(false);
            ConfirmationBox(false);
            t      = 0;
            start  = balance;
            target = balance + topup;
        }
    }
 public DataRefAllocator(DataRef field)
 {
     _field          = field;
     _originalLength = field.Length;
     InitializeComponent();
     DwmDropShadow.DropShadowToWindow(this);
     InitInformation();
 }
Exemple #18
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void AddToCircleTotal(int value)
    {
        DataRef.Circles("Bucket Circle New Zealand").Child("TotalMembers").SetValueAsync(value.ToString()).ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsCanceled || task.IsFaulted)
            {
                return;
            }
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void SetTotalMembers(string circleRef, int value)
    {
        DataRef.Circles(circleRef).Child("TotalMembers").SetValueAsync(value.ToString()).ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                print(task.Exception);
                return;
            }
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void SetProjectTotal(string circleRef, string projectRef, string value)
    {
        DataRef.Circles(circleRef).Child("Projects").Child(projectRef).Child("DonationTotal").SetValueAsync(value).ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                print(task.Exception);
                return;
            }
        });
    }
Exemple #21
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void GetUser(string id)
    {
        userID = id;

        DataRef.User(id).Child("Username").GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            userName = snapshot.Child("Username").Value.ToString();
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void SetOnboardStatus()
    {
        DataRef.CurrentUser().Child("Onboarded").Child("Bucket Circle New Zealand").SetValueAsync("true").ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsCanceled || task.IsFaulted)
            {
                return;
            }
            this.gameObject.SetActive(false);
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void RemoveReferences(string circleRef, string projectRef, string userRef)
    {
        DataRef.Circles(circleRef).Child("Projects").Child(projectRef).Child("Members").Child(userRef).RemoveValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                print(task.Exception);
                return;
            }
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void SetData(string circleRef, string child, string value)
    {
        DataRef.Circles(circleRef).Child(child).SetValueAsync(value).ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                print(task.Exception);
                return;
            }
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void RemoveFromTotalSet(string child, int value)
    {
        DataRef.General().Child(child).SetValueAsync(value.ToString()).ContinueWith(async(task) => {
            if (task.IsFaulted || task.IsCanceled)
            {
                await new WaitForUpdate();
                print(task.Exception);
                return;
            }
            await new WaitForUpdate();
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    // 0 = top message
    // 1 = type message
    // 2 = timestamp
    // 3 = picture
    // 4 = project link

    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void AssignDonation(DataSnapshot snap)
    {
        DataRef.User(snap.Child("UserID").Value.ToString()).GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                return;
            }
            DataSnapshot snapshot = task.Result;

            Sprite image = Resources.Load <Sprite> ("2D/Animals/" + snapshot.Child("PictureID").Value.ToString());
            this.transform.GetChild(3).GetChild(0).GetChild(0).GetComponent <Image> ().sprite = image;
        });

        DataRef.Projects(snap.Child("Reference").Value.ToString()).GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsFaulted || task.IsCanceled)
            {
                return;
            }
            DataSnapshot snapshot = task.Result;

            this.transform.GetChild(0).GetComponent <Text> ().text = snap.Child("Donor").Value.ToString();
            this.transform.GetChild(1).GetComponent <Text> ().text = "Donated $" + snap.Child("Amount").Value.ToString() + " to " + snapshot.Child("ProjectName").Value.ToString();
            this.transform.GetChild(2).GetComponent <Text> ().text = snap.Child("Date").Value.ToString();

            string pName             = snapshot.Child("ProjectName").Value.ToString();
            string gName             = snapshot.Child("Group").Value.ToString();
            string pRef              = "(" + gName + ") " + pName;
            string description       = snapshot.Child("ProjectDescription").Value.ToString();
            string fundingGoal       = snapshot.Child("FundingGoal").Value.ToString();
            string fundingAmount     = snapshot.Child("FundingAmount").Value.ToString();
            string location          = snapshot.Child("Tags").Child("Location").Value.ToString();
            string pictureID         = snapshot.Child("PictureID").Value.ToString();
            List <string> categories = new List <string> ();
            foreach (DataSnapshot s1 in snapshot.Child("Tags").Child("Categories").Children)
            {
                categories.Add(s1.Value.ToString());
            }
            List <string> goalTitles = new List <string> ();
            foreach (DataSnapshot s2 in snapshot.Child("Measurements").Children)
            {
                goalTitles.Add(s2.Child("Title").Value.ToString());
            }
            List <string> goalValues = new List <string> ();
            foreach (DataSnapshot s3 in snapshot.Child("Measurements").Children)
            {
                goalValues.Add(s3.Child("Value").Value.ToString());
            }

            this.transform.GetChild(4).GetComponent <ProjectInformation> ().SetInformation(pRef, gName, pName, description, fundingGoal, fundingAmount, location, categories, goalTitles, goalValues, pictureID);
        });
    }
Exemple #27
0
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void SetNewPictureID()
    {
        DataRef.CurrentUser().Child("PictureID").SetValueAsync(selectedPicture.gameObject.name).ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsCanceled || task.IsFaulted)
            {
                return;
            }
            Sprite image          = Resources.Load <Sprite> ("2D/Animals/" + selectedPicture.gameObject.name);
            profilePicture.sprite = image;
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    private void AddToUserTotal(int value)
    {
        DataRef.CurrentUser().Child("DonationTotal").SetValueAsync(value.ToString()).ContinueWith(async(task) => {
            if (task.IsFaulted || task.IsCanceled)
            {
                await new WaitForUpdate();
                print(task.Exception);
                return;
            }
            await new WaitForUpdate();
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void SetInfoSingle(string target, string value)
    {
        debug.message = "Process Starting (Set Info Single)";
        DataRef.CurrentUser().Child(target).SetValueAsync(value).ContinueWith(async(task) => {
            await new WaitForUpdate();
            if (task.IsCanceled || task.IsFaulted)
            {
                debug.message = "Process Error (Set Info Single)";
                return;
            }
            debug.message = "Process Completed (Set Info Single)";
        });
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------//

    public void AssignInfo(string userReference, string date, string comment)
    {
        DataRef.User(userReference).GetValueAsync().ContinueWith(async(task) => {
            await new WaitForUpdate();
            DataSnapshot snapshot = task.Result;

            usernameField.text    = snapshot.Child("Username").Value.ToString();
            Sprite image          = Resources.Load <Sprite> ("2D/Animals/" + snapshot.Child("PictureID").Value.ToString());
            pictureIDField.sprite = image;
            dateField.text        = date;
            commentField.text     = comment;
        });
    }
Exemple #31
0
 // =============================================================================
 // xtor
 // =============================================================================
 public CacheData(ZIMapApplication application)
     : base(application.Parent)
 {
     this.application = application;
     connection = application.Connection;
     server     = application.Server;
     factory    = connection.CommandLayer;
     progress   = connection.ProgressReporting;
     // At least deliver Info level messages ...
     MonitorLevel = application.MonitorLevel;
     if(MonitorLevel > ZIMapConnection.Monitor.Info)
         MonitorLevel = ZIMapConnection.Monitor.Info;
     Data = data = new DataRefImp(this);
 }
Exemple #32
0
 public override MetaField CloneValue()
 {
     var result = new DataRef(Name, Offset, Format, FieldAddress, DataAddress, Value, Length, PluginLine);
     return result;
 }