编队列表选中功能完善
This commit is contained in:
@@ -335,7 +335,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &16906197
|
--- !u!224 &16906197
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -1615,10 +1615,10 @@ RectTransform:
|
|||||||
- {fileID: 960238621}
|
- {fileID: 960238621}
|
||||||
m_Father: {fileID: 1704085229}
|
m_Father: {fileID: 1704085229}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 276, y: -366}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 180, y: 240}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &190161137
|
--- !u!1 &190161137
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -1968,10 +1968,10 @@ RectTransform:
|
|||||||
- {fileID: 1400477542}
|
- {fileID: 1400477542}
|
||||||
m_Father: {fileID: 1704085229}
|
m_Father: {fileID: 1704085229}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 94, y: -366}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 180, y: 240}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &269656317
|
--- !u!1 &269656317
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -2470,10 +2470,10 @@ RectTransform:
|
|||||||
- {fileID: 269656318}
|
- {fileID: 269656318}
|
||||||
m_Father: {fileID: 1704085229}
|
m_Father: {fileID: 1704085229}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 458, y: -124}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 180, y: 240}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &323084114
|
--- !u!1 &323084114
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -8655,7 +8655,19 @@ MonoBehaviour:
|
|||||||
m_TargetGraphic: {fileID: 888783199}
|
m_TargetGraphic: {fileID: 888783199}
|
||||||
m_OnClick:
|
m_OnClick:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 827262133}
|
||||||
|
m_TargetAssemblyTypeName: teamSettingPanel, Assembly-CSharp
|
||||||
|
m_MethodName: downChangeCharcterIndex
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
--- !u!114 &888783199
|
--- !u!114 &888783199
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -9324,10 +9336,10 @@ RectTransform:
|
|||||||
- {fileID: 341481672}
|
- {fileID: 341481672}
|
||||||
m_Father: {fileID: 1704085229}
|
m_Father: {fileID: 1704085229}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 276, y: -124}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 180, y: 240}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &928623233
|
--- !u!1 &928623233
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -12963,7 +12975,19 @@ MonoBehaviour:
|
|||||||
m_TargetGraphic: {fileID: 1387409702}
|
m_TargetGraphic: {fileID: 1387409702}
|
||||||
m_OnClick:
|
m_OnClick:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 827262133}
|
||||||
|
m_TargetAssemblyTypeName: teamSettingPanel, Assembly-CSharp
|
||||||
|
m_MethodName: upChangeCharcterIndex
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
--- !u!114 &1387409702
|
--- !u!114 &1387409702
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -13373,10 +13397,10 @@ RectTransform:
|
|||||||
- {fileID: 1224014391}
|
- {fileID: 1224014391}
|
||||||
m_Father: {fileID: 1704085229}
|
m_Father: {fileID: 1704085229}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 458, y: -366}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 180, y: 240}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &1466300096
|
--- !u!1 &1466300096
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -16060,7 +16084,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0.00082605326}
|
m_AnchoredPosition: {x: 0, y: 0.00082605326}
|
||||||
m_SizeDelta: {x: -0.000061035, y: 486}
|
m_SizeDelta: {x: -0.000061035, y: 0}
|
||||||
m_Pivot: {x: 0, y: 1}
|
m_Pivot: {x: 0, y: 1}
|
||||||
--- !u!114 &1704085230
|
--- !u!114 &1704085230
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@@ -18528,10 +18552,10 @@ RectTransform:
|
|||||||
- {fileID: 1005912080}
|
- {fileID: 1005912080}
|
||||||
m_Father: {fileID: 1704085229}
|
m_Father: {fileID: 1704085229}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 94, y: -124}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 180, y: 240}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &1987921078
|
--- !u!1 &1987921078
|
||||||
GameObject:
|
GameObject:
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
//适用于编队 列表
|
||||||
|
public class teamCharacterView : MonoBehaviour
|
||||||
|
{
|
||||||
|
public GameObject character;
|
||||||
|
public GameObject controlButton;
|
||||||
|
public bool isSelected =false;
|
||||||
|
public int listIndex;
|
||||||
|
// private TeamManager teamManager= TeamManager.Instance;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
controlButton.SetActive(isSelected);
|
||||||
|
Debug.Log("teamCharacterView Start,"+isSelected+","+listIndex);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 单机team列表内对象时触发选定
|
||||||
|
/// </summary>
|
||||||
|
public void SetSelected()
|
||||||
|
{
|
||||||
|
isSelected = true;
|
||||||
|
controlButton.SetActive(true);
|
||||||
|
TeamManager.Instance.setCurrentSelectedCharacterInTeam(listIndex);
|
||||||
|
}
|
||||||
|
public void SetUnSelected()
|
||||||
|
{
|
||||||
|
isSelected = false;
|
||||||
|
controlButton.SetActive(false);
|
||||||
|
if(TeamManager.Instance.currentSelectedCharacter==this.listIndex)
|
||||||
|
TeamManager.Instance.setCurrentSelectedCharacterInTeam(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5fe33ff09d0ea4848ac88809df94dbc8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -11,14 +11,47 @@ public class teamSettingPanel : MonoBehaviour
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
public GameObject[] teamCharactersObj;
|
public GameObject[] teamCharactersObj;
|
||||||
|
|
||||||
|
private TeamManager teamManager;
|
||||||
|
|
||||||
|
public static teamSettingPanel Instance{get;private set;}
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if (Instance == null)
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
// teamSettingPanelObj.SetActive(false);
|
teamManager = TeamManager.Instance;
|
||||||
|
if(teamManager!=null)
|
||||||
|
{
|
||||||
|
teamManager.OnSelectedCharacterChanged += updateTeamCharacterSelectedStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
if (teamManager != null)
|
||||||
|
{
|
||||||
|
teamManager.OnSelectedCharacterChanged -= updateTeamCharacterSelectedStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void openTeamSettingPanel()
|
public void openTeamSettingPanel()
|
||||||
{
|
{
|
||||||
Debug.Log("打开编队设置面板");
|
Debug.Log("打开编队设置面板");
|
||||||
//todo:向编队管理类拉取已有编队信息,把视图初始化为对应的编队信息
|
//todo:向teamManager拉取已有编队信息,把视图初始化为对应的编队信息
|
||||||
|
List<Character> currentTeam = teamManager.getCurrentTeam();
|
||||||
|
foreach (Character character in currentTeam)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//根据获取的队伍信息处理ui组件
|
||||||
//可在此补充ui动画信息
|
//可在此补充ui动画信息
|
||||||
teamSettingPanelObj.SetActive(true);
|
teamSettingPanelObj.SetActive(true);
|
||||||
}
|
}
|
||||||
@@ -29,4 +62,35 @@ public class teamSettingPanel : MonoBehaviour
|
|||||||
//todo:向保存编队信息的类获取编队信息,然后重新处理teamElementsObj的信息
|
//todo:向保存编队信息的类获取编队信息,然后重新处理teamElementsObj的信息
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 将当前角色向下交换位置
|
||||||
|
/// </summary>
|
||||||
|
public void downChangeCharcterIndex()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public void upChangeCharcterIndex()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 用于保证team内对象的选中状态一致
|
||||||
|
/// </summary>
|
||||||
|
public void updateTeamCharacterSelectedStatus()
|
||||||
|
{
|
||||||
|
int currentSelectedCharacter = teamManager.currentSelectedCharacter;
|
||||||
|
Debug.Log(currentSelectedCharacter+" "+$"{teamElementsObj.Length}");
|
||||||
|
for (int i = 0; i < teamElementsObj.Length; i++)
|
||||||
|
{
|
||||||
|
if (i != currentSelectedCharacter)
|
||||||
|
{
|
||||||
|
teamCharacterView teamCharacterView = teamElementsObj[i].GetComponent<teamCharacterView>();
|
||||||
|
if(teamCharacterView!=null)
|
||||||
|
{
|
||||||
|
teamCharacterView.SetUnSelected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Character
|
||||||
|
{
|
||||||
|
public string name{get; set;}
|
||||||
|
public string occupation{get; set;}
|
||||||
|
public int boundaryLevel{get; set;}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bae42af9bcfec5f46a3025f40ce5bd7b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class TeamManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public static TeamManager Instance {get; private set;}
|
||||||
|
|
||||||
|
public teamSettingPanel teamSettingPanelInstance= teamSettingPanel.Instance;
|
||||||
|
//当前玩家存档下的所有编队配置
|
||||||
|
public Dictionary<int, List<Character>> currentTeamSettings = new Dictionary<int, List<Character>>();
|
||||||
|
/// <summary>
|
||||||
|
/// 根据此字段来在编队信息页显示已有编队
|
||||||
|
/// </summary>
|
||||||
|
public int currentSelectedTeam = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 记录被选中的编队中角色的索引,用于处理队列位置交换的逻辑。-1表示无角色被选中
|
||||||
|
/// </summary>
|
||||||
|
public int currentSelectedCharacter = -1;
|
||||||
|
/// <summary>
|
||||||
|
/// 在修改被选中的编队中角色的索引时触发
|
||||||
|
/// </summary>
|
||||||
|
public event Action OnSelectedCharacterChanged;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if (Instance == null)
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
if(teamSettingPanelInstance == null)
|
||||||
|
{
|
||||||
|
teamSettingPanelInstance = teamSettingPanel.Instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 读取玩家存档信息后可直接在此写入编队信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="playerTeamSettings"></param>
|
||||||
|
public void setcurrentTeamSettings(Dictionary<int,List<Character>> playerTeamSettings)
|
||||||
|
{
|
||||||
|
currentTeamSettings = playerTeamSettings;
|
||||||
|
}
|
||||||
|
public List<Character> getCurrentTeam()
|
||||||
|
{
|
||||||
|
return currentTeamSettings[currentSelectedTeam];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentSelectedCharacterInTeam(int characterIndex)
|
||||||
|
{
|
||||||
|
if (characterIndex != currentSelectedCharacter)
|
||||||
|
{
|
||||||
|
currentSelectedCharacter = characterIndex;
|
||||||
|
OnSelectedCharacterChanged?.Invoke(); // 触发事件
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: debeba9c3c2f7334ab04c769534a1f85
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user