コード例 #1
0
 public void UpdateDataBeforeHit(SendHitToServerEvent e, HitNode weapon, [JoinSelf] SingleNode <ShootableComponent> node)
 {
     if (this.HasHit(e.TargetingData, weapon.streamHitConfig))
     {
         this.UpdateHitData(weapon, e.TargetingData, true);
     }
 }
コード例 #2
0
    public void ChangeHitTime(int k, int l)
    {
        m_ChangeHitNode = true;

        if (m_HitNodeNow.ContainsKey(k) && m_HitNodeNow.ContainsKey(l))
        {
            HitNode temp = m_HitNodeNow[k];
            m_HitNodeNow[k] = m_HitNodeNow[l];
            m_HitNodeNow[l] = temp;
            m_HitNodeNow[k].TextNum(k + 1);
            m_HitNodeNow[l].TextNum(l + 1);
        }
        else if (m_HitNodeNow.ContainsKey(k))
        {
            m_HitNodeNow[l] = m_HitNodeNow[k];
            m_HitNodeNow[l].TextNum(l + 1);
            m_HitNodeNow.Remove(k);
        }
        else if (m_HitNodeNow.ContainsKey(l))
        {
            m_HitNodeNow[k] = m_HitNodeNow[l];
            m_HitNodeNow[k].TextNum(k + 1);
            m_HitNodeNow.Remove(l);
        }

        m_ChangeHitNode = false;
    }
コード例 #3
0
 public void UpdateHitNode(HitNode tempNode, HitInfo ho, int i)
 {
     tempNode.StartHitTime = ho.StartHitTime / 1000f;
     tempNode.EndHitTime   = ho.EndHitTime / 1000f;
     tempNode.HitTime      = ho.HitTime / 1000f;
     tempNode.HitPosition  = new Vector3(ho.Position.x, ho.Position.y, 0);
     tempNode.SoundText    = ho.SoundText;
     tempNode.ClickText    = ho.ClickText;
     tempNode.TextNum(i + 1);
 }
コード例 #4
0
 public void EvaluateLastTank(TargetingEvaluateEvent e, HitNode weapon)
 {
     List <DirectionData> .Enumerator enumerator = e.TargetingData.Directions.GetEnumerator();
     while (enumerator.MoveNext())
     {
         List <TargetData> .Enumerator enumerator2 = enumerator.Current.Targets.GetEnumerator();
         while (enumerator2.MoveNext())
         {
             TargetData current = enumerator2.Current;
             if (ReferenceEquals(current.TargetEntity, weapon.streamHit.TankHit.Entity))
             {
                 base.Log.Debug("EvaluateLastTank");
                 current.Priority += 100f;
             }
         }
     }
 }
コード例 #5
0
 public void ValidateHitEvent(SelfHitEvent e, HitNode weapon)
 {
     if ((e.Targets != null) && (e.Targets.Count > 0))
     {
         if (e.Targets.Count > 1)
         {
             throw new Exception("Invalid stream hit. Targets.Count=" + e.Targets.Count);
         }
         Entity entity  = e.Targets.Single <HitTarget>().Entity;
         Entity entity2 = weapon.streamHit.TankHit.Entity;
         if (!entity.Equals(entity2))
         {
             object[] objArray1 = new object[] { "Invalid stream hit. targetTankInEvent=", entity, " targetTankInComponent=", entity2 };
             throw new Exception(string.Concat(objArray1));
         }
     }
 }
コード例 #6
0
        private void UpdateHitData(HitNode weapon, TargetingData targetingData, bool skipTimeoutCheck)
        {
            StreamHitConfigComponent   streamHitConfig   = weapon.streamHitConfig;
            StreamHitCheckingComponent streamHitChecking = weapon.streamHitChecking;
            StreamHitComponent         streamHit         = weapon.streamHit;
            HitTarget     tankHit       = GetTankHit(targetingData);
            DirectionData bestDirection = targetingData.BestDirection;

            weapon.streamHitChecking.LastCheckTime = UnityTime.time;
            streamHit.TankHit   = tankHit;
            streamHit.StaticHit = bestDirection.StaticHit;
            StaticHit staticHit = !streamHitConfig.DetectStaticHit ? null : bestDirection.StaticHit;
            bool      flag      = false;
            bool      flag2     = false;

            if (!this.IsSameTank(tankHit, streamHitChecking.LastSentTankHit))
            {
                flag = true;
            }
            else if (skipTimeoutCheck || ((streamHitChecking.LastSendToServerTime + streamHitConfig.SendToServerPeriod) < UnityTime.time))
            {
                if (!IsAlmostEqual(staticHit, streamHitChecking.LastSentStaticHit))
                {
                    flag2 = true;
                }
                else if (!this.IsAlmostEqual(tankHit, streamHitChecking.LastSentTankHit))
                {
                    flag2 = true;
                }
            }
            if (flag)
            {
                weapon.Entity.RemoveComponent <StreamHitComponent>();
                this.AddStreamHit(weapon.Entity, targetingData, streamHitConfig, streamHitChecking);
            }
            else if (flag2)
            {
                base.ScheduleEvent(new SelfUpdateStreamHitEvent(tankHit, staticHit), weapon);
                this.SaveHitSentToServer(streamHitChecking, streamHit);
            }
        }
コード例 #7
0
    public void HitNodeStatus()
    {
        List <HitInfo> temp = EiderToolPage.Instance.SongObject.HitInfos;

        for (int i = 0; i < temp.Count; i++)
        {
            HitInfo ho = temp[i];
            if (ho.EndHitTime < m_HitTimeStart || ho.StartHitTime > m_HitTimeEnd)
            {
                if (m_HitNodeNow.ContainsKey(i))
                {
                    Destroy(m_HitNodeNow[i].gameObject);
                    m_HitNodeNow.Remove(i);
                }
            }
            else
            {
                if (m_HitNodeNow.ContainsKey(i) == false && m_SelectStatus == false)
                {
                    HitNode tempNode = Instantiate(ResourceLoadUtils.Load <HitNode>("UI/Nodes/HitNode"));
                    tempNode.transform.SetParent(transform.Find("ClickNode").transform);
                    tempNode.Init();
                    UpdateHitNode(tempNode, ho, i);
                    m_HitNodeNow.Add(i, tempNode);
                }

                if (m_HitNodeNow.ContainsKey(i))
                {
                    if (m_SelectStatus == false)
                    {
                        UpdateHitNode(m_HitNodeNow[i], ho, i);
                    }
                    else
                    {
                        m_HitNodeNow[i].TextNum(i + 1);
                    }
                }
            }
        }
        transform.Find("Cibiao").SetAsLastSibling();
    }
コード例 #8
0
 public void UpdateHit(StreamHitResultEvent e, HitNode weapon, [JoinSelf] SingleNode <ShootableComponent> node)
 {
     this.UpdateHitData(weapon, e.TargetingData, false);
 }
コード例 #9
0
    public List <HitInfo> InsertHitNode(HitInfo ho, List <HitInfo> temp)
    {
        m_ChangeHitNode = true;
        HitNode tempNode = Instantiate(ResourceLoadUtils.Load <HitNode>("UI/Nodes/HitNode"));

        tempNode.transform.SetParent(transform.Find("ClickNode").transform);
        tempNode.Init();
        UpdateHitNode(tempNode, ho, 0);
        int k = 0;

        if (temp.Count == 0)
        {
            ho.StartHitTime = ho.HitTime;
            ho.EndHitTime   = ho.HitTime + 2000;
            ho.Type         = SentenceInfo.SentenceType.ClickNode;
            temp.Add(ho);
            k = 0;
        }
        else if (ho.HitTime < temp[0].StartHitTime)
        {
            ho.StartHitTime = ho.HitTime;
            if (temp[0].Type == SentenceInfo.SentenceType.SoundNode)
            {
                ho.EndHitTime = temp[0].StartHitTime - 1000;
            }
            else
            {
                ho.EndHitTime = temp[0].StartHitTime - 100;
            }

            ho.Type = SentenceInfo.SentenceType.ClickNode;

            temp.Insert(0, ho);

            k = 0;
        }
        else
        {
            int i = 0;
            for (i = 0; i < temp.Count; i++)
            {
                if (ho.HitTime >= temp[i].StartHitTime && ho.HitTime <= temp[i].EndHitTime)
                {
                    ho.StartHitTime = temp[i].StartHitTime;
                    ho.EndHitTime   = temp[i].EndHitTime;
                    ho.Type         = temp[i].Type;
                }

                if (temp[i].HitTime < ho.HitTime)
                {
                    continue;
                }
                else
                {
                    temp.Insert(i, ho);
                    k = i;
                    break;
                }
            }
            if (i == temp.Count)
            {
                if (temp[i - 1].EndHitTime <= ho.HitTime)
                {
                    float lastEndTime = temp[i - 1].EndHitTime;
                    ho.StartHitTime = ho.HitTime;
                    ho.Type         = SentenceInfo.SentenceType.ClickNode;
                    ho.EndHitTime   = ho.HitTime + 2000;
                    for (int j = temp.Count - 1; j >= 0; j--)
                    {
                        if (temp[j].EndHitTime == lastEndTime)
                        {
                            temp[j].EndHitTime = ho.HitTime - 100;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else
                {
                    ho.StartHitTime = temp[i - 1].StartHitTime;
                    ho.EndHitTime   = temp[i - 1].EndHitTime;
                    ho.Type         = temp[i - 1].Type;
                }
                temp.Add(ho);
                k = temp.Count - 1;
            }
        }

        if (m_HitNodeNow.ContainsKey(k) == false)
        {
            m_HitNodeNow.Add(k, tempNode);
        }
        else
        {
            HitNode node = tempNode;
            for (int i = k; i < temp.Count; i++)
            {
                HitNode ttt;
                if (m_HitNodeNow.ContainsKey(i))
                {
                    ttt             = m_HitNodeNow[i];
                    m_HitNodeNow[i] = node;
                    node            = ttt;
                    m_HitNodeNow[i].TextNum(i + 1);
                }
                else
                {
                    m_HitNodeNow.Add(i, node);
                    m_HitNodeNow[i].TextNum(i + 1);
                    break;
                }
            }
        }
        m_ChangeHitNode = false;
        return(temp);
    }