void Start() { ph = GlobalPanelHandler.Instance; sm = SCManager.Instance; ch = CameraHandler.Instance; ws = WinstonStats.Instance; gs = GameStatus.Instance; da = DiaryAnimation.Instance; continuar.onClick.AddListener(() => { displayInGameMenu(menuIsOn); }); goMainMenu.onClick.AddListener(() => sm.LoadScene(sm.ReturnLastSceneName())); exitGame.onClick.AddListener(() => Application.Quit()); StartCoroutine(EndGameChecker()); guardarSalir.onClick.AddListener(() => SaveExit()); playAgain.onClick.AddListener(() => sm.LoadScene("game1")); menuPrincipal.onClick.AddListener(() => sm.LoadScene("start")); }
private void GetDataTypeCallback(string url, Type dataType) { if (dataType == typeof(SCUser)) { SCManager.GetUser(url, GetUserCallback); } else if (dataType == typeof(SCTrack)) { SCManager.GetTrack(url, GetTrackCallback); } }
/// <summary> /// Constructeur du Singleton /// </summary> private PirepManager() { DelayedExit = false; DelayReco = false; AutoExit = false; m_SyncAIDone = false; Log = Logger.Instance; LastGoodUpdate = DateTimeEx.UtcNowMilli; Mapping = AIMapping.Instance; try { if ((m_btnConnect = ffs2play.getControl("btnConPirep") as Button) != null) { m_btnConnect.Click += btnConPirep_Click; } else { throw new InvalidOperationException("Le bouton btnConPirep n'existe pas"); } if ((m_rtbDecryptedMetar = ffs2play.getControl("rtbDecryptedMetar") as RichTextBox) == null) { throw new InvalidOperationException("Le contrôle richttextbox rtbDecryptedMetar n'existe pas"); } if ((m_tbMetar = ffs2play.getControl("tbMetarManuel") as TextBox) == null) { throw new InvalidOperationException("Le contrôle tbMetarManuel n'existe pas"); } } catch (Exception e) { Log.LogMessage("Erreur Constructeur PirepManager : " + e.Message); } m_bConnected = false; m_AIManagement = false; m_sURL = ""; Analyse = AnalyseurManager.Instance; LiveUpdateTimer = new System.Timers.Timer(30000); LiveUpdateTimer.Elapsed += new ElapsedEventHandler(OnLiveUpdate); LiveUpdateTimer.Start(); ATCTimer = new System.Timers.Timer(5000); ATCTimer.Elapsed += new ElapsedEventHandler(OnATCUpdate); SCM = SCManager.Instance; P2P = P2PManager.Instance; AEStoPHPCryptography aes = new AEStoPHPCryptography(); aes.GenerateRandomKeys(); m_sAESKey = aes.EncryptionKeyString; #if DEBUG Log.LogMessage("PManager: AES Key = " + m_sAESKey, Color.DarkRed, 2); #endif ButtonsTips = new ToolTip(); }
private void PlayTrackDataCallback(SCTrack track) { currentTrack = track; Text artist = GameObject.Find("TrackInfo/Artist/Text").GetComponent <Text>(); Text trackname = GameObject.Find("TrackInfo/Track/Text").GetComponent <Text>(); artist.text = track.user.username; trackname.text = track.title; SCManager.GetImage(track.artwork_url, GetAlbumArtCallback); SCManager.GetImage(track.waveform_url, GetWaveFormCallback); }
protected void Awake() { if (m_Instance != null) { Destroy(gameObject); /// si ya deja qulqun sur le trone je me detruit } else { m_Instance = this; // this est le nouveau roi (SINGLETON) } DontDestroyOnLoad(gameObject); }
// Use this for initialization void Start() { GlobalPanelHandler ph = GlobalPanelHandler.Instance; DataBaseHandler db = DataBaseHandler.Instance; SCManager sm = SCManager.Instance; startGameButton.onClick.AddListener(() => { ph.HoverShowUp(HoverPanel); ph.PanelShowUp(JugarPartidaPanel); }); historialButton.onClick.AddListener(() => { ph.HoverShowUp(HoverPanel); ph.PanelShowUp(Historial); }); exitButton.onClick.AddListener(() => { Application.Quit(); }); HoverButton.onClick.AddListener(() => { ph.HoverShowOff(HoverPanel); ph.PanelShowOff(); }); ngAceptButton.onClick.AddListener(() => { db.CreateGame("Game1"); sm.LoadScene("game1"); }); ngCancelButton.onClick.AddListener(() => { ph.HoverShowOff(HoverPanel); ph.PanelShowOff(); }); db.UpdatePlayersDropdown(playersDrops); ngNewUser.onClick.AddListener(() => { ph.PanelShowUp(NewUser); }); }
private AnalyseurManager() { Log = Logger.Instance; try { // Récupération du pointeur sur les variables du simulateur if ((m_lvDonneesFS = ffs2play.getControl("lvDonneesFS") as ListViewEx) == null) { throw new InvalidOperationException("La liste m_lvDonneesFS n'existe pas"); } } catch (Exception e) { Log.LogMessage("Erreur Constructeur Analyseur : " + e.Message, Color.DarkViolet, 0); } SCM = SCManager.Instance; SCM.OnSCReceiveEvent += OnSCReceiveEvent; SCM.OnSCReceiveVariable += OnSCReceiveVariable; Dernier = new AircraftState(); ADernier = new AircraftState(Dernier); m_FirstScan = true; }
/// <summary> /// Constructeur d'un PEER P2P /// </summary> /// <param name="pServer"></param> public Peer(ref UDPServer pServer, IPAddress pExternalIP, int pPort, string CallSign, bool pDisabled = false, bool pLocal = false, List <IPAddress> pInternalIP = null) { m_CallSign = CallSign; P2P = P2PManager.Instance; m_AIMapping = AIMapping.Instance; Server = pServer; m_Data = new AirData(); m_OldData = new AirData(); m_SendData = new AirData(); m_FuturData = new AirData(); m_ActualPos = new AirData(); m_AIData = new AIMoveStruct(); m_ExternalIP = pExternalIP; m_InternalIP = pInternalIP; m_Port = pPort; Log = Logger.Instance; m_bLocal = pLocal; if (!m_bLocal) { m_EP = new IPEndPoint(m_ExternalIP, m_Port); } else { m_EP = null; } m_SC = SCManager.Instance; m_Analyseur = AnalyseurManager.Instance; m_PM = PirepManager.Instance; m_FrameRateArray = new List <double>(); m_bDisabled = true; m_Mutex = new Mutex(); m_sel_iplocal = 0; m_TrySimpleAI = false; Disabled = pDisabled; Visible = false; m_bSpawnable = false; m_bBlockData = false; }
public void PlayTrack() { SCManager.GetTrack(input.text, PlayTrackDataCallback); SCManager.GetTrackAudioClip(input.text, GetTrackAudioClipCallback); }
public void GenericDataCall() { SCManager.GetDataType(input.text, GetDataTypeCallback); }
public void SignIn() { SCManager.Connect(ConnectCallback); }
/// <summary> /// Constructeur de la fenêtre principale /// </summary> public ffs2play() { // Définition de la culture par défaut Thread.CurrentThread.CurrentUICulture = FrenchCulture; // LeResourceManager prend en paramètre : nom_du_namespace.nom_de_la_ressource_principale RM = new System.Resources.ResourceManager("Localisation.Form1", typeof(ffs2play).Assembly); // Initialisation de contenu de la fenêtre InitializeComponent(); #if DEBUG #if P3D Text = "ffs2play P3D (version Debug)"; #else Text = "ffs2play (version Debug)"; #endif #else #if P3D Text = "ffs2play P3D"; #else Text = "ffs2play"; #endif #endif pInstance = this; // Préparation du bouton de connexion au simulateur ILConnexionFS.Images.Add(Resources.plane_red); ILConnexionFS.Images.SetKeyName(0, "Déconnecté"); ILConnexionFS.Images.Add(Resources.plane_green); ILConnexionFS.Images.SetKeyName(1, "Connecté"); btnConnectFS.ImageIndex = 0; // Préparation du bouton de connexion au serveur web ilServeur.Images.Add(Resources.connect2_R); ilServeur.Images.SetKeyName(0, "Déconnecté"); ilServeur.Images.Add(Resources.connect2_V); ilServeur.Images.SetKeyName(1, "Connecté"); btnConPirep.ImageIndex = 0; // Configuration par défaut de la fenêtre WindowState = FormWindowState.Normal; StartPosition = FormStartPosition.WindowsDefaultBounds; SetAllowUnsafeHeaderParsing20(); // Copy user settings from previous application version if necessary settings = Settings.Default; if ((bool)settings["UpgradeRequired"] == true) { // upgrade the settings to the latest version settings.Upgrade(); // clear the upgrade flag settings["UpgradeRequired"] = false; settings.Save(); } else { // the settings are up to date } // On vérifie des les données de taille et de position de la fenêtre ne sont pas vides // Et qu'elles sont toujours valides avec la configuration d'écran actuelle // Ceci pour éviter une fenêtre en dehors des limites if (Properties.Settings.Default.WindowPosition != Rectangle.Empty && IsVisibleOnAnyScreen(Properties.Settings.Default.WindowPosition)) { // Définition de la position et de la taille de la fenêtre StartPosition = FormStartPosition.Manual; DesktopBounds = Properties.Settings.Default.WindowPosition; // Définition de l'état de la fenêtre pour être maximisée // ou réduite selon la sauvegarde WindowState = Properties.Settings.Default.WindowState; } else { // Réinitialisation de la position à la valeur par défaut StartPosition = FormStartPosition.WindowsDefaultLocation; // Nous pouvons alors définir la taille enrégistrée si celle ci // Existe if (Properties.Settings.Default.WindowPosition != Rectangle.Empty) { Size = Properties.Settings.Default.WindowPosition.Size; } } // Mise à jour de l'option Météo Automatique cbEnaAutoWeather.Checked = Settings.Default.MetarAutoEnable; // La fenêtre est configurée windowInitialized = true; log = Logger.Instance; log.LogMessage("ffs2play démarré"); // Creation du contrôleur d'interface avec le simulateur scm = SCManager.Instance; // Création du contrôleur de mapping des AI m_Mapping = AIMapping.Instance; // Création du contrôleur d'inteface avec le serveur web pm = PirepManager.Instance; // Création du contrôleur d'analyse de vol Analyse = AnalyseurManager.Instance; // Création du contrôleur de connexion P2P P2P = P2PManager.Instance; if (Properties.Settings.Default.P2PEnable) { P2P.Init(true); } AcceptButton = btnSend; string[] arguments = Environment.GetCommandLineArgs(); scm.openConnection(); //Vérification de la version string CheckVersionURL; #if P3D CheckVersionURL = "http://download.ffsimulateur2.fr/ffs2playp3d.php"; #else CheckVersionURL = "http://download.ffsimulateur2.fr/ffs2play.php"; #endif if (Properties.Settings.Default.Beta) { CheckVersionURL += "?beta"; } HTTPRequestThread CheckVersion = new HTTPRequestThread(CheckVersionURL, CheckVersionCallBack); CheckVersion.Start(); if (!Properties.Settings.Default.LogVisible) { scMainWindow.Panel2Collapsed = true; scMainWindow.Panel2.Hide(); } }
public dlgP2P() { SCManager sc = SCManager.Instance; init = true; InitializeComponent(); AIM = AIMapping.Instance; #if DEBUG cbShadow = new CheckBox(); gbMultijoueur.Controls.Add(cbShadow); // // cbShadow // cbShadow.AutoSize = true; cbShadow.Location = new Point(9, 21); cbShadow.Name = "cbShadow"; cbShadow.Size = new Size(141, 17); cbShadow.TabIndex = 1; cbShadow.Text = "Activer le mode Shadow"; cbShadow.UseVisualStyleBackColor = true; cbShadow.CheckedChanged += new EventHandler(this.cbShadow_CheckedChanged); cbShadow.Checked = Properties.Settings.Default.ShadowEnable; #endif Changes = false; NeedP2PRestart = false; NeedDBReload = false; cbUPNP.Checked = Properties.Settings.Default.UPNPEnable; cbInfoSim.Checked = Properties.Settings.Default.P2PInfoEnable; numPort.Value = Properties.Settings.Default.P2PPort; numP2PTx.Value = Properties.Settings.Default.P2PRate; numAIRayon.Value = Properties.Settings.Default.P2PRadius; numAILimite.Value = Properties.Settings.Default.P2PAILimite; cbBeta.Checked = Properties.Settings.Default.Beta; cbDropRateDisp.Checked = Properties.Settings.Default.EnaDropDisp; cbSendDropRate.Checked = Properties.Settings.Default.EnaDropSend; btnAppliquer.Enabled = false; btnAppliquer.BackColor = Color.LightGray; btnAppliquer.ForeColor = Color.Black; UpdateEnable(); if (PirepManager.Instance.IsConnected()) { numPort.Enabled = false; } init = false; Sim = sc.GetVersion(); switch (Sim) { case SIM_VERSION.UNKNOWN: FolderList = null; lvItems.Enabled = false; btnAddItem.Enabled = false; btnDelItem.Enabled = false; break; case SIM_VERSION.FSX: gbFSX.Text += "FSX Microsoft"; FolderList = Properties.Settings.Default.AIScanFoldersFSX; break; case SIM_VERSION.FSX_STEAM: gbFSX.Text += "FSX Steam Edition"; FolderList = Properties.Settings.Default.AIScanFoldersFSXSE; break; case SIM_VERSION.P3D_V2: gbFSX.Text += "Prepar3D V2"; FolderList = Properties.Settings.Default.AIScanFoldersP3DV2; break; case SIM_VERSION.P3D_V3: gbFSX.Text += "Prepar3D V3"; FolderList = Properties.Settings.Default.AIScanFoldersP3DV3; break; case SIM_VERSION.P3D_V4: gbFSX.Text += "Prepar3D V4"; FolderList = Properties.Settings.Default.AIScanFoldersP3DV4; break; } if (FolderList != null) { foreach (string Path in FolderList) { lvItems.Items.Add(Path); } } }
private AIMapping() { m_Initialized = false; Log = Logger.Instance; m_SC = SCManager.Instance; m_SC.OnSCReceiveOpen += OnSCReceiveOpen; // On localise l'installateur de chaque simulateur BaseInstallation = new string[5]; //Check for FSX Installation if (Properties.Settings.Default.AIScanFoldersFSX.Count < 1) { BaseInstallation[0] = FindInstallationPath("Microsoft\\Microsoft Games\\Flight Simulator\\10.0"); if (BaseInstallation[0].Length > 0) { Properties.Settings.Default.AIScanFoldersFSX.Add(BaseInstallation[0] + "SimObjects\\Airplanes"); Properties.Settings.Default.AIScanFoldersFSX.Add(BaseInstallation[0] + "SimObjects\\Rotorcraft"); Properties.Settings.Default.Save(); #if DEBUG Log.LogMessage("AIMapping : Répertoire d'installation FSX trouvé : = " + BaseInstallation[0], Color.DarkBlue, 1); #endif } } //Vérification installation de FSX Steam if (Properties.Settings.Default.AIScanFoldersFSXSE.Count < 1) { BaseInstallation[1] = FindInstallationPath("DovetailGames\\FSX"); if (BaseInstallation[1].Length > 0) { if (!BaseInstallation[1].EndsWith("\\")) { BaseInstallation[1] += "\\"; } Properties.Settings.Default.AIScanFoldersFSXSE.Add(BaseInstallation[1] + "SimObjects\\Airplanes"); Properties.Settings.Default.AIScanFoldersFSXSE.Add(BaseInstallation[1] + "SimObjects\\Rotorcraft"); Properties.Settings.Default.Save(); #if DEBUG Log.LogMessage("AIMapping : Répertoire d'installation FSX STEAM trouvé : = " + BaseInstallation[1], Color.DarkOliveGreen, 1); #endif } } //Vérification installation de P3D if (Properties.Settings.Default.AIScanFoldersP3DV2.Count < 1) { BaseInstallation[2] = FindInstallationPath("Lockheed Martin\\Prepar3D v2"); if (BaseInstallation[2].Length > 0) { Properties.Settings.Default.AIScanFoldersP3DV2.Add(BaseInstallation[2] + "SimObjects\\Airplanes"); Properties.Settings.Default.AIScanFoldersP3DV2.Add(BaseInstallation[2] + "SimObjects\\Rotorcraft"); Properties.Settings.Default.Save(); #if DEBUG Log.LogMessage("AIMapping : Répertoire d'installation Prepar3D v2 trouvé : = " + BaseInstallation[2], Color.DarkOliveGreen, 1); #endif } } if (Properties.Settings.Default.AIScanFoldersP3DV3.Count < 1) { BaseInstallation[3] = FindInstallationPath("Lockheed Martin\\Prepar3D v3"); if (BaseInstallation[3].Length > 0) { Properties.Settings.Default.AIScanFoldersP3DV3.Add(BaseInstallation[3] + "SimObjects\\Airplanes"); Properties.Settings.Default.AIScanFoldersP3DV3.Add(BaseInstallation[3] + "SimObjects\\Rotorcraft"); Properties.Settings.Default.Save(); #if DEBUG Log.LogMessage("AIMapping : Répertoire d'installation Prepar3D v3 trouvé : = " + BaseInstallation[3], Color.DarkOliveGreen, 1); #endif } } if (Properties.Settings.Default.AIScanFoldersP3DV4.Count < 1) { BaseInstallation[4] = FindInstallationPath("Lockheed Martin\\Prepar3D v4"); if (BaseInstallation[4].Length > 0) { Properties.Settings.Default.AIScanFoldersP3DV4.Add(BaseInstallation[4] + "SimObjects\\Airplanes"); Properties.Settings.Default.AIScanFoldersP3DV4.Add(BaseInstallation[4] + "SimObjects\\Rotorcraft"); Properties.Settings.Default.Save(); #if DEBUG Log.LogMessage("AIMapping : Répertoire d'installation Prepar3D v4 trouvé : = " + BaseInstallation[4], Color.DarkOliveGreen, 1); #endif } } }
/// <summary> /// Constructeur du Singleton /// </summary> private P2PManager() { Log = Logger.Instance; #if DEBUG Log.LogMessage("P2P Manager : Démarré", Color.Blue, 1); #endif m_Mapper = AIMapping.Instance; Server = new UDPServer(); Peers = new List <Peer>(); Discoverer = new NatDiscoverer(); m_InternalIP = new List <IPAddress>(); m_SCM = SCManager.Instance; m_Analyseur = AnalyseurManager.Instance; m_Analyseur.OnStateChange += M_Analyseur_OnStateChange; CheckAI = new System.Timers.Timer(5000); CheckAI.Elapsed += CheckAI_Elapsed; CheckPropertiesData(); try { // récupération du pointeur sur le contrôle liste des utilisateurs P2P if ((m_lvUsers = ffs2play.getControl("lvUsers") as ListViewEx) == null) { throw new InvalidOperationException("La liste lvUsers n'existe pas"); } // récupération du pointeur sur le contrôle liste des détails Peer if ((m_lvPeerDetail = ffs2play.getControl("lvPeerDetail") as ListViewEx) == null) { throw new InvalidOperationException("La liste lvPeerDetail n'existe pas"); } // récupération du pointeur sur le contrôle liste des utilisateurs P2P if ((m_rtbLogChat = ffs2play.getControl("rtbLogChat") as RichTextBox) == null) { throw new InvalidOperationException("La zone de tchat rtbLogChat n'existe pas"); } } catch (Exception e) { Log.LogMessage("P2P Manager : Erreur Constructeur = " + e.Message, Color.DarkViolet); } try { // Récupératgion de l'adresse IP locale IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress ip in host.AddressList) { if (ip.AddressFamily == AddressFamily.InterNetwork) { m_InternalIP.Add(ip); #if DEBUG Log.LogMessage("P2PManager: IP locale trouvée = " + ip.ToString(), Color.DarkBlue, 1); #endif } } if (m_InternalIP.Count == 0) { throw new Exception("IP Locale introuvable"); } } catch (Exception e) { Log.LogMessage("P2P Manager : Erreur Constructeur = " + e.Message, Color.DarkViolet); } m_lvUsers.SelectedIndexChanged += M_lvUsers_SelectedIndexChanged; m_lvUsers.MouseClick += M_lvUsers_MouseClick; m_lvUsers.ItemSelectionChanged += M_lvUsers_ItemSelectionChanged; }
private void Awake() { playerManager = GetComponent <PlayerManager>(); sceneManager = GetComponent <SCManager>(); }