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


C# Player.Click方法代码示例

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


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

示例1: Use

        public void Use(Player p, string[] args) {
            //if (p == null) stuff here, not sure if should add yet or not since Console cannot do commands at the moment.
            Vector3S click = p.LastClick;

            if (args.Length == 3) {
                try {
                    for (int value = 0; value < 3; value++) {
                        switch (args[value].ToLower()) {
                            case "x":
                            case "z":
                            case "y":
                                break;

                            default:
                                if (isValid(args[value], value, p)) {
                                    switch (value) {
                                        case 0:
                                            click.x = short.Parse(args[0]);
                                            break;
                                        case 1:
                                            click.z = short.Parse(args[1]);
                                            break;
                                        case 2:
                                            click.y = short.Parse(args[2]);
                                            break;
                                    }
                                }
                                else {
                                    p.SendMessage("\"" + args[value] + "\" was not valid");
                                    return;
                                }
                                break;
                        }
                    }
                }
                catch (Exception e) {
                    Logger.LogError(e);
                    return;
                }
            }
            else {
                p.SendMessage("Invalid arguments");
                return;
            }

            p.Click((ushort)click.x, (ushort)click.z, (ushort)click.y, Block.BlockList.STONE);
            p.SendMessage("Click &b(" + click.x + ", " + click.z + ", " + click.y + ").");
        }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:48,代码来源:CmdClick.cs

示例2: OnPlayerBlockChange_Normal

 void OnPlayerBlockChange_Normal(Player sender, BlockChangeEventArgs args) {
     args.Cancel();
     if (args.Current == 0 && args.Action == ActionType.Delete) args.Current = 20;
     sender.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal;
     if (sender.ExtraData["Cursor"] != null) {
         Vector3S cursor;
         if (sender.ExtraData["Cursor"].GetType() == typeof(Vector3S))
             cursor = (Vector3S)sender.ExtraData["Cursor"];
         else {
             cursor = new Vector3S();
             cursor.FromString((string)sender.ExtraData["Cursor"]);
         }
         if (args.Action == ActionType.Place) {
             sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y + 1), args.Holding);
         }
         else {
             sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y), args.Holding, false);
         }
     }
     sender.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal;
     Curse(sender);
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:22,代码来源:CmdCursor.cs


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