Ejemplo n.º 1
0
 public virtual MainScreen SetUp(InitializeOption initializeOption)
 {
     application = new WinformsTestConfiguration().LaunchApplication();
     var screenRepository = new ScreenRepository(application.ApplicationSession);
     mainScreen = screenRepository.Get<MainScreen>("Form1", initializeOption);
     return mainScreen;
 }
Ejemplo n.º 2
0
        public void TestInitialize()
        {
            string applicationFilePath = Path.Combine(TestContext.DeploymentDirectory, ApplicationFileName);
            ApplicationUnderTest.Launch(applicationFilePath);

            mainScreen = new MainScreen();
        }
Ejemplo n.º 3
0
    // [HideInInspector] public GameObject car;
    // Use this for initialization
    void Awake()
    {
        secondCanvas = GameObject.Find("SecondCanvas");
        fireBackground = GameObject.Find("FireBackground");
        fireStart = GameObject.Find("FireStart");
        garage = GameObject.FindObjectOfType<Garage>();
        taskMenu = GameObject.FindObjectOfType<TaskMenu>();
        kaController = GameObject.FindObjectOfType<KAController>();
        waitBackground = GameObject.FindObjectOfType<WaitBackground>();
        mainScreen = GameObject.FindObjectOfType<MainScreen>();
        bg = GameObject.Find("BG");
        carsInfo = GetComponent<CarsInfo>();
        filling = GameObject.FindObjectOfType<Filling>();
        carChanger = GameObject.FindObjectOfType<CarChanger>();
        dustSmall = GameObject.Find("DustSmall");
        windowWarning = GameObject.FindObjectOfType<WindowWarning>();
        windowConfirmation = GameObject.FindObjectOfType<WindowConfirmation>();

        mainBonus = GetComponent<MainBonus>();

        dailyEvents = GetComponent<DailyEvents>();
        moneyBar = GameObject.FindObjectOfType<MoneyBar>();

        boosterMenu = GameObject.FindObjectOfType<BoosterMenu>();

        dailyGiftMenu = GameObject.FindObjectOfType<DailyGiftMenu>();

        backMenuButton = GameObject.FindObjectOfType<BackMenuButton>();
        /*
        car = garage.transform.Find("Car").gameObject;
        if (car == null)
            CreateCar();    */
    }
Ejemplo n.º 4
0
 public virtual MainScreen SetUp(InitializeOption initializeOption)
 {
     application = new WinformsTestConfiguration().LaunchApplication();
     var screenRepository = new ScreenRepository(application.ApplicationSession);
     mainScreen = screenRepository.Get<MainScreen>("MainWindow", initializeOption);
     //mainScreen.Tabs[0].SelectTabPage(2);
     return mainScreen;
 }
Ejemplo n.º 5
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     operation = ' ';
     a         = 0;
     b         = 0;
     c         = 0;
     MainScreen.Clear();
 }
Ejemplo n.º 6
0
        public void FromProcess()
        {
            //Act
            mainScreen = Screen.FromProcess <MainScreen>(mainScreen.Application.Process);

            //Assert
            Assert.IsTrue(mainScreen.Application.Exists);
        }
Ejemplo n.º 7
0
        private void ShowMainForm(User user)
        {
            authorisationForm.Hide();

            var form = new MainScreen(user);
            form.Show();

        }
    void Awake()
    {
        mainScreenScript = MainScreen.Script;

        //window = new Rect(Screen.width * 0.5f - width * 0.5f, Screen.height - height+5, width, height);
        //window = mainScreenScript.GetAreaForChat();
        window = new Rect(30, 30, width, height);
    }
        /// <summary>Switches the control to a specific GUI</summary>
        /// <param name="screen">Screen that owns the control from now on</param>
        internal void SetScreen(MainScreen screen)
        {
            this.screen = screen;

            for (int index = 0; index < base.Count; ++index)
            {
                base[index].SetScreen(screen);
            }
        }
Ejemplo n.º 10
0
        public CustomerControl(Customer customer, MainScreen screen)
        {
            Screen        = screen;
            this.customer = customer;
            InitializeComponent();
            Update();

            MainScreen.ZoomLoop.Subscribe(Update);
        }
Ejemplo n.º 11
0
 public Review(MainScreen mainScreen, RestApiHelper api, List <Models.UserProfile> allUser, int fnbId, string fnbName)
 {
     this.mainScreen = mainScreen;
     this.api        = api;
     this.fnbId      = fnbId;
     this.fnbName    = fnbName;
     this.allUser    = allUser;
     InitializeComponent();
 }
        public virtual MainScreen SetUp(InitializeOption initializeOption)
        {
            application = new WinformsTestConfiguration().LaunchApplication();
            var screenRepository = new ScreenRepository(application.ApplicationSession);

            mainScreen = screenRepository.Get <MainScreen>("MainWindow", initializeOption);
            //mainScreen.Tabs[0].SelectTabPage(2);
            return(mainScreen);
        }
Ejemplo n.º 13
0
        public MenuTemplate1Component(Game game, D3DEngine engine, MainScreen screen, SandboxCommonResources commonResources)
        {
            _engine         = engine;
            _screen         = screen;
            CommonResources = commonResources;
            _game           = game;

            _engine.ScreenSize_Updated += UpdateLayoutInternal;
        }
Ejemplo n.º 14
0
 public BalanceDetails(MainScreen mainView, int startingValue, int income, int expense, int current) : this()
 {
     this.mainView = mainView;
     this.starting = startingValue;
     this.income   = income;
     this.expenses = expense;
     this.current  = current;
     update();
 }
Ejemplo n.º 15
0
        public void TestVPNConnection()
        {
            // Switch to VPN client session
            this.vpnClient.Session.SwitchTo();
            LandingScreen landingScreen = new LandingScreen(this.vpnClient.Session);

            landingScreen.ClickGetStartedButton();

            // User Sign In via web browser
            UserCommonOperation.UserSignIn(this.vpnClient, this.browser);

            // Main Screen
            this.vpnClient.Session.SwitchTo();
            MainScreen mainScreen = new MainScreen(this.vpnClient.Session);

            mainScreen.ClickServerListButton();

            // Server Screen
            ServerListScreen serverListScreen = new ServerListScreen(this.vpnClient.Session);

            serverListScreen.RandomSelectDifferentCityServer("Miami");
            string prevCity = serverListScreen.GetSelectedCity();

            Console.WriteLine("Before switching: the selected city is {0}", prevCity);

            // User turns on VPN
            UserCommonOperation.ConnectVPN(this.vpnClient, this.desktop);

            // Click the server button
            mainScreen = new MainScreen(this.vpnClient.Session);
            mainScreen.ClickServerListButton();

            // Select a random US server
            serverListScreen = new ServerListScreen(this.vpnClient.Session);
            serverListScreen.RandomSelectDifferentCityServer("Atlanta");
            string currentCity = serverListScreen.GetSelectedCity();

            Console.WriteLine("After switching: the selected city is {0}", currentCity);

            // Check the subtitle
            Assert.AreEqual(string.Format("From {0} to {1}", prevCity, currentCity), mainScreen.GetSubtitle());

            // Check the windows notification again
            this.desktop.Session.SwitchTo();
            WindowsNotificationScreen windowsNotificationScreen = new WindowsNotificationScreen(this.desktop.Session);

            Assert.AreEqual(string.Format("From {0} to {1}", prevCity, currentCity), windowsNotificationScreen.GetTitleText());
            Assert.AreEqual("You switched servers.", windowsNotificationScreen.GetMessageText());
            windowsNotificationScreen.ClickDismissButton();

            // User turns off VPN
            UserCommonOperation.DisconnectVPN(this.vpnClient, this.desktop);

            // Sign out
            UserCommonOperation.UserSignOut(this.vpnClient);
        }
Ejemplo n.º 16
0
        private void ChangeLoadApplicationControls()
        {
            bool clearDataWhenDisabled = true;
            bool isLoadApplicationToggleButtonEnabled = TargetConnection.IsTargetConnected && RealTimeModelProperties.IsModelLocationLoaded;
            bool isLoadedModelRichTextBoxEnable       = TargetConnection.IsTargetConnected && SimulationState.IsModelLoadedOnTarget;

            MainScreen.ChangeLoadApplicationToggleButtonState(SimulationState.IsModelLoadedOnTarget, isLoadApplicationToggleButtonEnabled);
            MainScreen.ChangeLoadedModelRichTextBoxState(isLoadedModelRichTextBoxEnable, clearDataWhenDisabled);
            MainScreen.ChangeStopTimeRichTextBoxState(isLoadedModelRichTextBoxEnable, clearDataWhenDisabled);
        }
Ejemplo n.º 17
0
        private void RefreshPipeline()
        {
            MainScreen mainScreen = FormWrapper.Find("mainScreen") as MainScreen;

            mainScreen.PipelineScreenBrowser = null;
            IPipeline pipeline = mainScreen.GetService <EllieMae.EMLite.Common.UI.IPipeline>();

            mainScreen.ShowTab("Home");
            mainScreen.ShowTab("Pipeline");
        }
Ejemplo n.º 18
0
        //private DataGridView dgvDepot;
        public DepotAddForm(MainScreen parent)
        {
            InitializeComponent();

            parentForm = parent;
            //this.dgvDepot = dgvDepot;
            cbxCategory.DataSource        = ItemCategoryDAO.Instance.getAllCategory();
            cbxCategory.DisplayMember     = "name";
            this.lblDepotAddFormUser.Text = "You are " + parent.UserFirstName;
        }
Ejemplo n.º 19
0
        public void UserInputTestValid([Values("1", "Admin", "2", "GUests")] string input)
        {
            bool testInput = MainScreen.UserInput(input);

            Assert.AreEqual(false, testInput);

            var ex = Assert.Throws <FormatException>(() => MainScreen.UserInput(input));

            Assert.That(ex.Message, Is.EqualTo("\n\n  The inserted value was not a number."));
        }
Ejemplo n.º 20
0
        public static void Start()
        {
            Application.Init();

            MenuBar menu = new Navigation(db).Render();
            var     win  = MainScreen.Render();

            Application.Top.Add(menu, win);
            Application.Run();
        }
Ejemplo n.º 21
0
        public virtual MainScreen SetUp(InitializeOption initializeOption)
        {
            var configuration = new WinFormTestConfiguration(string.Empty);

            application = configuration.Launch();
            var screenRepository = new ScreenRepository(application.ApplicationSession);

            mainScreen = screenRepository.Get <MainScreen>("Form1", initializeOption);
            return(mainScreen);
        }
Ejemplo n.º 22
0
        public void TestOnboarding()
        {
            // Switch to VPN client session
            this.vpnClient.Session.SwitchTo();
            LandingScreen landingScreen = new LandingScreen(this.vpnClient.Session);

            landingScreen.ClickLearnMoreHyperlink();

            // Go to onboarding screen 1
            OnboardingScreen onboardingScreen1 = new OnboardingScreen(this.vpnClient.Session, "OnboardingView1");

            Assert.AreEqual("Skip", onboardingScreen1.GetSkipText());
            Assert.AreEqual("Next", onboardingScreen1.GetNextButtonText());
            Assert.AreEqual("No activity logs", onboardingScreen1.GetTitle());
            Assert.AreEqual("We're Mozilla. We don't log your activity and we're always on your side.", onboardingScreen1.GetSubTitle());
            onboardingScreen1.ClickNextButton();

            // Go to onboarding screen 2
            OnboardingScreen onboardingScreen2 = new OnboardingScreen(this.vpnClient.Session, "OnboardingView2");

            Assert.AreEqual("Skip", onboardingScreen2.GetSkipText());
            Assert.AreEqual("Next", onboardingScreen2.GetNextButtonText());
            Assert.AreEqual("Device level encryption", onboardingScreen2.GetTitle());
            Assert.AreEqual("No one will see your location or activity, even on unsecure Wi-Fi networks.", onboardingScreen2.GetSubTitle());
            onboardingScreen2.ClickNextButton();

            // Go to onboarding screen 3
            OnboardingScreen onboardingScreen3 = new OnboardingScreen(this.vpnClient.Session, "OnboardingView3");

            Assert.AreEqual("Skip", onboardingScreen3.GetSkipText());
            Assert.AreEqual("Next", onboardingScreen3.GetNextButtonText());
            Assert.AreEqual("Servers in 39 countries", onboardingScreen3.GetTitle());
            Assert.AreEqual("Stand up to tech bullies and protect your access to the web.", onboardingScreen3.GetSubTitle());
            onboardingScreen3.ClickNextButton();

            // Go to onboarding screen 4
            LastOnboardingScreen onboardingScreen4 = new LastOnboardingScreen(this.vpnClient.Session);

            Assert.AreEqual("Get started", onboardingScreen4.GetGetStartedButtonText());
            Assert.AreEqual("Connect up to 5 devices", onboardingScreen4.GetTitle());
            Assert.AreEqual("Stream, download and game. We won't restrict your bandwidth.", onboardingScreen4.GetSubTitle());
            onboardingScreen4.ClickGetStartedButton();

            // User Sign In via web browser
            UserCommonOperation.UserSignIn(this.vpnClient, this.browser);

            // Main Screen
            this.vpnClient.Session.SwitchTo();
            MainScreen mainScreen = new MainScreen(this.vpnClient.Session);

            Assert.AreEqual("VPN is off", mainScreen.GetTitle());

            // Setting Screen
            UserCommonOperation.UserSignOut(this.vpnClient);
        }
Ejemplo n.º 23
0
        public MarkerListDialog(FrequencyMarkerList markerList, MainScreen mainScreen)
        {
            InitializeComponent();

            MainScreen = mainScreen;

            MarkerList = markerList;
            MarkerList.MarkersChanged += MarkerList_MarkersChanged;

            UpdateMarkerList();
        }
Ejemplo n.º 24
0
        public BlockFallGame(MainScreen mainScreen, int seed) : base(mainScreen, seed)
        {
            serverRnd = new Random(seed);

            unchecked
            {
                clientRnd = new Random(seed + int.MaxValue);
            }

            ResetGame();
        }
 void Start()
 {
     if (UserSession.IsUserLogged())
     {
         MainScreen.Open();
     }
     else
     {
         LoginScreen.Open();
     }
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Creates a new MapCreator.
        /// </summary>
        /// <param name="owner">The owner of the MapCreator.</param>
        public MapCreator(MainScreen owner, ref TileMapDeffination tileMap)
            : base("MapCreator")
        {
            this.owner   = owner;
            this.tileMap = tileMap;

            camera = new BaseCamera2D("MapCam", new Rectangle(
                                          0, 0, 826, (int)Common.TextureQuality.Y));

            AttachComponent(camera);
        }
Ejemplo n.º 27
0
        public RoadControl(MainScreen screen, Road road)
        {
            Screen = screen;
            Road   = road;

            InitializeComponent();
            Update();

            RenderTransform = road.IsXRoad() ? new RotateTransform(0) : new RotateTransform(-90);

            MainScreen.ZoomLoop.Subscribe(Update);
        }
Ejemplo n.º 28
0
Archivo: Root.cs Proyecto: Arce11/Dome
    public void _OnGameOver()
    {
        foreach (Node2D node in GetChildren())
        {
            node.QueueFree();
        }
        MainScreen main = new MainScreen();

        main.Show();
        main.Position = new Vector2(0, 0);
        AddChild(main);
    }
Ejemplo n.º 29
0
        public ReccommendTrackControl()
        {
            InitializeComponent();
            opacity_panel.BackColor = Color.FromArgb(125, Color.Black);
            opacity_panel.Visible   = false;
            this.DoubleBuffered     = true;

            foreach (Control control in this.Controls)
            {
                MainScreen.EnableDoubleBuferring(control);
            }
        }
Ejemplo n.º 30
0
 /// Awake this instance.
 void Awake()
 {
     if(instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 31
0
        public Game1()
        {
            mGraphics             = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            mMainScreen     = new MainScreen(mGraphics);
            mInputProcessor = new InputProcessor();
            mMenueLoader    = new MenueLoader(mMainScreen, mInputProcessor);

            mMainMenue = new MainMenue(mMenueLoader);
            mWorld     = new World();
        }
Ejemplo n.º 32
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            textureManager = new TextureManager(this.Content);
            audioManager   = new AudioManager(this.Content);
            scoreManager   = new ScoreManager();

            waterBackground = new Texture2D(graphics.GraphicsDevice, WIDTH, 8 * 52);
            Color[] data = new Color[WIDTH * 8 * 52];
            for (int i = 0; i < data.Length; ++i)
            {
                data[i] = new Color(0, 4, 76);
            }
            waterBackground.SetData(data);

            blackBackground = new Texture2D(graphics.GraphicsDevice, WIDTH, HEIGHT);
            data            = new Color[WIDTH * HEIGHT];
            for (int i = 0; i < data.Length; ++i)
            {
                data[i] = new Color(0, 0, 0);
            }
            blackBackground.SetData(data);

            timeCounter = new Texture2D(graphics.GraphicsDevice, 374, 26);
            data        = new Color[timeCounter.Width * timeCounter.Height];
            timeCounter.SetData(data);

            timeBackground = new Texture2D(graphics.GraphicsDevice, 28 * 7, 26);
            data           = new Color[timeBackground.Width * timeBackground.Height];
            for (int i = 0; i < data.Length; ++i)
            {
                data[i] = new Color(0, 0, 0);
            }
            timeBackground.SetData(data);

            gameOverBackground = new Texture2D(graphics.GraphicsDevice, 28 * 9, 26);
            data = new Color[gameOverBackground.Width * gameOverBackground.Height];
            for (int i = 0; i < data.Length; ++i)
            {
                data[i] = new Color(0, 0, 0);
            }
            gameOverBackground.SetData(data);

            eightBitFont = Content.Load <SpriteFont>("Font/8bit");

            m_MainScreen    = new MainScreen(this.Content, new EventHandler(MainScreenEvent));
            m_GameScreen    = new GameScreen(this.Content, new EventHandler(GameScreenEvent));
            m_ScoreScreen   = new ScoreScreen(this.Content, new EventHandler(ScoreScreenEvent));
            m_CurrentScreen = m_MainScreen;
        }
Ejemplo n.º 33
0
 /// Awake this instance.
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 34
0
        public Receipt(User user, Flat flat, Building apartment, string month, int year, MainScreen mainScreen, Income incomeView) // used for collection
        {
            InitializeComponent();

            setValues(flat, month, year);
            controller = new TransactionModule(Util.CONNECTION_DETAILS.CONNECITION_STRING, Util.Tables.TABLE_INCOMING_TRANSACTIONS.TABLE_NAME);

            transaction     = new IncomingTransaction(receiptTrID.Text, apartment, flat, (int)receiptAmount.Value, reciptDateTime.Value, user.getFlat(), month, year);
            this.mainScreen = mainScreen;
            this.apartment  = apartment;
            this.incomeView = incomeView;
        }
Ejemplo n.º 35
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            _mainScreen    = new MainScreen(this);
            _screenManager = new ScreenManager();

            Components.Add(_screenManager);

            _screenManager.LoadScreen(_mainScreen);

            base.Initialize();
        }
Ejemplo n.º 36
0
 public void UpdateAllBackgrounds()
 {
     MainScreen.UpdateBackground();
     ItemScreen.UpdateBackground();
     //MagicScreen.UpdateBackground();
     MateriaScreen.UpdateBackground();
     EquipScreen.UpdateBackground();
     StatusScreen.UpdateBackground();
     ConfigScreen.UpdateBackground();
     PhsScreen.UpdateBackground();
     SaveScreen.UpdateBackground();
 }
Ejemplo n.º 37
0
        private void Connect_Click(object sender, RoutedEventArgs e)
        {
            Window mainScreen = new MainScreen();

            if (loginBox.Text == "" || passwordBox.Text == "")
            {
                errorMsg.Visibility = Visibility.Visible;
                return;
            }
            errorMsg.Visibility = Visibility.Hidden;
            mainScreen.Show();
            this.Close();
        }
    /* -------------------------------------------------------------------------------------------------------- */
    /*
     * UNITY STUFF
     */
    /* -------------------------------------------------------------------------------------------------------- */
    // Used when the game start
    void Awake()
    {
        Script = this;

        mainScreenScript = MainScreen.Script;
        playerName = MainScreen.playerName;

        inGameChatEntries = new List<LobbyChat.LobbyChatEntry>();

        window = new Rect(windowStartX, windowStartY, Screen.width-(windowStartX*2), windowHeight);
    }
Ejemplo n.º 39
0
	void Start() {

		MainScreen.instance = this;
	}
    /* -------------------------------------------------------------------------------------------------------- */
    /*
     * UNITY STUFF
     */
    /* -------------------------------------------------------------------------------------------------------- */
    // Use this for initialization
    void Awake()
    {
        Script = this;

        // Background stuff
        mainScreenBGPos.x = 0;
        mainScreenBGPos.y = 0;

        mainScreenBGPos.width = Screen.width;
        mainScreenBGPos.height = Screen.height;

        // Menu stuff
        screenX = Screen.width * 0.5f - menuWidth * 0.5f;
        screenY = Screen.height * 0.5f - menuHeight * 0.5f;
        //screenY = Screen.height * 0.5f - menuHeight * 0.5f;
        currentMenu = MainMenu;

        // Host game window stuff
        subMenuWindow.x = Screen.width * 0.5f - hostMenuWidth * 0.5f;
        subMenuWindow.y = (Screen.height * 0.5f - hostMenuHeight * 0.5f) + hostMenuOffsetY;

        subMenuWindow.width = hostMenuWidth;
        subMenuWindow.height = hostMenuHeight;

        // Network stuff
        netScript = GameObject.Find("NetworkCode").GetComponent<NetworkGame>();
        serverName = netScript.GetServerName();

        if(playerName == null || playerName == "") {

            playerName = "RandomName" + Random.Range(1,999);
        }
    }
    void Start()
    {
        mainScreen = GameObject.FindGameObjectWithTag(Utility.MainScreenTag).GetComponent<MainScreen>();
        supervillainScreen = GameObject.FindGameObjectWithTag(Utility.SupervillainScreenTag).GetComponent<SupervillainScreen>();
        colonyMembersScreen = GameObject.FindGameObjectWithTag (Utility.ColonyMembersScreenTag).GetComponent<ColonyMembersScreen>();
        businessScreen = GameObject.FindGameObjectWithTag (Utility.BusinessScreenTag).GetComponent<BusinessScreen> ();
        recruitmentScreen = GameObject.FindGameObjectWithTag (Utility.RecruitmentScreenTag).GetComponent<RecruitmentScreen> ();
        researchScreen = GameObject.FindGameObjectWithTag (Utility.ResearchScreenTag).GetComponent<ResearchScreen> ();
        worldDominationScreen = GameObject.FindGameObjectWithTag (Utility.WorldDominationScreenTag).GetComponent<WorldDominationScreen> ();
        gradeSchoolScreen = GameObject.FindGameObjectWithTag(Utility.GradeSchoolScreenTag).GetComponent<GradeSchoolScreen>();
        intelligenceUScreen = GameObject.FindGameObjectWithTag(Utility.IntelligenceUniversityScreenTag).GetComponent<IntelligenceUScreen>();
        combatUScreen = GameObject.FindGameObjectWithTag(Utility.CombatUniversityScreenTag).GetComponent<CombatUScreen>();
        teachingUScreen = GameObject.FindGameObjectWithTag(Utility.TeachingUniversityScreenTag).GetComponent<TeachingUScreen>();

        gameScreenList = new List<GameScreen>();
        gameScreenList.Add(supervillainScreen);
        gameScreenList.Add(colonyMembersScreen);
        gameScreenList.Add(businessScreen);
        gameScreenList.Add(recruitmentScreen);
        gameScreenList.Add(researchScreen);
        gameScreenList.Add(worldDominationScreen);
        gameScreenList.Add(gradeSchoolScreen);
        gameScreenList.Add(intelligenceUScreen);
        gameScreenList.Add(combatUScreen);
        gameScreenList.Add(teachingUScreen);

        moveAllScreensOffScreen ();
    }
Ejemplo n.º 42
0
        protected override void Update(GameTime gameTime)
        {
            KeyboardState ks = new KeyboardState();
            KeyboardState oldks = new KeyboardState();
            ks = Keyboard.GetState();

            if (mMainScreen == MainScreen.Welcome1)
            {
                if (ks.IsKeyDown(Keys.X))
                    mMainScreen = MainScreen.Play;
                if (ks.IsKeyDown(Keys.H))
                    mMainScreen = MainScreen.Welcome2;
            }
            else if (mMainScreen == MainScreen.Welcome2)
            {
                if (ks.IsKeyDown(Keys.X))
                    mMainScreen = MainScreen.Play;
                if (ks.IsKeyDown(Keys.B))
                    mMainScreen = MainScreen.Welcome1;
            }
            else if (mMainScreen == MainScreen.Play)
            {
                speed = Vector2.Zero;
                bool moving = false;

                if (ks.IsKeyDown(Keys.Right))
                {
                    speed.X = 2;
                    moving = true;
                    se = SpriteEffects.FlipHorizontally;
                }

                if (ks.IsKeyDown(Keys.Left))
                {
                    speed.X = -2;
                    moving = true;
                    se = SpriteEffects.None;
                }
                if (ks.IsKeyDown(Keys.Up))
                {
                    speed.Y = -2;
                    moving = true;
                    se = SpriteEffects.None;
                }
                if (ks.IsKeyDown(Keys.Down))
                {
                    speed.Y = 2;
                    moving = true;
                    se = SpriteEffects.None;
                }

                Collision();    //check if the sprite collision the wall

                //add speed value to our position to move the sprite
                pos += speed;

                if (moving)
                {
                    touchItem = false;
                    framedelay -= gameTime.ElapsedGameTime.TotalSeconds;
                    if (framedelay < 0)
                    {
                        framedelay = 0.07;

                        //sprite
                        framecounter += (sprite.Height - 4);
                        if (framecounter >= sprite.Width)
                            framecounter = 0;
                    }

                }

                Rectangle people = new Rectangle((int)pos.X, (int)pos.Y, 30, 30);

                //list1
                Rectangle item1 = new Rectangle(250, 0, 30, 20);        //piano
                Rectangle item2 = new Rectangle(0, 100, 10, 20);        //TV
                Rectangle item3 = new Rectangle(130, 150, 30, 10);      //sofa

                //list2
                Rectangle item4 = new Rectangle(80, 0, 100, 10);        //bookshelf
                Rectangle item5 = new Rectangle(340, 110, 10, 5);      //telephone
                Rectangle item6 = new Rectangle(0, 0, 20, 20);          //computer

                //list3
                Rectangle item7 = new Rectangle(300, 70, 10, 10);        //drawing

                //list4
                Rectangle item8 = new Rectangle(150, 430, 10, 20);      //rice
                Rectangle item9 = new Rectangle(130, 430, 10, 20);      //pasta
                Rectangle item10 = new Rectangle(110, 430, 10, 20);     //potato

                //list5
                Rectangle item11 = new Rectangle(90, 430, 20, 20);      //vegetable
                Rectangle item12 = new Rectangle(200, 430, 20, 20);     //meat
                Rectangle item13 = new Rectangle(120, 430, 20, 20);     //fruit

                //list6
                Rectangle item14 = new Rectangle(170, 430, 30, 20);     //cooker
                Rectangle item15 = new Rectangle(10, 350, 20, 20);      //fridge

                //list7
                Rectangle item16 = new Rectangle(490, 220, 50, 100);    //bed
                Rectangle item17 = new Rectangle(330, 250, 50, 30);     //clothes shelf
                Rectangle item18 = new Rectangle(570, 10, 20, 20);      //bath

                //list8
                Rectangle item19 = new Rectangle(470, 10, 20, 20);      //shower
                Rectangle item20 = new Rectangle(220, 260, 20, 20);     //handwash
                Rectangle item21 = new Rectangle(660, 120, 10, 10);     //toilet

                if ((people.Intersects(item1)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 1;
                    correctAns = 1;
                }
                else if ((people.Intersects(item2)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 2;
                    correctAns = 0;
                }
                else if ((people.Intersects(item3)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 3;
                    correctAns = 2;
                }
                else if ((people.Intersects(item4)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 4;
                    correctAns = 0;
                }
                else if ((people.Intersects(item5)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 5;
                    correctAns = 1;
                }
                else if ((people.Intersects(item6)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 6;
                    correctAns = 2;
                }
                else if ((people.Intersects(item7)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 7;
                    correctAns = 0;
                }
                else if ((people.Intersects(item8)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 8;
                    correctAns = 0;
                }
                else if ((people.Intersects(item9)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 9;
                    correctAns = 1;
                }
                else if ((people.Intersects(item10)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 10;
                    correctAns = 2;
                }
                else if ((people.Intersects(item11)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 11;
                    correctAns = 0;
                }
                else if ((people.Intersects(item12)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 12;
                    correctAns = 1;
                }
                else if ((people.Intersects(item13)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 13;
                    correctAns = 2;
                }
                else if ((people.Intersects(item14)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 14;
                    correctAns = 0;
                }
                else if ((people.Intersects(item15)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 15;
                    correctAns = 2;
                }
                else if ((people.Intersects(item16)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 16;
                    correctAns = 0;
                }
                else if ((people.Intersects(item17)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 17;
                    correctAns = 1;
                }
                else if ((people.Intersects(item18)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 18;
                    correctAns = 2;
                }
                else if ((people.Intersects(item19)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 19;
                    correctAns = 0;
                }
                else if ((people.Intersects(item20)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 20;
                    correctAns = 1;
                }
                else if ((people.Intersects(item21)) && (!touchItem))
                {
                    mMainScreen = MainScreen.Touch;
                    listoption = 21;
                    correctAns = 2;
                }
            }
            if (mMainScreen == MainScreen.Touch)
            {
                chooseAns = false;
                ansCorrect = false;
                touchItem = true;   //touch the item
                if (ks.IsKeyDown(Keys.A))
                    mChooseItem = 0;
                else if (ks.IsKeyDown(Keys.B))
                    mChooseItem = 1;
                else if (ks.IsKeyDown(Keys.C))
                    mChooseItem = 2;

                if (ks.IsKeyDown(Keys.Enter))
                {
                    if (checkAns(listoption, mChooseItem, correctAns))
                        score++;
                    mMainScreen = MainScreen.Play;
                    mChooseItem = 0;
                    pos -= speed;
                }

            }

            if (mMainScreen == MainScreen.Gameover)
            {
                //monkey
                if (gameTime.TotalGameTime.Milliseconds % 150 == 0)
                {
                    monkeyX = monkeyX + monkey.Width / 3;
                    if (monkeyX >= monkey.Width + monkey.Width / 3)
                        monkeyX = monkey.Width / 3;
                }
            }

            base.Update(gameTime);
        }
Ejemplo n.º 43
0
Archivo: Game.cs Proyecto: Wudek/Apollo
 public void Start()
 {
     var go = new GameObject("MainScreen");
     go.hideFlags = HideFlags.HideInHierarchy;
     _mainScreen = go.AddComponent<MainScreen>();
 }
Ejemplo n.º 44
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.LightGreen);
            spriteBatch.Begin();

            if (mMainScreen == MainScreen.Welcome1)
            {
                spriteBatch.Draw(Welcome1, new Rectangle(0, 0, 800, 600), Color.White);
            }
            else if (mMainScreen == MainScreen.Welcome2)
            {
                spriteBatch.Draw(Welcome2, new Rectangle(0, 0, 800, 600), Color.White);
            }
            else if (mMainScreen == MainScreen.Play)
            {
                int x = (int)pos.X;
                int y = (int)pos.Y;

                //count the screen size
                if (x < 60)
                    x = 60;
                if (x > 200)
                    x = 200;
                if (y < 30)
                    y = 30;
                if (y > 250)
                    y = 250;

                spriteBatch.Draw(background, Vector2.Zero, new Rectangle(x, y, 800 + x, 1280 + y), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.0f);

                spriteBatch.Draw(sprite, pos, new Rectangle(framecounter, 0, sprite.Height - 4, sprite.Height), Color.White, 0, Vector2.Zero, 1, se, 0);

                //score = 21;
                fillinBlood(score);

                //GAME OVER => monkey jump out
                if (score == 22)
                    mMainScreen = MainScreen.Gameover;

            }
            else if (mMainScreen == MainScreen.Touch)
            {
                if ((listoption == 1) || (listoption == 2) || (listoption == 3))
                {
                    if (mChooseItem == 0)
                    {
                        spriteBatch.DrawString(spriteFont, "Television", new Vector2(10, 10), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Piano", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Sofa", new Vector2(10, 50), Color.White);
                    }
                    else if (mChooseItem == 1)
                    {
                        spriteBatch.DrawString(spriteFont, "Television", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Piano", new Vector2(10, 30), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Sofa", new Vector2(10, 50), Color.White);
                    }
                    else
                    {
                        spriteBatch.DrawString(spriteFont, "Television", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Piano", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Sofa", new Vector2(10, 50), Color.Yellow);
                    }
                }
                else if ((listoption == 4) || (listoption == 5) || (listoption == 6))
                {
                    if (mChooseItem == 0)
                    {
                        spriteBatch.DrawString(spriteFont, "Anaquel de libro", new Vector2(10, 10), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Telefono", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Computadora", new Vector2(10, 50), Color.White);
                    }
                    else if (mChooseItem == 1)
                    {
                        spriteBatch.DrawString(spriteFont, "Anaquel de libro", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Telefono", new Vector2(10, 30), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Computadora", new Vector2(10, 50), Color.White);
                    }
                    else
                    {
                        spriteBatch.DrawString(spriteFont, "Anaquel de libro", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Telefono", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Computadora", new Vector2(10, 50), Color.Yellow);
                    }
                }
                else if (listoption == 7)
                {
                    if (mChooseItem == 0)
                    {
                        spriteBatch.DrawString(spriteFont, "Empate y pintura", new Vector2(10, 10), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Telefono", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Computadora", new Vector2(10, 50), Color.White);
                    }
                    else if (mChooseItem == 1)
                    {
                        spriteBatch.DrawString(spriteFont, "Empate y pintura", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Telefono", new Vector2(10, 30), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Computadora", new Vector2(10, 50), Color.White);
                    }
                    else
                    {
                        spriteBatch.DrawString(spriteFont, "Empate y pintura", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Telefono", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Computadora", new Vector2(10, 50), Color.Yellow);
                    }
                }
                else if ((listoption == 8) || (listoption == 9) || (listoption == 10))
                {
                    if (mChooseItem == 0)
                    {
                        spriteBatch.DrawString(spriteFont, "Arroz", new Vector2(10, 10), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Pasta", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Patata", new Vector2(10, 50), Color.White);
                    }
                    else if (mChooseItem == 1)
                    {
                        spriteBatch.DrawString(spriteFont, "Arroz", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Pasta", new Vector2(10, 30), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Patata", new Vector2(10, 50), Color.White);
                    }
                    else
                    {
                        spriteBatch.DrawString(spriteFont, "Arroz", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Pasta", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Patata", new Vector2(10, 50), Color.Yellow);
                    }
                }
                else if ((listoption == 11) || (listoption == 12) || (listoption == 13))
                {
                    if (mChooseItem == 0)
                    {
                        spriteBatch.DrawString(spriteFont, "Verdura", new Vector2(10, 10), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Carne", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Fruta", new Vector2(10, 50), Color.White);
                    }
                    else if (mChooseItem == 1)
                    {
                        spriteBatch.DrawString(spriteFont, "Verdura", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Carne", new Vector2(10, 30), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Fruta", new Vector2(10, 50), Color.White);
                    }
                    else
                    {
                        spriteBatch.DrawString(spriteFont, "Verdura", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Carne", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Fruta", new Vector2(10, 50), Color.Yellow);
                    }
                }
                else if ((listoption == 14) || (listoption == 15))
                {
                    if (mChooseItem == 0)
                    {
                        spriteBatch.DrawString(spriteFont, "Cocina", new Vector2(10, 10), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Carne", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Nevera", new Vector2(10, 50), Color.White);
                    }
                    else if (mChooseItem == 1)
                    {
                        spriteBatch.DrawString(spriteFont, "Cocina", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Carne", new Vector2(10, 30), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Nevera", new Vector2(10, 50), Color.White);
                    }
                    else
                    {
                        spriteBatch.DrawString(spriteFont, "Cocina", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Carne", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Nevera", new Vector2(10, 50), Color.Yellow);
                    }
                }
                else if ((listoption == 16) || (listoption == 17) || (listoption == 18))
                {
                    if (mChooseItem == 0)
                    {
                        spriteBatch.DrawString(spriteFont, "Cama", new Vector2(10, 10), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Anaquel de ropa", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Banera", new Vector2(10, 50), Color.White);
                    }
                    else if (mChooseItem == 1)
                    {
                        spriteBatch.DrawString(spriteFont, "Cama", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Anaquel de ropa", new Vector2(10, 30), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Banera", new Vector2(10, 50), Color.White);
                    }
                    else
                    {
                        spriteBatch.DrawString(spriteFont, "Cama", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Anaquel de ropa", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Banera", new Vector2(10, 50), Color.Yellow);
                    }
                }
                else if ((listoption == 19) || (listoption == 20) || (listoption == 21))
                {
                    if (mChooseItem == 0)
                    {
                        spriteBatch.DrawString(spriteFont, "Ducha", new Vector2(10, 10), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Mano se lava", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Retrete", new Vector2(10, 50), Color.White);
                    }
                    else if (mChooseItem == 1)
                    {
                        spriteBatch.DrawString(spriteFont, "Ducha", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Mano se lava", new Vector2(10, 30), Color.Yellow);
                        spriteBatch.DrawString(spriteFont, "Retrete", new Vector2(10, 50), Color.White);
                    }
                    else
                    {
                        spriteBatch.DrawString(spriteFont, "Ducha", new Vector2(10, 10), Color.White);
                        spriteBatch.DrawString(spriteFont, "Mano se lava", new Vector2(10, 30), Color.White);
                        spriteBatch.DrawString(spriteFont, "Retrete", new Vector2(10, 50), Color.Yellow);
                    }
                }

            }
            else if (mMainScreen == MainScreen.Gameover)  //GAME OVER
            {
                spriteBatch.Draw(Blank, new Rectangle(0, 0, 800, 600), Color.White);
                spriteBatch.Draw(Congratulation, new Rectangle(0, 0, 800, 600), Color.White);
                spriteBatch.Draw(monkey, new Vector2(100f, 230f), new Rectangle(monkeyX, 0, monkey.Width / 3, monkey.Height), Color.White);
            }
            spriteBatch.End();
            base.Draw(gameTime);
        }