private void DisAbleEntity() { if (inPlay) { waitTime += Time.deltaTime; if (waitTime > 1f) { foreach (KeyValuePair <string, List <ElementItem> > item in ElementContainer.GetInstance().dicElements) { foreach (ElementItem itemElement in item.Value) { if (itemElement != ElementContainer.GetInstance().nowElement) { itemElement.gameObject.SetActive(false); } } } foreach (Transform itemArray in ElementContainer.GetInstance().arrayLabelParent) { itemArray.gameObject.SetActive(false); } waitTime = 0f; } } }
void Update() { if (ElementContainer.GetInstance().isCurrent) { if (Input.GetMouseButtonDown(0)) { drawRectangle = true; //如果鼠标左键按下 设置开始画线标志 start = Input.mousePosition; //记录按下位置 } else if (Input.GetMouseButtonUp(0)) { drawRectangle = false; //如果鼠标左键放开 结束画线 CheckSelection(start, Input.mousePosition); //框选物体 string resSelectList = ""; foreach (ElementItem item in ElementContainer.GetInstance().listSelectItems) { resSelectList += "{\"resId\":\"" + item.name + "\",\"t_eCode\":\"" + item.t_eType + "\"},"; } if (!string.IsNullOrEmpty(resSelectList)) { resSelectList = "[" + resSelectList + "]"; resSelectList = resSelectList.Remove(resSelectList.LastIndexOf(","), 1);; //移除掉最后一个"," } GameObject.Find("JSInterface").GetComponent <JSInterface>().selectCurrentResList(resSelectList); } } }
/// <summary> /// 设置目标物体 /// </summary> /// <param name="_target"></param> public void SetTarget(Transform _target, Vector3 _initPos, bool _exist = true) { initPos = _initPos; posNum = 0; exist = _exist; target = _target; d_Length = 0f; z_Degree = 0f; target.localPosition = listPos[0]; Vector3 temp = new Vector3(); for (int i = 0; i < listPos.Count; i++) { if (i + 1 < listPos.Count) { d_Length += Vector3.Distance(listPos[i], listPos[i + 1]); } } foreach (Vector3 item in listPos) { Vector3 temp1 = ElementContainer.GetInstance().transform.TransformPoint(item); temp += temp1; } Camera.main.GetComponent <BLCameraControl>().LookAtPosition3(temp / listPos.Count); }
public void Select() { Debug.Log("选择" + transform.name); if (!ElementContainer.GetInstance().listSelectItems.Contains(this)) { ElementContainer.GetInstance().listSelectItems.Add(this); } }
public void DisSelect() { Debug.Log("取消选择" + transform.name); if (ElementContainer.GetInstance().listSelectItems.Contains(this)) { ElementContainer.GetInstance().listSelectItems.Remove(this); } }
IEnumerator WaitTime() { yield return(new WaitForSeconds(0.1f)); if (ElementContainer.GetInstance().nowElement != null) { ElementContainer.GetInstance().nowElement.SetUIByLevel(1); } target = null; }
// Update is called once per frame void Update() { if (ElementContainer.GetInstance().domMode == DomMode.lx || ElementContainer.GetInstance().domMode == DomMode.xj) { if (Input.GetMouseButtonUp(0)) { DoubleClick(); } } }
/// <summary> /// 重置 /// </summary> public void ResetStart() { listPos.Clear(); dicPosLine.Clear(); isPlay = false; inPlay = false; if (nowTrack != null) { foreach (KeyValuePair <GameObject, bool> item in ElementContainer.GetInstance().dicTrack) { if (item.Key != null) { item.Key.SetActive(item.Value); } } if (exist) { target.position = initPos; foreach (KeyValuePair <string, List <Transform> > item in ElementContainer.GetInstance().dicLineLabels) { if (item.Value.Contains(target)) { if (ElementContainer.GetInstance().arrayLabelParent.Find(item.Key) != null) { ElementContainer.GetInstance().arrayGo = ElementContainer.GetInstance().arrayLabelParent.Find(item.Key).gameObject; ElementContainer.GetInstance().arrayLabelParent.Find(item.Key).gameObject.SetActive(false); } //ElementContainer.GetInstance().level = 1; } } target.GetComponent <ElementItem>().Set(target.GetComponent <ElementItem>().resEntityTemp, false, true); } else { Destroy(target.gameObject); ElementContainer.GetInstance().SceneToLevel(1); exist = true; } ElementContainer.GetInstance().nowElement = target.GetComponent <ElementItem>(); if (ElementContainer.GetInstance().arrayGo != null) { if (ElementContainer.GetInstance().dicTrack.ContainsKey(ElementContainer.GetInstance().arrayGo)) { if (ElementContainer.GetInstance().dicTrack[ElementContainer.GetInstance().arrayGo] == true) { ElementContainer.GetInstance().ResetLabel(true); } } } nowTrack = null; } StartCoroutine(WaitTime()); }
/// <summary> /// 资源切换按钮事件 /// </summary> /// <param name="type">0-全部,1-人员,2-监控,3-传感器,4-设备,5-车辆</param> public void SelectResType(int type) { nowState = type; move.ResetButtonStyle(); panelPerson.gameObject.SetActive(false); Camera.main.GetComponent <BLCameraControl>().LookAtResAutoDis(GameObject.Find("TViewBase").transform); switch (type) { case 0: Debug.Log("选择全部资源按钮"); foreach (KeyValuePair <ElementType, List <ElementItem> > item in ElementContainer.GetInstance().dicElements) { foreach (ElementItem itemElement in item.Value) { itemElement.gameObject.SetActive(true); } } break; case 1: Debug.Log("选择人员按钮"); panelPerson.gameObject.SetActive(true); ElementContainer.GetInstance().SetElementItemVisible(ElementType.PERSON); break; case 2: Debug.Log("选择监控按钮"); ElementContainer.GetInstance().SetElementItemVisible(ElementType.JK); break; case 3: Debug.Log("选择传感器按钮"); ElementContainer.GetInstance().SetElementItemVisible(ElementType.CGQ); break; case 4: Debug.Log("选择设备按钮"); ElementContainer.GetInstance().SetElementItemVisible(ElementType.SB); break; case 5: Debug.Log("选择车辆按钮"); ElementContainer.GetInstance().SetElementItemVisible(ElementType.CAR); break; default: break; } }
public void DoubleClick() { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.transform.name.Split('_')[0] == "point") { foreach (KeyValuePair <string, GameObject> item in dicPoints) { item.Value.GetComponent <MeshRenderer>().material = matNormal; } hit.transform.GetComponent <MeshRenderer>().material = matSelect; string calljs = "{\"lineId\":\"" + hit.transform.name.Split('_')[1] + "\",\"distance\":" + hit.transform.name.Split('_')[2] + "}"; GameObject.Find("JSInterface").GetComponent <JSInterface>().selectCurrentRes(calljs); } if (Time.realtimeSinceStartup - lastKickTime < 0.2)//检测上次点击的时间和当前时间差 在一定范围内认为是双击 { if (hit.transform.parent.GetComponent <Line>() != null) { GameObject go = Instantiate(goPoint) as GameObject; go.transform.parent = transform; Line line = hit.transform.parent.GetComponent <Line>(); Vector3 startPos = ElementContainer.GetInstance().tviewBase.transform.TransformPoint(line.startPoint.pos); Vector3 endPos = ElementContainer.GetInstance().tviewBase.transform.TransformPoint(line.endPoint.pos); go.transform.position = GetAxisPos(startPos, endPos, hit.point); float distance = Vector3.Distance(go.transform.position, startPos) / 2; go.name = "point_" + line.id + "_" + distance.ToString(); if (!dicPoints.ContainsKey(go.name)) { dicPoints.Add(go.name, go); } string wayTemp = "{\"lineId\":\"" + line.id + "\",\"distance\":" + distance + "}"; if (ElementContainer.GetInstance().domMode == DomMode.lx) { GameObject.Find("JSInterface").GetComponent <JSInterface>().sendWayPointPosition(wayTemp); } else { GameObject.Find("JSInterface").GetComponent <JSInterface>().sendInspectionPointPosition(wayTemp); } } } lastKickTime = Time.realtimeSinceStartup;//重新设置上次点击的时间 } }
/// <summary> /// 根据当前层级显示UI /// </summary> /// <param name="level">0-第一层级(默认层级),1-第二层级</param> public void SetUIByLevel(int level) { switch (level) { case 0: Debug.Log("显示第一层级"); first.transform.Find("tuo").gameObject.SetActive(true); textParent.gameObject.SetActive(false); indexPanel.DOScaleY(0, 0.2f).SetEase(Ease.Linear).OnComplete(delegate() { first.transform.Find("Icon").DOLocalMoveY(0.45f, 0.2f); line.DOScaleY(0, 0.2f).SetEase(Ease.Linear).OnComplete(delegate() { second.SetActive(false); first.SetActive(true); }); }); Camera.main.GetComponent <BLCameraControl>().SetZoomLimit(0, 2500); transform.Find("Circle").gameObject.SetActive(false); break; case 1: Debug.Log("显示第二层级"); ElementContainer.GetInstance().isClick = false; first.SetActive(true); second.SetActive(true); first.transform.Find("tuo").gameObject.SetActive(false); first.transform.Find("Icon").DOLocalMoveY(1.3f, 0.2f); transform.Find("Circle").gameObject.SetActive(true); line.DOScaleY(0.9f, 0.2f).SetEase(Ease.Linear).OnComplete(delegate() { indexPanel.DOScaleY(0.3f, 0.2f).SetEase(Ease.Linear).OnComplete(delegate() { textParent.gameObject.SetActive(true); ElementContainer.GetInstance().isClick = true; }); }); Camera.main.GetComponent <BLCameraControl>().LookAtPosition2(transform.position, 500F); GameObject.Find("JSInterface").GetComponent <JSInterface>().selectCurrentArea(transform.name); break; default: break; } }
public void ChangePersonByHole(int num) { ElementContainer.GetInstance().SetPersonItemVisible(num - 1); switch (num) { case 0: Debug.Log("全部"); personGroup.listBtn[0].transform.DOLocalMoveY(4, 0.5f); personGroup.listBtn[1].transform.DOLocalMoveY(-6, 0.5f); personGroup.listBtn[2].transform.DOLocalMoveY(-6, 0.5f); personGroup.listBtn[3].transform.DOLocalMoveY(-6, 0.5f); break; case 1: Debug.Log("矿领导"); personGroup.listBtn[1].transform.DOLocalMoveY(4, 0.5f); personGroup.listBtn[0].transform.DOLocalMoveY(-6, 0.5f); personGroup.listBtn[2].transform.DOLocalMoveY(-6, 0.5f); personGroup.listBtn[3].transform.DOLocalMoveY(-6, 0.5f); break; case 2: Debug.Log("工人"); personGroup.listBtn[2].transform.DOLocalMoveY(4, 0.5f); personGroup.listBtn[1].transform.DOLocalMoveY(-6, 0.5f); personGroup.listBtn[0].transform.DOLocalMoveY(-6, 0.5f); personGroup.listBtn[3].transform.DOLocalMoveY(-6, 0.5f); break; case 3: Debug.Log("访客"); personGroup.listBtn[3].transform.DOLocalMoveY(4, 0.5f); personGroup.listBtn[1].transform.DOLocalMoveY(-6, 0.5f); personGroup.listBtn[2].transform.DOLocalMoveY(-6, 0.5f); personGroup.listBtn[0].transform.DOLocalMoveY(-6, 0.5f); break; default: break; } }
private IEnumerator wait() { yield return(new WaitForSeconds(0f)); float numTemp = 1.15f; foreach (KeyValuePair <string, List <Transform> > itemText in dicResType) { if (ElementContainer.GetInstance().listType.Contains(itemText.Key)) { GameObject goText = null; numTemp += 0.25f; if (textParent.Find(itemText.Key) != null) { goText = textParent.Find(itemText.Key).gameObject; } else if (ElementContainer.GetInstance().diceType.ContainsKey(itemText.Key)) { goText = Instantiate(textP) as GameObject; goText.transform.SetParent(textParent); goText.transform.localPosition = new Vector3(0, numTemp - 0.2f, 0); goText.transform.localScale = new Vector3(1, 1, 1); goText.transform.localEulerAngles = Vector3.zero; goText.name = itemText.Key; } if (textSize < Encoding.Default.GetByteCount(ElementContainer.GetInstance().diceType[itemText.Key].name + "个数:" + itemText.Value.Count)) { textSize = Encoding.Default.GetByteCount(ElementContainer.GetInstance().diceType[itemText.Key].name + "个数:" + itemText.Value.Count); } goText.GetComponent <TextMeshPro>().text = ElementContainer.GetInstance().diceType[itemText.Key].name + "个数:" + itemText.Value.Count; } } index.transform.localScale = new Vector3(1f / 32f * textSize, numTemp - 1.1f, 1); iconJH.sprite = Manager.GetInstance().iconJH; iconTuo.color = Manager.GetInstance().iconColor; }
//private void OnDisable() //{ // SetUIByLevel(0); //} /// <summary> /// 根据当前层级显示UI /// </summary> /// <param name="level">0-第一层级(默认层级),1-第二层级</param> public void SetUIByLevel(int level, bool zhankai = false) { switch (level) { case 0: Debug.Log("显示第一层级"); pian.SetActive(false); tuo.SetActive(true); textParent.gameObject.SetActive(false); indexPanel.DOScaleY(0, 0f).SetEase(Ease.Linear).OnComplete(delegate() { first.transform.Find("Icon").DOLocalMoveY(0.45f, 0f); line.DOScaleY(0, 0f).SetEase(Ease.Linear).OnComplete(delegate() { second.SetActive(false); first.SetActive(true); }); }); ElementContainer.GetInstance().nowElement = null; Camera.main.GetComponent <BLCameraControl>().SetZoomLimit(0, 2500); circle.SetActive(false); if (nowLevel == 0) { return; } if (!zhankai) { GameObject.Find("JSInterface").GetComponent <JSInterface>().unSelectRes(transform.name); } break; case 1: Debug.Log("显示第二层级"); ElementContainer.GetInstance().isClick = false; if (ElementContainer.GetInstance().nowElement != null) { if (ElementContainer.GetInstance().nowElement != this) { ElementContainer.GetInstance().nowElement.SetUIByLevel(0); } } ElementContainer.GetInstance().nowElement = null; first.SetActive(true); second.SetActive(true); if (nowState == 0) { circle.SetActive(true); pian.SetActive(false); } else { circle.gameObject.SetActive(false); pian.SetActive(true); pian.GetComponent <MeshRenderer>().material.color = elementColor; } tuo.SetActive(false); first.transform.Find("Icon").DOLocalMoveY(1.3f, 0.2f); line.DOScaleY(0.9f, 0.2f).SetEase(Ease.Linear).OnComplete(delegate() { indexPanel.DOScaleY(indexH, 0.2f).SetEase(Ease.Linear).OnComplete(delegate() { textParent.gameObject.SetActive(true); ElementContainer.GetInstance().SceneToLevel(2); ElementContainer.GetInstance().nowElement = this; ElementContainer.GetInstance().isClick = true; }); }); Camera.main.GetComponent <BLCameraControl>().LookAtPosition2(transform.position); if (nowLevel == 1) { return; } string calljs = "{\"resId\":\"" + transform.name + "\",\"t_eCode\":\"" + t_eType + "\"}"; GameObject.Find("JSInterface").GetComponent <JSInterface>().selectCurrentRes(calljs); break; default: break; } nowLevel = level; }
private IEnumerator WaitTrack(Track track, bool refresh = false, List <IndexData> _data = null) { yield return(new WaitForSeconds(0)); if (!refresh) { if (ElementContainer.GetInstance().diceTypeSprites.ContainsKey(track.t_eCode)) { iconSR.sprite = ElementContainer.GetInstance().diceTypeSprites[track.t_eCode]; } if (_data != null) { for (int i = _data.Count - 1; i >= 0; i--) { numTemp += 0.25f; GameObject goTextTime = Instantiate(P_text) as GameObject; goTextTime.transform.SetParent(textParent); goTextTime.transform.localPosition = new Vector3(0, numTemp - 0.2f, 0); goTextTime.transform.localScale = new Vector3(1, 1, 1); goTextTime.transform.localEulerAngles = Vector3.zero; indexH = numTemp - 1.8f; goTextTime.name = (i + track.data.Count).ToString(); if (textSize < Encoding.Default.GetByteCount(track.track[0].data[i].key + ":" + track.track[0].data[i].value)) { textSize = Encoding.Default.GetByteCount(track.track[0].data[i].key + ":" + track.track[0].data[i].value); } goTextTime.GetComponent <TextMeshPro>().text = track.track[0].data[i].key + ":" + track.track[0].data[i].value; } } for (int i = track.data.Count - 1; i >= 0; i--) { GameObject goText = null; if (textParent.Find(i.ToString()) != null) { goText = textParent.Find(i.ToString()).gameObject; } else { numTemp += 0.25f; goText = Instantiate(P_text) as GameObject; goText.transform.SetParent(textParent); goText.transform.localPosition = new Vector3(0, numTemp - 0.2f, 0); goText.transform.localScale = new Vector3(1, 1, 1); goText.transform.localEulerAngles = Vector3.zero; indexH = numTemp - 1.8f; goText.name = i.ToString(); } if (textSize < Encoding.Default.GetByteCount(track.data[i].key + ":" + track.data[i].value)) { textSize = Encoding.Default.GetByteCount(track.data[i].key + ":" + track.data[i].value); } goText.GetComponent <TextMeshPro>().text = track.data[i].key + ":" + track.data[i].value; } indexPanel.DOScaleX(1f / 32f * textSize, 0); indexPanel.DOScaleY(indexH, 0f); } else { if (_data != null) { for (int i = 0; i < _data.Count; i++) { textParent.Find((i + (numTemp - 0.25f * _data.Count - 1.8f) / 0.25f).ToString()).GetComponent <TextMeshPro>().text = _data[i].key + ":" + _data[i].value; } } } }
private void AlarmState() { dicElements.Clear(); foreach (Transform item in textParent) { DestroyImmediate(item.gameObject); } numTemp = 1.8f; string result = "[{\"alarmResId\":\"" + transform.name + "\",\"alarmResTCode\":\"" + t_eType + "\",\"alarmRangeRes\":["; foreach (ElementItem item in transform.parent.parent.parent.GetComponentsInChildren <ElementItem>(true)) { if (item.name != transform.name) { Debug.Log(item.name + "和" + transform.name + "的距离" + Vector3.Distance(item.transform.position, transform.position)); Debug.Log("当前距离" + scale_x * 25); if (Vector3.Distance(item.transform.position, transform.position) <= scale_x * 25) { result += "{\"resId\":\"" + item.name + "\",\"t_eCode\":\"" + item.t_eType + "\"},"; if (dicElements.ContainsKey(ElementContainer.GetInstance().diceType[item.t_eType].name)) { dicElements[ElementContainer.GetInstance().diceType[item.t_eType].name].Add(item); } else { List <ElementItem> listTemp = new List <ElementItem>(); listTemp.Add(item); dicElements.Add(ElementContainer.GetInstance().diceType[item.t_eType].name, listTemp); } } } } if (!string.IsNullOrEmpty(result)) { result = result.Remove(result.LastIndexOf(','), 1); } result += "]}]"; GameObject.Find("JSInterface").GetComponent <JSInterface>().sendAlarmRes(result); //ElementContainer.GetInstance().SingleAlarm(transform, scale_x, dicElements); foreach (KeyValuePair <string, List <ElementItem> > item in dicElements) { GameObject goText = null; numTemp += 0.25f; if (textParent.Find(item.Key) != null) { goText = textParent.Find(item.Key).gameObject; } else { goText = Instantiate(P_text) as GameObject; goText.transform.SetParent(textParent); goText.transform.localPosition = new Vector3(0, numTemp - 0.2f, 0); goText.transform.localScale = new Vector3(1, 1, 1); goText.transform.localEulerAngles = Vector3.zero; goText.name = item.Key; } if (textSize < Encoding.Default.GetByteCount(item.Key + "个数:" + item.Value.Count + "个")) { textSize = Encoding.Default.GetByteCount(item.Key + "个数:" + item.Value.Count + "个"); } goText.GetComponent <TextMeshPro>().text = item.Key + "个数:" + item.Value.Count + "个"; indexPanel.DOScaleX(1f / 32f * textSize, 0); } indexH = numTemp - 1.8f; indexPanel.DOScaleY(indexH, 0.2f).SetEase(Ease.Linear).OnComplete(delegate() { foreach (Transform item in textParent) { if (item.localPosition.y > indexH + 1.6f) { DestroyImmediate(item.gameObject); } } }); }
private void TelPageLater() { ElementContainer.GetInstance().cameraStartTrans = Camera.main.transform; GameObject.Find("JSInterface").GetComponent <JSInterface>().initFinished(); SendMessageToWeb(); }
public void Set(Entity resEntity, bool refresh = false, bool isPlay = false) { resEntityTemp = resEntity; t_eType = resEntity.t_eCode; lineId = resEntity.position.lineId; nowState = resEntity.state; pian.SetActive(false); Material matPian = new Material(pian.GetComponent <MeshRenderer>().material); pian.GetComponent <MeshRenderer>().material = matPian; if (resEntity.display == 1) { gameObject.SetActive(false); } if (resEntity.state == 0) { int dataCount = resEntity.data.Count; for (int i = resEntity.data.Count - 1; i >= 0; i--) { GameObject goText = null; if (textParent.Find(i.ToString()) != null) { if (isPlay) { goText = textParent.GetChild(dataCount - 1 - i).gameObject; } else { goText = textParent.GetChild(dataCount - 1 - i).gameObject; } } else { numTemp += 0.25f; goText = Instantiate(P_text) as GameObject; goText.transform.SetParent(textParent); goText.transform.localPosition = new Vector3(0, numTemp - 0.2f, 0); goText.transform.localScale = new Vector3(1, 1, 1); goText.transform.localEulerAngles = Vector3.zero; indexH = numTemp - 1.8f; goText.name = i.ToString(); } } Invoke("SetTextMeshPro", 0.1f); } if (resEntity.data.Count < textParent.childCount) { for (int i = resEntity.data.Count; i < textParent.childCount; i++) { numTemp -= 0.25f; DestroyImmediate(textParent.GetChild(i).gameObject); } } if (ElementContainer.GetInstance().diceTypeSprites.ContainsKey(resEntity.t_eCode)) { iconSR.sprite = ElementContainer.GetInstance().diceTypeSprites[resEntity.t_eCode]; } Color nowColor; ColorUtility.TryParseHtmlString(ElementContainer.GetInstance().diceType[resEntity.t_eCode].data.color, out nowColor); elementColor = new Color(nowColor.r, nowColor.g, nowColor.b, 0.4f); Color color1 = new Color(nowColor.r, nowColor.g, nowColor.b, 1); Color color2 = new Color(nowColor.r, nowColor.g, nowColor.b, 1); Color color3 = new Color(nowColor.r, nowColor.g, nowColor.b, 1); Color color4 = new Color(nowColor.r, nowColor.g, nowColor.b, 1); tuo.GetComponent <SpriteRenderer>().color = color4; transform.Find("Circle/1").GetComponent <MeshRenderer>().material.color = color1; transform.Find("Circle/2").GetComponent <MeshRenderer>().material.color = color2; transform.Find("Circle/3").GetComponent <MeshRenderer>().material.color = color3; second.transform.Find("Line/line").GetComponent <SpriteRenderer>().color = nowColor; if (refresh) { if (ElementContainer.GetInstance().nowElement == this && nowState != 0) { pian.SetActive(true); } if (tw1 != null) { tw1.Kill(); } if (tw2 != null) { tw2.Kill(); } if (tw3 != null) { tw3.Kill(); } if (tw4 != null) { tw4.Kill(); } if (tws1 != null) { tws1.Kill(); } if (tws2 != null) { tws2.Kill(); } if (tws3 != null) { tws3.Kill(); } if (tws4 != null) { tws4.Kill(); } if (tws5 != null) { tws5.Kill(); } if (tws6 != null) { tws6.Kill(); } if (tws7 != null) { tws7.Kill(); } if (tws8 != null) { tws8.Kill(); } tws1 = transform.Find("Circle/1").DOScaleX(1, 1).SetLoops(-1).SetEase(Ease.Linear).OnKill(delegate() { transform.Find("Circle/1").localScale = new Vector3(0, 0.00001f, 0); }); tws2 = transform.Find("Circle/1").DOScaleZ(1, 1).SetLoops(-1).SetEase(Ease.Linear); tws3 = transform.Find("Circle/2").DOScaleX(2F / 3F, 1).SetLoops(-1).SetEase(Ease.Linear).OnKill(delegate() { transform.Find("Circle/2").localScale = new Vector3(0, 0.00001f, 0); }); tws4 = transform.Find("Circle/2").DOScaleZ(2F / 3F, 1).SetLoops(-1).SetEase(Ease.Linear); tws5 = transform.Find("Circle/3").DOScaleX(1F / 3F, 1).SetLoops(-1).SetEase(Ease.Linear).OnKill(delegate() { transform.Find("Circle/3").localScale = new Vector3(0, 0.00001f, 0); }); tws6 = transform.Find("Circle/3").DOScaleZ(1F / 3F, 1).SetLoops(-1).SetEase(Ease.Linear); tw1 = DOTween.To(() => transform.Find("Circle/1").GetComponent <MeshRenderer>().material.color, x => transform.Find("Circle/1").GetComponent <MeshRenderer>().material.color = x, new Color(color1.r, color1.g, color1.b, 0), 1).SetLoops(-1).SetEase(Ease.Linear).OnKill(delegate() { transform.Find("Circle/1").GetComponent <MeshRenderer>().material.color = color1; }); tw2 = DOTween.To(() => transform.Find("Circle/2").GetComponent <MeshRenderer>().material.color, x => transform.Find("Circle/2").GetComponent <MeshRenderer>().material.color = x, new Color(color2.r, color2.g, color2.b, 0), 1).SetLoops(-1).SetEase(Ease.Linear).OnKill(delegate() { transform.Find("Circle/2").GetComponent <MeshRenderer>().material.color = color2; }); tw3 = DOTween.To(() => transform.Find("Circle/3").GetComponent <MeshRenderer>().material.color, x => transform.Find("Circle/3").GetComponent <MeshRenderer>().material.color = x, new Color(color3.r, color3.g, color3.b, 0), 1).SetLoops(-1).SetEase(Ease.Linear).OnKill(delegate() { transform.Find("Circle/3").GetComponent <MeshRenderer>().material.color = color3; }); tw4 = DOTween.To(() => tuo.GetComponent <SpriteRenderer>().color, x => tuo.GetComponent <SpriteRenderer>().color = x, new Color(color4.r, color4.g, color4.b, 0.3f), 1).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.Linear).OnKill(delegate() { tuo.GetComponent <SpriteRenderer>().color = color4; }); } if (resEntity.state != 0) { AlarmState(); if (resEntity.s_data.rate != 0) { rate = resEntity.s_data.rate; } if (resEntity.s_data.range != 0) { if (tws1 != null) { tws1.Kill(); } if (tws2 != null) { tws2.Kill(); } if (tws3 != null) { tws3.Kill(); } if (tws4 != null) { tws4.Kill(); } if (tws5 != null) { tws5.Kill(); } if (tws6 != null) { tws6.Kill(); } if (tws7 != null) { tws7.Kill(); } if (tws8 != null) { tws8.Kill(); } scale_x = resEntity.s_data.range / 25f; scale_z = resEntity.s_data.range / 25f; } tws7 = pian.transform.DOScaleX(scale_x, 0).SetEase(Ease.Linear); tws8 = pian.transform.DOScaleZ(scale_z, 0).SetEase(Ease.Linear); if (!string.IsNullOrEmpty(resEntity.s_data.icon) && !string.IsNullOrEmpty(resEntity.s_data.color)) { if (gameObject.activeInHierarchy) { StartCoroutine(ElementContainer.GetInstance().loadConfig.LoadPhoto(resEntity.s_data.icon, LoadSprite)); } if (tw1 != null) { tw1.Kill(); } if (tw2 != null) { tw2.Kill(); } if (tw3 != null) { tw3.Kill(); } if (tw4 != null) { tw4.Kill(); } Color nowColor2; ColorUtility.TryParseHtmlString(resEntity.s_data.color, out nowColor2); Color color1_1 = new Color(nowColor2.r, nowColor2.g, nowColor2.b, 1); Color color2_1 = new Color(nowColor2.r, nowColor2.g, nowColor2.b, 1); Color color3_1 = new Color(nowColor2.r, nowColor2.g, nowColor2.b, 1); Color color4_1 = new Color(nowColor2.r, nowColor2.g, nowColor2.b, 1); tuo.GetComponent <SpriteRenderer>().color = color4_1; transform.Find("Circle/1").GetComponent <MeshRenderer>().material.color = color1_1; transform.Find("Circle/2").GetComponent <MeshRenderer>().material.color = color2_1; transform.Find("Circle/3").GetComponent <MeshRenderer>().material.color = color3_1; second.transform.Find("Line/line").GetComponent <SpriteRenderer>().color = nowColor2; tw1 = DOTween.To(() => transform.Find("Circle/1").GetComponent <MeshRenderer>().material.color, x => transform.Find("Circle/1").GetComponent <MeshRenderer>().material.color = x, new Color(color1_1.r, color1_1.g, color1_1.b, 0), 1).SetLoops(-1).SetEase(Ease.Linear); tw2 = DOTween.To(() => transform.Find("Circle/2").GetComponent <MeshRenderer>().material.color, x => transform.Find("Circle/2").GetComponent <MeshRenderer>().material.color = x, new Color(color2_1.r, color2_1.g, color2_1.b, 0), 1).SetLoops(-1).SetEase(Ease.Linear); tw3 = DOTween.To(() => transform.Find("Circle/3").GetComponent <MeshRenderer>().material.color, x => transform.Find("Circle/3").GetComponent <MeshRenderer>().material.color = x, new Color(color3_1.r, color3_1.g, color3_1.b, 0), 1).SetLoops(-1).SetEase(Ease.Linear); tw4 = DOTween.To(() => tuo.GetComponent <SpriteRenderer>().color, x => tuo.GetComponent <SpriteRenderer>().color = x, new Color(color4_1.r, color4_1.g, color4_1.b, 0.3f), 1).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.Linear); } } }
public void OnMouseUp() { Debug.Log("鼠标按下"); foreach (KeyValuePair <string, List <ElementItem> > item in ElementContainer.GetInstance().dicElements) { foreach (ElementItem itemValue in item.Value) { if (itemValue.nowLevel == 1) { if (itemValue != ElementContainer.GetInstance().nowElement) { itemValue.SetUIByLevel(0); } } } } foreach (Transform item in Element.ElementContainer.GetInstance().arrayLabelParent) { if (!item.gameObject.active && !DynamicElement.GetInstance().isPlay && !DynamicElement.GetInstance().inPlay) { array = item; } } if (transform.parent.parent.GetComponent <ElementItem>() != null && ElementContainer.GetInstance().isClick && !DynamicElement.GetInstance().isPlay && !DynamicElement.GetInstance().inPlay) { transform.parent.parent.GetComponent <ElementItem>().SetUIByLevel(1); if (array != null) { if (transform.parent.parent.GetComponent <ElementItem>().lineId != array.name) { array.gameObject.SetActive(true); } } } if (transform.parent.parent.GetComponent <ElementArray>() != null && ElementContainer.GetInstance().isClick && !DynamicElement.GetInstance().isPlay && !DynamicElement.GetInstance().inPlay) { if (array != null) { array.gameObject.SetActive(true); } transform.parent.parent.gameObject.SetActive(false); if (Vector3.Distance(transform.position, Camera.main.transform.position) > 1000) { Camera.main.GetComponent <BLCameraControl>().LookAtPosition3(transform.parent.parent.position); } transform.parent.parent.parent.GetComponent <ArrayParent>().WaitTime(transform.parent.parent.gameObject); ElementContainer.GetInstance().SceneToLevel(1); } if (transform.parent.parent.GetComponent <ElementArea>() != null && ElementContainer.GetInstance().isClick && !DynamicElement.GetInstance().isPlay && !DynamicElement.GetInstance().inPlay) { transform.parent.parent.GetComponent <ElementArea>().SetUIByLevel(1); } }