Exemplo n.º 1
0
        public System.Windows.Forms.ListViewItem CreateVirtualListViewItem()
        {
            LVItem lvit = new LVItem();

            lvit.Text = Date.ToLongDateString();
            if (PrevItem == null)
            {
                lvit.SubItems.Add(Fuel.ToString());
                lvit.SubItems.Add(Ammo.ToString());
                lvit.SubItems.Add(Steel.ToString());
                lvit.SubItems.Add(Bauxite.ToString());
                lvit.SubItems.Add(FastRepair.ToString());
                lvit.SubItems.Add(FastBuild.ToString());
                lvit.SubItems.Add(Devel.ToString());
                lvit.SubItems.Add(Updater.ToString());
            }
            else
            {
                int diff = Fuel - PrevItem.Fuel;
                lvit.SubItems.Add(string.Format("{0}{1:(+#);(-#); }", Fuel, diff));

                diff = Ammo - PrevItem.Ammo;
                lvit.SubItems.Add(string.Format("{0}{1:(+#);(-#); }", Ammo, diff));

                diff = Steel - PrevItem.Steel;
                lvit.SubItems.Add(string.Format("{0}{1:(+#);(-#); }", Steel, diff));

                diff = Bauxite - PrevItem.Bauxite;
                lvit.SubItems.Add(string.Format("{0}{1:(+#);(-#); }", Bauxite, diff));

                diff = FastRepair - PrevItem.FastRepair;
                lvit.SubItems.Add(string.Format("{0}{1:(+#);(-#); }", FastRepair, diff));

                diff = FastBuild - PrevItem.FastBuild;
                lvit.SubItems.Add(string.Format("{0}{1:(+#);(-#); }", FastBuild, diff));

                diff = Devel - PrevItem.Devel;
                lvit.SubItems.Add(string.Format("{0}{1:(+#);(-#); }", Devel, diff));

                diff = Updater - PrevItem.Updater;
                lvit.SubItems.Add(string.Format("{0}{1:(+#);(-#); }", Updater, diff));
            }


            lvit.Info = this;

            return(lvit);
        }
Exemplo n.º 2
0
        private void setChart(DateTime date, int x_position, DateTime limit)
        {
            if (date.CompareTo(limit) == 0)
            {
                return;
            }
            Materials.Materials materials;
            string key = limit.ToString("yyyyMMdd");

            try
            {
                KanColleMaterialsGraph.MaterialsCache.TryGetValue(key, out materials);
            }
            catch (ArgumentNullException)
            {
                setChart(date, x_position += 1, limit.AddDays(1));
                return;
            }
            if (materials == null)
            {
                setChart(date, x_position += 1, limit.AddDays(1));
                return;
            }
            Fuel.Add(new Point {
                X = limit.ToOADate(), Y = materials.Fuel
            });
            Ammunition.Add(new Point {
                X = limit.ToOADate(), Y = materials.Ammunition
            });
            Steel.Add(new Point {
                X = limit.ToOADate(), Y = materials.Steel
            });
            Bauxite.Add(new Point {
                X = limit.ToOADate(), Y = materials.Bauxite
            });
            InstantRepairMaterials.Add(new Point {
                X = limit.ToOADate(), Y = materials.InstantRepairMaterials * 100
            });
            ImprovementMaterials.Add(new Point {
                X = limit.ToOADate(), Y = materials.ImprovementMaterials * 100
            });
            DateTimeXAxis xaxis = new DateTimeXAxis();

            setChart(date, x_position += 1, limit.AddDays(1));
            return;
        }
Exemplo n.º 3
0
        public ResourcePool(ResourceTypes resourceType, int numUnits, float depletedRate)
        {
            switch (resourceType)
            {
            case ResourceTypes.Bauxite:
                Resource = new Bauxite();
                break;

            case ResourceTypes.Hydrocarbons:
                Resource = new Hydrocarbons();
                break;

            case ResourceTypes.Hydrogen:
                Resource = new Hydrogen();
                break;

            case ResourceTypes.IronOre:
                Resource = new IronOre();
                break;

            case ResourceTypes.Medicine:
                Resource = new Medicine();
                break;

            case ResourceTypes.Organics:
                Resource = new Organics();
                break;

            case ResourceTypes.Silica:
                Resource = new Silica();
                break;

            case ResourceTypes.ThoriumOre:
                Resource = new ThoriumOre();
                break;

            default:
                throw new Exception("Error: " + resourceType.ToString() + " not defined in ResourcePool constructor.");
            }


            Resource.AddResource(numUnits);
            DepletedRate = depletedRate;
        }