private void OnGotProductList(Messages.PluginMessage msg) { OnScreenLog.Add("Got Product List"); Commerce.CommerceProductInfo[] productList = Commerce.GetProductList(); Commerce.CommerceProductInfo[] array = productList; for (int i = 0; i < array.Length; i++) { Commerce.CommerceProductInfo commerceProductInfo = array[i]; OnScreenLog.Add("Product: " + commerceProductInfo.get_productName() + " - " + commerceProductInfo.get_price()); } }
private void OnWordFilterSanitized(Messages.PluginMessage msg) { WordFilter.FilteredComment result = WordFilter.GetResult(); OnScreenLog.Add(string.Concat(new object[] { "Sanitized: changed=", result.wasChanged, ", comment='", result.get_comment(), "'" })); }
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); } }
private void OnMessagingGotInGameDataMessage(Messages.PluginMessage msg) { GameData gameData = default(GameData); OnScreenLog.Add("Got in-game data message..."); while (Messaging.InGameDataMessagesRecieved()) { Messaging.InGameDataMessage inGameDataMessage = Messaging.GetInGameDataMessage(); gameData.ReadFromBuffer(inGameDataMessage.data); OnScreenLog.Add(" ID: " + inGameDataMessage.messageID + " text: " + gameData.text + " item1: " + gameData.item1 + " item2: " + gameData.item2); } }
private void OnGotRemoteUserProfile(Messages.PluginMessage msg) { User.RemoteUserProfile cachedRemoteUserProfile = User.GetCachedRemoteUserProfile(); OnScreenLog.Add("Got Remote User Profile"); OnScreenLog.Add(" OnlineID: " + cachedRemoteUserProfile.get_onlineID()); string @string = Encoding.get_Default().GetString(cachedRemoteUserProfile.get_npID()); OnScreenLog.Add(" NpID: " + @string); OnScreenLog.Add(" Avatar URL: " + cachedRemoteUserProfile.get_avatarURL()); OnScreenLog.Add(" Country Code: " + cachedRemoteUserProfile.get_countryCode()); OnScreenLog.Add(" Language: " + cachedRemoteUserProfile.language); SonyNpMain.SetAvatarURL(cachedRemoteUserProfile.get_avatarURL(), 1); }
private void OnSetTusData(Messages.PluginMessage msg) { switch (this.m_TUSDataRequestType) { case SonyNpCloudTUS.TUSDataRequestType.SaveRawData: OnScreenLog.Add("Sent data to TUS"); break; case SonyNpCloudTUS.TUSDataRequestType.SavePlayerPrefs: OnScreenLog.Add("Sent PlayerPrefs to TUS"); break; } }
private void OnRankingGotOwnRank(Messages.PluginMessage msg) { Ranking.Rank ownRank = Ranking.GetOwnRank(); OnScreenLog.Add("Own rank..."); if (ownRank.rank > 0) { LogRank(ownRank); } else { OnScreenLog.Add("rank #: Not Ranked, " + ownRank.onlineId); } }
private void OnGotTssData(Messages.PluginMessage msg) { OnScreenLog.Add("Got TSS Data"); byte[] tssData = TusTss.GetTssData(); OnScreenLog.Add(" Data size: " + tssData.Length); string text = string.Empty; for (int i = 0; i < 16 && i < tssData.Length; i++) { text = text + tssData[i].ToString() + ", "; } OnScreenLog.Add(" Data: " + text); }
private void OnMatchingUpdatedSession(Messages.PluginMessage msg) { Matching.GetSessionInformationPtr(); OnScreenLog.Add("Session info updated..."); Matching.Session session = Matching.GetSession(); DumpSessionInfo(session); if (!InitializeHostAndSelf(session)) { OnScreenLog.Add("ERROR: Expected members not found!"); } if (Matching.IsHost) { return; } Matching.SessionMemberInfo?sessionMemberInfo = connected; if (sessionMemberInfo.HasValue) { return; } Matching.SessionMemberInfo value = host.Value; if (value.addr == 0) { OnScreenLog.Add("Unable to retrieve host IP address"); ErrorHandler(Matching.LeaveSession()); return; } Matching.SessionMemberInfo value2 = host.Value; string text = IntIPToIPString(value2.addr); object[] obj = new object[6] { "Connecting to ", text, ":", serverPort, " using signalling port:", null }; Matching.SessionMemberInfo value3 = host.Value; obj[5] = value3.port; OnScreenLog.Add(string.Concat(obj)); NetworkConnectionError networkConnectionError = Network.Connect(text, serverPort); if (networkConnectionError != 0) { OnScreenLog.Add("Connection failed: " + networkConnectionError); return; } OnScreenLog.Add("Connected to host " + text + " : " + serverPort); connected = host; }
private void OnMatchingUpdatedSession(Messages.PluginMessage msg) { IntPtr sessionInformationPtr = Matching.GetSessionInformationPtr(); OnScreenLog.Add("Session info updated..."); Matching.Session session = Matching.GetSession(); this.DumpSessionInfo(session); if (!this.InitializeHostAndSelf(session)) { OnScreenLog.Add("ERROR: Expected members not found!"); } if (!Matching.get_IsHost()) { Matching.SessionMemberInfo?sessionMemberInfo = this.connected; if (!sessionMemberInfo.get_HasValue()) { if (this.host.get_Value().addr == 0) { OnScreenLog.Add("Unable to retrieve host IP address"); this.ErrorHandler(Matching.LeaveSession()); return; } string text = this.IntIPToIPString(this.host.get_Value().addr); OnScreenLog.Add(string.Concat(new object[] { "Connecting to ", text, ":", this.serverPort, " using signalling port:", this.host.get_Value().port })); NetworkConnectionError networkConnectionError = Network.Connect(text, this.serverPort); if (networkConnectionError != null) { OnScreenLog.Add("Connection failed: " + networkConnectionError); } else { OnScreenLog.Add(string.Concat(new object[] { "Connected to host ", text, " : ", this.serverPort })); this.connected = this.host; } } } }
void OnInitializedNP(Messages.PluginMessage msg) { npReady = true; /* For some reason np ready is called twice. I can't find a reason why * in the documentation. If this function is called the first time it * causes an error and is ignored. */ npDelay++; if (npDelay < 2) { return; } LoadFile(); }
private void OnCheckPlusResult(Messages.PluginMessage msg) { bool flag; int num; Requests.GetCheckPlusResult(msg, ref flag, ref num); OnScreenLog.Add(string.Concat(new object[] { "OnPlusCheckResult returned:", flag, " userId :0x", num.ToString("X") })); }
private void OnWordFilterError(Messages.PluginMessage msg) { ResultCode resultCode = default(ResultCode); WordFilter.GetLastError(ref resultCode); OnScreenLog.Add(string.Concat(new object[] { resultCode.get_className(), ": ", resultCode.lastError, ", sce error 0x", resultCode.lastErrorSCE.ToString("X8") })); }
private void __EventHandler_UpdateTrophyInfo__(Messages.PluginMessage msg) { Trophies.TrophyData[] cachedTrophyData = Trophies.GetCachedTrophyData(); List <Trophies.TrophyData> list = new List <Trophies.TrophyData>(cachedTrophyData); this._data = list.ConvertAll <TrophyManager.TrophyData>((Trophies.TrophyData item) => new TrophyManager.TrophyData(item)); Action <bool> callback_update = this._callback_update; this._callback_update = null; if (callback_update != null) { callback_update.Invoke(true); } }
private void OnGotIMEDialogResult(Messages.PluginMessage msg) { Ime.ImeDialogResult result = Ime.GetResult(); if (result.result == null) { string text = result.get_text(); if (Utils.ChkNGWard(text) || Utils.ChkNGWard(result.get_text())) { text = string.Empty; this._animFeather.Play(); } this._strEditName = text; this._uiNameInput.value = this._strEditName; } }
private void OnSignedIn(Messages.PluginMessage msg) { OnScreenLog.Add(msg.ToString()); ResultCode result = default(ResultCode); User.GetLastSignInError(out result); if (result.lastError == ErrorCode.NP_SIGNED_IN_FLIGHT_MODE) { OnScreenLog.Add("INFO: Signed in but flight mode is on"); } else if (result.lastError != 0) { OnScreenLog.Add("Error: " + result.className + ": " + result.lastError + ", sce error 0x" + result.lastErrorSCE.ToString("X8")); } }
private void OnGotIMEDialogResult(Messages.PluginMessage msg) { Ime.ImeDialogResult result = Ime.GetResult(); if (result.result == Ime.EnumImeDialogResult.RESULT_OK) { string text = result.text; if (Utils.ChkNGWard(text) || Utils.ChkNGWard(result.text)) { text = string.Empty; _animFeather.Play(); } _strEditName = text; _uiNameInput.value = _strEditName; } }
private void OnGotTssData(Messages.PluginMessage msg) { OnScreenLog.Add("Got TSS Data"); byte[] tssData = TusTss.GetTssData(); OnScreenLog.Add(" Data size: " + tssData.Length); string text = string.Empty; int num = 0; while (num < 16 && num < tssData.Length) { text = text + tssData[num].ToString() + ", "; num++; } OnScreenLog.Add(" Data: " + text); }
private void OnModifiedTusVariables(Messages.PluginMessage msg) { OnScreenLog.Add("Modified TUS Variables"); TusTss.TusRetrievedVariable[] tusVariables = TusTss.GetTusVariables(); for (int i = 0; i < tusVariables.Length; i++) { string @string = Encoding.get_Default().GetString(tusVariables[i].get_ownerNpID()); string string2 = Encoding.get_Default().GetString(tusVariables[i].get_lastChangeAuthorNpID()); DateTime dateTime = new DateTime(tusVariables[i].lastChangedDate, 1); OnScreenLog.Add(" HasData: " + tusVariables[i].hasData); OnScreenLog.Add(" Value: " + tusVariables[i].variable); OnScreenLog.Add(" OwnerNpID: " + @string); OnScreenLog.Add(" lastChangeNpID: " + string2); OnScreenLog.Add(" lastChangeTime: " + dateTime.ToLongDateString() + " - " + dateTime.ToLongTimeString()); } }
private void OnUserGotProfile(Messages.PluginMessage msg) { User.UserProfile cachedUserProfile = User.GetCachedUserProfile(); OnScreenLog.Add(msg.ToString()); OnScreenLog.Add(" OnlineID: " + cachedUserProfile.get_onlineID()); string @string = Encoding.get_Default().GetString(cachedUserProfile.get_npID()); OnScreenLog.Add(" NpID: " + @string); OnScreenLog.Add(" Avatar URL: " + cachedUserProfile.get_avatarURL()); OnScreenLog.Add(" Country Code: " + cachedUserProfile.get_countryCode()); OnScreenLog.Add(" Language: " + cachedUserProfile.language); OnScreenLog.Add(" Age: " + cachedUserProfile.age); OnScreenLog.Add(" Chat Restrict: " + cachedUserProfile.chatRestricted); OnScreenLog.Add(" Content Restrict: " + cachedUserProfile.contentRestricted); SonyNpMain.SetAvatarURL(cachedUserProfile.get_avatarURL(), 0); }
private void OnTrophyGotTrophyInfo(Messages.PluginMessage msg) { OnScreenLog.Add("Got Trophy List!"); Trophies.TrophyDetails[] cachedTrophyDetails = Trophies.GetCachedTrophyDetails(); Trophies.TrophyData[] cachedTrophyData = Trophies.GetCachedTrophyData(); OnScreenLog.Add("Trophies: " + cachedTrophyDetails.Length); for (int i = 0; i < cachedTrophyDetails.Length; i++) { if (cachedTrophyData[i].hasIcon && trophyIcon == null) { trophyIcon = cachedTrophyData[i].icon; OnScreenLog.Add("Found icon: " + trophyIcon.width + ", " + trophyIcon.height); } OnScreenLog.Add(" " + i + ": " + cachedTrophyDetails[i].name + ", " + cachedTrophyDetails[i].trophyId + ", " + cachedTrophyDetails[i].trophyGrade + ", " + cachedTrophyDetails[i].groupId + ", " + cachedTrophyDetails[i].hidden + ", " + cachedTrophyData[i].unlocked + ", " + cachedTrophyData[i].timestamp + ", " + cachedTrophyData[i].userId.ToString("X")); } }
private void OnTrophyGotGroupInfo(Messages.PluginMessage msg) { OnScreenLog.Add("Got Group List!"); Trophies.GroupDetails[] cachedGroupDetails = Trophies.GetCachedGroupDetails(); Trophies.GroupData[] cachedGroupData = Trophies.GetCachedGroupData(); OnScreenLog.Add("Groups: " + cachedGroupDetails.Length); for (int i = 0; i < cachedGroupDetails.Length; i++) { if (cachedGroupDetails[i].hasIcon && trophyGroupIcon == null) { trophyGroupIcon = cachedGroupDetails[i].icon; OnScreenLog.Add("Found icon: " + trophyGroupIcon.width + ", " + trophyGroupIcon.height); } OnScreenLog.Add(" " + i + ": " + cachedGroupDetails[i].groupId + ", " + cachedGroupDetails[i].title + ", " + cachedGroupDetails[i].description + ", " + cachedGroupDetails[i].numTrophies + ", " + cachedGroupDetails[i].numPlatinum + ", " + cachedGroupDetails[i].numGold + ", " + cachedGroupDetails[i].numSilver + ", " + cachedGroupDetails[i].numBronze); OnScreenLog.Add(" " + i + ": " + cachedGroupData[i].groupId + ", " + cachedGroupData[i].unlockedTrophies + ", " + cachedGroupData[i].unlockedPlatinum + ", " + cachedGroupData[i].unlockedGold + ", " + cachedGroupData[i].unlockedSilver + ", " + cachedGroupData[i].unlockedBronze + ", " + cachedGroupData[i].progressPercentage + cachedGroupData[i].userId.ToString("X")); } }
private void OnRankingGotRankList(Messages.PluginMessage msg) { Ranking.Rank[] rankList = Ranking.GetRankList(); OnScreenLog.Add("Ranks..."); OnScreenLog.Add("Showing " + rankList[0].serialRank + "-> " + (rankList[0].serialRank + rankList.Length - 1) + " out of " + Ranking.GetRanksCountOnServer()); for (int i = 0; i < rankList.Length; i++) { LogRank(rankList[i]); } LastRankDisplayed = rankList[0].serialRank + rankList.Length - 1; LastRankingMaxCount = Ranking.GetRanksCountOnServer(); Console.WriteLine("LastRankDisplayed:" + LastRankDisplayed + " LastRankingMaxCount:" + LastRankingMaxCount); if (LastRankDisplayed >= LastRankingMaxCount) { LastRankDisplayed = 0; } }
private void OnRegisteredNewBestScore(Messages.PluginMessage msg) { Ranking.Rank ownRank = Ranking.GetOwnRank(); OnScreenLog.Add("New best score..."); OnScreenLog.Add(string.Concat(new object[] { "rank #", ownRank.rank, ", provisional rank #", ownRank.provisional, ", online id:", ownRank.get_onlineId(), ", score:", ownRank.score, ", comment:", ownRank.get_comment() })); }
private void OnGotCategoryInfo(Messages.PluginMessage msg) { OnScreenLog.Add("Got Category Info"); Commerce.CommerceCategoryInfo categoryInfo = Commerce.GetCategoryInfo(); OnScreenLog.Add("Category Id: " + categoryInfo.categoryId); OnScreenLog.Add("Category Name: " + categoryInfo.categoryName); OnScreenLog.Add("Category num products: " + categoryInfo.countOfProducts); OnScreenLog.Add("Category num sub categories: " + categoryInfo.countOfSubCategories); for (int i = 0; i < categoryInfo.countOfSubCategories; i++) { Commerce.CommerceCategoryInfo subCategoryInfo = Commerce.GetSubCategoryInfo(i); OnScreenLog.Add("SubCategory Id: " + subCategoryInfo.categoryId); OnScreenLog.Add("SubCategory Name: " + subCategoryInfo.categoryName); if (i == 0) { SonyNpCommerce.ErrorHandler(Commerce.RequestCategoryInfo(subCategoryInfo.categoryId)); } } }
private void OnParentalControlResult(Messages.PluginMessage msg) { int num; bool flag; bool flag2; Requests.GetParentalControlInfoResult(msg, ref num, ref flag, ref flag2); OnScreenLog.Add(string.Concat(new object[] { "OnParentalControlResult Age:", num, " chatRestriction:", flag, " ugcRestriction:", flag2, " OnlineID: ", Requests.GetRequestOnlineId(msg) })); }
private void OnTrophyGotTrophyInfo(Messages.PluginMessage msg) { OnScreenLog.Add("Got Trophy List!"); Trophies.TrophyDetails[] cachedTrophyDetails = Trophies.GetCachedTrophyDetails(); Trophies.TrophyData[] cachedTrophyData = Trophies.GetCachedTrophyData(); OnScreenLog.Add("Trophies: " + cachedTrophyDetails.Length); for (int i = 0; i < cachedTrophyDetails.Length; i++) { if (cachedTrophyData[i].get_hasIcon() && this.trophyIcon == null) { this.trophyIcon = cachedTrophyData[i].get_icon(); OnScreenLog.Add(string.Concat(new object[] { "Found icon: ", this.trophyIcon.get_width(), ", ", this.trophyIcon.get_height() })); } OnScreenLog.Add(string.Concat(new object[] { " ", i, ": ", cachedTrophyDetails[i].get_name(), ", ", cachedTrophyDetails[i].trophyId, ", ", cachedTrophyDetails[i].trophyGrade, ", ", cachedTrophyDetails[i].groupId, ", ", cachedTrophyDetails[i].hidden, ", ", cachedTrophyData[i].unlocked, ", ", cachedTrophyData[i].timestamp, ", ", cachedTrophyData[i].userId.ToString("X") })); } }
private void OnMatchingCreatedSession(Messages.PluginMessage msg) { OnScreenLog.Add("Created session..."); Matching.Session session = Matching.GetSession(); DumpSessionInfo(session); if (!InitializeHostAndSelf(session)) { OnScreenLog.Add("ERROR: Expected members not found!"); } NetworkConnectionError networkConnectionError = Network.InitializeServer(serverMaxConnections, serverPort, false); if (networkConnectionError != 0) { OnScreenLog.Add("Server err: " + networkConnectionError); } else { OnScreenLog.Add("Started Server"); } }
private void OnMessagingGotInGameDataMessage(Messages.PluginMessage msg) { SonyNpMessaging.GameData gameData = default(SonyNpMessaging.GameData); OnScreenLog.Add("Got in-game data message..."); while (Messaging.InGameDataMessagesRecieved()) { Messaging.InGameDataMessage inGameDataMessage = Messaging.GetInGameDataMessage(); gameData.ReadFromBuffer(inGameDataMessage.data); OnScreenLog.Add(string.Concat(new object[] { " ID: ", inGameDataMessage.messageID, " text: ", gameData.text, " item1: ", gameData.item1, " item2: ", gameData.item2 })); } }
void OnSavedGameLoaded(Messages.PluginMessage msg) { byte[] bytes = SaveLoad.GetLoadedGame(); if (bytes == null) { SceneManager.LoadSceneAsync((int)SceneIndex.Main); return; } SaveData data; using (MemoryStream memoryStream = new MemoryStream()) { BinaryFormatter binaryFormatter = new BinaryFormatter(); memoryStream.Write(bytes, 0, bytes.Length); memoryStream.Seek(0, SeekOrigin.Begin); data = (SaveData)binaryFormatter.Deserialize(memoryStream); } DataStorage.LoadFile(data); Objectives.LoadFile(data); SceneManager.LoadSceneAsync((int)SceneIndex.Main); }