示例#1
0
 public void SetPlayer(System.UInt64 qwPlayerId)
 {
     if (m_mapTetrisDatas.ContainsKey(qwPlayerId))
     {
         return;
     }
     m_mapTetrisDatas[qwPlayerId] = new TetrisData();
 }
示例#2
0
        public UserOperation(TetrisData data, TetriminoFactory factory, TetrisDifficultySettings difficultySettings, IInput input) : base(data)
        {
            Assert.IsNotNull(factory);
            Assert.IsNotNull(difficultySettings);
            Assert.IsNotNull(input);
            this.factory            = factory;
            this.difficultySettings = difficultySettings;
            this.input = input;

            fieldAnalyzer = new FieldAnalyzer(data.Field);
        }
示例#3
0
    public void OnGameNotifyPlayerGameConfig(byte[] pBuf)
    {
        GameProto.GameNotifyPlayerGameConfig oRet = GameProto.GameNotifyPlayerGameConfig.Parser.ParseFrom(pBuf);
        if (oRet == null)
        {
            SampleDebuger.LogYellow("OnGameNotifyPlayerGameConfig error parse");
            return;
        }

        TetrisData.InitGameConfig(oRet);
    }
示例#4
0
 public void SetTetrisData(TetrisData oData, System.UInt64 qwPlayerId)
 {
     m_oData = oData;
     if (qwPlayerId == PlayerData.Instance().proPlayerId)
     {
         m_goOperator.SetActive(true);
     }
     else
     {
         m_goOperator.SetActive(false);
     }
 }
示例#5
0
    public void OnGameNotifyPlayerGameState(byte[] pBuf)
    {
        GameProto.GameNotifyPlayerGameState oRet = GameProto.GameNotifyPlayerGameState.Parser.ParseFrom(pBuf);
        if (oRet == null)
        {
            SampleDebuger.LogYellow("OnGameNotifyPlayerGameState error parse");
            return;
        }
        SampleDebuger.LogBlue("game state : " + oRet.State.ToString());

        GameData.Instance().SetGameSceneState(oRet.State);

        if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != SysUtil.GetScesneNameBySceneState(oRet.State))
        {
            AssetBundleLoader.Instance().LoadLevelAsset(SysUtil.GetScesneNameBySceneState(oRet.State), delegate()
            {
                SampleDebuger.LogBlue("game state load level : " + SysUtil.GetScesneNameBySceneState(oRet.State));
            }
                                                        );
        }

        switch (oRet.State)
        {
        case GameProto.EGameSceneState.EssNone:
            break;

        case GameProto.EGameSceneState.EssPrepare:
        case GameProto.EGameSceneState.EssGameReady:
        {
        }
        break;

        case GameProto.EGameSceneState.EssGaming:
        {
            ReadyTime.SetGameBegin();
        }
        break;

        case GameProto.EGameSceneState.EssTransact:
        {
        }
        break;

        default:
        {
            SampleDebuger.LogError("error game state : " + ((uint)(oRet.State)).ToString());
        }
        break;
        }

        TetrisData.SetGameSceneState(oRet.State);
    }
示例#6
0
    public void OnGameNotifyPlayerNextTetris(byte[] pBuf)
    {
        GameProto.GameNotifyPlayerNextTetris oRet = GameProto.GameNotifyPlayerNextTetris.Parser.ParseFrom(pBuf);
        if (oRet == null)
        {
            SampleDebuger.LogYellow("GameNotifyPlayerNextTetris error parse");
            return;
        }
        TetrisData pTetrisData = TetrisDataManager.Instance().GetTetrisData(oRet.DwPlayerId);

        if (pTetrisData == null)
        {
            SampleDebuger.LogYellow("can't find tetris data player id : " + oRet.DwPlayerId.ToString());
            return;
        }
        pTetrisData.Sync(oRet);
    }
示例#7
0
    public void OnGameNotifyPlayeRotation(byte[] pBuf)
    {
        GameProto.GameNotifyPlayeRotation oRet = GameProto.GameNotifyPlayeRotation.Parser.ParseFrom(pBuf);
        if (oRet == null)
        {
            SampleDebuger.LogYellow("GameNotifyPlayeRotation error parse");
            return;
        }

        TetrisData pTetrisData = TetrisDataManager.Instance().GetTetrisData(oRet.DwPlayerId);

        if (pTetrisData == null)
        {
            SampleDebuger.LogYellow("can't find tetris data player id : " + oRet.DwPlayerId.ToString());
            return;
        }

        if (!pTetrisData.TetrisOperator(oRet.EDirection))
        {
            SampleDebuger.LogYellow("error rotation : " + oRet.EDirection.ToString());
        }
        SampleDebuger.LogBlue(string.Format("player : {0} rot dir {1}", oRet.DwPlayerId.ToString(), oRet.EDirection.ToString()));
    }
示例#8
0
 public Wait(TetrisData data) : base(data)
 {
 }
示例#9
0
 public GameOver(TetrisData data) : base(data)
 {
 }
示例#10
0
 protected Base(TetrisData data)
 {
     this.data = data;
 }
示例#11
0
 public Ground(TetrisData data, float interval) : base(data)
 {
     this.interval = interval;
 }