예제 #1
0
 public static Entity_Model GenerateRandomEntityModel(ref Client_Model player_model)
 {
     int rand = Random.Range(0, 6);
     Entity_Model model;
     if(rand >= 4) {
         model = new Entity_Model(new Stats("DefaultR"), player_model);
         model.character_object = "Entity 4";
         model.stats.can_range = true;
     } else {
         model = new Entity_Model(new Stats("Default"), player_model);
         switch(rand) {
             case 0:
                 model.character_object = "Entity 1";
                 break;
             case 1:
                 model.character_object = "Entity 1";
                 break;
             case 2:
                 model.character_object = "Entity 2";
                 break;
             case 3:
                 model.character_object = "Entity 3";
                 break;
         }
     }
     return model;
 }
예제 #2
0
 public Entity_Model(Stats stats, Client_Model player_model)
 {
     this.id = Entity_Models.Id;
     this.stats = stats;
     this.owner_model = player_model;
     this.rot = new Vector3_Serial(0, 0, 0);
     this.pos = FindPos();
 }
예제 #3
0
        private void AddNewClient(object sender, RoutedEventArgs e)
        {
            if (System.Windows.Forms.MessageBox.Show("Confirmer l'enregistrement de ce client ?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                     MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
            {
                Client_Controller client = new Client_Controller(Client_Model.ExistingClients.Count, Nom.Text, Prenom.Text, Adresse.Text, Telephone.Text, Mail.Text, 0);
                Client_Model.AddNewClient(client);

                MainWindow m = new MainWindow();
                m.Activate();
                m.Show();

                this.Close();
            }
        }
예제 #4
0
        public MainWindow()
        {
            InitializeComponent();
            Aeroport_Model.GetExistingAeroports();
            Avion_Model.GetExistingAvions();
            Vol_Model.GetExistingVols();
            Client_Model.GetExistingClients();
            DataContext = this;
            Title       = "AIR ATLANTIQUE";

            Flights.ItemsSource = Vol_Model.ExistingVols;

            Clients.ItemsSource = Client_Model.ExistingClients;

            //MessageBox.Show(vols[0].DateProperty);
        }
예제 #5
0
    public static Entity_Model_Army GenerateRandomArmy(ref Client_Model player_model, int army_size)
    {
        List<Entity_Model> models = new List<Entity_Model>();
        for(int i = 0; i < army_size; i++) {
            models.Add(Entity_Model.GenerateRandomEntityModel(ref player_model));
        }

        Entity_Model_Army army = new Entity_Model_Army();
        army.entity_army = models.ToArray();
        army.player_model = player_model;
        return army;
    }
예제 #6
0
 public void SetReady(Client_Model client)
 {
     //		server_players.
 }
예제 #7
0
 public void AddPlayerModel(Client_Model player_model)
 {
     players.Add(player_model);
 }
예제 #8
0
 public static void DeleteClient(int IdClient)
 {
     Client_Model.ExistingClients.RemoveAll(v => v.IdProperty == IdClient);
     Client_Model.DeleteClient(IdClient);
 }
    IEnumerator Players_Ready()
    {
        yield return new WaitForSeconds(8.5f);

        socket.AddCustomDataReadEvent(EventHelper.GetEventId("ALL_CLIENTS_JOINED"), delegate (NetworkingPlayer arg1, NetworkingStream arg2) {
            Debug_Console.i.add("server sent is ready");
        });
        manager.SetActive(true);
        List<Client_Model> players = new List<Client_Model>();
        Server_Player_Model server_players = new Server_Player_Model(players);
        NetworkingPlayer[] net_players = socket.Players.ToArray();
        for(int i = 0; i < net_players.Length; i++) {
            Client_Model player_model = new Client_Model("Player_" + i, 0, i);
            player_model.ip = net_players[i].Ip;
            player_model.id = net_players[i].NetworkId;
            server_players.AddPlayerModel(player_model);
        }
        GameObject.FindObjectOfType<Turn_Controller>().server_players = server_players;
        BMSByte bms_byte = EasySerialization.EasySerialize(server_players);

        Networking.WriteCustom(EventHelper.GetEventId("ALL_CLIENTS_JOINED"), socket, bms_byte, true, NetworkReceivers.Others);
        state = 2;
    }