Exemplo n.º 1
0
 private void OnFriendsGotList(Messages.PluginMessage msg)
 {
     OnScreenLog.Add("Got Friends List!");
     Friends.Friend[] cachedFriendsList = Friends.GetCachedFriendsList();
     Friends.Friend[] array             = cachedFriendsList;
     for (int i = 0; i < array.Length; i++)
     {
         Friends.Friend friend  = array[i];
         string         @string = Encoding.get_Default().GetString(friend.get_npID());
         OnScreenLog.Add(string.Concat(new string[]
         {
             friend.get_npOnlineID(),
             ", np(",
             @string,
             "), os(",
             this.OnlineStatus(friend.npOnlineStatus),
             "), pt(",
             this.OnlinePresenceType(friend.npPresenceType),
             "), prsc(",
             friend.get_npPresenceTitle(),
             ", ",
             friend.get_npPresenceStatus(),
             "),",
             friend.get_npComment()
         }));
     }
 }
Exemplo n.º 2
0
 private void OnFriendsGotList(Messages.PluginMessage msg)
 {
     OnScreenLog.Add("Got Friends List!");
     Friends.Friend[] cachedFriendsList = Friends.GetCachedFriendsList();
     Friends.Friend[] array             = cachedFriendsList;
     for (int i = 0; i < array.Length; i++)
     {
         Friends.Friend friend  = array[i];
         string         @string = Encoding.Default.GetString(friend.npID);
         OnScreenLog.Add(friend.npOnlineID + ", np(" + @string + "), os(" + OnlineStatus(friend.npOnlineStatus) + "), pt(" + OnlinePresenceType(friend.npPresenceType) + "), prsc(" + friend.npPresenceTitle + ", " + friend.npPresenceStatus + ")," + friend.npComment);
     }
 }
Exemplo n.º 3
0
 public void MenuMessaging(MenuStack menuStack)
 {
     menuMessaging.Update();
     if (menuMessaging.AddItem("Show Messages & Invites", User.IsSignedInPSN && !Messaging.IsBusy()))
     {
         Messaging.ShowRecievedDataMessageDialog();
     }
     if (menuMessaging.AddItem("Send Session Invite", User.IsSignedInPSN && Matching.InSession))
     {
         string text      = "Join my session";
         int    npIDCount = 8;
         Matching.InviteToSession(text, npIDCount);
     }
     if (menuMessaging.AddItem("Send Game Invite", User.IsSignedInPSN && !Messaging.IsBusy()))
     {
         GameInviteData gameInviteData = new GameInviteData();
         gameInviteData.taunt = "I got an awesome score, can you do better?";
         gameInviteData.level = 1;
         gameInviteData.score = 123456789;
         byte[] data = gameInviteData.WriteToBuffer();
         Messaging.MsgRequest msgRequest = new Messaging.MsgRequest();
         msgRequest.body          = "Game invite";
         msgRequest.expireMinutes = 30;
         msgRequest.data          = data;
         msgRequest.npIDCount     = 8;
         string dataDescription = "Some data to test invite messages";
         string dataName        = "Test data";
         msgRequest.dataDescription = dataDescription;
         msgRequest.dataName        = dataName;
         msgRequest.iconPath        = Application.streamingAssetsPath + "/PSP2SessionImage.jpg";
         Messaging.SendMessage(msgRequest);
     }
     if (menuMessaging.AddItem("Send Data Message", User.IsSignedInPSN && !Messaging.IsBusy()))
     {
         GameData gameData = default(GameData);
         gameData.text  = "Here's some data";
         gameData.item1 = 2;
         gameData.item2 = 987654321;
         byte[] data2 = gameData.WriteToBuffer();
         Messaging.MsgRequest msgRequest2 = new Messaging.MsgRequest();
         msgRequest2.body          = "Data message";
         msgRequest2.expireMinutes = 0;
         msgRequest2.data          = data2;
         msgRequest2.npIDCount     = 8;
         string dataDescription2 = "Some data to test messages";
         string dataName2        = "Test data";
         msgRequest2.dataDescription = dataDescription2;
         msgRequest2.dataName        = dataName2;
         msgRequest2.iconPath        = Application.streamingAssetsPath + "/PSP2SessionImage.jpg";
         Messaging.SendMessage(msgRequest2);
     }
     if (menuMessaging.AddItem("Send In Game Data (Session)", Matching.InSession && !Messaging.IsBusy()))
     {
         Matching.Session             session = Matching.GetSession();
         Matching.SessionMemberInfo[] members = session.members;
         if (members == null)
         {
             return;
         }
         int num = -1;
         for (int i = 0; i < members.Length; i++)
         {
             if ((members[i].memberFlag & Matching.FlagMemberType.MEMBER_MYSELF) == 0)
             {
                 num = i;
                 break;
             }
         }
         if (num >= 0)
         {
             OnScreenLog.Add("Sending in game data message to " + members[num].npOnlineID);
             GameData gameData2 = default(GameData);
             gameData2.text  = "Here's some data";
             gameData2.item1 = 2;
             gameData2.item2 = 987654321;
             byte[] data3 = gameData2.WriteToBuffer();
             Messaging.SendInGameDataMessage(members[num].npID, data3);
         }
         else
         {
             OnScreenLog.Add("No session member to send to.");
         }
     }
     if (menuMessaging.AddItem("Send In Game Message (Friend)", User.IsSignedInPSN && !Messaging.IsBusy()))
     {
         Friends.Friend[] cachedFriendsList = Friends.GetCachedFriendsList();
         if (cachedFriendsList.Length > 0)
         {
             int num2 = 0;
             if (num2 >= 0)
             {
                 OnScreenLog.Add("Sending in game data message to " + cachedFriendsList[num2].npOnlineID);
                 GameData gameData3 = default(GameData);
                 gameData3.text  = "Here's some data";
                 gameData3.item1 = 2;
                 gameData3.item2 = 987654321;
                 byte[] data4 = gameData3.WriteToBuffer();
                 Messaging.SendInGameDataMessage(cachedFriendsList[num2].npID, data4);
             }
             else
             {
                 OnScreenLog.Add("No friends in this context.");
             }
         }
         else
         {
             OnScreenLog.Add("No friends cached.");
             OnScreenLog.Add("refresh the friends list then try again.");
         }
     }
     if (menuMessaging.AddBackIndex("Back"))
     {
         menuStack.PopMenu();
     }
 }
 public void MenuMessaging(MenuStack menuStack)
 {
     this.menuMessaging.Update();
     if (this.menuMessaging.AddItem("Show Messages & Invites", User.get_IsSignedInPSN() && !Messaging.IsBusy()))
     {
         Messaging.ShowRecievedDataMessageDialog();
     }
     if (this.menuMessaging.AddItem("Send Session Invite", User.get_IsSignedInPSN() && Matching.get_InSession()))
     {
         string text = "Join my session";
         int    num  = 8;
         Matching.InviteToSession(text, num);
     }
     if (this.menuMessaging.AddItem("Send Game Invite", User.get_IsSignedInPSN() && !Messaging.IsBusy()))
     {
         byte[] data = new SonyNpMessaging.GameInviteData
         {
             taunt = "I got an awesome score, can you do better?",
             level = 1,
             score = 123456789
         }.WriteToBuffer();
         Messaging.MsgRequest msgRequest = new Messaging.MsgRequest();
         msgRequest.set_body("Game invite");
         msgRequest.expireMinutes = 30;
         msgRequest.set_data(data);
         msgRequest.npIDCount = 8;
         string dataDescription = "Some data to test invite messages";
         string dataName        = "Test data";
         msgRequest.dataDescription = dataDescription;
         msgRequest.dataName        = dataName;
         msgRequest.iconPath        = Application.get_streamingAssetsPath() + "/PSP2SessionImage.jpg";
         Messaging.SendMessage(msgRequest);
     }
     if (this.menuMessaging.AddItem("Send Data Message", User.get_IsSignedInPSN() && !Messaging.IsBusy()))
     {
         SonyNpMessaging.GameData gameData = default(SonyNpMessaging.GameData);
         gameData.text  = "Here's some data";
         gameData.item1 = 2;
         gameData.item2 = 987654321;
         byte[] data2 = gameData.WriteToBuffer();
         Messaging.MsgRequest msgRequest2 = new Messaging.MsgRequest();
         msgRequest2.set_body("Data message");
         msgRequest2.expireMinutes = 0;
         msgRequest2.set_data(data2);
         msgRequest2.npIDCount = 8;
         string dataDescription2 = "Some data to test messages";
         string dataName2        = "Test data";
         msgRequest2.dataDescription = dataDescription2;
         msgRequest2.dataName        = dataName2;
         msgRequest2.iconPath        = Application.get_streamingAssetsPath() + "/PSP2SessionImage.jpg";
         Messaging.SendMessage(msgRequest2);
     }
     if (this.menuMessaging.AddItem("Send In Game Data (Session)", Matching.get_InSession() && !Messaging.IsBusy()))
     {
         Matching.SessionMemberInfo[] members = Matching.GetSession().members;
         if (members == null)
         {
             return;
         }
         int num2 = -1;
         for (int i = 0; i < members.Length; i++)
         {
             if ((members[i].memberFlag & 4) == null)
             {
                 num2 = i;
                 break;
             }
         }
         if (num2 >= 0)
         {
             OnScreenLog.Add("Sending in game data message to " + members[num2].get_npOnlineID());
             SonyNpMessaging.GameData gameData2 = default(SonyNpMessaging.GameData);
             gameData2.text  = "Here's some data";
             gameData2.item1 = 2;
             gameData2.item2 = 987654321;
             byte[] array = gameData2.WriteToBuffer();
             Messaging.SendInGameDataMessage(members[num2].get_npID(), array);
         }
         else
         {
             OnScreenLog.Add("No session member to send to.");
         }
     }
     if (this.menuMessaging.AddItem("Send In Game Message (Friend)", User.get_IsSignedInPSN() && !Messaging.IsBusy()))
     {
         Friends.Friend[] cachedFriendsList = Friends.GetCachedFriendsList();
         if (cachedFriendsList.Length > 0)
         {
             int num3 = 0;
             if (num3 >= 0)
             {
                 OnScreenLog.Add("Sending in game data message to " + cachedFriendsList[num3].get_npOnlineID());
                 SonyNpMessaging.GameData gameData3 = default(SonyNpMessaging.GameData);
                 gameData3.text  = "Here's some data";
                 gameData3.item1 = 2;
                 gameData3.item2 = 987654321;
                 byte[] array2 = gameData3.WriteToBuffer();
                 Messaging.SendInGameDataMessage(cachedFriendsList[num3].get_npID(), array2);
             }
             else
             {
                 OnScreenLog.Add("No friends in this context.");
             }
         }
         else
         {
             OnScreenLog.Add("No friends cached.");
             OnScreenLog.Add("refresh the friends list then try again.");
         }
     }
     if (this.menuMessaging.AddBackIndex("Back", true))
     {
         menuStack.PopMenu();
     }
 }