Exemple #1
0
 public void StoneSet_GetData(OmSendDataFormat data)
 {
     _NowTargetPos_X = int.Parse(data.setblockx);
     _NowTargetPos_Y = int.Parse(data.setblocky);
     _GameMng.UseStone().InitOm(!_GameMng.ImBlack(), _NowTargetPos_X, _NowTargetPos_Y);
     _Board[_NowTargetPos_Y, _NowTargetPos_X] = _GameMng.GetEnemyBlockNumber();
     _GameMng.TurnChange();
     _SoundMng.EffectSoundPlay("setstone");
     _ClientMng.SendDataToServer("getdataoknormal");
     _SpareStoneCount_Enemy--;
 }
Exemple #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;
         }
     }
 }
Exemple #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");
                }
            }
        }
    }