コード例 #1
0
ファイル: BackButton.cs プロジェクト: randomcrab/SE
        public BackButton() : base(Vector2.Zero)
        {
            if (Screen.IsFullHeadless)
            {
                return;
            }

            Button controls = EditorTheme.CreateButton(new Vector2(1760, 910), new Point(150, 70),
                                                       "Hide Controls", Transform, EditorTheme.ColorSet.Blue);

            Button back = EditorTheme.CreateButton(new Vector2(1760, 990), new Point(150, 70),
                                                   "Back to Menu", Transform, EditorTheme.ColorSet.Blue);

            Button disableMultithreading = EditorTheme.CreateButton(new Vector2(1450, 990), new Point(300, 70),
                                                                    "Disable Multi-Threading", Transform, EditorTheme.ColorSet.Blue);

            back.Clicked += (sender, args) => SceneManager.SetCurrentScene("_DEMOS\\menu");
            disableMultithreading.Clicked += (sender, args) => {
                multithreadingToggle             = !multithreadingToggle;
                disableMultithreading.TextString = multithreadingToggle ? "Disable Multi-threading" : "Enable Multi-threading";
            };
            controls.Clicked += (sender, args) => {
                showControls = !showControls;
                back.SetActive(showControls);
                disableMultithreading.SetActive(showControls);
                controls.TextString = showControls ? "Hide Controls" : "Show Controls";
            };
        }
コード例 #2
0
        public MenuUI() : base(Vector2.Zero)
        {
            if (Screen.IsFullHeadless)
            {
                return;
            }

            Button networkTestBtn = EditorTheme.CreateButton(new Vector2(200, 100), new Point(200, 100),
                                                             "Network Test", Transform, EditorTheme.ColorSet.Blue);

            networkTestBtn.Clicked += (sender, args) => SceneManager.SetCurrentScene("_DEMOS\\networktest");
        }
コード例 #3
0
        public NetworkTestMenu() : base(Vector2.Zero)
        {
            if (Screen.IsFullHeadless)
            {
                return;
            }

            notConnectedMenu = new GameObject(Vector2.Zero, 0f, Vector2.One);
            Transform parentTransform = notConnectedMenu.Transform;

            parentTransform.SetParent(Transform);

            Button hostServer = EditorTheme.CreateButton(new Vector2(100, 100), new Point(200, 100),
                                                         "Start server", parentTransform, EditorTheme.ColorSet.Blue);

            spawnButton = EditorTheme.CreateButton(new Vector2(100, 100), new Point(200, 100),
                                                   "Spawn stuff", Transform, EditorTheme.ColorSet.Light);

            Button connect = EditorTheme.CreateButton(new Vector2(100, 400), new Point(200, 100),
                                                      "Connect", parentTransform, EditorTheme.ColorSet.Blue);

            TextInputField addressField = EditorTheme.CreateTextField(new Vector2(310, 100), new Point(200, 40), null, parentTransform);

            addressField.DefocusOnConfirm = false;
            addressField.ClearOnUnfocus   = false;
            addressField.SetValue("127.0.0.1");

            TextInputField portField = EditorTheme.CreateTextField(new Vector2(620, 100), new Point(100, 40), null, parentTransform);

            portField.DefocusOnConfirm = false;
            portField.ConfirmOnEnter   = false;
            portField.ClearOnUnfocus   = false;
            portField.SetValue(Random.Next(1, 25000).ToString());

            spawnButton.Disable();

            addressField.Confirmed += (sender, args) => Network.Connect(addressField.Input.Value, Convert.ToInt32(portField.Input.Value), 919);
            hostServer.Clicked     += (sender, args) => Network.StartServer(919, 920);
            spawnButton.Clicked    += (sender, args) => Game.SpawnStuff();
            connect.Clicked        += (sender, args) => Network.Connect(addressField.Input.Value, Convert.ToInt32(portField.Input.Value), 919);
        }