예제 #1
0
        // Performs all the necessary setup for the Highlights feature. It includes
        // creating the SDK, configuring all the highlights needed for the game, requesting
        // permissions and opening all highlight groups that would be used in the session.
        void SetupHighlights()
        {
            // Log message handler. Must be called before CreateHighlightsSDK.
            Highlights.AttachLogListener(Highlights.DefaultLogListener);

            // Create Highlights SDK
            Highlights.HighlightScope[] RequiredScopes = new Highlights.HighlightScope[3]
            {
                Highlights.HighlightScope.Highlights,
                Highlights.HighlightScope.HighlightsRecordVideo,
                Highlights.HighlightScope.HighlightsRecordScreenshot
            };
            System.String AppName = "Tanks";
            if (Highlights.CreateHighlightsSDK(AppName, RequiredScopes) != Highlights.ReturnCode.SUCCESS)
            {
                Debug.LogError("Failed to initialize Highlights");
                return;
            }

            int x = Highlights.PeekCallbackId();

            // Request Permissions
            Highlights.RequestPermissions(Highlights.DefaultRequestPermissionsCallback);

            // Configure Highlights
            Highlights.HighlightDefinition[] HighlightDefinitions = new Highlights.HighlightDefinition[3];

            HighlightDefinitions[0].Id                   = "HURT_ME_PLENTY";
            HighlightDefinitions[0].HighlightTags        = Highlights.HighlightType.Achievement;
            HighlightDefinitions[0].Significance         = Highlights.HighlightSignificance.Good;
            HighlightDefinitions[0].UserDefaultInterest  = true;
            HighlightDefinitions[0].NameTranslationTable = new Highlights.TranslationEntry[]
            {
                new Highlights.TranslationEntry("en-US", "Hurt me plenty"),
            };

            HighlightDefinitions[1].Id                   = "KABOOM";
            HighlightDefinitions[1].HighlightTags        = Highlights.HighlightType.Incident;
            HighlightDefinitions[1].Significance         = Highlights.HighlightSignificance.Good;
            HighlightDefinitions[1].UserDefaultInterest  = true;
            HighlightDefinitions[1].NameTranslationTable = new Highlights.TranslationEntry[]
            {
                new Highlights.TranslationEntry("en-US", "Kaboom!"),
            };

            HighlightDefinitions[2].Id                   = "HEAVY_DUTY_TRAVELER";
            HighlightDefinitions[2].HighlightTags        = Highlights.HighlightType.Achievement;
            HighlightDefinitions[2].Significance         = Highlights.HighlightSignificance.Good;
            HighlightDefinitions[2].UserDefaultInterest  = true;
            HighlightDefinitions[2].NameTranslationTable = new Highlights.TranslationEntry[]
            {
                new Highlights.TranslationEntry("en-US", "Heavy duty traveler"),
            };

            Highlights.ConfigureHighlights(HighlightDefinitions, "en-US", Highlights.DefaultConfigureCallback);

            // Open Groups
            Highlights.OpenGroupParams Ogp1 = new Highlights.OpenGroupParams();
            Ogp1.Id = "SHOT_HIGHLIGHT_GROUP";
            Ogp1.GroupDescriptionTable = new Highlights.TranslationEntry[]
            {
                new Highlights.TranslationEntry("en-US", "Shot highlight group"),
            };
            Highlights.OpenGroup(Ogp1, Highlights.DefaultOpenGroupCallback);

            Highlights.OpenGroupParams Ogp2 = new Highlights.OpenGroupParams();
            Ogp2.Id = "MISC_GROUP";
            Ogp2.GroupDescriptionTable = new Highlights.TranslationEntry[]
            {
                new Highlights.TranslationEntry("en-US", "Misc group"),
            };
            Highlights.OpenGroup(Ogp2, Highlights.DefaultOpenGroupCallback);
        }