Пример #1
0
        public override void Init()
        {
            base.Init();

            const string BACKGROUND_PATH = "Sprites/UI/background";
            var background = gameObjectsFactory.CreateSprite(BACKGROUND_PATH);
            this.children.Add(background);

            const string FOG_TEXTURE_PATH = "Sprites/UI/fog";
            var fogTexture = gameObjectsFactory.CreateSprite(FOG_TEXTURE_PATH);
            Fog2D fog = new Fog2D();
            fog.Init(800, 480, fogTexture);
            this.children.Add(fog);

            const string SMALL_COG_PATH = "Sprites/UI/Menu/smallCog";
            this.backgroundCog = gameObjectsFactory.CreateSprite(SMALL_COG_PATH);
            backgroundCog.SetRelativePosition(new Vector2(104, -246));
            backgroundCog.SetRootOrigin(new Vector2(400, 50));
            this.children.Add(backgroundCog);

            this.smallCog = gameObjectsFactory.CreateSprite(SMALL_COG_PATH);
            smallCog.SetRelativePosition(new Vector2(415, -298));
            smallCog.SetRootOrigin(new Vector2(720, -2));
            smallCog.SetRotation(ALIGN_ROTATION);
            this.children.Add(smallCog);

            largeCog.MenuChanged += largeCog_MenuChanged;
            largeCog.StartClicked += largeCog_StartClicked;
            largeCog.Init();
            largeCog.SetRootOrigin(new Vector2(0, 480));
            this.children.Add(largeCog);
        }
Пример #2
0
        public void Init(Drawable2DComposite backgroundTexture, Drawable2DComposite font, float leftTextMargin)
        {
            font.SetRelativePosition(new Vector2(leftTextMargin, 0));
            this.AddChild(backgroundTexture);
            this.AddChild(font);

            base.Init();
        }
Пример #3
0
        public void Init(int desiredWidth, int desiredHeight, Drawable2DComposite fogSprite)
        {
            this.fogSprite = fogSprite;
            textureRectangle = fogSprite.GetBounds();
            AddChild(fogSprite);

            cols = (int)((float)desiredWidth/textureRectangle.Width + 0.5);
            rows = (int)((float)desiredHeight/textureRectangle.Height + 0.5);
        }
Пример #4
0
        public override void Init()
        {
            base.Init();
            const string LARGE_COG_PATH = "Sprites/UI/Menu/largeCog";
            this.cog = gameObjectsFactory.CreateSprite(LARGE_COG_PATH);
            cog.SetRelativePosition(new Vector2(-602, -122));
            this.AddChild(cog);

            initMenus();
        }
        public Drawable2DComposite CreateButton(Drawable2DComposite background, Drawable2DComposite font, float letTextMargin, EventHandler clickHandler)
        {
            var button = fetchObject<Button>();

            button.Click += clickHandler;
            if(!buttons.Contains(button))
            {
                buttons.Add(button);
            }

            inputManager.RegisterClickListener(button);
            button.Init(background, font, letTextMargin);
            return button;
        }
 protected virtual void createEmptyParent()
 {
     parent = new EmptyDrawable2DComposite();
 }
 public void SetParent(Drawable2DComposite parent)
 {
     this.parent = parent;
 }
 public void AddChild(Drawable2DComposite child)
 {
     child.SetParent(this);
     children.Add(child);
 }