當前位置: 首頁>>代碼示例>>C#>>正文


C# Player.SelectMarks方法代碼示例

本文整理匯總了C#中fCraft.Player.SelectMarks方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.SelectMarks方法的具體用法?C# Player.SelectMarks怎麽用?C# Player.SelectMarks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fCraft.Player的用法示例。


在下文中一共展示了Player.SelectMarks方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MarkHandler

        static void MarkHandler( Player player, Command cmd )
        {
            Map map = player.WorldMap;
            int x, y, z;
            Vector3I coords;
            if( cmd.NextInt( out x ) && cmd.NextInt( out y ) && cmd.NextInt( out z ) ) {
                if( cmd.HasNext ) {
                    CdMark.PrintUsage( player );
                    return;
                }
                coords = new Vector3I( x, y, z );
            } else {
                coords = player.Position.ToBlockCoords();
            }
            coords.X = Math.Min( map.Width - 1, Math.Max( 0, coords.X ) );
            coords.Y = Math.Min( map.Length - 1, Math.Max( 0, coords.Y ) );
            coords.Z = Math.Min(map.Height - 1, Math.Max(0, coords.Z));

            if (player.SelectionMarksExpected > 0)
            {
                player.SelectionAddMark(coords, true);
            }
            else if(player.markSet > 0)
            {
                player.selectedMarks.Add(coords);
                player.SelectMarks();
            }
            else
            {
                player.MessageNow("Cannot mark - no selection in progress.");
            }
        }
開發者ID:EricKilla,項目名稱:LegendCraft,代碼行數:32,代碼來源:BuildingCommands.cs

示例2: HighlightHandler

        static void HighlightHandler(Player player, Command cmd)
        {
            string option = cmd.Next();
            if (String.IsNullOrEmpty(option))
            {
                CdHighlight.PrintUsage(player);
                return;
            }

            switch (option.ToLower())
            {
                case "create":
                case "new":
                case "add":
                    string name = cmd.Next();
                    if (String.IsNullOrEmpty(name))
                    {
                        player.Message("Usage is /Highlight create [highlight name]");
                        return;
                    }

                    if (Server.Highlights.Keys.Contains(name))
                    {
                        player.Message("A highlight with that name already exists!");
                        return;
                    }
                    System.Drawing.Color systemColor;

                    string color = cmd.Next();
                    if (String.IsNullOrEmpty(color))
                    {
                        player.Message("Usage is /Highlight create [highlight name] [color or #htmlcolor] [Percent Opaque]");
                        return;
                    }

                    if (color.Contains('#'))
                    {
                        try
                        {
                            systemColor = System.Drawing.ColorTranslator.FromHtml(color);
                        }
                        catch
                        {
                            player.Message("Unrecognized color! Please use a valid color name or html color code.");
                            return;
                        }
                    }
                    else
                    {
                        try
                        {
                            systemColor = System.Drawing.Color.FromName(color);
                        }
                        catch
                        {
                            player.Message("Unrecognized color! Please use a valid color name or html color code.");
                            return;
                        }
                    }

                    string opacity = cmd.Next();
                    int percentOpacity;
                    if (String.IsNullOrEmpty(opacity))
                    {
                        player.Message("Usage is /Highlight create [highlight name] [color or #htmlcolor] [Percent Opaque]");
                        return;
                    }

                    if (!Int32.TryParse(opacity, out percentOpacity))
                    {
                        player.Message("Percent opacity must be from 0-100, where 0 would be transparent, and 100 would be completely opaque.");
                        return;
                    }

                    player.highlightName = name;
                    player.cmd = cmd.Name;
                    player.color = systemColor;
                    player.percentOpacity = percentOpacity;
                    player.SelectMarks();
                    break;
                case "remove":
                case "delete":
                    string targetHighlight = cmd.Next();
                    if (String.IsNullOrEmpty(targetHighlight))
                    {
                        CdHighlight.PrintUsage(player);
                            return;
                    }
                    if(!Server.Highlights.Keys.Contains(targetHighlight))
                    {
                        player.Message("That highlight zone was not found! Please make sure you spelled it correctly!");
                        return;
                    }

                    Tuple<int, Vector3I, Vector3I, System.Drawing.Color, int> ID;
                    Server.Highlights.TryGetValue(targetHighlight, out ID);

                    player.World.Players.Send(PacketWriter.RemoveSelectionCuboid((byte)ID.Item1));

                    break;
//.........這裏部分代碼省略.........
開發者ID:EricKilla,項目名稱:LegendCraft,代碼行數:101,代碼來源:BuildingCommands.cs


注:本文中的fCraft.Player.SelectMarks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。