You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
3.6 KiB
132 lines
3.6 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.MessageSystem;
|
||
|
|
||
|
public class ShowDraw : MonoBehaviour {
|
||
|
|
||
|
int Num;
|
||
|
DrawLinePlate drawLine;
|
||
|
private GameObject Father; //画线父物体
|
||
|
private GameObject Tagfather; //标签父物体
|
||
|
private string TheDrawPlaneName = "DrawPlane";
|
||
|
public static ShowDraw instance;
|
||
|
private MouseFollowRotation MouseFollow;
|
||
|
private InputManager inputManager;
|
||
|
private UITaskWin uiTaskWin;
|
||
|
|
||
|
void Awake()
|
||
|
{
|
||
|
if (instance == null)
|
||
|
{
|
||
|
instance = this;
|
||
|
}
|
||
|
}
|
||
|
void Start ()
|
||
|
{
|
||
|
drawLine = GameObject.Find("Canvas").transform.Find("DrawPlane").GetComponent<DrawLinePlate>();
|
||
|
MouseFollow = GameObject.Find("Main Camera").GetComponent<MouseFollowRotation>();
|
||
|
inputManager = GameObject.Find("Main Camera").GetComponent<InputManager>();
|
||
|
Father = GameObject.Find("Canvas/DrawFather").gameObject;
|
||
|
Tagfather = GameObject.Find("TagFather").gameObject;
|
||
|
uiTaskWin = GameObject.Find("Canvas").transform.Find("TaskWind").GetComponent<UITaskWin>();
|
||
|
|
||
|
}
|
||
|
public void TheShowPlane() //显示画板
|
||
|
{
|
||
|
drawLine.gameObject.SetActive(true);
|
||
|
MouseFollow.enabled = false;
|
||
|
inputManager.enabled = false;
|
||
|
uiTaskWin.enabled = false;
|
||
|
drawLine.enabled = true;
|
||
|
UITaskWin.Instance. shield = true;
|
||
|
drawLine.HiStart();
|
||
|
drawLine.GetMaterialColor(9);
|
||
|
}
|
||
|
public void ClosePlane()//关闭画板
|
||
|
{
|
||
|
drawLine.enabled = false;
|
||
|
drawLine.gameObject.SetActive(false);
|
||
|
Cursor.visible = true;
|
||
|
AddItem.CanAdd = false;
|
||
|
UITaskWin.Instance. shield = false;
|
||
|
uiTaskWin.enabled = true;
|
||
|
MouseFollow.enabled = true;
|
||
|
inputManager.enabled = true;
|
||
|
if (GameObject.Find("VectorCam"))
|
||
|
{
|
||
|
GameObject ob = GameObject.Find("VectorCam").gameObject;
|
||
|
Destroy(ob);
|
||
|
}
|
||
|
ClearGame();
|
||
|
}
|
||
|
public void ClearGame() //清空
|
||
|
{
|
||
|
foreach (Transform child in Father.transform)
|
||
|
{
|
||
|
drawLine.Record_.Remove(child.gameObject);
|
||
|
Destroy(child.gameObject);
|
||
|
}
|
||
|
if (drawLine.gameObject.activeInHierarchy)
|
||
|
{
|
||
|
drawLine.HiStart();
|
||
|
}
|
||
|
foreach (Transform child in Tagfather.transform)
|
||
|
{
|
||
|
if (child.gameObject.name.Equals("addtag(Clone)"))
|
||
|
{
|
||
|
Destroy(child.gameObject);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void OnClickButton(GameObject obj) //点击画板按钮传入对应的Num
|
||
|
{
|
||
|
if(obj.gameObject.name.Equals("Red"))
|
||
|
{
|
||
|
Num = 4;
|
||
|
}
|
||
|
else if (obj.gameObject.name.Equals("Blue"))
|
||
|
{
|
||
|
Num = 2;
|
||
|
}
|
||
|
else if (obj.gameObject.name.Equals("DlepBlue"))
|
||
|
{
|
||
|
Num = 3;
|
||
|
}
|
||
|
else if (obj.gameObject.name.Equals("Green"))
|
||
|
{
|
||
|
Num = 5;
|
||
|
}
|
||
|
else if (obj.gameObject.name.Equals("Black"))
|
||
|
{
|
||
|
Num = 1;
|
||
|
}
|
||
|
else if (obj.gameObject.name.Equals("Yellow"))
|
||
|
{
|
||
|
Num = 6;
|
||
|
}
|
||
|
else if (obj.gameObject.name.Equals("Pen"))
|
||
|
{
|
||
|
Num =7;
|
||
|
}
|
||
|
else if (obj.gameObject.name.Equals("easer"))
|
||
|
{
|
||
|
Num = 8;
|
||
|
}
|
||
|
else if (obj.gameObject.name.Equals("Clear"))
|
||
|
{
|
||
|
ClearGame();
|
||
|
}
|
||
|
else if (obj.gameObject.name.Equals("Tag"))
|
||
|
{
|
||
|
AddItem.CanAdd = true;
|
||
|
Cursor.visible = true;
|
||
|
Num = 9;
|
||
|
}
|
||
|
|
||
|
drawLine.GetMaterialColor(Num);
|
||
|
}
|
||
|
|
||
|
}
|