Ejemplo n.º 1
0
        static void Postfix(MultiplayerScoreProvider __instance)
        {
            if (Instance == null)
            {
#if DEBUG
                Logger.Log("Got MultiplayerScoreProvider", LogLevel.Notice);
#endif
                Instance = __instance;
            }
        }
Ejemplo n.º 2
0
        void OnGUI()
        {
            if (MultiplayerSession.connectedPlayers != null && Config.DisplayMultiPlayerNameInfo)
            {
                foreach (IConnectedPlayer connectedPlayer in MultiplayerSession.connectedPlayers)
                {
                    if (Config.MultiPlayerNumber - 1 == connectedPlayer.sortIndex)
                    {
                        int size    = 0;
                        var offsetY = Screen.height / 2;

                        GUI.skin.label.fontSize = Config.screenWidth / 8;
                        size = GUI.skin.label.fontSize + 15;

                        GUI.Label(new Rect(Config.screenPosX, Screen.height - Config.screenPosY - Config.screenHeight, Config.screenWidth, GUI.skin.label.fontSize + 15), connectedPlayer.userName);

                        if (SceneManager.GetActiveScene().name == "GameCore" && MultiplayerSession.ConnectedMultiplay)
                        {
                            if (ScoreProvider == null)
                            {
                                ScoreProvider = Resources.FindObjectsOfTypeAll <MultiplayerScoreProvider>().FirstOrDefault();
                            }

                            foreach (MultiplayerScoreProvider.RankedPlayer rankedPlayer in ScoreProvider.rankedPlayers)
                            {
                                if (rankedPlayer.userId == connectedPlayer.userId)
                                {
                                    GUI.skin.label.fontSize = 30;
                                    GUI.Label(new Rect(Config.screenPosX, Screen.height - Config.screenPosY - Config.screenHeight + size + 45, Config.screenWidth, 40), String.Format("{0:#,0}", rankedPlayer.score));
                                    GUI.Label(new Rect(Config.screenPosX, Screen.height - Config.screenPosY - Config.screenHeight + size + 5, Config.screenWidth, 40), "Rank " + ScoreProvider.GetPositionOfPlayer(connectedPlayer.userId).ToString());
                                    break;
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }