/// <summary> /// 把trans设置为目标,如果表内有空的,那么修改空的,否则新建一个 /// </summary> /// <param name="trans"></param> /// <param name="size"></param> private void SetArrowTarget(Transform trans, float size) { // 先循环找无目标的箭头 foreach (var iter in BattleArrowGroupList) { if (iter == null) { continue; } Transform parentTrans = iter.GetParent(); if (parentTrans != null) { continue; } iter.ChangeParent(trans, size); return; } // 没有找到,那么新建一个 BattleArrowGroupList.Add(BattleArrowGroup.InitArrowGroup(trans, size, true)); }
/// <summary> /// 显示trans所属队伍的选中状态,关闭所属队伍列表内其他队伍的选中状态 /// </summary> /// <param name="trans"></param> private void ShowSelect(Transform trans) { if (trans == null) { return; } Dictionary <int, TeamDisplay> teamList = GetTeamDisplayList(trans); TeamDisplay display = GetTeamDisplay(trans); if (display == null) { return; } ResetSelect(teamList, display.IsPlayerShip()); display.SetSelect(true); if (!display.IsPlayerShip()) { return; } GameObject teamGo = display.GetTeamGo(); if (teamGo == null) { return; } Transform teamGoTrans = teamGo.transform; ClientShip ship = display.GetShip(); float vol = ship.Reference.vol; if (SelectedPlayerShipArrowGroup_ == null) { SelectedPlayerShipArrowGroup_ = BattleArrowGroup.InitArrowGroup(teamGoTrans, vol, false); } else { SelectedPlayerShipArrowGroup_.ChangeParent(teamGoTrans, vol); } }