public void MenuInSession(MenuStack menuStack) { bool isSignedInPSN = User.IsSignedInPSN; bool inSession = Matching.InSession; bool sessionIsBusy = Matching.SessionIsBusy; bool isHost = Matching.IsHost; MenuLayout menuLayout = (!isHost) ? menuInSessionClient : menuInSessionHosting; menuLayout.Update(); if (isHost && menuLayout.AddItem("Modify Session", isSignedInPSN && inSession && !sessionIsBusy)) { OnScreenLog.Add("Modifying session..."); Matching.ClearModifySessionAttributes(); gameDetails += 100; Matching.ModifySessionAttribute modifySessionAttribute = new Matching.ModifySessionAttribute(); modifySessionAttribute.name = "GAME_DETAILS"; modifySessionAttribute.intValue = gameDetails; Matching.AddModifySessionAttribute(modifySessionAttribute); ErrorHandler(Matching.ModifySession(Matching.EnumAttributeType.SESSION_INTERNAL_ATTRIBUTE)); } if (menuLayout.AddItem("Modify Member Attribute", isSignedInPSN && inSession && !sessionIsBusy)) { OnScreenLog.Add("Modifying Member Attribute..."); Matching.ClearModifySessionAttributes(); Matching.ModifySessionAttribute modifySessionAttribute2 = new Matching.ModifySessionAttribute(); modifySessionAttribute2.name = "CAR_TYPE"; cartype++; if (cartype > 3) { cartype = 0; } switch (cartype) { case 0: modifySessionAttribute2.binValue = "CATMOB"; break; case 1: modifySessionAttribute2.binValue = "CARTYPE1"; break; case 2: modifySessionAttribute2.binValue = "CARTYPE2"; break; case 3: modifySessionAttribute2.binValue = "CARTYPE3"; break; } modifySessionAttribute2.intValue = gameDetails; Matching.AddModifySessionAttribute(modifySessionAttribute2); ErrorHandler(Matching.ModifySession(Matching.EnumAttributeType.SESSION_MEMBER_ATTRIBUTE)); } if (!sendingData) { if (menuLayout.AddItem("Start Sending Data", isSignedInPSN && inSession && !sessionIsBusy)) { sendingData = true; } } else if (menuLayout.AddItem("Stop Sending Data", isSignedInPSN && inSession && !sessionIsBusy)) { sendingData = false; } if (menuLayout.AddItem("Leave Session", isSignedInPSN && inSession && !sessionIsBusy)) { OnScreenLog.Add("Leaving session..."); ErrorHandler(Matching.LeaveSession()); } if (menuLayout.AddItem("List session members", isSignedInPSN && inSession && !sessionIsBusy)) { Matching.Session session = Matching.GetSession(); Matching.SessionMemberInfo[] members = session.members; for (int i = 0; i < members.Length; i++) { Matching.SessionMemberInfo sessionMemberInfo = members[i]; string msg = i + "/memberId:" + sessionMemberInfo.memberId + "/memberFlag:" + sessionMemberInfo.memberFlag + "/addr:" + sessionMemberInfo.addr + "/natType:" + sessionMemberInfo.natType + "/port:" + sessionMemberInfo.port; OnScreenLog.Add(msg); } } if (menuLayout.AddItem("Invite Friend", isSignedInPSN && inSession && !sessionIsBusy)) { OnScreenLog.Add("Invite Friend..."); ErrorHandler(Matching.InviteToSession("Invite Test", 8)); } if (menuLayout.AddBackIndex("Back")) { menuStack.PopMenu(); } if (Matching.IsHost) { NetworkPlayer[] connections = Network.connections; GUI.Label(new Rect(Screen.width - 200, Screen.height - 200, 200f, 64f), connections.Length.ToString()); } }
public void MenuInSession(MenuStack menuStack) { bool isSignedInPSN = User.get_IsSignedInPSN(); bool inSession = Matching.get_InSession(); bool sessionIsBusy = Matching.get_SessionIsBusy(); bool isHost = Matching.get_IsHost(); MenuLayout menuLayout = (!isHost) ? this.menuInSessionClient : this.menuInSessionHosting; menuLayout.Update(); if (isHost && menuLayout.AddItem("Modify Session", isSignedInPSN && inSession && !sessionIsBusy)) { OnScreenLog.Add("Modifying session..."); Matching.ClearModifySessionAttributes(); this.gameDetails += 100; Matching.ModifySessionAttribute modifySessionAttribute = new Matching.ModifySessionAttribute(); modifySessionAttribute.set_name("GAME_DETAILS"); modifySessionAttribute.intValue = this.gameDetails; Matching.AddModifySessionAttribute(modifySessionAttribute); this.ErrorHandler(Matching.ModifySession(8)); } if (menuLayout.AddItem("Modify Member Attribute", isSignedInPSN && inSession && !sessionIsBusy)) { OnScreenLog.Add("Modifying Member Attribute..."); Matching.ClearModifySessionAttributes(); Matching.ModifySessionAttribute modifySessionAttribute2 = new Matching.ModifySessionAttribute(); modifySessionAttribute2.set_name("CAR_TYPE"); this.cartype++; if (this.cartype > 3) { this.cartype = 0; } switch (this.cartype) { case 0: modifySessionAttribute2.set_binValue("CATMOB"); break; case 1: modifySessionAttribute2.set_binValue("CARTYPE1"); break; case 2: modifySessionAttribute2.set_binValue("CARTYPE2"); break; case 3: modifySessionAttribute2.set_binValue("CARTYPE3"); break; } modifySessionAttribute2.intValue = this.gameDetails; Matching.AddModifySessionAttribute(modifySessionAttribute2); this.ErrorHandler(Matching.ModifySession(16)); } if (!this.sendingData) { if (menuLayout.AddItem("Start Sending Data", isSignedInPSN && inSession && !sessionIsBusy)) { this.sendingData = true; } } else if (menuLayout.AddItem("Stop Sending Data", isSignedInPSN && inSession && !sessionIsBusy)) { this.sendingData = false; } if (menuLayout.AddItem("Leave Session", isSignedInPSN && inSession && !sessionIsBusy)) { OnScreenLog.Add("Leaving session..."); this.ErrorHandler(Matching.LeaveSession()); } if (menuLayout.AddItem("List session members", isSignedInPSN && inSession && !sessionIsBusy)) { Matching.SessionMemberInfo[] members = Matching.GetSession().members; for (int i = 0; i < members.Length; i++) { Matching.SessionMemberInfo sessionMemberInfo = members[i]; string msg = string.Concat(new object[] { i, "/memberId:", sessionMemberInfo.memberId, "/memberFlag:", sessionMemberInfo.memberFlag, "/addr:", sessionMemberInfo.addr, "/natType:", sessionMemberInfo.natType, "/port:", sessionMemberInfo.port }); OnScreenLog.Add(msg); } } if (menuLayout.AddItem("Invite Friend", isSignedInPSN && inSession && !sessionIsBusy)) { OnScreenLog.Add("Invite Friend..."); this.ErrorHandler(Matching.InviteToSession("Invite Test", 8)); } if (menuLayout.AddBackIndex("Back", true)) { menuStack.PopMenu(); } if (Matching.get_IsHost()) { NetworkPlayer[] connections = Network.get_connections(); GUI.Label(new Rect((float)(Screen.get_width() - 200), (float)(Screen.get_height() - 200), 200f, 64f), connections.Length.ToString()); } }