Exemplo n.º 1
0
        private void EnemyDied(Point point)
        {
            Point p       = new Point(point.x, 0, point.z);
            bool  removed = EnvironmentManager.EnemyCollection.Remove(p);

            Logcat.I($"Unregistering unit from environment manager {p}, successfully? {removed}");
        }
Exemplo n.º 2
0
        public override IEnumerator Execute(BoardController boardController, List <Point> board)
        {
            this.unit.Board = board;

            List <Point> validPositions = GetMovementValidPositions();

            boardController?.SwitchTilesFromActiveBoards(new HashSet <Point>(validPositions), TileStates.HIGHLIGHT);
            yield return(new WaitForSeconds(0.5f));

            Move();
            yield return(new WaitForSeconds(1f));

            Logcat.I(this, $"Incarnate behaviour. Was an enemy killed? {wasAnEnemyKilled} was an excluded enemy? {rebirthAction.IsAnExcludedEnemy()}, enemy {lastEnemyKilled}");
            if (wasAnEnemyKilled && !rebirthAction.IsAnExcludedEnemy())
            {
                Attack(rebirthActionIndex);
                wasAnEnemyKilled = false;
            }
            else
            {
                Attack(afterbirthActionIndex);
            }

            yield return(new WaitForSeconds(1f));
        }
 public void ShowButtons(bool show)
 {
     showButtons = show;
     Logcat.I(this, $"Showing action buttons {showButtons}, button's size {buttons?.Length}");
     buttons?.ToList().ForEach(b => b.gameObject.SetActive(!showButtons));
     actionButtonPressed?.Play(this.transform.position);
 }
        private void updateSingleCorso(List <CorsoGiornaliero> listaCorsi)
        {
            foreach (var l in listaCorsi)
            {
                var corso = l;
                if (_db.CheckAppartieneMieiCorsi(l))
                {
                    //_db.InsertUpdate(l);
                    var orario = new Orari()
                    {
                        Insegnamento = corso.Insegnamento,
                        Codice       = corso.Codice,
                        AulaOra      = corso.AulaOra,
                        Note         = corso.Note,
                        Date         = corso.Date,
                        Docente      = corso.Docente,
                    };

                    if (_db.AppartieneOrari(orario))                     //l'orario è già presente
                    {
                        var o = _db.GetAllOrari().FirstOrDefault(y => y.Insegnamento == orario.Insegnamento && y.Date == orario.Date);
                        if ((string.Compare(o.Note, corso.Note) != 0) || !o.Notify)                         //ci sono state notifiche non ancora segnalate
                        {
                            o.Note    = corso.Note;
                            o.AulaOra = corso.AulaOra;
                            if (o.Note != null && o.Note != "" && !o.Notify)
                            {
                                Logcat.Write("---------- - Invio Notifica: " + o.Insegnamento);
                                Logcat.WriteDB(_db, "-----------Invio Notifica: " + o.Insegnamento);
                                SendNotification(corso);
                                Logcat.Write("-----------Invio Notifica OK");
                                Logcat.WriteDB(_db, "-----------Invio Notifica OK");
                                o.Notify = true;
                            }
                            _db.Update(o);
                        }
                    }
                    else                     // l'orario non è presente nel mio db
                    {
                        orario.Notify = false;

                        if (orario.Note != null && orario.Note != "" && !orario.Notify)
                        {
//							SendNotification ("TROVATO CORSO ANNULLATO!");
                            SendNotification(corso);
                            orario.Notify = true;
                        }

                        _db.Insert(orario);
                    }
                }
                else if (corso.Insegnamento.Contains("UTENZA"))
                {
                    _db.Insert(new Utenze()
                    {
                        Data = corso.Date, AulaOra = corso.AulaOra
                    });
                }
            }
        }
Exemplo n.º 5
0
        //public async Task<Earthquake[]> GetEarthquakes()
        //{
        //    var client = new HttpClient();
        //    client.BaseAddress = new Uri("http://api.geonames.org/");
        //    var response = await client.GetAsync("earthquakesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&username=bertt", HttpCompletionOption.ResponseHeadersRead);
        //    var earthquakesJson = response.Content.ReadAsStringAsync().Result;
        //    var rootobject = JsonConvert.DeserializeObject<Rootobject>(earthquakesJson);
        //    return rootobject.earthquakes;
        //}

        public static async Task <string> GetOrarioGiornaliero(string db, int?fac, int?laurea, string data)
        {
            string tipo = laurea == 0 ? "LCSDIPRXE" : "LCSDR";
            string s    = null;
            String uri  = string.Format("http://www03.unibg.it/orari/orario_giornaliero.php?db={0}&idfacolta={1}&idlaurea={2}&data={3}&tipo={4}", db, fac, laurea, data, tipo);

            try
            {
                var           httpClient   = new HttpClient();
                Task <string> contentsTask = httpClient.GetStringAsync(new Uri(uri)); // async method!
                s = await contentsTask;
                s = s.Replace("&deg;", "°");
                s = s.Replace("&nbsp;", "");
                s = s.Replace("&agrave;", "à");
                s = s.Replace("&egrave;", "è");
                s = s.Replace("&quot;", "'");
            }
            catch (Exception ex)
            {
                Logcat.Write(ex.Message);
                return(String.Empty);
            }

            return(s);
        }
Exemplo n.º 6
0
        public override void Execute()
        {
            Logcat.I(this, $"All Hail The Mighty Robot Action called");

            this.HealAllies();
            this.PullAll();
        }
Exemplo n.º 7
0
 private void OnPlayerActionExecuted()
 {
     Logcat.I(this, "Hidding bar when player action executed");
     if (canvas != null)
     {
         this.canvas.enabled = false;
     }
 }
Exemplo n.º 8
0
 public void PurchaseAction()
 {
     Logcat.I(this, $"Action purchased {this.currentUnit} index {this.actionIndex}");
     levelUpFx?.Play(this.currentUnit.transform.position);
     purchaseFx?.Play(this.transform.position);
     ActionPurchased?.Invoke(this.currentUnit, this.actionIndex);
     HidePanel();
 }
Exemplo n.º 9
0
 private void SetMaxChiclets(Health health)
 {
     Logcat.I(this, $"Set max chiclets {health?.GetTotalHealth()}");
     for (int i = 0; i < chiclets.Length; i++)
     {
         chiclets[i].gameObject.SetActive(i < health.GetTotalHealth());
     }
 }
        public override void OnReceive(Context context, Intent intent)
        {
            Logcat.Write("ON RECEVICE");
            Intent service = new Intent(context, typeof(SampleSchedulingService));

            // Start the service, keeping the device awake while it is launching.
            StartWakefulService(context, service);
        }
Exemplo n.º 11
0
 public override void Execute()
 {
     Logcat.I(this, $"NeoSatanHeadPukeAction Puking");
     Logcat.I(this, $"NeoSatanHeadPukeAction strongest target {strongestTarget}: {Unit.UnitsMap.Get(strongestTarget)?.UnitName}");
     Logcat.I(this, $"NeoSatanHeadPukeAction puke direction {cardinalDirection}");
     targets.ForEach(p => Logcat.I(this, $"NeoSatanHeadPukeAction targets {p}"));
     PlayParticles(strongestTarget);
     targets.ForEach(p => this.AttackPosition(p));
 }
Exemplo n.º 12
0
        public void OnActionPurchased(Unit unit, int actionIndex)
        {
            Logcat.I(this, $"Action Purchased {unit.UnitName} action {actionIndex}");
            int points = unit.ActionsHandler.GetActions()[actionIndex].ExperiencePointsToUnlocked;

            UnlockAction(unit, actionIndex);
            experiencePointsUpdater.ReducePoints(points);
            PurchaseCompleted?.Invoke();
        }
Exemplo n.º 13
0
        private void SpawnSplit(CardinalDirections direction, Vector3 otherPosition)
        {
            Vector3 position = otherPosition + PointConverter.ToVector(Direction.GetDirection(direction));

            Quaternion     rotation = RotationHelper.GetRotation(direction);
            HoloBlastSplit bullet   = Instantiate(this.blast, position, rotation);

            Logcat.I($"Other position {otherPosition} Splitted bullet {position} rotation {rotation}");
            bullet.SetUp(boardController, unitsMap, this.secondAttackDamage, secondKnockback, new Point((int)otherPosition.x, 0, (int)otherPosition.z));
        }
Exemplo n.º 14
0
        private void RaptureMoving(List <Point> row)
        {
            Logcat.I(this, $"Unit {unit.GetPosition()} Rapture moving {row[0].x}");
            if (row == null || row.Count == 0 || unit == null || unit.GetPosition().x > row[0].x)
            {
                return;
            }

            this.unit.Health.DeadByRapture();
        }
Exemplo n.º 15
0
        public TabbedDayView()
        {
            _db = new DbSQLite();
            this.SetBinding(ContentPage.TitleProperty, "Day");

            Logcat.Write(string.Format("{0}: {1}", "TABBEDDAYVIEW", "before content"));

            //Content = getView();
            Content = getPullToRefreshView();
        }
        private async Task updateDbOrariUtenza()
        {
            DateTime[] arrayDate = new DateTime[] { _oggi.Data, _domani.Data, _dopodomani.Data };

            Logcat.WriteDB(_db, "Getting All Orari");
            var _listOrariGiorno = _db.GetAllOrari(); //Elimina gli orari già passati

            Logcat.WriteDB(_db, "Finished: gettig all orari");


            foreach (var l in _listOrariGiorno)
            {
                Logcat.WriteDB(_db, "Checking old orari!");
                if (l.Date < _oggi.Data)
                {
                    _db.DeleteSingleOrari(l.IdOrario);
                }
            }
            ;

            if (!CrossConnectivity.Current.IsConnected)               //non connesso a internet
            {
                Logcat.WriteDB(_db, "*************ERRORE");
                Logcat.WriteDB(_db, "AGGIORNAMENTO NON RIUSCITO, nessun accesso a internet");
                Logcat.Write("AGGIORNAMENTO NON RIUSCITO, nessun accesso a internet");
                return;
            }

            foreach (var d in arrayDate)
            {
                Logcat.Write("Data Considerata: " + d.ToString());
                Logcat.WriteDB(_db, string.Format("Ottenimento orari del {0}", d.Date.ToString("dd'/'MM'/'yyyy")));

                string s = await Web.GetOrarioGiornaliero(Settings.FacoltaDB, Settings.FacoltaId, 0, d.ToString("dd'/'MM'/'yyyy"));

                List <CorsoGiornaliero> listaCorsi = Web.GetSingleOrarioGiornaliero(s, 0, d);
                Logcat.WriteDB(_db, string.Format("Lista corsi ottenuta {0}", d.Date.ToString("dd'/'MM'/'yyyy")));

                if (listaCorsi.Count() != 0)
                {
                    Logcat.WriteDB(_db, string.Format("Lista corsi non vuota, aggiornamento singolo corso"));
                    updateSingleCorso(listaCorsi);
                }

                Logcat.WriteDB(_db, string.Format("Ottenimento orari del {0} COMPLETATO", d.Date.ToString("dd'/'MM'/'yyyy")));
            }

            Logcat.WriteDB(_db, string.Format("Last Update: {0}", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")));
            Settings.LastUpdate     = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
            Settings.MieiCorsiCount = _db.GetAllMieiCorsi().Count();


            Logcat.WriteDB(_db, "AGGIORNAMENTO COMPLETATO!");
            Logcat.Write("AGGIORNAMENTO COMPLETATO!");
        }
Exemplo n.º 17
0
        public void SetUp(BoardController boardController, UnitsMap unitsMap, int damage, int knockback, Point origin)
        {
            DamageOnCollision onCollision = this.GetComponent <DamageOnCollision>();

            Logcat.I($"HoloblastSplit damage {damage}, unitsMap {unitsMap}, knockback {knockback} attacker position {origin}");
            onCollision.BoardController = boardController;
            onCollision.UnitsMap        = unitsMap;
            onCollision.Damage          = damage;
            onCollision.Knockback       = knockback;
            onCollision.AttackerPoint   = origin;
        }
Exemplo n.º 18
0
        public void SetUnitPosition()
        {
            if (index < 0 || unitsPlacedList.Contains(index))
            {
                return;
            }

            Logcat.I(this, $"Setting player's unit at position {position.Value}");
            if (this.Add(unitsContainer.transform, position.Value, playerPrefab[index]))
            {
                placementFx?.Play(default);
Exemplo n.º 19
0
        public void EnableButton()
        {
            if (currentAction == null || currentUnit == null)
            {
                return;
            }

            currentAction.AvailableToUnlock = SkillStoreController.ReadyToUnlock(this.currentAction, experiencePoints.Value);
            Logcat.I(this, $"Is the action available to unlock? {currentAction.AvailableToUnlock}");
            purchaseButton.interactable = currentAction.AvailableToUnlock;
        }
        public override List <Point> GetValidTargets(List <Point> board, Point position)
        {
            Logcat.I(this, $"NeoSatanHeadScreamAction rapture {raptureRow.Value}");
            neoSatanBehaviour   = GetComponentInParent <NeoSatanBehaviour>();
            this.ValidPositions = base.GetValidTargets(board, position);
            List <Point> excludingUnits      = this.ValidPositions.Where(currentPoint => !this.UnitsMap.Contains(currentPoint)).ToList();
            List <Point> excludingLegs       = excludingUnits?.Where(p => !neoSatanBehaviour.LegsPositions.Contains(p)).ToList();
            List <Point> excludingLatestRows = excludingLegs?.Where(p => p.x > this.raptureRow.Value + this.offset).ToList();

            this.ValidPositions = excludingLatestRows;
            return(this.ValidPositions);
        }
Exemplo n.º 21
0
        public override void Execute()
        {
            Logcat.I(this, $"Incarnate IncarnateRebirthAttackAction execute");
            base.Execute();
            if (IsAnExcludedEnemy())
            {
                return;
            }

            UnitsMap.Remove(this.Unit.GetPosition());
            StartCoroutine(Rebirth());
        }
Exemplo n.º 22
0
 public override void Begin(GameMachine context)
 {
     Logcat.I($"Starting results state. Has player won? {gameplayState.HasPlayerWon}");
     if (gameplayState.HasPlayerWon)
     {
         resultsPanel.RaiseWin();
     }
     else
     {
         resultsPanel.RaiseLose();
     }
 }
Exemplo n.º 23
0
 private void SwitchState(ChicletUI button, bool enable)
 {
     Logcat.I(this, $"SwitchState {enable}");
     if (enable)
     {
         button.SetOn();
     }
     else
     {
         button.SetOff();
     }
 }
Exemplo n.º 24
0
        private bool RemoveBodyParts(Unit unit)
        {
            if (unit == null)
            {
                Logcat.I(null, "unable to Remove");
                return(false);
            }

            unit?.UnitsMap.Remove(unit.GetPosition());
            MonoBehaviour.Destroy(unit.gameObject);
            return(true);
        }
Exemplo n.º 25
0
        private IEnumerator Attack(CardinalDirections direction, Vector3 point)
        {
            yield return(new WaitForSeconds(delay));

            Logcat.I(this, $"Shooting with direction {direction} vector {point}");
            this.transform.localPosition += point;
            GetPointsInLine(direction)?.ForEach(p => UnitsMap.Get(p)?.Health?.ReduceHealth(this.DeltaHealth));
            this.transform.localPosition -= point;
            KnockbackHandler handler = new KnockbackHandler(this.UnitsMap);

            handler.Execute(this.BoardController, Target, this.Unit.GetPosition(), this.Knockback);
        }
Exemplo n.º 26
0
        public override bool ValidateAction(Point target)
        {
            bool isValid = base.ValidateAction(target) && this.UnitsMap.Contains(target, Type.Player);

            if (isValid)
            {
                this.SkillFxPosition = this.UnitsMap.Get(target).gameObject.transform.position;
            }

            Logcat.I(this, $"Nanobots validating action {isValid}");
            return(isValid);
        }
Exemplo n.º 27
0
    void Start()
    {
        backgroundImage = GetComponent <Image>();
        joystickImage   = transform.GetChild(0).GetComponent <Image>();
        _player         = FindObjectOfType <Logcat>();

        backgroundSize = backgroundImage.rectTransform.sizeDelta;

        pivot    = backgroundImage.rectTransform.pivot;
        pivot.x -= 0.5f;
        pivot.y -= 0.5f;
        pivot   *= 2;
    }
Exemplo n.º 28
0
        public override List <Point> GetValidTargets(List <Point> board, Point position)
        {
            Point neoSatanPosition = this.Unit.GetPosition();

            base.GetValidTargets(board, position);
            this.ValidPositions = this.ValidPositions.Where(p => p.x >= (neoSatanPosition.x - 1) && p.x <= (neoSatanPosition.x + 1) ||
                                                            p.z >= (neoSatanPosition.z - 1) && p.z <= (neoSatanPosition.z + 1)).ToList();

            strongestTarget = AIUtils.GetStrongestTarget(this.UnitsMap);
            targets         = this.GetRowsToAttack(strongestTarget);
            Logcat.I(this, $"NeoSatanHeadPukeAction target {strongestTarget}");
            return(targets);
        }
        public void SendNotification(CorsoGiornaliero l)
        {
            if (!Settings.Notify)
            {
                return;
            }
            //			Logcat.Write("SEND NOTIFICATION");

            Logcat.Write("Creazione Notifica");
            Logcat.WriteDB(_db, "Creazione notifica");
            Logcat.WriteDB(_db, l.Note.ToUpper() + l.Insegnamento + " - " + l.Date.ToShortDateString() + " - " + l.Ora);

            // Set up an intent so that tapping the notifications returns to this app:
            var context = Android.App.Application.Context;
            //var context = Forms.Context;

            Intent intent = new Intent(context, typeof(MainActivity));

            Logcat.WriteDB(_db, "Intent created");
            // Create a PendingIntent; we're only using one PendingIntent (ID = 0):
            const int     pendingIntentId = 0;
            PendingIntent pendingIntent   = PendingIntent.GetActivity(context, pendingIntentId, intent, PendingIntentFlags.UpdateCurrent);

            Logcat.WriteDB(_db, "PendingIntent created");
            Notification.Builder builder = new Notification.Builder(context)
                                           .SetContentIntent(pendingIntent)
                                           .SetContentTitle(l.Note.ToUpper())
                                           .SetContentText(l.Insegnamento + " - " + l.Date.ToShortDateString() + " - " + l.Ora)
                                           .SetSmallIcon(Resource.Drawable.ic_notification_school)
                                           .SetAutoCancel(true);
            //builder.SetStyle(new Notification.BigTextStyle().BigText(longMess));

            Notification.InboxStyle inboxStyle = new Notification.InboxStyle();
            inboxStyle.AddLine(l.Insegnamento);
            inboxStyle.AddLine(l.Date.DayOfWeek + ", " + l.Date.ToShortDateString());
            inboxStyle.AddLine(l.AulaOra);
            inboxStyle.AddLine(l.Docente);
            builder.SetStyle(inboxStyle);

            // Build the notification:
            Notification notification = builder.Build();

            // Get the notification manager:
            NotificationManager notificationManager = context.GetSystemService(Context.NotificationService) as NotificationManager;

            // Publish the notification:
            // const int notificationId = 1;
            var rnd = new System.Random();

            notificationManager.Notify(rnd.Next(), notification);
        }
Exemplo n.º 30
0
        public void RemoveFromUnitsMap()
        {
            Unit unit = this.GetComponentInParent <Unit>();

            if (unit == null)
            {
                return;
            }

            Logcat.I(this, $"AnimationStateUpdater RemoveFromUnitsMap {unit.UnitName}");
            unit.UnitsMap.Remove(unit.GetPosition());
            GetComponentInParent <EnemyUnit>()?.NotifyDyingEvent();
            GetComponentInParent <PlayerUnit>()?.NotifyDyingEvent();
        }