示例#1
0
        public ModalDecisionState(string title, string text)
            : base(title)
        {
            GuiLabel Text = new GuiLabel(10, 10, text, (int)Window.ContentsBounds.width - 20, (int)Window.Height - 20 - 70);

            Text.TextAlign = TextAnchor.MiddleCenter;
            Text.WordWrap  = true;

            GuiButton YesButton = new GuiButton("Yes", 120, 30);

            YesButton.OnMouseClicked += delegate {
                Result = true;
                Close();
                doYes();
            };

            GuiButton NoButton = new GuiButton("No", 120, 30);

            NoButton.OnMouseClicked += delegate {
                Result = false;
                Close();
                doNo();
            };

            Window.Add(Text);
            Window.Add(YesButton, -20, -20);
            Window.Add(NoButton, 20, -20);
        }
        public OverlayEconomyState()
        {
            // Add the end turn button
            buttonEndTurn = GuiButton.createButtonWithLabel(MaxOfEmpires.overlayPos.ToPoint(), "End turn", null, "font");
            addElement(buttonEndTurn);

            // Add a label showing whose turn it currently is
            labelCurrentPlayer = GuiLabel.createNewLabel(new Vector2(buttonEndTurn.Bounds.Right + 2, buttonEndTurn.Bounds.Top + 2), "Current player: ", "font");
            addElement(labelCurrentPlayer);

            // Add a label telling the player how much money they have
            labelPlayerMoney = GuiLabel.createNewLabel(new Vector2(labelCurrentPlayer.Bounds.Left, labelCurrentPlayer.Bounds.Bottom + 5), "Money: 0G", "font");
            addElement(labelPlayerMoney);

            labelPlayerMoneyPerTurn = GuiLabel.createNewLabel(new Vector2(labelCurrentPlayer.Bounds.Left, labelPlayerMoney.Bounds.Bottom + 5), "Money per turn: 0G", "font");
            addElement(labelPlayerMoneyPerTurn);

            // Add a label telling the player how much population they have
            labelPlayerPopulation = GuiLabel.createNewLabel(new Vector2(labelCurrentPlayer.Bounds.Left, labelPlayerMoneyPerTurn.Bounds.Bottom + 5), "Free Population: 0", "font");
            addElement(labelPlayerPopulation);

            // Add labels for unit stats
            listArmySoldiers = GuiList.createNewList(new Point(labelPlayerMoneyPerTurn.Bounds.Location.X, labelPlayerPopulation.Bounds.Bottom + 5), 5, new List <GuiElement>(), 300);
            listArmySoldiers.addElement(ElementArmySelection.CreateBuildButton(Point.Zero, "1", null, null)); // Add this so that the size is calculated correctly
            addElement(listArmySoldiers);

            buildingInfoPosition = new Point(buttonEndTurn.Bounds.Left, listArmySoldiers.Bounds.Bottom + listArmySoldiers.MaxHeight + 5);

            // Remove this label so that it doesn't display bullshit :)
            listArmySoldiers.removeElement(0);
        }
示例#3
0
        public BankState() : base("Bank")
        {
            GoldTransfer = new GuiGold();

            MainWindow.Width  = 600;
            MainWindow.Height = 450;

            BankGoldLabel = new GuiLabel(0, 0, "Gold:");
            MainWindow.Add(BankGoldLabel, 20, 20);

            BankGoldValueLabel = new GuiLabel(0, 0, "");
            BankGoldValueLabel.DragDropEnabled = true;
            BankGoldValueLabel.ForceContent(GoldTransfer);
            MainWindow.Add(BankGoldValueLabel, 100, 20);

            InHandGoldLabel = new GuiLabel(0, 0, "In Hand:");
            MainWindow.Add(InHandGoldLabel, 20, 50);

            InHandGoldValueLabel = new GuiLabel(0, 0, "");
            MainWindow.Add(InHandGoldValueLabel, 100, 50);

            DepositButton = new GuiButton("Deposit");
            MainWindow.Add(DepositButton, 20, 80);

            Inventory = new GuiItemInventory(300, 330);
            MainWindow.Add(Inventory, 200, 10);

            DepositButton.OnMouseClicked += delegate {
                Character.GoldInBank += Character.GoldInHand;
                Character.GoldInHand  = 0;
            };

            RepositionControls();
        }
示例#4
0
        private void Initialize()
        {
            buttonCreate = new GuiButton()
            {
                Size = new Vector2(130, 10), Location = new Vector2(0, 10), Text = "New Game"
            };
            buttonCreate.OnClick += new EventHandler <EventArgs>(button_OnClick);
            AddControl(buttonCreate);

            GuiPanel panel = new GuiPanel()
            {
                Size = new Vector2(110, 10), Location = new Vector2(20, 30)
            };

            label = new GuiLabel()
            {
                Size = new Vector2(0, 0), Location = new Vector2(0, 0), Center = true, Text = "", Color = new Vector4(0.7f, 0.7f, 0.7f, 1)
            };
            panel.AddControl(label);
            AddControl(panel);
            buttonGenerator = new GuiButton()
            {
                Size = new Vector2(10, 10), Location = new Vector2(0, 30), Text = "="
            };
            buttonGenerator.OnClick += new EventHandler <EventArgs>(buttonGenerator_OnClick);
            AddControl(buttonGenerator);

            DataBind();
        }
示例#5
0
        /** Creates a new notification with given text and optional graphic */
        public GuiNotification(string content, Sprite sprite = null) : base(260, 60)
        {
            Stage     = NotificationStage.AnimateOn;
            stageLife = AnimationDuration;
            Color     = new Color(0.2f, 0.2f, 0.2f);

            text            = new GuiLabel(content);
            text.AutoHeight = false;
            text.AutoWidth  = false;
            text.X          = 5;
            text.Y          = 5;
            text.Width      = (int)ContentsBounds.width - 10;
            text.Height     = (int)ContentsBounds.height - 10;
            text.FontSize   = 12;
            text.WordWrap   = true;
            text.TextAlign  = TextAnchor.MiddleLeft;
            Add(text);

            OuterShadow = true;

            if (sprite != null)
            {
                image       = new GuiImage(3, 3, sprite);
                image.Scale = (Height - 10) / sprite.rect.height;
                text.X      = 60;
                text.Width  = (int)ContentsBounds.width - text.X - 5;

                var frame = new GuiFillRect(1, 1, image.Width + 4, image.Height + 4, Color.black.Faded(0.50f));
                Add(frame);
                Add(image);
                var shadow = new GuiFrameRect(3, 3, image.Width, image.Height, Color.black.Faded(0.5f));
                Add(shadow);
            }
        }
示例#6
0
        public GuiStoreListing(GuiStore parentStore, int x, int y, int itemID, int price, int quantity = 1)
            : base(300, 50)
        {
            X = x;
            Y = y;

            this.ItemID = itemID;
            this.Style  = Engine.GetStyleCopy("PanelSquare");
            this.price  = price;
            this.Style.padding.right     = 10;
            this.parentStore             = parentStore;
            this.DisableChildInteraction = true;

            link          = new MDRItemSlot();
            link.Quantity = quantity;

            itemContainer                    = new GuiItemSlot(2, 2, link);
            itemContainer.Locked             = true;
            itemContainer.ShowToolTipOnHover = false;
            Add(itemContainer);

            nameLabel = new GuiLabel(52, 14, "", 220);
            Add(nameLabel);

            coinsAmount = new GuiCoinAmount();
            Add(coinsAmount, -10, -10, true);

            CacheMode = CacheMode.Solid;

            Refresh();
        }
示例#7
0
 private void InitOther()
 {
     fInfo        = new GuiLabel();
     fButtonReset = new GuiLabel()
     {
         BackgroundColor = Color.Orange, Text = "Reset"
     };
 }
        public string GetLabelText(string strControlID)
        {
            GuiSession SapSession = getCurrentSession();
            GuiLabel   label      = (GuiLabel)SapSession.ActiveWindow.FindById(strControlID, "GuiLabelField");

            label.SetFocus();

            return(label.Text);
        }
示例#9
0
 public TextOdo(GuiLabel txtCounter, decimal curValue, String format, decimal minSteps)
     : base("Text-Odo", 0, 0)
 {
     this.txtCounter = txtCounter;
     this.curValue   = curValue;
     this.format     = format;
     this.minSteps   = minSteps;
     almDelay.Enable();
 }
示例#10
0
        public GuiLabel ToLabel(string fontName)
        {
            string display = item.Name;

            if (amount > 1)
            {
                display += " " + amount;
            }
            return(GuiLabel.createNewLabel(Vector2.Zero, display, fontName));
        }
示例#11
0
	// Update is called once per frame
	void Update () {
		if (player == null) {
			player = GameObject.Find ("Player").GetComponent<Rigidbody2D>();
		}
		if (label == null) {
			label = GetComponent<GuiLabel> ();
		}
		changeLabelAlpha ();

	}
示例#12
0
        /// <summary>
        /// Begins loading resources for the game.
        /// </summary>
        /// <param name="handover">object[] { host, port, token }</param>
        public void Load(object handover)
        {
            try
            {
                // Get server info from handover
                object[] inputs = (object[])handover;
                string   host   = (string)inputs[0];
                int      port   = (int)inputs[1];
                int      token  = (int)inputs[2];

                // Load resources required for loading screen
                ContentManager content =
                    GameManager.Content;
                LoadingScreen =
                    content.Load <Texture2D>("Backgrounds/title_screen");
                StatusLabel = new GuiLabel(
                    16, 16, "Loading",
                    content.Load <SpriteFont>("Fonts/Arial14"),
                    Color.White
                    );

                // Instantiate network handler
                NetworkHandler = new GameNetworkHandler();

                // Begin asynchronously loading game resources, connecting
                // to server.
                LoadTask    = Task.Run(() => LoadGameResources());
                ConnectTask = Task.Run(() =>
                {
                    try
                    {
                        NetworkManager.Connect(
                            host, port, token, NetworkHandler
                            );
                    }
                    catch (Exception e)
                    {
                        Trace.WriteLine("Exception in LoadGameScene.Load:");
                        Trace.WriteLine(e.ToString());

                        // Goto error scene.
                        SceneManager.GotoScene <ErrorScene>();
                    }
                });
            }
            catch (Exception e)
            {
                Trace.WriteLine("Exception in LoadGameScene.Load():");
                Trace.WriteLine(e.ToString());

                // Goto error scene.
                SceneManager.GotoScene <ErrorScene>();
            }
        }
示例#13
0
 void OnLocalize()
 {
     if (_label == null)
     {
         _label = GetComponent <GuiLabel> ();
     }
     if (!string.IsNullOrEmpty(_token))
     {
         _label.Text = Localizer.Get(_token);
     }
 }
示例#14
0
            public static List <GuiElement> GetNewGuiPanel(
                Plugin plugin,
                string name,
                Rectangle rectangle,
                GuiElement parent,
                Layer layer,
                GuiColor panelColor = null,
                float FadeIn        = 0,
                float FadeOut       = 0,
                GuiText text        = null,
                string imgName      = null,
                Blur blur           = Blur.none)
            {
                List <GuiElement> elements = new List <GuiElement>();

                Layer higherLayer = layer;

                if (parent != null)
                {
                    higherLayer = (Layer)Math.Min((int)layer, (int)parent.Layer);
                }

                if (string.IsNullOrEmpty(imgName))
                {
                    GuiPlainPanel plainPanel = GuiPlainPanel.GetNewGuiPlainPanel(name, rectangle, parent, layer, panelColor, FadeIn, FadeOut, blur);
                    elements.Add(plainPanel);
                }
                else
                {
                    GuiImage image = GuiImage.GetNewGuiImage(plugin, name, rectangle, imgName, false, parent, layer, panelColor, FadeIn, FadeOut);
                    elements.Add(image);
                }
                if (text != null)
                {
                    text.FadeIn = FadeIn;
                    GuiLabel label = new GuiLabel
                    {
                        Name       = name + "_txt",
                        Rectangle  = new Rectangle(),
                        Layer      = higherLayer,
                        Parent     = name,
                        Text       = text,
                        FadeOut    = FadeOut,
                        Components =
                        {
                            text,
                            new Rectangle()
                        }
                    };
                    elements.Add(label);
                }

                return(elements);
            }
示例#15
0
        public override bool OnLoad()
        {
            // STANDS ALONE.. DOES NOT REF "SharedMedia" Loader
            BMLoader ml = new BMLoader("LoadingLoader");

            ml.LoadFile(Name + ".txt");
            guiManager.Add(ml);
            lblAction = (GuiLabel)guiManager.Get("lbl_action");

            return(true);
        }
示例#16
0
 private void InitOther()
 {
     fMyFpsLabel = new GuiLabel()
     {
         Name                = "FPS",
         Margin              = new GuiThickness(5),
         BackgroundColor     = Color.DarkGreen,
         ForegroundColor     = Color.LightGreen,
         HorizontalAlignment = GuiHorizontalAlignment.Center,
         VerticalAlignment   = GuiVerticalAlignment.Center
     };
 }
 static void OnDrawRootGizmo(GuiLabel lbl, GizmoType gizmoType)
 {
     if (lbl.IsVisible)
     {
         var tr       = lbl.transform;
         var oldColor = Gizmos.color;
         var oldMat   = Gizmos.matrix;
         Gizmos.matrix = Matrix4x4.TRS(tr.position, tr.rotation, tr.lossyScale);
         Gizmos.color  = (gizmoType & GizmoType.InSelectionHierarchy) != 0 ? Color.yellow : new Color(0.5f, 0.5f, 0f);
         Gizmos.DrawWireCube(Vector3.zero, new Vector3(lbl.Width, lbl.Height, 0f));
         Gizmos.matrix = oldMat;
         Gizmos.color  = oldColor;
     }
 }
示例#18
0
        /// <summary>
        /// Loads error message screen.
        /// </summary>
        /// <param name="handover">null</param>
        public void Load(object handover)
        {
            // Load resources required for loading screen
            ContentManager content =
                GameManager.Content;

            LoadingScreen =
                content.Load <Texture2D>("Backgrounds/title_screen");
            StatusLabel = new GuiLabel(
                16, 16, "Unexpected error occurred.",
                content.Load <SpriteFont>("Fonts/Arial14"),
                Color.White
                );
        }
示例#19
0
        public OverlayEconomyState()
        {
            // Add the end turn button
            buttonEndTurn = GuiButton.createButtonWithLabel(new Point((int)MaxOfEmpires.OverlayPos.X + 20, 10), "End turn", null, "font");
            addElement(buttonEndTurn);

            // Add a label showing whose turn it currently is
            labelCurrentPlayer = GuiLabel.createNewLabel(new Vector2(buttonEndTurn.Bounds.Right + 2, buttonEndTurn.Bounds.Top + 2), "Current player: ", "font");
            addElement(labelCurrentPlayer);

            // Add labels for unit stats
            listArmySoldiers = GuiList.createNewList(new Point(buttonEndTurn.Bounds.Location.X, labelCurrentPlayer.Bounds.Bottom + 5), 5, new System.Collections.Generic.List <GuiLabel>(), 300);

            addElement(listArmySoldiers);
        }
示例#20
0
            public GuiLabel addText(string name, Rectangle rectangle, GuiElement Parent, Layer layer, GuiText text = null, float FadeIn = 0, float FadeOut = 0)
            {
                if (string.IsNullOrEmpty(name))
                {
                    name = "text";
                }

                purgeDuplicates(name);

                GuiLabel label = GuiLabel.GetNewGuiLabel(name, rectangle, Parent, layer, text, FadeIn, FadeOut);

                Add(label);

                return(label);
            }
示例#21
0
文件: Engine.cs 项目: bsimser/CoM
    private void InitializeComponents()
    {
        if (ComponentsInitialized)
        {
            return;
        }

        FPSLabel           = new GuiSolidLabel(0, 0, "FPS:");
        FPSLabel.Color     = new Color(0f, 0f, 0f, 1f);
        FPSLabel.FontColor = Color.white;
        FPSLabel.FontSize  = 14;

        SetupLogWindow();

        ComponentsInitialized = true;
    }
示例#22
0
        public GuiSellItemArea(int width, int height, MDRStore sourceStore) : base(width, height)
        {
            EnableBackground = false;
            Store            = sourceStore;

            ItemSlot = new GuiInspectionSlot();
            Add(ItemSlot, 0, 50);
            ItemSlot.Visible = false;

            dropHint           = new GuiLabel("Drop Here");
            dropHint.FontSize  = 24;
            dropHint.FontColor = new Color(0.9f, 0.9f, 0.9f, 0.9f);
            Add(dropHint, 0, 0);

            createButons();
        }
    void Start()        // Use this for initialization
    // displays a text in the inventory section
    {
        mTextControllerGO = GameObject.Find("TextController");
        mShowTextScript   = mTextControllerGO.GetComponent <ShowText>();

        mGuiBoxScript = mTextControllerGO.GetComponent <GuiBox> ();

        // displays a gui box which can be set visible or invisible
        mGuiBoxGO     = GameObject.Find("TextController");
        mGuiBoxScript = mGuiBoxGO.GetComponent <GuiBox> ();

        // displays a debug console text line in the left upper corner
        mGuiLabelGO     = GameObject.Find("TextController");
        mGuiLabelScript = mGuiLabelGO.GetComponent <GuiLabel> ();


        mObject0 = GameObject.Find("BierflascheVoll");
        mObject0.SetActive(false);


        mObject1 = GameObject.Find("coins");
        mObject1.SetActive(false);


        mObject2 = GameObject.Find("Ausweis");
        mObject2.SetActive(false);


        mObject3 = GameObject.Find("Handschuhe");
        mObject3.SetActive(false);

        print("AndroidCommunicationController class started");



        // SendFullNameToUnity ("##TestFullName");


        // code for java connection
        //AndroidJNIHelper.debug = true;
        //AndroidJavaClass jc = new AndroidJavaClass("com.works.forme");

        //AndroidJavaObject jo = new AndroidJavaObject ("com.works.forme.BlankFragment");
        //jo.CallStatic ("showAd");
    }
示例#24
0
 private void InitOther()
 {
     fMyLabel1 = new GuiLabel()
     {
         Name            = "My Label 1",
         BackgroundColor = Color.LightPink,
         Text            = "XXX",
         Margin          = new GuiThickness(0),
     };
     fMyLabel2 = new GuiLabel()
     {
         Name            = "My Label 2",
         BackgroundColor = Color.LightPink,
         Text            = "XXX",
         Margin          = new GuiThickness(0),
     };
     fMyBox1 = new GuiBox()
     {
         Name            = "My Box 1",
         Width           = 20,
         Height          = 20,
         Margin          = new GuiThickness(3),
         BackgroundColor = Color.White
     };
     fMyBox2 = new GuiBox()
     {
         Name            = "My Box 2",
         Width           = 20,
         Height          = 20,
         Margin          = new GuiThickness(3),
         BackgroundColor = Color.White
     };
     fMyBoxes = new List <GuiCanvasChild>();
     for (int i = 0; i < 50; i++)
     {
         fMyBoxes.Add(new GuiCanvasChild()
         {
             X       = 0,
             Y       = 0,
             Control = new GuiBox()
             {
                 Width = 10, Height = 10, BackgroundColor = Color.FloralWhite
             }
         });
     }
 }
示例#25
0
        public MyWindow(GuiScreen parent)
            : base(parent)
        {
            Width  = 300;
            Height = 200;

            Controls.Add(new MyPanel(Skin)
            {
                Text = "My Panel", HorizontalTextAlignment = HorizontalAlignment.Right
            });

            var button = new GuiButton(Skin)
            {
                Width             = 100,
                Height            = 32,
                Text              = "Yay",
                VerticalAlignment = VerticalAlignment.Bottom
            };

            Controls.Add(button);

            Controls.Add(new GuiStackPanel(Skin)
            {
                Controls =
                {
                    new GuiLabel(Skin,           "propertyName"),
                    new GuiStackPanel
                    {
                        HorizontalAlignment = HorizontalAlignment.Centre,
                        VerticalAlignment   = VerticalAlignment.Centre,
                        Orientation         = GuiOrientation.Horizontal,
                        Controls            =
                        {
                            new GuiLabel(Skin,   "propertyName"),
                            new GuiTextBox(Skin, "Hello"),
                            new GuiTextBox(Skin, "World")
                        }
                    }
                }
            });

            var label = new GuiLabel(Skin, "This is just a boring dialog.");

            Controls.Add(label);
        }
示例#26
0
        public override void Show()
        {
            base.Show();

            var guiLayer = new GuiLayer(GraphicsDevice, Game.Camera);

            Layers.Add(guiLayer);

            var guiButtonRegion = AssetManager.Load <Texture>("play-button.png").ToTextureRegion();
            var guiButton       = new GuiButton(guiButtonRegion)
            {
                Position = new Vector2(400, 240)
            };

            guiLayer.Controls.Add(guiButton);
            _mouseCursor = guiButton;

            var font     = AssetManager.Load("courier-new-32.fnt", new BitmapFontLoader());
            var guiLabel = new GuiLabel(font)
            {
                Text = "This is a label",
                HorizontalAlignment = HorizontalAlignment.Left,
                Position            = new Vector2(100, 100),
                TextColor           = Color.Black
            };

            guiLayer.Controls.Add(guiLabel);

            var guiImageTexture = AssetManager.Load <Texture>("photo.png");
            var guiImage        = new GuiImage(guiImageTexture)
            {
                Position = new Vector2(800, 0),
                Origin   = new Vector2(1.0f, 0.0f)
            };

            guiLayer.Controls.Add(guiImage);

            var guiCheckboxTexture = AssetManager.Load <Texture>("play-button.png");
            var guiCheckbox        = new GuiCheckbox(guiCheckboxTexture.ToTextureRegion())
            {
                Position = new Vector2(500, 100),
            };

            guiLayer.Controls.Add(guiCheckbox);
        }
示例#27
0
        public TerrainGenerator()
        {
            gui = new Gui();

            addLabel = gui.AddLabel(new Vector2(100, 50), "Generator Add: " + GameSettings.GeneratorAdd.ToString());
            gui.AddSlider(new Vector2(100, 100), 300.0f, 1.0f, 100.0f, (float)GameSettings.GeneratorAdd, GeneratorAdd);
            subLabel = gui.AddLabel(new Vector2(100, 150), "Generator Sub: " + GameSettings.GeneratorSub.ToString());
            gui.AddSlider(new Vector2(100, 200), 300.0f, 0.05f, 20.0f, (float)GameSettings.GeneratorSub, GeneratorSub);

            freq1Label = gui.AddLabel(new Vector2(100, 250), "Freq1: " + freq1.ToString());
            gui.AddSlider(new Vector2(100, 300), 300.0f, 0.0f, 20.0f, freq1, Freq1);

            freq2Label = gui.AddLabel(new Vector2(100, 350), "Freq2: " + freq2.ToString());
            gui.AddSlider(new Vector2(100, 400), 300.0f, 0.0f, 20.0f, freq2, Freq2);

            freq3Label = gui.AddLabel(new Vector2(100, 450), "Freq3: " + freq3.ToString());
            gui.AddSlider(new Vector2(100, 500), 300.0f, 0.0f, 20.0f, freq3, Freq3);
        }
示例#28
0
        /// <summary>
        /// Begins loading resources for the game.
        /// </summary>
        /// <param name="handover">NetworkHandler</param>
        public void Load(object handover)
        {
            // Load resources required for loading screen
            ContentManager content =
                GameManager.Content;

            LoadingScreen =
                content.Load <Texture2D>("Backgrounds/title_screen");
            StatusLabel = new GuiLabel(
                16, 16, "Waiting for players",
                content.Load <SpriteFont>("Fonts/Arial14"),
                Color.White
                );

            // Send client is ready message.
            NetworkHandler = (GameNetworkHandler)handover;
            NetworkHandler.SendMessage(PacketWriter.ClientIsReady());
        }
示例#29
0
        public string GetLabelText(string MainWindowName, string DialogBoxName1, string DialogBoxName2, string strControlID)
        {
            AutomationElement desktop    = AutomationElement.RootElement;
            AutomationElement MainWindow = desktop.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, MainWindowName));

            if (DialogBoxName1 != "")
            {
                AutomationElement DialogBox1 = MainWindow.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, DialogBoxName1));
                if (DialogBoxName1 != "")
                {
                    AutomationElement DialogBox2 = DialogBox1.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, DialogBoxName2));
                    DialogBox2.SetFocus();
                }
                else
                {
                    DialogBox1.SetFocus();
                }
            }
            else
            {
                MainWindow.SetFocus();
            }

            GuiSession SapSession = getCurrentSession(MainWindowName);

            SapSession.SaveAsUnicode = true;
            var chld = SapSession.Children;

            for (int i = 0; i < chld.Count; i++)
            {
                Debug.Print((((GuiMainWindow)chld.Item(i)).Text));
            }

            GuiLabel label = (GuiLabel)SapSession.ActiveWindow.FindById(strControlID, "GuiLabelField");

            label.SetFocus();
            string strLabelText = label.Text;

            MainWindow = null;
            desktop    = null;
            GC.Collect();

            return(strLabelText);
        }
示例#30
0
        // todo: this has all kinds of problems with auto sizing
        public ModalNotificaionState(string title, string text, TextAnchor textAlignment = TextAnchor.MiddleCenter, int width = 400)
            : base(title)
        {
            Window.Width = width;
            GuiLabel Text = new GuiLabel("", (int)Window.ContentsBounds.width - 20);

            Text.WordWrap  = true;
            Text.TextAlign = textAlignment;
            Text.Caption   = text;

            Window.Height = Text.Height + 20 + 45 + 30;

            // Create scroll box for really large messages.
            if (Window.Height > width * 0.75f)
            {
                Text.Width    = width - 60;              // make room for scroller
                Window.Height = (int)(width * 0.75f);
                var scrollBox = new GuiScrollableArea((int)Window.ContentsFrame.width - 10, (int)Window.ContentsFrame.height - 60, ScrollMode.VerticalOnly)
                {
                    X = 10,
                    Y = 10
                };
                scrollBox.ContentsScrollRect.height = Text.Height + 40;
                scrollBox.Add(Text);
                Window.Add(scrollBox);
            }
            else
            {
                Window.Add(Text, 10, 15);
                // this is because sometimes the width estimation is wrong and text wraps incorrently without it.
                Text.Width += 8;
            }

            ConfirmationButton = new GuiButton("OK", 150, 30);
            ConfirmationButton.OnMouseClicked += delegate {
                Close();
            };
            Window.Add(ConfirmationButton, 0, -12);

            DefaultControl = ConfirmationButton;

            PositionComponent(Window, 0, 0);
        }
    private void InitView()
    {
        _view = new GuiView(new Rect(5, 5, 890, 590));

        GuiButton button = new GuiButton(new Rect(0, 0, 110, 20), "刷新资源数据库");

        button.RegisterHandler(RefreshAssets);
        _view.AddChild(button);

        button = new GuiButton(new Rect(340, 2, 16, 16), "?");
        button.RegisterHandler(ShowHelpInfo);
        _view.AddChild(button);

        _searchTextField = new GuiSearchTextField(new Rect(130, 1, 196, 20));
        _searchTextField.OnTextChange(OnSearchTextChange);
        _view.AddChild(_searchTextField);

        _timeLabel = new GuiLabel(new Rect(400, 0, 500, 20), "");
        _view.AddChild(_timeLabel);

        _assetDataSelectedGrid = new GuiSelectionGrid(new Rect(0, 35, 200, 20), new string[] { "资源列表", "无引用资源" }, new Action[] { ShowAllAssets, ShowUnusedAssets });
        _view.AddChild(_assetDataSelectedGrid);

        _dependenceSelectedGrid = new GuiSelectionGrid(new Rect(345, 35, 200, 20), new string[] { "资源依赖项", "反向引用" }, new Action[] { ShowDependencies, ShowRedependencies });
        _view.AddChild(_dependenceSelectedGrid);

        GuiScrollView scrollView = new GuiScrollView(new Rect(0, 60, 320, 530));

        _view.AddChild(scrollView);

        _assetDatafoldoutTree = new GuiFoldoutTree(new Rect(0, 60, 320, 3000));
        _assetDatafoldoutTree.AttachDrawer(new AssetDatasDrawer(_assetDatafoldoutTree));
        scrollView.AddChild(_assetDatafoldoutTree);

        scrollView = new GuiScrollView(new Rect(340, 60, 550, 530));
        _view.AddChild(scrollView);

        _dependencefoldoutTree = new GuiFoldoutTree(new Rect(340, 60, 320, 3000));
        _dependencefoldoutTree.AttachDrawer(new DependenceInfoDrawer(_dependencefoldoutTree));
        scrollView.AddChild(_dependencefoldoutTree);
    }
 static void OnDrawRootGizmo(GuiLabel lbl, GizmoType gizmoType)
 {
     if (lbl.IsVisible) {
         var tr = lbl.transform;
         var oldColor = Gizmos.color;
         var oldMat = Gizmos.matrix;
         Gizmos.matrix = Matrix4x4.TRS (tr.position, tr.rotation, tr.lossyScale);
         Gizmos.color = (gizmoType & GizmoType.InSelectionHierarchy) != 0 ? Color.yellow : new Color (0.5f, 0.5f, 0f);
         Gizmos.DrawWireCube (Vector3.zero, new Vector3 (lbl.Width, lbl.Height, 0f));
         Gizmos.matrix = oldMat;
         Gizmos.color = oldColor;
     }
 }