コード例 #1
0
        private void ReceiveTeamPlayerChangeEvent(object sender, TeamPlayerChangeEventArgs e)
        {
            var message = e.Message;
            var player  = message.Player;

            switch (message.ChangeType)
            {
            case TeamPlayerChangeType.Add:
                AddCharacterSubscription(player.Id);
                break;

            case TeamPlayerChangeType.Remove:
                RemoveCharacterSubscription(player.Id);
                break;
            }
        }
コード例 #2
0
        private void OnTeamPlayerChangeEvent(object sender, TeamPlayerChangeEventArgs e)
        {
            if (MatchConfiguration.IsManualWorldId)
            {
                return;
            }

            var message    = e.Message;
            var changeType = message.ChangeType;
            var player     = message.Player;

            // Handle outfit removals via Team Outfit Change events
            if (!player.IsOutfitless)
            {
                return;
            }

            int? worldId;
            bool isRollBack = false;

            if (changeType == TeamPlayerChangeType.Add)
            {
                worldId = player.WorldId;
            }
            else
            {
                worldId    = _teamsManager.GetNextWorldId(MatchConfiguration.WorldId);
                isRollBack = true;
            }

            if (worldId == null)
            {
                MatchConfiguration.ResetWorldId();
                SendMatchConfigurationUpdateMessage();
            }
            else if (MatchConfiguration.TrySetWorldId((int)worldId, false, isRollBack))
            {
                SendMatchConfigurationUpdateMessage();
            }
        }
 protected virtual void OnRaiseTeamPlayerChangeEvent(TeamPlayerChangeEventArgs e)
 {
     RaiseTeamPlayerChangeEvent?.Invoke(this, e);
 }