Inheritance: Faction
Exemple #1
0
        public static void create(Tome leTome)
        {
            try
            {
                open();

                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection = conn;

                cmd.CommandText = "INSERT INTO tome(idTome, numeroTome, titreTome, resumerTome, dateAchatTome) VALUES (@idTome, @numeroTome, @titreTome, @resumerTome, @statutManga, @dateAchatTome)";

                cmd.Prepare();

                cmd.Parameters.AddWithValue("@idTome", leTome.IdTome);
                cmd.Parameters.AddWithValue("@numeroTome", leTome.NumeroTome);
                cmd.Parameters.AddWithValue("@titreTome", leTome.TitreTome);
                cmd.Parameters.AddWithValue("@resumerTome", leTome.ResumerTome);
                cmd.Parameters.AddWithValue("@dateAchatTome", leTome.DateAchatTome);


                cmd.ExecuteNonQuery();

                leTome.IdTome = (int)cmd.LastInsertedId;

                close();
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: {0}", ex.ToString());
            }
        }
Exemple #2
0
        public static Boolean editTome(Tome leTome)
        {
            try
            {
                open();
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "UPDATE tome SET idTome=@idTome,numeroTome=@numeroTome, titreTome=@titreTome, resumerTome=@resumerTome, dateAchatTome=@dateAchatTome WHERE idTome=" + leTome.IdTome;

                cmd.Prepare();

                cmd.Parameters.AddWithValue("@idTome", leTome.IdTome);
                cmd.Parameters.AddWithValue("@numeroTome", leTome.NumeroTome);
                cmd.Parameters.AddWithValue("@titreTome", leTome.TitreTome);
                cmd.Parameters.AddWithValue("@resumerTome", leTome.ResumerTome);
                cmd.Parameters.AddWithValue("@dateAchatTome", leTome.DateAchatTome);

                cmd.ExecuteNonQuery();

                close();

                return(true);
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: {0}", ex.ToString());
                return(false);
            }
        }
    void Update()
    {
        GUI_Main comp = this.GetComponent <GUI_Main>() as GUI_Main;

        //Debug.Log (comp.ScrollValue);

        if (this.SelectedTome == this.TheDatabase.TomeDict["ASOIAF"])
        {
            updateCharacters(comp.ScrollValueREAL);
            //this.currentDate = convertRatioToDate(comp.ScrollValue);
            this.currentClosestEvent = this.getCurrentEvent();
        }
        else
        {
            double LocalTimeRatio = comp.ScrollValueREAL;

            // ScrollValue means the ratio for current selected TOme,
            // so we have to convert it to a maximum update
            DateTime TheDate = convertRatioToDate(comp.ScrollValueREAL);

            //float GlobalTimeRAtio = convertDateToRatio(TheDate);

            Tome   MasterTome      = this.TheDatabase.TomeDict["ASOIAF"];      //TODO: create a method that returns the MasterTome.
            int    DateNumbers     = (TheDate - MasterTome.Start).Days;
            int    TotalNumbers    = (MasterTome.End - MasterTome.Start).Days;
            double GlobalTimeRAtio = (DateNumbers / (double)TotalNumbers);

            updateCharacters(GlobalTimeRAtio);
            //this.currentDate = TheDate;
            this.currentClosestEvent = this.getCurrentEvent();
        }


        //Debug.Log ("Closest is ="+this.currentClosestEvent.Name );
    }
Exemple #4
0
        public static Tome ReadOneName(string titreTome)
        {
            Tome leTome = null;

            try
            {
                open();
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "SELECT * FROM manga WHERE nomManga=" + titreTome;

                MySqlDataReader res = cmd.ExecuteReader();

                res.Read();
                leTome               = new Tome();
                leTome.IdTome        = (int)res["idTome"];
                leTome.NumeroTome    = (int)res["numeroTome"];
                leTome.TitreTome     = (string)res["titreTome"];
                leTome.ResumerTome   = (string)res["resumerTome"];
                leTome.DateAchatTome = (DateTime)res["dateAchatTome"];
                close();

                return(leTome);
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: {0}", ex.ToString());

                return(leTome);
            }
        }
Exemple #5
0
        public LoanDateError Validate(DateTime firstDay, DateTime lastDay, Int32 tomeId)
        {
            if (lastDay < firstDay)
            {
                return(LoanDateError.EndInvalid);
            }

            if (lastDay == firstDay)
            {
                return(LoanDateError.LengthInvalid);
            }

            Tome selectedTome = _context.Tomes.FirstOrDefault(l => l.Id == tomeId);

            if (selectedTome == null)
            {
                return(LoanDateError.None);
            }

            if (_context.Loans.Where(l => l.TomeId == selectedTome.Id && l.LastDay >= firstDay)
                .ToList()
                .Any(l => l.IsConflicting(firstDay, lastDay)))
            {
                return(LoanDateError.Conflicting);
            }

            return(LoanDateError.None);
        }
 public void pickUpTome(Tome t)
 {
     positionBeforeTome = transform.localPosition;
     transform.localPosition = t.transform.position;
     canMove = false;
     //toggleCollider(false);
     sanityRegenActive = false;
 }
Exemple #7
0
        public editTome(int idTome)
        {
            InitializeComponent();

            leTome = DaoTome.ReadOneId(idTome);

            refreshForm();
        }
Exemple #8
0
    // Start is called before the first frame update
    void Start()
    {
        shotDelay = 2 * Random.Range(minShotDelay, maxShotDelay);

        pawn = GetComponent <Pawn>();
        pawn.PickupTome(Tome.Authored(new Card.Effect[] { Card.Effect.None }));

        findPlayer();
    }
 /// <summary>
 /// заполнить поля ввода
 /// </summary>
 public void Init()
 {
     LbTitle.Text = Title;
     toolTip1.SetToolTip(LbTitle, Title);
     lbDocNumber.Text = DocNumber.ToString();
     lbTome.Text      = Tome.ToString();
     LbStartPage.Text = PageStart.ToString();
     ChangeHeight();
 }
Exemple #10
0
    /// <summary>
    /// This returns a tome with a pre-ordained set of cards
    /// </summary>
    /// <param name="cardEffects">The effects of the cards that this tome will be created with</param>
    /// <returns>A Tome populated with the specified cards</returns>
    public static Tome Authored(Card.Effect[] cardEffects)
    {
        Tome tome = new Tome();

        foreach (Card.Effect e in cardEffects)
        {
            tome.cards.Add(Card.GetSpecificCard(e));
        }
        return(tome);
    }
Exemple #11
0
    private void TossTome()
    {
        soundEffectSource.clip = dropTomeClip;
        soundEffectSource.Play();

        GameObject discardTome = Instantiate(tomePickup, transform.position + new Vector3(0f, 1f, 0), Quaternion.identity);

        discardTome.GetComponent <TomePickup>().tome = currentTome;
        currentTome = null;
    }
    // Start is called before the first frame update
    void Start()
    {
        calcNewVariance();

        pawn = GetComponent <Pawn>();
        pawn.PickupTome(Tome.Authored(new Card.Effect[] { Card.Effect.None }));

        findPlayer();

        Animation anim = GetComponentInChildren <Animation>();
    }
        public void UpgateView()
        {
            if (!string.IsNullOrWhiteSpace(NameDoc))
            {
                lbTome.Text   = Tome.ToString();
                lbNumber.Text = DocNumber.ToString();

                LbTitleDocument.Text = NameDoc;
                LbStartPage.Text     = "стр. " + PageStart.ToString();
            }
        }
Exemple #14
0
    void Start()
    {
        pawn = GetComponent <Pawn>();
        cam  = Camera.main;
        gui  = GameObject.FindObjectOfType <CardManager>();

        pawn.PickupTome(Tome.Random());
        pawn.PickupTome(Tome.Random());
        pawn.PickupTome(Tome.Random());

        UpdateHUD();
    }
Exemple #15
0
    public static Tome Random()
    {
        Tome tome = new Tome();

        tome.cardCap        = UnityEngine.Random.Range(2, 6);
        tome.tomeBaseDamage = UnityEngine.Random.Range(1, 8);

        tome.cards.Add(Card.Random());
        tome.cards.Add(Card.Random());
        tome.cards.Add(Card.Random());
        return(tome);
    }
Exemple #16
0
    Projectile ShootProjectile(float yaw)
    {
        Tome tome = CurrentTome();

        yaw += transform.rotation.eulerAngles.y;

        Projectile projectile = Instantiate(projectilePrefab, transform.position, Quaternion.Euler(0, yaw, 0));

        projectile.Init(gameObject);

        tome.ModifyProjectile(projectile);
        return(projectile);
    }
Exemple #17
0
        public bool AddTome(Tome tome)
        {
            _context.Add(tome);
            try
            {
                _context.SaveChanges();
            }
            catch
            {
                return(false);
            }

            return(true);
        }
Exemple #18
0
        public Tome GetTome(int?tomeId)
        {
            if (tomeId == null)
            {
                return(null);
            }

            Tome tome = _context.Tomes
                        .Include(l => l.Book)
                        .Include(l => l.Loans)
                        .FirstOrDefault(l => l.Id == tomeId);

            return(tome);
        }
Exemple #19
0
        // TODO: implement multiple media-types and encoding
        public void SetData(string mediaType, JToken data)
        {
            lock ((object)this)
            {
                // Detect media type
                MediaType = mediaType;

                // Set data based on media type
                Data = Tome.Conjure(JToken.Parse((string)data));

                // Bump the last written time
                WrittenAt = DateTime.UtcNow;
            }
        }
Exemple #20
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            if (nearTome != null)
            {
                if (currentTome != null)
                {
                    TossTome();
                }
                currentTome            = nearTome.GetComponent <TomePickup>().tome;
                soundEffectSource.clip = pickUpTomeClip;
                soundEffectSource.Play();

                equipCommand.Execute();

                if (tomeManager)
                {
                    tomeManager.Combine();
                }

                Destroy(nearTome);
            }
        }

        //if (Input.GetKeyDown(KeyCode.Alpha2))
        //{
        //    equipCommand.Execute();
        //}

        if (Input.GetKeyDown(KeyCode.Q))
        {
            equipCommand.Undo();

            if (tomeManager)
            {
                TossTome();
                tomeManager.Combine();
            }
        }

        //if (Input.GetKeyDown(KeyCode.Alpha4))
        //{
        //    //foreach(Tome t in tomeStack)
        //    //{
        //    //    t.Print();
        //    //}
        //}
    }
Exemple #21
0
        private void editMangaBtn_Click(object sender, EventArgs e)
        {
            Tome monTome = new Tome();

            monTome.IdTome      = leTome.IdTome;
            monTome.NumeroTome  = Convert.ToUInt16(MtxNumTome.Text);
            monTome.TitreTome   = MtxTitreTome.Text;
            monTome.ResumerTome = MtxSysnopsisTome.Text;
            //monTome.ImageTome = AddImageBtn.Text;
            monTome.DateAchatTome = DateAchatDt.Value;
            DaoTome.editTome(monTome);
            readAllTome AccueilForm = new readAllTome();

            AccueilForm.Show();
            this.Close();
        }
Exemple #22
0
        //
        public void ApplyDiff(JArray diff)
        {
            lock ((object)this)
            {
                if (diff == null || Data == null)
                {
                    return;
                }

                // Apply diff to data
                Tome.ApplyDiff(Data, diff);

                // Bump the last written time
                WrittenAt = DateTime.UtcNow;
            }
        }
Exemple #23
0
        private void createTomeBtn_Click(object sender, EventArgs e)
        {
            Tome leTome = new Tome();

            leTome.NumeroTome    = Convert.ToUInt16(MtxnumTome.Text);
            leTome.TitreTome     = MtxTitreTome.Text;
            leTome.ResumerTome   = mtxSysnopsisTome.Text;
            leTome.DateAchatTome = DateAcahtDt.Value;
            //leTome.ImageManga = AddImageBtn.Text;
            //leTome.SelectionManga = SelectionManga(); TODO lié a un manga
            DaoTome.create(leTome);
            Form1 AccueilForm = new Form1();

            AccueilForm.Show();
            this.Close();
        }
Exemple #24
0
    private CLS_Database()
    {
        TomeDict       = new Dictionary <string, Tome>();
        DeathSentences = new Dictionary <DateTime, string>();

        Tome FULL = new Tome("A SONG OF ICE AND FIRE", "ASOIAF", 0);

        Tome agot = new Tome("A GAME OF THRONES", "AGOT", 1);
        Tome acok = new Tome("A CLASH OF KINGS", "ACOK", 2);
        Tome asos = new Tome("A STORM OF SWORDS", "ASOS", 3);
        Tome affc = new Tome("A FEAST FOR CROWS", "AFFC", 4);
        Tome adwd = new Tome("A DANCE WITH DRAGONS", "ADWD", 5);

        FULL.Start = new DateTime(298, 2, 24);
        FULL.End   = new DateTime(300, 7, 31);

        agot.Start = new DateTime(298, 2, 24);
        agot.End   = new DateTime(299, 1, 20);
        acok.Start = new DateTime(299, 1, 22);
        acok.End   = new DateTime(299, 10, 27);
        asos.Start = new DateTime(299, 9, 9);
        asos.End   = new DateTime(300, 2, 10);
        affc.Start = new DateTime(299, 12, 5);
        affc.End   = new DateTime(300, 5, 21);
        adwd.Start = new DateTime(300, 1, 5);
        adwd.End   = new DateTime(300, 7, 31);

        TomeDict["ASOIAF"] = FULL;
        TomeDict["AGOT"]   = agot;
        TomeDict["ACOK"]   = acok;
        TomeDict["ASOS"]   = asos;
        TomeDict["AFFC"]   = affc;
        TomeDict["ADWD"]   = adwd;

        DeathSentences[new DateTime(298, 11, 15)] = "Robert";
        DeathSentences[new DateTime(298, 12, 23)] = "Ned";
        DeathSentences[new DateTime(299, 7, 15)]  = "Renly";
        DeathSentences[new DateTime(299, 12, 23)] = "Catelyn";
        DeathSentences[new DateTime(299, 12, 23)] = "Robb";
        DeathSentences[new DateTime(300, 1, 1)]   = "Joffrey";
        DeathSentences[new DateTime(300, 1, 24)]  = "Tywin";
        DeathSentences[new DateTime(300, 1, 23)]  = "Lysa";       //This one NEEDS CONFIRMATION


        //ReadDatabase();
    }
Exemple #25
0
        public IActionResult DeleteTome(Int32 id)
        {
            try
            {
                Tome tome = _context.Tomes.FirstOrDefault(t => t.Id == id);

                if (tome == null)
                {
                    return(NotFound());
                }

                _context.Tomes.Remove(tome);
                _context.SaveChanges();
                return(Ok());
            }
            catch
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
Exemple #26
0
        public IActionResult PostTome([FromBody] TomeDTO tomeDTO)
        {
            Tome tome = new Tome
            {
                BookId = tomeDTO.Book.Id
            };

            _context.Tomes.Add(tome);

            _context.SaveChanges();

            try
            {
                return(CreatedAtAction(nameof(GetTome), new { id = tome.Id }, tomeDTO));
            }
            catch
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
Exemple #27
0
        /// <summary>
        /// Заполнение полей формыж
        /// </summary>
        public void Init()
        {
            TbFullName.Text = Fullname;
            tbName.Text = NameDocument;
            TbTome.Text = Tome.ToString();
            TbNumber.Text = Number.ToString();
            tbPage.Text = PageStart.ToString();
            TbAmountPages.Text = AmountPage.ToString();
            tbTypeDocument.Text = TypeDocument;

            try
            {
                dateTimePicker1.Value = dateTimePicker1.MinDate > Date ? DateTime.Now : Date;

            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }                 
        }
Exemple #28
0
        //
        public void Del()
        {
            lock ((object)this)
            {
                // Bump the last written time and check if we have data to destroy
                WrittenAt = DateTime.UtcNow;
                if (Data == null)
                {
                    return;
                }

                // Cleanup data
                Tome.Destroy(Data);
                Data      = null;
                MediaType = null;

                // Clear expiration time
                Touch(null);
            }
        }
Exemple #29
0
        public LoanViewModel NewLoan(int?tomeId)
        {
            if (tomeId == null)
            {
                return(null);
            }

            Tome tome = _context.Tomes
                        .Include(l => l.Book)
                        .Include(l => l.Loans)
                        .FirstOrDefault(l => l.Id == tomeId);

            LoanViewModel loan = new LoanViewModel {
                Tome = tome
            };

            loan.LoanFirstDay = DateTime.Today;

            loan.LoanLastDay = loan.LoanFirstDay + TimeSpan.FromDays(7);

            return(loan);
        }
Exemple #30
0
    public void SwitchTomes(List <Tome> tomes, Tome tome, int shift)
    {
        for (int i = 0; i < tomes.Count; i++)
        {
            Tome t = tomes[i];
            bool thisTomeExistsInGui = false;
            foreach (TomeGUI tg in this.tomes)
            {
                if (tg.tome == t)
                {
                    thisTomeExistsInGui = true;
                    break;
                }
            }
            if (!thisTomeExistsInGui)
            {
                TomeGUI newTomeGUI = Instantiate(tomeGUIPrefab, loadoutArea);
                newTomeGUI.tome = t;
                this.tomes.Insert(i, newTomeGUI);
            }
        }
        currentTomeIndex = tomes.IndexOf(tome);

        float dx = 130;
        float x  = -(this.tomes.Count - 1) * dx / 2;

        for (int i = 0; i < this.tomes.Count; i++)
        {
            TomeGUI t         = this.tomes[i];
            bool    isCurrent = (i == currentTomeIndex);

            t.AnimateTo(new Vector3(x + dx * i, 0), isCurrent);
        }

        RemoveAllCards();
        currentTome = tome;
        AddCards(tome.cards.ToArray());
    }
Exemple #31
0
        public IActionResult Create([Bind("Id,BookId")] Tome tome)
        {
            var book = _loanService.Books.FirstOrDefault(l => l.Id == tome.BookId);

            tome.Book = book;

            IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);

            foreach (var error in allErrors)
            {
                Debug.WriteLine(error);
            }

            if (ModelState.IsValid)
            {
                if (_loanService.AddTome(tome))
                {
                    return(View("AddTomeDone", tome));
                }
            }

            ViewBag.Message = "Kötet létrehozása sikertelen!";
            return(RedirectToAction("Index", "Home"));
        }
Exemple #32
0
	/**
	 * Called when the script is loaded, before the game starts
	 */
	void Awake() {
		S = this;
	}
	public void pickup(Tome t){
		GameController.gc.SeasonChange(t.sea);
	}