Ejemplo n.º 1
0
 public void SetPrivateSavepath(CargoType cargo, string path)
 {
     if (path.IsValidPath())
     {
         privateSavepathByCargo[cargo] = path;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Method to create cargo plane that drops our custom airdrops
        /// </summary>
        /// <param name="supplySignal">Supply signal that has initiated the custom airdrop (used for position & to cancel default airdrop)</param>
        /// <param name="cargoType">The type of cargo to drop (custom airdrop)</param>
        private void CallSpecializedCargoPlane(SupplySignal supplySignal, CargoType cargoType)
        {
            // Stop the normal cargo plane
            var cargoPlane = supplySignal.GetComponent <CargoPlane>();

            if (cargoPlane == null)
            {
                Interface.Oxide.LogDebug("Cargo plane not found");
            }
            NextTick(() => { cargoPlane?.Kill(); });

            // REMOVE WHEN FINISHED<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            var planes = UnityEngine.Object.FindObjectsOfType <CargoPlane>().ToList();

            Interface.Oxide.LogDebug($"Found {planes?.Count ?? 0} active cargo planes");
            foreach (var plane in planes)
            {
                Interface.Oxide.LogDebug($"Killing plane: {plane.name}");
                NextTick(() => { plane?.Kill(); });
            }

            // Service to create custom airdrops (type defined in constructor)
            var vehicleDroppingService = new VehicleDroppingService(cargoType);

            // Put the special cargo plane into action
            vehicleDroppingService.CallPlane(supplySignal.transform.position);
        }
Ejemplo n.º 3
0
    /*添加货物的的显示*/
    private void AddCargoObject(Direction dir, CargoType type)
    {
        GameObject obj = cargo_objPool[(int)type].GetObject();

        obj.transform.parent     = transform;
        obj.transform.localScale = new Vector3(1.0f / transform.localScale.x, 1.0f / transform.localScale.y, 1.0f / transform.localScale.z);
        switch (dir)
        {
        case Direction.UP:
            obj.transform.localPosition = new Vector3(0.0f, cargo_offset, 0.0f);
            break;

        case Direction.DOWN:
            obj.transform.localPosition = new Vector3(0.0f, -cargo_offset, 0.0f);
            break;

        case Direction.RIGHT:
            obj.transform.localPosition = new Vector3(cargo_offset, 0.0f, 0.0f);
            break;

        case Direction.LEFT:
            obj.transform.localPosition = new Vector3(-cargo_offset, 0.0f, 0.0f);
            break;
        }
        cargoes_obj[(int)dir] = obj;
    }
        public override void UpdateMenu(string path)
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine(path);
                CargoType entity = null;
                Console.WriteLine("1 - Редактировать по ID -->");
                Console.WriteLine("2 - Редактировать № -->");
                Console.WriteLine("3 - Выход -->");
                var consoleCommand = ReadIntValueFromConsole();
                if (consoleCommand == 1)
                {
                    Console.WriteLine("Введите Id --> ");
                    var id = ReadIntValueFromConsole();
                    entity = DAO.GetInstance().Repository <CargoType>().Find(id);
                    if (entity == null)
                    {
                        Console.Write("Сущьность с Id = " + id + " не найденна!!!");
                        Console.ReadKey();
                        break;
                    }
                }
                else if (consoleCommand == 2)
                {
                    Console.WriteLine("Введите номер записи --> ");
                    var pos  = ReadIntValueFromConsole();
                    var list = DAO.GetInstance().Repository <CargoType>().FindAll();
                    if (pos >= list.Count())
                    {
                        Console.WriteLine("Вы ввели не корректный номер!!!");
                        Console.ReadKey(); break;
                    }
                    entity = list[pos];
                }
                else if (consoleCommand == 3)
                {
                    break;
                }
                if (entity == null)
                {
                    break;
                }
                Console.WriteLine(entity.ToString());
                Console.WriteLine();

                Console.WriteLine("Введите название типа");
                entity.TypeName = Console.ReadLine();
                try
                {
                    DAO.GetInstance().Repository <CargoType>().SaveChanges();
                    Console.WriteLine("Изменения внесены!!!");
                }
                catch (Exception err)
                {
                    Console.WriteLine("Ошибка при сохранении изменений");
                }
                Console.ReadKey();
            }
        }
Ejemplo n.º 5
0
 public TradeGood(CargoType cargoType, int quantity, long priceBuy, long priceSell)
 {
     Type = cargoType;
     Quantity = quantity;
     PriceBuy = priceBuy;
     PriceSell = priceSell;
 }
Ejemplo n.º 6
0
 public MaritimeCargo(CargoQuality quality, City city, CargoType type)
     : base(0xA2C4)
 {
     CargoQuality = quality;
     City         = city;
     CargoType    = type;
 }
Ejemplo n.º 7
0
        private void ComboxCargo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            CargoType cargoType = (CargoType)ComboxCargo.SelectedValue;
            int       value;

            switch (cargoType)
            {
            case CargoType.Civilian:
                value = 50;
                break;

            case CargoType.Military:
                value = 100;
                break;

            case CargoType.Colony:
                value = 0;
                break;

            default:
                value = 0;
                break;
            }

            LblValue.Content = value;
        }
Ejemplo n.º 8
0
 public Vehicle(CargoType cargoType, string vClass, double speed, Cargo cargo = null)
 {
     CargoType    = cargoType;
     CurrentCargo = cargo;
     Speed        = speed;
     VehicleClass = vClass;
 }
Ejemplo n.º 9
0
    /// <summary>
    /// Listener del evento "OnScore" para el modo TimeAttack
    /// </summary>
    /// <param name="cargo"></param>
    void TimeAttackOnScoreListener(CargoType cargo)
    {
        //Checkeamos si se cumplió alguna misión!
        CargoDelivered CD = _cargosDelivered.Find(x => x.type == cargo);

        if (CD == null)
        {
            Debug.LogError("Cannot Find CargoType: " + cargo.ToString());
            return;
        }
        int  cargoamount = CD.delivered;
        bool b           = false;

        foreach (Quest q in myLevel.quests)
        {
            if (q.CheckQuest(cargoamount, WinCondition.Delivered, cargo))
            {
                b = true;
            }
        }
        //Si se cumplió alguna misión lanzamos el evento de misión completada (que tal vez complete otras misiones)
        if (b && OnCompeletedQuest != null)
        {
            OnCompeletedQuest(TimeController.s.timeSpent);
        }
        //foreach (QuestSlate qsd in FindObjectsOfType<QuestSlate>()) qsd.UpdateGUI();
    }
Ejemplo n.º 10
0
 /// <summary>
 /// Este metodo permita a scripts de fuera lanzar el Evento "OnScore"
 /// </summary>
 /// <param name="cargo"></param>
 public void OnScoreCall(CargoType cargo)
 {
     if (OnScore != null)
     {
         OnScore(cargo);
     }
 }
Ejemplo n.º 11
0
        public static IEnumerable <Manifest> Create(IEnumerable <SiteMetricProfile> profiles, EmrDto emrDto,
                                                    IEnumerable <Site> sites, CargoType type = CargoType.Patient)
        {
            var manifests = new List <Manifest>();

            if (emrDto.EmrSetup == EmrSetup.SingleFacility)
            {
                var site     = sites.OrderByDescending(x => x.PatientCount).First();
                var manifest = new Manifest(site, emrDto);
                manifest.AddCargo(profiles.Select(x => x.MetricId).ToList(), CargoType.Migration);
                manifests.Add(manifest);
                return(manifests);
            }

            // multi site setup

            foreach (var site in sites)
            {
                var manifest = new Manifest(site, emrDto);
                var pks      = profiles
                               .Where(x => x.SiteCode == site.SiteCode)
                               .Select(x => x.MetricId)
                               .ToList();
                manifest.AddCargo(pks, CargoType.Migration);
                manifests.Add(manifest);
            }
            return(manifests);
        }
Ejemplo n.º 12
0
        public ActionResult DeleteConfirmed(int id)
        {
            CargoType cargoType = db.cargoTypes.Find(id);

            db.cargoTypes.Remove(cargoType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
    private void OnCargoLoaded(CargoType type)
    {
        if (SingletonBehaviour <NetworkTrainManager> .Instance.IsChangeByNetwork || SingletonBehaviour <NetworkTrainManager> .Instance.IsSpawningTrains)
        {
            return;
        }

        SingletonBehaviour <NetworkTrainManager> .Instance.CargoStateChanged(trainCar, type, true);
    }
Ejemplo n.º 14
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            _CargoQuality = (CargoQuality)reader.ReadInt();
            _CargoType    = (CargoType)reader.ReadInt();
            _City         = (City)reader.ReadInt();
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            HashSet <Car> cars = new HashSet <Car>(new CarComparer());
            int           n    = int.Parse(Console.ReadLine());

            while (n-- > 0)
            {
                string[]  carData     = Console.ReadLine().Split();
                string    model       = carData[0];
                int       engineSpeed = int.Parse(carData[1]);
                int       enginePower = int.Parse(carData[2]);
                int       cargoWeight = int.Parse(carData[3]);
                CargoType cargoType   = Enum.Parse <CargoType>(carData[4]);

                Tire[] tires = new Tire[]
                {
                    new Tire(double.Parse(carData[5]), int.Parse(carData[6])),
                    new Tire(double.Parse(carData[7]), int.Parse(carData[8])),
                    new Tire(double.Parse(carData[9]), int.Parse(carData[10])),
                    new Tire(double.Parse(carData[11]), int.Parse(carData[12])),
                };

                Engine engine = new Engine(engineSpeed, enginePower);
                Cargo  cargo  = new Cargo(cargoWeight, cargoType);

                try
                {
                    Car car = new Car(model, engine, cargo, tires);
                    cars.Add(car);
                }
                catch (ArgumentOutOfRangeException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            string command = Console.ReadLine();

            switch (command)
            {
            case "fragile":
                cars.Where(c => c.Cargo.CargoType.ToString() == "fragile" && c.Tires.Any(t => t.Pressure < 1))
                .ToList()
                .ForEach(c => Console.WriteLine(c.Model));
                break;

            case "flamable":
                cars.Where(c => c.Cargo.CargoType.ToString() == "flamable" && c.Engine.Power > 250)
                .ToList()
                .ForEach(c => Console.WriteLine(c.Model));
                break;

            default:
                break;
            }
        }
Ejemplo n.º 16
0
 public ActionResult Edit([Bind(Include = "CargoTypeKey,CargoName,CargoValue")] CargoType cargoType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cargoType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cargoType));
 }
Ejemplo n.º 17
0
    /*递交货物*/
    public CargoType PassCargo(Direction dir)
    {
        int       index = (int)dir;
        CargoType c     = cargoes[index];

        cargoes[index] = CargoType.EMPTY;
        cargo_count--;
        DeleteCargoObject(index, c);
        return(c);
    }
Ejemplo n.º 18
0
        public void AddCargo(Metric metric, CargoType type = CargoType.Metrics)
        {
            if (null == metric)
            {
                return;
            }
            var items = JsonConvert.SerializeObject(metric);

            Cargoes.Add(new Cargo(type, items, Id));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 新增货物类型实体
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool AddCargoType(CargoType item)
        {
            var obj = DatabaseProvider.Insert(item);

            if (obj != null)
            {
                return(Convert.ToInt32(obj) > 0);
            }
            return(false);
        }
Ejemplo n.º 20
0
        public override void Insert()
        {
            Console.Write(string.Format("Insert {0}'s {1} : ", "CargoType", "Name"));
            string name      = Console.ReadLine();
            var    cargoType = new CargoType()
            {
                Name = name
            };

            _manager.Insert(cargoType);
        }
Ejemplo n.º 21
0
        public async Task AddCargoTypeAsync(SettingInputModel input)
        {
            var type = new CargoType
            {
                Name = input.Name,
            };

            await this.cargoTypes.AddAsync(type);

            await this.cargoTypes.SaveChangesAsync();
        }
Ejemplo n.º 22
0
        public static IEnumerable <Manifest> Create(IEnumerable <SitePatientProfile> profiles,
                                                    CargoType type = CargoType.Patient)
        {
            var manifests = new List <Manifest>();
            var p         = profiles.ToList();
            var m         = new Manifest(p.First().SiteCode, p.First().SiteName);

            m.AddCargo(p.Select(x => x.PatientPk).ToList());
            manifests.Add(m);
            return(manifests);
        }
Ejemplo n.º 23
0
        public void AddCargo(CargoType cargoType, object metric)
        {
            if (null == metric)
            {
                return;
            }

            var items = JsonConvert.SerializeObject(metric);

            FacMetrics.Add(new FacMetric(cargoType, items));
        }
Ejemplo n.º 24
0
        public ActionResult Create([Bind(Include = "CargoTypeKey,CargoName,CargoValue")] CargoType cargoType)
        {
            if (ModelState.IsValid)
            {
                db.cargoTypes.Add(cargoType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cargoType));
        }
Ejemplo n.º 25
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.CompareTag("Product"))
        {
            CargoType cargoT = col.GetComponent <Cargo> () != null?
                               col.GetComponent <Cargo> ().type : CargoType.Unknown;

            IncreasePile(cargoT);
            Destroy(col.gameObject);
        }
    }
Ejemplo n.º 26
0
 void OnScoreListener(CargoType cargoDelivered)
 {
     if (cargoDelivered != _myQuest.CargoType)
     {
         return;
     }
     if (_myQuest.completed && _myCargoDelivered.delivered > _myQuest.winAmount)
     {
         return;
     }
     ShowSlate();
 }
Ejemplo n.º 27
0
    public static MineralStats GetMineralStats(CargoType cargo)
    {
        // ReSharper disable once SwitchStatementMissingSomeCases
        switch (cargo)
        {
        case CargoType.Iron:
            return(new MineralStats(10, 0, 120, 270));

        case CargoType.Copper:
            return(new MineralStats(15, 0, 60, 150));

        case CargoType.Tin:
            return(new MineralStats(15, 8, 80, 150));

        case CargoType.Silver:
            return(new MineralStats(40, 20, 140, 140));

        case CargoType.Gold:
            return(new MineralStats(80, 40, 160, 140));

        case CargoType.Platinum:
            return(new MineralStats(150, 70, 180, 130));

        case CargoType.Emerald:
            return(new MineralStats(300, 85, 190, 100));

        case CargoType.Ruby:
            return(new MineralStats(300, 95, 190, 100));

        case CargoType.Diamond:
            return(new MineralStats(800, 135, MAP_HEIGHT, 50));

        case CargoType.Adamantium:
            return(new MineralStats(2000, 170, MAP_HEIGHT, 45));

        case CargoType.Unobtainium:
            return(new MineralStats(1000000, MAP_HEIGHT - 5, MAP_HEIGHT, 1));

        case CargoType.Bronze:
            return(new MineralStats(50, 0, 0, 0));

        case CargoType.Oragnium:
            return(new MineralStats(250, 0, 0, 0));

        case CargoType.Katanium:
            return(new MineralStats(3000, 0, 0, 0));

        default:
            Debug.LogError("lol rekt, Invalid value in GetMineralStats: " + cargo);
            return(new MineralStats(0, 0, 0, 0));
        }
    }
Ejemplo n.º 28
0
        public void StoreInputCargo(CargoType cargoType, float amount)
        {
            foreach (IndustryResource stock in inputStockpile)
            {
                if (stock.AcceptedItems.ContainsCargo(cargoType))
                {
                    stock.Amount += amount;
                    return;
                }
            }

            DVIndustry.ModEntry.Logger.Warning($"Tried to store an input ({cargoType}) that this industry doesn't accept");
        }
Ejemplo n.º 29
0
 public static ResourceClass SingleCargoClass(CargoType singleType)
 {
     if (singleResourceClassMap.TryGetValue(singleType, out var resource))
     {
         return(resource);
     }
     else
     {
         resource = new ResourceClass(singleType);
         singleResourceClassMap[singleType] = resource;
         return(resource);
     }
 }
Ejemplo n.º 30
0
    void IncreasePile(CargoType type)
    {
        if (cargo == CargoType.Unknown || amount == 0)
        {
            cargo = type;
        }
        else if (cargo != type)
        {
            cargo = CargoType.Mixed;
        }

        amount++;
    }
Ejemplo n.º 31
0
    /*接收货物*/
    public bool GetCargo(Direction dir, CargoType type)
    {
        int index = (int)dir;

        //Debug.Log(cargoes[index]);
        if (cargoes[index] == CargoType.EMPTY)
        {
            cargoes[index] = type;
            cargo_count++;
            AddCargoObject(dir, type);
            return(true);
        }
        return(false);
    }
Ejemplo n.º 32
0
 public Cargo(CargoType cargoType)
 {
     Type = cargoType;
     Quantity = 1;
 }
Ejemplo n.º 33
0
 public Cargo(CargoType cargoType)
 {
     this.Token = TokenGenerator.NextToken();
     this.Type = cargoType;
 }
Ejemplo n.º 34
0
 public Cargo(int cargoWeight, CargoType cargoType)
 {
     this.CargoWeight = cargoWeight;
     this.CargoType = cargoType;
 }
Ejemplo n.º 35
0
 public Cargo(CargoType cargoType, double density, double volume)
     : this(cargoType)
 {
     this.Density = density;
     this.Volume = volume;
 }
Ejemplo n.º 36
0
 public Cargo(CargoType cargoType, int quantity)
 {
     Type = cargoType;
     Quantity = quantity;
 }
Ejemplo n.º 37
0
 public TradeGood(CargoType cargoType)
 {
     Type = cargoType;
 }