当前位置: 首页>>代码示例>>C#>>正文


C# Label.SetOffset方法代码示例

本文整理汇总了C#中Label.SetOffset方法的典型用法代码示例。如果您正苦于以下问题:C# Label.SetOffset方法的具体用法?C# Label.SetOffset怎么用?C# Label.SetOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Label的用法示例。


在下文中一共展示了Label.SetOffset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        public static Node Create(Vector3 pos)
        {
            var cmp = new MyButton ();

            var btn = new Button (ButtonType.Push);
            btn.Normal = new Texture ("media/image128x128(Red).png");
            btn.Pressed = new Texture ("media/image128x128(Green).png");

            var label1 = new Label ();
            var label2 = new Label ();
            label2.SetOffset (0, 20);

            var col = new CollisionObject ();
            col.Shape = new BoxShape (64, 64, 100);
            col.SetOffset (64, 64, 100);

            var node = new Node ("Button");
            node.Attach (btn);
            node.Attach (cmp);
            node.Attach (label1);
            node.Attach (label2);
            node.Attach (col);

               node.Translation = pos;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:27,代码来源:MyButton.cs

示例2: Create

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pos"></param>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public static Node Create(Vector3 pos, int groupID)
        {
            var cmp = new MyCharacter ();

            var spr = new Sprite (64, 64);
            spr.AddTexture (Resource.GetDefaultTexture ());
            spr.Color = Color.Red;
            spr.SetOffset (-32, -32);

            var col = new CollisionObject ();
            col.Shape = new BoxShape (spr.Width / 2, spr.Height / 2, 1);
            //col.SetOffset (spr.Width / 2, spr.Height / 2, 1);

            var label = new Label ();
            label.Text = "ID = 0x" + groupID.ToString ("x");
            label.SetOffset (-spr.Width / 2, -spr.Height / 2);

            var node = new Node ("MyCharacter");
            node.Attach (cmp);
            node.Attach (spr);
            node.Attach (col);
            node.Attach (label);

            node.Translation = pos;
            node.GroupID = groupID;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:34,代码来源:MyCharacter.cs

示例3: Create

        public static Node Create(string name, Vector3 pos)
        {
            var cmp = new MyRecver ();

            var spr = new Sprite (64, 64);
            spr.AddTexture (Resource.GetDefaultTexture ());
            spr.Color = Color.Cyan;

            var label1 = new Label ();
            label1.Text = name;
            label1.SetOffset (4, 16);

            var label2 = new Label ();
            label2.Text = "None";
            label2.SetOffset (0, -24);

            var mbox = new MailBox (name);

            var node = new Node (name);
            node.Attach (cmp);
            node.Attach (spr);
            node.Attach (label1);
            node.Attach (label2);
            node.Attach (mbox);

            node.Translation = pos;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:29,代码来源:MyRecver.cs

示例4: Create

        public static Node Create(string address, Vector3 pos)
        {
            var cmp = new MySender ();
               cmp.address = address;

               var spr = new Sprite (64, 64);
               spr.AddTexture (Resource.GetDefaultTexture ());
               spr.Color = Color.Purple;

               var label1 = new Label ();
               label1.Text = "Sender";
               label1.SetOffset (8, 16);

               var label2 = new Label ();
               label2.SetOffset (0, -24);
               label2.Text = "None";

               var node = new Node ("Sender");
               node.Attach (cmp);
               node.Attach (spr);
               node.Attach (label1);
               node.Attach (label2);

               node.Translation = pos;

               return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:27,代码来源:MySender.cs

示例5: Test_SetOffset

        public void Test_SetOffset()
        {
            var label = new Label ();

            label.Offset = new Vector2 (1, 2);
            Assert.AreEqual (new Vector2 (1, 2), label.Offset);

            label.SetOffset (3, 4);
            Assert.AreEqual (new Vector2 (3, 4), label.Offset);
        }
开发者ID:weimingtom,项目名称:erica,代码行数:10,代码来源:TestLabel.cs

示例6: Create

        public static Node Create(int slot, Node charNode, Node tankNode)
        {
            var cha = charNode.GetComponent<MyCharacter> ();
            var tank = tankNode.GetComponent<MyTank> ();
            var cmp = new MyCard ();

            cmp.tank = tankNode;
            cmp.character = charNode;

            // 背景
            var spr1 = new Sprite (256, 128);
            spr1.Color = Color.Gray;

            // 顔
            var spr2 = new Sprite (128, 128);
            spr2.AddTexture (cha.FaceTexture);

            // 戦車
            var spr3 = new Sprite (32, 64);
            spr3.AddTexture (tank.TankTexture);
            spr3.SetOffset (128 + 6, 6);

            // 戦車名
            var label1 = new Label ();
            label1.Text = tank.TankName;
            label1.SetOffset (128 + 6 + 32 + 6, 6);

            // HP
            var hp = new Bar (4, 96, BarOrientation.Horizontal);
            hp.MaxValue = tank.MaxHp;
            hp.CurrentValue = tank.Hp;
            hp.SetOffset (128 + 6, 64 + 6);

            // クリック
            var col = new BoxCollision (128, 64, 0);
            col.SetOffset (128, 64, 0);

            var node = new Node ("Card");
            node.Attach (cmp);
            node.Attach (spr1);
            node.Attach (spr2);
            node.Attach (spr3);
            node.Attach (label1);
            node.Attach (hp);
            node.Attach (col);

            node.DrawPriority = -10;

            node.Translate (12+(256+4)*slot, 600, 0);

            // キャラクター -> マイカード
            cha.MyCard = node;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:55,代码来源:MyCard.cs

示例7: Create

        public static Node Create()
        {
            var label = new Label ("こんにちは、世界(カメラ固定)");
            label.SetOffset (10, 10);

            var cmp = new MyHUD ();

            var node = new Node ();
            node.Attach (label);
            node.Attach (cmp);

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:13,代码来源:MyHUD.cs

示例8: Create

        public static Node Create()
        {
            var cmp = new MyLabels ();

            var label1 = new Label ();
            var label2 = new Label ();
            label2.SetOffset (0, 24);

            var node = new Node ("Label");
            node.Attach (cmp);
            node.Attach (label1);
            node.Attach (label2);
            node.DrawPriority = -1;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:16,代码来源:MyLabels.cs

示例9: Create

        public static Node Create(Vector3 pos)
        {
            var cmp = new MyLogger ();

            var mbox = new MailBox ("Logger");

            var node = new Node ();
            node.Attach (cmp);
            node.Attach (mbox);

            for (var i = 0; i < lineCount; i++) {
                var line = new Label ("No Message");
                line.SetOffset (0, 16 * i);
                node.Attach (line);
            }

            node.Translation = pos;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:20,代码来源:MyLogger.cs

示例10: Create

        public static Node Create(Vector3 pos)
        {
            var label1 = new Label ();
            var label2 = new Label ();
            var label3 = new Label ("Destroy : ");
            var label4 = new Label ("Miss : 0");
            label2.SetOffset (0, 20);
            label3.SetOffset (200, 0);
            label4.SetOffset (200, 20);

            var node = new Node ("Label");
            node.Attach (label1);
            node.Attach (label2);
            node.Attach (label3);
            node.Attach (label4);

            node.Translation = pos;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:20,代码来源:MyDebugInfo.cs

示例11: Create

        public static Node Create(string words, long lifeTime)
        {
            var cmp = new MyBalloon ();
            cmp.lifeTime = lifeTime;

            var spr = new Sprite (128, 64);
            spr.AddTexture (new Texture ("media/Balloon-128x64.png"));

            var label = new Label ();
            label.Text = words;
            label.Color = Color.Black;
            label.SetOffset (4, 12);

            var node = new Node ("Balloon");
            node.Attach (cmp);
            node.Attach (spr);
            node.Attach (label);

            node.DrawPriority = -3;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:22,代码来源:MyBalloon.cs

示例12: Create

        public static Node Create(Vector3 pos)
        {
            var cmp = new MyConsole ();

            var spr = new Sprite (300, 240);
            spr.Color = new Color (0, 0, 0, 128);

            var node = new Node ();
            node.Attach (cmp);
            node.Attach (spr);

            for (var i = 0; i < lineCount; i++) {
                var label = new Label ();
                label.SetOffset (10, 16 * i);
                label.Text = "> ";
                node.Attach (label);
            }

            node.Translation = pos;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:22,代码来源:MyConsole.cs

示例13: Create

        public static Node Create(string name, Vector3 pos)
        {
            var cmp = new MyCharacterButton (name);

            var spr = new Sprite (128, 64);
            spr.AddTexture (Resource.GetDefaultTexture ());

            var label1 = new Label ();
            label1.Text = cmp.dbCharacter.FullName;
            label1.SetOffset (10, 10);
            label1.Color = Color.Black;

            var label2 = new Label ();
            label2.Text = cmp.dbCharacter.FullNameYomi;
            label2.SetOffset (10, 30);
            label2.Color = Color.Black;

            var col = new CollisionObject ();
            col.Shape = new BoxShape (64, 32, 100);
            col.SetOffset (64, 32, 0);

            var snd = new SoundEffectTrack ("media/PinPon.wav");
            var clip = new SoundClip ("クリック音");
            clip.AddTrack (snd);

            var node = new Node ("Button(" + name + ")");
            node.Attach (cmp);
            node.Attach (spr);
            node.Attach (label1);
            node.Attach (label2);
            node.Attach (col);

            node.UserData.Add (clip.Name, clip);

            node.Translation = pos;
            node.DrawPriority = -1;

            return node;
        }
开发者ID:weimingtom,项目名称:erica,代码行数:39,代码来源:MyCharacterButton.cs

示例14: AddBranch

        private void AddBranch(OffsetInstruction instruction, Label label) {
            if (_currentStackDepth == -1) {
                return; // this code is unreachable
            }

            AddInstruction(instruction);
            label.NoteStackSize();
            label.SetOffset(instruction);
        }
开发者ID:bclubb,项目名称:ironruby,代码行数:9,代码来源:LightCompiler.cs

示例15: Create

        public static Node Create(Vector3 pos)
        {
            var cmp = new MyStatusPanel ();

            var spr = new Sprite (600, 200);
            spr.AddTexture (Resource.GetDefaultTexture ());
            spr.Color = Color.Gray;

            var mbox = new MailBox ("CharacterChanged");

            var nameLabel = new Label ("Name");
            var levelLabel = new Label ("Lv");
            var hpLabel = new Label ("HP");
            var attackLabel = new Label ("Ata");
            var armorLabel = new Label ("Arm");
            var dexLabel = new Label ("Dex");
            var luckLabel = new Label ("Luck");
            var expLabel = new Label ("Exp");

            var x = 410;
            var y = 10;
            nameLabel.SetOffset (x, y + 0);
            levelLabel.SetOffset (spr.Width - 50, y + 0);
            hpLabel.SetOffset (x, y + 20);
            attackLabel.SetOffset (x, y + 40);
            armorLabel.SetOffset (x, y + 60);
            dexLabel.SetOffset (x, y + 80);
            luckLabel.SetOffset (x, y + 100);
            expLabel.SetOffset (x, y + 120);

            cmp.Name = new Label ("デフォルト");
            cmp.Level = new Label ("-1");
            cmp.Hp = new Bar (16, 120, BarOrientation.Horizontal, 20);
            cmp.Attack = new Bar (16, 120, BarOrientation.Horizontal, 20);
            cmp.Armor = new Bar (16, 120, BarOrientation.Horizontal, 20);
            cmp.Dexterity = new Bar (16, 120, BarOrientation.Horizontal, 20);
            cmp.Luck = new Bar (16, 120, BarOrientation.Horizontal, 20);
            cmp.Exp = new Bar (16, 120, BarOrientation.Horizontal, 100);

            cmp.hpValue = new Label ("100");
            cmp.attackValue = new Label ("100");
            cmp.armorValue = new Label ("100");
            cmp.dexValue = new Label ("100");
            cmp.luckValue = new Label ("100");
            cmp.expValue = new Label ("100");

            x = 450;
            y = 10;
            cmp.Name.SetOffset (x, y + 0);
            cmp.Level.SetOffset (spr.Width - 30, y + 0);
            cmp.Hp.SetOffset (x, y + 20);
            cmp.Attack.SetOffset (x, y + 40);
            cmp.Armor.SetOffset (x, y + 60);
            cmp.Dexterity.SetOffset (x, y + 80);
            cmp.Luck.SetOffset (x, y + 100);
            cmp.Exp.SetOffset (x, y + 120);

            x = 572;
            y = 10;
            cmp.HpValue.SetOffset (x, y + 20);
            cmp.AttackValue.SetOffset (x, y + 40);
            cmp.ArmorValue.SetOffset (x, y + 60);
            cmp.DexterityValue.SetOffset (x, y + 80);
            cmp.LuckValue.SetOffset (x, y + 100);
            cmp.ExpValue.SetOffset (x, y + 120);

            var node = new Node ("StatusPanel");
            node.Attach (cmp);
            node.Attach (spr);
            node.Attach (mbox);

            node.Attach (nameLabel);
            node.Attach (levelLabel);
            node.Attach (hpLabel);
            node.Attach (armorLabel);
            node.Attach (attackLabel);
            node.Attach (dexLabel);
            node.Attach (luckLabel);
            node.Attach (expLabel);

            node.Attach (cmp.name);
            node.Attach (cmp.level);

            node.Attach (cmp.Hp);
            node.Attach (cmp.Armor);
            node.Attach (cmp.Attack);
            node.Attach (cmp.Dexterity);
            node.Attach (cmp.Luck);
            node.Attach (cmp.Exp);

            node.Attach (cmp.HpValue);
            node.Attach (cmp.ArmorValue);
            node.Attach (cmp.AttackValue);
            node.Attach (cmp.DexterityValue);
            node.Attach (cmp.LuckValue);
            node.Attach (cmp.ExpValue);

            node.AddChild (MyBodySprite.Create (new Vector3 (0, -100, 0)));

            node.Position = pos;
//.........这里部分代码省略.........
开发者ID:weimingtom,项目名称:erica,代码行数:101,代码来源:MyStatusPanel.cs


注:本文中的Label.SetOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。