加ant+相关代码。
This commit is contained in:
1 parent
f45711f39f
commit
3c2bb10f07
115 files changed
+9058
-405
No files matched your search
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
public abstract class PFUIComponentBase : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1a49a106321aaf48b65347644f43168
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
public class PFUIDropdown : PFUIComponentBase
|
||||
{
|
||||
private int mSelectedIndex = -1;
|
||||
|
||||
private object mSelectedValue;
|
||||
|
||||
public int SelectedIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mSelectedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
public int Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetComponent<Dropdown>().value;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.GetComponent<Dropdown>().value = value;
|
||||
}
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
//this.mSelectedIndex =
|
||||
//UIManager.AddEvent(this.transform.GetComponent<Image>().gameObject, EventTriggerType.Select, new UnityEngine.Events.UnityAction<BaseEventData>(OnSelect));
|
||||
//UIManager.AddEvent(this.transform.GetComponent<Image>().gameObject, EventTriggerType.Deselect, new UnityEngine.Events.UnityAction<BaseEventData>(OnDeselect));
|
||||
}
|
||||
|
||||
public void OnSelect(BaseEventData eventData)
|
||||
{
|
||||
var image = this.transform.GetComponent<Image>();
|
||||
var png = Resources.Load<Sprite>("Images/input-bg2");
|
||||
image.sprite = png;
|
||||
}
|
||||
public void OnDeselect(BaseEventData eventData)
|
||||
{
|
||||
var image = this.transform.GetComponent<Image>();
|
||||
var png1 = Resources.Load<Sprite>("Images/input-bg1");
|
||||
image.sprite = png1;
|
||||
}
|
||||
|
||||
|
||||
public void AddOptions(List<Dropdown.OptionData> options)
|
||||
{
|
||||
this.GetComponent<Dropdown>().AddOptions(options);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81cc4b54765fb63428ca4b88ee884d22
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
public class PFUIInputField: PFUIComponentBase
|
||||
{
|
||||
[SerializeField]
|
||||
private InputField mInnerInputField;
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mInnerInputField.text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.mInnerInputField.text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSelect(BaseEventData eventData)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
this.mInnerInputField.OnSelect(eventData);
|
||||
var image = this.transform.GetComponent<Image>();
|
||||
var png = Resources.Load<Sprite>("Images/input-bg2");
|
||||
image.sprite = png;
|
||||
}
|
||||
|
||||
public void OnDeselect(BaseEventData eventData)
|
||||
{
|
||||
this.mInnerInputField.OnDeselect(eventData);
|
||||
var image = this.transform.GetComponent<Image>();
|
||||
var png1 = Resources.Load<Sprite>("Images/input-bg1");
|
||||
image.sprite = png1;
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>(this.OnSelect));
|
||||
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.Select, new UnityAction<BaseEventData>(this.OnSelect));
|
||||
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.Deselect, new UnityAction<BaseEventData>(this.OnDeselect));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfae8ac78fe0be741802fcc046f0a716
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
public class PfText : MonoBehaviour
|
||||
public class PfText : PFUIComponentBase
|
||||
{
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -4,10 +4,12 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
public class PfPrimaryButton : MonoBehaviour
|
||||
[RequireComponent(typeof(Button))]
|
||||
public class PfPrimaryButton : PFUIComponentBase
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0341abab3ca8db49b556a2b5cb0465b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Assets.Scripts.Devices.Ant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -6,22 +7,61 @@ using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DeviceController : MonoBehaviour
|
||||
public class DeviceController : PFUIPanel
|
||||
{
|
||||
public Toggle toggle;
|
||||
private float timer = 1.0f;
|
||||
protected override void Awake()
|
||||
{
|
||||
AntConnector.Instance();
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
Button button = this.transform.Find("Button").GetComponent<Button>();
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
});
|
||||
|
||||
this.toggle = this.transform.Find("Toggle").GetComponent<Toggle>();
|
||||
this.toggle.onValueChanged.AddListener(s =>
|
||||
{
|
||||
if (s)
|
||||
{
|
||||
this.toggle.transform.GetComponentInChildren<UnityEngine.UI.Text>().color = Color.green;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.toggle.transform.GetComponentInChildren<UnityEngine.UI.Text>().color = Color.gray;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
if (timer <= 0)
|
||||
{
|
||||
this.toggle.isOn = AntConnector.Instance().IsAvailable;
|
||||
|
||||
//foreach (var item in AntConnector.Instance().discoveredDevices)
|
||||
//{
|
||||
// if (!devices.ContainsKey(item.DeviceNumber))
|
||||
// {
|
||||
// var dev1 = Instantiate(device);
|
||||
// dev1.transform.SetParent(this.grid.transform);
|
||||
// var s1 = dev1.GetComponent<Assets.Scripts.UI.Devicea>();
|
||||
// s1.Device = item;
|
||||
|
||||
// devices.Add(item.DeviceNumber, dev1);
|
||||
// }
|
||||
//}
|
||||
|
||||
timer = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EditUserController : PFUIPanel
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d865b6d0ecb54044a4600bc590d8c29
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -8,7 +8,7 @@ using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class HomeController : MonoBehaviour
|
||||
public class HomeController : PFUIPanel
|
||||
{
|
||||
[SerializeField] Text Ftp;
|
||||
[SerializeField] RawImage Avatar;
|
||||
@@ -22,8 +22,9 @@ public class HomeController : MonoBehaviour
|
||||
[SerializeField] Button BtnRide;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
//var parent = Utils.FindUpParent(gameObject.transform);
|
||||
//if (parent.Find("ToastContainer") == null)
|
||||
//{
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
//namespace Assets.Scripts.UI.Prefab.Panel
|
||||
//{
|
||||
public class PFUIPanel : UIBehaviour
|
||||
{
|
||||
|
||||
public void OpenURL(string url)
|
||||
{
|
||||
Application.OpenURL(url);
|
||||
}
|
||||
}
|
||||
//}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3622b843b296d2e46ba722beb139f040
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,10 +3,10 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UserInfoController : MonoBehaviour
|
||||
public class UserInfoController : PFUIPanel
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
protected override void Start()
|
||||
{
|
||||
this.transform.localPosition = new Vector3(0, 0, 0);
|
||||
|
||||
@@ -16,6 +16,12 @@ public class UserInfoController : MonoBehaviour
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
});
|
||||
|
||||
Button editBtn = this.transform.Find("InfoPanel").Find("EditButton").GetComponent<Button>();
|
||||
editBtn.onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowEditUserPanel();
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
||||
Reference in new issue
Block a user