//public override void SetParentPanelDepth( int depth ) { // for( int i = 0; i < lineParents.Count; i++ ) { // UIPanel panel = lineParents[i].GetComponent<UIPanel>(); // // panel.depth = depth + (lineParents.Count - i); // } //} public void AddHai(MahjongPai pai) { int inLine = _allHais.Count / MaxCoutPerLine; //inLine=0,1,2. >2 has a small chance. int indexInLine = _allHais.Count % MaxCoutPerLine; int EndingLine = Max_Lines - 1; if (inLine != _curLine) { if (inLine <= EndingLine) { _curLine = inLine; _curLineRightAligPosX = AlignLeftLocalPos.x; } else if (inLine > EndingLine) { _curLine = EndingLine; indexInLine += MaxCoutPerLine; _curLineRightAligPosX += MahjongPai.Width + HaiPosOffsetX; } } else { if (indexInLine > 0) { _curLineRightAligPosX += MahjongPai.Width + HaiPosOffsetX; } } //pai.gameObject.layer = LayerMask.NameToLayer ("Hou"); Utils.SetLayerRecursively(pai.gameObject, LayerMask.NameToLayer("Hou")); //pai.transform.parent = lineParents[_curLine]; //pai.transform.localPosition = new Vector3(_curLineRightAligPosX, 0, 0); pai.transform.parent = AllHouUI.instance.GiveHouParent(); pai.transform.localPosition = new Vector3(AllHouUI.instance.GiveHouPoistion(_allHais.Count), 0, 0); pai.DisableInput(); pai.SetEnableStateColor(true); _allHais.Add(pai); pai.Show(); //轉90度 //lineParents[_curLine].GetComponent<UIPanel>().Update(); }
public void AddHai(MahjongPai pai) { int inLine = _allHais.Count / MaxCoutPerLine; //inLine=0,1,2. >2 has a small chance. int indexInLine = _allHais.Count % MaxCoutPerLine; int EndingLine = Max_Lines - 1; if (inLine != _curLine) { if (inLine <= EndingLine) { _curLine = inLine; _curLineRightAligPosX = AlignLeftLocalPos.x; } else if (inLine > EndingLine) { _curLine = EndingLine; indexInLine += MaxCoutPerLine; _curLineRightAligPosX += MahjongPai.Width + HaiPosOffsetX; } } else { if (indexInLine > 0) { _curLineRightAligPosX += MahjongPai.Width + HaiPosOffsetX; } } pai.transform.parent = lineParents[_curLine]; pai.transform.localPosition = new Vector3(_curLineRightAligPosX, 0, 0); pai.DisableInput(); pai.SetEnableStateColor(true); _allHais.Add(pai); pai.Show(); lineParents[_curLine].GetComponent <UIPanel>().Update(); }