コード例 #1
0
        private void AddCard(int no, float x, float y)
        {
            // Symbols
            Roga2dButton button = new Roga2dButton();
            button.LocalPriority = 0.1f;
            button.SetUpSprite("UI/buttons", new Vector2(32, 32), new Vector2(16, 16), new Rect(0, 0, 32, 32));
            button.SetDownSprite("UI/buttons", new Vector2(32, 32), new Vector2(16, 16), new Rect(32, 0, 32, 32));
            button.OnTouched = this.onTouched;
            button.LocalPixelPosition = new Vector2(x, y);
            button.Tag = no;

            int tx = no % 3;
            int ty = no / 3;

            Roga2dSprite sprite = new Roga2dSprite("UI/weapon", new Vector2(32, 32), new Vector2(16, 16), new Rect(64 * tx, 56 * ty, 64, 56));
            sprite.LocalPriority = 0.1f;
            sprite.LocalPixelPosition = new Vector2(16, 16);
            button.AddChild(sprite);
            this.AddChild(button);
        }
コード例 #2
0
 private void addStep(int no, float x, float y)
 {
     // Steps
     Roga2dButton button = new Roga2dButton();
     button.Tag = no;
     button.LocalPriority = 0.1f;
     button.SetUpSprite("Dungeon/symbols", new Vector2(24, 24), new Vector2(12, 12), new Rect(0, 0, 32, 32));
     button.SetDownSprite("Dungeon/symbols", new Vector2(24, 24), new Vector2(12, 12), new Rect(32, 0, 32, 32));
     button.OnTouched = this.onStepTouched;
     button.LocalPixelPosition = new Vector2(x, y);
     this.floor.AddChild(button);
 }