卡牌绘制

void doManagerPlayerCard(){
		GameObject _object = Resources.Load ("Card/CardSprite", typeof(GameObject)) as GameObject;
		_testList.Sort ();
		int cardNumber = 3 * _testList.Count;
		for (int i=0; i<cardNumber; ++i) {
			int index = i % _testList.Count;
			int place = _testList[index];

			GameObject _parent = NGUITools.AddChild (_background, _object);
			_parent.name = "lordcard";
			_parent.transform.localPosition = new Vector3(0.0f, 200.0f, 0.0f);

			TweenPosition _position = _parent.AddComponent<TweenPosition> ();
			_position.duration = 0.4f;
			_position.delay = i*0.4f;
			_position.from = new Vector3(0.0f, 200.0f, 0.0f);
			_position.to = doDealPlayerCard(index, place);
			_position.PlayForward();
		}
	}

	Vector3 doDealPlayerCard(int _index, int _place){
		if (_place == 1) {
			return new Vector3(-200.0f, 60.0f, 0.0f);
		} else if (_place == 2) {
			return new Vector3(-200.0f, -60.0f, 0.0f);
		} else if (_place == 3) {
			return new Vector3(0.0f, -200.0f, 0.0f);
		} else if (_place == 4) {
			return new Vector3(200.0f, -60.0f, 0.0f);
		} else if (_place == 5) {
			return new Vector3(200.0f, 60.0f, 0.0f);
		} else {
			return new Vector3(200.0f, 60.0f, 0.0f);
		}
	}

  

posted @ 2014-08-26 18:48  Zhaoyier  阅读(293)  评论(0编辑  收藏  举报