public void Validate_Creation(string name) { string code_name = name.Replace(" ", "_"); int r_alea = rand.Next(1000); Composition compo = Settings.Instance.Default_compo.First ().Value; Team t = new Team(name, compo, null, code_name + r_alea); for (int i = 0; i < t.Nb_Player; i++) { t.add_player(Settings.Instance.Random_Player); } Settings.Instance.AddOrUpdate_Team(t); chooseCompo_panel.SetActive(false); info_panel.SetActive(true); info_panel.GetComponent<TeamController>().Get_Teams_Array(); }
public Settings() { this.version = VERSION; this.notificationState = NotificationState.All; this.soundState = SoundState.All; this.keyboard = new Dictionary<KeyboardAction, KeyCode>(); this.paid_player = new Dictionary<string, Player>(); this.secret_player = new Dictionary<string, Player>(); this.challenge_player = new Dictionary<string, Player>(); this.allowReplayBackup = true; this.selectedLanguage = AvailableLanguage.FR; // -- Setup Keyboard this.keyboard.Add(KeyboardAction.Passe, KeyCode.A); // -- ResetDefaultPlayer(); this.default_team = new Dictionary<string, Team>(); this.default_compo = new Dictionary<string, Composition>(); this.selected_stadium_name = "Stadium_0"; // ----- Default Compo Composition compo_psg = new Composition("PSG", "psg"); compo_psg.SetPosition(0, 0, 0); compo_psg.SetPosition(1, 1, 1); compo_psg.SetPosition(2, 2, 2); compo_psg.SetPosition(3, 3, 3); compo_psg.SetPosition(4, 5, 5); Default_compo.Add("psg", compo_psg); Composition compo_fr = new Composition("FRANCE", "fr"); compo_fr.SetPosition(0, 3, 3); compo_fr.SetPosition(1, 1, 3); compo_fr.SetPosition(2, 2, 5); compo_fr.SetPosition(3, 1, 2); compo_fr.SetPosition(4, 5, 4); Default_compo.Add("fr", compo_fr); // ------------------- // ----- Default Team FOR DEBUG string[] def_sound = new string[] { "Musics/Team/PSG/Allez", "Musics/Team/PSG/Clap" }; Team psg = new Team("PSG", compo_psg, def_sound, "psg"); psg.add_player(new Player(4, 6, 10, 4, "Lombrix", "D_00_lombrix")); psg.add_player(new Player(1, 4, 6, 10, "Itectori", "D_01_itectori")); psg.add_player(new Player(3, 2, 10, 7, "PlayWithCube", "D_02_pwc")); psg.add_player(new Player(7, 4, 4, 8, "GPasDNom", "D_03_gpasdnom")); //psg.add_player(new Player(4, 6, 10, 4, "Lombrix")); //psg.add_player(new Player(1, 4, 6, 10, "Itectori")); //psg.add_player(new Player(3, 2, 10, 7, "PlayWithCube")); //psg.add_player(new Player(7, 4, 4, 8, "GPasDNom")); psg.add_player(new Player(1, 1, 6, 8, "Epitechien")); default_team.Add("psg", psg); def_sound = new string[] { }; Team fr = new Team("France", compo_fr, def_sound, "fr"); fr.add_player(new Player(4, 6, 10, 4, "Lombrix", "D_00_lombrix")); fr.add_player(new Player(1, 4, 6, 10, "Itectori", "D_01_itectori")); fr.add_player(new Player(3, 2, 10, 7, "PlayWithCube", "D_02_pwc")); fr.add_player(new Player(7, 4, 4, 8, "GPasDNom", "D_03_gpasdnom")); //fr.add_player(new Player(4, 6, 10, 4, "Lombrix")); //fr.add_player(new Player(1, 4, 6, 10, "Itectori")); //fr.add_player(new Player(3, 2, 10, 7, "PlayWithCube")); //fr.add_player(new Player(7, 4, 4, 8, "GPasDNom")); fr.add_player(new Player(8, 7, 5, 7, "Epiteen")); default_team.Add("fr", fr); // ------------------ selected_team = fr; }