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


C# System.Collections.Generic.List.Remove方法代码示例

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


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

示例1: AttributeUpDown_ValueChanged

        //this is code to adjust the maximum value of the attribute up downs. Only one attribute can max out.
        //there is corresponding code in the AttributeUpDown class and in the Character class that works to achieve this
        public void AttributeUpDown_ValueChanged(object sender, EventArgs e)
        {
            AttributeUpDown attribute = (AttributeUpDown)sender;

            System.Collections.Generic.List<AttributeUpDown> upDowns = new System.Collections.Generic.List<AttributeUpDown>();
            upDowns.Add(agilityUpDown);
            upDowns.Add(strengthUpDown);
            upDowns.Add(bodyUpDown);
            upDowns.Add(reactionUpDown);
            upDowns.Add(logicUpDown);
            upDowns.Add(charismaUpDown);
            upDowns.Add(intuitionUpDown);
            upDowns.Add(willpowerUpDown);

            if (character.attributeMax == false)
            {
                if (attribute.Value == attribute.Maximum)
                {
                    upDowns.Remove(attribute);

                    foreach (AttributeUpDown n in upDowns)
                    {
                        n.Maximum = n.Maximum - 1;
                        n.maxReached = true;
                    }

                    character.attributeMax = true;
                }
            }
            else if (character.attributeMax == true && attribute.maxReached == false)
            {
                upDowns.Remove(attribute);

                foreach (AttributeUpDown n in upDowns)
                {
                    n.Maximum = n.Maximum + 1;
                    n.maxReached = false;
                }

                character.attributeMax = false;
            }
        }
开发者ID:RobotOptimist,项目名称:Shadowrun-maker,代码行数:44,代码来源:CharUpdater.cs

示例2: GenerateMovementTree

    // CALL THIS EVERY TIME A UNIT GETS A NEW TURN
    public static void GenerateMovementTree(UnitActions mover)
    {
        System.Collections.Generic.List<Tile> all = new System.Collections.Generic.List<Tile>();
        //optimization
        int mx = (int)mover.gridPosition.x;
        int my = (int)mover.gridPosition.y;
        int mxmin = mx - mover.MovementTiles;
        int mxmax = mx + mover.MovementTiles;
        int mymin = my - mover.MovementTiles;
        int mymax = my + mover.MovementTiles;
        if (mxmin < 0)
            mxmin = 0;
        if (mxmax >= GameManager.MapWidth)
            mxmax = GameManager.MapWidth - 1;
        if (mymin < 0)
            mymin = 0;
        if (mymax >= GameManager.MapHeight)
            mymax = GameManager.MapHeight - 1;
        Tile temp = GetTileFromPlayer(mover);
        for (int i = mxmin; i <= mxmax; ++i)
        {
            for (int j = mymin; j <= mymax; ++j)
            {
                if (GetDistance(temp, GameManager.map[i][j]) < mover.MovementTiles + 1)
                    if (true) //TODO replace this with a check to see if the mover can walk on map[i][j]
                        all.Add(GameManager.map[i][j]);
            }
        }
        //TODO This will need to be tweaked if we allow movement through allied units
        //if allied movement is desired, this foreach can be removed to allow it, but you'll need to manually remove player location tiles
        // from the output of getmovement or they'll be able to walk into each other
        //uncomment this to make it so that allied units block player movement
        /*foreach (Player p in GameManager.currentTeam.myRoster)
        {
            temp = GetTileFromPlayer(p);
            if (all.Contains(temp))
                all.Remove(temp);
        }*/
        foreach (UnitActions p in GameManager.enemyTeam.myRoster)
        {
            temp = GetTileFromPlayer(p);
            if (all.Contains(temp))
                all.Remove(temp);
        }

        //Dijkstra's Algorithm
        Dictionary<Tile, int> weights = new Dictionary<Tile, int>();
        List<Tile> unvisited = new List<Tile>();
        Dictionary<Tile, Tile> nextParent = new Dictionary<Tile, Tile>();
        foreach (Tile t in all)
        {
            weights.Add(t, Infinity);
            unvisited.Add(t);
        }
        temp = GetTileFromPlayer(mover);
        weights[temp] = 0;
        unvisited.Remove(temp);
        CurrentMovementTree.Clear();
        CurrentMovementTree.Value = temp;
        while (unvisited.Count > 0)
        {
            List<Tile> uvn = GetUnvisitedNeighbors(unvisited, temp);
            int dist;
            foreach (Tile t in uvn)
            {
                float jdist = t.elevation - temp.elevation;
                if (jdist < 0)
                    jdist *= -1;
                if (t.isAccessible && jdist <= mover.MovementJump)
                    dist = t.MoveCost + weights[temp];
                else
                    dist = Infinity;
                if (dist < weights[t])
                {
                    weights[t] = dist;
                    if (nextParent.ContainsKey(t))
                        nextParent[t] = temp;
                    else
                        nextParent.Add(t, temp);
                }
            }
            if (unvisited.Count > 0)
            {
                temp = unvisited[0];
                foreach (Tile t in weights.Keys)
                {
                    if (unvisited.Contains(t) && weights[t] < weights[temp])
                        temp = t;
                }
            }
            unvisited.Remove(temp);
        }
        Queue<Tile> distancecheck = new Queue<Tile>();
        foreach (Tile t in nextParent.Keys)
        {
            distancecheck.Enqueue(t);
        }
        Queue<Tile> Remove = new Queue<Tile>();
        while (distancecheck.Count > 0)
//.........这里部分代码省略.........
开发者ID:point01,项目名称:Square-Wars,代码行数:101,代码来源:Movement.cs

示例3: kuaJu


//.........这里部分代码省略.........
                                result.Add(allNum[i]);
                            }
                        }
                    }
                }
                else
                {
                    result.AddRange(allNum);
                }

                List<string> result1 = result.Distinct().ToList();//去除重复项
                return result1.ToArray();
            }
            else
            {
                List<int> nums = new List<int>();
                result.AddRange(allNum);

                foreach (Control ctls in this.kuaJuGpb.Controls)
                {
                    bool isNum = isNumber(ctls.Text);
                    if ((ctls as CheckBox).Checked == true && isNum == true)
                    {
                        nums.Add(Convert.ToInt16(ctls.Text));
                    }
                }

                if (nums.Count > 0)
                {
                    for (int i = 0; i < allNum.Count(); i++)
                    {
                        for (int j = 0; j < nums.Count(); j++)
                        {
                            int a = Convert.ToInt32(allNum[i].Substring(0, 1));
                            int b = Convert.ToInt32(allNum[i].Substring(1, 1));
                            int c = Convert.ToInt32(allNum[i].Substring(2, 1));
                            int max = 0;
                            int min = 0;

                            if (a > b)
                            {
                                if (a > c)
                                {
                                    max = a;
                                }
                                else
                                {
                                    max = c;
                                }
                            }
                            else
                            {
                                if (b > c)
                                {
                                    max = b;
                                }
                                else
                                {
                                    max = c;
                                }
                            }

                            if (a < b)
                            {
                                if (a < c)
                                {
                                    min = a;
                                }
                                else
                                {
                                    min = c;
                                }
                            }
                            else
                            {
                                if (b < c)
                                {
                                    min = b;
                                }
                                else
                                {
                                    min = c;
                                }
                            }

                            if (
                                max - min == nums[j]
                            )
                            {
                                result.Remove(allNum[i]);
                            }
                        }
                    }
                }

                List<string> result1 = result.Distinct().ToList();//去除重复项
                return result1.ToArray();

            }
        }
开发者ID:svn2github,项目名称:eztx,代码行数:101,代码来源:page3.cs

示例4: DoRestart

        void DoRestart()
        {
            System.Collections.Generic.List<string> args =
                new System.Collections.Generic.List<string>();
            var cmds = System.Environment.GetCommandLineArgs();
            foreach (string a in cmds)
                args.Add(a);

            args.RemoveAt(0);
            args.Remove("-restart");

            string sArgs = string.Empty;
            foreach(string s in args)
                sArgs += (s + " ");

            sArgs += " -restart";

            Process.Start("Elpis.exe", sArgs);
        }
开发者ID:CristaliS,项目名称:Elpis,代码行数:19,代码来源:MainWindow.xaml.cs

示例5: Main

        static void Main(string[] args)
        {
            int hSeg = 16;
            int vSeg = 8;
            mikity.index myIndex = new mikity.index();                  //節点番号と座標変数の対応表
            mikity.index mask = new mikity.index();                  //節点番号と座標変数の対応表
            mikity.shape myShape = new mikity.shape();                  //座標変数
            mikity.elements Triangles = new mikity.elements();          //三角形要素
            mikity.elements myElements = new mikity.elements();         //張力要素リスト
            mikity.elements Border = new mikity.elements();         //境界要素リスト

            //形状定義
            System.Random rand = new System.Random(0);
            for (int i = 0; i < hSeg; i++)
            {
                for (int j = 0; j < vSeg + 1; j++)
                {
                    int num = i + j * (hSeg);
                    myIndex.Add(new int[3] { num * 3, num * 3 + 1, num * 3 + 2 });
                    myShape.AddRange(new double[3] { (rand.NextDouble() - 0.5) * 15d, (rand.NextDouble() - 0.5) * 15d, (rand.NextDouble() - 0.5) * 15d });
                }
            }
            double Radius = 10.0;
            for (int i = 0; i < hSeg; i++)
            {
                int num = i + 0 * (hSeg);
                mask.Add(myIndex[num]);
                double theta = System.Math.PI * 2 / hSeg * i;
                myShape[mask.Last()] = new double[3] { Radius*System.Math.Cos(theta), Radius*System.Math.Sin(theta), -2.0 };
            }
            for (int i = 0; i < hSeg; i++)
            {
                int num = i + vSeg * (hSeg);
                double theta = System.Math.PI * 2 / hSeg * i;
                mask.Add(myIndex[num]);
                myShape[mask.Last()] = new double[3] { Radius * System.Math.Cos(theta), Radius * System.Math.Sin(theta), 0.0 };
            }
            //基準正方形を構成する2つの三角形
            int[,] _t = (matrix_INT)(new int[2, 2] { { 0, 1 }, { hSeg, hSeg+1 } });
            Triangles.Add(new int[3] { _t[0, 0], _t[0, 1], _t[1, 0] });
            Triangles.Add(new int[3] { _t[0, 1], _t[1, 1], _t[1, 0] });
            int[] tmp = vector.lin(0, 1);
            //作成した基準正方形を並べて行を作成
            for (int i = 1; i < hSeg; i++)
            {
                Triangles.AddRange((elements)Triangles[tmp] + i);
            }
            Triangles[Triangles.Count-2][1] = 0;
            Triangles[Triangles.Count-1][0] = 0;
            Triangles[Triangles.Count-1][1] = hSeg;
            //作成した基準行を並べて膜を作成
            tmp = vector.lin(0, 2*hSeg-1);
            for (int i = 1; i < vSeg; i++)
            {
                Triangles.AddRange((elements)Triangles[tmp] + i * (hSeg));

            }
            myElements.AddRange(Triangles);

            //3項法の準備
            mikity.term p = new mikity.term(myShape.Count);          //加速度
            mikity.term q = new mikity.term(myShape.Count);          //速度
            mikity.term x = new mikity.term(myShape);                //位置

            //GUIと可変パラメータの準備
            mikity.visualize.FigureUI figUI = new mikity.visualize.FigureUI();
            //時間の刻み幅
            mikity.visualize.slider s1 = figUI.addSlider(min: 1, step: 2, max: 44, val: 38, text: "dt");
            s1.Converter = val => Math.Pow(10, ((double)val / 10) - 4.8) * 2.0;
            System.Collections.Generic.List<double> dt = new System.Collections.Generic.List<double>();
            //リング間の距離
            mikity.visualize.slider s2 = figUI.addSlider(min: 0, step: 2, max: 4000, val: 800, text: "Ring");
            s2.Converter = val => (val)/200;
            //描画ウインドウの準備
            mikity.visualize.figure3D myFigure = new mikity.visualize.figure3D();
            myFigure.xtitle = "Tanzbrunnen";
            System.Collections.Generic.List<double> fps = new System.Collections.Generic.List<double>();
            System.Collections.Generic.List<int> ticks = new System.Collections.Generic.List<int>();
            ticks.AddRange(new int[101]);
            //3項法のメインループ
            int t = 0;
            mikity.visualize.drawelements.scale(0.5);
            while (figUI.Exit == false)
            {
                if (figUI.Pause == false)
                {
                    t++;
                    ticks.Add(System.Environment.TickCount);
                    ticks.Remove(ticks[0]);
                    fps.Add((double)1000 / (ticks[100] - ticks[0]) * 100);
                    dt.Add(s1.value);
                    double w1 = s2.value;//リング
                    for (int i = 0; i < hSeg; i++)
                    {
                        double theta = System.Math.PI * 2 / hSeg * i;
                        myShape[mask[i]] = new double[3] { Radius * System.Math.Cos(theta), Radius * System.Math.Sin(theta), -w1 };
                    }
                    for (int i = 0; i < hSeg; i++)
                    {
                        double theta = System.Math.PI * 2 / hSeg * i;
//.........这里部分代码省略.........
开发者ID:mikity-mikity,项目名称:ForceDiagram,代码行数:101,代码来源:Program.cs

示例6: sumZhi

        //和值
        public string[] sumZhi()
        {
            System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
            string[] allNum = locChaExecute();

            if (this.killHeZhi.Checked == false)
            {
                List<int> nums = new List<int>();
                foreach (Control ctls in this.sumZhiGbp.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums.Add(Convert.ToInt16(ctls.Text));
                    }
                }
                if (nums.Count > 0)
                {
                    for (int i = 0; i < allNum.Count(); i++)
                    {
                        for (int j = 0; j < nums.Count(); j++)
                        {
                            int allNumSum = Convert.ToInt32(allNum[i].Substring(0, 1)) + Convert.ToInt32(allNum[i].Substring(1, 1)) + Convert.ToInt32(allNum[i].Substring(2, 1));
                            if (
                                allNumSum == nums[j]
                            )
                            {
                                result.Add(allNum[i]);
                            }
                        }
                    }
                }
                else
                {
                    result.AddRange(allNum);
                }
                List<string> result1 = result.Distinct().ToList();//去除重复项
                return result1.ToArray();
            }
            else
            {
                List<int> nums = new List<int>();
                result.AddRange(allNum);
                foreach (Control ctls in this.sumZhiGbp.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums.Add(Convert.ToInt16(ctls.Text));
                    }
                }
                if (nums.Count > 0)
                {
                    for (int i = 0; i < allNum.Count(); i++)
                    {
                        for (int j = 0; j < nums.Count(); j++)
                        {
                            int allNumSum = Convert.ToInt32(allNum[i].Substring(0, 1)) + Convert.ToInt32(allNum[i].Substring(1, 1)) + Convert.ToInt32(allNum[i].Substring(2, 1));
                            if (
                                allNumSum == nums[j]
                            )
                            {
                                result.Remove(allNum[i]);
                            }
                        }
                    }
                }
                List<string> result1 = result.Distinct().ToList();//去除重复项
                return result1.ToArray();
            }
        }
开发者ID:svn2github,项目名称:eztx,代码行数:70,代码来源:page2.cs

示例7: OptimizeCommands

        /// <summary>
        /// Creates Compound commands if necessary
        /// </summary>
        /// <param name="commands"></param>
        private Command[] OptimizeCommands(SyncEngine engine, IList<Entity> commands)
        {
            if (commands == null)
                throw new ArgumentNullException("commands");

            if (commands.Count == 0)
                return new Command[0];

            HashedList<Command> optimizedCommands = new HashedList<Command>();

            System.Collections.Generic.List<CompoundCreateCommand> createdCommands = new System.Collections.Generic.List<CompoundCreateCommand>();

            int j;

            for (int i = 0; i < commands.Count; i++)
            {
                Entity e = commands[i];

                string currentId = e.GetString(SyncUtils.PARENTID);
                int transaction = e.GetInt32(SyncUtils.TRANSACTION);

                switch (e.Type)
                {
                    case SyncUtils.CREATE_ENTITY:

                        string createType = e.GetString(SyncUtils.TYPE);

                        j = i + 1;

                        CompoundCreateCommand ccc = new CompoundCreateCommand(currentId, createType, new List<AttributeCommand>());

                        CompoundCreateCommand actual = createdCommands.Find(delegate(CompoundCreateCommand toFind)
                        {
                            return toFind.ClientId == ccc.ClientId &&
                                toFind.ParentId == ccc.ParentId &&
                                toFind.Type == ccc.Type;
                        });

                        if (actual == null)
                        {
                            createdCommands.Add(ccc);
                            optimizedCommands.Add(ccc);

                            while (j < commands.Count)
                            {

                                string subType = commands[j].GetString(SyncUtils.PARENTTYPE);
                                string subId = commands[j].GetString(SyncUtils.PARENTID);
                                int subTransaction = commands[j].GetInt32(SyncUtils.TRANSACTION);
                                string subCommand = commands[j].Type;

                                if (commands[j].Type == SyncUtils.CREATE_ATTRIBUTE && subId == currentId && subType == createType)
                                {
                                    if (subTransaction != transaction)
                                        break;

                                    ccc.InnerCommands.Add((AttributeCommand)engine.CreateCommand(commands[j]));
                                    commands.RemoveAt(j);
                                }
                                else
                                {
                                    j++;
                                }
                            }
                        }
                        else
                        {
                            optimizedCommands.Remove(actual);
                            optimizedCommands.Add(ccc);

                            createdCommands.Remove(actual);
                            createdCommands.Add(ccc);
                        }

                        break;

                    case SyncUtils.UPDATE_ATTRIBUTE:

                        string updateType = e.GetString(SyncUtils.PARENTTYPE);

                        j = i + 1;

                        CompoundUpdateCommand cuc = new CompoundUpdateCommand(currentId, updateType, new List<AttributeCommand>());
                        cuc.InnerCommands.Add((AttributeCommand)engine.CreateCommand(commands[i]));
                        optimizedCommands.Add(cuc);

                        while (j < commands.Count)
                        {
                            string subType = commands[j].GetString(SyncUtils.PARENTTYPE);
                            string subId = commands[j].GetString(SyncUtils.PARENTID);
                            int subTransaction = commands[j].GetInt32(SyncUtils.TRANSACTION);
                            string subCommand = commands[j].Type;

                            if (commands[j].Type == SyncUtils.UPDATE_ATTRIBUTE && subId == currentId && subType == updateType)
                            {
                                if (subTransaction != transaction)
//.........这里部分代码省略.........
开发者ID:npenin,项目名称:uss,代码行数:101,代码来源:Synchronizer.cs


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