public void RenderCardsOutside(List <int> list) { List <int> pointsOutside = new List <int>(list); AllCardsOutsideBack(); var length = pointsOutside.Count; float mid = (float)length / 2; GameObject cardObj; string objTag; Vector3 lp; int point; PlayManager.GetInstance().SetOutsidePoints(pointsOutside); for (int i = 0; i < length; i++) { point = pointsOutside[i]; objTag = CardHelper.GetInstance().GetTag(point); cardObj = GameObject.FindGameObjectWithTag(objTag); cardObj.transform.localScale = Vector3.one * 0.5f; lp = new Vector3((i - mid) * 0.5f, 1f, -8.0f + (length - i - 1) * 0.001f); cardObj.transform.localPosition = lp; SetCardGoAttr(cardObj, false, point, i, false); } }
public void TouchEnded() { doDetect = false; int point; bool ready2Go; foreach (Transform t in touchedForms) { point = t.gameObject.GetComponent <CardAttr>().point; ready2Go = t.gameObject.GetComponent <CardAttr>().ready2go; if (ready2Go) { t.localPosition += Vector3.down * 0.5f; PlayManager.GetInstance().RemoveReady2GoPoint(point); } else { t.localPosition += Vector3.up * 0.5f; PlayManager.GetInstance().AddReady2GoPoint(point); } t.gameObject.GetComponent <CardAttr>().ready2go = !ready2Go; ChangeColor(t, Color.white); } touching = false; touchedForms.Clear(); doDetect = true; }
public void LetItGo() { List <int> allReady2GoPoints = PlayManager.GetInstance().AllReady2GoPoints(); foreach (int ready2GoPoint in allReady2GoPoints) { PlayManager.GetInstance().RemoveHandPoint(ready2GoPoint); } RenderCardsInHand(PlayManager.GetInstance().AllPointsInHand()); RenderCardsOutside(allReady2GoPoints); PlayManager.GetInstance().ClearAlllReady2Go(); }
public void Pass() { HideAll(); PlayCardsReq req = new PlayCardsReq(); var reqTypeWithPoints = new TypeWithPoints(); reqTypeWithPoints.cardsType = CardsType.Pass; req.typeWithPoints = reqTypeWithPoints; req.handPoints = new List <int>(PlayManager.GetInstance().AllPointsInHand()); SendPlayCards(req); }
private void AllCardsOutsideBack() { GameObject obj; foreach (int point in PlayManager.GetInstance().AllPointsOutside()) { obj = GameObject.FindGameObjectWithTag(CardHelper.GetInstance().GetTag(point)); obj.transform.localScale = Vector3.one; obj.transform.localPosition = new Vector3(0, 2000f, 0); SetCardGoAttr(obj, false, 0, 0, false); } PlayManager.GetInstance().ClearAlllOutside(); }
public void PlayCards() { List <int> allReady2GoPoints = PlayManager.GetInstance().AllReady2GoPoints(); Debug.Log("out before play:" + CardHelper.GetInstance().Join(PlayManager.GetInstance().AllPointsOutside())); if (allReady2GoPoints.Count == 0) { Debug.Log("no card selected."); ShowMessage(ErrorCode.PLAY_NO_CARD_SELECTED); } else { Debug.Log("ready2GoPoints:" + CardHelper.GetInstance().Join(allReady2GoPoints)); TypeWithPoints typeWithPoints = CardHelper.GetInstance().JudgeType(allReady2GoPoints); Debug.Log(string.Format("type:{0},p:{1},ps{2}", typeWithPoints.cardsType, typeWithPoints.p, Join(typeWithPoints.ps))); if (typeWithPoints.cardsType.Equals(CardsType.Invalid)) { ShowMessage(ErrorCode.PLAY_INVALID_CARDS_TYPE); } else if (!CardHelper.GetInstance().CanPlay(typeWithPoints)) { ShowMessage(ErrorCode.PLAY_NOT_BIG_ENOUGH); } else { List <int> goPoints = new List <int>(allReady2GoPoints); List <int> handPoints = new List <int>(PlayManager.GetInstance().AllPointsInHand()); PlayCardsReq req = new PlayCardsReq(); req.typeWithPoints = typeWithPoints; req.handPoints = handPoints; req.points = goPoints; GameObject.FindGameObjectWithTag("MainCamera").GetComponent <GameController>().SendMessage("SendPlayCards", req); } } }
public void ResetHandCards() { PlayManager.GetInstance().ClearAlllReady2Go(); Debug.Log("ready2GoPoints after reset:" + CardHelper.GetInstance().Join(PlayManager.GetInstance().AllReady2GoPoints())); GetComponent <GameUIRender>().SendMessage("RenderCardsInHand", PlayManager.GetInstance().AllPointsInHand()); }