void Awake() { instance = this; Title = transform.FindChild("Dialog/Title").GetComponent <Text>(); FileDir = transform.FindChild("Dialog/InputField").GetComponent <InputField>(); Transform BntTra = transform.FindChild("Dialog/Button"); FileBnt = BntTra.GetComponent <Button>(); CancelBnt = transform.FindChild("Dialog/CancelBnt").GetComponent <Button>(); CancelBnt.onClick.AddListener(delegate() { _Hide(); }); gameObject.SetActive(false); }
public void OnClickExport() { int totalCnt = MapDataProccess.instance.ResList.Count; IList <int> ilistValues = MapDataProccess.instance.ResList.Keys; csvString = new string[totalCnt + 2]; csvString[0] = "场景元素ID,元素类型,中文名称-策划用,模型ID,缩放,坐标X,坐标Y,坐标Z,朝向X,朝向Y,朝向Z,触发器参数2,响应事件容器,模型路径(临时用)"; csvString[1] = "eID,Type,Name,ModelID,Scale,PointX,PointY,PointZ,ForwardX,ForwardY,ForwardZ,TrggerPara2,EventResponse,ResPath"; int i = 0; for (; i < totalCnt; i++) { int id = ilistValues[i]; MapResProperty ResPropData = MapDataProccess.instance.ResList[id]; Transform modelTansform = ResPropData.transform; IList <int> idlistValues = ResPropData.GetIDContainerList().Keys; string ContainerlistStr = string.Empty; // 响应事件容器 string TrggerPara2 = string.Empty; //触发器参数2 for (int k = 0; k < idlistValues.Count; k++) { if (idlistValues[k] < 10100) { MapResProperty ConResPropData = MapDataProccess.instance.ResList[idlistValues[k]]; if ((ResPropData.GetIDContainerList()[idlistValues[k]]).sStatus == MapResSelectedUnit.ResUnitStatus.IsEx) { ContainerlistStr += "!"; } ContainerlistStr += ConResPropData.GetIDStr(); if (k != idlistValues.Count - 1) { ContainerlistStr += "|"; } } else //场景ID { if ((ResPropData.GetIDContainerList()[idlistValues[k]]).sStatus == MapResSelectedUnit.ResUnitStatus.IsEx) { ContainerlistStr += "!"; } ContainerlistStr += "SID:" + idlistValues[k]; if (k != idlistValues.Count - 1) { ContainerlistStr += "|"; } } } float PosY = modelTansform.localPosition.y; if (ResPropData.GetResType() == 18 || ResPropData.GetResType() == 16) { TrggerPara2 = string.Format("{0:0.00}", modelTansform.localScale.x) + "|" + string.Format("{0:0.00}", modelTansform.localScale.y) + "|" + string.Format("{0:0.00}", modelTansform.localScale.z); if (ResPropData.GetResType() == 18) { PosY = modelTansform.localPosition.y - 1; } } csvString[i + 2] = ResPropData.GetIDStr() + "," + ResPropData.GetResType() + "," + ResPropData.GetName() + "," + ResPropData.GetResID() + "," + modelTansform.localScale.x + "," + string.Format("{0:0.00}", modelTansform.localPosition.x) + "," + string.Format("{0:0.00}", PosY) + "," + string.Format("{0:0.00}", modelTansform.localPosition.z) + "," + string.Format("{0:0.00}", modelTansform.localEulerAngles.x) + "," + string.Format("{0:0.00}", modelTansform.localEulerAngles.y) + "," + string.Format("{0:0.00}", modelTansform.localEulerAngles.z) + "," + TrggerPara2 + "," + ContainerlistStr + "," + ResPropData.GetResPath(); } UIFileSetting.Show("导出"); UIFileSetting.SetOpera(ExportToFile); }