Merge branch 'master' of https://bdgit.educoder.net/p5uap9m7n/AED
commit
3aa3877aa1
@ -1,87 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cinemachine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
|
||||
public class Canvas2 : MonoBehaviour
|
||||
{
|
||||
public AudioClip[] ac;
|
||||
AudioSource audioSource;
|
||||
public GameObject tip2;
|
||||
public GameObject step2_1;
|
||||
public GameObject step2_2;
|
||||
public Animator animator;
|
||||
public GameObject errorTip;
|
||||
public GameObject step2_3;
|
||||
private void Start()
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
EventManager.Instance.register("NextAc", NextAc);
|
||||
EventManager.Instance.register("ActionTwoEnd", ActionTwoEnd);
|
||||
EventManager.Instance.register("guancha",Guancha);
|
||||
tip2.SetActive(true);
|
||||
Invoke("InitLevel2", 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void InitLevel2()
|
||||
{
|
||||
tip2.GetComponentInChildren<Tip>().str = "请选择正确的部位进行拍打询问";
|
||||
tip2.SetActive(false);
|
||||
step2_1.SetActive(true);
|
||||
tip2.SetActive(true);
|
||||
}
|
||||
|
||||
void Guancha(params object[] data) {
|
||||
audioSource.clip = ac[1];
|
||||
audioSource.Play();
|
||||
}
|
||||
public void ActionOne(bool inspect) {
|
||||
if (inspect)
|
||||
{
|
||||
step2_1.SetActive(false);
|
||||
audioSource.clip = ac[0];
|
||||
audioSource.Play();
|
||||
animator.SetTrigger("Huhuan");
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
errorTip.SetActive(true);
|
||||
errorTip.GetComponentInChildren<ErrorTip>().InitThis("当前拍打部位错误,请重试");
|
||||
}
|
||||
}
|
||||
void NextAc(params object[] data) {
|
||||
GameObject obj = Instantiate(Resources.Load<GameObject>("operate"), GameObject.FindWithTag("Grid").transform);
|
||||
obj.GetComponent<Operate>().str = "1-判断被救者有无意识";
|
||||
tip2.GetComponentInChildren<Tip>().str = "请选择正确的部位进行观察被救者的呼吸";
|
||||
tip2.SetActive(false);
|
||||
tip2.SetActive(true);
|
||||
step2_2.SetActive(true);
|
||||
|
||||
}
|
||||
|
||||
void ActionTwoEnd(params object[] data) {
|
||||
step2_3.SetActive(true);
|
||||
}
|
||||
|
||||
public void ActionTwo(bool inspect)
|
||||
{
|
||||
if (inspect)
|
||||
{
|
||||
step2_2.SetActive(false);
|
||||
animator.SetTrigger("Tuoyi");
|
||||
}
|
||||
else
|
||||
{
|
||||
errorTip.SetActive(true);
|
||||
errorTip.GetComponentInChildren<ErrorTip>().InitThis("当前观察部位错误,请重试");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e546a613bbac3ad44acb0fff81fb0b44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,39 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
public class DrawLine : MonoBehaviour,IPointerClickHandler
|
||||
{
|
||||
RectTransform rt;
|
||||
void Start()
|
||||
{
|
||||
rt = GetComponent<RectTransform>();
|
||||
Vector2 point1 = rt.anchoredPosition + new Vector2(-rt.sizeDelta.x / 2, rt.sizeDelta.y / 2);
|
||||
Vector2 point2 = rt.anchoredPosition + new Vector2(rt.sizeDelta.x / 2, rt.sizeDelta.y / 2);
|
||||
Vector2 point3 = rt.anchoredPosition + new Vector2(-rt.sizeDelta.x / 2, -rt.sizeDelta.y / 2);
|
||||
Vector2 point4 = rt.anchoredPosition + new Vector2(rt.sizeDelta.x / 2, -rt.sizeDelta.y / 2);
|
||||
DrawStraightLine(point1, point2);
|
||||
DrawStraightLine(point2, point4);
|
||||
DrawStraightLine(point3, point4);
|
||||
DrawStraightLine(point3, point1);
|
||||
}
|
||||
void DrawStraightLine(Vector2 a, Vector2 b)
|
||||
{
|
||||
GameObject img = new GameObject();
|
||||
img.AddComponent<Image>();
|
||||
img.transform.SetParent(transform);
|
||||
img.GetComponent<Image>().raycastTarget = false;
|
||||
float distance = Vector2.Distance(a, b);
|
||||
float angle = Vector2.SignedAngle(a - b, Vector2.left);
|
||||
img.GetComponent<RectTransform>().anchoredPosition = (a + b) / 2;
|
||||
img.GetComponent<RectTransform>().sizeDelta = new Vector2(distance, 5);
|
||||
img.transform.localRotation = Quaternion.AngleAxis(-angle, Vector3.forward);
|
||||
img.GetComponent<Image>().color = Color.red;
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f500fe94495be2459997134376a881e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,28 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
public class Question2 : MonoBehaviour
|
||||
{
|
||||
public int index;//玩家选择的答案记录
|
||||
int rand;//随机的结果
|
||||
public string[] questionInfo;
|
||||
Toggle tg;
|
||||
void Start()
|
||||
{
|
||||
|
||||
tg = GetComponent<Toggle>();
|
||||
Debug.Log("对题目进行初始化");
|
||||
rand = Step2_3.rand;
|
||||
transform.GetChild(1).GetComponent<Text>().text = questionInfo[rand];
|
||||
tg.onValueChanged.AddListener((bool value) =>
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
EventManager.Instance.emit("Question2", index);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd91c0d5a804bf64498ad6c20b35d0fd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,21 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using UnityEngine.UI;
|
||||
public class Tip : MonoBehaviour
|
||||
{
|
||||
public float time;
|
||||
[TextArea]
|
||||
public string str;
|
||||
Text myText;
|
||||
private void Awake()
|
||||
{
|
||||
myText = GetComponent<Text>();
|
||||
}
|
||||
private void OnEnable()
|
||||
{
|
||||
myText.text = "";
|
||||
myText.DOText(str, time);
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cb08099ae8f90d4890c0319edd1e963
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cb7a923ce234c242a10dd106105826f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc62637c6246ccc428064df41cb5be1d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,11 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LoadManager : MonoSingleton<LoadManager>
|
||||
{
|
||||
public T Load<T>(string path) where T:class
|
||||
{
|
||||
return Resources.Load(path) as T;
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c94f25fee4a4da34bbe263f631e5cd65
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f0567f363b89b847b07c63968cf7b33
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,3 +0,0 @@
|
||||
public interface IObserver {
|
||||
void Notify();
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46ec0ffc8508fa24aa92cddc19d59dcc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,39 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
public class MessageCenter : MonoSingleton<MessageCenter>
|
||||
{
|
||||
public delegate void Message();
|
||||
Dictionary<string, Message> Events=new Dictionary<string, Message>();
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
DontDestroyOnLoad(gameObject);
|
||||
Events = new Dictionary<string, Message>();
|
||||
}
|
||||
public void AddListen(string eventName, IObserver observer) {
|
||||
if (!Events.ContainsKey(eventName))
|
||||
{
|
||||
Message message = new Message(observer.Notify);
|
||||
Events.Add(eventName, message);
|
||||
return;
|
||||
}
|
||||
Events[eventName]+=observer.Notify;
|
||||
}
|
||||
|
||||
public void RemoveListen(string eventName, IObserver observer)
|
||||
{
|
||||
if (Events.ContainsKey(eventName))
|
||||
{
|
||||
Events[eventName] -= observer.Notify;
|
||||
}
|
||||
}
|
||||
|
||||
public void SendEvent(string eventName) {
|
||||
if (!Events.ContainsKey(eventName)) return;
|
||||
Events[eventName]();
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e86b7a137f0e0fe4baf15cad99c6bcff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in new issue