public void SocialGraph_Can_Serialize()
        {
            var graph         = new SocialGraph();
            var stringBuilder = new StringBuilder();

            var writer        = XmlWriter.Create(stringBuilder);
            var xmlSerializer = new XmlSerializer(typeof(SocialGraph));

            xmlSerializer.Serialize(writer, graph);
        }
Example #2
0
 // Start is called before the first frame update
 void Awake()
 {
     if (_instance)
     {
         Debug.LogError("Only one instance of Social Manager can exist.");
     }
     else
     {
         Graph       = new SocialGraph();
         _eventQueue = new Queue <BaseSocialEvent>();
     }
 }
Example #3
0
    public static void ComputeSocialGraph(Profile u, System.Action <Profile, SocialGraph> callback)
    {
        DatabaseReference _ref = FirebaseDatabase.DefaultInstance.RootReference.Child("Profiles");

        _ref.GetValueAsync().ContinueWith(task =>
        {
            var res = task.Result;

            Debug.Log(res);
            Dictionary <string, object> dict = res.Value as Dictionary <string, object>;

            List <string> nodes            = new List <string>();
            List <Tuple <int, int> > edges = new List <Tuple <int, int> >();

            foreach (var entry in dict)
            {
                nodes.Add(entry.Key);
            }

            foreach (var entry in dict)
            {
                Dictionary <string, object> profile = entry.Value as Dictionary <string, object>;

                if (!profile.ContainsKey("friends"))
                {
                    continue;
                }

                Dictionary <string, object> friends = profile["friends"] as Dictionary <string, object>;

                int src = nodes.IndexOf(entry.Key);

                foreach (var _entry in friends)
                {
                    int dest = nodes.IndexOf(_entry.Key);

                    edges.Add(new Tuple <int, int>(src, dest));
                }
            }

            SocialGraph g = new SocialGraph
            {
                nodes = nodes,
                edges = edges
            };

            Debug.Log("Social Graph created!");
            callback(u, g);
        });
    }
Example #4
0
 public override void TestInitialize()
 {
     base.TestInitialize();
     MockXboxLiveData.Load(Environment.CurrentDirectory + "\\Social\\SocialGraphUT.json");
     this.graph = new SocialGraph(user, SocialManagerExtraDetailLevel.PreferredColor);
 }
 public override void TestInitialize()
 {
     base.TestInitialize();
     this.graph = new SocialGraph(user, SocialManagerExtraDetailLevel.PreferredColor);
 }