コード例 #1
0
ファイル: testUI.cs プロジェクト: nanami-hitomi/yaritakunai
        public static UIWindow 作る(Vector2 場所, bool tickedUp = false, bool visible = true)
        {
            HorizontalGroupBox gb = new HorizontalGroupBox(5, 8);

            gb.Add(new UIText("the fox says:"));
            gb.Add(new Textbox(50));
            gb.Add(new KeyInputBox(Keys.ImeNoConvert));
            gb.Add(new Textbox(50));
            gb.Add(new Button("button in horizontal box"));
            gb.Add(new Itembox(new Item(1), true));
            uint windowButtons = (uint)windowTopButtons.titlebar | (uint)windowTopButtons.tickDown | (uint)windowTopButtons.removeToParent | (uint)windowTopButtons.close;
            var  window        = new UIWindow(場所, "test", 5, 8, windowButtons)
            {
                new KeyInputBox(Input.arrange.jump, delegate(object key) { Input.arrange.jump = (Keys)key; }),
                new Textbox(150, "ナデシコ", "お名前は"),
                new Textbox(150, "ナデシコ", "お名前は"),
                new Button("Button", delegate
                {
                    Console.WriteLine("button pressed");
                }),
                gb,
                new Itembox(new Item(0)),
            };

            window.Add(new Button("toggle window titlebar", delegate
            {
                window.windowButtons ^= windowButtons;
            }));
            window.Visible  = visible;
            window.tickedUp = tickedUp;
            return(window);
        }
コード例 #2
0
        public static UIWindow 作る(Vector2 場所, bool tickedUp = false, bool visible = true)
        {
            Textbox nameBox      = new Textbox(100, "", Locale.getTRFromKey("PlayerCreate::NamePrompt"));
            Button  submitButton = new Button(Locale.getTRFromKey("Game::Create"), delegate
            {
                Main.refmain.setPlayer(new Player(nameBox.text, new PlayerControllers.PlayerInputController(), Vector2.Zero));
                Transitions.SetupAndBegin(Main.refmain.GraphicsDevice, Main.refmain, Transitions.Fade, screens.characterCreate, screens.mainGame);
            });
            Button returnButton = new Button(Locale.getTRFromKey("Game::Back"), delegate
            {
                Transitions.SetupAndBegin(Main.refmain.GraphicsDevice, Main.refmain, Transitions.Fade, screens.characterCreate, screens.characterSelect);
            });
            HorizontalGroupBox hbox = new HorizontalGroupBox(5, 8);

            hbox.Add(submitButton, returnButton);
            UIWindow window = new UIWindow(場所, "player creation", 5, 8, 0)
            {
                new UIText(Locale.getTRFromKey("PlayerCreate::InlineNamePrompt")),
                nameBox,
                hbox
            };


            return(window);
        }
コード例 #3
0
ファイル: CheatUI.cs プロジェクト: nanami-hitomi/yaritakunai
        public static UIWindow 作る(Vector2 場所, bool tickedUp = false, bool visible = true)
        {
            Textbox            xBox   = new Textbox(30, "0");
            Textbox            yBox   = new Textbox(30, "0");
            HorizontalGroupBox locBox = new HorizontalGroupBox(0, 0);

            locBox.Add(new UIText("X:"));
            locBox.Add(xBox);
            locBox.Add(new UIText("Y:"));
            locBox.Add(yBox);
            Textbox itemIDBox    = new Textbox(30, "0");
            Button  spawnNewItem = new Button("Spawn an item", delegate(EventArgs e)
            {
                tryToSpawnItem(itemIDBox.text, xBox.text, yBox.text);
            });
            Itembox spawnedItemBox = new Itembox((Item)null, true);
            Button  boxItemSpawner = new Button("Box item", delegate(EventArgs e)
            {
                spawnedItemBox.itemHolder.held = tryToParseItem(itemIDBox.text);
            });
            UIWindow window = new UIWindow(場所, "cheats", 5, 8, (uint)windowTopButtons.titlebar | (uint)windowTopButtons.tickDown | (uint)windowTopButtons.close)
            {
                new UIText("Coordinates:"),
                locBox,
                new UIText("Item ID:"),
                itemIDBox,
                spawnNewItem,
                spawnedItemBox,
                boxItemSpawner
            };

            window.Visible  = visible;
            window.tickedUp = tickedUp;
            return(window);
        }
コード例 #4
0
        public static UIWindow 作る(Vector2 場所, bool tickedUp = false, bool visible = true)
        {
            UIWindow  window        = new UIWindow(場所, "inventory", 5, 8, (uint)windowTopButtons.titlebar | (uint)windowTopButtons.tickDown);
            const int inventoryRows = 5;
            const int slotsInRow    = Player.inventorySlots / inventoryRows;

            for (int i = 0; i < inventoryRows; i++)
            {
                HorizontalGroupBox row = new HorizontalGroupBox(8, 0);
                for (int j = 0; j < slotsInRow; j++)
                {
                    Itembox box = new Itembox((Item)null, true);
                    int     loc = slotsInRow * i + j;
                    Main.refmain.localPlayerLoaded += delegate { box.itemHolder = Main.currentPlayer.inventory[loc]; };
                    row.Add(box);
                }
                window.Add(row);
            }

            window.Visible  = visible;
            window.tickedUp = tickedUp;
            return(window);
        }