예제 #1
0
 public static UIAlert ShowAlert(UIAlertOptions options, bool modal)
 {
     var alert = new UIAlert(options);
     ShowDialog(alert, modal);
     alert.CenterAround(UIScreen.Current);
     return alert;
 }
예제 #2
0
        private void Controller_OnLotUnbuildable()
        {
            UIAlertOptions AlertOptions = new UIAlertOptions();
            AlertOptions.Title = GameFacade.Strings.GetString("246", "1");
            //This isn't exported as a string. WTF Maxis??
            AlertOptions.Message = "This property cannot be purchased!\r\n";
            AlertOptions.Buttons = UIAlertButtons.OK;

            m_LotUnbuildableAlert = UIScreen.ShowAlert(AlertOptions, true);
        }
예제 #3
0
        public override void Update(UpdateState state)
        {
            CoreGameScreen CurrentUIScr = (CoreGameScreen)GameFacade.Screens.CurrentUIScreen;

            if (Visible)
            { //if we're not visible, do not update CityRenderer state...
                m_LastMouseState = m_MouseState;
                m_MouseState = Mouse.GetState();

                m_MouseMove = (m_MouseState.MiddleButton == ButtonState.Pressed);

                if (m_HandleMouse)
                {
                    if (m_Zoomed)
                    {
                        m_SelTile = GetHoverSquare();

                        if (m_CanSend)
                        {
                            Network.UIPacketSenders.SendLotCostRequest(Network.NetworkFacade.Client, (short)m_SelTile[0], (short)m_SelTile[1]);
                            m_CanSend = false;
                        }
                    }

                    if (m_MouseState.MiddleButton == ButtonState.Pressed && m_LastMouseState.MiddleButton == ButtonState.Released)
                    {
                        m_MouseStart = new Vector2(m_MouseState.X, m_MouseState.Y); //if middle mouse button activated, record where we started pressing it (to use for panning)
                    }

                    else if (m_MouseState.LeftButton == ButtonState.Released && m_LastMouseState.LeftButton == ButtonState.Pressed) //if clicked...
                    {
                        if (!m_Zoomed)
                        {
                            m_Zoomed = true;
                            double ResScale = 768.0 / m_ScrHeight;
                            double isoScale = (Math.Sqrt(0.5 * 0.5 * 2) / 5.10) * ResScale;
                            double hb = m_ScrWidth * isoScale;
                            double vb = m_ScrHeight * isoScale;

                            m_TargVOffX = (float)(-hb + m_MouseState.X * isoScale * 2);
                            m_TargVOffY = (float)(vb - m_MouseState.Y * isoScale * 2); //zoom into approximate location of mouse cursor if not zoomed already
                        }
                        else
                        {
                            if (m_SelTile[0] != -1 && m_SelTile[1] != -1)
                            {
                                UIAlertOptions AlertOptions = new UIAlertOptions();
                                AlertOptions.Title = GameFacade.Strings.GetString("246", "1");
                                AlertOptions.Message = GameFacade.Strings.GetString("215", "23", new string[]
                                { m_LotCost.ToString(), CurrentUIScr.ucp.MoneyText.Caption });
                                AlertOptions.Buttons = UIAlertButtons.YesNo;

                                m_BuyPropertyAlert = UIScreen.ShowAlert(AlertOptions, true);
                                m_BuyPropertyAlert.ButtonMap[UIAlertButtons.Yes].OnButtonClick +=
                                    new ButtonClickDelegate(BuyPropertyAlert_OnButtonClick);
                            }
                        }

                        CurrentUIScr.ucp.UpdateZoomButton();
                    }
                }
                else
                {
                    m_SelTile = new int[] { -1, -1 };
                }

                //m_SecondsBehind += time.ElapsedGameTime.TotalSeconds;
                //m_SecondsBehind -= 1 / 60;
                FixedTimeUpdate();
                //SetTimeOfDay(m_DayNightCycle % 1); //calculates sun/moon light colour and position
                //m_DayNightCycle += 0.001; //adjust the cycle speed here. When ingame, set m_DayNightCycle to to the percentage of time passed through the day. (0 to 1)

                m_ViewOffX = (m_TargVOffX) * m_ZoomProgress;
                m_ViewOffY = (m_TargVOffY) * m_ZoomProgress;
            }
        }
예제 #4
0
        private void Controller_OnLotPurchaseFailed(Network.Events.TransactionEvent e)
        {
            UIAlertOptions AlertOptions = new UIAlertOptions();
            AlertOptions.Title = GameFacade.Strings.GetString("246", "1");

            if (Events.EventSink.EventQueue[0].ECode == Events.EventCodes.TRANSACTION_PLAYER_OUT_OF_MONEY)
            {
                //For now this says "Error! Transaction refused by server", because I couldn't find the right string.
                AlertOptions.Message = GameFacade.Strings.GetString("224", "16");

                //Doing this instead of EventQueue.Clear() ensures we won't accidentally remove any
                //events that may have been added to the end.
                Events.EventSink.EventQueue.Remove(Events.EventSink.EventQueue[0]);
            }
            else
            {
                AlertOptions.Message = "General Error";
                //Doing this instead of EventQueue.Clear() ensures we won't accidentally remove any
                //events that may have been added to the end.
                Events.EventSink.EventQueue.Remove(Events.EventSink.EventQueue[0]);
            }

            AlertOptions.Buttons = UIAlertButtons.OK;

            m_LotUnbuildableAlert = UIScreen.ShowAlert(AlertOptions, true);
        }
예제 #5
0
        /// <summary>
        /// User clicked the "Retire avatar" button.
        /// </summary>
        private void DeleteAvatarButton_OnButtonClick(UIElement button)
        {
            UIAlertOptions AlertOptions = new UIAlertOptions();
            //These should be imported as strings for localization.
            AlertOptions.Title = "Are you sure?";
            AlertOptions.Message = "Do you want to retire this Sim?";
            AlertOptions.Buttons = UIAlertButtons.OKCancel;

            RetireCharAlert = UIScreen.ShowAlert(AlertOptions, true);
            RetireCharAlert.ButtonMap[UIAlertButtons.OK].OnButtonClick +=
                new ButtonClickDelegate(PersonSlot_OnButtonClick);
        }