public void LineUp(bool isMy = true) { doSort(); for (int i = 0; i < list.Count; i++) { MJEntity trans = list[i]; //trans.localPosition = Vector3.right * width * (i-count * 0.5f); Vector3 toPos = Vector3.right * width * (i - list.Count * 0.5f); if (trans == last && list.IndexOf(trans) != list.Count - 1) { Vector3 lcPos = trans.transform.localPosition; Vector3 upPos = lcPos + Vector3.forward * 0.0405f; Vector3 leftUpPos = toPos + Vector3.forward * 0.0405f; Vector3[] path = new Vector3[] { lcPos, upPos, leftUpPos, toPos }; //trans.trans.DOLocalPath(path,1); trans.transform.DOLocalMove(upPos, 0.3f).OnComplete(() => { trans.transform.DOLocalMove(leftUpPos, 0.5f).OnComplete(() => { trans.transform.DOLocalMove(toPos, 0.4f); }); }); } else { //trans.transform.DOLocalMove(toPos, 0.3f).SetDelay(0.5f); trans.transform.DOLocalMoveX(toPos.x, 0.3f).SetDelay(0.4f); } } last = null; }
private Transform FindRightCard() { if (list.Count <= 0) { return(null); } MJEntity trans = list[list.Count - 1]; return(trans.transform); }
public void RemoveCard(int card) { MJEntity ent = Find(card); if (null != ent) { list.Remove(ent); Game.PoolManager.CardPool.Despawn(ent.gameObject); HandCards.Remove(card); } }
public void Clear() { while (list.Count > 0) { MJEntity trans = list[0]; list.RemoveAt(0); Game.PoolManager.CardPool.Despawn(trans.gameObject); } HandCards.Clear(); }
public void cardSelect(MJEntity card) // 一张牌抬起 其他牌落下 { for (int i = 0; i < list.Count; i++) { list[i].SetSelect(false); } if (card != null) { card.SetSelect(true); } }
public void TurnOffAllHandCard() { int count = Game.MJMgr.MyPlayer.handCardLayout.list.Count; for (int i = 0; i < count; i++) { MJEntity cardTran = Game.MJMgr.MyPlayer.handCardLayout.list[i]; Renderer r = cardTran.GetComponent <Renderer>(); r.material = myCardMatOff; } }
public void RemoveCardAt(int index) { if (index < 0 || index >= list.Count) { Debug.LogError("RemoveCardAt index:" + index); } MJEntity trans = list[index]; list.Remove(trans); Game.PoolManager.CardPool.Despawn(trans.gameObject); HandCards.RemoveAt(index); }
public void OnGameOperPlayerActionNotify(GameOperPlayerActionNotify data) { RoomMgr.actionNotify = data; int position = data.position; int actions = data.actions; int lastActionPosition = data.lastActionPosition; int lastActionCard = data.lastActionCard; string pengArg = ""; if (MJUtils.Peng()) { pengArg = GetCardStr(data.pengArg); } string chi = ""; if (MJUtils.Chi()) { int count = data.chiArg.Count; for (int i = 0; i < count; i++) { GameOperChiArg arg = data.chiArg[i]; chi += "[" + GetCardStr(arg.myCard1) + "," + GetCardStr(arg.myCard2) + "]-" + GetCardStr(arg.targetCard) + " "; } } Debug.LogFormat("===<color=blue>提示</color>,最后操作[{0}]; 牌[{1}]", strs[lastActionPosition], GetCardStr(lastActionCard)); Debug.LogFormat("===<color=blue>提示</color>,{0} <color=yellow>{1}</color>,[{2}] 支对:[{3}],听列表:[{4}]", strs[data.position], ActionStr(data.actions), pengArg + chi, ToStr(data.tingDzs), ToStr(data.tingList)); if (lastActionPosition >= 0 && lastActionCard > 0) { MJPlayer p = Game.MJMgr.GetPlayerByPosition(lastActionPosition); GameObject go = p.dropCardLayout.last; if (null != go) { MJEntity et = go.GetComponent <MJEntity>(); if (null != et) { Game.MJMgr.LastDropCard = et; Game.MJMgr.targetFlag.gameObject.SetActive(true); Game.MJMgr.targetFlag.position = go.transform.position; } } } else { Game.MJMgr.targetFlag.gameObject.SetActive(false); } EventDispatcher.DispatchEvent(MessageCommand.MJ_UpdatePlayPage); }
public void LineUpNoAnimation() { for (int i = 0; i < list.Count; i++) { MJEntity trans = list[i]; Vector3 pos = trans.transform.localPosition; pos.x = width * (i - list.Count * 0.5f); trans.transform.localPosition = pos; //trans.transform.localPosition = Vector3.right * width * (i - list.Count * 0.5f); //Vector3 toPos = Vector3.right * width * (i - list.Count * 0.5f); //trans.trans.DOLocalMove(toPos, 0.3f); } }
public void Clear() { while (list.Count > 0) { MJEntity trans = list[0]; //trans.reSetPoisiton -= cardSelect; //trans.onSendMessage -= cardPlay; list.RemoveAt(0); Game.PoolManager.CardPool.Despawn(trans.gameObject); } HandCards.Clear(); }
public int FindIndex(int card) { for (int i = 0; i < list.Count; i++) { MJEntity trans = list[i]; if (trans.Card == card) { return(i); } } Debug.LogErrorFormat("Can't Find MJEntity card:{0}", card); return(-1); }
private void ResetCard(params object[] args) { TingLiangFlag = false; detail.LiangtTiShi.gameObject.SetActive(TingLiangFlag); var handCardList = Game.MJMgr.MyPlayer.handCardLayout.list; for (int i = 0; i < handCardList.Count; i++) { MJEntity cardObj = handCardList[i]; //cardObj.tingLiangSendMessage = null; cardObj.SetSelect(false); cardObj.SetEnable(true); } }
private void PopingCard() { var handCardList = Game.MJMgr.MyPlayer.handCardLayout.list; for (int i = 0; i < handCardList.Count; i++) { MJEntity cardObj = handCardList[i]; cardObj.SetSelect(false); //cardObj.tingLiangSendMessage = OnCardChoose; //这里的注册没有去做保证释放,可能有残留的危险。 int cardPoint = cardObj.Card; bool isEnable = RoomMgr.actionNotify.tingList.Count == 0?true:RoomMgr.actionNotify.tingList.Contains(cardPoint); cardObj.SetEnable(isEnable); } }
public void AddCard(int card, bool withTween = false) { GameObject child = null; if (-1 == card) { child = Game.PoolManager.CardPool.Spawn("Dragon_Blank"); } else { child = Game.PoolManager.CardPool.Spawn(card.ToString()); } if (null == child) { Debug.LogWarningFormat("没有找到牌模型 card:{0}", card); } child.transform.SetParent(this.transform); child.transform.localScale = Vector3.one; child.transform.localRotation = Quaternion.identity; Transform newPos = FindRightCard(); Vector3 pos = Vector3.zero; if (null != newPos) { pos = newPos.localPosition; } child.transform.localPosition = pos + Vector3.right * width; //child.transform.localPosition = Vector3.zero; MJEntity entity = child.GetComponent <MJEntity>(); entity.Card = card; list.Add(entity); HandCards.Add(card); LineUpNoAnimation(); if (withTween) { entity.transform.DOLocalRotate(new Vector3(90, 0, 0), 0.3f).From(); } // TODO 手组上增加的每张牌,上下可选择 //child.GetComponent<MJEntity>().reSetPoisiton += cardSelect; //child.GetComponent<MJEntity>().onSendMessage += cardPlay; }
//public void Sort() //{ // doSort(); // LineUpNoAnimation(); //} public void DropCard(int card) { for (int i = list.Count - 1; i >= 0; i--) { MJEntity trans = list[i]; if (card == trans.Card) { list.Remove(trans); Game.PoolManager.CardPool.Despawn(trans.gameObject); HandCards.RemoveAt(i); return; } } //LineUp(); }
public void DropCard() { MJEntity entity = Game.MJMgr.MyDropMJEntity; if (!list.Contains(entity)) { Debug.LogWarning("DropCard error not Contains"); return; } list.Remove(entity); Game.PoolManager.CardPool.Despawn(entity.gameObject); HandCards.Remove(entity.Card); //LineUp(); }
private void ResetCard() { for (int i = 0; i < handCardList.Count; i++) { MJEntity cardObj = handCardList[i]; int cardPoint = cardObj.Card; if (cardPoint % 8 == 1 || cardPoint > 48) //if (true) { cardObj.SetSelect(false); cardObj.isCardUp = false; } else { cardObj.SetEnable(true); } } }
public void AddCard(int card, GameObject child = null) { Vector3 toPos = GetLocalPos(this.transform.childCount); if (null == child) { child = Game.PoolManager.CardPool.Spawn(card.ToString()); } child.transform.SetParent(this.transform); child.transform.localPosition = toPos; child.transform.localScale = Vector3.one; child.transform.localRotation = Quaternion.identity; MJEntity entity = child.GetComponent <MJEntity>(); last = child; lastCard = card; }
//public void Sort() //{ // doSort(); // LineUpNoAnimation(); //} public void DropCard(int card) { for (int i = list.Count - 1; i >= 0; i--) { MJEntity trans = list[i]; if (card == trans.Card) { //trans.reSetPoisiton -= cardSelect; //trans.onSendMessage -= cardPlay; list.Remove(trans); Game.PoolManager.CardPool.Despawn(trans.gameObject); HandCards.RemoveAt(i); return; } } //LineUp(); }
public void TurnOffHandCard() { if (RoomMgr.actionNotify.tingList.Count > 0) { int count = Game.MJMgr.MyPlayer.handCardLayout.list.Count; for (int i = 0; i < count; i++) { MJEntity cardTran = Game.MJMgr.MyPlayer.handCardLayout.list[i]; Renderer r = cardTran.GetComponent <Renderer>(); int card = cardTran.Card; if (RoomMgr.IsTingDropCard(card)) { r.material = myCardMatOn; } else { r.material = myCardMatOff; } } } }
public Vector3 DragCard(int card, GameObject child) { child.transform.SetParent(this.transform); child.transform.localScale = Vector3.one; child.transform.localRotation = Quaternion.identity; Transform newPos = FindRightCard(); Vector3 pos = Vector3.zero; if (null != newPos) { if (newPos.localPosition.x > -0.1f && newPos.localPosition.x < 0.01f) { pos = new Vector3(newPos.localPosition.x - 0.04425f, 0, 0); print(" >>>>>>.newPos 1-222222 <<<<<<" + newPos.localPosition.x); } else if (newPos.localPosition.x > 0.013f) { pos = new Vector3(newPos.localPosition.x - 0.13275f, 0, 0); print(" >>>>>>.newPos 1-333333 <<<<<<" + newPos.localPosition.x); } else { pos = newPos.localPosition; print(" >>>>>>.newPos 1-444444 <<<<<<" + newPos.localPosition.x); } } child.transform.localPosition = pos + Vector3.right * width * 1.5f; last = child.GetComponent <MJEntity>(); last.Card = card; list.Add(last); HandCards.Add(card); MJCardGroup.TryDragCard(); return(child.transform.position); }
public Vector3 DragCard(int card, GameObject child) { child.transform.SetParent(this.transform); child.transform.localScale = Vector3.one; child.transform.localRotation = Quaternion.identity; Transform newPos = FindRightCard(); Vector3 pos = Vector3.zero; if (null != newPos) { pos = newPos.localPosition; } child.transform.localPosition = pos + Vector3.right * width * 1.2f; last = child.GetComponent <MJEntity>(); last.Card = card; list.Add(last); HandCards.Add(card); MJCardGroup.TryDragCard(true); return(child.transform.position); }
// 甩九幺按钮触发的事件 private void OnClickShuaiJiuYao_MakeSureBtn() { List <int> throwList = new List <int>(); for (int i = 0; i < handCardList.Count; i++) { MJEntity cardObj = handCardList[i]; if (cardObj.Select) { throwList.Add(cardObj.Card); } } if (throwList.Count % 3 != 0) { string info = "要甩的牌是:"; for (int i = 0; i < throwList.Count; i++) { info += (throwList[i] + ", "); } info += " - "; info += throwList.Count + "张不能甩,请选三张、六张或者九张"; detail.Text_tishi.text = throwList.Count + "张不能甩,请选三张、六张或者九张"; detail.Text_tishi.color = Color.red; return; } if (RoomMgr.actionNotify == null)//避免报错 { RoomMgr.actionNotify = new GameOperPlayerActionNotify(); } Game.SocketGame.DoGameOperPlayerActionSyn(MJUtils.ACT_SHUAIJIUYAO, throwList.ToArray()); CancelInvoke("OnBackPressed"); OnBackPressed(); detail.Text_tishi.text = ""; }
public void OnCardChoose(MJEntity card) //tingliang #2 选定要亮的牌并发送。 { Game.SoundManager.PlayClick(); Game.MJMgr.MyPlayer.TingLiang(card.Card); ResetCard(); }
public void cardPlay(MJEntity card) //打出牌 { card.OnClickDrop(); }