示例#1
0
    int jiluCont = 0;            //如果现在是用户胜利,点击悔棋
    public void IloveHUIQI()
    {
        for (int i = 1; i <= 90; i++)
        {
            GameObject Clear = GameObject.Find("prefabs" + i.ToString());
            Destroy(Clear);
        }
        if (jiluCont >= 1)
        {
            //yemiantiaozhuang.ChessPeople=1;
            jiluCont = 0;
        }
        if (Count <= 0)
        {
            return;
        }
        int        f = Count - 1;
        int        oneID = pos[f].ChessID.x; //黑色旗子原来位置ID
        int        twoID = pos[f].ChessID.y; //黑色旗子移动到的位置的ID
        GameObject obj1, obj2, obj3, obj4;
        bool       IsfalseOrtrue;

        obj1          = pos[f].obj1;       //第一个款
        obj2          = pos[f].obj2;       //第二个框
        obj3          = pos[f].objfrist;   //第一个旗子
        obj4          = pos[f].objsconde;  //第二个旗子
        IsfalseOrtrue = pos[f].BlackOrRed; //现在红色还是黑色
        if (obj4 != null)                  //最后一步等于吃子
        {
            obj3.transform.parent        = obj1.transform;
            obj4.transform.parent        = obj2.transform;
            obj3.transform.localPosition = Vector3.zero;
            obj4.transform.localPosition = Vector3.zero;
            Board.chess[pos[f].From.y, pos[f].From.x] = oneID;
            Board.chess[pos[f].To.y, pos[f].To.x]     = twoID;
        }
        else
        {
            obj3.transform.parent        = obj1.transform;
            obj3.transform.localPosition = Vector3.zero;
            Board.chess[pos[f].From.y, pos[f].From.x] = oneID;
            Board.chess[pos[f].To.y, pos[f].To.x]     = 0;
        }
        if (blackclick.ChessMove == false)
        {
            blackclick.str       = "红方走";
            blackclick.ChessMove = true;
        }
        else
        {
            blackclick.ChessMove = false;
            blackclick.str       = "黑方走";
        }
        Count -= 1;
        blackclick.TrueOrFalse = true;//在将帅被吃了的情况下 给他能走棋
        KingPosition.JiangJunCheck();
    }
示例#2
0
    public void threm()
    {
        //str="对方正在思考";
        if (ChessMove == false)
        {
            //print("yes");
            //ChessChongzhi chzh = new ChessChongzhi();
            //SearchEngine see = new SearchEngine();
            //Blackmove mo = new Blackmove();
            chere = see.SearchAGoodMove(board.chess);
            string s1 = "";
            string s2 = "";
            string s3 = "";
            string s4 = "";
            s1 = see.Itemfirname(chere);
            s2 = see.Itemsconname(chere);
            //print(s1+"  "+s2);
            GameObject one = GameObject.Find(s1);
            GameObject two = GameObject.Find(s2);
            foreach (Transform child in one.transform)
            {
                s3 = child.name;                        //第一个象棋名字
            }
            foreach (Transform child in two.transform)
            {
                s4 = child.name;                        //吃到的子的象棋名字
            }
            if (s4 == "")
            {
                int a = board.chess [chere.From.y, chere.From.x];
                int b = board.chess [chere.To.y, chere.To.x];
                chzh.AddChess(ChessChongzhi.Count, chere.From.x, chere.From.y, chere.To.x, chere.To.y, false, a, b);
                IsMove(s3, two, chere.From.x, chere.From.y, chere.To.x, chere.To.y);
                renji.transform.localPosition = one.transform.localPosition;
            }
            else
            {
                int a = board.chess [chere.From.y, chere.From.x];
                int b = board.chess [chere.To.y, chere.To.x];
                chzh.AddChess(ChessChongzhi.Count, chere.From.x, chere.From.y, chere.To.x, chere.To.y, false, a, b);
                IsEat(s3, s4, chere.From.x, chere.From.y, chere.To.x, chere.To.y);
                renji.transform.localPosition = one.transform.localPosition;
            }

            RedName   = null;
            BlackName = null;
            GameObject obj1 = GameObject.Find(s3);
            tog       = obj1.GetComponent <UIToggle> ();
            tog.value = true;
            str       = "红方走";
            KingPosition.JiangJunCheck();
            ChessMove = true;
        }
    }
示例#3
0
    public void SendMoveMessage(int x1, int y1, int x2, int y2)
    {
        //停止计时
        TM.StopTime();
        YidongOrChizi = "Yidong";
        if ((GameManager.curTurn == GameManager.userColor) && TrueOrFalse)
        {
            // 发送消息通知对手,落子位置
            {
                KingPosition.JiangJunCheck();
                Hashtable values = new Hashtable();
                values.Add("name", "piece");
                values.Add("FromX", x1);
                values.Add("FromY", y1);
                values.Add("ToX", x2);
                values.Add("ToY", y2);
                values.Add("Move", str);
                values.Add("YidongOrChizi", YidongOrChizi);
                values.Add("Regame", 0);
                values.Add("GoBack", 0);

                GobangClient.send(GameSerialize.toBytes(values));
            }
            //检查游戏是否结束
            Game.updateChess();
            // 落子后,切换回合
            if (GameManager.curTurn == "Red")
            {
                GameManager.curTurn = "Black";
            }
            else
            {
                GameManager.curTurn = "Red";
            }
        }
    }
示例#4
0
    public void IsClickCheck()
    {
        if (TrueOrFalse == false)
        {
            return;
        }
        if (!bIsOnline)
        {
            GameObject obj = UICamera.hoveredObject;
            BlackNameOrRedName(obj);//是否点击到棋子  如果是  就得到棋子
            if (obj.name.Substring(0, 1) != "i")
            {
                obj = obj.gameObject.transform.parent.gameObject;//得到他的父容器
            }
            int x      = System.Convert.ToInt32((obj.transform.localPosition.x + 263) / 195);
            int y      = System.Convert.ToInt32(Mathf.Abs((obj.transform.localPosition.y - 302) / 192));
            int Result = IsBlackOrRed(x, y);//判断点击到了什么
            switch (Result)
            {
            case 0:    //点击到了空  是否要走棋
                       //如果点击到了空格  就把对象清空
                for (int i = 1; i <= 90; i++)
                {
                    GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                    Destroy(Clear);
                }
                ToY = y;
                ToX = x;
                if (ChessMove)
                {    //红色走
                    if (RedName == null)
                    {
                        return;
                    }
                    string sssRed = RedName;    //记录红色棋子的名字
                    bool   ba     = rules.IsValidMove(Board.chess, FromX, FromY, ToX, ToY);
                    if (!ba)
                    {
                        return;
                    }

                    int a = Board.chess[FromY, FromX];
                    int b = Board.chess[ToY, ToX];
                    chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                    str = "黑方走";
                    IsMove(RedName, obj, FromX, FromY, ToX, ToY);    //走了
                    KingPosition.JiangJunCheck();
                    ChessMove = false;
                    //getString();
                    if (str == "红色棋子胜利")
                    {
                        return;    //因为没有携程关系  每次进入黑色走棋的时候都判断 棋局是否结束
                    }
                    BlackName = null;
                    RedName   = null;
                    return;
                    //执行走棋
                }
                else
                {    //黑色走
                    if (BlackName == null)
                    {
                        return;
                    }
                    bool ba = rules.IsValidMove(Board.chess, FromX, FromY, ToX, ToY);
                    if (!ba)
                    {
                        return;
                    }
                    //ChessChongzhi chzh = new ChessChongzhi();
                    int a = Board.chess[FromY, FromX];
                    int b = Board.chess[ToY, ToX];
                    chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                    str = "红方走";
                    IsMove(BlackName, obj, FromX, FromY, ToX, ToY);
                    //黑色走棋
                    ChessMove = true;
                    KingPosition.JiangJunCheck();
                }
                break;

            case 1:    //点击到了黑色  是否选中  还是  红色要吃子
                if (!ChessMove)
                {
                    FromX = x;
                    FromY = y;
                    for (int i = 1; i <= 90; i++)
                    {
                        GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                        Destroy(Clear);
                    }
                    can.ClickChess(FromX, FromY);
                }
                else
                {
                    for (int i = 1; i <= 90; i++)
                    {
                        GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                        Destroy(Clear);
                    }
                    if (RedName == null)
                    {
                        return;
                    }
                    ToX = x;
                    ToY = y;
                    bool ba = rules.IsValidMove(Board.chess, FromX, FromY, ToX, ToY);
                    if (!ba)
                    {
                        return;
                    }
                    int a = Board.chess[FromY, FromX];
                    int b = Board.chess[ToY, ToX];
                    chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                    //看看是否能播放音乐
                    IsEat(RedName, BlackName, FromX, FromY, ToX, ToY);
                    ChessMove = false;
                    //红色吃子  变黑色走
                    str = "黑方走";
                    KingPosition.JiangJunCheck();
                    if (str == "红色棋子胜利")
                    {
                        return;    //因为没有携程关系  每次进入黑色走棋的时候都判断 棋局是否结束
                    }
                    RedName   = null;
                    BlackName = null;
                    return;
                }
                break;

            case 2:    //点击到了红色   是否选中  还是黑色要吃子
                if (ChessMove)
                {
                    FromX = x;
                    FromY = y;
                    for (int i = 1; i <= 90; i++)
                    {
                        GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                        Destroy(Clear);
                    }
                    can.ClickChess(FromX, FromY);
                }
                else
                {
                    for (int i = 1; i <= 90; i++)
                    {
                        GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                        Destroy(Clear);
                    }
                    if (BlackName == null)
                    {
                        return;
                    }
                    ToX = x;
                    ToY = y;
                    bool ba = rules.IsValidMove(Board.chess, FromX, FromY, ToX, ToY);
                    if (!ba)
                    {
                        return;
                    }
                    //ChessChongzhi chzh = new ChessChongzhi();
                    int a = Board.chess[FromY, FromX];
                    int b = Board.chess[ToY, ToX];
                    chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                    //看看是否能播放音乐
                    IsEat(BlackName, RedName, FromX, FromY, ToX, ToY);
                    RedName   = null;
                    BlackName = null;
                    ChessMove = true;
                    str       = "红方走";
                    KingPosition.JiangJunCheck();
                }
                break;
            }
        }
        else
        {
            if (!GobangClient.isConnected())
            {
                return;
            }
            if ((GameManager.curTurn == GameManager.userColor) && TrueOrFalse)
            {
                GameObject obj = UICamera.hoveredObject;
                BlackNameOrRedName(obj);//是否点击到棋子  如果是  就得到棋子
                if (obj.name.Substring(0, 1) != "i")
                {
                    obj = obj.gameObject.transform.parent.gameObject;//得到他的父容器
                }
                int x      = System.Convert.ToInt32((obj.transform.localPosition.x + 263) / 195);
                int y      = System.Convert.ToInt32(Mathf.Abs((obj.transform.localPosition.y - 302) / 192));
                int Result = IsBlackOrRed(x, y);//判断点击到了什么
                switch (Result)
                {
                case 0:    //点击到了空  是否要走棋
                           //如果点击到了空格  就把对象清空
                    for (int i = 1; i <= 90; i++)
                    {
                        GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                        Destroy(Clear);
                    }
                    ToY = y;
                    ToX = x;
                    if (ChessMove)
                    {    //红色走
                        if (RedName == null)
                        {
                            return;
                        }
                        string sssRed = RedName;    //记录红色棋子的名字
                        bool   ba     = rules.IsValidMove(Board.chess, FromX, FromY, ToX, ToY);
                        if (!ba)
                        {
                            return;
                        }

                        int a = Board.chess[FromY, FromX];
                        int b = Board.chess[ToY, ToX];
                        chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                        str = "黑方走";
                        IsMove(RedName, obj, FromX, FromY, ToX, ToY);    //走了
                        KingPosition.JiangJunCheck();
                        ChessMove = false;
                        //getString();
                        if (str == "红色棋子胜利")
                        {
                            return;    //因为没有携程关系  每次进入黑色走棋的时候都判断 棋局是否结束
                        }
                        BlackName = null;
                        RedName   = null;
                        SendMoveMessage(FromX, FromY, ToX, ToY);
                        return;
                        //执行走棋
                    }
                    else
                    {    //黑色走
                        if (BlackName == null)
                        {
                            return;
                        }
                        bool ba = rules.IsValidMove(Board.chess, FromX, FromY, ToX, ToY);
                        if (!ba)
                        {
                            return;
                        }
                        //ChessChongzhi chzh = new ChessChongzhi();
                        int a = Board.chess[FromY, FromX];
                        int b = Board.chess[ToY, ToX];
                        chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                        str = "红方走";
                        IsMove(BlackName, obj, FromX, FromY, ToX, ToY);
                        //黑色走棋
                        ChessMove = true;
                        KingPosition.JiangJunCheck();
                        SendMoveMessage(FromX, FromY, ToX, ToY);
                    }
                    break;

                case 1:    //点击到了黑色  是否选中  还是  红色要吃子
                    if (!ChessMove)
                    {
                        FromX = x;
                        FromY = y;
                        for (int i = 1; i <= 90; i++)
                        {
                            GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                            Destroy(Clear);
                        }
                        can.ClickChess(FromX, FromY);
                    }
                    else
                    {
                        for (int i = 1; i <= 90; i++)
                        {
                            GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                            Destroy(Clear);
                        }
                        if (RedName == null)
                        {
                            return;
                        }
                        ToX = x;
                        ToY = y;
                        bool ba = rules.IsValidMove(Board.chess, FromX, FromY, ToX, ToY);
                        if (!ba)
                        {
                            return;
                        }
                        int a = Board.chess[FromY, FromX];
                        int b = Board.chess[ToY, ToX];
                        chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                        //红色吃子  变黑色走
                        str = "黑方走";
                        IsEat(RedName, BlackName, FromX, FromY, ToX, ToY);
                        ChessMove = false;
                        KingPosition.JiangJunCheck();
                        if (str == "红色棋子胜利")
                        {
                            return;    //因为没有携程关系  每次进入黑色走棋的时候都判断 棋局是否结束
                        }
                        RedName   = null;
                        BlackName = null;
                        SendEatMessage(FromX, FromY, ToX, ToY);
                        return;
                    }
                    break;

                case 2:    //点击到了红色   是否选中  还是黑色要吃子
                    if (ChessMove)
                    {
                        FromX = x;
                        FromY = y;
                        for (int i = 1; i <= 90; i++)
                        {
                            GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                            Destroy(Clear);
                        }
                        can.ClickChess(FromX, FromY);
                    }
                    else
                    {
                        for (int i = 1; i <= 90; i++)
                        {
                            GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                            Destroy(Clear);
                        }
                        if (BlackName == null)
                        {
                            return;
                        }
                        ToX = x;
                        ToY = y;
                        bool ba = rules.IsValidMove(Board.chess, FromX, FromY, ToX, ToY);
                        if (!ba)
                        {
                            return;
                        }
                        //ChessChongzhi chzh = new ChessChongzhi();
                        int a = Board.chess[FromY, FromX];
                        int b = Board.chess[ToY, ToX];
                        chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                        str = "红方走";
                        IsEat(BlackName, RedName, FromX, FromY, ToX, ToY);
                        RedName   = null;
                        BlackName = null;
                        ChessMove = true;
                        KingPosition.JiangJunCheck();
                        SendEatMessage(FromX, FromY, ToX, ToY);
                    }
                    break;
                }
            }
        }
    }
示例#5
0
    public void IsClickCheck()
    {
        renji = GameObject.Find("chessRENJI");
        if (TrueOrFalse == false)
        {
            return;
        }
        GameObject obj = UICamera.hoveredObject;

        BlackNameOrRedName(obj);         //是否点击到棋子  如果是  就得到棋子
        if (obj.name.Substring(0, 1) != "i")
        {
            obj = obj.gameObject.transform.parent.gameObject;            //得到他的父容器
        }
        int x      = System.Convert.ToInt32((obj.transform.localPosition.x) / 130);
        int y      = System.Convert.ToInt32(Mathf.Abs((obj.transform.localPosition.y) / 128));
        int Result = IsBlackOrRed(x, y);         //判断点击到了什么

        switch (Result)
        {
        case 0:        //点击到了空  是否要走棋
            //如果点击到了空格  就把对象清空
            //p.MusicPlay();
            for (int i = 1; i <= 90; i++)
            {
                GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                Destroy(Clear);
            }
            if (posthread == false)
            {
                return;
            }
            //can.ClickChess(FromX,FromY);
            ToY = y;
            ToX = x;
            if (ChessMove)            //红色走
            {
                if (RedName == null)
                {
                    return;
                }
                string sssRed = RedName;                //记录红色棋子的名字
                bool   ba     = rules.IsValidMove(board.chess, FromX, FromY, ToX, ToY);
                if (!ba)
                {
                    return;
                }

                int a = board.chess[FromY, FromX];
                int b = board.chess[ToY, ToX];
                chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                IsMove(RedName, obj, FromX, FromY, ToX, ToY);           //走了
                str = "黑方走";
                KingPosition.JiangJunCheck();
                ChessMove = false;
                //getString();
                if (str == "红色棋子胜利")
                {
                    return;                     //因为没有携程关系  每次进入黑色走棋的时候都判断 棋局是否结束
                }
                if (yemiantiaozhuang.ChessPeople == 2)
                {                //如果现在是双人对战模式
                    BlackName = null;
                    RedName   = null;
                    return;
                }
                if (ChessMove == false)
                {
                    StartCoroutine("Robot");
                }
                //执行走棋
            }
            else             //黑色走
            {
                if (BlackName == null)
                {
                    return;
                }
                bool ba = rules.IsValidMove(board.chess, FromX, FromY, ToX, ToY);
                if (!ba)
                {
                    return;
                }
                //ChessChongzhi chzh = new ChessChongzhi();
                int a = board.chess[FromY, FromX];
                int b = board.chess[ToY, ToX];
                chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                //看看是否能播放音乐
                IsMove(BlackName, obj, FromX, FromY, ToX, ToY);

                //黑色走棋
                ChessMove = true;
                str       = "红方走";
                KingPosition.JiangJunCheck();
            }
            break;

        case 1:        //点击到了黑色  是否选中  还是  红色要吃子
            if (posthread == false)
            {
                return;
            }
            if (!ChessMove)
            {
                FromX = x;
                FromY = y;
                //	Canmovetishi can = new Canmovetishi();

                for (int i = 1; i <= 90; i++)
                {
                    GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                    Destroy(Clear);
                }
                can.ClickChess(FromX, FromY);
            }
            else
            {
                for (int i = 1; i <= 90; i++)
                {
                    GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                    Destroy(Clear);
                }
                if (RedName == null)
                {
                    return;
                }
                ToX = x;
                ToY = y;
                bool ba = rules.IsValidMove(board.chess, FromX, FromY, ToX, ToY);
                if (!ba)
                {
                    return;
                }
                //ChessChongzhi chzh = new ChessChongzhi();
                int a = board.chess[FromY, FromX];
                int b = board.chess[ToY, ToX];
                chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                //看看是否能播放音乐
                IsEat(RedName, BlackName, FromX, FromY, ToX, ToY);

                //print(RedName+"  "+BlackName+" "+FromX+" "+FromY+" "+ToX+" "+ToY);
                ChessMove = false;
                //getString();
                //红色吃子  变黑色走
                str = "黑方走";
                KingPosition.JiangJunCheck();
                if (str == "红色棋子胜利")
                {
                    return;                     //因为没有携程关系  每次进入黑色走棋的时候都判断 棋局是否结束
                }
                if (yemiantiaozhuang.ChessPeople == 2)
                {
                    RedName   = null;
                    BlackName = null;
                    return;
                }
                if (ChessMove == false)
                {
                    StartCoroutine("Robot");
                }
            }
            break;

        case 2:        //点击到了红色   是否选中  还是黑色要吃子
            if (posthread == false)
            {
                return;
            }
            if (ChessMove)
            {
                FromX = x;
                FromY = y;
                //Canmovetishi can = new Canmovetishi();
                for (int i = 1; i <= 90; i++)
                {
                    GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                    Destroy(Clear);
                }
                can.ClickChess(FromX, FromY);
            }
            else
            {
                for (int i = 1; i <= 90; i++)
                {
                    GameObject Clear = GameObject.Find("prefabs" + i.ToString());
                    Destroy(Clear);
                }
                if (BlackName == null)
                {
                    return;
                }
                ToX = x;
                ToY = y;
                bool ba = rules.IsValidMove(board.chess, FromX, FromY, ToX, ToY);
                if (!ba)
                {
                    return;
                }
                //ChessChongzhi chzh = new ChessChongzhi();
                int a = board.chess[FromY, FromX];
                int b = board.chess[ToY, ToX];
                chzh.AddChess(ChessChongzhi.Count, FromX, FromY, ToX, ToY, true, a, b);
                //看看是否能播放音乐
                IsEat(BlackName, RedName, FromX, FromY, ToX, ToY);

                RedName   = null;
                BlackName = null;
                ChessMove = true;
                str       = "红方走";
                KingPosition.JiangJunCheck();
            }
            break;
        }
    }
    int jiluCont = 0;            //如果现在是用户胜利,点击悔棋
    public void IloveHUIQI()
    {
        GameObject obj = GameObject.Find("chessRENJI");

        obj.transform.localPosition = new Vector3(8888, 8888, 0);
        for (int i = 1; i <= 90; i++)
        {
            GameObject Clear = GameObject.Find("prefabs" + i.ToString());
            Destroy(Clear);
        }
        if (blackclick.ChessMove == false && yemiantiaozhuang.ChessPeople == 1)
        {
            if (blackclick.str == "红色棋子胜利")
            {
                //人机状态时候红色棋子胜利悔棋
                yemiantiaozhuang.ChessPeople = 2;                //先把他等于2
                jiluCont++;
            }
            return;
        }
        if (yemiantiaozhuang.ChessPeople == 1)           //如果是人机 就让他悔棋两部
        {
            if (Count <= 1)
            {
                return;
            }
            int f       = Count - 1;
            int s       = Count - 2;
            int oneID   = pos [f].ChessID.x;          //黑色旗子原来位置ID
            int twoID   = pos [f].ChessID.y;          //黑色旗子移动到的位置的ID
            int threeID = pos [s].ChessID.x;          //红色旗子原来位置的ID
            int forID   = pos [s].ChessID.y;          //红色旗子移动到的位置ID
            //print (pos [f].From.x + "," + pos [f].From.y + "--" + pos [f].To.x + "," + pos [f].To.y);
            //print (board.chess [0, 0]);
            GameObject obj1, obj2, obj3, obj4;
            bool       IsfalseOrtrue;
            obj1          = pos [f].obj1;       //第一个款
            obj2          = pos [f].obj2;       //第二个框
            obj3          = pos [f].objfrist;   //第一个旗子
            obj4          = pos [f].objsconde;  //第二个旗子
            IsfalseOrtrue = pos [f].BlackOrRed; //现在红色还是黑色
            GameObject o1, o2, o3, o4;
            bool       IstrueOrfalse;
            o1            = pos [s].obj1;      //第一个款
            o2            = pos [s].obj2;      //第二个框
            o3            = pos [s].objfrist;  //第一个旗子
            o4            = pos [s].objsconde; //第二个旗子
            IstrueOrfalse = pos [s].BlackOrRed;

            if (obj4 != null)              //黑色等于吃子
            {
                obj3.transform.parent        = obj1.transform;
                obj4.transform.parent        = obj2.transform;
                obj3.transform.localPosition = Vector3.zero;
                obj4.transform.localPosition = Vector3.zero;
                board.chess [pos [f].From.y, pos [f].From.x] = oneID;
                board.chess [pos [f].To.y, pos [f].To.x]     = twoID;
                if (o4 != null)                  //红色吃子状态
                {
                    o3.transform.parent        = o1.transform;
                    o4.transform.parent        = o2.transform;
                    o3.transform.localPosition = Vector3.zero;
                    o4.transform.localPosition = Vector3.zero;
                    board.chess [pos [s].From.y, pos [s].From.x] = threeID;
                    board.chess [pos [s].To.y, pos [s].To.x]     = forID;
                }
                else
                {
                    o3.transform.parent        = o1.transform;
                    o3.transform.localPosition = Vector3.zero;
                    board.chess [pos [s].From.y, pos [s].From.x] = threeID;
                    board.chess [pos [s].To.y, pos [s].To.x]     = 0;
                }
            }
            else                //黑色等于走棋
            {
                obj3.transform.parent        = obj1.transform;
                obj3.transform.localPosition = Vector3.zero;
                board.chess [pos [f].From.y, pos [f].From.x] = oneID;
                board.chess [pos [f].To.y, pos [f].To.x]     = 0;
                if (o4 != null)
                {
                    o3.transform.parent        = o1.transform;
                    o4.transform.parent        = o2.transform;
                    o3.transform.localPosition = Vector3.zero;
                    o4.transform.localPosition = Vector3.zero;
                    board.chess [pos [s].From.y, pos [s].From.x] = threeID;
                    board.chess [pos [s].To.y, pos [s].To.x]     = forID;
                }
                else
                {
                    o3.transform.parent        = o1.transform;
                    o3.transform.localPosition = Vector3.zero;
                    board.chess [pos [s].From.y, pos [s].From.x] = threeID;
                    board.chess [pos [s].To.y, pos [s].To.x]     = 0;
                }
            }
            blackclick.ChessMove = true;
            Count -= 2;
            blackclick.TrueOrFalse = true;            //在将帅被吃了的情况下 给他能走棋
            blackclick.str         = "红方走";
            KingPosition.JiangJunCheck();
        }
        else if (yemiantiaozhuang.ChessPeople == 2)
        {
            if (jiluCont >= 1)
            {
                yemiantiaozhuang.ChessPeople = 1;
                jiluCont = 0;
            }
            if (Count <= 0)
            {
                return;
            }
            int f = Count - 1;
            //int s = Count - 2;
            int        oneID = pos [f].ChessID.x;     //黑色旗子原来位置ID
            int        twoID = pos [f].ChessID.y;     //黑色旗子移动到的位置的ID
            GameObject obj1, obj2, obj3, obj4;
            bool       IsfalseOrtrue;
            obj1          = pos [f].obj1;       //第一个款
            obj2          = pos [f].obj2;       //第二个框
            obj3          = pos [f].objfrist;   //第一个旗子
            obj4          = pos [f].objsconde;  //第二个旗子
            IsfalseOrtrue = pos [f].BlackOrRed; //现在红色还是黑色
            GameObject o1, o2, o3, o4;
            bool       IstrueOrfalse;
            if (obj4 != null)              //最后一步等于吃子
            {
                obj3.transform.parent        = obj1.transform;
                obj4.transform.parent        = obj2.transform;
                obj3.transform.localPosition = Vector3.zero;
                obj4.transform.localPosition = Vector3.zero;
                board.chess [pos [f].From.y, pos [f].From.x] = oneID;
                board.chess [pos [f].To.y, pos [f].To.x]     = twoID;
            }
            else
            {
                obj3.transform.parent        = obj1.transform;
                obj3.transform.localPosition = Vector3.zero;
                board.chess [pos [f].From.y, pos [f].From.x] = oneID;
                board.chess [pos [f].To.y, pos [f].To.x]     = 0;
            }
            if (blackclick.ChessMove == false)
            {
                blackclick.str       = "红方走";
                blackclick.ChessMove = true;
            }
            else
            {
                blackclick.ChessMove = false;
                blackclick.str       = "黑方走";
            } Count -= 1;
            blackclick.TrueOrFalse = true;            //在将帅被吃了的情况下 给他能走棋
            KingPosition.JiangJunCheck();
        }
        else
        {
            print("return");
            return;
        }
    }