Пример #1
0
        private void OnParticipantStateChanged(object sender, InteractiveParticipantStateChangedEventArgs e)
        {
            // Every time a new participant joins randomly assign them to a new group. Groups can
            // be used to show different sets of controls to your audience.
            InteractiveParticipant participant = e.Participant;

            if (participant.State == InteractiveParticipantState.Joined &&
                MixerInteractive.Groups.Count >= 2)
            {
                InteractiveGroup group1 = MixerInteractive.Groups[0];
                InteractiveGroup group2 = MixerInteractive.Groups[1];
                InteractiveGroup group3 = MixerInteractive.Groups[2];

                int group = Mathf.CeilToInt(Random.value * 3);
                if (group == 1)
                {
                    participant.Group = group1;
                    group1Text.text  += "\n" + participant.UserName;
                }
                else if (group == 2)
                {
                    participant.Group = group2;
                    group2Text.text  += "\n" + participant.UserName;
                }
                else if (group == 3)
                {
                    participant.Group = group3;
                    group3Text.text  += "\n" + participant.UserName;
                }
            }
        }
Пример #2
0
    private static void ProcessSerializedProperties()
    {
        MixerInteractiveHelper helper = MixerInteractiveHelper.SingletonInstance;
        InteractivityManager   interactivityManager = InteractivityManager.SingletonInstance;
        string defaultSceneID = helper.defaultSceneID;

        if (helper.groupSceneMapping.Count > 0 ||
            defaultSceneID != string.Empty)
        {
            shouldCheckForOutstandingRequests = true;
        }
        if (helper.groupSceneMapping.Count > 0)
        {
            var groupIDs = helper.groupSceneMapping.Keys;
            foreach (var groupID in groupIDs)
            {
                if (groupID == string.Empty)
                {
                    continue;
                }
                // Supress this warning because calling the contructor
                // triggers the creation of a group.
#pragma warning disable 0219
                InteractiveGroup group;
#pragma warning restore 0219
                string sceneID = helper.groupSceneMapping[groupID];
                if (sceneID != string.Empty)
                {
                    group = new InteractiveGroup(groupID, sceneID);
                }
                else
                {
                    group = new InteractiveGroup(groupID);
                }
                outstandingCreateGroupsRequests.Add(groupID);
            }
            if (defaultSceneID != string.Empty)
            {
                interactivityManager.SetCurrentScene(defaultSceneID);
                outstandingSetDefaultSceneRequest = defaultSceneID;
            }
        }
        processedSerializedProperties = true;
    }