示例#1
0
        private void InviaTemplateESchede(string ip, params String[] idSchede)
        {
            String tempString = null;

            IEnumerable <Scheda> schedeRichieste = from Scheda s in _schede.Keys where idSchede.Contains(s.IdScheda) select s;

            tempString = DocumentoMaster.GetIstance().Persister.FormatScheda(schedeRichieste);
            if (tempString == null)
            {
                throw new InvalidOperationException("Schede non correttamente formattate");
            }
            _output(this, new GestoreGiocatoriMessageEventArgs(ip, new PersistanceFileSchedeMessageEventArgs(tempString)));

            Scheda[]         sc = schedeRichieste.ToArray <Scheda>();
            ElementoTemplate templateRichiesto = null;

            if (_schede.Values.Count == 0)
            {
                templateRichiesto = DocumentoMaster.GetIstance().Persister.LoadTemplate(DocumentoMaster.GetIstance().Path + DocumentoMaster.GetIstance().CurrentDescrittore.IdPartita + "/Template.xml");
            }
            else
            {
                templateRichiesto = sc.Length > 0 ? _schede[sc[0]] : _schede.Values.ToArray <ElementoTemplate>()[0];
            }

            tempString = null;
            tempString = DocumentoMaster.GetIstance().Persister.FormatTemplate(templateRichiesto);
            if (tempString == null)
            {
                throw new InvalidOperationException("Template non correttamente formattato");
            }
            _output(this, new GestoreGiocatoriMessageEventArgs(ip, new PersistanceFileTemplateMessageEventArgs(tempString)));
        }
示例#2
0
 protected override void joinPartitaToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (_currentDescrittoreView != null)
     {
         DocumentoMaster.GetIstance().JoinPartita(_currentDescrittoreView.Descrittore);
     }
 }
示例#3
0
 public static new DocumentoMaster GetIstance()
 {
     if (_doc == null)
     {
         _doc = new DocumentoMaster();
     }
     return(_doc as DocumentoMaster);
 }
示例#4
0
        protected override void impostazioniToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string newName = DocumentoMaster.GetIstance().NomeUtente;

            if (Dialog.InputBox("Impostazioni", "Inserisci il tuo nome utente", ref newName) == DialogResult.OK)
            {
                DocumentoMaster.GetIstance().NomeUtente = newName;
            }
        }
示例#5
0
 private void ModificaPartita(object o, EventArgs e)
 {
     if (_currentDescrittoreView != null)
     {
         if ((DescrittorePartitaModifier.GetInputBox(_currentDescrittoreView.Descrittore)) == DialogResult.OK)
         {
             DocumentoMaster.GetIstance().Persister.SaveDescrittorePartita(DocumentoMaster.GetIstance().Path + "Descrittori.xml", Descrittori);
             this.Aggiorna();
         }
     }
 }
示例#6
0
 protected virtual void SocketMessageHandler(MySocket sender, Utility.Messages.PasswordSubmitMessageEventArgs e)
 {
     if (DocumentoMaster.GetIstance().CurrentDescrittore.IdPartita == e.IdPartita)
     {
         if (DocumentoMaster.GetIstance().CurrentDescrittore.Password == e.Argomento)
         {
             sender.Input(new Utility.Messages.PasswordResponseMessageEventArgs("ok"));
         }
         else
         {
             sender.Input(new Utility.Messages.PasswordResponseMessageEventArgs("wrong password"));
         }
     }
     else
     {
         sender.Input(new Utility.Messages.PasswordResponseMessageEventArgs("wrong id"));
     }
 }
示例#7
0
 protected virtual void SocketMessageHandler(MyServerSocket sender, Utility.Messages.ServerSocketErrorMessageEventArgs e)
 {
     DocumentoMaster.GetIstance().LeavePartita(this, e);
 }
示例#8
0
 protected virtual void SocketMessageHandler(MySocket sender, Utility.Messages.GiocatoreCollegatoMessageEventArgs e)
 {
     foreach (Utility.IComponent c in _components)
     {
         if (c is GestoreSchedeMaster)
         {
             c.Input(new GestoreGiocatoriMessageEventArgs(sender.RemoteAddress, e));
         }
     }
     this.MessageForwarder(sender, new ChatComuneMessageEventArgs(e.NomeGiocatore + " partecipa ora alla partita \"" + DocumentoMaster.GetIstance().CurrentDescrittore.Nome + "\""));
 }
示例#9
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(DocumentoMaster.GetIstance().MainForm);
 }
示例#10
0
 private void MainFormMaster_FormClosed(object sender, FormClosedEventArgs e)
 {
     DocumentoMaster.GetIstance().CloseApplication();
 }