예제 #1
0
파일: Button.cs 프로젝트: anthrax3/AForm
 public override void OnAfterLoad()
 {
     ctl.Click +=
         new EventHandler(
             delegate(object sender, EventArgs e)
     {
         clickEvent.Raise();
     }
             );
 }
예제 #2
0
파일: Button.cs 프로젝트: anthrax3/AForm
        public override void  OnAfterLoad()
        {
            ctl.Click +=
                new EventHandler(
                    delegate(object sender, EventArgs e)
            {
                clickEvent.Raise();
            }
                    );

            if (HasConnector("image"))
            {
                ctl.Image = Image.FromStream(this["image"].GetValue <Stream>());
            }

            base.OnAfterLoad();
        }
예제 #3
0
파일: Level.cs 프로젝트: Jorch72/obsidian
        public bool SetBlock(Player player, short x, short y, short z, byte type)
        {
            if (this[x, y, z] == type)
            {
                return(false);
            }
            BlockArgs e = new BlockArgs(player, x, y, z, type);

            BlockEvent.Raise(server, this, e);
            if (e.Abort)
            {
                return(false);
            }
            this[x, y, z] = type;
            Protocol.BlockPacket(x, y, z, type).Send(this);
            return(true);
        }
예제 #4
0
파일: Level.cs 프로젝트: Jorch72/obsidian
        internal void PlayerSetBlock(Player player, short x, short y, short z, byte type)
        {
            byte      before = this[x, y, z];
            BlockArgs e      = new BlockArgs(player, x, y, z, type);

            BlockEvent.Raise(server, this, e);
            if (before == this[x, y, z])
            {
                if (e.Abort)
                {
                    Protocol.BlockPacket(x, y, z, before).Send(player);
                }
                else
                {
                    this[x, y, z] = type; Protocol.BlockPacket(x, y, z, type).Send(this, player);
                }
            }
        }
예제 #5
0
 protected virtual void OnBlock(BlockArgs args)
 {
     BlockEvent.Raise(level.server, this, args);
 }
예제 #6
0
파일: Player.cs 프로젝트: Jorch72/obsidian
        private void OnBlock(short x, short y, short z, byte action, byte type)
        {
            if (status != OnlineStatus.Ready)
            {
                return;
            }
            if (!Group.CanBuild)
            {
                SendBlock(x, y, z); return;
            }
            if (action >= 2)
            {
                new Message("&eUnknown block action.").Send(this);
                SendBlock(x, y, z); return;
            }
            Blocktype blocktype = Blocktype.FindById(type);

            if (blocktype == null)
            {
                new Message("&eUnknown blocktype.").Send(this);
                SendBlock(x, y, z); return;
            }
            if (!blocktype.Placeable)
            {
                new Message("&eUnplaceable blocktype.").Send(this);
                SendBlock(x, y, z); return;
            }
            if (y == level.Depth)
            {
                return;
            }
            if (x >= level.Width || y >= level.Depth || z >= level.Height)
            {
                new Message("&eInvalid block position.").Send(this); return;
            }
            byte block = bind[type];

            if (action == 0)
            {
                block = 0x00;
            }
            byte before = level[x, y, z];

            if (before == block)
            {
                if (bind[type] != type)
                {
                    SendBlock(x, y, z);
                }
                return;
            }
            if (before == Blocktype.adminium.ID && !destroyAdminium)
            {
                Protocol.BlockPacket(x, y, z, 7).Send(this);
                return;
            }
            BlockArgs args = new BlockArgs(this, x, y, z, block);

            BlockEvent.Raise(server, this, args, type);
            if (!args.Abort)
            {
                InternalBlockEvent(this, args, (bind[type] != type));
            }
            else if (level[x, y, z] == before)
            {
                SendBlock(x, y, z);
            }
        }