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


C# Engine.Sandbox類代碼示例

本文整理匯總了C#中Rant.Engine.Sandbox的典型用法代碼示例。如果您正苦於以下問題:C# Sandbox類的具體用法?C# Sandbox怎麽用?C# Sandbox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Sandbox類屬於Rant.Engine命名空間,在下文中一共展示了Sandbox類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ClearTarget

 private static void ClearTarget(Sandbox sb,
     [RantDescription("The name of the target to be cleared.")]
     string targetName)
 {
     sb.Output.Do(chain => chain.ClearTarget(targetName));
 }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:6,代碼來源:RantFunctions.cs

示例2: PrintEmoji

 private static void PrintEmoji(Sandbox sb, 
     [RantDescription("The emoji shortcode to use, without colons.")]
     string shortcode)
 {
     shortcode = shortcode.ToLower();
     if(!Emoji.Shortcodes.ContainsKey(shortcode))
     {
         sb.Print("[missing emoji]");
         return;
     }
     sb.Print(Char.ConvertFromUtf32(Emoji.Shortcodes[shortcode]));
 }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:12,代碼來源:RantFunctions.cs

示例3: Plural

	    private static void Plural(Sandbox sb, string word)
	    {
		    sb.Print(sb.Format.Pluralizer.Pluralize(word));
	    }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:4,代碼來源:RantFunctions.cs

示例4: Emdash

 private static void Emdash(Sandbox sb) => sb.Print("\x2014");
開發者ID:strogonoff,項目名稱:Rant,代碼行數:1,代碼來源:RantFunctions.cs

示例5: Bullet

 private static void Bullet(Sandbox sb) => sb.Print("\x2022");
開發者ID:strogonoff,項目名稱:Rant,代碼行數:1,代碼來源:RantFunctions.cs

示例6: PatternArg

	    private static void PatternArg(Sandbox sb, 
			[RantDescription("The name of the argument to access.")]
			string argName)
		{
			if (sb.PatternArgs == null) return;
			sb.Output.Print(sb.PatternArgs[argName]);
		}
開發者ID:strogonoff,項目名稱:Rant,代碼行數:7,代碼來源:RantFunctions.cs

示例7: RegisteredTrademark

 private static void RegisteredTrademark(Sandbox sb) => sb.Print("\x00ae");
開發者ID:strogonoff,項目名稱:Rant,代碼行數:1,代碼來源:RantFunctions.cs

示例8: Import

        private static IEnumerator<RantAction> Import(Sandbox sb,
            [RantDescription("The name or path of the pattern to load.")]
            string name)
        {
            RantAction action;

            try
            {
                action = sb.Engine.GetPattern(name).Action;
            }
            catch (RantCompilerException e)
            {
                throw new RantRuntimeException(sb.Pattern, sb.CurrentAction.Range,
                    $"Failed to compile imported pattern '{name}':\n{e.Message}");
            }
            catch (Exception e)
            {
                throw new RantRuntimeException(sb.Pattern, sb.CurrentAction.Range,
                    $"Failed to import '{name}':\n{e.Message}");
            }

            yield return action;
        }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:23,代碼來源:RantFunctions.cs

示例9: Define

 private static void Define(Sandbox sb,
     [RantDescription("The list of flags to define.")]
     params string[] flags)
 {
     foreach (var flag in flags.Where(f => !Util.IsNullOrWhiteSpace(f) && Util.ValidateName(f)))
     {
         sb.Engine.Flags.Add(flag);
     }
 }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:9,代碼來源:RantFunctions.cs

示例10: End

 private static void End(Sandbox sb,
     [RantDescription("The pattern to run after the next block.")]
     RantAction endPattern)
 {
     sb.CurrentBlockAttribs.End = endPattern;
 }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:6,代碼來源:RantFunctions.cs

示例11: Persist

 private static void Persist(Sandbox sb, AttribPersistence persistence)
 {
     sb.CurrentBlockAttribs.Persistence = persistence;
 }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:4,代碼來源:RantFunctions.cs

示例12: Start

 private static void Start(Sandbox sb,
     [RantDescription("The pattern to run before the next block.")]
     RantAction beforePattern)
 {
     sb.CurrentBlockAttribs.Start = beforePattern;
 }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:6,代碼來源:RantFunctions.cs

示例13: NotNthO

 private static IEnumerator<RantAction> NotNthO(Sandbox sb,
     [RantDescription("The interval at which the pattern should not be run.")]
     int interval,
     [RantDescription("The number of iterations to offset the interval by.")]
     int offset,
     [RantDescription("The pattern to run when the condition is satisfied.")]
     RantAction pattern)
 {
     if (!sb.Blocks.Any()) yield break;
     if (Util.Mod(sb.Blocks.Peek().Iteration - offset, interval) == 0) yield break;
     yield return pattern;
 }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:12,代碼來源:RantFunctions.cs

示例14: NotNth

 private static IEnumerator<RantAction> NotNth(Sandbox sb,
     [RantDescription("The interval at which the pattern should not be run.")]
     int interval,
     [RantDescription("The pattern to run when the condition is satisfied.")]
     RantAction pattern)
 {
     if (!sb.Blocks.Any()) yield break;
     if (sb.Blocks.Peek().Iteration % interval == 0) yield break;
     yield return pattern;
 }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:10,代碼來源:RantFunctions.cs

示例15: Branch

	    private static IEnumerator<RantAction> Branch(Sandbox sb, string id, RantAction branchAction)
	    {
		    sb.RNG.Branch(id.Hash());
		    yield return branchAction;
		    sb.RNG.Merge();
	    }
開發者ID:strogonoff,項目名稱:Rant,代碼行數:6,代碼來源:RantFunctions.cs


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