public void SetIndex(int index, bool isEffect = true) { Vector2 v2 = new Vector2(); v2.x = bg.width * index + (index * gap); // v2.y = 0; if (isEffect) { bg.TweenMove(v2, 0.2f); } else { bg.TweenMove(v2, 0f); } }
//右列表选择框位置调整 add by tianjinpeng 2018/03/09 15:29:54 void choicepos(int index) { if (baglist.numItems == 0) { } else { Vector2 screenPos = baglist.GetChildAt(index).LocalToGlobal(Vector2.zero); Vector2 sPos = new Vector2(screenPos.x - 2, screenPos.y - 1); Vector2 logicScreenPos = storeup.GlobalToLocal(sPos); //choice.position = new Vector2(logicScreenPos.x, logicScreenPos.y); killtweener(choicemove); choicemove = choice.TweenMove(logicScreenPos, 0.1f); } }
void choiceleftpos(int qwe) { Vector2 screenPos = new Vector2(LeftList[qwe].position.x + 1, LeftList[qwe].position.y); //leftchoice.position = new Vector2(screenPos.x, screenPos.y); killtweener(choicemove); choicemove = leftchoice.TweenMove(screenPos, 0.1f); int i; for (i = 0; i < 4; i++) { if (qwe == i) { LeftList[i].visible = true; textlist[i].alpha = 1f; } else { LeftList[i].visible = false; textlist[i].alpha = 0.3f; } } Import(); }
/// <summary> /// /// </summary> /// <param name="deskId"></param> /// <param name="cards"></param> /// <param name="action">是否执行发牌动画</param> void PutCard(int deskId, string cards, bool action = false) { Data.Player player = null; foreach (var p in Data.Game.Players.Values) { if (p.DeskId == deskId) { player = p; } } if (player == null) { return; } List <GImage> cardImgs = new List <GImage>(); var cp = cardPlaces[player.Index]; var cpos = cp.position; var tpos = cpos; // 记录牌动画的目的点 foreach (var v in cards.Split('|')) { if (v == "-") { cpos.x += player.DeskId == Data.Game.DeskId ? 40 : 15; continue; } var n = int.Parse(v); string cardName = getName(n); GImage card = UIPackage.CreateObject("qipai", cardName).asImage; card.position = cpos; tpos = cpos; var scale = 1.0f; if (player.DeskId == Data.Game.DeskId) { cpos.x += 50; } else { cpos.x += 23; scale = 0.6f; } if (action) { card.position = cardCenterPlace.position; card.TweenMove(new Vector2(tpos.x, tpos.y), 0.3f); card.TweenScale(new Vector2(scale, scale), 0.3f); } else { card.SetScale(scale, scale); } card.AddRelation(cp, RelationType.Middle_Middle); card.AddRelation(cp, RelationType.Center_Center); ui.AddChild(card); cardImgs.Add(card); } if (cardsUi.ContainsKey(deskId)) { foreach (var img in cardsUi[deskId]) { ui.RemoveChild(img); } cardsUi.Remove(deskId); } cardsUi.Add(deskId, cardImgs); }