private void UpdateGridCallBack(int index, bool vertical) { var tempValue = index % 10; if (tempValue == 0) //千米级别的线条才创建 { var tran = gridPool.SpawnGo(); RefreshLineModel(tran, index, vertical); } }
private void RefreshHurted() { if (adapter.GetPlayerEntity().gamePlay.IsLifeState(EPlayerLifeState.Dead)) { _viewModel.hurtedRootActive = false; foreach (var key in hurtedRecord.Keys) { RefreshDisappearHurtedItem(hurtedRecord[key]); } this.OnGameobjectDestoryed(); adapter.HurtedDataList.Clear(); } else { _viewModel.hurtedRootActive = true; //更新添加的和现有的 foreach (var data in adapter.HurtedDataList) { if (!hurtedRecord.ContainsKey(data.Key)) { var record = new HurtedTweenData(data.Key, null, pool.SpawnGo(), data.Value); hurtedRecord.Add(data.Key, record); } else { var record = hurtedRecord[data.Key]; if (record != null) { record.Data.DamageSrcPos = data.Value.DamageSrcPos; record.Data.HurtedAngel = data.Value.HurtedAngel; record.Data.HurtedNum = data.Value.HurtedNum; if (record.Tween != null) { record.Tween.Kill(); record.Tween = null; } } } RefreshHurtedItem(hurtedRecord[data.Key]); } //更新删除的 foreach (var record in hurtedRecord) { //找到是否有消失的 伤害 if (!adapter.HurtedDataList.ContainsKey(record.Key)) { RefreshDisappearHurtedItem(hurtedRecord[record.Key]); } } adapter.HurtedDataList.Clear(); } }
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 InitPlayerItemList() { if (playItemModel && playItemRoot) { UIUtils.SetActive(playItemModel, false); playPool = new UIUtils.SimplePool(playItemModel, playItemRoot); if (playMarkUtil == null) { playMarkUtil = new PlayMarkCommn(adapter); } playMarkUtil.SetPlayAction((info) => { var tran = playPool.SpawnGo(); var playData = (MiniMapTeamPlayInfo)info; RefreshPlayTeamItem(tran, playData); }); } }
private void InitMarkItemList() { if (markRoot && markModel) { if (playMarkUtil == null) { playMarkUtil = new PlayMarkCommn(adapter); } playMarkUtil.SetMarkAction((info) => { var tran = markPool.SpawnGo(); var markData = (MiniMapPlayMarkInfo)info; RefreshMarkItem(tran, markData); }); UIUtils.SetActive(markModel, false); markPool = new UIUtils.SimplePool(markModel, markRoot); } }
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); }