Exemplo n.º 1
0
        private Vector3 GetGarbageCheckPointPosition(int route, int checkPoint)
        {
            // Get the garbage
            GarbageModel garbage = Constants.GARBAGE_LIST.Where(garbageModel => garbageModel.route == route && garbageModel.checkPoint == checkPoint).FirstOrDefault();

            return(garbage?.position);
        }
Exemplo n.º 2
0
        public void AddGarbage(Client sender, int prop = 0)
        {
            if (!sender.HasRank(ServerRank.AdministratorRozgrywki2))
            {
                sender.SendWarning("Nie posiadasz uprawnień do tworzenia śmietnika.");
                return;
            }

            sender.SendInfo("Ustaw się w wybranej pozycji, a następnie wpisz \"tu\", użyj ctrl + alt + shift + d aby poznać swoją obecną pozycję.");

            void Handler(Client o, string command)
            {
                if (o == sender && command == "tu")
                {
                    GarbageModel garbage = new GarbageModel
                    {
                        GtaPropId        = prop,
                        CreatorForumName = sender.GetAccountEntity().DbModel.Name,
                        Position         = sender.Position,
                        Rotation         = sender.Rotation
                    };

                    XmlHelper.AddXmlObject(garbage, Path.Combine(Utils.XmlDirectory, "JobGarbages"));
                    Garbages.Add(garbage);
                    sender.SendInfo("Dodawanie śmietnika zakończyło się pomyślnie.");
                }
            }
        }
Exemplo n.º 3
0
    void Awake()
    {
        view  = GetComponent <BagView>();
        model = GarbageModel.Instance;

        view.Btn_Close.onClick.AddListener(() => gameObject.SetActive(false));
        model.addGarbage += AddGarbage;
    }
        public override void Start()
        {
            GarbageModel v = NonVisitedPoints[new Random().Next(NonVisitedPoints.Count)];

            NonVisitedPoints.Remove(v);

            NAPI.ClientEvent.TriggerClientEvent(Player.Client, "DrawJobComponents", v, 318);
            CurrentGarbageColshape = NAPI.ColShape.CreateCylinderColShape(v.Position, 2f, 3f);
            CurrentGarbageColshape.OnEntityEnterColShape += CurrentShapeOnEntityEnterColShape;
        }
Exemplo n.º 5
0
        public AddPage(GarbageModel gm)
        {
            InitializeComponent();
            this.gm           = gm;
            isInsert          = false;
            tipo.IsEnabled    = false;
            tipo.SelectedItem = gm.Tipo;
            string app  = gm.Colore;
            string app2 = app.Substring(0, app.Length - 4);

            colore.SelectedItem = app2;
            giorno.SelectedItem = gm.Giorno;
            string [] ora = gm.Ora.Split(':');
            TimeSpan  ts  = new TimeSpan(Int32.Parse(ora[0]), Int32.Parse(ora[1]), 0);

            orario.Time = ts;
        }
Exemplo n.º 6
0
    public void SetData(GarbageVo garbage)
    {
        model            = GarbageModel.Instance;
        view             = GetComponent <GarbageItemView>();
        model.updateNum += UpdateNum;//添加事件触发函数

        view.Btn_Choose.gameObject.SetActive(false);

        UIEventListener.Get(view.Img_Icon).OnClickHandler     += OnChooseGarge;
        UIEventListener.Get(view.Img_Icon).OnBeginDragHandler += OnBeginDrag;
        UIEventListener.Get(view.Img_Icon).OnDragHandler      += OnDrag;
        UIEventListener.Get(view.Img_Icon).OnEndDragHandler   += OnEndDrag;

        this.garbage         = garbage;
        view.Img_Icon.sprite = ResourcesManager.Load <Sprite>("Garbages/" + garbage.Id);
        view.Txt_Num.text    = garbage.Num.ToString();
    }
Exemplo n.º 7
0
 public int SaveGarbage(GarbageModel g)
 {
     lock (collisionLock)
     {
         if (g.Id != 0)
         {
             App.timerM = new DateTime();
             database.Update(g);
             return(g.Id);
         }
         else
         {
             App.timerM = new DateTime();
             return(database.Insert(g));
         }
     }
 }
        private void DrawNextPoint(bool end)
        {
            NAPI.ClientEvent.TriggerClientEvent(Player.Client, "DisposeJobComponents");
            if (end)
            {
                NAPI.ClientEvent.TriggerClientEvent(Player.Client, "DrawJobComponents", JobsScript.GetRandomGarbage().Position, 318);
                CurrentGarbageColshape = NAPI.ColShape.CreateCylinderColShape(JobsScript.GetRandomGarbage().Position, 2f, 3f);
                CurrentGarbageColshape.OnEntityEnterColShape += CurrentShapeOnEntityEnterColShape;
                return;
            }

            GarbageModel v = NonVisitedPoints[new Random().Next(NonVisitedPoints.Count)];

            NonVisitedPoints.Remove(v);

            NAPI.ClientEvent.TriggerClientEvent(Player.Client, "DrawJobComponents", v, 318);
            CurrentGarbageColshape = NAPI.ColShape.CreateCylinderColShape(v.Position, 2f, 3f);

            CurrentGarbageColshape.OnEntityEnterColShape += CurrentShapeOnEntityEnterColShape;
        }
        public async Task <IActionResult> Post([FromBody] GarbageViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                var newGarbage = new GarbageModel();
                newGarbage.SubId        = vm.SubId;
                newGarbage.CreatedTime  = vm.CreatedTime;
                newGarbage.RecyclingQty = vm.RecyclingQty;
                repostiory.AddGarbage(newGarbage);
                await unitOfWork.SaveAsync();

                // var result = mapper.Map<GarbageModel, GarbageViewModel>(newGarbage);
                return(Ok(true));
            }
            catch (Exception ex)
            {
                return(Ok(new { success = false, result = ex.Message }));
            }
        }
Exemplo n.º 10
0
        public Page1(GarbageModel gm)
        {
            BindingContext = gm;
            InitializeComponent();
            this.gm = gm;
            switch (gm.Colore)
            {
            case "azzurro.png":
                ColorFrame.BorderColor = Color.LightBlue;
                break;

            case "blu.png":
                ColorFrame.BorderColor = Color.Blue;
                break;

            case "giallo.png":
                ColorFrame.BorderColor = Color.Yellow;
                break;

            case "grigio.png":
                ColorFrame.BorderColor = Color.Gray;
                break;

            case "marrone.png":
                ColorFrame.BorderColor = Color.Brown;
                break;

            case "nero.png":
                ColorFrame.BorderColor = Color.Black;
                break;

            case "verde.png":
                ColorFrame.BorderColor = Color.Green;
                break;;
            }
        }
Exemplo n.º 11
0
        private async void ToolbarItem_Save(object sender, EventArgs e)
        {
            string t          = tipo.SelectedItem as string;
            int    indiceTipo = tipo.SelectedIndex;
            string g          = giorno.SelectedItem as string;
            string app        = colore.SelectedItem as string;
            string c          = app.ToLower() + ".png";
            string descr      = "";

            switch (indiceTipo)
            {
            case 0:
                descr = "Possono essere buttati: stracci sporchi, spugne, spazzolini, oggetti di gomma, " +
                        "cicche di sigarette, carta plastificata, scontrini, " +
                        "posate monouso, polvere, pannolini e assorbenti.";
                break;

            case 1:
                descr = "Possono essere buttati: giornali e riviste, cartone e " +
                        "cartoncino, fotocopie, confezioni di alimenti e bevande, " +
                        "confezioni TetraPak.";
                break;

            case 2:
                descr = "Possono essere buttati: bottiglie, flaconi per detersivi in plastica privi di liquido, " +
                        "piatti e bicchieri monouso, buste, vaschette, pellicole, polistirolo, " +
                        "barattoli yogurt, blister trasparenti e cellophane.";
                break;

            case 3:
                descr = "Possono essere buttati: barattoli per alimenti privi di residui di cibo, lattine e latte, " +
                        "bombolette per alimenti e per prodotti destinati all'igiene personale privi della dicitura \"T\" e\\o \"F\", " +
                        "chiusure metalliche per vasetti di vetro, scatole varie in metallo usate per confezioni regalo, " +
                        "carta stagnola.";
                break;

            case 4:
                descr = "Possono essere buttati: bottiglie, barattoli, vasetti e flaconi.";
                break;

            case 5:
                descr = "Possono essere buttati: scarti di cucine, avanzi di cibo e frutta, tovaglioli da cucina unti non colorati, " +
                        "caffè, cialde biodegradabili, stuzzicadenti, tappi di sughero, ceneri di camino, cartoni di pizza unti," +
                        "piccole potature di fiori e piante e terriccio.";
                break;
            }
            string h = orario.Time.Hours + ":" + orario.Time.Minutes;

            if (isInsert)
            {
                gm = new GarbageModel();
            }
            gm.Tipo        = t;
            gm.Colore      = c;
            gm.Descrizione = descr;
            gm.Giorno      = g;
            gm.Ora         = h;
            App.Database.SaveGarbage(gm);
            TimeSpan span = new DateTime() - App.timerM;

            Console.WriteLine("DB TIME= " + (int)span.TotalMilliseconds);
            await DisplayAlert("Info", "Salvato!", "Ok");

            await Navigation.PopToRootAsync();
        }
 public void AddGarbage(GarbageModel model)
 {
     context.Garbages.Add(model);
 }
 public GarbageController(ILogger <GarbageController> logger, GarbageModel garbageModel, FileHelper fileHelper)
 {
     _logger       = logger;
     _garbageModel = garbageModel;
     _fileHelper   = fileHelper;
 }