Пример #1
0
 protected void GetSelfPosition()
 {
     //var data = adapter.ObservePlayer;
     //selfPlayPos = data.Pos.ShiftedUIVector2();
     selfPlayPos   = adapter.CurPlayerPos;
     selfPlayPos3D = adapter.CurPlayerPos3D;
 }
Пример #2
0
 public SuoDuUiAdapter(Contexts contexts)
 {
     _contexts  = contexts;
     _playerPos = new MapFixedVector3(0, 0, 0);
 }
Пример #3
0
        public void Update(List <MiniMapTeamPlayInfo> TeamInfos, Vector2 selfPlayPos, float rate, float miniMapRepresentWHByRice, MapLevel mapLevel, MapFixedVector3 selfPlayPos3D)
        {
            if (TeamInfos.Count > 0)
            {
                isNoTeamPlayer = (TeamInfos.Count == 1) ? true : false;
                for (int i = 0; i < TeamInfos.Count; i++)
                {
                    MiniMapTeamPlayInfo data = TeamInfos[i];
                    PlayerItem          playerItem;
                    playerItemDic.TryGetValue(data.PlayerId, out playerItem);
                    if (playerItem == null)
                    {
                        playerItem = new PlayerItem(GameObject.Instantiate(playItemModel, tran, true));
                        playerItemDic[data.PlayerId] = playerItem;
                    }

                    playerItem.IsOutDate = false;
                    playerItem.Update(data, rate, selfPlayPos, miniMapRepresentWHByRice, mapLevel, isNoTeamPlayer, selfPlayPos3D);
                }
            }

            ClearOutDateItem();
        }
Пример #4
0
        private void UpdatePlayStatue(ref Vector2 referPos, MiniMapTeamPlayInfo data, MapLevel mapLevel, MapFixedVector3 selfPlayPos3D)
        {
            var shiftVec = data.Pos.ShiftedUIVector2();

            if (referPos.Equals(_referPos) && data.Statue.Equals(_miniMapPlayStatue) &&
                shiftVec.Equals(_infoPos) && data.ShootingCount.Equals(_shootingCount) && _selfPlayPos3D.Equals(selfPlayPos3D))
            {
                return;
            }
            _referPos          = referPos;
            _miniMapPlayStatue = data.Statue;
            _infoPos           = shiftVec;
            _shootingCount     = data.ShootingCount;

            switch (data.Statue)
            {
            case MiniMapPlayStatue.NORMAL:        //常态
            {
                UIUtils.SetActive(number, !MapLevel.Min.Equals(mapLevel));
                UIUtils.SetActive(stateIcon, false);
                if (data.IsPlayer)
                {
                    UIUtils.SetActive(loftIcon, false);
                }
                else
                {
                    var temperSprite = SpriteComon.GetInstance().GetSpriteByName("Loft_icon");
                    if (temperSprite != null && loftIconImage.sprite != temperSprite)
                    {
                        loftIconImage.sprite = temperSprite;
                    }

                    if (data.Pos3D.Vector.y > selfPlayPos3D.Vector.y + 2.5f)               //上方
                    {
                        if (!loftIcon.transform.localScale.y.Equals(1))
                        {
                            loftIcon.transform.localScale = Vector3.one;
                        }
                        UIUtils.SetActive(loftIcon, true);
                    }
                    else if (data.Pos3D.Vector.y < selfPlayPos3D.Vector.y - 2.5f)           //下方
                    {
                        if (!loftIcon.transform.localScale.y.Equals(-1))
                        {
                            loftIcon.transform.localScale = new UnityEngine.Vector3(1, -1, 1);
                        }
                        UIUtils.SetActive(loftIcon, true);
                    }
                    else
                    {
                        UIUtils.SetActive(loftIcon, false);
                    }
                }

                if (data.ShootingCount > 0)           //在射击状态下
                {
                    if (!tranCTween.ContainsKey(tran) || tranCTween[tran] == null)
                    {
                        var temperTween = UIUtils.CallTween(1, 1.5f, (value) =>
                            {
                                bgRectTf.localScale = new UnityEngine.Vector3((float)value, (float)value, 1.0f);
                            },
                                                            (value) =>
                            {
                                bgRectTf.localScale = Vector3.one;
                                data.ShootingCount--;
                                tranCTween[tran].Kill();
                                tranCTween[tran] = null;
                            },
                                                            0.1f);

                        if (!tranCTween.ContainsKey(tran))
                        {
                            tranCTween.Add(tran, temperTween);
                        }
                        else
                        {
                            tranCTween[tran] = temperTween;
                        }
                    }
                }
                else
                {
                    if (tranCTween.ContainsKey(tran) && tranCTween[tran] != null)
                    {
                        tranCTween[tran].Kill();
                        tranCTween[tran] = null;
                    }
                    if (bgRectTf.localScale != Vector3.one)
                    {
                        bgRectTf.localScale = Vector3.one;
                    }
                }
            }
            break;

            case MiniMapPlayStatue.TIAOSAN:        //跳伞
            {
                UIUtils.SetActive(number, false);
                UIUtils.SetActive(loftIcon, false);
                UIUtils.SetActive(stateIcon, true);

                var temperSprite = SpriteComon.GetInstance().GetSpriteByName("icon_parachute");
                if (temperSprite != null && stateIconImage.sprite != temperSprite)
                {
                    stateIconImage.sprite = temperSprite;
                }
            }
            break;

            case MiniMapPlayStatue.ZAIJU:        //载具
            {
                UIUtils.SetActive(number, false);
                UIUtils.SetActive(loftIcon, false);
                UIUtils.SetActive(stateIcon, true);

                var temperSprite = SpriteComon.GetInstance().GetSpriteByName("icon_drive");
                if (temperSprite != null && stateIconImage.sprite != temperSprite)
                {
                    stateIconImage.sprite = temperSprite;
                }
            }
            break;

            case MiniMapPlayStatue.HURTED:        //受伤
            {
                UIUtils.SetActive(number, false);
                UIUtils.SetActive(loftIcon, false);
                UIUtils.SetActive(stateIcon, true);

                var temperSprite = SpriteComon.GetInstance().GetSpriteByName("icon_hurt");
                if (temperSprite != null && stateIconImage.sprite != temperSprite)
                {
                    stateIconImage.sprite = temperSprite;
                }
            }
            break;

            case MiniMapPlayStatue.DEAD:        //死亡
            {
                UIUtils.SetActive(number, false);
                UIUtils.SetActive(loftIcon, false);
                UIUtils.SetActive(stateIcon, true);

                var temperSprite = SpriteComon.GetInstance().GetSpriteByName("icon_die");
                if (temperSprite != null && stateIconImage.sprite != temperSprite)
                {
                    stateIconImage.sprite = temperSprite;
                }
            }
            break;

            default:
            {
                UIUtils.SetActive(number, false);
                UIUtils.SetActive(loftIcon, false);
                UIUtils.SetActive(stateIcon, false);
            }
            break;
            }
        }
Пример #5
0
 public void Update(MiniMapTeamPlayInfo data, float rate, Vector2 selfPlayPos, float miniMapRepresentWHByRice, MapLevel mapLevel, bool isNoTeamPlayer, MapFixedVector3 selfPlayPos3D)
 {
     UodateLocation(data, rate, ref selfPlayPos, miniMapRepresentWHByRice);
     UpdatePlayNum(data, mapLevel, isNoTeamPlayer);
     UpdatePlayStatue(ref selfPlayPos, data, mapLevel, selfPlayPos3D);
     UpdatePlayFaceDirection(data);
 }
Пример #6
0
 public AirPlaneData(int type, MapFixedVector3 pos, float direction)
 {
     this.type      = type;
     this.pos       = pos;
     this.direction = direction;
 }