Example #1
0
        public CASScreen(ScreenManager Manager, SpriteBatch SBatch) : base(Manager, "CAS", SBatch,
                                                                           new Vector2(0, 0),
                                                                           new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight),
                                                                           GlobalSettings.Default.StartupPath + "\\" + "gamedata\\uiscripts\\personselectionedit.uis")
        {
            m_BackgroundImg = (UIImage)m_PResult.Elements["\"BackgroundImage\""];

            m_CancelBtn = (UIButton)m_PResult.Elements["\"CancelButton\""];
            m_AcceptBtn = (UIButton)m_PResult.Elements["\"AcceptButton\""];

            m_DescriptionScrollUpBtn = (UIButton)m_PResult.Elements["\"DescriptionScrollUpButton\""];
            m_DescriptionScrollUpBtn.OnButtonClicked += M_DescriptionScrollUpBtn_OnButtonClicked;
            m_DescriptionScrollUpBtn.Enabled          = false;
            m_DescriptionScrollDownBtn = (UIButton)m_PResult.Elements["\"DescriptionScrollDownButton\""];
            m_DescriptionScrollDownBtn.OnButtonClicked += M_DescriptionScrollDownBtn_OnButtonClicked;
            m_DescriptionScrollDownBtn.Enabled          = false;

            m_ExitBtn = (UIButton)m_PResult.Elements["\"ExitButton\""];
            m_ExitBtn.OnButtonClicked += M_ExitBtn_OnButtonClicked;

            m_FemaleBtn = (UIButton)m_PResult.Elements["\"FemaleButton\""];
            m_FemaleBtn.OnButtonClicked += M_FemaleBtn_OnButtonClicked;

            m_MaleBtn = (UIButton)m_PResult.Elements["\"MaleButton\""];
            m_MaleBtn.OnButtonClicked += M_MaleBtn_OnButtonClicked;

            m_SkinLightBtn = (UIButton)m_PResult.Elements["\"SkinLightButton\""];
            m_SkinLightBtn.OnButtonClicked += M_SkinLightBtn_OnButtonClicked;

            m_SkinMediumBtn = (UIButton)m_PResult.Elements["\"SkinMediumButton\""];
            m_SkinMediumBtn.OnButtonClicked += M_SkinMediumBtn_OnButtonClicked;

            m_SkinDarkBtn = (UIButton)m_PResult.Elements["\"SkinDarkButton\""];
            m_SkinDarkBtn.OnButtonClicked += M_SkinDarkBtn_OnButtonClicked;

            m_HeadSkinBrowser = new UIHeadBrowser(this, m_PResult.Controls["\"HeadSkinBrowser\""], 1, AvatarSex.Female);
            m_HeadSkinBrowser.OnButtonClicked += M_HeadSkinBrowser_OnButtonClicked;
            m_BodySkinBrowser = new UIBodyBrowser(this, m_PResult.Controls["\"BodySkinBrowser\""], 1, AvatarSex.Female);
            m_BodySkinBrowser.OnButtonClicked += M_BodySkinBrowser_OnButtonClicked;

            AdultAvatar Avatar = new AdultAvatar(Manager.Device, Manager.HeadShader);

            Avatar.ChangeOutfit(FileManager.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fab001_sl__pjs4), Vitaboy.SkinType.Medium);
            Avatar.SetHead(FileManager.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fah002_mom), (Vitaboy.SkinType)m_CurrentSkinType);
            Avatar.ShouldRotate = true;

            m_Avatar = new Sim(Manager.Device, Manager.RenderCamera, Avatar);

            m_VitaboyScreen = new VitaboyScreen(Manager, new Vector2(0, 0),
                                                new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight));
            m_VitaboyScreen.AddSim(m_Avatar);

            m_ExitDialog = new ExitDialog(this, new Vector2(250, 250), m_Walker,
                                          GlobalSettings.Default.StartupPath + "gamedata\\uiscripts\\exitdialog.uis");
            m_ExitDialog.Visible = false;

            m_DescriptionTextEdit = (UITextEdit)m_PResult.Elements["\"DescriptionTextEdit\""];

            Manager.AddScreen(m_VitaboyScreen);
        }
Example #2
0
 //Muestra el diálogo para salir de la aplicación
 public void ExitDialog(ExitDialog ventanaSalir)
 {
     if (ventanaSalir.ShowDialog() == true)
     {
         Application.Current.Shutdown();
     }
 }
Example #3
0
 void Awake()
 {
     inst         = this;
     content      = transform.Find("content").gameObject;
     cancelButton = transform.Find("content/Cancel").GetComponent <Button>();
     sureButton   = transform.Find("content/Sure").GetComponent <Button>();
 }
Example #4
0
        protected override async Task PostAsync(IActivity item, string state, CancellationToken token)
        {
            var message = item as IMessageActivity;

            if (message != null)
            {
                var exitDialog = new ExitDialog();

                this.task.Call(exitDialog, exitDialog.MessageReceivedAsync);

                await this.task.PollAsync(token);
            }
        }
        protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
        {
            var confirmation = GeneralSettings.ExitConfirmationType == ExitConfirmationType.Always ||
                               (GeneralSettings.ExitConfirmationType == ExitConfirmationType.InSortieOnly && KanColleClient.Current.IsInSortie);

            if (confirmation)
            {
                var vmodel = new DialogViewModel();
                var window = new ExitDialog
                {
                    DataContext = vmodel,
                    Owner       = this.MainWindow,
                };
                window.ShowDialog();

                e.Cancel = !vmodel.DialogResult;
            }

            base.OnSessionEnding(e);
        }
Example #6
0
        /// <summary>
        /// Handles the click on Quit menu item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Quit_Click(object sender, RoutedEventArgs e)
        {
            if (this.projectstate.Saved == false && this.projectstate.Active == true)
            {
                //Ask to save
                ExitDialog exit = new ExitDialog();

                //Inject event
                exit.ProjectQuitted +=
                    new ExitDialog.QuitProjectEventHandler(QuitProject_Quit);

                //Set dialog to the center of MainWindow
                exit.Owner = this;

                exit.ShowDialog();
            }
            else
            {
                //Exit
                Environment.Exit(0);
            }
        }
Example #7
0
        /// <summary>
        /// Здесь проводится загрузка активных COM портов, загрузка настроек приложения
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            LoadSerialPorts();
            settings = new SettingsDialogViewModel();
            settings.Load();
            if (settings.DemoMode)
            {
                OnDemoMode(null, null);
            }
            this.SensorsDataTable.ItemsSource = this.SensorsData;

            dialog         = new MessageDialog();
            exitDialog     = new ExitDialog();
            settingsDialog = new SettingsDialog
            {
                DataContext = settings
            };
            settingsDialog.OnDemoMode  += OnDemoMode;
            settingsDialog.OffDemoMode += OffDemoMode;
            updateResultsTableDialog    = new UpdateResultsTableDialog();
        }
Example #8
0
 void Awake()
 {
     _instance = this;
 }
Example #9
0
        public SASScreen(ScreenManager Manager, SpriteBatch SBatch) : base(Manager, "SAS", SBatch,
                                                                           new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight),
                                                                           GlobalSettings.Default.StartupPath + "\\" + "gamedata\\uiscripts\\personselection.uis")
        {
            m_BackgroundImg = (UIBackgroundImage)m_PResult.Elements["\"BackgroundImage\""];

            AdultAvatar Avatar = new AdultAvatar(Manager.Device, Manager.HeadShader);

            Avatar.ChangeOutfit(FileManager.Instance.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fab001_sl__pjs4), Vitaboy.SkinType.Medium);
            Avatar.SetHead(FileManager.Instance.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fah002_mom), Vitaboy.SkinType.Medium);
            AddAvatar(Avatar, 1);

            VitaboyScreen VScreen = new VitaboyScreen(Manager, new Vector2(0, 0),
                                                      new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight));

            VScreen.AddSim(m_Avatars[0]);

            Manager.AddScreen(VScreen);

            TabBackgroundImg1 = m_PResult.Elements["\"TabBackgroundImage1\""].Image;
            TabBackgroundImg2 = m_PResult.Elements["\"TabBackgroundImage2\""].Image;
            TabBackgroundImg3 = m_PResult.Elements["\"TabBackgroundImage3\""].Image;

            SimCreateButtonImage = (UIImage)m_PResult.Elements["\"SimCreateButtonImage\""];
            SimSelectButtonImage = (UIImage)m_PResult.Elements["\"SimSelectButtonImage\""];

            DescriptionTabBackgroundImg1         = m_PResult.Elements["\"DescriptionTabBackgroundImage1\""].Image;
            DescriptionTabBackgroundImg1.Visible = m_Avatars.Count >= 1 ? true : false;
            DescriptionTabBackgroundImg2         = m_PResult.Elements["\"DescriptionTabBackgroundImage2\""].Image;
            DescriptionTabBackgroundImg2.Visible = m_Avatars.Count >= 2 ? true : false;
            DescriptionTabBackgroundImg3         = m_PResult.Elements["\"DescriptionTabBackgroundImage3\""].Image;
            DescriptionTabBackgroundImg3.Visible = m_Avatars.Count == 3 ? true : false;

            DescriptionTabImage1         = m_PResult.Elements["\"DescriptionTabImage1\""].Image;
            DescriptionTabImage1.Visible = m_Avatars.Count >= 1 ? true : false;
            DescriptionTabImage2         = m_PResult.Elements["\"DescriptionTabImage2\""].Image;
            DescriptionTabImage2.Visible = m_Avatars.Count >= 2 ? true : false;
            DescriptionTabImage3         = m_PResult.Elements["\"DescriptionTabImage3\""].Image;
            DescriptionTabImage3.Visible = m_Avatars.Count == 3 ? true : false;

            EnterTabImage1         = m_PResult.Elements["\"EnterTabImage1\""].Image;
            EnterTabImage1.Visible = false;
            EnterTabImage2         = m_PResult.Elements["\"EnterTabImage2\""].Image;
            EnterTabImage2.Visible = false;
            EnterTabImage3         = m_PResult.Elements["\"EnterTabImage3\""].Image;
            EnterTabImage3.Visible = false;

            EnterTabBackgroundImage1         = m_PResult.Elements["\"EnterTabBackgroundImage1\""].Image;
            EnterTabBackgroundImage1.Visible = false;
            EnterTabBackgroundImage2         = m_PResult.Elements["\"EnterTabBackgroundImage2\""].Image;
            EnterTabBackgroundImage2.Visible = false;
            EnterTabBackgroundImage3         = m_PResult.Elements["\"EnterTabBackgroundImage3\""].Image;
            EnterTabBackgroundImage3.Visible = false;

            //DefaultHouseImg = (UIImage)m_Elements["\"DefaultHouseImage\""].Image; //Not used??

            CreditsBackgroundImg = m_PResult.Controls["\"CreditsButtonBackgroundImage\""].Image;
            //CityThumbnailBusyImg = m_Controls["\"CityThumbnailBusyImage\""].Image; //Not used??

            CityButtonTemplateImage = (UIImage)m_PResult.Elements["\"CityButtonTemplateImage\""];

            m_ExitButton = (UIButton)m_PResult.Elements["\"ExitButton\""];
            m_ExitButton.OnButtonClicked += M_ExitButton_OnButtonClicked;
            m_ExitDialog = new ExitDialog(this, new Vector2(250, 250), m_Walker,
                                          GlobalSettings.Default.StartupPath + "gamedata\\uiscripts\\exitdialog.uis");
            m_ExitDialog.Visible = false;
            RegisterElement(m_ExitDialog);

            m_EnterTabBtn1 = (UIButton)m_PResult.Elements["\"EnterTabButton1\""];
            m_EnterTabBtn1.OnButtonClicked += EnterTabBtn1_OnButtonClicked;
            m_EnterTabBtn1.Enabled          = m_Avatars.Count >= 1 ? true : false;
            m_EnterTabBtn2 = (UIButton)m_PResult.Elements["\"EnterTabButton2\""];
            m_EnterTabBtn2.OnButtonClicked += EnterTabBtn2_OnButtonClicked;
            m_EnterTabBtn2.Enabled          = m_Avatars.Count >= 2 ? true : false;
            m_EnterTabBtn3 = (UIButton)m_PResult.Elements["\"EnterTabButton3\""];
            m_EnterTabBtn3.OnButtonClicked += EnterTabBtn3_OnButtonClicked;
            m_EnterTabBtn3.Enabled          = m_Avatars.Count == 3 ? true : false;

            m_DescriptionTabBtn1 = (UIButton)m_PResult.Elements["\"DescriptionTabButton1\""];
            m_DescriptionTabBtn1.OnButtonClicked += DescriptionTabBtn1_OnButtonClicked;
            m_DescriptionTabBtn1.Enabled          = m_Avatars.Count >= 1 ? true : false;
            m_DescriptionTabBtn2 = (UIButton)m_PResult.Elements["\"DescriptionTabButton2\""];
            m_DescriptionTabBtn2.OnButtonClicked += DescriptionTabBtn2_OnButtonClicked;
            m_DescriptionTabBtn2.Enabled          = m_Avatars.Count >= 2 ? true : false;
            m_DescriptionTabBtn3 = (UIButton)m_PResult.Elements["\"DescriptionTabButton3\""];
            m_DescriptionTabBtn3.OnButtonClicked += DescriptionTabBtn3_OnButtonClicked;
            m_DescriptionTabBtn3.Enabled          = m_Avatars.Count == 3 ? true : false;

            m_AvatarButton1 = (UIButton)m_PResult.Elements["\"AvatarButton1\""];
            //m_AvatarButton1.AddImage(SimCreateButtonImage);
            m_AvatarButton2 = (UIButton)m_PResult.Elements["\"AvatarButton2\""];
            UIImage SimCreateButtonImg2 = new UIImage(SimCreateButtonImage);

            m_AvatarButton2.AddImage(SimCreateButtonImg2);
            m_AvatarButton3 = (UIButton)m_PResult.Elements["\"AvatarButton3\""];
            UIImage SimCreateButtonImg3 = new UIImage(SimCreateButtonImage);

            m_AvatarButton3.AddImage(SimCreateButtonImg3);

            m_CityButton1 = (UIButton)m_PResult.Elements["\"CityButton1\""];
            m_CityButton1.AddImage(GetImage("\"CityButtonTemplateImage\"", true));
            m_CityButton1.Visible = false;
            m_CityButton2         = (UIButton)m_PResult.Elements["\"CityButton2\""];
            m_CityButton2.AddImage(GetImage("\"CityButtonTemplateImage\"", true));
            m_CityButton2.Visible = false;
            m_CityButton3         = (UIButton)m_PResult.Elements["\"CityButton3\""];
            m_CityButton3.AddImage(GetImage("\"CityButtonTemplateImage\"", true));
            m_CityButton3.Visible = false;

            m_HouseButton1 = (UIButton)m_PResult.Elements["\"HouseButton1\""];
            m_HouseButton1.AddImage(GetImage("\"HouseButtonTemplateImage\"", true));
            m_HouseButton1.Visible = false;
            m_HouseButton2         = (UIButton)m_PResult.Elements["\"HouseButton2\""];
            m_HouseButton2.AddImage(GetImage("\"HouseButtonTemplateImage\"", true));
            m_HouseButton2.Visible = false;
            m_HouseButton3         = (UIButton)m_PResult.Elements["\"HouseButton3\""];
            m_HouseButton3.AddImage(GetImage("\"HouseButtonTemplateImage\"", true));
            m_HouseButton3.Visible = false;

            m_NewAvatarButton1         = (UIButton)m_PResult.Elements["\"NewAvatarButton1\""];
            m_NewAvatarButton1.Image   = SimSelectButtonImage;
            m_NewAvatarButton1.Visible = m_Avatars.Count >= 1 ? false : true;
            m_NewAvatarButton2         = (UIButton)m_PResult.Elements["\"NewAvatarButton2\""];
            m_NewAvatarButton2.Image   = SimCreateButtonImage;
            m_NewAvatarButton2.Visible = m_Avatars.Count >= 2 ? false : true;
            m_NewAvatarButton3         = (UIButton)m_PResult.Elements["\"NewAvatarButton3\""];
            m_NewAvatarButton3.Image   = SimCreateButtonImage;
            m_NewAvatarButton3.Visible = m_Avatars.Count == 3 ? false : true;

            m_DeleteAvatarButton1         = (UIButton)m_PResult.Elements["\"DeleteAvatarButton1\""];
            m_DeleteAvatarButton1.Visible = m_Avatars.Count >= 1 ? true : false;
            m_DeleteAvatarButton2         = (UIButton)m_PResult.Elements["\"DeleteAvatarButton2\""];
            m_DeleteAvatarButton2.Visible = m_Avatars.Count >= 2 ? true : false;
            m_DeleteAvatarButton3         = (UIButton)m_PResult.Elements["\"DeleteAvatarButton3\""];
            m_DeleteAvatarButton3.Visible = m_Avatars.Count == 3 ? true : false;

            m_PersonDescriptionText1         = (UITextEdit)m_PResult.Elements["\"PersonDescriptionText1\""];
            m_PersonDescriptionText1.Visible = m_Avatars.Count >= 1 ? true : false;
            m_PersonDescriptionText2         = (UITextEdit)m_PResult.Elements["\"PersonDescriptionText2\""];
            m_PersonDescriptionText2.Visible = m_Avatars.Count >= 2 ? true : false;
            m_PersonDescriptionText3         = (UITextEdit)m_PResult.Elements["\"PersonDescriptionText3\""];
            m_PersonDescriptionText3.Visible = m_Avatars.Count == 3 ? true : false;

            m_PersonDescriptionScrollUpBtn1         = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollUpButton1\""];
            m_PersonDescriptionScrollUpBtn1.Visible = m_PersonDescriptionText1.Visible ? true : false;
            m_PersonDescriptionScrollUpBtn2         = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollUpButton2\""];
            m_PersonDescriptionScrollUpBtn2.Visible = m_PersonDescriptionText2.Visible ? true : false;
            m_PersonDescriptionScrollUpBtn3         = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollUpButton3\""];
            m_PersonDescriptionScrollUpBtn3.Visible = m_PersonDescriptionText3.Visible ? true : false;

            m_PersonDescriptionScrollDownBtn1         = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollDownButton1\""];
            m_PersonDescriptionScrollDownBtn1.Visible = m_PersonDescriptionText1.Visible ? true : false;
            m_PersonDescriptionScrollDownBtn2         = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollDownButton2\""];
            m_PersonDescriptionScrollDownBtn2.Visible = m_PersonDescriptionText2.Visible ? true : false;
            m_PersonDescriptionScrollDownBtn3         = (UIButton)m_PResult.Elements["\"PersonDescriptionScrollDownButton3\""];
            m_PersonDescriptionScrollDownBtn3.Visible = m_PersonDescriptionText3.Visible ? true : false;

            m_CityNameText1         = (UILabel)m_PResult.Elements["\"CityNameText1\""];
            m_CityNameText1.Visible = false;
            m_CityNameText2         = (UILabel)m_PResult.Elements["\"CityNameText2\""];
            m_CityNameText2.Visible = false;
            m_CityNameText3         = (UILabel)m_PResult.Elements["\"CityNameText3\""];
            m_CityNameText3.Visible = false;

            //TODO: Assign captions to these if a sim has a house...
            m_HouseNameText1 = (UILabel)m_PResult.Elements["\"HouseNameText1\""];
            m_HouseNameText2 = (UILabel)m_PResult.Elements["\"HouseNameText2\""];
            m_HouseNameText3 = (UILabel)m_PResult.Elements["\"HouseNameText3\""];

            m_CreditsButton = (UIButton)m_PResult.Elements["\"CreditsButton\""];

            HitVM.PlayEvent("bkground_selectasim");

            foreach (KeyValuePair <string, UIElement> KVP in m_PResult.Elements)
            {
                RegisterElement(KVP.Value);
            }
        }
Example #10
0
        public CASScreen(ScreenManager Manager, SpriteBatch SBatch) : base(Manager, "CAS", SBatch,
                                                                           new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight),
                                                                           GlobalSettings.Default.StartupPath + "\\" + "gamedata\\uiscripts\\personselectionedit.uis")
        {
            m_BackgroundImg = (UIBackgroundImage)m_PResult.Elements["\"BackgroundImage\""];

            m_CancelBtn = (UIButton)m_PResult.Elements["\"CancelButton\""];
            m_AcceptBtn = (UIButton)m_PResult.Elements["\"AcceptButton\""];

            m_DescriptionScrollUpBtn = (UIButton)m_PResult.Elements["\"DescriptionScrollUpButton\""];
            m_DescriptionScrollUpBtn.OnButtonClicked += M_DescriptionScrollUpBtn_OnButtonClicked;
            m_DescriptionScrollUpBtn.Enabled          = false;
            m_DescriptionScrollDownBtn = (UIButton)m_PResult.Elements["\"DescriptionScrollDownButton\""];
            m_DescriptionScrollDownBtn.OnButtonClicked += M_DescriptionScrollDownBtn_OnButtonClicked;
            m_DescriptionScrollDownBtn.Enabled          = false;

            m_ExitBtn = (UIButton)m_PResult.Elements["\"ExitButton\""];
            m_ExitBtn.OnButtonClicked += M_ExitBtn_OnButtonClicked;

            m_FemaleBtn = (UIButton)m_PResult.Elements["\"FemaleButton\""];
            m_FemaleBtn.OnButtonClicked += M_FemaleBtn_OnButtonClicked;

            m_MaleBtn = (UIButton)m_PResult.Elements["\"MaleButton\""];
            m_MaleBtn.OnButtonClicked += M_MaleBtn_OnButtonClicked;

            m_SkinLightBtn = (UIButton)m_PResult.Elements["\"SkinLightButton\""];
            m_SkinLightBtn.OnButtonClicked += M_SkinLightBtn_OnButtonClicked;

            m_SkinMediumBtn = (UIButton)m_PResult.Elements["\"SkinMediumButton\""];
            m_SkinMediumBtn.OnButtonClicked += M_SkinMediumBtn_OnButtonClicked;

            m_SkinDarkBtn = (UIButton)m_PResult.Elements["\"SkinDarkButton\""];
            m_SkinDarkBtn.OnButtonClicked += M_SkinDarkBtn_OnButtonClicked;

            m_HeadSkinBrowser = new UIHeadBrowser(this, m_PResult.Controls["\"HeadSkinBrowser\""], 1, AvatarSex.Female);
            m_HeadSkinBrowser.OnButtonClicked += M_HeadSkinBrowser_OnButtonClicked;
            m_HeadSkinBrowser.DrawOrder        = (int)DrawOrderEnum.UI;
            RegisterElement(m_HeadSkinBrowser);
            m_BodySkinBrowser = new UIBodyBrowser(this, m_PResult.Controls["\"BodySkinBrowser\""], 1, AvatarSex.Female);
            m_BodySkinBrowser.OnButtonClicked += M_BodySkinBrowser_OnButtonClicked;
            m_BodySkinBrowser.DrawOrder        = (int)DrawOrderEnum.UI;
            RegisterElement(m_BodySkinBrowser);

            AdultAvatar Avatar = new AdultAvatar(Manager.Device, Manager.HeadShader);

            Avatar.ChangeOutfit(FileManager.Instance.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fab001_sl__pjs4), Vitaboy.SkinType.Medium);
            Avatar.SetHead(FileManager.Instance.GetOutfit((ulong)FileIDs.OutfitsFileIDs.fah002_mom), (Vitaboy.SkinType)m_CurrentSkinType);
            Avatar.ShouldRotate = true;

            m_Avatar = new Sim(Manager.Device, Manager.RenderCamera, Avatar);

            m_VitaboyScreen = new VitaboyScreen(Manager, new Vector2(0, 0),
                                                new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight));
            m_VitaboyScreen.AddSim(m_Avatar);

            m_ExitDialog = new ExitDialog(this, new Vector2(250, 250), m_Walker,
                                          GlobalSettings.Default.StartupPath + "gamedata\\uiscripts\\exitdialog.uis");
            m_ExitDialog.Visible = false;
            RegisterElement(m_ExitDialog);

            m_NameTextEdit = new TextBox(new Rectangle(22, 52, 230, 18), 64, "", Manager.Device, 9,
                                         StandardTxtColor, StandardTxtColor, 30, this, false);
            m_NameTextEdit.Name             = "NameTextEdit"; //This should be set for all UIElements that need to receive input.
            m_NameTextEdit.DrawOrder        = (int)DrawOrderEnum.UI;
            m_DescriptionTextEdit           = (UITextEdit)m_PResult.Elements["\"DescriptionTextEdit\""];
            m_DescriptionTextEdit.DrawOrder = (int)DrawOrderEnum.UI;

            KeyboardInput.Initialize(Manager, 500f, 20);

            HitVM.PlayEvent("bkground_createasim");

            Manager.AddScreen(m_VitaboyScreen);

            foreach (KeyValuePair <string, UIElement> KVP in m_PResult.Elements)
            {
                RegisterElement(KVP.Value);
            }
        }
Example #11
0
        /// <summary>
        /// Initializes UI elements
        /// </summary>
        private void InitControls()
        {
            //Map

            MapControl = new MapWindow(Manager);
            MapControl.Init();
            MapControl.SetPosition(201, 0);
            MapControl.Environment = Environment;
            MapControl.Renderer    = Renderers[0];
            MapControl.SetSize(Height, Height);
            MapControl.Resizable = true;
            MapControl.Movable   = true;
            Add(MapControl);

            //Left side bar

            SideBar = new SideBar(Manager);
            SideBar.Init();
            SideBar.StayOnBack = true;
            SideBar.Passive    = true;
            SideBar.SetSize(200, Height);
            SideBar.Anchor = Anchors.Left | Anchors.Top | Anchors.Bottom;

            Add(SideBar);

            NewMapBtn = new Button(Manager);
            NewMapBtn.Init();
            NewMapBtn.Text = "New Map";
            NewMapBtn.SetPosition(25, 10);
            NewMapBtn.SetSize(150, 25);
            NewMapBtn.Anchor = Anchors.Top | Anchors.Left;
            NewMapBtn.Click += new EventHandler(NewMapBtn_Click);
            SideBar.Add(NewMapBtn);

            SelectMapBtn = new Button(Manager);
            SelectMapBtn.Init();
            SelectMapBtn.Text   = "Select Map";
            SelectMapBtn.Click += new EventHandler(selectMapBtn_Click);
            SelectMapBtn.SetPosition(25, 40);
            SelectMapBtn.SetSize(150, 25);
            SelectMapBtn.Anchor = Anchors.Top | Anchors.Left;
            SideBar.Add(SelectMapBtn);

            DoOneStepBtn = new Button(Manager);
            DoOneStepBtn.Init();
            DoOneStepBtn.Text = "Do One Step";
            DoOneStepBtn.SetPosition(25, 90);
            DoOneStepBtn.SetSize(150, 25);
            DoOneStepBtn.Anchor = Anchors.Top | Anchors.Left;
            DoOneStepBtn.Click += new EventHandler(DoOneStepBtn_Click);
            SideBar.Add(DoOneStepBtn);

            DoOneRunBtn = new Button(Manager);
            DoOneRunBtn.Init();
            DoOneRunBtn.Text = "Do One Run";
            DoOneRunBtn.SetPosition(25, 120);
            DoOneRunBtn.SetSize(150, 25);
            DoOneRunBtn.Anchor = Anchors.Top | Anchors.Left;
            DoOneRunBtn.Click += new EventHandler(DoOneRunBtn_Click);
            SideBar.Add(DoOneRunBtn);

            NextRunBtn = new Button(Manager);
            NextRunBtn.Init();
            NextRunBtn.Text = "Next Run";
            NextRunBtn.SetPosition(25, 150);
            NextRunBtn.SetSize(150, 25);
            NextRunBtn.Anchor = Anchors.Top | Anchors.Left;
            NextRunBtn.Click += new EventHandler(NextRunBtn_Click);
            SideBar.Add(NextRunBtn);

            DoAllRunBtn = new Button(Manager);
            DoAllRunBtn.Init();
            DoAllRunBtn.Text = "Do All Run";
            DoAllRunBtn.SetPosition(25, 180);
            DoAllRunBtn.SetSize(150, 25);
            DoAllRunBtn.Anchor = Anchors.Top | Anchors.Left;
            DoAllRunBtn.Click += new EventHandler(DoAllRunBtn_Click);
            SideBar.Add(DoAllRunBtn);

            GrpBox = new GroupBox(Manager);
            GrpBox.Init();
            GrpBox.SetSize(SideBar.Width - 30, 135);
            GrpBox.SetPosition(5, 220);
            GrpBox.ClientWidth = 180;
            GrpBox.Text        = "Display Options";
            GrpBox.TextColor   = Color.Wheat;
            SideBar.Add(GrpBox);

            Label stepsLbl = new Label(Manager);

            stepsLbl.Init();
            stepsLbl.Text = "Steps:";
            stepsLbl.SetPosition(5, 25);
            GrpBox.Add(stepsLbl);

            StepsTxt = new TextBox(Manager);
            StepsTxt.Init();
            StepsTxt.Text = "100";
            StepsTxt.SetSize(100, 25);
            StepsTxt.SetPosition(5 + stepsLbl.Width, 20);
            StepsTxt.TextColor    = Color.WhiteSmoke;
            StepsTxt.TextChanged += new EventHandler(TimeTxt_TextChanged);
            GrpBox.Add(StepsTxt);

            Label timeLbl = new Label(Manager);

            timeLbl.Init();
            timeLbl.Text = "Time:";
            timeLbl.SetPosition(5, 60);
            GrpBox.Add(timeLbl);

            TimeTxt = new TextBox(Manager);
            TimeTxt.Init();
            TimeTxt.Text = "20";
            TimeTxt.SetSize(100, 25);
            TimeTxt.SetPosition(5 + stepsLbl.Width, 55);
            TimeTxt.TextChanged += new EventHandler(TimeTxt_TextChanged);
            TimeTxt.TextColor    = Color.WhiteSmoke;
            GrpBox.Add(TimeTxt);

            DisplayBtn = new Button(Manager);
            DisplayBtn.Init();
            DisplayBtn.Text   = "Display";
            DisplayBtn.Click += new EventHandler(displayBtn_Click);
            DisplayBtn.SetSize(120, 25);
            DisplayBtn.SetPosition(50, 90);
            GrpBox.Add(DisplayBtn);

            Label rendererLbl = new Label(Manager);

            rendererLbl.Init();
            rendererLbl.Text = "Renderer:";
            rendererLbl.SetPosition(25, 360);
            Add(rendererLbl);

            RenderersComboBox = new ComboBox(Manager);
            RenderersComboBox.Init();
            RenderersComboBox.SetPosition(25, 385);
            RenderersComboBox.Width     = 150;
            RenderersComboBox.TextColor = Color.Wheat;
            RenderersComboBox.Items.AddRange(Renderers);
            RenderersComboBox.ItemIndex    = 0;
            RenderersComboBox.TextChanged += new EventHandler(RenderersComboBox_TextChanged);
            Add(RenderersComboBox);

            Button makeFullScreenBtn = new Button(Manager);

            makeFullScreenBtn.Init();
            makeFullScreenBtn.Text = "Fullscreen";
            makeFullScreenBtn.SetPosition(25, 475);
            makeFullScreenBtn.SetSize(150, 25);
            makeFullScreenBtn.Click += new EventHandler(makeFullScreenBtn_Click);
            makeFullScreenBtn.Anchor = Anchors.Top | Anchors.Left;
            SideBar.Add(makeFullScreenBtn);

            Button exitBtn = new Button(Manager);

            exitBtn.Init();
            exitBtn.Text = "Quit";
            exitBtn.SetPosition(25, 510);
            exitBtn.SetSize(150, 25);
            exitBtn.Click += new EventHandler(exitBtn_Click);
            exitBtn.Anchor = Anchors.Top | Anchors.Left;
            SideBar.Add(exitBtn);

            ExitDlg = new ExitDialog(Manager);
            ExitDlg.Init();
            ExitDlg.Closed += new WindowClosedEventHandler(ExitDlg_Closed);
            Manager.Add(ExitDlg);
            ExitDlg.Hide();

            //Right side bar
            SideBarRight = new SideBar(Manager);
            SideBarRight.Init();
            SideBarRight.StayOnBack = true;
            SideBarRight.Resizable  = true;
            SideBarRight.ResizeEdge = Anchors.Left;
            SideBarRight.SetSize(200, Height);
            SideBarRight.SetPosition(Width - SideBarRight.Width, 0);
            SideBarRight.Anchor = Anchors.Right | Anchors.Top | Anchors.Bottom;
            Add(SideBarRight);

            GroupBox runParamsGrpBox = new GroupBox(Manager);

            runParamsGrpBox.Init();
            runParamsGrpBox.SetSize(SideBarRight.Width - 30, 155);
            runParamsGrpBox.SetPosition(5, 10);
            runParamsGrpBox.ClientWidth = 38;
            runParamsGrpBox.Text        = "Run Statistics";
            runParamsGrpBox.TextColor   = Color.Wheat;
            runParamsGrpBox.Anchor      = Anchors.Left | Anchors.Right | Anchors.Top;
            SideBarRight.Add(runParamsGrpBox);

            Label runLbl1 = new Label(Manager);

            runLbl1.Init();
            runLbl1.Text = "Run:";
            runLbl1.SetPosition(10, 20);
            runLbl1.Width = 120;
            runParamsGrpBox.Add(runLbl1);

            Label runLbl2 = new Label(Manager);

            runLbl2.Init();
            runLbl2.Text = "0";
            runLbl2.SetPosition(runLbl1.Left + runLbl1.Width + 10, 20);
            runParamsGrpBox.Add(runLbl2);
            RunStatsLbls.Add(runLbl2);

            Label timeStepLbl1 = new Label(Manager);

            timeStepLbl1.Init();
            timeStepLbl1.Text = "Time step:";
            timeStepLbl1.SetPosition(10, 35);
            timeStepLbl1.Width = 120;
            runParamsGrpBox.Add(timeStepLbl1);

            Label timeStepLbl2 = new Label(Manager);

            timeStepLbl2.Init();
            timeStepLbl2.Text = "0";
            timeStepLbl2.SetPosition(timeStepLbl1.Left + timeStepLbl1.Width + 10, 35);
            runParamsGrpBox.Add(timeStepLbl2);
            RunStatsLbls.Add(timeStepLbl2);

            Label actionLbl1 = new Label(Manager);

            actionLbl1.Init();
            actionLbl1.Text = "Action:";
            actionLbl1.SetPosition(10, 60);
            actionLbl1.Width = 120;
            runParamsGrpBox.Add(actionLbl1);

            Label actionLbl2 = new Label(Manager);

            actionLbl2.Init();
            actionLbl2.Text = "0";
            actionLbl2.SetPosition(actionLbl1.Left + actionLbl1.Width + 10, 60);
            runParamsGrpBox.Add(actionLbl2);
            RunStatsLbls.Add(actionLbl2);

            Label dirtyOnMapLbl1 = new Label(Manager);

            dirtyOnMapLbl1.Init();
            dirtyOnMapLbl1.Text = "Dirty on map:";
            dirtyOnMapLbl1.SetPosition(10, 85);
            dirtyOnMapLbl1.Width = 120;
            runParamsGrpBox.Add(dirtyOnMapLbl1);

            Label dirtyOnMapLbl2 = new Label(Manager);

            dirtyOnMapLbl2.Init();
            dirtyOnMapLbl2.Text = "0";
            dirtyOnMapLbl2.SetPosition(dirtyOnMapLbl1.Left + dirtyOnMapLbl1.Width + 10, 85);
            runParamsGrpBox.Add(dirtyOnMapLbl2);
            RunStatsLbls.Add(dirtyOnMapLbl2);

            Label overAllDirtyLbl1 = new Label(Manager);

            overAllDirtyLbl1.Init();
            overAllDirtyLbl1.Text = "Overall dirty:";
            overAllDirtyLbl1.SetPosition(10, 100);
            overAllDirtyLbl1.Width = 120;
            runParamsGrpBox.Add(overAllDirtyLbl1);

            Label overAllDirtyLbl2 = new Label(Manager);

            overAllDirtyLbl2.Init();
            overAllDirtyLbl2.Text = "0";
            overAllDirtyLbl2.SetPosition(overAllDirtyLbl1.Left + overAllDirtyLbl1.Width + 10, 100);
            runParamsGrpBox.Add(overAllDirtyLbl2);
            RunStatsLbls.Add(overAllDirtyLbl2);

            Label cleanedDirtyLbl1 = new Label(Manager);

            cleanedDirtyLbl1.Init();
            cleanedDirtyLbl1.Text = "Cleaned dirty:";
            cleanedDirtyLbl1.SetPosition(10, 115);
            cleanedDirtyLbl1.Width = 120;
            runParamsGrpBox.Add(cleanedDirtyLbl1);

            Label cleanedDirtyLbl2 = new Label(Manager);

            cleanedDirtyLbl2.Init();
            cleanedDirtyLbl2.Text = "0";
            cleanedDirtyLbl2.SetPosition(cleanedDirtyLbl1.Left + cleanedDirtyLbl1.Width + 10, 115);
            runParamsGrpBox.Add(cleanedDirtyLbl2);
            RunStatsLbls.Add(cleanedDirtyLbl2);

            Label consumedEnergyLbl1 = new Label(Manager);

            consumedEnergyLbl1.Init();
            consumedEnergyLbl1.Text = "Consumed energy:";
            consumedEnergyLbl1.SetPosition(10, 130);
            consumedEnergyLbl1.Width = 120;
            runParamsGrpBox.Add(consumedEnergyLbl1);

            Label consumedEnergyLbl2 = new Label(Manager);

            consumedEnergyLbl2.Init();
            consumedEnergyLbl2.Text = "0";
            consumedEnergyLbl2.SetPosition(consumedEnergyLbl1.Left + consumedEnergyLbl1.Width + 10, 130);
            runParamsGrpBox.Add(consumedEnergyLbl2);
            RunStatsLbls.Add(consumedEnergyLbl2);
            ////
            GroupBox totalParamsGrpBox = new GroupBox(Manager);

            totalParamsGrpBox.Init();
            totalParamsGrpBox.SetSize(SideBarRight.Width - 30, 215);
            totalParamsGrpBox.SetPosition(5, runParamsGrpBox.Top + runParamsGrpBox.Height + 10);
            totalParamsGrpBox.ClientWidth = 38;
            totalParamsGrpBox.Text        = "Total Statistics";
            totalParamsGrpBox.TextColor   = Color.Wheat;
            totalParamsGrpBox.Anchor      = Anchors.Left | Anchors.Right | Anchors.Top;
            SideBarRight.Add(totalParamsGrpBox);

            Label completedRunsLbl1 = new Label(Manager);

            completedRunsLbl1.Init();
            completedRunsLbl1.Text = "Completed Runs:";
            completedRunsLbl1.SetPosition(10, 20);
            completedRunsLbl1.Width = 120;
            totalParamsGrpBox.Add(completedRunsLbl1);

            Label completedRunsLbl2 = new Label(Manager);

            completedRunsLbl2.Init();
            completedRunsLbl2.Text = "0";
            completedRunsLbl2.SetPosition(completedRunsLbl1.Left + completedRunsLbl1.Width + 10, 20);
            totalParamsGrpBox.Add(completedRunsLbl2);
            TotalStatsLbls.Add(completedRunsLbl2);

            Label totalDirtyLbl1 = new Label(Manager);

            totalDirtyLbl1.Init();
            totalDirtyLbl1.Text = "Total dirty degree:";
            totalDirtyLbl1.SetPosition(10, 35);
            totalDirtyLbl1.Width = 120;
            totalParamsGrpBox.Add(totalDirtyLbl1);

            Label totalDirtyLbl2 = new Label(Manager);

            totalDirtyLbl2.Init();
            totalDirtyLbl2.Text = "0";
            totalDirtyLbl2.SetPosition(totalDirtyLbl1.Left + totalDirtyLbl1.Width + 10, 35);
            totalParamsGrpBox.Add(totalDirtyLbl2);
            TotalStatsLbls.Add(totalDirtyLbl2);

            Label totalCleanedLbl1 = new Label(Manager);

            totalCleanedLbl1.Init();
            totalCleanedLbl1.Text = "Total cleaned dirty:";
            totalCleanedLbl1.SetPosition(10, 60);
            totalCleanedLbl1.Width = 120;
            totalParamsGrpBox.Add(totalCleanedLbl1);

            Label totalCleanedLbl2 = new Label(Manager);

            totalCleanedLbl2.Init();
            totalCleanedLbl2.Text = "0";
            totalCleanedLbl2.SetPosition(totalCleanedLbl1.Left + totalCleanedLbl1.Width + 10, 60);
            totalParamsGrpBox.Add(totalCleanedLbl2);
            TotalStatsLbls.Add(totalCleanedLbl2);

            Label totalConsumedLbl1 = new Label(Manager);

            totalConsumedLbl1.Init();
            totalConsumedLbl1.Text = "Total consumed\nenergy:";
            totalConsumedLbl1.SetPosition(10, 85);
            totalConsumedLbl1.SetSize(120, 30);
            totalParamsGrpBox.Add(totalConsumedLbl1);

            Label totalConsumedLbl2 = new Label(Manager);

            totalConsumedLbl2.Init();
            totalConsumedLbl2.Text = "0";
            totalConsumedLbl2.SetPosition(totalConsumedLbl1.Left + totalConsumedLbl1.Width + 10, 85);
            totalParamsGrpBox.Add(totalConsumedLbl2);
            TotalStatsLbls.Add(totalConsumedLbl2);

            Label avarageDirtyLbl1 = new Label(Manager);

            avarageDirtyLbl1.Init();
            avarageDirtyLbl1.Text = "Average dirty\ndegree:";
            avarageDirtyLbl1.SetPosition(10, 115);
            avarageDirtyLbl1.SetSize(120, 30);
            totalParamsGrpBox.Add(avarageDirtyLbl1);

            Label avarageDirtyLbl2 = new Label(Manager);

            avarageDirtyLbl2.Init();
            avarageDirtyLbl2.Text = "0";
            avarageDirtyLbl2.SetPosition(avarageDirtyLbl1.Left + avarageDirtyLbl1.Width + 10, 115);
            totalParamsGrpBox.Add(avarageDirtyLbl2);
            TotalStatsLbls.Add(avarageDirtyLbl2);

            Label avarageCleanedLbl1 = new Label(Manager);

            avarageCleanedLbl1.Init();
            avarageCleanedLbl1.Text = "Average cleaned\ndirty:";
            avarageCleanedLbl1.SetPosition(10, 145);
            avarageCleanedLbl1.SetSize(120, 30);
            totalParamsGrpBox.Add(avarageCleanedLbl1);

            Label avarageCleanedLbl2 = new Label(Manager);

            avarageCleanedLbl2.Init();
            avarageCleanedLbl2.Text = "0";
            avarageCleanedLbl2.SetPosition(avarageCleanedLbl1.Left + avarageCleanedLbl1.Width + 10, 145);
            totalParamsGrpBox.Add(avarageCleanedLbl2);
            TotalStatsLbls.Add(avarageCleanedLbl2);

            Label avarageConsumedLbl1 = new Label(Manager);

            avarageConsumedLbl1.Init();
            avarageConsumedLbl1.Text = "Average consumed\nenergy:";
            avarageConsumedLbl1.SetPosition(10, 175);
            avarageConsumedLbl1.Width  = 120;
            avarageConsumedLbl1.Height = 30;
            totalParamsGrpBox.Add(avarageConsumedLbl1);

            Label avarageConsumedLbl2 = new Label(Manager);

            avarageConsumedLbl2.Init();
            avarageConsumedLbl2.Text = "0";
            avarageConsumedLbl2.SetPosition(avarageConsumedLbl1.Left + avarageConsumedLbl1.Width + 10, 175);
            totalParamsGrpBox.Add(avarageConsumedLbl2);
            TotalStatsLbls.Add(avarageConsumedLbl2);
            /////
            //Select map

            OpenFileDialog = new Dialog(Manager);
            OpenFileDialog.Init();
            OpenFileDialog.Text = "Select map file";
            OpenFileDialog.Description.Visible = false;
            OpenFileDialog.Caption.Text        = "";
            OpenFileDialog.Width   = 600;
            OpenFileDialog.Resize += new ResizeEventHandler(OpenFileDialog_Resize);
            Manager.Add(OpenFileDialog);
            OpenFileDialog.Hide();

            FilesList = new ListBox(Manager);
            FilesList.Init();
            FilesList.Tag = System.Environment.CurrentDirectory;
            FilesList.SetPosition(0, 40);
            FilesList.ClientWidth  = OpenFileDialog.Width - 15;
            FilesList.ClientHeight = OpenFileDialog.ClientHeight - 40;
            FilesList.TextColor    = Color.Wheat;
            FilesList.DoubleClick += new EventHandler(FilesList_DoubleClick);
            GetFilesAndFolders();
            OpenFileDialog.Add(FilesList);

            LifeTimeLbl = new Label(Manager);
            LifeTimeLbl.Init();
            LifeTimeLbl.Text = "Life Time:";
            LifeTimeLbl.SetPosition(5, 10);
            OpenFileDialog.Add(LifeTimeLbl);

            LifeTimeTxt = new TextBox(Manager);
            LifeTimeTxt.Init();
            LifeTimeTxt.Text = "2000";
            LifeTimeTxt.SetSize(100, 25);
            LifeTimeTxt.SetPosition(5 + stepsLbl.Width, 5);
            LifeTimeTxt.TextColor    = Color.WhiteSmoke;
            LifeTimeTxt.TextChanged += new EventHandler(TimeTxt_TextChanged);
            OpenFileDialog.Add(LifeTimeTxt);

            TestCaseLbl = new Label(Manager);
            TestCaseLbl.Init();
            TestCaseLbl.Text = "Test Case:";
            TestCaseLbl.SetPosition(LifeTimeTxt.Left + LifeTimeTxt.Width + 5, 10);
            OpenFileDialog.Add(TestCaseLbl);

            TestCaseTxt = new TextBox(Manager);
            TestCaseTxt.Init();
            TestCaseTxt.Text = "10";
            TestCaseTxt.SetSize(100, 25);
            TestCaseTxt.SetPosition(TestCaseLbl.Left + TestCaseLbl.Width + 5, 5);
            TestCaseTxt.TextColor    = Color.WhiteSmoke;
            TestCaseTxt.TextChanged += new EventHandler(TimeTxt_TextChanged);
            OpenFileDialog.Add(TestCaseTxt);

            AgentLbl = new Label(Manager);
            AgentLbl.Init();
            AgentLbl.Text = "Agent:";
            AgentLbl.SetPosition(TestCaseTxt.Left + TestCaseTxt.Width + 5, 10);
            OpenFileDialog.Add(AgentLbl);

            AgentsComboBox = new ComboBox(Manager);
            AgentsComboBox.Init();
            AgentsComboBox.SetPosition(AgentLbl.Left + AgentLbl.Width - 10, 5);
            AgentsComboBox.Width     = 150;
            AgentsComboBox.Height    = 25;
            AgentsComboBox.TextColor = Color.Wheat;
            AgentsComboBox.Items.Add("RandomAgent");
            AgentsComboBox.Items.Add("ModelAgent");
            AgentsComboBox.Items.Add("ModelAgentNoIdle");
            AgentsComboBox.ItemIndex = 0;
            OpenFileDialog.Add(AgentsComboBox);

            NewGameDialog = new Dialog(Manager);
            NewGameDialog.Init();
            NewGameDialog.Text = "Start new tests";
            NewGameDialog.Description.Visible = false;
            NewGameDialog.BottomPanel.Visible = false;
            NewGameDialog.Caption.Text        = "";
            NewGameDialog.Width           = 600;
            NewGameDialog.Height          = 130;
            NewGameDialog.TopPanel.Height = 100;
            Manager.Add(NewGameDialog);
            NewGameDialog.Hide();

            Button newGameOk = new Button(Manager);

            newGameOk.Init();
            newGameOk.SetPosition(20, 50);
            newGameOk.Text   = "Confirm";
            newGameOk.Click += new EventHandler(newGameOk_Click);
            NewGameDialog.Add(newGameOk);

            EnableDisableMapControls(false);
        }