Beispiel #1
0
    void ConnectGUI()
    {
        GUILayout.BeginArea(new Rect(100, 50, Screen.width - 200, Screen.height - 100));
        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Player Name: ");
        localPlayerName = GUILayout.TextField(localPlayerName, 40);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Server Address: ");
        hostAddress = GUILayout.TextField(hostAddress, 40);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Server port: ");
        hostPort = GUILayout.TextField(hostPort, 40);
        GUILayout.EndHorizontal();

        if (GUILayout.Button("Connect"))
        {
            comSat.Connect(hostAddress, System.Convert.ToInt32(hostPort));
            SaveSettngs();
        }
        if (GUILayout.Button("Host"))
        {
            comSat.Host(System.Convert.ToInt32(hostPort));
            SaveSettngs();
        }

        StateDumpButton();
        TraceButton();
        GameSpeedButtons();

        // Game options.
        scrollMode = GUILayout.Toggle(scrollMode == 1 ? true : false, "Camera Scroll Mode") ? 1 : 0;
        PlayerPrefs.SetInt("Scroll Mode", scrollMode);

        if (System.IO.Directory.Exists("Replays"))
        {
            replayListScrollPosition = GUILayout.BeginScrollView(replayListScrollPosition);
            foreach (var replay in System.IO.Directory.GetFiles("Replays", "*.replay"))
            {
                if (GUILayout.Button(replay))
                {
                    comSat.PlayReplay(replay);
                }
            }
            GUILayout.EndScrollView();
        }

        GUILayout.EndVertical();
        GUILayout.EndArea();
    }