Esempio n. 1
0
        public static T LoadWidget <T>(string id, Widget parent, WidgetArgs args) where T : Widget
        {
            var widget = LoadWidget(id, parent, args) as T;

            if (widget == null)
            {
                throw new InvalidOperationException(
                          "Widget {0} is not of type {1}".F(id, typeof(T).Name));
            }
            return(widget);
        }
Esempio n. 2
0
        public static Widget OpenWindow(string id, WidgetArgs args)
        {
            var window = Game.ModData.WidgetLoader.LoadWidget(args, Root, id);

            if (WindowList.Count > 0)
            {
                Root.HideChild(WindowList.Peek());
            }
            WindowList.Push(window);
            return(window);
        }
Esempio n. 3
0
        public void PostInit(WidgetArgs args)
        {
            if (Logic == null)
            {
                return;
            }

            args["widget"] = this;

            LogicObject = Game.modData.ObjectCreator.CreateObject <object>(Logic, args);

            args.Remove("widget");
        }
Esempio n. 4
0
        public void PostInit(WidgetArgs args)
        {
            if (!Logic.Any())
            {
                return;
            }

            args["widget"] = this;

            LogicObjects = Logic.Select(l => Game.ModData.ObjectCreator.CreateObject <ChromeLogic>(l, args))
                           .ToArray();

            args.Remove("widget");
        }
Esempio n. 5
0
        public override void Initialize(WidgetArgs args)
        {
            base.Initialize(args);

            if (Unit != null && Sequence != null)
            {
                var anim = new Animation(worldRenderer.world, Unit, () => Facing);
                anim.PlayFetchIndex(Sequence, () => Frame);
                GetAnimation = () => anim;
            }

            GetSprite = () =>
            {
                var anim = GetAnimation();
                return(anim != null ? anim.Image : null);
            };
        }
Esempio n. 6
0
        public void PostInit(WidgetArgs args)
        {
            if (Logic == null)
            {
                return;
            }

            args["widget"] = this;

            LogicObject = Game.modData.ObjectCreator.CreateObject <object>(Logic, args);
            var iwd = LogicObject as ILogicWithInit;

            if (iwd != null)
            {
                iwd.Init();
            }

            args.Remove("widget");
        }
Esempio n. 7
0
 public static Widget LoadWidget(string id, Widget parent, WidgetArgs args)
 {
     return(Game.ModData.WidgetLoader.LoadWidget(args, parent, id));
 }