private void SetPos(DirType dir = DirType.Null) { float x = LeftPoint.x + CurData.Pos.x * 88; float y = LeftPoint.y - CurData.Pos.y * 88; int index = CurData.Pos.x + CurData.Pos.y * MapData.MapW; int item = MapData.Map[MapData.CurLevel][index]; if (item > 5) { RotateItem(transform.GetChild(0) as RectTransform, item); CurData.Dir = (DirType)item; } else if (dir != DirType.Null) { RotateItem(transform.GetChild(0) as RectTransform, (int)dir); CurData.Dir = dir; } if (item == (int)CurData.Type && item < 6 && item > 0) { IsWin = true; GetComponent <Image>().sprite = ResLoad.LoadAsset <Sprite>("UI/Map/Target", item.ToString()); } else { IsWin = false; GetComponent <Image>().sprite = ResLoad.LoadAsset <Sprite>("UI/Map/Squares", ((int)CurData.Type).ToString()); } (transform.parent as RectTransform).DOLocalMove(new Vector2(x, y), 0.4f); }
/// <summary> /// 屏幕外滑动进入 /// </summary> /// <param name="control"></param> /// <param name="fTime"></param> /// <param name="stType"></param> /// <param name="ltType"></param> /// <returns></returns> public static CUIControl SlideIn(CUIControl control, Vector3 vIn, DirType stType = DirType.Top, float fTime = 0.25f, LeanTweenType ltType = LeanTweenType.easeOutCirc) { control.show = true; Vector3 vFrom = Vector3.zero; RectTransform rt = control.GetComponent <RectTransform>(); Rect rect = rt.rect; switch (stType) { default: case DirType.Top: vFrom = new Vector3(0, Screen.height * 0.5f + rect.height * 0.5f, 0); break; case DirType.Bottom: vFrom = new Vector3(0, -Screen.height * 0.5f - rect.height * 0.5f, 0); break; case DirType.Right: vFrom = new Vector3(Screen.width * 0.5f + rect.width * 0.5f, 0, 0); break; case DirType.Left: vFrom = new Vector3(-Screen.width * 0.5f - rect.width * 0.5f, 0, 0); break; } CUI.MoveTo(control, vFrom, vIn, fTime, ltType); return(control); }
/// <summary> /// GUI for selecting directory. /// </summary> void DrawChooseDir(DirType dirType) { string dir = GetDir(dirType); string dirLabel = GetDirLabel(dirType); EditorGUILayout.BeginVertical(); GUILayout.Label(dirLabel + " Dir:"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); GUILayout.Space(4f); GUILayout.Label(dir, "AS TextArea", GUILayout.Height(20f)); EditorGUILayout.EndVertical(); GUILayout.Space(3f); if (GUILayout.Button("Choose", "LargeButtonMid", GUILayout.Height(20f), GUILayout.ExpandWidth(false))) { string defaultDir = string.IsNullOrEmpty(dir) ? Application.dataPath : dir; dir = EditorUtility.OpenFolderPanel("Choose Folder", defaultDir, ""); if (!string.IsNullOrEmpty(dir)) { SetDir(dirType, dir); } } EditorGUILayout.EndHorizontal(); GUILayout.Space(10f); EditorGUILayout.EndVertical(); }
/// <summary> /// 屏幕外滑动退出 /// </summary> /// <param name="control"></param> /// <param name="stType"></param> /// <param name="fTime"></param> /// <param name="ltType"></param> /// <returns></returns> public static CUIControl SlideOut(CUIControl control, DirType stType = DirType.Top, float fTime = 0.25f, LeanTweenType ltType = LeanTweenType.easeInCirc) { control.show = true; Vector3 vFrom = control.transform.localPosition; Vector3 vTo; RectTransform rt = control.GetComponent <RectTransform>(); Rect rect = rt.rect; switch (stType) { default: case DirType.Top: vTo = new Vector3(0, Screen.height * 0.5f + rect.height * 0.5f, 0); break; case DirType.Bottom: vTo = new Vector3(0, -Screen.height * 0.5f - rect.height * 0.5f, 0); break; case DirType.Right: vTo = new Vector3(Screen.width * 0.5f + rect.width * 0.5f, 0, 0); break; case DirType.Left: vTo = new Vector3(-Screen.width * 0.5f - rect.width * 0.5f, 0, 0); break; } LeanTween.move(rt, vTo, fTime).setEase(ltType).setOnComplete(() => { control.show = false; }); return(control); }
private bool Obstruct(DirType dir) { var pos = Move(dir); var square = IsSquare(pos); if (square != null) { bool b = square.Pushed(dir); if (b) { Walk.Add(MapData.Walks, CurData); // 目标成功推动则设置当前位置 否则 不设置 CurData.Pos = pos; SetPos(); return(true); } return(false); } if (pos == CurData.Pos) { return(false); } Walk.Add(MapData.Walks, CurData); CurData.Pos = pos; SetPos(); return(true); }
/// <summary> /// 功能:返回指定路径下的子目录及文件列表,默认为当前工作地址 /// </summary> /// <param name="pathName"></param> /// <param name="dirType"></param> /// <returns></returns> public List <string> Dir(string pathName = "/", DirType dirType = DirType.MLSD) { _client.FTPDataManager.IsFile = false; using (var dataSocket = _client.CreateDataConnection()) { _client.FTPDataManager.Refresh(); var sres = _client.BaseSend($"{dirType.ToString()} {pathName}"); Active(); var str = _client.FTPDataManager.ReadAllText(); if (string.IsNullOrEmpty(str)) { if (ChangeDir(pathName)) { return(new List <string>()); } else { return(null); } } return(str.Split(Environment.NewLine).ToList()); } }
public bool Select(DirType dirType, int successID, GameFrameworkAction <Drawer> action) { if (!m_IsCanTouch) { return(false); } m_IsCanTouch = false; if (m_IsOpen) { return(false); } if (dirType == m_DrawerDirType && m_Id == successID) { GameEntry.Sound.PlayUISound((int)UISoundId.drawer); m_Mask.color = Color.white; Open(); if (action != null) { action(this); } return(true); } else { GameEntry.Sound.PlayUISound((int)UISoundId.drawer); //m_Mask.color = Color.red; Shake(); return(false); } }
/// <summary> /// Return cached dir based on DirType. /// </summary> string GetDir(DirType dirType) { string dir = string.Empty; switch (dirType) { case DirType.WinLegacy: dir = _winLegacyDir; break; case DirType.WinIntegration: dir = _winIntegrationDir; break; case DirType.NuGet: case DirType.BuildLocal: dir = _nugetDir; break; case DirType.VSCommonTool: dir = _vsCommonToolDir; break; } return(dir); }
private void Move(Vector2 moveDir, DirType dir) { switch (dir) { case DirType.UPLEFT: rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, areaInset.down, rectTransform.rect.height + moveDir.y); areaInset.up -= moveDir.y; rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Right, areaInset.right, rectTransform.rect.width - moveDir.x); areaInset.left += moveDir.x; break; case DirType.UPRIGHT: rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, areaInset.down, rectTransform.rect.height + moveDir.y); areaInset.up -= moveDir.y; rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, areaInset.left, rectTransform.rect.width + moveDir.x); areaInset.right -= moveDir.x; break; case DirType.DOWNLEFT: rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, areaInset.up, rectTransform.rect.height - moveDir.y); areaInset.down += moveDir.y; rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Right, areaInset.right, rectTransform.rect.width - moveDir.x); areaInset.left += moveDir.x; break; case DirType.DOWNRIGHT: rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, areaInset.up, rectTransform.rect.height - moveDir.y); areaInset.down += moveDir.y; rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, areaInset.left, rectTransform.rect.width + moveDir.x); areaInset.right -= moveDir.x; break; case DirType.UP: rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, areaInset.down, rectTransform.rect.height + moveDir.y); areaInset.up -= moveDir.y; break; case DirType.LEFT: rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Right, areaInset.right, rectTransform.rect.width - moveDir.x); areaInset.left += moveDir.x; break; case DirType.DOWN: rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, areaInset.up, rectTransform.rect.height - moveDir.y); areaInset.down += moveDir.y; break; case DirType.RIGHT: rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, areaInset.left, rectTransform.rect.width + moveDir.x); areaInset.right -= moveDir.x; break; case DirType.CENTER: rectTransform.anchoredPosition += moveDir; break; case DirType.NONE: break; } }
/// <summary> /// Return dir GUI label based on DirType. /// </summary> string GetDirLabel(DirType dirType) { string dirLabel = string.Empty; switch (dirType) { case DirType.WinLegacy: dirLabel = "WinLegacy Project"; break; case DirType.WinIntegration: dirLabel = "WinIntegration Project"; break; case DirType.NuGet: case DirType.BuildLocal: dirLabel = "Build Scripts"; break; case DirType.VSCommonTool: dirLabel = "Visual Studio Common Tools"; break; } return(dirLabel); }
/// <summary> /// Store dir of DirType to EditorPrefs. /// </summary> void SetDir(DirType dirType, string dir) { dir = System.IO.Path.GetFullPath(dir); switch (dirType) { case DirType.WinLegacy: _winLegacyDir = dir; PluginConfigHelper.WinLegacyDir = _winLegacyDir; break; case DirType.WinIntegration: _winIntegrationDir = dir; PluginConfigHelper.WinIntegrationDir = _winIntegrationDir; break; case DirType.NuGet: case DirType.BuildLocal: _nugetDir = dir; PluginConfigHelper.BuildScriptsDir = _nugetDir; break; case DirType.VSCommonTool: _vsCommonToolDir = dir; PluginConfigHelper.VSCommonToolDir = _vsCommonToolDir; break; } }
public void Reflect(ReflectionType reflType) { if (reflType == ReflectionType.Bottom || reflType == ReflectionType.Top) { int temp = PosLimDown; PosLimDown = PosLimUp; PosLimUp = temp; if (Dir == DirType.Down) { Dir = DirType.Up; } else { Dir = DirType.Down; } } else if (reflType == ReflectionType.Left || reflType == ReflectionType.Right) { int temp = PosLimRight; PosLimRight = PosLimLeft; PosLimLeft = temp; if (Dir == DirType.Left) { Dir = DirType.Right; } else { Dir = DirType.Left; } } }
private void HandleDir(TransformCom transCom) { if (transCom.ReqDir == DirType.None) { return; } DirType backDir = transCom.ForwardDir == DirType.Right ? DirType.Left : DirType.Right; DirType dirType = DirType.Right; if (transCom.ReqDir == DirType.Right) { dirType = transCom.ForwardDir; } else { dirType = backDir; } if (dirType == transCom.CurrDir) { return; } transCom.CurrDir = dirType; Vector3 dir = new Vector3(0, transCom.CurrDir == DirType.Right ? 0 : 180, 0); transCom.DisplayTrans.localEulerAngles = dir; transCom.ReqDir = DirType.None; }
public TileDirection(int x, int y, int w, DirType t) { this.X = x; this.Y = y; this.W = w; this.Type = t; }
private void UpdateComponent(DirType type, Vector2 direction, Vector3 leftDir) { Mark mark = marks.Find(s => s.selfType == type); RectTransform rect; for (int i = 0; i < marks.Count; i++) { rect = marks[i].rect; if (marks[i].selfType == type) { float anglePercent = Vector2.Angle(leftDir, direction) / intervalangle; mark.rect.localPosition = new Vector2(mark.rect.rect.width / 2, -5) - new Vector2(anglePercent * mark.rect.rect.width, 0); mark.rect.gameObject.SetActive(true); RectTransform preRect = marks.Find(s => s.selfType == mark.preType).rect; preRect.localPosition = mark.rect.localPosition - new Vector3(mark.rect.rect.width, 0, -5); preRect.gameObject.SetActive(true); RectTransform nextRect = marks.Find(s => s.selfType == mark.nextType).rect; nextRect.localPosition = mark.rect.localPosition + new Vector3(mark.rect.rect.width, 0, -5); nextRect.gameObject.SetActive(true); continue; } if (marks[i].selfType == mark.preType) { continue; } if (marks[i].selfType == mark.nextType) { continue; } rect.gameObject.SetActive(false); } }
void FixedUpdate() { float dt = Time.fixedDeltaTime; switch (m_dirType) { case DirType.StartToEnd: { Vector3 delta = (m_endPos - m_startPos).normalized * m_speed * dt; if (delta.magnitude >= (m_endPos - transform.position).magnitude) { delta = (m_endPos - m_startPos).normalized * (m_endPos - transform.position).magnitude; m_dirType = DirType.EndToStart; } transform.Translate(delta); } break; case DirType.EndToStart: { Vector3 delta = (m_startPos - m_endPos).normalized * m_speed * dt; if (delta.magnitude >= (m_startPos - transform.position).magnitude) { delta = (m_startPos - m_endPos).normalized * (m_startPos - transform.position).magnitude; m_dirType = DirType.StartToEnd; } transform.Translate(delta); } break; } }
/// <summary> /// 获取指定方向的相邻的聚焦项目 /// </summary> public virtual FocusableItem Get(DirType dir, List <FocusableItem> list) { var ret = this; switch (dir) { case DirType.Left: if (this.DisableLeft) { return(this); } if (this.Left != null && this.Left.IsActive) { return(this.Left); } ret = Search(Vector3.left, list) ?? this; break; case DirType.Right: if (this.DisableRight) { return(this); } if (this.Right != null && this.Right.IsActive) { return(this.Right); } ret = Search(Vector3.right, list) ?? this; break; case DirType.Up: if (this.DisableUp) { return(this); } if (this.Up != null && this.Up.IsActive) { return(this.Up); } ret = Search(Vector3.up, list) ?? this; break; case DirType.Down: if (this.DisableDown) { return(this); } if (this.Down != null && this.Down.IsActive) { return(this.Down); } ret = Search(Vector3.down, list) ?? this; break; } //释放优先聚焦权 FirstFocus = false; return(ret); }
public void OnPointerExit() { if (!Input.GetMouseButton(0)) { dir = DirType.NONE; isPointerEnter = false; CursorView.Instance.Set(DirType.NONE); } }
public WalkRectangular(int posLimRight, int posLimLeft, int posLimUp, int posLimDown, int dPos, DirType dir) { Dir = dir; DPos = dPos; PosLimRight = posLimRight; PosLimLeft = posLimLeft; PosLimDown = posLimDown; PosLimUp = posLimUp; }
private void HandleMoveDir(PlayerMoveCom moveCom, TransformCom transCom) { if (moveCom.ReqMoveSpeed == 0) { return; } DirType dirType = moveCom.ReqMoveSpeed > 0 ? DirType.Right: DirType.Left; transCom.ReqDir = dirType; }
public CssSelector ForDir(DirType type) { if (type == DirType.Ltr) { return(AppendSelector($":dir(ltr)")); } else { return(AppendSelector($":dir(rtl)")); } }
public void OnPointerEnter(int dir) { if (!isPointerEnter) { isPointerEnter = true; upPointerPos = (Vector2)Input.mousePosition; DirType dirType = (DirType)dir; this.dir = dirType; CursorView.Instance.Set(dirType); } }
public void Move(Vector3 dir, int a, int d) //인자 값은 Vector3방향, 움직이는 축의 방향 { axis = (Axis)a; dirType = (DirType)d; if (axis == Axis.X) { if (blockManager.BlockIsExist(location[0], (int)blockType, d)) //움직일수있는 위치인지 검사함 { return; } direction = dir; //direction = dir.normalized; //if (!BeBlockedByWall()) // return; destination = transform.position + (direction * 1.3f); if (d == 0) //왼쪽으로 이동 { if (location[0] == 12 && blockType == BlockType.Me) //도착지점!! { destination = transform.position + (direction * 2.6f); speed = 15f; //destination += (direction * 1.3f); mouseController.GameClear = true; } } Set_location(); isMoving = true; SoundManger.instance.PlaySound(moveSound); } else //(axis == Axis.Y) { if (blockManager.BlockIsExist(location[0], (int)blockType, d)) { return; } direction = dir; destination = transform.position + (direction * 1.3f); Set_location(); isMoving = true; SoundManger.instance.PlaySound(moveSound); } }
/// <summary> /// Attempts to create a relative path name that is relative to the PossibleRoot. /// /// Unless the file is close to the root, showing the full path of a filename in the UI /// is often not very useful because the end of the filename is often obscured. Storing /// the full path to a background or a theme (in a theme file, or a song file) is also /// not desirable from a portability stand point. /// </summary> /// <param name="PossibleRoot">The path root to attempt to remove</param> /// <param name="FileName">The full path to remove the root from</param> /// <returns>The FileName with the PossibleRoot removed, or the original FileName /// if it does not start with PossibleRoot</returns> public static string GetRelativePath(DirType PossibleRoot, string FileName) { string root = GetDirectory(PossibleRoot) + Path.DirectorySeparatorChar; if (FileName.StartsWith(root)) { return(FileName.Substring(root.Length)); } else { return(FileName); } }
public void Set(DirType type) { switch (type) { case DirType.UPLEFT: Cursor.SetCursor(UpLeft, new Vector2(5.5f, 5.5f), CursorMode.Auto); break; case DirType.UPRIGHT: Cursor.SetCursor(UpRight, new Vector2(5.5f, 5.5f), CursorMode.Auto); break; case DirType.DOWNLEFT: Cursor.SetCursor(DownLeft, new Vector2(5.5f, 5.5f), CursorMode.Auto); break; case DirType.DOWNRIGHT: Cursor.SetCursor(DownRight, new Vector2(5.5f, 5.5f), CursorMode.Auto); break; case DirType.UP: Cursor.SetCursor(Vertical, new Vector2(0, 9.5f), CursorMode.Auto); break; case DirType.LEFT: Cursor.SetCursor(Horizontal, new Vector2(9.5f, 0), CursorMode.Auto); break; case DirType.DOWN: Cursor.SetCursor(Vertical, new Vector2(0, 9.5f), CursorMode.Auto); break; case DirType.RIGHT: Cursor.SetCursor(Horizontal, new Vector2(9.5f, 0), CursorMode.Auto); break; case DirType.CENTER: Cursor.SetCursor(MoveArrow, Vector2.zero, CursorMode.Auto); break; case DirType.NONE: Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); break; default: Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); break; } }
public static Vector3 CalcUnitPosition(Int2D idx, DirType dir) { Vector3 pos = Vector3.zero; pos.x = -UnitCount.X * UnitSize / 2; pos.x += idx.X * UnitSize; pos.z = -300; //-(FightCtller.Dim.Y / 2) + (UnitCount.Y * UnitSize) + 50; pos.z -= idx.Y * UnitSize; pos.x += UnitSize / 2; //pos.y -= UnitSize / 2; if (dir == DirType.Up) { pos.z = -pos.z; } return pos; }
public void Create(FightCtller ctl, DirType dir) { m_dir = dir; m_ctller = ctl; m_units = new Unit[UnitCount.Y, UnitCount.X]; for (int y = 0; y < Units.GetLength(0); ++y) { for (int x = 0; x < Units.GetLength(1); ++x) { m_units[y, x] = new Unit(new Int2D(x, y), null); m_units[y, x].Position = CalcUnitPosition(m_units[y, x].Index, dir); } } }
public LTInstanceNode GetNeightbourNodeByDir(DirType dir) { switch (dir) { case DirType.UP: return(UpNode); case DirType.Down: return(DownNode); case DirType.Left: return(LeftNode); case DirType.Right: return(RightNode); default: return(null); } }
public static Vector3 CalcUnitPosition(Int2D idx, DirType dir) { Vector3 pos = Vector3.zero; pos.x = -UnitCount.X * UnitSize / 2; pos.x += idx.X * UnitSize; pos.y = -FightSize;// -(FightCtller.Dim.Y / 2) + (UnitCount.Y * UnitSize) + 50; pos.y -= idx.Y * UnitSize; pos.x += UnitSize / 2; pos.y -= UnitSize / 2; if (dir == DirType.Up) { pos.y = -pos.y; } return(pos); }
public void Init(DirType dir) { m_Die = false; m_Dir = dir; Vector2 vec = Vector2.zero; switch (m_Dir) { case DirType.Up: { vec = Vector2.up; } break; case DirType.Down: { vec = Vector2.down; } break; case DirType.Left: { vec = Vector2.left; } break; case DirType.Right: { vec = Vector2.right; } break; } float ang = Vector2.Angle(vec, Vector2.up); if (vec.x > 0) { ang = -ang; } transform.SetLocalEulerAngles_Z(ang); m_RemoveDelay += Global.instance.m_Time; }
private void Update() { if (isPointerEnter) { if (Input.GetMouseButton(0) && dir != DirType.NONE) { nowPointerPos = (Vector2)Input.mousePosition; Move(nowPointerPos - upPointerPos, dir); upPointerPos = nowPointerPos; } if (Input.GetMouseButtonUp(0)) { dir = DirType.NONE; isPointerEnter = false; CursorView.Instance.Set(DirType.NONE); } } }
/// <summary> /// Return cached dir based on DirType. /// </summary> string GetDir(DirType dirType) { string dir = string.Empty; switch (dirType) { case DirType.WinLegacy: dir = _winLegacyDir; break; case DirType.WinIntegration: dir = _winIntegrationDir; break; case DirType.NuGet: case DirType.BuildLocal: dir = _nugetDir; break; case DirType.VSCommonTool: dir = _vsCommonToolDir; break; } return dir; }
/// <summary> /// Return dir GUI label based on DirType. /// </summary> string GetDirLabel(DirType dirType) { string dirLabel = string.Empty; switch (dirType) { case DirType.WinLegacy: dirLabel = "WinLegacy Project"; break; case DirType.WinIntegration: dirLabel = "WinIntegration Project"; break; case DirType.NuGet: case DirType.BuildLocal: dirLabel = "Build Scripts"; break; case DirType.VSCommonTool: dirLabel = "Visual Studio Common Tools"; break; } return dirLabel; }
/// <summary> /// Represents the HTML attribute "dir". /// </summary> /// <param name="dir">The value.</param> /// <returns>The same instance of <see cref="Hex.AttributeBuilders.HtmlAttributeBuilder"/>.</returns> public HtmlAttributeBuilder Dir( DirType dir ) { return this.Dir( dir.ToLowerString() ); }