public void Update(float rate, MiniMapPlayMarkInfo data) { if (data.Color.Equals(_color) && rate.Equals(_rate) && data.Pos.Equals(_pos)) { return; } // _statue = teamPlayInfo.Statue; _color = data.Color; _pos = data.Pos; _rate = rate; // if (_statue == MiniMapPlayStatue.DEAD) //死亡 // { // UIUtils.SetActive(tran, false); // } // else // { UIUtils.SetActive(tran, true); // var temperSprite = SpriteComon.GetInstance().GetSpriteByName("fix_00"); // if (temperSprite != null && temperSprite != img.sprite) // img.sprite = temperSprite; img.color = _color; var pos = data.Pos * rate; rectTransform.anchoredPosition = pos; //更新标记位置 // } }
private void RefreshMarkItem(long playerId, MiniMapPlayMarkInfo markData, float rate) { MapMarkItem markItem; markItemDic.TryGetValue(playerId, out markItem); if (markItem == null) { markItem = new MapMarkItem(GameObject.Instantiate(markModel, tran, true)); markItemDic[playerId] = markItem; } markItem.SetActive(true); markItem.Update(rate, markData); }
private void RefreshMarkItem(Transform tran, MiniMapPlayMarkInfo data) { playMarkUtil.UpdateMarkItemCommon(markPool, tran, rate, data, markRefePosByRice, MaxMapRepresentWHByRice, markRefePosByPixel); }
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); } }