Example #1
0
        public static void VariantPopup(string desc, SimGameState s, IEnumerable <MechDef> variantsToList, MechBayPanel refresh = null, SimpleMechAssembly_InterruptManager_AssembleMechEntry close = null)
        {
            GenericPopupBuilder pop    = GenericPopupBuilder.Create("Assemble Mech?", desc);
            bool   hasMultipleVariants = variantsToList.Count() > 1;
            string closeButtonText     = hasMultipleVariants ? "-" : "Not now";

            pop.AddButton(closeButtonText, delegate
            {
                if (close != null)
                {
                    close.NewClose();
                }
            }, true, null);


            foreach (MechDef m in variantsToList)
            {
                string buttonText = hasMultipleVariants ? string.Format("{0}", m.Chassis.VariantName) : "Yes";
                pop.AddButton(buttonText, delegate
                {
                    PerformMechAssemblyStorePopup(s, m, refresh, close);
                }, true, null);
            }

            pop.CancelOnEscape();
            pop.AddFader(new UIColorRef?(LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants.PopupBackfill), 0f, true);
            pop.Render();
        }
Example #2
0
        public void Render()
        {
            GenericPopupBuilder builder = GenericPopupBuilder.Create("__/CAE.Components/__", this.BuildText());

            builder.AddButton("X", null, true);
            builder.AddButton("+", new Action(this.Left), false);
            builder.AddButton("<-", new Action(this.Up), false);
            builder.AddButton("-", new Action(this.Right), false);
            builder.AddButton("->", new Action(this.Down), false);
            builder.AddButton("Ок", null, true);
            popup = builder.CancelOnEscape().Render();
        }