public void UpdateMarkItemCommon(UIUtils.SimplePool markPool, Transform tran, float rate, MiniMapPlayMarkInfo data, Vector2 centerPoint, float centerWidth, Vector2 refePosByPixel) { if (adapter == null) { return; } var tranRT = tran.GetComponent <RectTransform>(); var offset = new Vector2(tranRT.sizeDelta.x, tranRT.sizeDelta.y) / (2 * rate); var result = UIUtils.MathUtil.IsInSquare(centerPoint, centerWidth, centerWidth, offset, true, data.Pos); if (!result.IsContact) //地图内 { MiniMapPlayStatue statue = MiniMapPlayStatue.NONE; Color color = Color.white; foreach (var item in adapter.TeamInfos) { if (data.Num == item.Num) { statue = item.Statue; color = item.Color; break; } } if (statue == MiniMapPlayStatue.DEAD) //死亡 { markPool.DespawnGo(tran); } else { var img = tran.GetComponent <Image>(); // var temperSprite = SpriteComon.GetInstance().GetSpriteByName("fix_00"); // if (temperSprite != null && temperSprite != img.sprite) // img.sprite = temperSprite; img.color = color; var pos = data.Pos * rate; tran.GetComponent <RectTransform>().anchoredPosition = refePosByPixel + pos; //更新标记位置 } } else { markPool.DespawnGo(tran); } }
private void UpdatePlayFaceDirection(MiniMapTeamPlayInfo data) { if (data.Statue.Equals(_playStatue) && data.FaceDirection.Equals(_faceDirection)) { return; } _playStatue = data.Statue; _faceDirection = data.FaceDirection; if (data.Statue != MiniMapPlayStatue.DEAD) //非死亡状态 { UIUtils.SetActive(faceDirectionTf, true); float angular = data.FaceDirection % 360; angular = angular < 0 ? 360 + angular : angular; faceDirectionTf.localEulerAngles = new UnityEngine.Vector3(0, 0, -angular); } else { UIUtils.SetActive(faceDirectionTf, false); } }
private void UpdatePlayStatue(ref Vector2 referPos, MiniMapTeamPlayInfo data, MapLevel mapLevel) { var shiftVec = data.Pos.ShiftedUIVector2(); if (referPos.Equals(_referPos) && data.Statue.Equals(_miniMapPlayStatue) && shiftVec.Equals(_infoPos) && data.ShootingCount.Equals(_shootingCount)) { 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 { // UIUtils.SetActive(loftIcon, true); // var temperSprite = SpriteComon.GetInstance().GetSpriteByName("Loft_icon"); // if (temperSprite != null && loftIconImage.sprite != temperSprite) // { // loftIconImage.sprite = temperSprite; // } // // if (data.Pos.y > referPos.y) //上方 // { // if (loftIcon.transform.localScale != Vector3.one) // loftIcon.transform.localScale = Vector3.one; // } // else if (data.Pos.y <= referPos.y) //下方 // { // if (loftIcon.transform.localScale != new UnityEngine.Vector3(1, -1, 1)) // loftIcon.transform.localScale = new UnityEngine.Vector3(1, -1, 1); // } } 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; } }
public MiniMapTeamPlayInfo(long playerId, int entityId, bool isPlayer, int num, Color color, MiniMapPlayStatue statue, Vector2 pos, float faceDirection, List <MiniMapPlayMarkInfo> markList, bool isShooting, int shootingCount, string playerName, int curHp, int maxHp, int curHpInHurted, bool isMark, Vector3 topPos) { this.PlayerId = playerId; this.EntityId = entityId; this.IsPlayer = isPlayer; this.Num = num; this.Color = color; this.Statue = statue; this.Pos = new MapFixedVector2(pos); this.FaceDirection = faceDirection; this.MarkList = markList; this.IsShooting = isShooting; this.ShootingCount = shootingCount; this.PlayerName = playerName; this.CurHp = curHp; this.MaxHp = maxHp; this.CurHpInHurted = curHpInHurted; this.IsMark = isMark; this.TopPos = topPos; }