예제 #1
0
            // Token: 0x06000094 RID: 148 RVA: 0x00007348 File Offset: 0x00005548
            private static void CamoSetup_Comp(Type compType, Func <ThingDef, bool> qualifier)
            {
                List <ThingDef> list = DefDatabase <ThingDef> .AllDefsListForReading.Where(qualifier).ToList();

                GenList.RemoveDuplicates <ThingDef>(list);
                foreach (ThingDef thingDef in list)
                {
                    if (thingDef.comps != null && !GenCollection.Any <CompProperties>(thingDef.comps, (Predicate <CompProperties>)((CompProperties c) => (object)((object)c).GetType() == compType)))
                    {
                        thingDef.comps.Add((CompProperties)(object)(CompProperties)Activator.CreateInstance(compType));
                    }
                    if (thingDef.IsApparel)
                    {
                        if (GenCollection.Any <CompProperties>(thingDef.comps, (CompProperties c) => c.GetType() == typeof(CompProperties_GearCamo)))
                        {
                            foreach (CompProperties compProperties in thingDef.comps)
                            {
                                if (compProperties.GetType() == typeof(CompProperties_GearCamo) && (compProperties as CompProperties_GearCamo).ActiveCamoEff > 0f && (compProperties as CompProperties_GearCamo).CamoEnergyMax > 0f && thingDef.thingClass == typeof(Apparel))
                                {
                                    thingDef.thingClass = typeof(ActiveCamoApparel);
                                    if (thingDef.tickerType != TickerType.Normal)
                                    {
                                        thingDef.tickerType = TickerType.Normal;
                                    }
                                }
                            }
                        }
                    }
                }
            }
예제 #2
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            GenList list = new GenList(window)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1
            };

            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (obj, part) =>
                {
                    return(string.Format("{0} - {1}", (string)obj, part));
                }
            };

            for (int i = 0; i < 100; i++)
            {
                list.Append(defaultClass, string.Format("{0} Item", i));
            }
            list.Show();
            list.ItemSelected += List_ItemSelected;;
            list.Geometry      = window.GetInnerSquare();
        }
예제 #3
0
        static void Main(string[] args)
        {
            GenList <int> l = new GenList <int>();

            l.PushBack(1);
            l.PushBack(2);
            l.PushBack(3);
            l.PushBack(4);
            l.Disp();

            GenList <int> l2 = (GenList <int>)l.Clone();

            foreach (int x in l)
            {
                Console.Write($"{x} ");
            }
            Console.WriteLine();
            Console.WriteLine(l[2]);
            l[2] = 10;
            l.Disp();
            l2.Disp();
            ArrayList arrL = l; // implicit conversion

            foreach (var x in arrL)
            {
                Console.Write($"{x} ");
            }
            Console.WriteLine();
        }
예제 #4
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            Box box = new Box(window);

            conformant.SetContent(box);
            box.Show();

            GenList list = new GenList(window)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1
            };

            Button button = new Button(window)
            {
                Text       = "Remove",
                AlignmentX = -1,
                AlignmentY = -1,
            };

            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (obj, part) =>
                {
                    return(string.Format("{0} - {1}", (string)obj, part));
                }
            };

            GenListItem[] itemArr = new GenListItem[9];
            for (int i = 0; i < 9; i++)
            {
                itemArr[i] = list.Append(defaultClass, string.Format("{0} Item", i));
            }

            int idx = 0;

            button.Clicked += (s, e) =>
            {
                if (idx < 9)
                {
                    Console.WriteLine("GenListItem deleted");
                    itemArr[idx++].Delete();
                }
            };
            button.Show();

            list.Show();
            list.ItemSelected   += List_ItemSelected;
            list.ItemRealized   += List_ItemRealized;
            list.ItemUnrealized += List_ItemUnrealized;

            box.PackEnd(list);
            box.PackEnd(button);
        }
예제 #5
0
        static void Main(string[] args)
        {
            var list = new GenList <int>();

            for (int i = 1; i < 5; i++)
            {
                list.AddToHead(i * 2);
                Console.WriteLine("Добавлено значение :" + i * 2);
            }

            list.GoToHead();
            try
            {
                for (int i = 1; i < 100; i++)
                {
                    Console.WriteLine("Значение элемента " + i + ": " + list.GetNext());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.ReadLine();
        }
예제 #6
0
        public void InitNet()
        {
            GenList.RemoveDuplicates(PipesThings);

            foreach (var thing in PipesThings)
            {
                Pipes.Add(thing.GetComp <CompPipe>());

                GasPlant gasPlant = thing.TryGetComp <GasPlant>();
                if (gasPlant != null)
                {
                    GasPlants.Add(gasPlant);
                }

                CompGasCooler compGasCooler = thing.TryGetComp <CompGasCooler>();
                if (compGasCooler != null)
                {
                    GasCoolers.Add(compGasCooler);
                }

                CompGasTank compGasTank = thing.TryGetComp <CompGasTank>();
                if (compGasTank != null)
                {
                    GasTankers.Add(compGasTank);
                }
            }

            if (GasCoolers.Count > 0)
            {
                CanPush = true;
            }

            PipesThings.ForEach(x => x.GetComp <CompPipe>().NetInit());
        }
예제 #7
0
        public string Get()
        {
            MovieLista   listaFilmes  = new MovieLista();
            GenList      listaGeneros = new GenList().Listar();
            List <Movie> filmes       = new List <Movie>();
            int          paging       = 1;
            int          totalPages   = 0;

            do
            {
                MovieList upCMovies = listaFilmes.Listar(paging);
                paging     = upCMovies.page;
                totalPages = upCMovies.total_pages;
                foreach (var movie in upCMovies.results)
                {
                    Movie filme = new Movie()
                    {
                        title        = movie.title,
                        release_date = movie.release_date,
                        genre        = new List <string>()
                    };
                    foreach (int genreId in movie.genre_ids)
                    {
                        filme.genre.Add(listaGeneros.genres.Where(g => g.id == genreId).First().name);
                    }

                    filmes.Add(filme);
                }
                paging++;
            } while (paging != totalPages + 1);

            return(JsonConvert.SerializeObject(filmes));
        }
예제 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter a number  :");
            string num = Console.ReadLine();
            int num1 = int.Parse(num);
            var number = new Nullable<int>(num1);

            Console.WriteLine("Has a value ?:  "+ number.HasValue);
            Console.WriteLine("Value :  "+ number.GetValueOrDefault());
            Console.WriteLine("");

            Console.WriteLine("enter a number :");
            string index = Console.ReadLine();
            Console.WriteLine("enter a Name :");
            string name = Console.ReadLine();

            var Nlist = new GenericDictionary<string,string>();
            Nlist.Add(index, name);

            var NList2 = new GenList<string,string>();
            NList2.Add(index,name);

            List<string> NewList = new List<string> { index, name, num };
            Console.WriteLine(NewList.LongCount());

            Console.WriteLine("choose 1, 2 or 3");
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(NewList[n-1]);


        }
예제 #9
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            GenList list = new GenList(window)
            {
                Homogeneous = true
            };

            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (obj, part) =>
                {
                    return(string.Format("{0} - {1}", (string)obj, part));
                }
            };

            for (int i = 0; i < 100; i++)
            {
                list.Append(defaultClass, string.Format("{0} Item", i));
            }
            list.Show();
            list.ItemSelected      += List_ItemSelected;;
            list.ItemActivated     += List_ItemActivated;
            list.ItemUnselected    += List_ItemUnselected;
            list.ItemPressed       += List_ItemPressed;
            list.ItemRealized      += List_ItemRealized;
            list.ItemReleased      += List_ItemReleased;
            list.ItemUnrealized    += List_ItemUnrealized;
            list.ItemLongPressed   += List_ItemLongPressed;
            list.ItemDoubleClicked += List_ItemDoubleClicked;

            list.Geometry = window.GetInnerSquare();
        }
        // Token: 0x060000F5 RID: 245 RVA: 0x00008F70 File Offset: 0x00007170
        public virtual void PerformPreFiringTreatment()
        {
            this.DetermineImpactExactPosition();
            Vector3 a    = (this.destinationInt - this.OriginIV3.ToVector3()).normalized * 0.9f;
            bool    flag = GenList.NullOrEmpty <Projectile_LaserConfig>(this.Def.graphicSettings);

            if (flag)
            {
                Vector3 s   = new Vector3(1f, 1f, (this.Destination - this.origin).magnitude - a.magnitude);
                Vector3 pos = this.OriginIV3.ToVector3() + a / 2f + (this.destinationInt - this.OriginIV3.ToVector3()) / 2f + Vector3.up * this.def.Altitude;
                this.drawingMatrix = new List <Matrix4x4>();
                Matrix4x4 item = default(Matrix4x4);
                item.SetTRS(pos, this.ExactRotation, s);
                this.drawingMatrix.Add(item);
            }
            else
            {
                this.drawingMatrix = new List <Matrix4x4>();
                bool flag2 = !this.Def.cycleThroughFiringPositions;
                if (flag2)
                {
                    foreach (Projectile_LaserConfig setting in this.Def.graphicSettings)
                    {
                        this.AddLaserGraphicUsing(setting);
                    }
                }
            }
        }
예제 #11
0
 public ActionResult GeneratorList(GenList gl)
 {
     if (ModelState.IsValid)
     {
         ViewBag.OK = true;
     }
     return(View(gl));
 }
예제 #12
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            GenList list = new GenList(window)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1
            };

            Button button = new Button(window)
            {
                Text       = "Remove",
                AlignmentX = -1,
                AlignmentY = -1,
            };

            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (obj, part) =>
                {
                    return(string.Format("{0} - {1}", (string)obj, part));
                }
            };

            GenListItem[] itemArr = new GenListItem[9];
            for (int i = 0; i < 9; i++)
            {
                itemArr[i] = list.Append(defaultClass, string.Format("{0} Item", i));
            }

            int idx = 0;

            button.Clicked += (s, e) =>
            {
                if (idx < 9)
                {
                    Console.WriteLine("GenListItem deleted");
                    itemArr[idx++].Delete();
                }
            };
            button.Show();

            list.Show();
            list.ItemSelected   += List_ItemSelected;
            list.ItemRealized   += List_ItemRealized;
            list.ItemUnrealized += List_ItemUnrealized;

            var square = window.GetInnerSquare();

            list.Geometry   = new Rect(square.X, square.Y, square.Width, square.Height * 3 / 4);
            button.Geometry = new Rect(square.X, square.Y + square.Height * 3 / 4, square.Width, square.Height / 4);
        }
예제 #13
0
        void Initialize(EvasObject parent)
        {
            _menu = new GenList(parent)
            {
                BackgroundColor = EColor.Transparent,
                Style           = "solid/default",
            };

            _menu.ItemSelected += (s, e) =>
            {
                MenuItemSelected?.Invoke(this, e);
            };

            _menu.Show();
            PackEnd(_menu);

            _defaultClass = new GenItemClass("double_label")
            {
                GetTextHandler = (obj, part) =>
                {
                    if (part == "elm.text")
                    {
                        return(((Item)obj).Title);
                    }
                    else
                    {
                        return(null);
                    }
                },
                GetContentHandler = (obj, part) =>
                {
                    if (part == "elm.swallow.icon")
                    {
                        var icon = ((Item)obj).Icon;

                        if (icon != null)
                        {
                            var image = new ElmSharp.Image(parent)
                            {
                                MinimumWidth  = Forms.ConvertToScaledPixel(24),
                                MinimumHeight = Forms.ConvertToScaledPixel(24)
                            };
                            var result = image.Load(ResourcePath.GetPath(icon));
                            return(image);
                        }
                        else
                        {
                            return(null);
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }
            };
        }
예제 #14
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            square = window.GetInnerSquare();

            Naviframe navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true,
                Geometry = square
            };

            box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Geometry   = new Rect(square.X, square.Y, square.Width, square.Height)
            };
            box.Show();

            box2          = new Box(box);
            box2.Geometry = new Rect(square.X, square.Y + square.Height / 6, square.Width, square.Height / 2);
            box2.Show();
            box.PackEnd(box2);

            list = new GenList(window)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1,
                Style       = "solid/default"
            };
            box.PackEnd(list);
            navi.Push(box, "Performance");

            InitializeListItem();

            list.Changed += List_Changed;
            list.ScrollAnimationStarted += List_ScrollAnimationStarted;
            list.ScrollAnimationStopped += List_ScrollAnimationStopped;
            list.Show();

            navi.Show();
            conformant.SetContent(navi);
        }
예제 #15
0
        private static void PeturbVerticesRandomly()
        {
            Perlin         perlin = new Perlin(0.0070000002160668373, 2.0, 0.5, 6, Rand.Range(0, 2147483647), QualityMode.Medium);
            List <Vector2> list   = GenList.ListFullCopy <Vector2>(TM_MeshMaker.verts2D);

            TM_MeshMaker.verts2D.Clear();
            for (int i = 0; i < list.Count; i++)
            {
                float   d    = 12f * (float)perlin.GetValue((double)i, 0.0, 0.0);
                Vector2 item = list[i] + d * Vector2.right;
                TM_MeshMaker.verts2D.Add(item);
            }
        }
        // Token: 0x06000100 RID: 256 RVA: 0x00009A08 File Offset: 0x00007C08
        public override void Draw()
        {
            base.Comps_PostDraw();
            bool flag = !GenList.NullOrEmpty <Matrix4x4>(this.drawingMatrix);

            if (flag)
            {
                foreach (Matrix4x4 matrix in this.drawingMatrix)
                {
                    Graphics.DrawMesh(MeshPool.plane10, matrix, FadedMaterialPool.FadedVersionOf(this.drawingTexture, this.drawingIntensity), 0);
                }
            }
        }
        // The list of things are all the growers we want to change
        void                                GroupPlantChange(List <Thing> things)
        {
            var thisGrower = Building_PlantGrower;

#if DEBUG
            if (thisGrower == null)
            {
                CCL_Log.TraceMod(
                    parent.def,
                    Verbosity.NonFatalErrors,
                    "Unable to resolve ThingClass to base Building_PlantGrower"
                    );
                return;
            }
#endif
            // Get plant to grow
            var plantDef = thisGrower.GetPlantDefToGrow();
            if (GenList.NullOrEmpty(plantDef?.plant?.sowTags))
            {
                // "Plant" doesn't contain the required information
                CCL_Log.TraceMod(
                    parent.def,
                    Verbosity.Warnings,
                    "Unable to resolve plant def to grow"
                    );
                return;
            }

            // Now set their plant
            foreach (Thing g in things)
            {
                // Should be a Building_PlantGrower
                var grower = g as Building_PlantGrower;
#if DEBUG
                if (string.IsNullOrEmpty(grower?.def?.building.sowTag))
                {
                    CCL_Log.TraceMod(
                        parent.def,
                        Verbosity.Warnings,
                        "Unable to resolve other things ThingClass to base Building_PlantGrower"
                        );
                    return;
                }
#endif
                // Only set if the sow tags match
                if (plantDef.plant.sowTags.Contains(grower.def.building.sowTag))
                {
                    grower.SetPlantDefToGrow(plantDef);
                }
            }
        }
예제 #18
0
        internal static void Postfix(int tile, ref IEnumerable <ThingDef> __result, ref World __instance)
        {
            Traverse  traverse = Traverse.Create(__instance);
            WorldGrid value    = traverse.Field("grid").GetValue <WorldGrid>();
            bool      flag     = value[tile].biome.defName.Equals("RockMoonBiome");

            if (flag)
            {
                List <ThingDef> list1 = new List <ThingDef>();

                list1.Add(DefDatabase <ThingDef> .GetNamed("BiomesNEO_MariaRock"));
                list1.Add(DefDatabase <ThingDef> .GetNamed("BiomesNEO_HighlandRock"));
                __result = list1; Find.World.NaturalRockTypesIn(1);
            }
            else
            {
                bool flag2 = __result.Contains(DefDatabase <ThingDef> .GetNamed("BiomesNEO_HighlandRock"));
                bool flag4 = __result.Contains(DefDatabase <ThingDef> .GetNamed("BiomesNEO_MariaRock"));
                if (flag2 || flag4)
                {
                    Rand.PushState();
                    Rand.Seed = tile;
                    List <ThingDef> rocks = __result.ToList <ThingDef>();
                    if (flag2)
                    {
                        rocks.Remove(DefDatabase <ThingDef> .GetNamed("BiomesNEO_HighlandRock"));
                    }
                    if (flag4)
                    {
                        rocks.Remove(DefDatabase <ThingDef> .GetNamed("BiomesNEO_MariaRock"));
                    }
                    List <ThingDef> list2 = (from d in DefDatabase <ThingDef> .AllDefs
                                             where d.category.Equals(ThingCategory.Building) &&
                                             d.building.isNaturalRock &&
                                             !d.building.isResourceRock &&
                                             !d.IsSmoothed &&
                                             !rocks.Contains(d) &&
                                             d.defName != "BiomesNEO_HighlandRock" &&
                                             d.defName != "BiomesNEO_MariaRock"
                                             select d).ToList <ThingDef>();

                    bool flag3 = !GenList.NullOrEmpty <ThingDef>(list2);
                    if (flag3)
                    {
                        rocks.Add(GenCollection.RandomElement <ThingDef>(list2));
                    }
                    __result = rocks;
                    Rand.PopState();
                }
            }
        }
    public void ReferencesAreNotMaintained()
    {
        var object1 = new GenList()
        {
            Col1 = "a", Col2 = "b"
        };
        var cloned = object1.DeepClone();

        Assert.AreEqual(object1.Col1, cloned.Col1);
        Assert.AreEqual(object1.Col2, cloned.Col2);
        cloned.Col1 = "c";
        cloned.Col2 = "d";
        Assert.AreNotEqual(object1.Col1, cloned.Col1);
        Assert.AreNotEqual(object1.Col2, cloned.Col2);
    }
 public static T EndOnNoTargetInQueue <T>(this T f, TargetIndex ind, JobCondition endCondition = JobCondition.Incompletable) where T : IJobEndable
 {
     f.AddEndCondition(delegate
     {
         Pawn actor = f.GetActor();
         Job curJob = actor.jobs.curJob;
         List <LocalTargetInfo> targetQueue = curJob.GetTargetQueue(ind);
         if (GenList.NullOrEmpty <LocalTargetInfo>((IList <LocalTargetInfo>)targetQueue))
         {
             return(endCondition);
         }
         return(JobCondition.Ongoing);
     });
     return(f);
 }
예제 #21
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };
            box.Show();

            box2 = new Box(box);
            //elm_box_padding_set(box2, ELM_SCALE_SIZE(10), ELM_SCALE_SIZE(10)); ºÎºÐ ºüÁü.
            box2.Show();
            box.PackEnd(box2);

            list = new GenList(window)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1,
                Style       = "solid/default"
            };
            box.PackEnd(list);
            navi.Push(box, "Performance");

            InitializeListItem();

            list.Changed += List_Changed;
            list.ScrollAnimationStarted += List_ScrollAnimationStarted;
            list.ScrollAnimationStopped += List_ScrollAnimationStopped;
            list.Show();

            navi.Show();
            conformant.SetContent(navi);
        }
 private DevOptionDialog()
 {
     DispatcherHelpers.RunOnDispatcher(() =>
     {
         _popup = new Popup(ReactProgram.RctWindow)
         {
         };
         //_conformant = new Conformant(_popup);
         _list = new GenList(_popup)
         {
             Homogeneous = true,
             ListMode    = GenListMode.Expand,
         };
         _list.ItemSelected += ItemSelected;
     });
 }
예제 #23
0
 static void Main(string[] args)
 {
     //Test
     GenList<int> start = new GenList<int>();
     start.Add(1);
     start.Add(2);
     start.Add(3);
     Console.WriteLine(start.Capacity);
     Console.WriteLine(start.Count);
     start.RemoveAt(2);
     Console.WriteLine(start.Count);
     start.InsertElementAt(1, 7);
     Console.WriteLine(start.Count);
     Console.WriteLine( start.ToString());
     Console.WriteLine(start.Max<int>());
     Console.WriteLine(start.Min<int>());
 }