示例#1
0
    void StoneStoped()
    {
        _TouchBlocking.SetActive(false);
        _Shooted = false;
        _GameMng.CheckStoneOutOfBoard();
        _GameMng.TurnChange();
        _ShootSlotsGroup_My.SetActive(false);
        _ShootLostsGroup_MyArrows.SetActive(false);
        _ShootSlotsGroup_Enemy.SetActive(true);
        _GameMng.EnemyReadyPopupSet_Normal(true);
        _ClientMng.SendDataToServer("stonestoped");

        if (_SpareStoneCount_My == 0 && _SpareStoneCount_Enemy == 0)
        {
            _GameMng.EnemyReadyPopupSet_Change(true);
            ChangeToOmGame();
            _GameMng._NowGameOm = true;
        }
        else if (_WantUseChangeStone_AlGame)
        {
            _GameMng.UseChangeStone();
            _GameMng.EnemyReadyPopupSet_Change(true);
            ChangeToOmGame();
            _GameMng._NowGameOm = true;
        }
        _WantUseChangeStone_AlGame = false;
    }
示例#2
0
 public void StoneSet_MySelf()
 {
     if (_GameMng.IsMyTurn() && _SpareStoneCount != 0)
     {
         if (_Board[_NowTargetPos_Y, _NowTargetPos_X] == 0)
         {
             _SpareStoneCount--;
             _GameMng._TimerOn = false;
             _GameMng.UseStone().InitOm(_GameMng.ImBlack(), _NowTargetPos_X, _NowTargetPos_Y);
             _Board[_NowTargetPos_Y, _NowTargetPos_X] = _GameMng.GetMyBlockNumber();
             OmSendDataFormat data = new OmSendDataFormat(_NowTargetPos_X.ToString(), _NowTargetPos_Y.ToString());
             string           item = JsonUtility.ToJson(data);
             _GameMng.TurnChange();
             _SoundMng.EffectSoundPlay("setstone");
             _GameMng.EnemyReadyPopupSet_Normal(true);
             _ClientMng.SendDataToServer("om" + item);
             WinOrDrawCheck();
             _WantUseChangeStone_OmGame = false;
         }
     }
 }
示例#3
0
    IEnumerator Reading(StringQueue sq)
    {
        while (_On)
        {
            yield return(null);

            string str = "";
            if (!sq.IsEmpty())
            {
                str = sq.getData();

                if (str != "")
                {
                    Debug.Log(str);
                    if (str[0] == '{')
                    {
                        SendDataFormat data = JsonUtility.FromJson <SendDataFormat>(str);
                        if (data.type == "enemyid")
                        {
                            _EnemyId    = data.data;
                            _getEnemyId = true;
                        }
                    }
                    else if (str[0] == 'o' && str[1] == 'm')
                    {
                        string           data = str.Replace("om", "");
                        OmSendDataFormat dd   = JsonUtility.FromJson <OmSendDataFormat>(data);
                        _GameMng._OmGameMng.StoneSet_GetData(dd);
                    }
                    else if (str[0] == 'o' && str[1] == 'c')
                    {
                        string data = str.Replace("oc", "");
                        _GameMng.GameChange_GetData("toom");
                        JsonData item = JsonMapper.ToObject(data);
                        _GameMng._OmGameMng.SetRePosition_OmGame(item);
                    }
                    else if (str[0] == 's' && str[1] == 'h')
                    {
                        _GameMng._AlGameMng.TurnOffEnemySlot(str[2] - '0');
                    }
                    else if (str[0] == 'a' && str[1] == 'l')
                    {
                        string   data = str.Replace("al", "");
                        JsonData item = JsonMapper.ToObject(data);
                        _GameMng._AlGameMng.SetStones_GetData(item);
                    }
                    else if (str[0] == 'a' && str[1] == 's')
                    {
                        string   data = str.Replace("as", "");
                        JsonData item = JsonMapper.ToObject(data);
                        _GameMng._AlGameMng.SetStones_GetData(item);
                    }
                    else if (str[0] == 'c' && str[1] == 'c')
                    {
                        _GameMng.EnemyChangeStoneCountSet(str[2] - '0');
                    }
                    else if (str == "stonestoped")
                    {
                        _GameMng._AlGameMng.TurnChange_GetData();
                    }
                    else if (str == "black" || str == "white")
                    {
                        Matched_GameStart(str);
                    }
                    else if (str == "youlose")
                    {
                        _GameMng._OmGameMng.LoseAfterEffectCheck();
                    }
                    else if (str == "draw")
                    {
                        _GameMng._OmGameMng.LoseAfterEffectCheck();
                    }
                    else if (str == "getdataoknormal")
                    {
                        _GameMng.EnemyReadyPopupSet_Normal(false);
                    }
                    else if (str == "getdataokchange")
                    {
                        _GameMng.EnemyReadyPopupSet_Change(false);
                    }
                    else if (str == "changetoal")
                    {
                        _GameMng.GameChange_GetData("toal");
                    }
                    else if (str == "youwintime")
                    {
                        _SceneMng.OpenWinnerPopup_Time();
                    }
                    else if (str == "youlosetime")
                    {
                        _SceneMng.OpenLoserPopup_Time();
                    }
                    else if (str == "youwindisconnect")
                    {
                        WinThisGame_Disconnect();
                    }
                }
                else
                {
                    SendDataToServer("enemyout");
                    Debug.Log("empty");
                }
            }
        }
    }