【战斗】战斗拖动显示界面

main
chenyuqi 2024-10-10 17:34:13 +08:00
parent 9dc6379c2a
commit e8575dd5b3
9 changed files with 251 additions and 97 deletions

View File

@ -105,6 +105,7 @@ RectTransform:
m_Children:
- {fileID: 5260383636370141986}
- {fileID: 7654477066102010246}
- {fileID: 7719534918938043390}
- {fileID: 8797797722769182732}
m_Father: {fileID: 6327197852501126704}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -113,6 +114,81 @@ RectTransform:
m_AnchoredPosition: {x: 960, y: 0}
m_SizeDelta: {x: 1920, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2193621023159843838
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7719534918938043390}
- component: {fileID: 8545129227365018213}
- component: {fileID: 9027109718808095091}
m_Layer: 5
m_Name: Image_Paintting
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7719534918938043390
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2193621023159843838}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 365248029760201153}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 220, y: 400}
m_SizeDelta: {x: 710, y: 1440}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8545129227365018213
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2193621023159843838}
m_CullTransparentMesh: 1
--- !u!114 &9027109718808095091
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2193621023159843838}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 0cdafd04e83027142a921aa5bc78cc0b, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &2329328601947059140
GameObject:
m_ObjectHideFlags: 0
@ -817,7 +893,6 @@ GameObject:
m_Component:
- component: {fileID: 8797797722769182732}
- component: {fileID: 9104570272094888291}
- component: {fileID: 1370355139069272167}
m_Layer: 5
m_Name: Image_StandPaintting
m_TagString: Untagged
@ -854,36 +929,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4779928449035185729}
m_CullTransparentMesh: 1
--- !u!114 &1370355139069272167
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4779928449035185729}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 0cdafd04e83027142a921aa5bc78cc0b, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &6556716334687146530
GameObject:
m_ObjectHideFlags: 0

View File

@ -3,16 +3,19 @@ using Gameplay.Guide;
public partial class TeamManager
{
private UIWindow _curFightPosterUI;
public async void OpenFightPosterUI(uint uid)
public async void OpenFightPosterUI(uint uid = 0)
{
if (GetSingleCharacByUid(uid).Type != SingleTeamCharacterInfo.CharacType.Hero)
{
return;
}
// if (GetSingleCharacByUid(uid).Type != SingleTeamCharacterInfo.CharacType.Hero)
// {
// return;
// }
if (_curFightPosterUI == null)
{
_curFightPosterUI = await UIPosterAndSkillInfoController.Open(uid);
if(uid != 0)
_curFightPosterUI = await UIPosterAndSkillInfoController.Open(uid);
else
_curFightPosterUI = await UIPosterAndSkillInfoController.Open();
}
}

View File

@ -1032,6 +1032,7 @@ public class SingleTeamCharacterInfo
{
_vConfigData = configData;
//m_leftBlood = configData.Blood();
OutUid = configData.nID;
m_uid = uid;
m_type = type;
}

View File

@ -18,7 +18,8 @@ public class UIPosterAndSkillInfoController : UIWindow
///Auto Gen Start///
public Button Button_SkillInfoBg;
public Image Image_UI_PosterShadow;
public Image Image_StandPaintting;
public GameObject Image_StandPaintting;
public Image Image_Paintting;
public Image Image_CharacterLogo;
public Image Image_SkillInfoLogo;
public TMP_Text Text_SkillName;
@ -32,10 +33,18 @@ public class UIPosterAndSkillInfoController : UIWindow
///Auto Gen End///
private uint _fightUid;
private CharacterDataInfo _data;
private object _data;
private Image _imgCancel;
private bool _normalOpen;
private EUnitType _unitType;
private enum EUnitType
{
Character,
Vehicle,
Building,
Command
}
public enum OpenType
{
@ -87,18 +96,55 @@ public class UIPosterAndSkillInfoController : UIWindow
if (_openType == OpenType.Normal)
{
var singleCharData = TeamManager.Instance.GetSingleCharacByUid(_fightUid);
_data = CharacterDataInfoManager.Instance.DataDic[singleCharData.OutUid];;
if (CharacterDataInfoManager.Instance.DataDic.TryGetValue(singleCharData.OutUid, out var value))
{
_data = value;
_unitType = EUnitType.Character;
}
else if (VehicleCultivateDataManager.Instance.DataDic.TryGetValue(singleCharData.OutUid, out var value1))
{
_data = value1;
_unitType = EUnitType.Vehicle;
}
else if (FightBuildingDataManager.Instance.DataDic.ContainsKey(singleCharData.OutUid))
{
_unitType = EUnitType.Building;
}
else
{
_unitType = EUnitType.Command;
}
//_data = CharacterDataInfoManager.Instance.DataDic[singleCharData.OutUid];
}
if (_openType == OpenType.PVP)
{
_data = CharacterDataInfoManager.Instance.DataDic[_fightUid];
if (CharacterDataInfoManager.Instance.DataDic.TryGetValue(_fightUid, out var value))
{
_unitType = EUnitType.Character;
_data = value;
}
else if (VehicleCultivateDataManager.Instance.DataDic.TryGetValue(_fightUid, out var value1))
{
_unitType = EUnitType.Vehicle;
_data = value1;
}
else if (FightBuildingDataManager.Instance.DataDic.ContainsKey(_fightUid))
{
_unitType = EUnitType.Building;
}
else
{
_unitType = EUnitType.Command;
}
}
_normalOpen = false;
return;
}
_unitType = EUnitType.Command;
_normalOpen = true;
}
@ -114,18 +160,21 @@ public class UIPosterAndSkillInfoController : UIWindow
protected override void OnShowWindow(object data = null)
{
if (null != LevelManager.Instance.CurrentLevel &&
LevelManager.Instance.CurrentLevel.IsPreparing() &&
_data.Cfg.RoleID != 0)
LevelManager.Instance.CurrentLevel.IsPreparing() )
{
EventManager.Instance.Send(EventManager.EventName.INFIGHT_AUDIO_SELECT_UNIT, _data.Cfg.RoleID);
if (_unitType == EUnitType.Character)
{
if (_data is CharacterDataInfo charData)
{
EventManager.Instance.Send(EventManager.EventName.INFIGHT_AUDIO_SELECT_UNIT, charData.Cfg.RoleID);
}
}
}
if (!_normalOpen)
{
_RefreshPoster();
_RefreshInfo();
_RefreshSkill();
}
_RefreshPoster();
_RefreshInfo();
_RefreshSkill();
InputManager.Instance.OnFingerUpUI += _OnFingerUp;
}
@ -164,47 +213,101 @@ public class UIPosterAndSkillInfoController : UIWindow
}
private void _RefreshPoster()
{
var path = CommonUtils.GetCharacterPicPath(_data.Cfg.RoleID,CommonUtils.ECharacterPicPathType.LevelUp);
_AsyncSetSprite(Image_StandPaintting, path);
if (_unitType == EUnitType.Character)
{
if (_data is CharacterDataInfo data)
{
var path = CommonUtils.GetCharacterPicPath(data.Cfg.RoleID,CommonUtils.ECharacterPicPathType.LevelUp);
_AsyncSetSprite(Image_Paintting, path);
}
return;
}
Image_Paintting.gameObject.SetActive(false);
}
private async void _RefreshInfo()
{
var cfg = _data.Cfg;
var professionData = TableManager.Instance.Tables.JobAttri.GetOrDefault((int)cfg.Job);
// var sprite = await AssetManager.Instance.LoadAssetAsync<Sprite>(professionData.IconPath);
// if (!sprite)
// {
// sprite = await LoadAssetAsync<Sprite>(professionData.IconPath);
// }
var sprite = await LoadAssetAsync<Sprite>(professionData.IconPath);
Image_Profession.sprite = sprite;
Text_CharacterName.text = CommonUtils.GetLocalizeText(cfg.Name);
Text_EnglishName.text = CommonUtils.GetLocalizeText(cfg.NickName);
switch (_unitType)
{
case EUnitType.Character:
if (_data is CharacterDataInfo data)
{
var cfg = data.Cfg;
var professionData = TableManager.Instance.Tables.JobAttri.GetOrDefault((int)cfg.Job);
var sprite = await LoadAssetAsync<Sprite>(professionData.IconPath);
Image_Profession.sprite = sprite;
Text_CharacterName.text = CommonUtils.GetLocalizeText(cfg.Name);
Text_EnglishName.text = CommonUtils.GetLocalizeText(cfg.NickName);
}
break;
case EUnitType.Vehicle:
if (_data is VehicleCultivateData data1)
{
var cfg = data1.Cfg;
var sprite = await LoadAssetAsync<Sprite>("Assets/Art/UI/Texture/CommonTextures/CharacterStatus/InHead/UI_VehicleIcon.png");
Image_Profession.sprite = sprite;
Text_CharacterName.text = CommonUtils.GetLocalizeText(cfg.Name);
Text_EnglishName.text = "";
}
break;
case EUnitType.Building:
break;
case EUnitType.Command:
//指挥官技能信息
break;
}
}
private async void _RefreshSkill()
{
int skillID;
if (_openType == OpenType.PVP)
switch (_unitType)
{
skillID = CommonUtils.GetGameUnitUltraSkillID(_fightUid);
case EUnitType.Character:
if (_openType == OpenType.PVP)
{
skillID = CommonUtils.GetGameUnitUltraSkillID(_fightUid);
}
else
{
var singleUnitData = TeamManager.Instance.GetSingleCharacByUid(_fightUid);
skillID = CommonUtils.GetGameUnitUltraSkillID(singleUnitData.OutUid);
}
break;
case EUnitType.Vehicle:
if (_data is VehicleCultivateData dataV)
{
skillID = VehicleDataHelper.GetVehicleSkillId((int)dataV.nID);
}
else
{
skillID = 0;
}
break;
default:
//指挥官技能信息
skillID = 0;
break;
}
if (skillID != 0)
{
DataSkill skillData = TableManager.Instance.Tables.SkillConfig?.Get(skillID);
if (skillData != null)
{
Text_SkillName.text = CommonUtils.GetLocalizeText(E_LocalizePrefix.skill, skillID);
Text_SkillCD.text = CommonUtils.GetLocalizeText("time_sec", skillData.CDTime);
Text_SkillInfoDes.text = CommonUtils.GetLocalizeText(E_LocalizePrefix.skill_desc, skillID);
var skillIconPath = CommonUtils.GetSkillIconByID(skillID);
Image_CharacterLogo.sprite = await LoadAssetAsync<Sprite>(skillIconPath);
}
}
else
{
var singleUnitData = TeamManager.Instance.GetSingleCharacByUid(_fightUid);
skillID = CommonUtils.GetGameUnitUltraSkillID(singleUnitData.OutUid);
}
DataSkill skillData = TableManager.Instance.Tables.SkillConfig?.Get(skillID);
if (skillData != null)
{
Text_SkillName.text = CommonUtils.GetLocalizeText(E_LocalizePrefix.skill, skillID);
Text_SkillCD.text = CommonUtils.GetLocalizeText("time_sec", skillData.CDTime);
Text_SkillInfoDes.text = CommonUtils.GetLocalizeText(E_LocalizePrefix.skill_desc, skillID);
var skillIconPath = CommonUtils.GetSkillIconByID(skillID);
Image_CharacterLogo.sprite = await LoadAssetAsync<Sprite>(skillIconPath);
CommonUtils.GetGameObject(Image_StandPaintting.gameObject, "ImageBG").SetActive(false);
}
}

View File

@ -1680,7 +1680,7 @@ public class UITeamFightController : UIWindow
{
if (_dragingUid == 0)
{
if(m_curSkillState == SkillPutState.Dragging)
if(m_curSkillState == SkillPutState.Dragging || UICommandSkillNode.IsDraggingSkill)
TeamManager.Instance.SetCancelImageShow();
return;
}

View File

@ -20,16 +20,18 @@ public class UICommandSkillNode: UINode
private UIWindow _bindWindow;
public static bool IsDraggingSkill => _isDraggingSkill;
private float _curCdProgress;
private bool _isInCd;
private int _skillID;
private bool _isDraggingSkill;
private static bool _isDraggingSkill;
public override void OnAwake()
{
Button_CMSkillPress.AddBeginDrag(OnOutDrag);
InputManager.Instance.OnFingerUpUI += OnPointUp;
_isDraggingSkill = false;
//Button_CMSkillPress.AddPointUpListener(OnPointUp);
}
@ -49,6 +51,8 @@ public class UICommandSkillNode: UINode
{
InputManager.Instance.OnFingerUpUI -= OnPointUp;
}
_isDraggingSkill = false;
}
public override void SetData(object data)
@ -157,6 +161,7 @@ public class UICommandSkillNode: UINode
}
_isDraggingSkill = true;
TeamManager.Instance.OpenFightPosterUI();
window.OnOutDragNode();
}
catch (Exception e)
@ -173,6 +178,7 @@ public class UICommandSkillNode: UINode
{
CameraController.FingerMoveEnable = true;
var window = (UI_StartBtn_CMSBtnController)_bindWindow;
TeamManager.Instance.CloseFightPosterUI();
if (window != null)
{
window.OnPointUp();

View File

@ -363,14 +363,15 @@ public class UI_StartBtn_CMSBtnController : UIWindow{
try
{
var rect = GoCancelSkill.GetComponent<RectTransform>();
bool isCancel = RectTransformUtility.RectangleContainsScreenPoint(rect,
InputManager.Instance.GetTouchPosition(),
CameraManager.Instance.UICamera);
if (!GoCancelSkill.activeInHierarchy)
{
isCancel = false;
}
// bool isCancel = RectTransformUtility.RectangleContainsScreenPoint(rect,
// InputManager.Instance.GetTouchPosition(),
// CameraManager.Instance.UICamera);
//
// if (!GoCancelSkill.activeInHierarchy)
// {
// isCancel = false;
// }
bool isCancel = TeamManager.Instance.CheckIsOnCancel();
var data = new EDReleasePlayerSkill();
data.isCancel = isCancel;

View File

@ -438,17 +438,11 @@ public class UI_DefendSettingController : UIWindow
HideWindow();
if (_curSelectID > 0)
{
if (CharacterDataInfoManager.Instance.DataDic.ContainsKey(_curSelectID))
{
await UIPosterAndSkillInfoController.Open(_curSelectID, UIPosterAndSkillInfoController.OpenType.PVP);
}
await UIPosterAndSkillInfoController.Open(_curSelectID, UIPosterAndSkillInfoController.OpenType.PVP);
}
else
{
if (CharacterDataInfoManager.Instance.DataDic.ContainsKey(selectID))
{
await UIPosterAndSkillInfoController.Open(selectID, UIPosterAndSkillInfoController.OpenType.PVP);
}
await UIPosterAndSkillInfoController.Open(selectID, UIPosterAndSkillInfoController.OpenType.PVP);
}
}

View File

@ -17,7 +17,8 @@ public class UIPosterAndSkillInfoBinder
{
window.Button_SkillInfoBg = window.GetComponent<Button>("GameObj_SkillInfo/Button_SkillInfoBg");
window.Image_UI_PosterShadow = window.GetComponent<Image>("GameObj_SkillInfo/Image_UI_PosterShadow");
window.Image_StandPaintting = window.GetComponent<Image>("GameObj_SkillInfo/Image_StandPaintting");
window.Image_Paintting = window.GetComponent<Image>("GameObj_SkillInfo/Image_Paintting");
window.Image_StandPaintting = window.FindObj("GameObj_SkillInfo/Image_StandPaintting");
window.Image_CharacterLogo = window.GetComponent<Image>("GameObj_SkillInfo/Image_StandPaintting/ImageBG/Image_CharacterLogo");
window.Image_SkillInfoLogo = window.GetComponent<Image>("GameObj_SkillInfo/Image_StandPaintting/ImageBG/Image_SkillInfoLogo");
window.Text_SkillName = window.GetComponent<TMP_Text>("GameObj_SkillInfo/Image_StandPaintting/ImageBG/Image_SkillInfoLogo/Text_SkillName");