Пример #1
0
        /// <summary>
        /// 往接收端中添加发送端信息
        /// </summary>
        /// <param name="send"></param>
        public void AddReceiveDistanced(DistanceData send)
        {
            if (Distanced == null)
            {
                Distanced = new List <DistanceData>();
            }

            //移除正在交互的
            if (Distanceing.Contains(send))
            {
                Distanceing.Remove(send);
            }

            if (Distanced.Contains(send))
            {
                return;
            }

            Distanced.Add(send);

            if (maxCount == -1)
            {
                return;
            }

            maxCount--;
        }
Пример #2
0
        /// <summary>
        /// 往接收端中添加发送端信息
        /// </summary>
        /// <param name="send"></param>
        public void AddReceiveDistanced(DistanceInteraction send)
        {
            if (Distanced == null)
            {
                Distanced = new List <DistanceInteraction>();
            }

            //移除正在交互的
            if (Distancing.Contains(send))
            {
                Distancing.Remove(send);
            }

            if (Distanced.Contains(send))
            {
                return;
            }

            Distanced.Add(send);

            if (distanceData.maxCount == -1)
            {
                return;
            }

            distanceData.maxCount--;
        }
Пример #3
0
        /// <summary>
        /// 移除已经交互的距离信息
        /// </summary>
        /// <param name="send">Send.</param>
        public void RemoveReceiveDistanced(DistanceInteraction send)
        {
            if (Distanced == null)
            {
                return;
            }
            if (!Distanced.Contains(send))
            {
                return;
            }

            Distanced.Remove(send);

            if (distanceData.maxCount != -1)
            {
                distanceData.maxCount++;
            }
        }
Пример #4
0
        public void RemoveReceiveDistanced(DistanceData send)
        {
            if (Distanced == null)
            {
                return;
            }

            if (!Distanced.Contains(send))
            {
                return;
            }

            Distanced.Remove(send);

            if (maxCount != -1)
            {
                maxCount++;
            }
        }
Пример #5
0
        /// <summary>
        /// 松手
        /// </summary>
        public void OnRelesae(DistanceData target)
        {
            switch (interactionType)
            {
            case InteractionType.Receive:
            case InteractionType.All:
            case InteractionType.Pour:

                if (IsOnly)
                {
                    if (OnlyDistance == target)
                    {
                        Interaction.OnDistanceRelesae(target.Interaction);
                        Interaction.OnDistanceRelease(target.Interaction, InteractionReleaseStatus.Inside);
                        return;
                    }
                }
                else
                {
                    if (Distanced != null && Distanced.Contains(target))
                    {
                        Interaction.OnDistanceRelesae(target.Interaction);
                        Interaction.OnDistanceRelease(target.Interaction, InteractionReleaseStatus.Inside);
                        return;
                    }
                }

                if (!OnCheck())
                {
                    return;
                }

                Interaction.OnDistanceRelesae(target.Interaction);
                Interaction.OnDistanceRelease(target.Interaction, InteractionReleaseStatus.Once);

                if (IsOnly)
                {
                    OnlyDistance = target;

                    return;
                }
                else
                {
                    AddReceiveDistanced(target);
                }

                break;

            case InteractionType.Send:

                if (!OnCheck())
                {
                    Interaction.OnDistanceRelesae(target.Interaction);
                    Interaction.OnDistanceRelease(target.Interaction, InteractionReleaseStatus.Inside);

                    return;
                }

                Interaction.OnDistanceRelesae(target.Interaction);
                Interaction.OnDistanceRelease(target.Interaction, InteractionReleaseStatus.Once);

                AddSendDistance(target);

                break;
            }
        }
Пример #6
0
        /// <summary>
        /// 交互松手处理
        /// </summary>
        /// <param name="interaction">Target.</param>
        public void OnInteractionRelease(DistanceInteraction interaction, bool isAuto = false)
        {
            switch (distanceData.interactionType)
            {
            case InteractionType.Receive:
            case InteractionType.All:
            case InteractionType.Pour:

                if (distanceData.IsOnly)
                {
                    if (OnlyDistance == interaction)
                    {
                        OnDistanceRelesae(interaction);
                        if (isAuto)
                        {
                            OnDistanceRelease(interaction, InteractionReleaseStatus.IsAuto);
                        }
                        else
                        {
                            OnDistanceRelease(interaction, InteractionReleaseStatus.Inside);
                        }
                        return;
                    }
                }
                else
                {
                    if (Distanced != null && Distanced.Contains(interaction))
                    {
                        OnDistanceRelesae(interaction);
                        if (isAuto)
                        {
                            OnDistanceRelease(interaction, InteractionReleaseStatus.IsAuto);
                        }
                        else
                        {
                            OnDistanceRelease(interaction, InteractionReleaseStatus.Inside);
                        }
                        return;
                    }
                }

                if (!OnInteractionCheck())
                {
                    return;
                }

                OnDistanceRelesae(interaction);
                if (isAuto)
                {
                    OnDistanceRelease(interaction, InteractionReleaseStatus.IsAuto);
                }
                else
                {
                    OnDistanceRelease(interaction, InteractionReleaseStatus.Once);
                }

                if (distanceData.IsOnly)
                {
                    OnlyDistance = interaction;

                    return;
                }
                else
                {
                    AddReceiveDistanced(interaction);
                }

                break;

            case InteractionType.Send:

                if (!OnInteractionCheck())
                {
                    OnDistanceRelesae(interaction);
                    if (isAuto)
                    {
                        OnDistanceRelease(interaction, InteractionReleaseStatus.IsAuto);
                    }
                    else
                    {
                        OnDistanceRelease(interaction, InteractionReleaseStatus.Inside);
                    }

                    return;
                }

                OnDistanceRelesae(interaction);
                if (isAuto)
                {
                    OnDistanceRelease(interaction, InteractionReleaseStatus.IsAuto);
                }
                else
                {
                    OnDistanceRelease(interaction, InteractionReleaseStatus.Once);
                }

                AddSendDistance(interaction);

                break;
            }
        }