Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        JSONObject jsonObj = new JSONObject("[" + testStr[useIndex] + "]");

        for (int i = 0; i < jsonObj.Count; i++)
        {
            DDZPokerData pd = new DDZPokerData((int)jsonObj.list[i].n);
            originList.Add(pd);
        }
        List <List <DDZPokerData> > result = DDZTip2.addLineArray(originList);

        printList(result);
        result = DDZTip2.clearArrayNull(result);
        printList(result);
        result = DDZTip2.lengthArray(originList);
        printList(result);

        List <DDZPokerData> list3 = DDZTip2.autoCheckPai(originList);

        printList(list3);

        result = DDZTip2.tishi(originList, new List <int>()
        {
            11, 0, 1
        });
        printList(result);

//		List<int> ss = new List<int>(){1,2,3,4};
//		List<int> ss2 = new List<int>(){1,2,3,4};
//		ss.RemoveRange(0,4);
//		Debug.Log(ss.Count);
//		ss2.AddRange(ss);
//		Debug.Log(ss2.Count);
//		Debug.Log( DDZTip2.isCheckChu(new List<int>(){1,8,1},new List<int>(){1,7,1}) );
//		List<DDZPokerData> list3 = originList.GetRange(0,5);
//		printList(list3);
//		List<int> sss1 = DDZTip2.typePai(originList.GetRange(0,5));
//		Debug.Log(sss1[0] + "  "+ sss1[1] +"  "+ sss1[2]);
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (ddzMain.isObserver)
        {
            return;
        }
        if (ddzMain.btnGroup.isManaged)
        {
            return;
        }
        if (Input.GetMouseButtonDown(0))
        {
            tapX = Input.mousePosition.x;
            Vector3    vc3 = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(vc3, Vector3.forward, out hit))
            {
//				Debug.LogError("---->"+hit.collider.gameObject.name);
                if (hit.collider.gameObject.transform.parent == this.transform)
                {
                    Debug.LogError(hit.collider.gameObject.name);
                    startX    = hit.collider.bounds.min.x;
                    startCard = hit.collider.gameObject;
//					Debug.LogError("===>"+startX);
                    hit.collider.gameObject.GetComponent <DDZPlayercard>().preSelectCard();
                    isDown = true;
                }
            }
        }
        else if (Input.GetMouseButtonUp(0))
        {
            isDown = false;
            if (isMove)
            {
                Debug.Log("isDown = false");
                selCards = new List <GameObject>();
                List <DDZPokerData> pdList = new List <DDZPokerData>();
                for (int i = 0; i < len; i++)
                {
                    if (deck[i] != null)
                    {
                        DDZPlayercard tempCard = deck[i].GetComponent <DDZPlayercard>();
                        if (tempCard._preSel)
                        {
                            selCards.Add(deck[i]);
                            pdList.Add(new DDZPokerData(tempCard.pokerD.cardID));

                            tempCard.clearPreSelectCard();
                        }
                    }
                }

                List <DDZPokerData> result = DDZTip2.autoCheckPai(pdList);
                for (int i = 0; i < result.Count; i++)
                {
                    DDZPokerData pd = result[i];
                    for (int m = 0; m < selCards.Count; m++)
                    {
                        if (selCards[m].GetComponent <DDZPlayercard>().pokerD.cardID == pd.cardID)
                        {
                            selCards[m].GetComponent <DDZPlayercard>().toggleWithoutCheck();
                            break;
                        }
                    }
                }
                if (result.Count > 0)
                {
                    playCtrl.selCardHandle();
                }

                if (ddzMain.isLiveRoom)
                {
                    playCtrl.sendSelectCardToServer();
                }

//				if( DDZTip.tip(selCards, null, 5).Count != 0){
//					DDZTip._preCards = null;
//					ddzMain.dragToSelTip(selCards);
//				}else if(DDZTip.tip(selCards, null, 6).Count != 0){
//					DDZTip._preCards = null;
//					ddzMain.dragToSelTip(selCards);
//				}else{
//					for(int i=0; i< selCards.Count; i++){
//						selCards[i].GetComponent<DDZPlayercard>().toggleWithoutCheck();
//					}
//					playCtrl.selCardHandle();
//				}


//				if(ddzMain.beginplay && !ddzMain.isMyRoot){
//					for(int i=0; i< len; i++){
//						if(deck[i] !=  null){
//							DDZPlayercard tempCard = deck[i].GetComponent<DDZPlayercard>();
//							if(tempCard._preSel || tempCard.isSelected){
//								selCards.Add(deck[i]);
//								tempCard.clearPreSelectCard();
//							}
//						}
//					}
//					if(selCards.Count> 0){
//						ddzMain.dragToSelTip(selCards);
//					}
//				}else{
//					for(int i=0; i< len; i++){
//						if(deck[i] !=  null){
//							DDZPlayercard tempCard = deck[i].GetComponent<DDZPlayercard>();
//							if(tempCard._preSel){
//								selCards.Add(deck[i]);
//								tempCard.clearPreSelectCard();
//							}
//						}
//					}
//					if(ddzMain.isInBattle){
//						for(int i=0; i< selCards.Count; i++){
//							selCards[i].GetComponent<DDZPlayercard>().Buttonc();
//						}
//					}
//				}
            }
            isMove = false;
        }
        if (isDown)
        {
            if (!isMove)
            {
                if (Mathf.Abs(Input.mousePosition.x - tapX) > 10)
                {
                    isMove = true;
                }
            }
            if (isMove)
            {
                Vector3 vc3 = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                rangeSelect(vc3.x);
//				RaycastHit hit;
//				if( Physics.Raycast(vc3,Vector3.forward,out hit)){
//					if(hit.collider.gameObject.transform.parent == this.transform){
//						hit.collider.gameObject.GetComponent<DDZPlayercard>().preSelectCard();
//					}
//				}
            }
        }
    }