當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。