示例#1
0
        protected override void OnAdded()
        {
            //背景
            var background = new SpriteNode();

            background.Texture  = Texture2D.Load("bg_shop.jpg");
            background.Position = new Vector2F(0, 0);
            background.ZOrder   = Common.Parameter.ZOrder.BackGround;
            AddChildNode(background);

            var sign = new SpriteNode();

            sign.Texture  = Texture2D.Load("shopsign.png");
            sign.Position = new Vector2F(0, 0);
            sign.ZOrder   = Common.Parameter.ZOrder.Sign;
            AddChildNode(sign);

            _powerPanel = new PowerPanel();
            _powerPanel.SetPosition(new Vector2F(sign.Texture.Size.X, 0));
            _powerPanel.SetNode(this);
            _powerPanel.UpdateValue();

            _moneyPanel = new MoneyPanel();
            _moneyPanel.SetPosition(new Vector2F(sign.Texture.Size.X, _powerPanel.GetHeight()));
            _moneyPanel.SetNode(this);
            _moneyPanel.SetValue(GameData.PlayerData.Money);

            _weatherPanel = new WeatherPanel();
            _weatherPanel.SetPosition(new Vector2F(sign.Texture.Size.X, _powerPanel.GetHeight() + _moneyPanel.GetHeight()));
            _weatherPanel.SetNode(this);
            _weatherPanel.UpdateValue();

            menu = new CommonMenu(this);
            shop = new ShopPanel();
            shop.SetNode(this);
        }