protected override void ShowHistory(XsollaHistoryList pList)
        {
            GameObject        screenHistoryView;
            HistoryController controller;

            controller = GameObject.FindObjectOfType <HistoryController>();
            // if we have controller
            if (controller != null)
            {
                controller = GameObject.FindObjectOfType <HistoryController>();
                if (!controller.IsRefresh())
                {
                    controller.AddListRows(Utils.GetTranslations(), pList);
                }
                else
                {
                    controller.InitScreen(Utils.GetTranslations(), pList, Utils.GetProject().virtualCurrencyName);
                }
            }
            else
            {
                currentActive     = ActiveScreen.HISTORY_LIST;
                screenHistoryView = Instantiate(Resources.Load(PREFAB_SCREEN_HISTORY_USER)) as GameObject;
                controller        = screenHistoryView.GetComponent <HistoryController>();
                if (controller != null)
                {
                    controller.InitScreen(Utils.GetTranslations(), pList, Utils.GetProject().virtualCurrencyName);
                }
                // clear container
                //Resizer.DestroyChilds(mainScreenContainer.transform);
                screenHistoryView.transform.SetParent(mainScreenContainer.transform);
                screenHistoryView.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
                Resizer.ResizeToParrent(screenHistoryView);
            }
        }
Example #2
0
 public SplashScreen(Game game, Vector2 pos, float timeLeft,
                     Texture2D txMain, Texture2D txPause, Texture2D txGameOver, Texture2D txWin,
                     Song menuMusic, Song playMusic, Song pauseMusic, Song gameOverMusic, Song winMusic,
                     Keys pauseKey, Keys activateKey, Buttons activateButton, Buttons pauseButton,
                     SpriteFont fontIn, SoundEffect blinkPlay, SoundEffect blinkPause) : base(game)
 {
     game.Components.Add(this);
     DrawOrder = 1000;
     #region Load Audio
     _txMain       = txMain;
     _txPause      = txPause;
     _txGameOver   = txGameOver;
     _txWin        = txWin;
     MenuTrack     = menuMusic;
     BackingTrack  = playMusic;
     PauseTrack    = pauseMusic;
     GameOverTrack = gameOverMusic;
     WinTrack      = winMusic;
     BlinkPlay     = blinkPlay;
     BlinkPause    = blinkPause;
     #endregion
     Position                = pos;
     ActivationKey           = activateKey;
     ActivationButton        = activateButton;
     PauseKey                = pauseKey;
     PauseButton             = pauseButton;
     Font                    = fontIn;
     TimeRemaining           = timeLeft;
     CurrentScreen           = ActiveScreen.MAIN;
     CurrentGameCondition    = GameCondition.LOSE;
     Active                  = true;
     MediaPlayer.Volume      = VOLUME;
     MediaPlayer.IsRepeating = true;
 }
 private void DrawError(XsollaError error)
 {
     if (mainScreenContainer != null)
     {
         currentActive = ActiveScreen.ERROR;
         GameObject errorScreen = Instantiate(Resources.Load(PREFAB_SCREEN_ERROR)) as GameObject;
         errorScreen.transform.SetParent(mainScreenContainer.transform);
         errorScreen.GetComponent <RectTransform> ().anchoredPosition     = new Vector2(0, 0);
         mainScreenContainer.GetComponentInParent <ScrollRect> ().content = errorScreen.GetComponent <RectTransform> ();
         ScreenErrorController controller = errorScreen.GetComponent <ScreenErrorController> ();
         controller.ErrorHandler += OnErrorRecivied;
         controller.DrawScreen(error);
     }
     else
     {
         GameObject errorScreen = Instantiate(Resources.Load(PREFAB_SCREEN_ERROR_MAIN)) as GameObject;
         errorScreen.transform.SetParent(container.transform);
         Text[] texts = errorScreen.GetComponentsInChildren <Text>();
         texts[1].text = "Somthing went wrong";
         texts[2].text = error.errorMessage;
         texts[3].text = error.errorCode.ToString();
         texts[3].gameObject.SetActive(false);
         Resizer.ResizeToParrent(errorScreen);
     }
 }
Example #4
0
        static void SwitchScreen(DashCMDScreen screen)
        {
            if (!ConsoleHandleExists)
            {
                return;
            }
            if (ActiveScreen != null)
            {
                ActiveScreen.Stop();
            }

            if (screen != null)
            {
                OnMainScreen = false;
                Console.Clear();
                ActiveScreen          = screen;
                Console.CursorVisible = false;
                screen.Start();
            }
            else
            {
                Console.CursorVisible = true;
                OnMainScreen          = true;
                ActiveScreen          = null;
                Console.ResetColor();

                // Try-catch is for when coming out of a screen back to
                // a lot of messages. It takes CMD so long to actually write
                // them that the lines list changes causing a collection
                // modified exception.
                try { WriteLogScreen(); }
                catch (Exception) { }
            }
        }
Example #5
0
        public void Update(GameTime gameTime)
        {
            //screens[activeScreen].Update(gameTime);

            if (activeScreen == ActiveScreen.game)
            {
                gameScreen.Update(gameTime);
                if (gameScreen.EndGame)
                {
                    activeScreen = ActiveScreen.over;
                }
            }
            else if (activeScreen == ActiveScreen.start)
            {
                startScreen.Update(gameTime);
                if (startScreen.FinishedScreen() == 0)
                {
                    activeScreen = ActiveScreen.game;
                    startScreen.Reset();
                }
            }
            else if (activeScreen == ActiveScreen.over)
            {
                if (overScreen.FinishedScreen() == 0)
                {
                    activeScreen = ActiveScreen.start;
                    overScreen.Reset();
                }
            }
        }
Example #6
0
        public void Push(GameScreen i_GameScreen)
        {
            // hello new screen, I am your manager, nice to meet you:
            i_GameScreen.ScreensManager = this;

            if (!this.Contains(i_GameScreen))
            {
                this.Add(i_GameScreen);

                // let me know when you are closed, so i can pop you from the stack:
                i_GameScreen.StateChanged += Screen_StateChanged;
            }

            if (ActiveScreen != i_GameScreen)
            {
                if (ActiveScreen != null)
                {
                    // connect each new screen to the previous one:
                    i_GameScreen.PreviousScreen = ActiveScreen;

                    ActiveScreen.Deactivate();
                }
            }

            if (ActiveScreen != i_GameScreen)
            {
                m_ScreensStack.Push(i_GameScreen);
            }

            i_GameScreen.DrawOrder = m_ScreensStack.Count;
        }
        /// <summary>
        /// Handles active screen switch events.
        /// </summary>
        /// <param name="activeScreen">Current active screen.</param>
        private void _SwitchActiveScreen(ActiveScreen activeScreen)
        {
            LobbyScreen.SetActive(activeScreen == ActiveScreen.LobbyScreen);
            StatusScreen.SetActive(activeScreen != ActiveScreen.StartScreen);
            StartScreen.SetActive(activeScreen == ActiveScreen.StartScreen);

            bool switchToARScreen = activeScreen == ActiveScreen.ARScreen;

            ARScreen.SetActive(switchToARScreen);
            SessionCore.SetActive(switchToARScreen);
            ARExtentions.SetActive(switchToARScreen);

            m_CurrentActiveScreen = activeScreen;

            if (m_CurrentActiveScreen == ActiveScreen.StartScreen)
            {
                PlayerPrefs.SetInt(k_HasDisplayedStartInfoKey, 1);
            }

            if (m_CurrentActiveScreen == ActiveScreen.ARScreen)
            {
                // Set platform active when switching to AR Screen so the camera permission only
                // shows after Start Screen.
                m_TimeSinceStart = 0.0f;
            }
        }
 public void EditUser(DataRowView dataRowView)
 {
     ActiveScreen?.Invoke(Key.user_edit.ToString(), new Parameter()
     {
         Command = Command.EditUser,
         Arg     = dataRowView
     });
 }
Example #9
0
 //Opens AnnotationScreen
 private void openAnnotationScreen()
 {
     //open Screen
     makeAnnotationsTransparent();
     ListScreen.SetActive(false);
     AddEditScreen.SetActive(true);
     currentActiveScreen = ActiveScreen.add;
 }
Example #10
0
        public void Draw(GameTime time)
        {
            // draw the main active screen
            if (ScreenCollection.Count > 0 && ActiveScreen != null)
            {
                ActiveScreen.Draw(time);
            }

            // draw any active popup windows
            if (ActivePopups.Count > 0 && ActiveScreen != null)
            {
                foreach (Screen popupScreen in ActivePopups)
                {
                    popupScreen.Draw(time);
                }
            }

            // draw any active context menus
            if (ContextMenus.Count > 0 && ActiveScreen != null)
            {
                foreach (Screen contextScreen in ContextMenus)
                {
                    contextScreen.Draw(time);
                }
            }

            // if a screen transition has been triggered, fade in
            // you can swap screens without activating a transition
            if (IsTransitioning)
            {
                DateTime now = DateTime.Now;
                TimeSpan ts  = now - TransitionStartTime;
                double   timeTransitioning = ts.TotalMilliseconds;

                if (timeTransitioning >= TransitionTime && ScreenToTransitionTo != null)
                {
                    ActiveScreen         = ScreenToTransitionTo;
                    ScreenToTransitionTo = null;
                }

                float alphaPct = Convert.ToSingle(timeTransitioning) / TransitionTime;

                if (alphaPct > 1.0f)
                {
                    alphaPct = 2.0f - alphaPct;
                }

                int alpha = Convert.ToInt32(255f * alphaPct);

                if (timeTransitioning >= TransitionTime * 2)
                {
                    IsTransitioning = false;
                    alpha           = 0;
                }

                ScreenTransitionBlack(alpha);
            }
        }
Example #11
0
        public override void Load()
        {
            #region Ressources

            sndBGM = new FMODSound(FMODSystem, "Content/Triple Thunder/Menus/Music/Shop.mp3");
            sndBGM.SetLoop(true);
            sndBGM.PlayAsBGM();

            sndButtonOver  = new FMODSound(FMODSystem, "Content/Triple Thunder/Menus/SFX/Button Over.wav");
            sndButtonClick = new FMODSound(FMODSystem, "Content/Triple Thunder/Menus/SFX/Button Click.wav");

            fntText = Content.Load <SpriteFont>("Fonts/Arial10");

            sprBackground = Content.Load <Texture2D>("Triple Thunder/Menus/Shop/Background");

            BackToLobbyButton = new InteractiveButton(Content, "Triple Thunder/Menus/Common/Back To Lobby", new Vector2(678, 28),
                                                      "Triple Thunder/Menus/Common/Back Arrow Icon", new Vector2(-86, 0), 6, OnButtonOver, ReturnToLobby);

            CharacterFilterButton = new InteractiveButton(Content, "Triple Thunder/Menus/Shop/Character Filter", new Vector2(60, 102), OnButtonOver, FilterCharacters);
            EquipmentFilterButton = new InteractiveButton(Content, "Triple Thunder/Menus/Shop/Equipment Filter", new Vector2(113, 102), OnButtonOver, FilterEquipment);
            WeaponsFilterButton   = new InteractiveButton(Content, "Triple Thunder/Menus/Shop/Weapons Filter", new Vector2(169, 102), OnButtonOver, FilterWeapons);
            ItemsFilterButton     = new InteractiveButton(Content, "Triple Thunder/Menus/Shop/Items Filter", new Vector2(225, 102), OnButtonOver, FilterItems);
            OthersFilterButton    = new InteractiveButton(Content, "Triple Thunder/Menus/Shop/Others Filter", new Vector2(281, 102), OnButtonOver, FilterOther);

            CharacterFilterButton.CanBeChecked = true;
            EquipmentFilterButton.CanBeChecked = true;
            WeaponsFilterButton.CanBeChecked   = true;
            ItemsFilterButton.CanBeChecked     = true;
            OthersFilterButton.CanBeChecked    = true;

            CharacterFilterButton.Select();

            ArrayMenuButton = new InteractiveButton[]
            {
                BackToLobbyButton,
                CharacterFilterButton, EquipmentFilterButton, WeaponsFilterButton, ItemsFilterButton, OthersFilterButton,
            };

            #endregion

            ShopCharactersScreen NewShopCharacterScreen = new ShopCharactersScreen(Owner);
            ShopEquipmentScreen  NewShopEquipmentScreen = new ShopEquipmentScreen(Owner);
            ShopWeaponsScreen    NewShopWeaponsScreen   = new ShopWeaponsScreen(Owner);
            ShopItemsScreen      NewShopItemsScreen     = new ShopItemsScreen(Owner);
            ShopOtherScreen      NewShopOtherScreen     = new ShopOtherScreen(Owner);

            ArrayShopScreen = new GameScreen[] { NewShopCharacterScreen, NewShopEquipmentScreen, NewShopWeaponsScreen, NewShopItemsScreen, NewShopOtherScreen };

            foreach (GameScreen ActiveScreen in ArrayShopScreen)
            {
                ActiveScreen.Content        = Content;
                ActiveScreen.ListGameScreen = ListGameScreen;
                ActiveScreen.Load();
            }

            ActiveShopScreen = NewShopCharacterScreen;
        }
 //probably better if it's internal. making it public for a small hack
 public void HideKeyboard()
 {
     if (CurrentKeyboard == null)
     {
         return;
     }
     ActiveScreen.HideKeyboard();
     CurrentKeyboard.OnKeyboardDisappear();
     CurrentKeyboard = null;
 }
Example #13
0
        private void Pop(GameScreen i_GameScreen)
        {
            m_ScreensStack.Pop();

            if (m_ScreensStack.Count > 0)
            {
                // when one is popped, the previous becomes the active one
                ActiveScreen.Activate();
            }
        }
Example #14
0
 public ScreenManager(int screenWidth, int screenHeight)
 {
     //screens = new List<Screen>();
     this.screenWidth  = screenWidth;
     this.screenHeight = screenHeight;
     activeScreen      = ActiveScreen.start;
     gameScreen        = new GameScreen(screenWidth, screenHeight);
     startScreen       = new StartScreen(screenWidth, screenHeight);
     overScreen        = new OverScreen(screenWidth, screenHeight);
 }
        public override void Unload()
        {
            SoundSystem.ReleaseSound(sndButtonOver);
            SoundSystem.ReleaseSound(sndButtonClick);

            foreach (GameScreen ActiveScreen in ArraySubScreen)
            {
                ActiveScreen.Unload();
            }
        }
Example #16
0
 /// <summary>
 /// Key released event arguments passsed to the active popup or screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public virtual void HandleKeyReleasedEvent(object sender, KeyboardEventArgs e)
 {
     if (IsActivePopupAvailable)
     {
         ActivePopup.HandleKeyReleasedEvent(sender, e);
     }
     else if (IsActiveScreenAvailable)
     {
         ActiveScreen.HandleKeyReleasedEvent(sender, e);
     }
 }
Example #17
0
 /// <summary>
 /// Text inputting (with IME support) event arguments passed to the active popup or screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public virtual void HandleTextInputtingEvent(object sender, TextInputEventArgs e)
 {
     if (IsActivePopupAvailable)
     {
         ActivePopup.HandleTextInputtingEvent(sender, e);
     }
     else if (IsActiveScreenAvailable)
     {
         ActiveScreen.HandleTextInputtingEvent(sender, e);
     }
 }
Example #18
0
 /// <summary>
 /// Mouse movement event arguments passed to the active popup or screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public virtual void HandleMouseMovingEvent(object sender, MouseMotionEventArgs e)
 {
     if (IsActivePopupAvailable)
     {
         ActivePopup.HandleMouseMovingEvent(sender, e);
     }
     else if (IsActiveScreenAvailable)
     {
         ActiveScreen.HandleMouseMovingEvent(sender, e);
     }
 }
Example #19
0
 public void PassKeyStatesToActiveScreen(IEnumerable <KeyInformation> keysPressed, IEnumerable <KeyInformation> keysReleased)
 {
     if (IsActivePopupAvailable)
     {
         ActivePopup.HandleKeyStates(keysPressed, keysReleased);
     }
     else if (IsActiveScreenAvailable)
     {
         ActiveScreen.HandleKeyStates(keysPressed, keysReleased);
     }
 }
 //probably better if it's internal. making it public for a small hack
 public void RequestKeyboard(string inputScope)
 {
     inputScope = inputScope ?? "default";
     if (_keyboards.ContainsKey(inputScope))
     {
         CurrentKeyboard = _keyboards[inputScope];
     }
     CurrentKeyboard?.Control.UpdateLayout(new Rect(0, ScreenRect.Height - CurrentKeyboard.Height, ScreenRect.Width, CurrentKeyboard.Height));
     ActiveScreen.ShowKeyboard();
     CurrentKeyboard?.OnKeyboardAppear();
 }
Example #21
0
 public void PassMouseButtonPressedEventToActiveScreen(object sender, MouseButtonEventArgs e)
 {
     if (IsActivePopupAvailable)
     {
         ActivePopup.HandleMouseButtonPressedEvent(sender, e);
     }
     else if (IsActiveScreenAvailable)
     {
         ActiveScreen.HandleMouseButtonPressedEvent(sender, e);
     }
 }
Example #22
0
 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 // >>>>>>>>>>>>>>>>>>>>>>>>>>>> PAYMENT METHODS >>>>>>>>>>>>>>>>>>>>>>>>>>>>
 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 private void InitPaymentListScreen()
 {
     currentActive = ActiveScreen.P_LIST;
     if (_paymentListScreenController == null)
     {
         GameObject paymentListScreen = Instantiate(paymentListScreebPrefab);
         _paymentListScreenController = paymentListScreen.GetComponent <PaymentListScreenController> ();
         _paymentListScreenController.transform.SetParent(mainScreenContainer.transform);
         _paymentListScreenController.GetComponent <RectTransform> ().anchoredPosition = new Vector2(0, 0);
         //mainScreenContainer.GetComponentInParent<ScrollRect> ().content = _paymentListScreenController.GetComponent<RectTransform> ();
     }
 }
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<< PAYMENT METHODS <<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SHOP >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        private void DrawShopScreen()
        {
            currentActive = ActiveScreen.SHOP;
            if (_shopViewController == null)
            {
                GameObject paymentListScreen = Instantiate(shopScreenPrefab);
                _shopViewController = paymentListScreen.GetComponent <ShopViewController> ();
                _shopViewController.transform.SetParent(mainScreenContainer.transform);
                _shopViewController.GetComponent <RectTransform> ().anchoredPosition = new Vector2(0, 0);
                mainScreenContainer.GetComponentInParent <ScrollRect> ().content     = _shopViewController.GetComponent <RectTransform> ();
            }
        }
Example #24
0
        private void OpenError(XsollaError error)
        {
            currentActive = ActiveScreen.ERROR;
            GameObject errorScreen = Instantiate(Resources.Load("Prefabs/Screens/ScreenError")) as GameObject;

            errorScreen.transform.SetParent(mainScreenContainer.transform);
            errorScreen.GetComponent <RectTransform> ().anchoredPosition     = new Vector2(0, 0);
            mainScreenContainer.GetComponentInParent <ScrollRect> ().content = errorScreen.GetComponent <RectTransform> ();
            ScreenErrorController controller = errorScreen.GetComponent <ScreenErrorController> ();

            controller.ErrorHandler += OnErrorRecivied;
            controller.DrawScreen(error);
        }
        private void DrawForm(XsollaUtils utils, XsollaForm form)
        {
            currentActive = ActiveScreen.PAYMENT;
            GameObject checkoutScreen = Instantiate(Resources.Load(PREFAB_SCREEN_CHECKOUT)) as GameObject;

            checkoutScreen.transform.SetParent(mainScreenContainer.transform);
            checkoutScreen.GetComponent <RectTransform> ().anchoredPosition = new Vector2(0, 0);
            //scroll.content = paymentScreen.GetComponent<RectTransform> ();
            mainScreenContainer.GetComponentInParent <ScrollRect> ().content = checkoutScreen.GetComponent <RectTransform> ();
            ScreenCheckoutController controller = checkoutScreen.GetComponent <ScreenCheckoutController> ();

            controller.InitScreen(utils, form);
        }
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< SHOP <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        private void DrawStatus(XsollaTranslations translations, XsollaStatus status)
        {
            currentActive = ActiveScreen.STATUS;
            GameObject statusScreen = Instantiate(Resources.Load(PREFAB_SCREEN_STATUS)) as GameObject;

            statusScreen.transform.SetParent(mainScreenContainer.transform);
            statusScreen.GetComponent <RectTransform> ().anchoredPosition    = new Vector2(0, 0);
            mainScreenContainer.GetComponentInParent <ScrollRect> ().content = statusScreen.GetComponent <RectTransform> ();
            StatusViewController controller = statusScreen.GetComponent <StatusViewController> ();

            controller.StatusHandler += OnUserStatusExit;
            controller.InitScreen(translations, status);
        }
Example #27
0
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< SHOP <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        private void OpenStatus(XsollaTranslations translations, XsollaStatus status)
        {
            currentActive = ActiveScreen.STATUS;
            menuTransform.gameObject.SetActive(false);
            GameObject statusScreen = Instantiate(Resources.Load("Prefabs/SimpleView/_ScreenStatus/ScreenStatusNew")) as GameObject;

            statusScreen.transform.SetParent(mainScreenContainer.transform);
            statusScreen.GetComponent <RectTransform> ().anchoredPosition    = new Vector2(0, 0);
            mainScreenContainer.GetComponentInParent <ScrollRect> ().content = statusScreen.GetComponent <RectTransform> ();
            StatusViewController controller = statusScreen.GetComponent <StatusViewController> ();

            controller.StatusHandler += OnUserStatusExit;
            controller.InitScreen(translations, status);
        }
        private void DrawVPError(XsollaUtils utils, string error)
        {
            currentActive = ActiveScreen.VP_PAYMENT;
            menuTransform.gameObject.SetActive(true);
            GameObject statusScreen = Instantiate(Resources.Load(PREFAB_SCREEN_VP_SUMMARY)) as GameObject;

            statusScreen.transform.SetParent(mainScreenContainer.transform);
            statusScreen.GetComponent <RectTransform> ().anchoredPosition    = new Vector2(0, 0);
            mainScreenContainer.GetComponentInParent <ScrollRect> ().content = statusScreen.GetComponent <RectTransform> ();
            ScreenVPController screenVpController = statusScreen.GetComponent <ScreenVPController> ();

            screenVpController.DrawScreen(utils, _summary);
            screenVpController.ShowError(error);
        }
Example #29
0
        /// <summary>
        /// Updates the active screens.
        /// </summary>
        /// <param name="gameTime">The elapsed game time.</param>
        public void Update(GameTime gameTime)
        {
            inputManager.BeginUpdate(gameTime);

            ActiveScreen.Update(gameTime);

            this.handleBackButtonInput();

#if DEBUG
            touchIndicatorManager.Update(gameTime);
#endif

            inputManager.EndUpdate();
        }
        private void DrawVPSummary(XsollaUtils utils, XVirtualPaymentSummary summary)
        {
            _summary      = summary;
            currentActive = ActiveScreen.VP_PAYMENT;
            GameObject statusScreen = Instantiate(Resources.Load(PREFAB_SCREEN_VP_SUMMARY)) as GameObject;

            statusScreen.transform.SetParent(mainScreenContainer.transform);
            Resizer.SetDefScale(statusScreen);
            statusScreen.GetComponent <RectTransform> ().anchoredPosition    = new Vector2(0, 0);
            mainScreenContainer.GetComponentInParent <ScrollRect> ().content = statusScreen.GetComponent <RectTransform> ();
            ScreenVPController screenVpController = statusScreen.GetComponent <ScreenVPController> ();

            screenVpController.DrawScreen(utils, summary);
        }
 public void ShowRedeemCoupon()
 {
     currentActive = ActiveScreen.REDEEM_COUPONS;
     GameObject screenRedeemCoupons = Instantiate(Resources.Load(PREFAB_SCREEN_REDEEM_COUPON)) as GameObject;
     // clear container
     Resizer.DestroyChilds(mainScreenContainer.transform);
     screenRedeemCoupons.transform.SetParent (mainScreenContainer.transform);
     screenRedeemCoupons.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 0);
     Resizer.ResizeToParrent (screenRedeemCoupons);
     mainScreenContainer.GetComponentInParent<ScrollRect> ().content = screenRedeemCoupons.GetComponent<RectTransform> ();
     _couponController = screenRedeemCoupons.GetComponent<RedeemCouponViewController>();
     _couponController.InitScreen(base.Utils);
     _couponController._btnApply.onClick.AddListener(delegate
         {
             CouponApplyClick(_couponController.GetCode());
         });
 }
Example #32
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // TODO: Add your update logic here

            float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (currentscreen == ActiveScreen.MainMenu)
            {
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                    this.Exit();

                touchLocations = TouchPanel.GetState();
                if (touchLocations.Count > 0 && touchLocations[0].State == TouchLocationState.Pressed)
                {
                    Vector2 touchposition = touchLocations[0].Position;

                    if (touchposition.X > 140 && touchposition.X < 340 && touchposition.Y > 280 && touchposition.Y < 320)
                    {
                        currentscreen = ActiveScreen.InGame;
                        resetdata();
                        setuplevel();
                    }
                    else if (touchposition.X > 140 && touchposition.X < 340 && touchposition.Y > 350 && touchposition.Y < 390)
                    {
                        LoadLeaderboard(LeaderboardScope.Overall, 1);
                        currentscreen = ActiveScreen.HighScores;
                    }
                }
            }
            else if (currentscreen == ActiveScreen.InGame)
            {
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                    currentscreen = ActiveScreen.MainMenu;

                touchLocations = TouchPanel.GetState();

                for (int i = 0; i < boxlist.Count; i++)
                {
                    boxlist[i].update(elapsedTime);

                    if (boxlist[i].clicktimer <= 0)
                    {
                        currentscreen = ActiveScreen.GameOver;
                        if (Guide.IsVisible == false)
                        {
                            object stateObj;
                            Guide.BeginShowKeyboardInput(PlayerIndex.One, "Game Over", "Please enter a name for the scoreboard (No longer than 30 characters)", "", GetText, stateObj = (object)"GetText for Input PlayerOne");
                        }
                    }

                    if (touchLocations.Count > 0 && touchLocations[0].State == TouchLocationState.Pressed)
                    {
                        Vector2 touchposition = touchLocations[0].Position;

                        if (boxlist[i].rectangle.Contains(new Point((int)touchposition.X, (int)touchposition.Y)) && boxlist[i].isgreen)
                        {
                            score += 25;
                            boxlist.Remove(boxlist[i]);
                            break;
                        }
                    }
                }

                if (boxlist.Count <= 0)
                {
                    level++;
                    if (level <= 6)
                    {
                        setuplevel();
                    }
                    else
                    {
                        currentscreen = ActiveScreen.GameOver;
                        if (Guide.IsVisible == false)
                        {
                            object stateObj;
                            Guide.BeginShowKeyboardInput(PlayerIndex.One, "Game Over", "Please enter a name for the scoreboard (No longer than 10 characters)", "", GetText, stateObj = (object)"GetText for Input PlayerOne");
                        }
                    }
                }
            }
            else if (currentscreen == ActiveScreen.GameOver)
            {
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                    currentscreen = ActiveScreen.MainMenu;
            }
            else if (currentscreen == ActiveScreen.HighScores)
            {
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                    currentscreen = ActiveScreen.MainMenu;

                 touchLocations = TouchPanel.GetState();
                 if (touchLocations.Count > 0 && touchLocations[0].State == TouchLocationState.Pressed)
                 {
                     Vector2 touchposition = touchLocations[0].Position;

                     if (touchposition.X > 100 && touchposition.X < 140 && touchposition.Y > 75 && touchposition.Y < 130)
                     {
                         if (currenthighscorestab == ActiveHighScoresTab.Overall)
                         {
                             currenthighscorestab = ActiveHighScoresTab.Daily;
                         }
                         else
                         {
                             currenthighscorestab--;
                         }

                         if (currenthighscorestab == ActiveHighScoresTab.Overall)
                         {
                             LoadLeaderboard(LeaderboardScope.Overall, 1);
                         }
                         else if (currenthighscorestab == ActiveHighScoresTab.Weekly)
                         {
                             LoadLeaderboard(LeaderboardScope.Weekly, 1);
                         }
                         else if (currenthighscorestab == ActiveHighScoresTab.Daily)
                         {
                             LoadLeaderboard(LeaderboardScope.Daily, 1);
                         }
                     }
                     else if (touchposition.X > 340 && touchposition.X < 380 && touchposition.Y > 75 && touchposition.Y < 130)
                     {
                         if (currenthighscorestab == ActiveHighScoresTab.Daily)
                         {
                             currenthighscorestab = ActiveHighScoresTab.Overall;
                         }
                         else
                         {
                             currenthighscorestab++;
                         }

                         if (currenthighscorestab == ActiveHighScoresTab.Overall)
                         {
                             LoadLeaderboard(LeaderboardScope.Overall, 1);
                         }
                         else if (currenthighscorestab == ActiveHighScoresTab.Weekly)
                         {
                             LoadLeaderboard(LeaderboardScope.Weekly, 1);
                         }
                         else if (currenthighscorestab == ActiveHighScoresTab.Daily)
                         {
                             LoadLeaderboard(LeaderboardScope.Daily, 1);
                         }
                     }
                 }
            }

            base.Update(gameTime);
        }
 protected override void ShowHistory(XsollaHistoryList pList)
 {
     GameObject screenHistoryView;
     HistoryController controller;
     controller = GameObject.FindObjectOfType<HistoryController>();
     // if we have controller
     if (controller != null)
     {
         controller = GameObject.FindObjectOfType<HistoryController>();
         if (!controller.IsRefresh())
             controller.AddListRows(Utils.GetTranslations(), pList);
         else
             controller.InitScreen(Utils.GetTranslations(), pList, Utils.GetProject().virtualCurrencyName);
     }
     else
     {
         currentActive = ActiveScreen.HISTORY_LIST;
         screenHistoryView = Instantiate(Resources.Load(PREFAB_SCREEN_HISTORY_USER)) as GameObject;
         controller = screenHistoryView.GetComponent<HistoryController>();
         if (controller != null)
             controller.InitScreen(Utils.GetTranslations(), pList, Utils.GetProject().virtualCurrencyName);
         // clear container
         //Resizer.DestroyChilds(mainScreenContainer.transform);
         screenHistoryView.transform.SetParent (mainScreenContainer.transform);
         screenHistoryView.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 0);
         Resizer.ResizeToParrent (screenHistoryView);
     }
 }
Example #34
0
    void Start()
    {
        activeScreen = GameObject.Find ("Main Camera").GetComponent<ActiveScreen> ();

        touch = new TouchGesture(this.GestureSetting);
        StartCoroutine(touch.CheckHorizontalSwipes(
        onDownSwipe: () =>
        {
            if (activeScreen.timeScreen)
            {
                timeScreenToggleUp = GameObject.Find ("Time Screen Toggle U").GetComponent<Toggle>();
                timeScreenToggleUp.isOn = true;
                timeScreenToggleUp.isOn = false;
            }
        },

        onUpSwipe: () =>
        {
            if (activeScreen.homeScreen)
            {
                homeScreenToggleDown = GameObject.Find ("Home Screen Toggle D").GetComponent<Toggle>();
                homeScreenToggleDown.isOn = true;
                homeScreenToggleDown.isOn = false;
            }
        },

        onRightSwipe: () =>
        {
            if (activeScreen.homeScreen)
            {
                homeScreenToggleRight = GameObject.Find ("Home Screen Toggle R").GetComponent<Toggle>();
                homeScreenToggleRight.isOn = true;
                homeScreenToggleRight.isOn = false;
            }

            if (activeScreen.profileScreen)
            {
                profileScreenToggleRight = GameObject.Find ("Profile Screen Toggle R").GetComponent<Toggle>();
                profileScreenToggleRight.isOn = true;
                profileScreenToggleRight.isOn = false;
            }

            if (activeScreen.achievementsScreen)
            {
                achievementsScreenToggleRight = GameObject.Find ("Achievements Screen Toggle R").GetComponent<Toggle>();
                achievementsScreenToggleRight.isOn = true;
                achievementsScreenToggleRight.isOn = false;
            }

            if (activeScreen.staticticsScreen)
            {
                statisticsScreenToggle = GameObject.Find ("Statistics Screen Toggle").GetComponent<Toggle>();
                statisticsScreenToggle.isOn = true;
                statisticsScreenToggle.isOn = false;
            }

            if (activeScreen.sessionScreen)
            {
                sessionScreenToggleRight = GameObject.Find ("Session Screen Toggle R").GetComponent<Toggle>();
                sessionScreenToggleRight.isOn = true;
                sessionScreenToggleRight.isOn = false;
            }

            if (activeScreen.instructionsScreen)
            {
                instructionsScreenToggle = GameObject.Find ("Instructions Screen Toggle").GetComponent<Toggle>();
                instructionsScreenToggle.isOn = true;
                instructionsScreenToggle.isOn = false;
            }
        },

        onLeftSwipe: () =>
        {
            if (activeScreen.homeScreen)
            {
                homeScreenToggleLeft = GameObject.Find ("Home Screen Toggle L").GetComponent<Toggle>();
                homeScreenToggleLeft.isOn = true;
                homeScreenToggleLeft.isOn = false;
            }

            if (activeScreen.settingsScreen)
            {
                settingsScreenToggle = GameObject.Find ("Settings Screen Toggle").GetComponent<Toggle>();
                settingsScreenToggle.isOn = true;
                settingsScreenToggle.isOn = false;
            }

            if (activeScreen.profileScreen)
            {
                profileScreenToggleLeft = GameObject.Find ("Profile Screen Toggle L").GetComponent<Toggle>();
                profileScreenToggleLeft.isOn = true;
                profileScreenToggleLeft.isOn = false;
            }

            if (activeScreen.achievementsScreen)
            {
                achievementsScreenToggleLeft = GameObject.Find ("Achievements Screen Toggle L").GetComponent<Toggle>();
                achievementsScreenToggleLeft.isOn = true;
                achievementsScreenToggleLeft.isOn = false;
            }

            if (activeScreen.timeScreen)
            {
                timeScreenToggleLeft = GameObject.Find ("Time Screen Toggle L").GetComponent<Toggle>();
                timeScreenToggleLeft.isOn = true;
                timeScreenToggleLeft.isOn = false;
            }

            if (activeScreen.sessionScreen)
            {
                sessionScreenToggleLeft = GameObject.Find ("Session Screen Toggle L").GetComponent<Toggle>();
                sessionScreenToggleLeft.isOn = true;
                sessionScreenToggleLeft.isOn = false;
            }
        }
        ));
    }
 private void DrawError(XsollaError error)
 {
     if (mainScreenContainer != null) {
         currentActive = ActiveScreen.ERROR;
         GameObject errorScreen = Instantiate (Resources.Load (PREFAB_SCREEN_ERROR)) as GameObject;
         errorScreen.transform.SetParent (mainScreenContainer.transform);
         errorScreen.GetComponent<RectTransform> ().anchoredPosition = new Vector2 (0, 0);
         mainScreenContainer.GetComponentInParent<ScrollRect> ().content = errorScreen.GetComponent<RectTransform> ();
         ScreenErrorController controller = errorScreen.GetComponent<ScreenErrorController> ();
         controller.ErrorHandler += OnErrorRecivied;
         controller.DrawScreen (error);
     } else {
         GameObject errorScreen = Instantiate (Resources.Load (PREFAB_SCREEN_ERROR_MAIN)) as GameObject;
         errorScreen.transform.SetParent (container.transform);
         Text[] texts = errorScreen.GetComponentsInChildren<Text>();
         texts[1].text = "Somthing went wrong";
         texts[2].text = error.errorMessage;
         texts[3].text = error.errorCode.ToString();
         texts[3].gameObject.SetActive(false);
         Resizer.ResizeToParrent (errorScreen);
     }
 }
 private void DrawForm(XsollaUtils utils, XsollaForm form)
 {
     currentActive = ActiveScreen.PAYMENT;
     GameObject checkoutScreen = Instantiate (Resources.Load(PREFAB_SCREEN_CHECKOUT)) as GameObject;
     checkoutScreen.transform.SetParent(mainScreenContainer.transform);
     checkoutScreen.GetComponent<RectTransform> ().anchoredPosition = new Vector2 (0, 0);
     //scroll.content = paymentScreen.GetComponent<RectTransform> ();
     mainScreenContainer.GetComponentInParent<ScrollRect> ().content = checkoutScreen.GetComponent<RectTransform> ();
     ScreenCheckoutController controller = checkoutScreen.GetComponent<ScreenCheckoutController> ();
     controller.InitScreen(utils, form);
 }
 private void DrawVPSummary(XsollaUtils utils, XVirtualPaymentSummary summary)
 {
     _summary = summary;
     currentActive = ActiveScreen.VP_PAYMENT;
     menuTransform.gameObject.SetActive (true);
     GameObject statusScreen = Instantiate (Resources.Load(PREFAB_SCREEN_VP_SUMMARY)) as GameObject;
     statusScreen.transform.SetParent(mainScreenContainer.transform);
     statusScreen.GetComponent<RectTransform> ().anchoredPosition = new Vector2 (0, 0);
     mainScreenContainer.GetComponentInParent<ScrollRect> ().content = statusScreen.GetComponent<RectTransform> ();
     ScreenVPController screenVpController = statusScreen.GetComponent<ScreenVPController> ();
     screenVpController.DrawScreen(utils, summary);
 }
 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 // <<<<<<<<<<<<<<<<<<<<<<<<<<<< PAYMENT METHODS <<<<<<<<<<<<<<<<<<<<<<<<<<<<
 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SHOP >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 private void DrawShopScreen()
 {
     currentActive = ActiveScreen.SHOP;
     if (_shopViewController == null) {
         GameObject paymentListScreen = Instantiate (shopScreenPrefab);
         _shopViewController = paymentListScreen.GetComponent<ShopViewController> ();
         _shopViewController.transform.SetParent (mainScreenContainer.transform);
         _shopViewController.GetComponent<RectTransform> ().anchoredPosition = new Vector2 (0, 0);
         mainScreenContainer.GetComponentInParent<ScrollRect> ().content = _shopViewController.GetComponent<RectTransform> ();
     }
 }
 private void DrawVPStatus(XsollaUtils utils, XVPStatus status)
 {
     currentActive = ActiveScreen.STATUS;
     menuTransform.gameObject.SetActive (false);
     GameObject statusScreen = Instantiate (Resources.Load(PREFAB_SCREEN_STATUS)) as GameObject;
     statusScreen.transform.SetParent(mainScreenContainer.transform);
     statusScreen.GetComponent<RectTransform> ().anchoredPosition = new Vector2 (0, 0);
     mainScreenContainer.GetComponentInParent<ScrollRect> ().content = statusScreen.GetComponent<RectTransform> ();
     StatusViewController controller = statusScreen.GetComponent<StatusViewController> ();
     controller.StatusHandler += OnUserStatusExit;
     controller.DrawVpStatus(utils, status);
 }