/* private void SetMjCdsInfo(ISFSObject isfObj ,ref int with,ref int hight) * { * var sfsobj = isfObj; * var cds = sfsobj.GetIntArray(_keyCards); * var cdslen = cds.Length; * if ((with + cdslen * Mjwith) > Screen.width) * { * var leftwigth = Screen.width - with; * * var num = (int)Math.Ceiling((double)leftwigth / Mjwith); * * var cdsgp1 = new int[num]; * for (var i = 0; i < num; i++) * { * cdsgp1[i] = cds[i]; * Debug.LogError(i); * } * sfsobj.PutIntArray(_keyCards, cdsgp1); * * var gob = AddMjGroupInfo(sfsobj); * gob.transform.localPosition = new Vector3(with,hight,0); * * with = 0; * hight -= 80; * * var leftLen = cdslen - num; * * if (leftLen > 0) * { * var cdsgp2 = new int[cdslen - num]; * int j = 0; * for (var i = num; i < cdslen; i++) * { * cdsgp2[j] = cds[i]; * j++; * } * sfsobj.PutIntArray(_keyCards, cdsgp2); * SetMjCdsInfo(sfsobj, ref with, ref hight); * } * * * } * else * { * var gob = AddMjGroupInfo(sfsobj); * gob.transform.localPosition = new Vector3(with, hight, 0); * with += cdslen * Mjwith+50; * } * }*/ private void SetTotalMjGrouInfo(ISFSArray dataArray, GameObject bg) { JpHuManjongGroupInfo groupInfo = null; foreach (var obj in dataArray) { AddMjGroupInfo((ISFSObject)obj, bg, ref groupInfo); } SortPnl(bg); }
private void AddMjGroupInfo(ISFSObject data, GameObject bg, ref JpHuManjongGroupInfo groupInfo) { if (groupInfo == null) { groupInfo = Instantiate(JpHumjGroupInfo); groupInfo.gameObject.SetActive(true); groupInfo.gameObject.transform.SetParent(bg.transform); groupInfo.transform.localScale = Vector3.one; Vector3 gpTransform = groupInfo.GetComponent <RectTransform>().localPosition; groupInfo.GetComponent <RectTransform>().localPosition = new Vector3(gpTransform.x, gpTransform.y, 0); } var cards = data.GetIntArray(_keyCards); var tai = data.GetInt(_keyTai); var hua = data.GetInt(_keyHua); var cnt = data.GetInt(_keyCnt); if (cards == null) { return; } var len = cards.Length; if (len < 1) { return; } for (int i = 0; i < len; i++) { groupInfo.AddMjGobCell(cards[i]); if (groupInfo.PosX > _maxWigth)// && i < len - 1 { if (len - (i + 1) > 0) { groupInfo = null; var j = 0; var cdsLeftList = new int[len - (i + 1)]; for (int k = i + 1; k < len; k++) { cdsLeftList[j] = cards[k]; j++; } data.PutIntArray(_keyCards, cdsLeftList); AddMjGroupInfo(data, bg, ref groupInfo); } else { groupInfo.AddInfotextGob(tai, hua, cnt); groupInfo = null; } return; } } groupInfo.AddInfotextGob(tai, hua, cnt); }