public void setImage(int itemPos, int ChildRightPos, Texture2D t) { dpic = this.gameObject.transform.GetComponentInChildren <DragItemPic> (); if (dpic) { dpic.showImage.texture = t as Texture; dpic.rightPos = ChildRightPos; this.currentPos = itemPos; dpic.showImage.gameObject.name = ChildRightPos + "_dragitem"; drag.Init(); } }
private void calculateScore() { SoundController.Instance.PlayDidi(); score = 0; for (int i = 0; i < listItem.Count; i++) { DragItem _t = listItem[i]; DragItemPic _p = _t.gameObject.GetComponentInChildren <DragItemPic> (); if (_t.currentPos == _p.rightPos && _t.gameObject.activeInHierarchy) { score++; } } //Debug.Log ("----"+score); tips.text = "移动次数:" + switchCount + "\r\n正确位置" + score + "/" + listItem.Count; if (score == listItem.Count) { Debug.Log("完成拼图" + Time.time); MainUIController.Instance.ShowTipManager("恭喜,拼图成功!"); } }