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


C# Script.AddRange方法代码示例

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


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

示例1: AddJavaScript

		public static void AddJavaScript(Script script)
		{
			script.AddRange(
				"function helloWord() {",
				"	alert('Hello World');",
				"}",
				"",
				"helloWorld();",
				"",
				Js.Function("helloWord",
					Js.Statement(Js.Call("alert", Js.Q("Hello World"))),
					"line 2",
					Js.Block(
						"This should be blocked",
						"This should be blocked",
						Sb.Line("This should be blocked"),
						"This should be blocked",
						Sb.Indent(
							Sb.Line("This should be indented"),
							"This should be indented"
						),
						"This should be blocked",
						"This should be blocked",
						Sb.Wrapper(
							"/*",
							Sb.Script(ScriptLayout.InlineBlock,
								"comment",
								"comment",
								"comment",
								"comment",
								"comment",
								"comment"
							),
							"*/"
						),
						Sb.Line("1", "2", "3", "4"),
						Sb.ScriptIf(true, "This is true", "should not show"),
						Sb.ScriptIf(false, "should not show", "This is false"),
						Sb.ScriptIf(true, "This is true"),
						Sb.ScriptIf(false, "should not show")

					)
				),
				Js.Function("withParams",
					Js.Parameters("aaa", "ddd", "fff"),
					Js.Statement(Js.Call("alert", Js.Q("Hello World"))),
					"line 2"
				),
				Js.Function("withBigParams",
					Js.Parameters(ScriptLayout.Block,
						"aaa",
						"ddd",
						"fff"
					),
					Js.Statement(Js.Call("alert", Js.Q("Hello World"))),
					"line 2"
				),
				Sb.Line(),
				Js.Statement(Js.Call("helloWorld")),
				Sb.Line(),
				Js.Statement("var testBool = ", true),
				Js.Statement("var testDate = ", Js.Q(new DateTime(2008, 12, 18, 14, 30, 45))),
				Js.Statement("var testSecureString = ", Js.QQ(Encryption.CreateSecureString("pass'wo\"rd"))),
				Js.Statement("var testQuotes = ", Js.Q("dfgdfg'gdfgdfg'gdfsg\"dsfg")),
				Js.Statement("var testList = ", Js.List("1", "2", "3")),
				Js.Statement("var testArray = ", Js.Array("1", "2", "3")),
				Js.Statement("var testNew = ", Js.New("className", "a", "b")),
				Js.Statement("var testXml = ", Js.Q(
						Xs.Element("name",
							"tony"
						)
					)
				),
				Js.Statement("var testObject = ",
					Js.Object(
						Js.Property("name1", "value1"),
						Js.Property("name2", "value2"),
						Js.Property("name3", "value3"),
						Js.Property("name4", "value4")
					)
				),
				Js.Statement("var testScript = ",
					Sb.Script(
						Js.Property("name1", "value1"),
						Js.Property("name2", "value2"),
						Js.Property("name3", "value3"),
						Js.Property("name4", "value4")
					)
				),
				Js.Statement("var testObject = ",
					Js.Object(ScriptLayout.InlineBlock,
						Js.Property("name1", "value1"),
						Js.Property("name2", "value2"),
						Js.Property("name3", "value3"),
						Js.Property("name4", "value4"),
						Js.Property("name5",
							Js.Function(
								Js.Statement("statement1"),
								Js.Statement("statement2"),
								Js.Statement("statement3"),
//.........这里部分代码省略.........
开发者ID:Tiggerito,项目名称:ClockWork.ScriptBuilder.Test,代码行数:101,代码来源:JavaScriptTests.cs

示例2: GetFrameInfo

        /// <summary>
        /// 
        /// </summary>
        /// <param name="currentKey"></param>
        /// <param name="framesOnKey"></param>
        /// <param name="rect"></param>
        /// <param name="script"></param>
        /// <param name="direction"></param>
        /// <param name="spriteFlipped"></param>
        /// <param name="reversed"></param>
        public virtual void GetFrameInfo(ref int currentKey, ref int framesOnKey, ref FloatRectangle rect, ref Script script, RotationComponent.CardinalDirections direction, out bool spriteFlipped,bool reversed = false)
        {
            framesOnKey++;
            if (framesOnKey > mFrameDurations[currentKey])
            {
                framesOnKey = 0;

                if (reversed)
                {
                    currentKey--;
                    if (currentKey < 0)
                    {
                        currentKey = mFrames[DirectionMap[RotationComponent.CardinalDirections.N]].Count - 1;
                    }
                }
                else
                {
                    currentKey++;
                    if (currentKey > mFrames[DirectionMap[RotationComponent.CardinalDirections.N]].Count - 1)
                    {
                        currentKey = 0;
                    }
                }
            }

            if (mFrames.Count == 1)
            {
                rect = mFrames[RotationComponent.CardinalDirections.NONE][currentKey];
            }
            else
            {
                rect = mFrames[mDirectionMap[direction]][currentKey];
            }

            if (direction > RotationComponent.CardinalDirections.S && mDirectionMap[RotationComponent.CardinalDirections.SW] != RotationComponent.CardinalDirections.SW)
            {
                spriteFlipped = true;
            }
            else
            {
                spriteFlipped = false;
            }

            script.AddRange(mWholeAnimationScript);

            if (mFrameScripts.ContainsKey(currentKey))
            {
                script.AddRange(mFrameScripts[currentKey]);
            }
        }
开发者ID:dogmahtagram,项目名称:Finale,代码行数:60,代码来源:Animation.cs


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