コード例 #1
0
        public static T PopBack <T>(this IList <T> self)
        {
            if (self.IsNullOrEmpty <T>())
            {
                return(default(T));
            }
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            \u003C\u003E__AnonType10 <T, int> anonType10 = self.Select <T, \u003C\u003E__AnonType10 <T, int> >((Func <T, int, \u003C\u003E__AnonType10 <T, int> >)((value, index) => new \u003C\u003E__AnonType10 <T, int>(value, index))).Last <\u003C\u003E__AnonType10 <T, int> >();

            self.RemoveAt(anonType10.index);
            return(anonType10.value);
        }
コード例 #2
0
        public static void OrganizeItemList(this List <StuffItem> itemList)
        {
            // ISSUE: object of a compiler-generated type is created
            \u003C\u003E__AnonType10 <StuffItem, int>[] array = itemList.Select <StuffItem, \u003C\u003E__AnonType10 <StuffItem, int> >((Func <StuffItem, int, \u003C\u003E__AnonType10 <StuffItem, int> >)((value, index) => new \u003C\u003E__AnonType10 <StuffItem, int>(value, index))).ToArray <\u003C\u003E__AnonType10 <StuffItem, int> >();
            List <Tuple <int, StuffItem> > source             = ListPool <Tuple <int, StuffItem> > .Get();

            foreach (\u003C\u003E__AnonType10 <StuffItem, int> anonType10 in array)
            {
                // ISSUE: variable of a compiler-generated type
                \u003C\u003E__AnonType10 <StuffItem, int> item = anonType10;
                Tuple <int, StuffItem> tuple = source.Find((Predicate <Tuple <int, StuffItem> >)(x => x.Item2.CategoryID == item.value.CategoryID && x.Item2.ID == item.value.ID));
                if (tuple == null)
                {
                    source.Add(new Tuple <int, StuffItem>(item.index, new StuffItem(item.value)));
                }
                else
                {
                    tuple.Item2.Count += item.value.Count;
                    if (tuple.Item2.Count > Singleton <Resources> .Instance.DefinePack.MapDefines.ItemStackUpperLimit)
                    {
                        int count = tuple.Item2.Count - 99;
                        tuple.Item2.Count -= count;
                        StuffItem stuffItem = new StuffItem(tuple.Item2.CategoryID, tuple.Item2.ID, count);
                        int       num       = ((IEnumerable <\u003C\u003E__AnonType10 <StuffItem, int> >)array).Last <\u003C\u003E__AnonType10 <StuffItem, int> >().index + 1;
                        source.Add(new Tuple <int, StuffItem>(num, stuffItem));
                    }
                }
            }
            List <Tuple <int, StuffItem> > list = source.OrderBy <Tuple <int, StuffItem>, int>((Func <Tuple <int, StuffItem>, int>)(x => x.Item2.ID)).ToList <Tuple <int, StuffItem> >();
            List <StuffItem> toRelease          = ListPool <StuffItem> .Get();

            foreach (Tuple <int, StuffItem> tuple in list)
            {
                toRelease.Add(tuple.Item2);
            }
            itemList.Clear();
            itemList.AddRange((IEnumerable <StuffItem>)toRelease.ToArray());
            ListPool <StuffItem> .Release(toRelease);

            ListPool <Tuple <int, StuffItem> > .Release(list);
        }
コード例 #3
0
    protected bool CreateCalcInfo(GameObject obj)
    {
        if (Object.op_Equality((Object)null, (Object)obj))
        {
            return(false);
        }
        MorphSetting component1 = (MorphSetting)obj.GetComponent("MorphSetting");

        if (Object.op_Equality((Object)null, (Object)component1))
        {
            return(false);
        }
        this.CalcInfo = (MorphCalcInfo[])null;
        GC.Collect();
        this.CalcInfo = new MorphCalcInfo[component1.MorphDataList.Count];
        int index1 = 0;

        foreach (MorphData morphData in component1.MorphDataList)
        {
            if (!Object.op_Equality((Object)null, (Object)morphData.TargetObj))
            {
                this.CalcInfo[index1]           = new MorphCalcInfo();
                this.CalcInfo[index1].TargetObj = morphData.TargetObj;
                MeshFilter meshFilter = new MeshFilter();
                MeshFilter component2 = morphData.TargetObj.GetComponent(typeof(MeshFilter)) as MeshFilter;
                if (Object.op_Implicit((Object)component2))
                {
                    this.CalcInfo[index1].OriginalMesh   = component2.get_sharedMesh();
                    this.CalcInfo[index1].OriginalPos    = component2.get_sharedMesh().get_vertices();
                    this.CalcInfo[index1].OriginalNormal = component2.get_sharedMesh().get_normals();
                    this.CalcInfo[index1].WeightFlags    = false;
                }
                else
                {
                    SkinnedMeshRenderer skinnedMeshRenderer = new SkinnedMeshRenderer();
                    SkinnedMeshRenderer component3          = morphData.TargetObj.GetComponent(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer;
                    this.CalcInfo[index1].OriginalMesh   = component3.get_sharedMesh();
                    this.CalcInfo[index1].OriginalPos    = component3.get_sharedMesh().get_vertices();
                    this.CalcInfo[index1].OriginalNormal = component3.get_sharedMesh().get_normals();
                    this.CalcInfo[index1].WeightFlags    = true;
                }
                int length1;
                if (Object.op_Equality((Object)null, (Object)morphData.MorphArea))
                {
                    length1 = this.CalcInfo[index1].OriginalMesh.get_vertices().Length;
                    this.CalcInfo[index1].UpdateIndex = new int[length1];
                    for (int index2 = 0; index2 < length1; ++index2)
                    {
                        this.CalcInfo[index1].UpdateIndex[index2] = index2;
                    }
                }
                else if (morphData.MorphArea.get_colors().Length != 0)
                {
                    List <int> source = new List <int>();
                    // ISSUE: object of a compiler-generated type is created
                    using (IEnumerator <\u003C\u003E__AnonType10 <Color, int> > enumerator = ((IEnumerable <Color>)morphData.MorphArea.get_colors()).Select <Color, \u003C\u003E__AnonType10 <Color, int> >((Func <Color, int, \u003C\u003E__AnonType10 <Color, int> >)((value, index) => new \u003C\u003E__AnonType10 <Color, int>(value, index))).GetEnumerator())
                    {
                        while (((IEnumerator)enumerator).MoveNext())
                        {
                            // ISSUE: variable of a compiler-generated type
                            \u003C\u003E__AnonType10 <Color, int> current = enumerator.Current;
                            if (Color.op_Equality(current.value, morphData.AreaColor))
                            {
                                source.Add(current.index);
                            }
                        }
                    }
                    this.CalcInfo[index1].UpdateIndex = new int[source.Count];
                    // ISSUE: object of a compiler-generated type is created
                    foreach (\u003C\u003E__AnonType10 <int, int> anonType10 in source.Select <int, \u003C\u003E__AnonType10 <int, int> >((Func <int, int, \u003C\u003E__AnonType10 <int, int> >)((value, index) => new \u003C\u003E__AnonType10 <int, int>(value, index))))
                    {
                        this.CalcInfo[index1].UpdateIndex[anonType10.index] = anonType10.value;
                    }
                    length1 = source.Count;
                }
                else
                {
                    length1 = this.CalcInfo[index1].OriginalMesh.get_vertices().Length;
                    this.CalcInfo[index1].UpdateIndex = new int[length1];
                    for (int index2 = 0; index2 < length1; ++index2)
                    {
                        this.CalcInfo[index1].UpdateIndex[index2] = index2;
                    }
                }
                int length2 = morphData.MorphMesh.Length;
                this.CalcInfo[index1].UpdateInfo = new MorphUpdateInfo[length2];
                for (int index2 = 0; index2 < length2; ++index2)
                {
                    this.CalcInfo[index1].UpdateInfo[index2]         = new MorphUpdateInfo();
                    this.CalcInfo[index1].UpdateInfo[index2].Pos     = new Vector3[length1];
                    this.CalcInfo[index1].UpdateInfo[index2].Normmal = new Vector3[length1];
                    if (Object.op_Equality((Object)null, (Object)morphData.MorphMesh[index2]))
                    {
                        for (int index3 = 0; index3 < length1; ++index3)
                        {
                            this.CalcInfo[index1].UpdateInfo[index2].Pos[index3]     = this.CalcInfo[index1].OriginalMesh.get_vertices()[this.CalcInfo[index1].UpdateIndex[index3]];
                            this.CalcInfo[index1].UpdateInfo[index2].Normmal[index3] = this.CalcInfo[index1].OriginalMesh.get_normals()[this.CalcInfo[index1].UpdateIndex[index3]];
                        }
                    }
                    else
                    {
                        for (int index3 = 0; index3 < length1; ++index3)
                        {
                            this.CalcInfo[index1].UpdateInfo[index2].Pos[index3]     = morphData.MorphMesh[index2].get_vertices()[this.CalcInfo[index1].UpdateIndex[index3]];
                            this.CalcInfo[index1].UpdateInfo[index2].Normmal[index3] = morphData.MorphMesh[index2].get_normals()[this.CalcInfo[index1].UpdateIndex[index3]];
                        }
                    }
                }
                ++index1;
            }
        }
        return(true);
    }