2
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b67e9c2e3d14c514b93428b432d5cc25
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LevelUp : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
UIManager.Instance.Show<UILevelUp>();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf0e17ad5b66e8c4398d696d6c42e86a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 831a08ac5bb2de440acde27635619af9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12c2b15ec8c03cf48ae095dfbb940ab7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,210 +0,0 @@
|
||||
using Manager;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class PlayerControler : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private InputActions inputActions;
|
||||
[SerializeField] public Animator animator;
|
||||
[SerializeField] private Rigidbody2D rb;
|
||||
[SerializeField] private BoxCollider2D bc;
|
||||
|
||||
private CameraVR cameraVR;
|
||||
|
||||
[Header("正常速度")]
|
||||
[SerializeField] private float normalSpeed;
|
||||
Vector2 InputDir;//移动方向
|
||||
|
||||
|
||||
public float dodgeCoolDown;//闪避Cd时间
|
||||
public float dodgeSpeed;
|
||||
private float dodge;
|
||||
private bool isCanDodge;
|
||||
|
||||
|
||||
|
||||
private bool isWuDi;
|
||||
public float wuDiTimer;
|
||||
|
||||
public CharacterCombat ch;
|
||||
public CharacterHp info;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
inputActions = new InputActions();
|
||||
cameraVR = GameObject.FindWithTag("Camera").GetComponentInChildren<CameraVR>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
|
||||
inputActions.GamePlay.ComBa_01.started += this.Attack_01;
|
||||
inputActions.GamePlay.ComBa_02.started += this.Attack_02;
|
||||
inputActions.GamePlay.Dodge.started += this.Dodge;
|
||||
inputActions.UI.Stop.started += this.OnStop;
|
||||
inputActions.UI.Bag.started += this.OpenBag;
|
||||
|
||||
dodge = dodgeCoolDown;
|
||||
isCanDodge = true;
|
||||
|
||||
ManagersMode.Poll.CreateGameObjectPoll("Timer", 10);
|
||||
ManagersMode.Poll.CreateGameObjectPoll("BulletPoll", 3);
|
||||
ManagersMode.Poll.CreateGameObjectPoll("EffectPoll", 2);
|
||||
|
||||
info.Init(ch);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
if(ch.currentHp<=0)
|
||||
{
|
||||
UIManager.Instance.Show<UIGameOver>();
|
||||
ch._animator.Play("die");
|
||||
}
|
||||
if(!animator.CheckAnimationTag("Roll"))
|
||||
{
|
||||
animator.speed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.transform.Translate(InputDir*dodgeSpeed*0.01f);//闪避移动
|
||||
}
|
||||
CanDodge();
|
||||
|
||||
|
||||
UseItem();
|
||||
}
|
||||
private void OnEnable()
|
||||
{
|
||||
inputActions.Enable();
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
inputActions.Disable();
|
||||
}
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if(!animator.CheckAnimationTag("Die"))
|
||||
{
|
||||
this.MoveController();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rb.velocity =Vector2.zero;
|
||||
}
|
||||
}
|
||||
|
||||
#region 移动 新版输入系统
|
||||
private void MoveController()
|
||||
{
|
||||
InputDir = inputActions.GamePlay.Move.ReadValue<Vector2>().normalized;
|
||||
|
||||
animator.SetFloat("Horizontal", InputDir.x);
|
||||
animator.SetFloat("Vertical", InputDir.y);
|
||||
animator.SetFloat("Speed", InputDir.sqrMagnitude);
|
||||
|
||||
this.rb.velocity = InputDir * normalSpeed;
|
||||
|
||||
if (InputDir.x < 0)//向左
|
||||
{
|
||||
transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
if (InputDir.x > 0)//向左
|
||||
{
|
||||
transform.localScale = new Vector3(-1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStop(InputAction.CallbackContext obj)
|
||||
{
|
||||
UIManager.Instance.Show<UIGameOver>();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 角色攻击
|
||||
/// </summary>
|
||||
private void Attack_01(InputAction.CallbackContext obj)
|
||||
{
|
||||
animator.SetTrigger("Attack_01");
|
||||
}
|
||||
private void Attack_02(InputAction.CallbackContext obj)
|
||||
{
|
||||
animator.SetTrigger("Attack_02");
|
||||
}
|
||||
|
||||
private bool CanDodge()
|
||||
{
|
||||
if(isCanDodge)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
dodgeCoolDown -= Time.deltaTime;
|
||||
if(dodgeCoolDown<=0)
|
||||
{
|
||||
isCanDodge = true;
|
||||
dodgeCoolDown = dodge;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 角色闪避
|
||||
/// </summary>
|
||||
private void Dodge(InputAction.CallbackContext obj)
|
||||
{
|
||||
//||animator.CheckAnimationTag("Hit")
|
||||
if (!CanDodge())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StartCoroutine(nameof(SetWuDi));//无敌状态
|
||||
|
||||
isCanDodge = false;
|
||||
animator.speed = 1f;
|
||||
|
||||
if (InputDir.x!=0)
|
||||
{
|
||||
animator.Play("roll");
|
||||
}
|
||||
if (InputDir.y > 0)
|
||||
{
|
||||
animator.Play("roll-up");
|
||||
}
|
||||
if (InputDir.y < 0)
|
||||
{
|
||||
animator.Play("roll-down");
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator SetWuDi()
|
||||
{
|
||||
isWuDi = true;
|
||||
yield return new WaitForSeconds(wuDiTimer);
|
||||
isWuDi = false;
|
||||
}
|
||||
|
||||
public bool GetIsDodge()
|
||||
{
|
||||
return isWuDi;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OpenBag(InputAction.CallbackContext obj)
|
||||
{
|
||||
UIManager.Instance.Show<UIBagInfo>();
|
||||
}
|
||||
public void UseItem()
|
||||
{
|
||||
if(Input.GetKeyDown(KeyCode.Alpha1))
|
||||
{
|
||||
PlayerInfo.Instance.BagMgr.UserItem(1, 1);//回血道具
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09455605d05154d4d9194d9b1781ba9b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,154 +0,0 @@
|
||||
using Managers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerInfo : Singleton<PlayerInfo>
|
||||
{
|
||||
public CharInfo info;
|
||||
|
||||
public Action OnUpdateBagInfo;
|
||||
public Action OnUpdateMainUI;
|
||||
public Action OnUpdateLevel;
|
||||
|
||||
public Action<LotteryType, float> OnUpdateAttrbute;
|
||||
|
||||
public Managers.BagManager BagMgr;
|
||||
|
||||
public void Init(CharInfo date)
|
||||
{
|
||||
|
||||
info = date;
|
||||
info.playerName = date.playerName;
|
||||
info.Level = date.Level;
|
||||
info.exp = date.exp;
|
||||
|
||||
info.maxHp = date.maxHp;
|
||||
info.attack = date.attack;
|
||||
|
||||
info.testAttack = date.testAttack;
|
||||
info.currentHp = date.currentHp;
|
||||
info.currentMap = date.currentMap;
|
||||
|
||||
info.BagInfo = new Dictionary<int, int>();
|
||||
info.UpInfo = new Dictionary<int, bool>();
|
||||
|
||||
for (int i = 0; i < date.BagKey.Count; i++)
|
||||
{
|
||||
info.BagInfo.Add(date.BagKey[i], date.BagValue[i]);
|
||||
}
|
||||
for (int i = 0; i < date.UpKey.Count; i++)
|
||||
{
|
||||
info.UpInfo.Add(date.UpKey[i], date.UpValue[i]);
|
||||
}
|
||||
|
||||
//初始化管理器
|
||||
BagMgr = new Managers.BagManager(this);
|
||||
|
||||
Debug.Log("数据读取完毕");
|
||||
}
|
||||
public void Resrt()
|
||||
{
|
||||
info.currentHp = info.maxHp; ;
|
||||
info.testAttack = info.attack;
|
||||
if(!info.BagInfo.ContainsKey(1))
|
||||
{
|
||||
info.BagInfo.Add(1,4);
|
||||
}
|
||||
else
|
||||
{
|
||||
info.BagInfo[1] = 4;
|
||||
}
|
||||
|
||||
WriteBagInfo();
|
||||
}
|
||||
|
||||
public void KeepData(float max, float current, float attack)
|
||||
{
|
||||
info.maxHp = max;
|
||||
info.currentHp = current;
|
||||
info.testAttack = attack;
|
||||
}
|
||||
public Sprite GetSprite(string path)
|
||||
{
|
||||
return Resloader.Load<Sprite>(path);
|
||||
}
|
||||
|
||||
#region 属性更改
|
||||
public void AddHp(int num)
|
||||
{
|
||||
OnUpdateAttrbute?.Invoke(LotteryType.Hp, num);
|
||||
}
|
||||
public void AddMp(int num)
|
||||
{
|
||||
OnUpdateAttrbute?.Invoke(LotteryType.Mp, num);
|
||||
}
|
||||
public void AddAttack(int num)
|
||||
{
|
||||
OnUpdateAttrbute?.Invoke(LotteryType.Attack, num);
|
||||
}
|
||||
public void AddUpHp(int num)
|
||||
{
|
||||
OnUpdateAttrbute?.Invoke(LotteryType.UpHp, num);
|
||||
}
|
||||
public void AddUpMaxHp(int num)
|
||||
{
|
||||
OnUpdateAttrbute?.Invoke(LotteryType.UpMaxHp, num);
|
||||
}
|
||||
public void AddUpAttack(int num)
|
||||
{
|
||||
OnUpdateAttrbute?.Invoke(LotteryType.UpAttack, num);
|
||||
}
|
||||
#endregion
|
||||
#region 升级
|
||||
public void LevelUp()
|
||||
{
|
||||
int need = NeedExp();
|
||||
if (need < info.exp)
|
||||
{
|
||||
info.exp -= need;
|
||||
|
||||
info.Level++;
|
||||
LevelUp();
|
||||
|
||||
SaveSystem.SaveDate(info.DatePath, info);
|
||||
}
|
||||
}
|
||||
public int NeedExp()
|
||||
{
|
||||
int needExp;
|
||||
return needExp = info.Level * (1000);
|
||||
}
|
||||
public void ItemLevel(LevelUpDefine item)
|
||||
{
|
||||
switch (item.type)
|
||||
{
|
||||
case LotteryType.UpMaxHp:
|
||||
AddUpMaxHp(item.value);
|
||||
break;
|
||||
case LotteryType.UpAttack:
|
||||
AddUpAttack(item.value);
|
||||
break;
|
||||
case LotteryType.UpHp:
|
||||
AddUpHp(item.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
//重写数据
|
||||
public void WriteBagInfo()
|
||||
{
|
||||
info.BagKey.Clear();
|
||||
info.BagValue.Clear();
|
||||
foreach (var data in info.BagInfo)
|
||||
{
|
||||
info.BagKey.Add(data.Key);
|
||||
info.BagValue.Add(data.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0c918ecff055954093fcb740f901146
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,33 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Item
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ItemName { get; set; }
|
||||
public string Descripte;
|
||||
public ItemClass type;
|
||||
public LotteryType lotteryType;
|
||||
public string Path { get; set; }
|
||||
public int value;
|
||||
|
||||
public void UseItem(Item item)
|
||||
{
|
||||
switch(item.lotteryType)
|
||||
{
|
||||
case LotteryType.Hp:
|
||||
Debug.LogFormat("UseItem:[{0}],AddHp {1}",item.Id,item.value);
|
||||
PlayerInfo.Instance.AddHp(item.value);
|
||||
break;
|
||||
case LotteryType.Attack:
|
||||
Debug.LogFormat("UseItem:[{0}],AddAttack {1}", item.Id,value);
|
||||
PlayerInfo.Instance.AddAttack(item.value);
|
||||
break;
|
||||
case LotteryType.Mp:
|
||||
Debug.LogFormat("UseItem:[{0}],AddMp {1}", item.Id,item.value);
|
||||
PlayerInfo.Instance.AddMp(item.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3800075d5f0f84f49b03c7082b653229
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c51cc61b3d5e6444b7b11ef9546e47d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,82 +0,0 @@
|
||||
using Managers;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LevelItem : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
public int LevelId;
|
||||
public int PreId;//前置节点
|
||||
public Text need;
|
||||
public Text activeText;
|
||||
private void Awake()
|
||||
{
|
||||
foreach (var date in Date.Instance.UpDate)
|
||||
{
|
||||
if (date.UpId == LevelId)
|
||||
{
|
||||
if(PlayerInfo.Instance.info.UpValue[date.UpId])
|
||||
{
|
||||
activeText.text = "已激活";
|
||||
need.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeText.text = "未激活";
|
||||
need.text = date.useNum.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
foreach (var date in Date.Instance.UpDate)
|
||||
{
|
||||
if (date.UpId == LevelId&&!PlayerInfo.Instance.info.UpInfo[date.UpId])
|
||||
{
|
||||
if(CheckUp(LevelId))
|
||||
{
|
||||
if(!PlayerInfo.Instance.info.BagInfo.ContainsKey(date.userId))
|
||||
{
|
||||
Debug.Log("所用道具不足");
|
||||
return;
|
||||
}
|
||||
if(PlayerInfo.Instance.info.BagInfo[date.userId]>=date.useNum)
|
||||
{
|
||||
PlayerInfo.Instance.BagMgr.UserItem(date.userId, date.useNum);
|
||||
PlayerInfo.Instance.ItemLevel(date);
|
||||
activeText.text = "已激活";
|
||||
need.gameObject.SetActive(false);
|
||||
|
||||
//保存数据
|
||||
PlayerInfo.Instance.info.UpValue[date.UpId] = true;
|
||||
PlayerInfo.Instance.info.UpInfo[date.UpId] = PlayerInfo.Instance.info.UpValue[date.UpId];
|
||||
SaveSystem.SaveDate(PlayerInfo.Instance.info.DatePath, PlayerInfo.Instance.info);
|
||||
|
||||
return;
|
||||
}
|
||||
Debug.Log("所用道具不足");
|
||||
return;
|
||||
}
|
||||
Debug.Log("前置条件没有升级");
|
||||
}
|
||||
}
|
||||
}
|
||||
bool CheckUp(int id)
|
||||
{
|
||||
if(id==0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(!PlayerInfo.Instance.info.UpValue[Date.Instance.UpDate[id].PreId])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e8febb475782074d92ed6e2d7d41a8a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LevelUpDefine
|
||||
{
|
||||
public int UpId;
|
||||
public int PreId;
|
||||
public string UpName;
|
||||
public bool Active;
|
||||
public string Descripet;
|
||||
public int userId;
|
||||
public int useNum;
|
||||
public LotteryType type;
|
||||
public int value;
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2221f9aac6ce9c45818de80359b75bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f949d68b257d1248b73744596dc025a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7f20aebcd8ef7145880ce6921cd9750
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,16 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ManagersMode : MonoBehaviour
|
||||
{
|
||||
private static PollManager _pool;
|
||||
public static PollManager Poll
|
||||
{
|
||||
get { return _pool; }
|
||||
}
|
||||
private void Awake()
|
||||
{
|
||||
_pool = this.gameObject.AddComponent<PollManager>();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afea4f43157c8f541a7fcde752e70440
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,77 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PollManager : MonoBehaviour
|
||||
{
|
||||
Transform m_PollParent;
|
||||
|
||||
//对象池字典
|
||||
Dictionary<string, PollBase> m_Polls = new Dictionary<string, PollBase>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_PollParent = this.transform.parent.Find("Poll");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建对象池
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="pollName"></param>
|
||||
/// <param name="releaseTime"></param>
|
||||
private void CreatePoll<T>(string pollName, float releaseTime)
|
||||
where T : PollBase
|
||||
{
|
||||
if (!m_Polls.TryGetValue(pollName, out PollBase poll))
|
||||
{
|
||||
GameObject go = new GameObject();
|
||||
go.name = pollName;
|
||||
go.transform.SetParent(m_PollParent);
|
||||
poll = go.AddComponent<T>();
|
||||
poll.Init(releaseTime);
|
||||
m_Polls.Add(pollName, poll);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建物体对象池
|
||||
/// </summary>
|
||||
/// <param name="pollName"></param>
|
||||
/// <param name="releaseTime"></param>
|
||||
public void CreateGameObjectPoll(string pollName, float releaseTime)
|
||||
{
|
||||
CreatePoll<GameObjectPoll>(pollName, releaseTime);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取出对象
|
||||
/// </summary>
|
||||
/// <param name="pollName"></param>
|
||||
/// <param name="asseteName"></param>
|
||||
/// <returns></returns>
|
||||
public Object Spwan(string pollName, string asseteName)
|
||||
{
|
||||
if (m_Polls.TryGetValue(pollName, out PollBase poll))
|
||||
{
|
||||
return poll.Spwan(asseteName);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回收对象
|
||||
/// </summary>
|
||||
/// <param name="pollName"></param>
|
||||
/// <param name="asseteName"></param>
|
||||
/// <returns></returns>
|
||||
public void UnSpwan(string pollName, string asseteName, Object assete)
|
||||
{
|
||||
if (m_Polls.TryGetValue(pollName, out PollBase poll))
|
||||
{
|
||||
poll.UnSpwan(asseteName, assete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea449011b5381b246bcdfef0efa1523c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,57 +0,0 @@
|
||||
using Manager;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MessageBox : UIWindow
|
||||
{
|
||||
public InputField playerName;
|
||||
public Text infoText;
|
||||
|
||||
CharInfo info;
|
||||
string path;
|
||||
public void Init(string dataName,string datePath)
|
||||
{
|
||||
infoText.text = dataName + " 是一个空白存档,需要创建你的存档嘛?";
|
||||
path = datePath;
|
||||
}
|
||||
public override void OnYesClick()
|
||||
{
|
||||
base.OnYesClick();
|
||||
|
||||
Debug.Log("创建存档");
|
||||
//创建新存档
|
||||
//初始化玩家数据
|
||||
info = new CharInfo();
|
||||
|
||||
info.DatePath = path;
|
||||
|
||||
info.playerName = playerName.text; //名字
|
||||
info.Level = 1;//等级
|
||||
info.exp = 0;//经验值
|
||||
|
||||
info.attack = 50;//攻击力
|
||||
info.maxHp = 400;//最大生命值
|
||||
|
||||
|
||||
info.currentHp = info.maxHp;//本局血量
|
||||
info.testAttack = info.attack;//本局攻击力
|
||||
info.currentMap = 1;
|
||||
|
||||
//背包数据
|
||||
info.BagKey = new List<int> { 0};//道具Id
|
||||
info.BagValue = new List<int> { 6 };//道具数量
|
||||
|
||||
//升级数据
|
||||
info.UpKey = new List<int> { 0, 1, 2, 3, 4, 5, 6,7,8 };//升级节点
|
||||
info.UpValue = new List<bool> { false, false, false, false, false, false, false,false,false };//是否升级
|
||||
SaveSystem.SaveDate(path, info);
|
||||
|
||||
//存档赋值
|
||||
PlayerInfo.Instance.Init(info);
|
||||
|
||||
SenceManager.Instance.LoadScene(info.currentMap);
|
||||
SoundManager.Instance.PlayMusic(SoundDefine.Map_1Music);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c73df666b571fe649b79bfb8ea5a15b3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,81 +0,0 @@
|
||||
|
||||
//using UnityEngine;
|
||||
//using System.Collections;
|
||||
//using UnityEditor;
|
||||
//using System.IO;
|
||||
//using System.Collections.Generic;
|
||||
/// < summary >
|
||||
/// 切割
|
||||
/// </ summary >
|
||||
//public static class ImageSlicer
|
||||
//{
|
||||
// [MenuItem("Assets/ImageSlicer/Process to Sprites")]
|
||||
// static void ProcessToSprite()
|
||||
// {
|
||||
// Texture2D image = Selection.activeObject as Texture2D;//获取旋转的对象
|
||||
// string rootPath = Path.GetDirectoryName(AssetDatabase.GetAssetPath(image));//获取路径名称
|
||||
// string path = rootPath + "/" + image.name + ".PNG";//图片路径名称
|
||||
|
||||
|
||||
// TextureImporter texImp = AssetImporter.GetAtPath(path) as TextureImporter;//获取图片入口
|
||||
|
||||
|
||||
// AssetDatabase.CreateFolder(rootPath, image.name);//创建文件夹
|
||||
|
||||
|
||||
// foreach (SpriteMetaData metaData in texImp.spritesheet)//遍历小图集
|
||||
// {
|
||||
// Texture2D myimage = new Texture2D((int)metaData.rect.width, (int)metaData.rect.height);
|
||||
|
||||
// abc_0: (x: 2.00, y: 400.00, width: 103.00, height: 112.00)
|
||||
// for (int y = (int)metaData.rect.y; y < metaData.rect.y + metaData.rect.height; y++)//Y轴像素
|
||||
// {
|
||||
// for (int x = (int)metaData.rect.x; x < metaData.rect.x + metaData.rect.width; x++)
|
||||
// myimage.SetPixel(x - (int)metaData.rect.x, y - (int)metaData.rect.y, image.GetPixel(x, y));
|
||||
// }
|
||||
|
||||
|
||||
// 转换纹理到EncodeToPNG兼容格式
|
||||
// if (myimage.format != TextureFormat.ARGB32 && myimage.format != TextureFormat.RGB24)
|
||||
// {
|
||||
// Texture2D newTexture = new Texture2D(myimage.width, myimage.height);
|
||||
// newTexture.SetPixels(myimage.GetPixels(0), 0);
|
||||
// myimage = newTexture;
|
||||
// }
|
||||
// DeCompress(myimage);
|
||||
// var pngData = myimage.EncodeToPNG();
|
||||
|
||||
|
||||
// AssetDatabase.CreateAsset(myimage, rootPath + "/" + image.name + "/" + metaData.name + ".PNG");
|
||||
// File.WriteAllBytes(rootPath + "/" + image.name + "/" + metaData.name + ".PNG", pngData);
|
||||
// 刷新资源窗口界面
|
||||
// AssetDatabase.Refresh();
|
||||
// }
|
||||
// }
|
||||
|
||||
// / <summary>
|
||||
// /
|
||||
// / </summary>
|
||||
// / <param name = "source" ></ param >
|
||||
// / < returns ></ returns >
|
||||
// public static Texture2D DeCompress(Texture2D source)
|
||||
// {
|
||||
// RenderTexture renderTex = RenderTexture.GetTemporary(
|
||||
// source.width,
|
||||
// source.height,
|
||||
// 0,
|
||||
// RenderTextureFormat.Default,
|
||||
// RenderTextureReadWrite.Linear);
|
||||
|
||||
// Graphics.Blit(source, renderTex);
|
||||
// RenderTexture previous = RenderTexture.active;
|
||||
// RenderTexture.active = renderTex;
|
||||
// Texture2D readableText = new Texture2D(source.width, source.height);
|
||||
// readableText.ReadPixels(new Rect(0, 0, renderTex.width, renderTex.height), 0, 0);
|
||||
// readableText.Apply();
|
||||
// RenderTexture.active = previous;
|
||||
// RenderTexture.ReleaseTemporary(renderTex);
|
||||
// return readableText;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a585f91919ecc5049b0440e503ce7482
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc6de09ab7131f9468c2acea40471f24
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,72 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PollBase : MonoBehaviour
|
||||
{
|
||||
//自动释放时间/秒
|
||||
protected float m_ReleaseTime;
|
||||
|
||||
//上次释放的时间/毫微秒 10……7;
|
||||
protected long m_LastReleaseTime = 0;
|
||||
|
||||
//对象池
|
||||
protected List<PollObject> m_Objects;
|
||||
public void Start()
|
||||
{
|
||||
m_LastReleaseTime = System.DateTime.Now.Ticks;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化对象池
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
public void Init(float time)
|
||||
{
|
||||
m_ReleaseTime = time;
|
||||
m_Objects = new List<PollObject>();
|
||||
}
|
||||
/// <summary>
|
||||
/// 取出对象
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public virtual Object Spwan(string name)
|
||||
{
|
||||
foreach (PollObject po in m_Objects)
|
||||
{
|
||||
if (po.Name == name)
|
||||
{
|
||||
m_Objects.Remove(po);
|
||||
return po.Object;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 回收
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="obj"></param>
|
||||
public virtual void UnSpwan(string name, Object obj)
|
||||
{
|
||||
PollObject po = new PollObject(name, obj);
|
||||
m_Objects.Add(po);
|
||||
}
|
||||
/// <summary>
|
||||
/// 释放
|
||||
/// </summary>
|
||||
public virtual void Release()
|
||||
{
|
||||
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (System.DateTime.Now.Ticks - m_LastReleaseTime >= m_ReleaseTime * 10000000)
|
||||
{
|
||||
m_LastReleaseTime = System.DateTime.Now.Ticks;
|
||||
Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ba11d249cb380348b661dda9386a33a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,18 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PollObject
|
||||
{
|
||||
//对象
|
||||
public Object Object;
|
||||
//对象名
|
||||
public string Name;
|
||||
//最后一次的使用时间,记录销毁
|
||||
public System.DateTime lastUserTime;
|
||||
|
||||
public PollObject(string name, Object obj)
|
||||
{
|
||||
Name = name;
|
||||
Object = obj;
|
||||
lastUserTime = System.DateTime.Now;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d7860cc304322b41a0233c9cf94ab61
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,40 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class RsertTriger : StateMachineBehaviour
|
||||
{
|
||||
public string[] trigger;
|
||||
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
|
||||
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
foreach (var info in trigger)
|
||||
{
|
||||
animator.ResetTrigger(info);
|
||||
}
|
||||
}
|
||||
|
||||
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
|
||||
//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
|
||||
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
|
||||
//override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
|
||||
// OnStateMove is called right after Animator.OnAnimatorMove()
|
||||
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
//{
|
||||
// // Implement code that processes and affects root motion
|
||||
//}
|
||||
|
||||
// OnStateIK is called right after Animator.OnAnimatorIK()
|
||||
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
//{
|
||||
// // Implement code that sets up animation IK (inverse kinematics)
|
||||
//}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee7bc4befba7eea4eab0ccc3c78f51aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,38 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class MonoSingleton<T> : MonoBehaviour where T : MonoBehaviour
|
||||
{
|
||||
public bool global=true;
|
||||
private static T instance;
|
||||
public static T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
instance = FindObjectOfType<T>();
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
void Awake()
|
||||
{
|
||||
if (global)
|
||||
{
|
||||
if (instance != null && instance != this.gameObject.GetComponent<T>())
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
return;
|
||||
}
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
instance = this.gameObject.GetComponent<T>();
|
||||
|
||||
}
|
||||
this.OnStart();
|
||||
}
|
||||
|
||||
protected virtual void OnStart()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29d9d55349331304fb3da0aa1c10e559
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
class Resloader
|
||||
{
|
||||
public static T Load<T>(string path) where T : UnityEngine.Object
|
||||
{
|
||||
return Resources.Load<T>(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e7452ecf3eb2b94c8af2b8b2f16c9ac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ItemTip : MonoBehaviour
|
||||
{
|
||||
public Image icon;
|
||||
public Text itemName;
|
||||
public Text descripte;
|
||||
|
||||
|
||||
public void Init(Item item)
|
||||
{
|
||||
if (item == null) return;
|
||||
itemName.text = item.ItemName;
|
||||
descripte.text = item.Descripte;
|
||||
icon.sprite = PlayerInfo.Instance.GetSprite(item.Path);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f120710dbd20f65488798761408eddb4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,801 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.12.0
|
||||
// from Assets/Shader/Setting/InputActions.inputactions
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Provides programmatic access to <see cref="InputActionAsset" />, <see cref="InputActionMap" />, <see cref="InputAction" /> and <see cref="InputControlScheme" /> instances defined in asset "Assets/Shader/Setting/InputActions.inputactions".
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class is source generated and any manual edits will be discarded if the associated asset is reimported or modified.
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// using namespace UnityEngine;
|
||||
/// using UnityEngine.InputSystem;
|
||||
///
|
||||
/// // Example of using an InputActionMap named "Player" from a UnityEngine.MonoBehaviour implementing callback interface.
|
||||
/// public class Example : MonoBehaviour, MyActions.IPlayerActions
|
||||
/// {
|
||||
/// private MyActions_Actions m_Actions; // Source code representation of asset.
|
||||
/// private MyActions_Actions.PlayerActions m_Player; // Source code representation of action map.
|
||||
///
|
||||
/// void Awake()
|
||||
/// {
|
||||
/// m_Actions = new MyActions_Actions(); // Create asset object.
|
||||
/// m_Player = m_Actions.Player; // Extract action map object.
|
||||
/// m_Player.AddCallbacks(this); // Register callback interface IPlayerActions.
|
||||
/// }
|
||||
///
|
||||
/// void OnDestroy()
|
||||
/// {
|
||||
/// m_Actions.Dispose(); // Destroy asset object.
|
||||
/// }
|
||||
///
|
||||
/// void OnEnable()
|
||||
/// {
|
||||
/// m_Player.Enable(); // Enable all actions within map.
|
||||
/// }
|
||||
///
|
||||
/// void OnDisable()
|
||||
/// {
|
||||
/// m_Player.Disable(); // Disable all actions within map.
|
||||
/// }
|
||||
///
|
||||
/// #region Interface implementation of MyActions.IPlayerActions
|
||||
///
|
||||
/// // Invoked when "Move" action is either started, performed or canceled.
|
||||
/// public void OnMove(InputAction.CallbackContext context)
|
||||
/// {
|
||||
/// Debug.Log($"OnMove: {context.ReadValue<Vector2>()}");
|
||||
/// }
|
||||
///
|
||||
/// // Invoked when "Attack" action is either started, performed or canceled.
|
||||
/// public void OnAttack(InputAction.CallbackContext context)
|
||||
/// {
|
||||
/// Debug.Log($"OnAttack: {context.ReadValue<float>()}");
|
||||
/// }
|
||||
///
|
||||
/// #endregion
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
public partial class @InputActions: IInputActionCollection2, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to the underlying asset instance.
|
||||
/// </summary>
|
||||
public InputActionAsset asset { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance.
|
||||
/// </summary>
|
||||
public @InputActions()
|
||||
{
|
||||
asset = InputActionAsset.FromJson(@"{
|
||||
""name"": ""InputActions"",
|
||||
""maps"": [
|
||||
{
|
||||
""name"": ""GamePlay"",
|
||||
""id"": ""ef6d65da-b091-4f70-9e32-99c29000e209"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""Move"",
|
||||
""type"": ""Value"",
|
||||
""id"": ""b6a973e9-b6eb-4dad-8a96-553ea339b051"",
|
||||
""expectedControlType"": ""Vector2"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""Dodge"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""d348f7e8-ff62-4c96-87c1-a9e98d57bb2c"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""ComBa_01"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""9af8087e-ae18-4038-a763-7a50f8a8bdb0"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""ComBa_02"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""3f62d770-4603-4cf6-abef-09404d6f9ae5"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": ""ASWD"",
|
||||
""id"": ""484f54ae-3627-44d2-a373-6a5b54938842"",
|
||||
""path"": ""2DVector"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""up"",
|
||||
""id"": ""ad2dff40-9527-4d45-9c3e-02332a3f51a3"",
|
||||
""path"": ""<Keyboard>/w"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""down"",
|
||||
""id"": ""d08e425e-ae6a-4657-af75-09e68b3ed25c"",
|
||||
""path"": ""<Keyboard>/s"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""left"",
|
||||
""id"": ""4e4b0eaf-ad07-4d76-9daa-935adece5343"",
|
||||
""path"": ""<Keyboard>/a"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""right"",
|
||||
""id"": ""9b1a005b-e37d-4bb0-819d-0f6b89836782"",
|
||||
""path"": ""<Keyboard>/d"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""Arrow"",
|
||||
""id"": ""8d4ef714-11b2-43c3-bbaa-479b49948e0a"",
|
||||
""path"": ""2DVector"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": true,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": ""up"",
|
||||
""id"": ""5b52bfc2-45b5-4de6-915e-b06c67c37f75"",
|
||||
""path"": ""<Keyboard>/upArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""down"",
|
||||
""id"": ""edf2eecb-163f-43bf-bc30-f960e22f3b26"",
|
||||
""path"": ""<Keyboard>/downArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""left"",
|
||||
""id"": ""2ce71c6c-6860-4836-82be-bff71a0c46a2"",
|
||||
""path"": ""<Keyboard>/leftArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": ""right"",
|
||||
""id"": ""656a945c-89ae-40e7-a605-1e92fbfface0"",
|
||||
""path"": ""<Keyboard>/rightArrow"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": true
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""b48d83b6-1bf3-4ab6-9d2d-20106caf4da6"",
|
||||
""path"": ""<Gamepad>/leftStick"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Gamepad"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""d23564b4-a3cb-4ea3-a16f-89a230fd21b1"",
|
||||
""path"": ""<Gamepad>/dpad"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Gamepad"",
|
||||
""action"": ""Move"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""0b5373f5-5766-44bd-ad30-6ecdb7f10507"",
|
||||
""path"": ""<Keyboard>/leftShift"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Dodge"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""8394600a-cbc2-48f3-98f6-e85b97c6c73a"",
|
||||
""path"": ""<Gamepad>/buttonWest"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Dodge"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""7b23266c-b664-4e2f-974f-0a39631edfc8"",
|
||||
""path"": ""<Mouse>/leftButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""ComBa_01"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""b722d7d7-f0b4-48ed-9841-38e1b82bc799"",
|
||||
""path"": ""<Gamepad>/buttonNorth"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Gamepad"",
|
||||
""action"": ""ComBa_01"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""12f4c305-e962-40b4-a9a7-e5aa3da6c393"",
|
||||
""path"": ""<Mouse>/rightButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""ComBa_02"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""UI"",
|
||||
""id"": ""c4fb9ed3-1627-423d-846c-d579fa919ec3"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""Stop"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""71b6b5b4-6945-48e1-9fd8-6ed8da0a732d"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Bag"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""190885c1-dabe-4806-9cab-05bb726a1922"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""b0baa221-5e25-4812-8392-536934b794ff"",
|
||||
""path"": ""<Keyboard>/escape"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""PC"",
|
||||
""action"": ""Stop"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""907c233f-767d-4184-9500-025c302482d4"",
|
||||
""path"": ""<Gamepad>/leftStickPress"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Gamepad"",
|
||||
""action"": ""Stop"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""e4beee93-8dbc-4c17-95b7-1f424ff637ac"",
|
||||
""path"": ""<Keyboard>/tab"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Bag"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": [
|
||||
{
|
||||
""name"": ""PC"",
|
||||
""bindingGroup"": ""PC"",
|
||||
""devices"": []
|
||||
},
|
||||
{
|
||||
""name"": ""Gamepad"",
|
||||
""bindingGroup"": ""Gamepad"",
|
||||
""devices"": []
|
||||
}
|
||||
]
|
||||
}");
|
||||
// GamePlay
|
||||
m_GamePlay = asset.FindActionMap("GamePlay", throwIfNotFound: true);
|
||||
m_GamePlay_Move = m_GamePlay.FindAction("Move", throwIfNotFound: true);
|
||||
m_GamePlay_Dodge = m_GamePlay.FindAction("Dodge", throwIfNotFound: true);
|
||||
m_GamePlay_ComBa_01 = m_GamePlay.FindAction("ComBa_01", throwIfNotFound: true);
|
||||
m_GamePlay_ComBa_02 = m_GamePlay.FindAction("ComBa_02", throwIfNotFound: true);
|
||||
// UI
|
||||
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
|
||||
m_UI_Stop = m_UI.FindAction("Stop", throwIfNotFound: true);
|
||||
m_UI_Bag = m_UI.FindAction("Bag", throwIfNotFound: true);
|
||||
}
|
||||
|
||||
~@InputActions()
|
||||
{
|
||||
UnityEngine.Debug.Assert(!m_GamePlay.enabled, "This will cause a leak and performance issues, InputActions.GamePlay.Disable() has not been called.");
|
||||
UnityEngine.Debug.Assert(!m_UI.enabled, "This will cause a leak and performance issues, InputActions.UI.Disable() has not been called.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destroys this asset and all associated <see cref="InputAction"/> instances.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEngine.Object.Destroy(asset);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindingMask" />
|
||||
public InputBinding? bindingMask
|
||||
{
|
||||
get => asset.bindingMask;
|
||||
set => asset.bindingMask = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.devices" />
|
||||
public ReadOnlyArray<InputDevice>? devices
|
||||
{
|
||||
get => asset.devices;
|
||||
set => asset.devices = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.controlSchemes" />
|
||||
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Contains(InputAction)" />
|
||||
public bool Contains(InputAction action)
|
||||
{
|
||||
return asset.Contains(action);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.GetEnumerator()" />
|
||||
public IEnumerator<InputAction> GetEnumerator()
|
||||
{
|
||||
return asset.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IEnumerable.GetEnumerator()" />
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Enable()" />
|
||||
public void Enable()
|
||||
{
|
||||
asset.Enable();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Disable()" />
|
||||
public void Disable()
|
||||
{
|
||||
asset.Disable();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindings" />
|
||||
public IEnumerable<InputBinding> bindings => asset.bindings;
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindAction(string, bool)" />
|
||||
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
|
||||
{
|
||||
return asset.FindAction(actionNameOrId, throwIfNotFound);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindBinding(InputBinding, out InputAction)" />
|
||||
public int FindBinding(InputBinding bindingMask, out InputAction action)
|
||||
{
|
||||
return asset.FindBinding(bindingMask, out action);
|
||||
}
|
||||
|
||||
// GamePlay
|
||||
private readonly InputActionMap m_GamePlay;
|
||||
private List<IGamePlayActions> m_GamePlayActionsCallbackInterfaces = new List<IGamePlayActions>();
|
||||
private readonly InputAction m_GamePlay_Move;
|
||||
private readonly InputAction m_GamePlay_Dodge;
|
||||
private readonly InputAction m_GamePlay_ComBa_01;
|
||||
private readonly InputAction m_GamePlay_ComBa_02;
|
||||
/// <summary>
|
||||
/// Provides access to input actions defined in input action map "GamePlay".
|
||||
/// </summary>
|
||||
public struct GamePlayActions
|
||||
{
|
||||
private @InputActions m_Wrapper;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new instance of the input action map wrapper class.
|
||||
/// </summary>
|
||||
public GamePlayActions(@InputActions wrapper) { m_Wrapper = wrapper; }
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "GamePlay/Move".
|
||||
/// </summary>
|
||||
public InputAction @Move => m_Wrapper.m_GamePlay_Move;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "GamePlay/Dodge".
|
||||
/// </summary>
|
||||
public InputAction @Dodge => m_Wrapper.m_GamePlay_Dodge;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "GamePlay/ComBa_01".
|
||||
/// </summary>
|
||||
public InputAction @ComBa_01 => m_Wrapper.m_GamePlay_ComBa_01;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "GamePlay/ComBa_02".
|
||||
/// </summary>
|
||||
public InputAction @ComBa_02 => m_Wrapper.m_GamePlay_ComBa_02;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action map instance.
|
||||
/// </summary>
|
||||
public InputActionMap Get() { return m_Wrapper.m_GamePlay; }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
|
||||
public void Enable() { Get().Enable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
|
||||
public void Disable() { Get().Disable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
|
||||
public bool enabled => Get().enabled;
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see ref="GamePlayActions" /> to an <see ref="InputActionMap" /> instance.
|
||||
/// </summary>
|
||||
public static implicit operator InputActionMap(GamePlayActions set) { return set.Get(); }
|
||||
/// <summary>
|
||||
/// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <param name="instance">Callback instance.</param>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
|
||||
/// </remarks>
|
||||
/// <seealso cref="GamePlayActions" />
|
||||
public void AddCallbacks(IGamePlayActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_GamePlayActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_GamePlayActionsCallbackInterfaces.Add(instance);
|
||||
@Move.started += instance.OnMove;
|
||||
@Move.performed += instance.OnMove;
|
||||
@Move.canceled += instance.OnMove;
|
||||
@Dodge.started += instance.OnDodge;
|
||||
@Dodge.performed += instance.OnDodge;
|
||||
@Dodge.canceled += instance.OnDodge;
|
||||
@ComBa_01.started += instance.OnComBa_01;
|
||||
@ComBa_01.performed += instance.OnComBa_01;
|
||||
@ComBa_01.canceled += instance.OnComBa_01;
|
||||
@ComBa_02.started += instance.OnComBa_02;
|
||||
@ComBa_02.performed += instance.OnComBa_02;
|
||||
@ComBa_02.canceled += instance.OnComBa_02;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
|
||||
/// </remarks>
|
||||
/// <seealso cref="GamePlayActions" />
|
||||
private void UnregisterCallbacks(IGamePlayActions instance)
|
||||
{
|
||||
@Move.started -= instance.OnMove;
|
||||
@Move.performed -= instance.OnMove;
|
||||
@Move.canceled -= instance.OnMove;
|
||||
@Dodge.started -= instance.OnDodge;
|
||||
@Dodge.performed -= instance.OnDodge;
|
||||
@Dodge.canceled -= instance.OnDodge;
|
||||
@ComBa_01.started -= instance.OnComBa_01;
|
||||
@ComBa_01.performed -= instance.OnComBa_01;
|
||||
@ComBa_01.canceled -= instance.OnComBa_01;
|
||||
@ComBa_02.started -= instance.OnComBa_02;
|
||||
@ComBa_02.performed -= instance.OnComBa_02;
|
||||
@ComBa_02.canceled -= instance.OnComBa_02;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="GamePlayActions.UnregisterCallbacks(IGamePlayActions)" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="GamePlayActions.UnregisterCallbacks(IGamePlayActions)" />
|
||||
public void RemoveCallbacks(IGamePlayActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_GamePlayActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
|
||||
/// </remarks>
|
||||
/// <seealso cref="GamePlayActions.AddCallbacks(IGamePlayActions)" />
|
||||
/// <seealso cref="GamePlayActions.RemoveCallbacks(IGamePlayActions)" />
|
||||
/// <seealso cref="GamePlayActions.UnregisterCallbacks(IGamePlayActions)" />
|
||||
public void SetCallbacks(IGamePlayActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_GamePlayActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_GamePlayActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Provides a new <see cref="GamePlayActions" /> instance referencing this action map.
|
||||
/// </summary>
|
||||
public GamePlayActions @GamePlay => new GamePlayActions(this);
|
||||
|
||||
// UI
|
||||
private readonly InputActionMap m_UI;
|
||||
private List<IUIActions> m_UIActionsCallbackInterfaces = new List<IUIActions>();
|
||||
private readonly InputAction m_UI_Stop;
|
||||
private readonly InputAction m_UI_Bag;
|
||||
/// <summary>
|
||||
/// Provides access to input actions defined in input action map "UI".
|
||||
/// </summary>
|
||||
public struct UIActions
|
||||
{
|
||||
private @InputActions m_Wrapper;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new instance of the input action map wrapper class.
|
||||
/// </summary>
|
||||
public UIActions(@InputActions wrapper) { m_Wrapper = wrapper; }
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "UI/Stop".
|
||||
/// </summary>
|
||||
public InputAction @Stop => m_Wrapper.m_UI_Stop;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "UI/Bag".
|
||||
/// </summary>
|
||||
public InputAction @Bag => m_Wrapper.m_UI_Bag;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action map instance.
|
||||
/// </summary>
|
||||
public InputActionMap Get() { return m_Wrapper.m_UI; }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
|
||||
public void Enable() { Get().Enable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
|
||||
public void Disable() { Get().Disable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
|
||||
public bool enabled => Get().enabled;
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see ref="UIActions" /> to an <see ref="InputActionMap" /> instance.
|
||||
/// </summary>
|
||||
public static implicit operator InputActionMap(UIActions set) { return set.Get(); }
|
||||
/// <summary>
|
||||
/// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <param name="instance">Callback instance.</param>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
|
||||
/// </remarks>
|
||||
/// <seealso cref="UIActions" />
|
||||
public void AddCallbacks(IUIActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_UIActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_UIActionsCallbackInterfaces.Add(instance);
|
||||
@Stop.started += instance.OnStop;
|
||||
@Stop.performed += instance.OnStop;
|
||||
@Stop.canceled += instance.OnStop;
|
||||
@Bag.started += instance.OnBag;
|
||||
@Bag.performed += instance.OnBag;
|
||||
@Bag.canceled += instance.OnBag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
|
||||
/// </remarks>
|
||||
/// <seealso cref="UIActions" />
|
||||
private void UnregisterCallbacks(IUIActions instance)
|
||||
{
|
||||
@Stop.started -= instance.OnStop;
|
||||
@Stop.performed -= instance.OnStop;
|
||||
@Stop.canceled -= instance.OnStop;
|
||||
@Bag.started -= instance.OnBag;
|
||||
@Bag.performed -= instance.OnBag;
|
||||
@Bag.canceled -= instance.OnBag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="UIActions.UnregisterCallbacks(IUIActions)" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIActions.UnregisterCallbacks(IUIActions)" />
|
||||
public void RemoveCallbacks(IUIActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_UIActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
|
||||
/// </remarks>
|
||||
/// <seealso cref="UIActions.AddCallbacks(IUIActions)" />
|
||||
/// <seealso cref="UIActions.RemoveCallbacks(IUIActions)" />
|
||||
/// <seealso cref="UIActions.UnregisterCallbacks(IUIActions)" />
|
||||
public void SetCallbacks(IUIActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_UIActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_UIActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Provides a new <see cref="UIActions" /> instance referencing this action map.
|
||||
/// </summary>
|
||||
public UIActions @UI => new UIActions(this);
|
||||
private int m_PCSchemeIndex = -1;
|
||||
/// <summary>
|
||||
/// Provides access to the input control scheme.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputControlScheme" />
|
||||
public InputControlScheme PCScheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_PCSchemeIndex == -1) m_PCSchemeIndex = asset.FindControlSchemeIndex("PC");
|
||||
return asset.controlSchemes[m_PCSchemeIndex];
|
||||
}
|
||||
}
|
||||
private int m_GamepadSchemeIndex = -1;
|
||||
/// <summary>
|
||||
/// Provides access to the input control scheme.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputControlScheme" />
|
||||
public InputControlScheme GamepadScheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_GamepadSchemeIndex == -1) m_GamepadSchemeIndex = asset.FindControlSchemeIndex("Gamepad");
|
||||
return asset.controlSchemes[m_GamepadSchemeIndex];
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "GamePlay" which allows adding and removing callbacks.
|
||||
/// </summary>
|
||||
/// <seealso cref="GamePlayActions.AddCallbacks(IGamePlayActions)" />
|
||||
/// <seealso cref="GamePlayActions.RemoveCallbacks(IGamePlayActions)" />
|
||||
public interface IGamePlayActions
|
||||
{
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Move" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnMove(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Dodge" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnDodge(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "ComBa_01" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnComBa_01(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "ComBa_02" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnComBa_02(InputAction.CallbackContext context);
|
||||
}
|
||||
/// <summary>
|
||||
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIActions.AddCallbacks(IUIActions)" />
|
||||
/// <seealso cref="UIActions.RemoveCallbacks(IUIActions)" />
|
||||
public interface IUIActions
|
||||
{
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Stop" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnStop(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Bag" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnBag(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94cf862b15dc4df40966b28f96776336
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user