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


C# ArrayList.AddRange方法代码示例

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


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

示例1: GetCardsInOrder

 public override ArrayList GetCardsInOrder()
 {
     ArrayList cards = new ArrayList(pair1);
     cards.AddRange(pair2);
     cards.AddRange(kickers);
     return cards;
 }
开发者ID:kiichi7,项目名称:Lies_and_Seductions,代码行数:7,代码来源:TwoPair.cs

示例2: OnGUI

    void OnGUI()
    {
        ArrayList textToDisplay = new ArrayList();
        string[] normalText = { "Score " + myGame.score,
                                "Max lvl " + myGame.playerLvl,
                                "Build points " + myGame.buildPoints,
                                "Herbivores " + myGame.herbovores.Count,
                                "Plants " + myGame.plants.Count + " out of " + myGame.maxPlants,
                                "Next enemy in " + (1 + (int)(EnemySpawner.enemySpawnTime - EnemySpawner.enemyTime)),
                                "Next plant in " + (1 + (int)(PlantSpawner.plantSpawnTime - PlantSpawner.plantTime)),
                            };

        string[] debugText = {
                                "Time scale " + Time.timeScale,
                            };

        textToDisplay.AddRange(normalText);
        if (myGame.debug)
        {
            textToDisplay.AddRange(debugText);
        }

        for (int i = 0; i < textToDisplay.Count; i++)
        {
            GUI.Box(new Rect(10, y_start + (line_height + line_offset) * i, line_width, line_height), textToDisplay[i].ToString());
        }
    }
开发者ID:vircung,项目名称:Unity-LD24,代码行数:27,代码来源:Level1.cs

示例3: AddText

 public void AddText( string pText, int pIndex )
 {
     ArrayList list = new ArrayList();
     list.AddRange( mContents);
     list.Insert( pIndex, new GUIContent( pText));
     mContents = list.ToArray( typeof(GUIContent)) as GUIContent[];
 }
开发者ID:jhoe123,项目名称:Yonatan-Project,代码行数:7,代码来源:GUISelectionGrid.cs

示例4: RunTest

	static int RunTest (SqlConnection conn)
	{
		ArrayList persons = new ArrayList ();
		Person personA = new Person ("de Icaza", "Miguel",
			new DateTime (1925, 1, 31, 5, 8, 29, 998),
			new DateTime (1925, 1, 31, 5, 8, 0),
			new DateTime (2004, 4, 20, 3, 43, 55, 567));
		Person personB = new Person ("Pobst", "Jonathan",
			new DateTime (2007, 12, 01, 7, 9, 29, 999),
			new DateTime (2007, 12, 01, 7, 10, 0),
			new DateTime (2006, 12, 30, 23, 05, 1, 3));
		Person personC = new Person ("Toshok", "Chris",
			new DateTime (1973, 8, 13, 0, 0, 0),
			new DateTime (1973, 8, 13, 0, 0, 0),
			new DateTime (2004, 4, 20, 3, 43, 55, 563));
		Person personD = new Person ("Harper", "Jackson",
			new DateTime (1973, 8, 13, 0, 0, 59, 2),
			new DateTime (1973, 8, 13, 0, 1, 0),
			new DateTime (2004, 4, 20, 3, 43, 54, 0));
		persons.AddRange (new Person [] { personA, personB, personC, personD });

		SqlCommand cmd = new SqlCommand (create_table, conn);
		cmd.ExecuteNonQuery ();
		cmd.Dispose ();

		cmd = new SqlCommand ("INSERT INTO bug323646 VALUES (@name, @firstName, @birthDate, @created)", conn);
		foreach (Person person in persons) {
			cmd.Parameters.Add (CreateParameter ("@name", person.Name));
			cmd.Parameters.Add (CreateParameter ("@firstName", person.FirstName));
			cmd.Parameters.Add (CreateParameter ("@BirthdatE", person.BirthDate));
			cmd.Parameters.Add (CreateParameter ("@created", person.Created));
			cmd.ExecuteNonQuery ();
			cmd.Parameters.Clear ();
		}
		cmd.Dispose ();

		cmd = new SqlCommand ("SELECT * FROM bug323646 WHERE Created = @created", conn);
		cmd.Parameters.Add (CreateParameter ("@created", DateTime.Now));

		using (SqlDataReader dr = cmd.ExecuteReader ()) {
			Assert.IsFalse (dr.Read (), "#A");
		}

		foreach (Person person in persons) {
			cmd.Parameters ["@created"].Value = person.Created;

			using (SqlDataReader dr = cmd.ExecuteReader ()) {
				Assert.IsTrue (dr.Read (), "#B1");
				Assert.AreEqual (person.Name, dr.GetString (0), "#B2");
				Assert.AreEqual (person.FirstName, dr.GetString (1), "#B3");

				DateTime birthDate = (DateTime) dr.GetValue (2);
				Assert.AreEqual (person.ExpectedBirthDate, birthDate, "#B4");
				Assert.AreEqual (person.Created, dr.GetDateTime (3), "#B5");
				Assert.IsFalse (dr.Read (), "#B6");
			}
		}

		return 0;
	}
开发者ID:mono,项目名称:gert,代码行数:60,代码来源:test.cs

示例5: initAxeMan

	protected void initAxeMan()
	{
		// Get the main camera
		Camera mainCam = Camera.main;
		// Play sound from main camera when axeman spawns
		mainCam.audio.PlayOneShot((AudioClip)axemanIntroSounds[Random.Range (0, bopperIdleSounds.Length)]);

		SpriteRenderer[] sceneObjects = FindObjectsOfType<SpriteRenderer>();
		treeList = new ArrayList ();
		if (player == null)
			player = GameObject.Find("Player");

		treeList.AddRange (getAllPlayerTrees ());

		foreach (SpriteRenderer sceneObject in sceneObjects)
		{
			if (sceneObject.sprite == null)
				continue;
			
			string name = sceneObject.sprite.name;
			if (name.Equals("cw_tree_2") || name.Equals("cw_tree_3") || name.Equals ("cw_tree_4") || name.Equals("cw_tree_5") || name.Equals("cw_tree_6"))
			{
				if (Vector3.Distance(panickedNPCPosition, sceneObject.gameObject.transform.position) < wanderRadius) {
					treeList.Add (sceneObject.gameObject);
				}
			}
		}
		
		this.SkinType = NPCSkinType.AxeMan;
	}
开发者ID:mezosaurus,项目名称:eae-project,代码行数:30,代码来源:EnemyAIController.cs

示例6: GetFiles

		/// <summary>
		/// Retorna uma lista de arquivos, pesquisando em todos os diretórios.
		/// </summary>
		/// <param name="filter">O filtro</param>
		public override HoloFile[] GetFiles(string filter)
		{
			ArrayList files = new ArrayList();
			foreach (HoloDirectory dir in dirs)
				files.AddRange(dir.GetFiles(filter));
			return (HoloFile[]) CollectionUtils.ToArray(typeof(HoloFile), files);
		}
开发者ID:elementar,项目名称:Suprifattus.Util,代码行数:11,代码来源:FallThroughDirectory.cs

示例7: OnTriggerEnter2D

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag ("Paddle")) {
            GameObject[] bricks = BrickController.GetBricks ();
            ArrayList hitBricks = new ArrayList ();

            if (bricks.Length <= destroyBlockCount) {
                //Just break all the bricks if we only have as many bricks left as we should hit
                hitBricks.AddRange (bricks);
            } else {
                //Select some random bricks.
                for (int i = 0; i < destroyBlockCount; i++) {
                    while (hitBricks.Count < i + 1) {
                        int index = Random.Range (0, bricks.Length - 1);
                        GameObject b = bricks [index];
                        if (!hitBricks.Contains (b)) {
                            hitBricks.Add (b);
                        }
                    }
                }
            }

            //Destroy some Bricks!
            foreach (GameObject b in hitBricks) {
                BrickController.HitBrick (b);
            }
            //Remove the carrot
            Destroy (this.gameObject);
        }
    }
开发者ID:jd4rider,项目名称:bunnybreakout,代码行数:30,代码来源:CatchCarrot.cs

示例8: EvaluateHand

 public static EvaluatedHand EvaluateHand(ArrayList hand, ArrayList board)
 {
     ArrayList cards = new ArrayList(hand);
     cards.AddRange(board);
     Card[][] cardArray = GenerateCardArray(cards);
     EvaluatedHand evaluatedHand = CreateStraightFlush(cardArray);
     if (evaluatedHand == null){
         evaluatedHand = CreateFourOfAKind(cardArray);
     }
     if (evaluatedHand == null){
         evaluatedHand = CreateFullHouse(cardArray);
     }
     if (evaluatedHand == null){
         evaluatedHand = CreateFlush(cardArray);
     }
     if (evaluatedHand == null){
         evaluatedHand = CreateStraight(cardArray);
     }
     if (evaluatedHand == null){
         evaluatedHand = CreateThreeOfAKind(cardArray);
     }
     if (evaluatedHand == null){
         evaluatedHand = CreateTwoPair(cardArray);
     }
     if (evaluatedHand == null){
         evaluatedHand = CreateOnePair(cardArray);
     }
     if (evaluatedHand == null){
         evaluatedHand = CreateHighCards(cardArray);
     }
     return evaluatedHand;
 }
开发者ID:kiichi7,项目名称:Lies_and_Seductions,代码行数:32,代码来源:HandEvaluator.cs

示例9: findDetachedVoxels

    public static ArrayList findDetachedVoxels(int [,,] mapData, int stopCode, IntVector3 point)
    {
        /*
        where i,j,k is a recently destroyed block, returns a list of IntVector3s of all blocks that should
        be detached, as well as the size of the blob that would contain them.
        */
        ArrayList detachedVoxels = new ArrayList ();

        allVisitedVoxels = new ArrayList ();
        ArrayList seeds = MDView.getNeighbors (mapData, point);

        for (int index=0; index<seeds.Count; index++) {

            IntVector3 seedPoint = (IntVector3)seeds [index];

            if (allVisitedVoxels.Contains (seedPoint)) {
                seeds.Remove (seedPoint);
                index--;
                continue;
            }

            ArrayList newVoxels = getBlob (mapData, stopCode, seedPoint);

            if (newVoxels.Count > 0) {
                detachedVoxels.AddRange (newVoxels);

            }

        }
        return detachedVoxels;
    }
开发者ID:Zulban,项目名称:viroid,代码行数:31,代码来源:MDPathfinder.cs

示例10: DestroyChildBlocks

    /// Destroy child blocks
    public ArrayList DestroyChildBlocks()
    {
        var childCubes = from Transform cube in this.transform
            where cube.name == "Cube"
            select cube.gameObject;

        if (childCubes == null) return new ArrayList();

        // sum up child cube score to set into parent score
        this.gameObject.GetComponent<CubeInfo>().score +=
            childCubes
            .Select(cube => cube.GetComponent<CubeInfo>().score)
            .Sum();

        // store child cubes position
        ArrayList destroyPositions = new ArrayList();
        destroyPositions.AddRange(
            childCubes
            .Select(childCube => childCube.transform.position)
            .ToList()
        );

        // destroy child cubes
        childCubes
            .ToList()
            .ForEach(MonoBehaviour.Destroy);

        // perform event
        if (WhenDestroyChild != null) {
            WhenDestroyChild(this, EventArgs.Empty);
        }

        return destroyPositions;
    }
开发者ID:nobuyo,项目名称:3J_class_project,代码行数:35,代码来源:BlockController.cs

示例11: initialize

    public void initialize(int numCharacters)
    {
        spawnPoints = new ArrayList ();

        for (int i = 1; i <= 40; i++) {
            GameObject tempObject = GameObject.Find("SpawnPoint" + i);

            if(tempObject)
                spawnPoints.Add(tempObject);
        }

        ArrayList initialSpawnPoints = new ArrayList();
        initialSpawnPoints.AddRange (spawnPoints);

        characterList = new ArrayList ();

        int randomSpawnIndex = Random.Range (0, initialSpawnPoints.Count - 1);
        makeCharacter("Player", "Materials/Player1Color", "Player", ((GameObject)initialSpawnPoints[randomSpawnIndex]).transform.position, new Color (0, 1, 0));
        initialSpawnPoints.RemoveAt (randomSpawnIndex);

        for(int j = 1; j < numCharacters; j++) {
            randomSpawnIndex = Random.Range (0, initialSpawnPoints.Count - 1);
            makeCharacter ("Player", "Materials/EnemyColor", "MediumAI", ((GameObject)initialSpawnPoints[randomSpawnIndex]).transform.position, new Color (1, 0, 0));
            initialSpawnPoints.RemoveAt (randomSpawnIndex);
        }
    }
开发者ID:Stran6,项目名称:ArcherArena,代码行数:26,代码来源:SpawnManager.cs

示例12: GetAllChildren

    public static ArrayList GetAllChildren(GameObject parentGameObject, string[] excludeSubstrings, bool includeParent = false)
    {
        //returns an arraylist of all children, grandchildren, etc.
        //excludes all objects and their children if their name contains any string in excludeSubstrings

        ArrayList children = new ArrayList();

        if (includeParent)
            children.Add(parentGameObject);

        for (int i = 0; i < parentGameObject.transform.childCount; i++)
        {
            GameObject child = parentGameObject.transform.GetChild(i).gameObject;
            bool excludeChild = false;
            foreach (string substring in excludeSubstrings)
            {
                if (child.name.Contains(substring))
                {
                    excludeChild = true;
                    break;
                }
            }
            if (excludeChild)
                continue;

            children.Add(child);
            if (child.transform.childCount > 0)
                children.AddRange(GetAllChildren(child, excludeSubstrings, false));
        }
        return children;
    }
开发者ID:B1sounours,项目名称:coulombic,代码行数:31,代码来源:ParentChildFunctions.cs

示例13: GetDirectoryFiles

 /// <summary>
 /// 指定されたフォルダ以下にあるすべてのファイルを取得する(サブフォルダは含まれない)
 /// </summary>
 /// <param name="folder">ファイルを検索するフォルダ名。</param>
 /// <param name="searchPattern">ファイル名検索文字列
 /// ワイルドカード指定子(*, ?)を使用する。</param>
 /// <param name="files">見つかったファイル名のリスト</param>
 public static void GetDirectoryFiles(string folder, string searchPattern, ref ArrayList files)
 {
     //folderにあるファイルを取得する
     string[] fs = System.IO.Directory.GetFiles (folder, searchPattern);
     //ArrayListに追加する
     files.AddRange (fs);
 }
开发者ID:yasuakiohama,项目名称:SocialConnector,代码行数:14,代码来源:DirectoryUtils.cs

示例14: InsertionSortArrayListTest

 public void InsertionSortArrayListTest(int[] toSortInts, int[] expectedSortedInts)
 {
     ArrayList<int> toSort = new ArrayList<int>();
     toSort.AddRange(toSortInts);
     toSort.InsertionSort();
     CollectionAssert.AreEqual(toSort, expectedSortedInts);
 }
开发者ID:rashed-cse08,项目名称:DSA,代码行数:7,代码来源:InsertionSorterTests.cs

示例15: moveTowards

 public void moveTowards(GameObject selectedTile)
 {
     if (!selectedTile) return;
     path = new ArrayList();
     ArrayList newPath = aStar(playerTile, selectedTile);
     if(newPath != null)
         path.AddRange(newPath);
 }
开发者ID:fataku,项目名称:Ambrosia,代码行数:8,代码来源:MovementHandler.cs


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