Exemplo n.º 1
0
        private void createMissions()
        {
            missions = new List<Mission>();

            Type[] missionsClassesList = Assembly.GetExecutingAssembly().GetTypes().Where(type => type.IsSubclassOf(typeof(Mission))).ToArray();
            foreach (Type missionClass in missionsClassesList)
            {
                Mission newMission = (Mission)Activator.CreateInstance(missionClass);

                if (Globals.debug == true || newMission.getIsActivated())
                {
                    newMission.OnStarted += (sender) =>
                    {
                        if (DemagoScript.currentMission != null)
                        {
                            DemagoScript.currentMission.stop();
                        }

                        DemagoScript.currentMission = (Mission)sender;
                        GTA.UI.Notify(sender.getName());

                        if (!Globals.debug)
                        {
                            GUIManager.Instance.menu.getMenuPool().hide("Outils");
                            GUIManager.Instance.menu.getMenuPool().hide("Modèles");
                            GUIManager.Instance.menu.getMenuPool().hide("Véhicules");
                        }
                    };

                    newMission.OnAccomplished += (sender, time) =>
                    {
                        string missionTime = "Temps inconnu";
                        if (Tools.getTextFromMilliSeconds(time) != "")
                        {
                            missionTime = "En " + Tools.getTextFromMilliSeconds(time);
                        }

                        SuccessMissionPopup successPopup = new SuccessMissionPopup(sender.getName(), missionTime);
                        successPopup.OnPopupClose += () =>
                        {
                            GUIManager.Instance.popupManager.remove(successPopup);

                            AudioManager.Instance.FilesSubFolder = @"joe\joe";
                            AudioManager.Instance.startSound("anticonformiste");

                            NotificationPopup creditsPopup = new NotificationPopup();
                            creditsPopup.add(new UIRectElement(0.5, 0.5, 1, 1, UIColor.BLACK, 200));
                            creditsPopup.add(new UITextElement("GTA Démago", 0.5, 0.2, 1.5, true, Font.Pricedown, UIColor.GTA_YELLOW));
                            creditsPopup.add(new UITextElement("Merci d’avoir jouer à GTA Démago !", 0.5, 0.29, 0.7, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("De nouvelles missions seront bientôt disponibles alors rejoignez nous sur ", 0.5, 0.33, 0.7, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Twitch : http://twitch.tv/realmyop2", 0.5, 0.39, 0.5, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Facebook : http://facebook.com/realmyop", 0.5, 0.42, 0.5, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Twitter : http://twitter.com/RealMyop", 0.5, 0.45, 0.5, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Venez nombreux !", 0.5, 0.525, 1, true, Font.HouseScript, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Entrée pour fermer", 0.5, 0.9, 0.6, true, Font.HouseScript, UIColor.WHITE));
                            creditsPopup.OnPopupClose += () =>
                            {
                                GUIManager.Instance.popupManager.remove(creditsPopup);

                                AudioManager.Instance.stopAll();
                                AudioManager.Instance.FilesSubFolder = "";
                            };

                            Script.Wait(100);

                            creditsPopup.show();
                        };
                        successPopup.show();
                    };

                    newMission.OnEnded += (sender) =>
                    {
                        DemagoScript.currentMission = null;

                        if (!Globals.debug)
                        {
                            GUIManager.Instance.menu.getMenuPool().show("Outils");
                            GUIManager.Instance.menu.getMenuPool().show("Modèles");
                            GUIManager.Instance.menu.getMenuPool().show("Véhicules");
                        }
                    };

                    missions.Add(newMission);
                }
            }
        }
Exemplo n.º 2
0
        private void createMissions()
        {
            missions = new List <Mission>();

            Type[] missionsClassesList = Assembly.GetExecutingAssembly().GetTypes().Where(type => type.IsSubclassOf(typeof(Mission))).ToArray();
            foreach (Type missionClass in missionsClassesList)
            {
                Mission newMission = (Mission)Activator.CreateInstance(missionClass);

                if (Globals.debug == true || newMission.getIsActivated())
                {
                    newMission.OnStarted += (sender) =>
                    {
                        if (DemagoScript.currentMission != null)
                        {
                            DemagoScript.currentMission.stop();
                        }

                        DemagoScript.currentMission = (Mission)sender;
                        GTA.UI.Notify(sender.getName());

                        if (!Globals.debug)
                        {
                            GUIManager.Instance.menu.getMenuPool().hide("Outils");
                            GUIManager.Instance.menu.getMenuPool().hide("Modèles");
                            GUIManager.Instance.menu.getMenuPool().hide("Véhicules");
                        }
                    };

                    newMission.OnAccomplished += (sender, time) =>
                    {
                        string missionTime = "Temps inconnu";
                        if (Tools.getTextFromMilliSeconds(time) != "")
                        {
                            missionTime = "En " + Tools.getTextFromMilliSeconds(time);
                        }

                        SuccessMissionPopup successPopup = new SuccessMissionPopup(sender.getName(), missionTime);
                        successPopup.OnPopupClose += () =>
                        {
                            GUIManager.Instance.popupManager.remove(successPopup);

                            AudioManager.Instance.FilesSubFolder = @"joe\joe";
                            AudioManager.Instance.startSound("anticonformiste");

                            NotificationPopup creditsPopup = new NotificationPopup();
                            creditsPopup.add(new UIRectElement(0.5, 0.5, 1, 1, UIColor.BLACK, 200));
                            creditsPopup.add(new UITextElement("GTA Démago", 0.5, 0.2, 1.5, true, Font.Pricedown, UIColor.GTA_YELLOW));
                            creditsPopup.add(new UITextElement("Merci d’avoir jouer à GTA Démago !", 0.5, 0.29, 0.7, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("De nouvelles missions seront bientôt disponibles alors rejoignez nous sur ", 0.5, 0.33, 0.7, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Twitch : http://twitch.tv/realmyop2", 0.5, 0.39, 0.5, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Facebook : http://facebook.com/realmyop", 0.5, 0.42, 0.5, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Twitter : http://twitter.com/RealMyop", 0.5, 0.45, 0.5, true, Font.ChaletLondon, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Venez nombreux !", 0.5, 0.525, 1, true, Font.HouseScript, UIColor.WHITE));
                            creditsPopup.add(new UITextElement("Entrée pour fermer", 0.5, 0.9, 0.6, true, Font.HouseScript, UIColor.WHITE));
                            creditsPopup.OnPopupClose += () =>
                            {
                                GUIManager.Instance.popupManager.remove(creditsPopup);

                                AudioManager.Instance.stopAll();
                                AudioManager.Instance.FilesSubFolder = "";
                            };

                            Script.Wait(100);

                            creditsPopup.show();
                        };
                        successPopup.show();
                    };

                    newMission.OnEnded += (sender) =>
                    {
                        DemagoScript.currentMission = null;

                        if (!Globals.debug)
                        {
                            GUIManager.Instance.menu.getMenuPool().show("Outils");
                            GUIManager.Instance.menu.getMenuPool().show("Modèles");
                            GUIManager.Instance.menu.getMenuPool().show("Véhicules");
                        }
                    };

                    missions.Add(newMission);
                }
            }
        }