private void UpdateGrids() { if (lineModel == null || lineRoot == null) { return; } if (MapLevel.Min.Equals(adapter.MapLevel)) { lineRoot.gameObject.SetActive(false); } else { lineRoot.gameObject.SetActive(true); if (lastMaskCenterPInMapByRice == maskCenterPInMapByRice) { return; } else { lastMaskCenterPInMapByRice = maskCenterPInMapByRice; } gridPool.DespawnAllGo(); gridUtil.UpdateGrid((int)MaxMapRealWHByRice, (int)MaxMapRepresentWHByRice, maskCenterPInMapByRice); } }
private void UpdatePlayerItemList() { if (playItemRoot == null || playItemModel == null || playPool == null) { return; } playPool.DespawnAllGo(); playMarkUtil.UpdatePlayList(); }
private void UpdateMarkItemList() { if (markModel == null || markRoot == null || markPool == null) { return; } markPool.DespawnAllGo(); playMarkUtil.UpdateMarkList(); }
private void RefreshGUI() { if (!isGameObjectCreated) { return; } if (infoItemRoot == null || infoItemModel == null) { return; } var modelId = adapter.ModeID; if (modelId == 1) //单人模式 { _viewModel.rootActiveSelf = false; } else //其他模式 { _viewModel.rootActiveSelf = true; var datas = adapter.TeamPlayerInfos; if (datas.Count > 0) { pool.DespawnAllGo(); teamInfoHeight = 0; //排序 保证序号从1开始向下 datas.Sort((left, right) => { if (left.Num > right.Num) { return(1); } else if (left.Num == right.Num) { return(0); } else { return(-1); } }); for (int i = 0; i < datas.Count; i++) { var tran = pool.SpawnGo(); RefreshTeamItem(tran, datas[i]); } } } }
private void UpateAirPlane(float interval) { if (kTouModel == null || kTouRoot == null) { return; } UIUtils.SetActive(kTouModel, false); var planeData = adapter.PlaneData; if (planeData.Type == 0) //目前无飞机 { if (planeData.Type != lastPlaneType) { UIUtils.SetActive(airPlane, false); airPlanePool.DespawnAllGo(); lastPlaneType = planeData.Type; } isNeedChangeSprite = false; } else if (planeData.Type == 1) //空投机 { if (planeData.Type != lastPlaneType) { UIUtils.SetActive(airPlane, true); lastPlaneType = planeData.Type; } //更新飞机位置 Vector2 planePosByPixel = (planeData.Pos.ShiftedUIVector2() - maskCenterPInMapByRice) * rate; airPlaneRT.anchoredPosition = planePosByPixel; //更新飞机方向 float delataAngel = planeData.Direction - lastKongTouDirection; airPlane.transform.RotateAround(kTouRoot.transform.position, UnityEngine.Vector3.forward, -delataAngel); lastKongTouDirection = planeData.Direction; airPlanePool.DespawnAllGo(); List <MapFixedVector2> list = adapter.KongTouList(); foreach (var item in list) //更新空投点 { var tran = airPlanePool.SpawnGo(); //设置空投点的位置 Vector2 kTouPosByPixel = (item.ShiftedUIVector2() - maskCenterPInMapByRice) * rate; tran.GetComponent <RectTransform>().anchoredPosition = kTouPosByPixel; } isNeedChangeSprite = true; } else if (planeData.Type == 2) //运输机 { if (planeData.Type != lastPlaneType) { UIUtils.SetActive(airPlane, true); airPlanePool.DespawnAllGo(); lastPlaneType = planeData.Type; } //更新飞机位置 Vector2 planePosByPixel = (planeData.Pos.ShiftedUIVector2() - maskCenterPInMapByRice) * rate; airPlaneRT.anchoredPosition = planePosByPixel; //更新飞机方向 float delataAngel = planeData.Direction - lastKongTouDirection; airPlane.transform.RotateAround(kTouRoot.transform.position, UnityEngine.Vector3.forward, -delataAngel); lastKongTouDirection = planeData.Direction; isNeedChangeSprite = false; } UpdateKTouImg(interval); }