/// <summary> /// 骸骨のRotateEnemy /// </summary> public override void RotateEnemy() { base.RotateEnemy(); center = new Vector3(-center.x, center.y, center.z); rotateObj.transform.Rotate(0, 180, 0); if (stpos == StartPos.Left) { stpos = StartPos.Right; } else if (stpos == StartPos.Right) { stpos = StartPos.Left; } addAngle = -addAngle; SetRotate(); }
public void SpawnPlane(CargoPlane plane, Vector3 position, float speed, bool isSquad = false, Vector3 offset = new Vector3()) { enabled = true; Plane = plane; TargetPosition = position; Plane.InitDropPosition(position); Plane.Spawn(); if (isSquad) { Vector3 SpawnPos = CalculateSpawnPos(offset); StartPos.SetValue(Plane, SpawnPos); EndPos.SetValue(Plane, SpawnPos - new Vector3(0, 0, TerrainMeta.Size.x)); Plane.transform.position = SpawnPos; Plane.transform.rotation = new Quaternion(0, 180, 0, 0); } TimeToTake.SetValue(Plane, Vector3.Distance((Vector3)StartPos.GetValue(Plane), (Vector3)EndPos.GetValue(Plane)) / speed); InvokeRepeating("CheckDistance", 3, 3); }
private void ChangeSegment() { if (_runningRoutine != null) { StopCoroutine(_runningRoutine); } _changeSegment = false; _runningRoutine = StartCoroutine(DisablingTimer()); MovingPlatformActivator currentActivator = activators[_currentActiveSegment]; currentActivator.GetComponentInChildren <StartPos>().enabled = false; currentActivator.GetComponentInChildren <EndPos>().enabled = false; _currentActiveSegment++; currentActivator = activators[_currentActiveSegment]; currentActivator.GetComponentInChildren <StartPos>().enabled = true; currentActivator.GetComponentInChildren <EndPos>().enabled = true; _startPosObject = currentActivator.GetComponentInChildren <StartPos>(); _startPos = _startPosObject.transform.position; _endPosObject = currentActivator.GetComponentInChildren <EndPos>(); _endPos = _endPosObject.transform.position; _startToEnd = (_endPos - _startPos).normalized; _endToStart = -_startToEnd; _currentDirection = _startToEnd; }
private void MakeupFields() { canEdit = false; List <ArcNote> selected = AdeCursorManager.Instance.SelectedNotes; int count = selected.Count; if (count == 0) { Panel.gameObject.SetActive(false); return; } else { SelectParent.gameObject.SetActive(false); if (count == 1) { if (selected[0] is ArcArcTap) { SelectParent.gameObject.SetActive(true); } } Timing.gameObject.SetActive(true); Track.gameObject.SetActive(true); EndTiming.gameObject.SetActive(true); StartPos.gameObject.SetActive(true); EndPos.gameObject.SetActive(true); LineType.gameObject.SetActive(true); Color.gameObject.SetActive(true); IsVoid.gameObject.SetActive(true); foreach (var s in selected) { if (Track.gameObject.activeSelf) { Track.gameObject.SetActive(s is ArcTap || s is ArcHold); } if (EndTiming.gameObject.activeSelf) { EndTiming.gameObject.SetActive(s is ArcLongNote); } if (StartPos.gameObject.activeSelf) { StartPos.gameObject.SetActive(s is ArcArc); } if (EndPos.gameObject.activeSelf) { EndPos.gameObject.SetActive(s is ArcArc); } if (LineType.gameObject.activeSelf) { LineType.gameObject.SetActive(s is ArcArc); } if (Color.gameObject.activeSelf) { Color.gameObject.SetActive(s is ArcArc); } if (IsVoid.gameObject.activeSelf) { IsVoid.gameObject.SetActive(s is ArcArc); } } bool multiple = count != 1; ArcNote note = selected[0]; Timing.GetComponentInChildren <InputField>().text = multiple ? "-" : note.Timing.ToString(); if (Track.gameObject.activeSelf) { Track.GetComponentInChildren <InputField>().text = multiple ? "-" : (note is ArcTap ? (note as ArcTap).Track.ToString() : (note as ArcHold).Track.ToString()); } if (EndTiming.gameObject.activeSelf) { EndTiming.GetComponentInChildren <InputField>().text = multiple ? "-" : (note as ArcLongNote).EndTiming.ToString(); } if (StartPos.gameObject.activeSelf) { StartPos.GetComponentInChildren <InputField>().text = multiple ? "-,-" : $"{(note as ArcArc).XStart.ToString("f2")},{(note as ArcArc).YStart.ToString("f2")}"; } if (EndPos.gameObject.activeSelf) { EndPos.GetComponentInChildren <InputField>().text = multiple ? "-,-" : $"{(note as ArcArc).XEnd.ToString("f2")},{(note as ArcArc).YEnd.ToString("f2")}"; } if (LineType.gameObject.activeSelf) { LineType.GetComponentInChildren <Dropdown>().value = multiple ? 0 : (int)(note as ArcArc).LineType; } if (Color.gameObject.activeSelf) { Color.GetComponentInChildren <Dropdown>().value = multiple ? 0 : (note as ArcArc).Color; } if (IsVoid.gameObject.activeSelf) { IsVoid.GetComponentInChildren <Toggle>().isOn = multiple ? false : (note as ArcArc).IsVoid; } Panel.gameObject.SetActive(true); } canEdit = true; }
/// <summary> /// Optimizes the selected area /// </summary> public async Task OptimizeSelection() { // Define exchange buffer variables XmlCursorPositions dummyPos; int dummyTextPos; if (StartPos.ActualNode == null) { return; } // 1. if the start pos is behind the end pos, then swap both if (StartPos.ActualNode == EndPos.ActualNode) // Both nodes are equal { if (StartPos.PosOnNode > EndPos.PosOnNode) // If StartPos is within a node behind EndPos { // exchange both positions at the same node dummyPos = StartPos.PosOnNode; dummyTextPos = StartPos.PosInTextNode; StartPos.SetPos(EndPos.ActualNode, EndPos.PosOnNode, EndPos.PosInTextNode); EndPos.SetPos(EndPos.ActualNode, dummyPos, dummyTextPos); } else // StartPos was not behind Endpos { // Is a text part within a text node selected ? if ((StartPos.PosOnNode == XmlCursorPositions.CursorInsideTextNode) && (EndPos.PosOnNode == XmlCursorPositions.CursorInsideTextNode)) { // A part of a text node is selected if (StartPos.PosInTextNode > EndPos.PosInTextNode) // If the TextStartpos is behind the TextEndpos, then change { // Exchange text selection dummyTextPos = StartPos.PosInTextNode; StartPos.SetPos(StartPos.ActualNode, XmlCursorPositions.CursorInsideTextNode, EndPos.PosInTextNode); EndPos.SetPos(StartPos.ActualNode, XmlCursorPositions.CursorInsideTextNode, dummyTextPos); } } } } else // Both nodes are not equal { // If the nodes are wrong in the order, then swap both if (ToolboxXml.Node1LaisBeforeNode2(EndPos.ActualNode, StartPos.ActualNode)) { var tempPos = this.StartPos.Clone(); this.StartPos.SetPos(this.EndPos.ActualNode, this.EndPos.PosOnNode, this.EndPos.PosInTextNode); this.EndPos.SetPos(tempPos.ActualNode, tempPos.PosOnNode, tempPos.PosInTextNode); } // If the EndNode is in the StartNode, select the entire surrounding StartNode if (ToolboxXml.IsChild(EndPos.ActualNode, StartPos.ActualNode)) { await SetPositions(StartPos.ActualNode, XmlCursorPositions.CursorOnNodeStartTag, 0, throwChangedEventWhenValuesChanged : false); } // Find the first common parent of start and end and select the nodes in this height. // This leads to the fact that e.g. with LI elements and UL only the whole LI // is selected when dragging the selection over several LI and not only parts of it if (StartPos.ActualNode.ParentNode != EndPos.ActualNode.ParentNode) // if start and end are not directly in the same parent { // - first find out which is the deepest common parent of start and end node XmlNode commonParent = XmlCursorSelectionHelper.DeepestCommonParent(StartPos.ActualNode, EndPos.ActualNode); // - then upscale start- and end-node to before the parent XmlNode nodeStart = StartPos.ActualNode; while (nodeStart.ParentNode != commonParent) { nodeStart = nodeStart.ParentNode; } XmlNode nodeEnde = EndPos.ActualNode; while (nodeEnde.ParentNode != commonParent) { nodeEnde = nodeEnde.ParentNode; } // - finally show the new start and end nodes StartPos.SetPos(nodeStart, XmlCursorPositions.CursorOnNodeStartTag); EndPos.SetPos(nodeEnde, XmlCursorPositions.CursorOnNodeStartTag); } } }
public Form1() { InitializeComponent(); if (File.Exists(Info_Name) == false) { Info_Fs = new FileStream(Info_Name, FileMode.OpenOrCreate, FileAccess.ReadWrite); Info_Fs.Close(); File.SetAttributes(Info_Name, FileAttributes.Hidden); //DEBUG_TEXTBOX.AppendText("创建配置文件\r\n"); } else { Info_Fs = new FileStream(Info_Name, FileMode.Open, FileAccess.Read); StreamReader Info_SR = new StreamReader(Info_Fs); String Line; String[] Project; if (!Info_SR.EndOfStream) { this.Methods_COMBOBOX.Enabled = true; //DEBUG_TEXTBOX.AppendText("读取配置文件\r\n"); Line = Info_SR.ReadLine();//读取所有项目 Project = Line.Split(';'); List <String> list = new List <String>(); for (int n = 0; n < Project.Length; n++) { if (Project[n].IndexOfAny(new char[] { '\0', ' ', '\n', '\r' }) != 0 && Project[n].Equals("") == false) { list.Add(Project[n]); } } //DEBUG_TEXTBOX.AppendText("读取到项目:"); for (int n = 0; n < list.Count; n++) { Info.Add_Info(list[n]); Project_COMBOBOX.Items.Add(list[n]); //DEBUG_TEXTBOX.AppendText(list[n]); if (n < list.Count - 1) { //DEBUG_TEXTBOX.AppendText("、"); } } //DEBUG_TEXTBOX.AppendText("\r\n"); Line = Info_SR.ReadLine(); int Start = Line.LastIndexOf("="); int End = Line.LastIndexOf("="); String StartPos, EndPos; if (Start >= 0 && End >= 0) { StartPos = Line.Substring(0, Start); EndPos = Line.Substring(End + 1); if (StartPos.Equals("DEFAULT") == true) { //DEBUG_TEXTBOX.AppendText("当前选择项目:" + EndPos + "\r\n"); //下拉列表默认选择那个项目(这里设置完后会调用 Project_COMBOBOX_SelectedIndexChanged 函数) Project_COMBOBOX.SelectedItem = EndPos; } } } else { //DEBUG_TEXTBOX.AppendText("配置文件为空\r\n"); } Info_SR.Close(); Info_Fs.Close(); } }