예제 #1
0
    public void MenuSetupSession(MenuStack menuStack)
    {
        bool isSignedInPSN = User.IsSignedInPSN;
        bool inSession     = Matching.InSession;
        bool sessionIsBusy = Matching.SessionIsBusy;

        menuSession.Update();
        if (menuSession.AddItem("Create & Join Session", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Creating session...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute = new Matching.SessionAttribute();
            sessionAttribute.name     = "APP_VERSION";
            sessionAttribute.intValue = appVersion;
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute          = new Matching.SessionAttribute();
            sessionAttribute.name     = "PASSWORD";
            sessionAttribute.binValue = "NO";
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute          = new Matching.SessionAttribute();
            sessionAttribute.name     = "CAR_TYPE";
            sessionAttribute.binValue = "CATMOB";
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute          = new Matching.SessionAttribute();
            sessionAttribute.name     = "LEVEL";
            sessionAttribute.intValue = 1;
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute          = new Matching.SessionAttribute();
            sessionAttribute.name     = "RACE_TRACK";
            sessionAttribute.binValue = "TURKEY";
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute          = new Matching.SessionAttribute();
            sessionAttribute.name     = "GAME_DETAILS";
            sessionAttribute.intValue = gameDetails;
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute          = new Matching.SessionAttribute();
            sessionAttribute.name     = "TEST_BIN_SEARCH";
            sessionAttribute.binValue = "BIN_VALUE";
            Matching.AddSessionAttribute(sessionAttribute);
            string name             = "Test Session";
            int    serverID         = 0;
            int    worldID          = 0;
            int    numSlots         = 8;
            string empty            = string.Empty;
            string ps4SessionStatus = "Toolkit Sample Session";
            ErrorHandler(Matching.CreateSession(name, serverID, worldID, numSlots, empty, SignallingType, Matching.EnumSessionType.SESSION_TYPE_PUBLIC, ps4SessionStatus));
        }
        if (menuSession.AddItem("Create & Join Private Session", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Creating private session... password is required");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute2 = new Matching.SessionAttribute();
            sessionAttribute2.name     = "APP_VERSION";
            sessionAttribute2.intValue = appVersion;
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2          = new Matching.SessionAttribute();
            sessionAttribute2.name     = "PASSWORD";
            sessionAttribute2.binValue = "YES";
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2          = new Matching.SessionAttribute();
            sessionAttribute2.name     = "CAR_TYPE";
            sessionAttribute2.binValue = "CATMOB";
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2          = new Matching.SessionAttribute();
            sessionAttribute2.name     = "LEVEL";
            sessionAttribute2.intValue = 1;
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2          = new Matching.SessionAttribute();
            sessionAttribute2.name     = "RACE_TRACK";
            sessionAttribute2.binValue = "TURKEY";
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2          = new Matching.SessionAttribute();
            sessionAttribute2.name     = "GAME_DETAILS";
            sessionAttribute2.intValue = gameDetails;
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2          = new Matching.SessionAttribute();
            sessionAttribute2.name     = "TEST_BIN_SEARCH";
            sessionAttribute2.binValue = "BIN_VALUE";
            Matching.AddSessionAttribute(sessionAttribute2);
            string name2             = "Test Session";
            int    serverID2         = 0;
            int    worldID2          = 0;
            int    numSlots2         = 8;
            string password          = sessionPassword;
            string ps4SessionStatus2 = "Toolkit Sample Session";
            ErrorHandler(Matching.CreateSession(name2, serverID2, worldID2, numSlots2, password, SignallingType | Matching.FlagSessionCreate.CREATE_PASSWORD_SESSION, Matching.EnumSessionType.SESSION_TYPE_PRIVATE, ps4SessionStatus2));
        }
        if (menuSession.AddItem("Create & Join Friend Session", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Creating Friend session...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute3 = new Matching.SessionAttribute();
            sessionAttribute3.name     = "APP_VERSION";
            sessionAttribute3.intValue = appVersion;
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3          = new Matching.SessionAttribute();
            sessionAttribute3.name     = "PASSWORD";
            sessionAttribute3.binValue = "YES";
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3          = new Matching.SessionAttribute();
            sessionAttribute3.name     = "CAR_TYPE";
            sessionAttribute3.binValue = "CATMOB";
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3          = new Matching.SessionAttribute();
            sessionAttribute3.name     = "LEVEL";
            sessionAttribute3.intValue = 1;
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3          = new Matching.SessionAttribute();
            sessionAttribute3.name     = "RACE_TRACK";
            sessionAttribute3.binValue = "TURKEY";
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3          = new Matching.SessionAttribute();
            sessionAttribute3.name     = "GAME_DETAILS";
            sessionAttribute3.intValue = gameDetails;
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3          = new Matching.SessionAttribute();
            sessionAttribute3.name     = "TEST_BIN_SEARCH";
            sessionAttribute3.binValue = "BIN_VALUE";
            Matching.AddSessionAttribute(sessionAttribute3);
            string name3             = "Test Session";
            int    serverID3         = 0;
            int    worldID3          = 0;
            int    numSlots3         = 8;
            int    friendSlots       = 8;
            string password2         = sessionPassword;
            string ps4SessionStatus3 = "Toolkit Sample Session";
            ErrorHandler(Matching.CreateFriendsSession(name3, serverID3, worldID3, numSlots3, friendSlots, password2, SignallingType | Matching.FlagSessionCreate.CREATE_PASSWORD_SESSION, ps4SessionStatus3));
        }
        if (menuSession.AddItem("Find Sessions", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding sessions...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute4 = new Matching.SessionAttribute();
            sessionAttribute4.name           = "APP_VERSION";
            sessionAttribute4.intValue       = appVersion;
            sessionAttribute4.searchOperator = Matching.EnumSearchOperators.MATCHING_OPERATOR_EQ;
            Matching.AddSessionAttribute(sessionAttribute4);
            int serverID4 = 0;
            int worldID4  = 0;
            ErrorHandler(Matching.FindSession(serverID4, worldID4));
        }
        if (menuSession.AddItem("Find Sessions (bin search)", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding sessions...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute5 = new Matching.SessionAttribute();
            sessionAttribute5.name           = "TEST_BIN_SEARCH";
            sessionAttribute5.binValue       = "BIN_VALUE";
            sessionAttribute5.searchOperator = Matching.EnumSearchOperators.MATCHING_OPERATOR_EQ;
            Matching.AddSessionAttribute(sessionAttribute5);
            int serverID5 = 0;
            int worldID5  = 0;
            ErrorHandler(Matching.FindSession(serverID5, worldID5, Matching.FlagSessionSearch.SEARCH_REGIONAL_SESSIONS));
        }
        if (menuSession.AddItem("Find Friend Sessions", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding friend sessions...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute6 = new Matching.SessionAttribute();
            sessionAttribute6.name           = "APP_VERSION";
            sessionAttribute6.intValue       = appVersion;
            sessionAttribute6.searchOperator = Matching.EnumSearchOperators.MATCHING_OPERATOR_EQ;
            Matching.AddSessionAttribute(sessionAttribute6);
            int serverID6 = 0;
            int worldID6  = 0;
            ErrorHandler(Matching.FindSession(serverID6, worldID6, Matching.FlagSessionSearch.SEARCH_FRIENDS_SESSIONS));
        }
        if (menuSession.AddItem("Find Regional Sessions", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding friend sessions...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute7 = new Matching.SessionAttribute();
            sessionAttribute7.name           = "APP_VERSION";
            sessionAttribute7.intValue       = appVersion;
            sessionAttribute7.searchOperator = Matching.EnumSearchOperators.MATCHING_OPERATOR_EQ;
            Matching.AddSessionAttribute(sessionAttribute7);
            int serverID7 = 0;
            int worldID7  = 0;
            ErrorHandler(Matching.FindSession(serverID7, worldID7, Matching.FlagSessionSearch.SEARCH_REGIONAL_SESSIONS));
        }
        if (menuSession.AddItem("Find Random Sessions", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding sessions in a random order...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute8 = new Matching.SessionAttribute();
            sessionAttribute8.name           = "APP_VERSION";
            sessionAttribute8.intValue       = appVersion;
            sessionAttribute8.searchOperator = Matching.EnumSearchOperators.MATCHING_OPERATOR_EQ;
            Matching.AddSessionAttribute(sessionAttribute8);
            int serverID8 = 0;
            int worldID8  = 0;
            ErrorHandler(Matching.FindSession(serverID8, worldID8, Matching.FlagSessionSearch.SEARCH_RANDOM_SESSIONS));
        }
        bool flag = availableSessions != null && availableSessions.Length > 0;

        if (menuSession.AddItem("Join 1st Found Session", isSignedInPSN && flag && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Joining PSN session: " + availableSessions[0].sessionInfo.sessionName);
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute9 = new Matching.SessionAttribute();
            sessionAttribute9.name     = "CAR_TYPE";
            sessionAttribute9.binValue = "CATMOB";
            Matching.AddSessionAttribute(sessionAttribute9);
            ErrorHandler(Matching.JoinSession(availableSessions[0].sessionInfo.sessionID, sessionPassword));
        }
        if (menuSession.AddBackIndex("Back"))
        {
            menuStack.PopMenu();
        }
    }
    public void MenuSetupSession(MenuStack menuStack)
    {
        bool isSignedInPSN = User.get_IsSignedInPSN();
        bool inSession     = Matching.get_InSession();
        bool sessionIsBusy = Matching.get_SessionIsBusy();

        this.menuSession.Update();
        if (this.menuSession.AddItem("Create & Join Session", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Creating session...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute = new Matching.SessionAttribute();
            sessionAttribute.set_name("APP_VERSION");
            sessionAttribute.intValue = this.appVersion;
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute = new Matching.SessionAttribute();
            sessionAttribute.set_name("PASSWORD");
            sessionAttribute.set_binValue("NO");
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute = new Matching.SessionAttribute();
            sessionAttribute.set_name("CAR_TYPE");
            sessionAttribute.set_binValue("CATMOB");
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute = new Matching.SessionAttribute();
            sessionAttribute.set_name("LEVEL");
            sessionAttribute.intValue = 1;
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute = new Matching.SessionAttribute();
            sessionAttribute.set_name("RACE_TRACK");
            sessionAttribute.set_binValue("TURKEY");
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute = new Matching.SessionAttribute();
            sessionAttribute.set_name("GAME_DETAILS");
            sessionAttribute.intValue = this.gameDetails;
            Matching.AddSessionAttribute(sessionAttribute);
            sessionAttribute = new Matching.SessionAttribute();
            sessionAttribute.set_name("TEST_BIN_SEARCH");
            sessionAttribute.set_binValue("BIN_VALUE");
            Matching.AddSessionAttribute(sessionAttribute);
            string text  = "Test Session";
            int    num   = 0;
            int    num2  = 0;
            int    num3  = 8;
            string empty = string.Empty;
            string text2 = "Toolkit Sample Session";
            this.ErrorHandler(Matching.CreateSession(text, num, num2, num3, empty, this.SignallingType, 4, text2));
        }
        if (this.menuSession.AddItem("Create & Join Private Session", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Creating private session... password is required");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute2 = new Matching.SessionAttribute();
            sessionAttribute2.set_name("APP_VERSION");
            sessionAttribute2.intValue = this.appVersion;
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2 = new Matching.SessionAttribute();
            sessionAttribute2.set_name("PASSWORD");
            sessionAttribute2.set_binValue("YES");
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2 = new Matching.SessionAttribute();
            sessionAttribute2.set_name("CAR_TYPE");
            sessionAttribute2.set_binValue("CATMOB");
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2 = new Matching.SessionAttribute();
            sessionAttribute2.set_name("LEVEL");
            sessionAttribute2.intValue = 1;
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2 = new Matching.SessionAttribute();
            sessionAttribute2.set_name("RACE_TRACK");
            sessionAttribute2.set_binValue("TURKEY");
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2 = new Matching.SessionAttribute();
            sessionAttribute2.set_name("GAME_DETAILS");
            sessionAttribute2.intValue = this.gameDetails;
            Matching.AddSessionAttribute(sessionAttribute2);
            sessionAttribute2 = new Matching.SessionAttribute();
            sessionAttribute2.set_name("TEST_BIN_SEARCH");
            sessionAttribute2.set_binValue("BIN_VALUE");
            Matching.AddSessionAttribute(sessionAttribute2);
            string text3 = "Test Session";
            int    num4  = 0;
            int    num5  = 0;
            int    num6  = 8;
            string text4 = this.sessionPassword;
            string text5 = "Toolkit Sample Session";
            this.ErrorHandler(Matching.CreateSession(text3, num4, num5, num6, text4, this.SignallingType | 16, 8, text5));
        }
        if (this.menuSession.AddItem("Create & Join Friend Session", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Creating Friend session...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute3 = new Matching.SessionAttribute();
            sessionAttribute3.set_name("APP_VERSION");
            sessionAttribute3.intValue = this.appVersion;
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3 = new Matching.SessionAttribute();
            sessionAttribute3.set_name("PASSWORD");
            sessionAttribute3.set_binValue("YES");
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3 = new Matching.SessionAttribute();
            sessionAttribute3.set_name("CAR_TYPE");
            sessionAttribute3.set_binValue("CATMOB");
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3 = new Matching.SessionAttribute();
            sessionAttribute3.set_name("LEVEL");
            sessionAttribute3.intValue = 1;
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3 = new Matching.SessionAttribute();
            sessionAttribute3.set_name("RACE_TRACK");
            sessionAttribute3.set_binValue("TURKEY");
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3 = new Matching.SessionAttribute();
            sessionAttribute3.set_name("GAME_DETAILS");
            sessionAttribute3.intValue = this.gameDetails;
            Matching.AddSessionAttribute(sessionAttribute3);
            sessionAttribute3 = new Matching.SessionAttribute();
            sessionAttribute3.set_name("TEST_BIN_SEARCH");
            sessionAttribute3.set_binValue("BIN_VALUE");
            Matching.AddSessionAttribute(sessionAttribute3);
            string text6 = "Test Session";
            int    num7  = 0;
            int    num8  = 0;
            int    num9  = 8;
            int    num10 = 8;
            string text7 = this.sessionPassword;
            string text8 = "Toolkit Sample Session";
            this.ErrorHandler(Matching.CreateFriendsSession(text6, num7, num8, num9, num10, text7, this.SignallingType | 16, text8));
        }
        if (this.menuSession.AddItem("Find Sessions", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding sessions...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute4 = new Matching.SessionAttribute();
            sessionAttribute4.set_name("APP_VERSION");
            sessionAttribute4.intValue       = this.appVersion;
            sessionAttribute4.searchOperator = 1;
            Matching.AddSessionAttribute(sessionAttribute4);
            int num11 = 0;
            int num12 = 0;
            this.ErrorHandler(Matching.FindSession(num11, num12));
        }
        if (this.menuSession.AddItem("Find Sessions (bin search)", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding sessions...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute5 = new Matching.SessionAttribute();
            sessionAttribute5.set_name("TEST_BIN_SEARCH");
            sessionAttribute5.set_binValue("BIN_VALUE");
            sessionAttribute5.searchOperator = 1;
            Matching.AddSessionAttribute(sessionAttribute5);
            int num13 = 0;
            int num14 = 0;
            this.ErrorHandler(Matching.FindSession(num13, num14, 4096));
        }
        if (this.menuSession.AddItem("Find Friend Sessions", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding friend sessions...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute6 = new Matching.SessionAttribute();
            sessionAttribute6.set_name("APP_VERSION");
            sessionAttribute6.intValue       = this.appVersion;
            sessionAttribute6.searchOperator = 1;
            Matching.AddSessionAttribute(sessionAttribute6);
            int num15 = 0;
            int num16 = 0;
            this.ErrorHandler(Matching.FindSession(num15, num16, 1024));
        }
        if (this.menuSession.AddItem("Find Regional Sessions", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding friend sessions...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute7 = new Matching.SessionAttribute();
            sessionAttribute7.set_name("APP_VERSION");
            sessionAttribute7.intValue       = this.appVersion;
            sessionAttribute7.searchOperator = 1;
            Matching.AddSessionAttribute(sessionAttribute7);
            int num17 = 0;
            int num18 = 0;
            this.ErrorHandler(Matching.FindSession(num17, num18, 4096));
        }
        if (this.menuSession.AddItem("Find Random Sessions", isSignedInPSN && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Finding sessions in a random order...");
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute8 = new Matching.SessionAttribute();
            sessionAttribute8.set_name("APP_VERSION");
            sessionAttribute8.intValue       = this.appVersion;
            sessionAttribute8.searchOperator = 1;
            Matching.AddSessionAttribute(sessionAttribute8);
            int num19 = 0;
            int num20 = 0;
            this.ErrorHandler(Matching.FindSession(num19, num20, 262144));
        }
        bool flag = this.availableSessions != null && this.availableSessions.Length > 0;

        if (this.menuSession.AddItem("Join 1st Found Session", isSignedInPSN && flag && !inSession && !sessionIsBusy))
        {
            OnScreenLog.Add("Joining PSN session: " + this.availableSessions[0].sessionInfo.get_sessionName());
            Matching.ClearSessionAttributes();
            Matching.SessionAttribute sessionAttribute9 = new Matching.SessionAttribute();
            sessionAttribute9.set_name("CAR_TYPE");
            sessionAttribute9.set_binValue("CATMOB");
            Matching.AddSessionAttribute(sessionAttribute9);
            this.ErrorHandler(Matching.JoinSession(this.availableSessions[0].sessionInfo.sessionID, this.sessionPassword));
        }
        if (this.menuSession.AddBackIndex("Back", true))
        {
            menuStack.PopMenu();
        }
    }