예제 #1
0
        private static void TryLabelUpdate()
        {
            if ((seed != null) && (version_label != null))
            {
                int right;
                if (seed_label == null)
                {
                    seed_label = new Game.GUI.Controls.Label(version_label.Manager);
                    seed_label.Init();
                    seed_label.Anchor = Game.GUI.Controls.Anchors.Left | Game.GUI.Controls.Anchors.Bottom;
                    seed_label.Top    = version_label.Top;
                    var default_color = seed_label.TextColor = version_label.TextColor;
                    seed_label.ToolTip = new Game.GUI.Controls.ToolTip(version_label.Manager)
                    {
                        Text = "Create a new world with this Seed."
                    };
                    seed_label.Passive  = false;
                    seed_label.CanFocus = true;

                    /*seed_label.MouseMove += new Game.GUI.Controls.MouseEventHandler((sender, args) =>
                     * {
                     *  (sender as Game.GUI.Controls.Label).TextColor = Microsoft.Xna.Framework.Color.LightGreen;
                     * });*/
                    seed_label.MouseOver += new Game.GUI.Controls.MouseEventHandler((sender, args) =>
                    {
                        (sender as Game.GUI.Controls.Label).TextColor = Microsoft.Xna.Framework.Color.LightGreen;
                    });
                    seed_label.MouseOut += new Game.GUI.Controls.MouseEventHandler((sender, args) =>
                    {
                        (sender as Game.GUI.Controls.Label).TextColor = default_color;
                    });
                    seed_label.Click += new Game.GUI.Controls.EventHandler((sender, args) =>
                    {
                        Game.GnomanEmpire.Instance.GuiManager.MenuStack.PushWindow(
                            new Game.GUI.AdvancedSetupWindow(
                                ((Game.GUI.Controls.Control)sender).Manager, new Game.CreateWorldOptions()
                        {
                            Seed        = last_seed,
                            KingdomName = Game.GnomanEmpire.Instance.World.LanguageManager.RandomFactionName(Game.GnomanEmpire.Instance.World.AIDirector.FactionDefs[0].Language)
                        })
                            );
                    });
                    version_label.Parent.Add(seed_label);
                    right = version_label.Left + version_label.Width;
                    version_label.Text += "; ";
                    version_label.Width = (int)version_label.Skin.Layers[0].Text.Font.Resource.MeasureString(version_label.Text).X + 2;
                }
                else
                {
                    right = seed_label.Left + seed_label.Width;
                }
                seed_label.Text    = seed.ToString();
                seed_label.Width   = (int)seed_label.Skin.Layers[0].Text.Font.Resource.MeasureString(seed_label.Text).X + 2;
                seed_label.Left    = right - seed_label.Width;
                version_label.Left = seed_label.Left - version_label.Width;
                seed          = null;
                version_label = null;
            }
        }
 private static void TryLabelUpdate()
 {
     if ((seed != null) && (version_label != null))
     {
         int right;
         if (seed_label == null)
         {
             seed_label = new Game.GUI.Controls.Label(version_label.Manager);
             seed_label.Init();
             seed_label.Anchor = Game.GUI.Controls.Anchors.Left | Game.GUI.Controls.Anchors.Bottom;
             seed_label.Top = version_label.Top;
             var default_color = seed_label.TextColor = version_label.TextColor;
             seed_label.ToolTip = new Game.GUI.Controls.ToolTip(version_label.Manager) { Text = "Create a new world with this Seed." };
             seed_label.Passive = false;
             seed_label.CanFocus = true;
             /*seed_label.MouseMove += new Game.GUI.Controls.MouseEventHandler((sender, args) =>
             {
                 (sender as Game.GUI.Controls.Label).TextColor = Microsoft.Xna.Framework.Color.LightGreen;
             });*/
             seed_label.MouseOver += new Game.GUI.Controls.MouseEventHandler((sender, args) =>
             {
                 (sender as Game.GUI.Controls.Label).TextColor = Microsoft.Xna.Framework.Color.LightGreen;
             });
             seed_label.MouseOut += new Game.GUI.Controls.MouseEventHandler((sender, args) =>
             {
                 (sender as Game.GUI.Controls.Label).TextColor = default_color;
             });
             seed_label.Click += new Game.GUI.Controls.EventHandler((sender, args) =>
             {
                 Game.GnomanEmpire.Instance.GuiManager.MenuStack.PushWindow(
                     new Game.GUI.AdvancedSetupWindow(
                         ((Game.GUI.Controls.Control)sender).Manager, new Game.CreateWorldOptions() { 
                             Seed = last_seed,
                             KingdomName = Game.GnomanEmpire.Instance.World.LanguageManager.RandomFactionName(Game.GnomanEmpire.Instance.World.AIDirector.FactionDefs[0].Language)
                         })
                     );
             });
             version_label.Parent.Add(seed_label);
             right = version_label.Left + version_label.Width;
             version_label.Text += "; ";
             version_label.Width = (int)version_label.Skin.Layers[0].Text.Font.Resource.MeasureString(version_label.Text).X + 2;
         }
         else
         {
             right = seed_label.Left + seed_label.Width;
         }
         seed_label.Text = seed.ToString();
         seed_label.Width = (int)seed_label.Skin.Layers[0].Text.Font.Resource.MeasureString(seed_label.Text).X + 2;
         seed_label.Left = right - seed_label.Width;
         version_label.Left = seed_label.Left - version_label.Width;
         seed = null;
         version_label = null;
     }
 }
예제 #3
0
 public static void On_GnomanEmpire_PlayGame(GnomanEmpire self)
 {
     lbl = new Game.GUI.Controls.Label(self.GuiManager.Manager);
     lbl.Init();
     lbl.Top    = 200;
     lbl.Left   = 5;
     lbl.Width  = 1000;
     lbl.Height = 100;
     refresh();
     self.GuiManager.Add(lbl);
     btn = new Game.GUI.Controls.Button(self.GuiManager.Manager);
     btn.Init();
     btn.Top    = 300;
     btn.Left   = 5;
     btn.Text   = "Dump";
     btn.Click += new Game.GUI.Controls.EventHandler(btn_Click);
     self.GuiManager.Add(btn);
 }
예제 #4
0
 public static void On_GnomanEmpire_PlayGame(GnomanEmpire self)
 {
     lbl = new Game.GUI.Controls.Label(self.GuiManager.Manager);
     lbl.Init();
     lbl.Top = 200;
     lbl.Left = 5;
     lbl.Width = 1000;
     lbl.Height = 100;
     refresh();
     self.GuiManager.Add(lbl);
     btn = new Game.GUI.Controls.Button(self.GuiManager.Manager);
     btn.Init();
     btn.Top = 300;
     btn.Left = 5;
     btn.Text = "Dump";
     btn.Click += new Game.GUI.Controls.EventHandler(btn_Click);
     self.GuiManager.Add(btn);
 }