Ejemplo n.º 1
0
        public NPCWindow(GUI.WindowManager WM, GameObject.MapEntities.Actors.NPC NPC, GameObject.MapEntities.Actors.Player Player)
        {
            this.Player = Player;
            this.Width  = 320;
            this.Height = 512;
            GUI.Controls.RichTextDisplay greeting = new GUI.Controls.RichTextDisplay(NPC.Greeting, 180, 200, WM);
            this.Controls.Add(greeting);
            this.Title = NPC.DisplayName;
            int yoffset = greeting.Height + 2;

            if (NPC.Commands != null && NPC.Commands.Count > 0)
            {
                for (int i = 0; i < NPC.Commands.Count; i++)
                {
                    NPCMenuItem mi = new NPCMenuItem(Player, NPC.Commands[i])
                    {
                        Y = yoffset
                    };
                    yoffset += mi.Height;
                    AddControl(mi);
                }
            }
            NPCMenuItem end = NPCMenuItem.Close();

            end.Y = yoffset;
            AddControl(end);
        }
Ejemplo n.º 2
0
        //Exit option at the end of any menu
        public static NPCMenuItem Close()
        {
            NPCMenuItem close = new NPCMenuItem(null, "Exit");

            close.OnClick += new ClickEventHandler((sender, m) => close.GetParentWindow()?.Close());
            return(close);
        }