Esempio n. 1
0
    public void OnGameNotifyPlayerGameSceneInfo(byte[] pBuf)
    {
        GameProto.GameNotifyPlayerGameSceneInfo oRet = GameProto.GameNotifyPlayerGameSceneInfo.Parser.ParseFrom(pBuf);
        if (oRet == null)
        {
            SampleDebuger.LogYellow("OnGameNotifyPlayerGameSceneInfo error parse");
            return;
        }

        SampleDebuger.LogBlue("game scene state : " + oRet.State.ToString());

        for (int i = 0; i < oRet.Players.Count; i++)
        {
            if (oRet.Players[i].QwPlayerId != 0)
            {
                SampleDebuger.LogBlue(string.Format("game scene info : [{0}, {1}, {2}, {3}]",
                                                    oRet.Players[i].QwPlayerId.ToString(), oRet.Players[i].SzNickName, oRet.Players[i].SzAvatar, oRet.Players[i].DwSex.ToString()));

                GameData.Instance().SetSlotId((uint)i, oRet.Players[i].QwPlayerId);
                GameData.Instance().SetRoleDate(oRet.Players[i].QwPlayerId, oRet.Players[i]);

                TetrisDataManager.Instance().SetPlayer(oRet.Players[i].QwPlayerId);
            }
        }

        if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != SysUtil.GetScesneNameBySceneState(oRet.State))
        {
            AssetBundleLoader.Instance().LoadLevelAsset(SysUtil.GetScesneNameBySceneState(oRet.State), delegate()
            {
                SampleDebuger.LogBlue("scene info load level : " + SysUtil.GetScesneNameBySceneState(oRet.State));
            }
                                                        );
        }
    }
Esempio n. 2
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);
    }