예제 #1
0
 private TlLine GetLine(ELineDir eLineDir, int X, int Y)
 {
     if (X < 0 || X >= arrDownLine.GetLength(0) || Y < 0 || Y >= arrDownLine.GetLength(1))
     {
         return(null);
     }
     return(GetLineByIndex(eLineDir, X, Y));
 }
예제 #2
0
    private TlLine CreateLine(ELineDir eLineDir, int x, int y)
    {
        GameObject go      = CreateLine(_goPreLine);
        Vector2    vec2Pos = new Vector2(x * 50 - Screen.width / 2, y * 50 - Screen.height / 2) + vec2Offset;
        Vector3    pos     = new Vector3(vec2Pos.x, vec2Pos.y);
        TlLine     scrLine = go.GetComponent <TlLine>();

        scrLine.Init(eLineDir, pos, new SIntPos2(x, y));
        return(scrLine);
    }
예제 #3
0
    private TlLine GetLine(ELineDir eLineDir)
    {
        Vector2 vec2 = UICamera.lastEventPosition - vec2Offset;
        int     X    = Mathf.FloorToInt(vec2.x / 50);
        int     Y    = Mathf.FloorToInt(vec2.y / 50);

        X = Mathf.Clamp(X, 0, arrDownLine.GetLength(0) - 1);
        Y = Mathf.Clamp(Y, 0, arrDownLine.GetLength(1) - 1);
        return(GetLineByIndex(eLineDir, X, Y));
    }
예제 #4
0
 private TlLine GetLineByIndex(ELineDir eLineDir, int X, int Y)
 {
     if (eLineDir == ELineDir.eLdHorizontal)
     {
         Debug.Log("Horizontal:" + X + "|" + Y);
         return(arrDownLine[X, Y]);
     }
     else
     {
         Debug.Log("Vertical:" + X + "|" + Y);
         return(arrRightLine[X, Y]);
     }
 }
예제 #5
0
 public void Init(ELineDir _eLineDir, Vector3 vec3Pos, SIntPos2 pos)
 {
     eLineDir = _eLineDir;
     curPos   = pos;
     if (eLineDir == ELineDir.eLdHorizontal)
     {
         uiSprite.pivot  = UIWidget.Pivot.Left;
         uiSprite.height = LINE_WIDTH;
     }
     else
     {
         uiSprite.pivot = UIWidget.Pivot.Bottom;
         uiSprite.width = LINE_WIDTH;
     }
     orgPos = vec3Pos;
     this.transform.localPosition = vec3Pos;
     this.gameObject.SetActive(false);
 }