コード例 #1
0
        private void CreateObjectiveFrame()
        {
            holderFrame    = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center));
            objectiveFrame = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ObjectiveAnchor, holderFrame.RectTransform), style: null);

            for (int i = 0; i < activeObjectives.Count; i++)
            {
                CreateObjectiveGUI(activeObjectives[i], i, activeObjectives[i].ContentType);
            }

            screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
            prevUIScale      = GUI.Scale;
        }
コード例 #2
0
        void InitProjSpecific()
        {
            var buttonContainer = new GUILayoutGroup(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ButtonAreaTop, inGameHUD.RectTransform),
                                                     isHorizontal: true, childAnchor: Anchor.CenterRight)
            {
                CanBeFocused = false
            };

            var endRoundButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.6f), buttonContainer.RectTransform)
            {
                MinSize = new Point(150, 0)
            },
                                               TextManager.Get("EndRound"))
            {
                OnClicked = (btn, userdata) => { EndGame(); return(true); }
            };

            showLogButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.6f), buttonContainer.RectTransform)
            {
                MinSize = new Point(150, 0)
            },
                                          TextManager.Get("ServerLog"))
            {
                OnClicked = (GUIButton button, object userData) =>
                {
                    if (ServerLog.LogFrame == null)
                    {
                        ServerLog.CreateLogFrame();
                    }
                    else
                    {
                        ServerLog.LogFrame = null;
                        GUI.KeyboardDispatcher.Subscriber = null;
                    }
                    return(true);
                }
            };

            GUIButton settingsButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.6f), buttonContainer.RectTransform)
            {
                MinSize = new Point(150, 0)
            },
                                                     TextManager.Get("ServerSettingsButton"))
            {
                OnClicked = ToggleSettingsFrame,
                UserData  = "settingsButton"
            };
        }