コード例 #1
0
    public override void CustomGUI()
    {
        float x = (Screen.width * (5f / 6)) / 2f - _buttonWidth * WekitPlayers.Count / 2;

        for (int i = 0; i < WekitPlayers.Count; i++)
        {
            bool contained = ActiveWekitPlayers.Contains(WekitPlayers[i]);

            if (contained && RecordGUI)
            {
                //Overwrite toggle
                bool inOverwriteList = OverWriteWekitPlayers.Contains(WekitPlayers[i]);
                bool overwrite       =
                    GUI.Toggle(
                        new Rect(x + i * _buttonWidth, Screen.height - (Screen.height / 20f * 5), _buttonWidth,
                                 Screen.height / 20f), inOverwriteList, "Overwrite");
                if (overwrite != inOverwriteList)
                {
                    if (overwrite)
                    {
                        OverWriteWekitPlayers.Add(WekitPlayers[i]);
                    }
                    else
                    {
                        OverWriteWekitPlayers.Remove(WekitPlayers[i]);
                    }
                }

                //Force focus toggle
                bool focus =
                    GUI.Toggle(
                        new Rect(x + i * _buttonWidth, Screen.height - (Screen.height / 20f * 4), _buttonWidth,
                                 Screen.height / 20f), WekitPlayers[i].ForceFocus, "Force focus");
                if (focus != WekitPlayers[i].ForceFocus)
                {
                    WekitPlayers[i].ForceFocus = focus;
                    WekitPlayers[i].SetFocus(true);
                }
                //Step size slider
                WekitPlayers[i].Stepsize = (int)GUI.HorizontalSlider(new Rect(x + i * _buttonWidth, Screen.height - (Screen.height / 20f * 3), _buttonWidth, Screen.height / 20f), WekitPlayers[i].Stepsize, 1, 3);
                if (WekitPlayers[i].HasGui)
                {
                    if (GUI.Button(new Rect(x + i * _buttonWidth, Screen.height - (Screen.height / 20f * 2), _buttonWidth, Screen.height / 20f), WekitPlayers[i].PlayerName + " options"))
                    {
                        _activeGuiIndex = i;
                        SetCustomGuiActive(i, true);
                    }
                }
            }

            //Player active button
            if (!GUI.Button(new Rect(x + i * _buttonWidth, Screen.height - (Screen.height / 20f), _buttonWidth, Screen.height / 20f),
                            WekitPlayers[i].PlayerName + (contained ? " active" : " inactive")))
            {
                continue;
            }

            //(De)activate button pressed
            EnablePlayer(WekitPlayers[i], !contained);
        }
    }