public override void Update(UpdateState state) { UpdateMotives(); base.Update(state); if (Opacity < 1) { if (DynamicOverlay.GetChildren().Count > 0) { foreach (var m in MotiveDisplays) { DynamicOverlay.Remove(m); Add(m); } } Invalidate(); } else { if (DynamicOverlay.GetChildren().Count == 0) { foreach (var m in MotiveDisplays) { Remove(m); DynamicOverlay.Add(m); Invalidate(); } } } }
public void SetPanel(int newPanel) { GameFacade.Cursor.SetCursor(CursorType.Hourglass); OptionsModeButton.Selected = false; BuyModeButton.Selected = false; BuildModeButton.Selected = false; LiveModeButton.Selected = false; HouseModeButton.Selected = false; if (Game.InLot) { Game.LotControl.QueryPanel.Active = false; Game.LotControl.QueryPanel.Visible = false; Game.LotControl.LiveMode = true; Game.LotControl.World.State.BuildMode = 0; } if (CurrentPanel != -1) { switch (CurrentPanel) { case 3: case 2: if (Game.InLot && Game.vm.TSOState.Roommates.Contains(Game.vm.MyUID)) { FindController <CoreGameScreenController>()?.UploadLotThumbnail(); } break; } DynamicOverlay.Remove(Panel); Panel = null; if (Game.InLot) { Game.LotControl.SetDonatorDialogVisible(false); Game.LotControl.PanelActive = false; } } if (newPanel != CurrentPanel) { if (SpecialMusic || SpecialMusicTrigger()) { if (newPanel == 2) { HITVM.Get().PlaySoundEvent(UIMusic.Buy); } else if (newPanel == 3 || newPanel == 4) { HITVM.Get().PlaySoundEvent(UIMusic.Build); } else if (newPanel != 5) { HITVM.Get().PlaySoundEvent(UIMusic.None); } } if (Game.InLot) { Game.LotControl.SetDonatorDialogVisible(newPanel > 1 && newPanel < 4); Game.LotControl.PanelActive = true; if ((newPanel == 2 || newPanel == 3) && Game.vm.TSOState.CommunityLot) { if (Game.vm.TSOState.OwnerID == Game.vm.MyUID) { FSOFacade.Hints.TriggerHint("ui:mayor_buildbuy"); FSOFacade.Hints.TriggerHint("ui:mayor_donators"); } else if (Game.vm.TSOState.Roommates.Contains(Game.vm.MyUID)) { FSOFacade.Hints.TriggerHint("ui:donator"); } } } switch (newPanel) { case 5: Panel = new UIOptions(); Panel.X = 177; Panel.Y = 96; DynamicOverlay.Add(Panel); OptionsModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); break; case 2: if (!Game.InLot) { break; //not ingame } Panel = new UIBuyMode(Game.LotControl); //enable grid Game.LotControl.World.State.BuildMode = 1; Game.LotControl.LiveMode = false; Panel.X = 177; Panel.Y = 96; DynamicOverlay.Add(Panel); BuyModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); break; case 3: if (!Game.InLot) { break; //not ingame } Panel = new UIBuildMode(Game.LotControl); //enable air tile graphics + grid Game.LotControl.World.State.BuildMode = 2; Game.LotControl.LiveMode = false; Panel.X = 177; Panel.Y = 96; DynamicOverlay.Add(Panel); BuildModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); FSOFacade.Hints.TriggerHint("ui:buildmode"); break; case 4: if (!Game.InLot) { break; //not ingame } Panel = new UIHouseMode(Game.LotControl); //enable grid Game.LotControl.World.State.BuildMode = 1; Panel.X = 177; Panel.Y = 87; DynamicOverlay.Add(Panel); HouseModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); break; case 1: if (!Game.InLot) { break; //not ingame } Panel = new UILiveMode(Game.LotControl); Panel.X = 177; Panel.Y = 61; DynamicOverlay.Add(Panel); LiveModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); break; default: if (Game.InLot) { Game.LotControl.PanelActive = false; } break; } CurrentPanel = newPanel; } else { Remove(PanelBlocker); PanelBlocker = null; CurrentPanel = -1; } GameFacade.Cursor.SetCursor(CursorType.Normal); }
public void SetPanel(int newPanel) { GameFacade.Cursor.SetCursor(CursorType.Hourglass); OptionsModeButton.Selected = false; BuyModeButton.Selected = false; BuildModeButton.Selected = false; LiveModeButton.Selected = false; HouseModeButton.Selected = false; if (Game.InLot) { Game.LotControl.QueryPanel.Active = false; Game.LotControl.QueryPanel.Visible = false; Game.LotControl.LiveMode = true; Game.LotControl.World.State.BuildMode = 0; } if (CurrentPanel != -1) { switch (CurrentPanel) { case 3: case 2: if (Game.InLot && Game.vm.TSOState.Roommates.Contains(Game.vm.MyUID)) { FindController <CoreGameScreenController>().UploadLotThumbnail(); } break; } DynamicOverlay.Remove(Panel); Panel = null; if (Game.InLot) { Game.LotControl.PanelActive = false; } } if (newPanel != CurrentPanel) { if (Game.InLot) { Game.LotControl.PanelActive = true; } switch (newPanel) { case 5: Panel = new UIOptions(); Panel.X = 177; Panel.Y = 96; DynamicOverlay.Add(Panel); OptionsModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); break; case 2: if (!Game.InLot) { break; //not ingame } Panel = new UIBuyMode(Game.LotControl); //enable grid Game.LotControl.World.State.BuildMode = 1; Game.LotControl.LiveMode = false; Panel.X = 177; Panel.Y = 96; DynamicOverlay.Add(Panel); BuyModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); break; case 3: if (!Game.InLot) { break; //not ingame } Panel = new UIBuildMode(Game.LotControl); //enable air tile graphics + grid Game.LotControl.World.State.BuildMode = 2; Game.LotControl.LiveMode = false; Panel.X = 177; Panel.Y = 96; DynamicOverlay.Add(Panel); BuildModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); break; case 4: if (!Game.InLot) { break; //not ingame } Panel = new UIHouseMode(Game.LotControl); //enable grid Game.LotControl.World.State.BuildMode = 1; Panel.X = 177; Panel.Y = 87; DynamicOverlay.Add(Panel); HouseModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); break; case 1: if (!Game.InLot) { break; //not ingame } Panel = new UILiveMode(Game.LotControl); Panel.X = 177; Panel.Y = 61; DynamicOverlay.Add(Panel); LiveModeButton.Selected = true; SetFocus(UCPFocusMode.ActiveTab); break; default: if (Game.InLot) { Game.LotControl.PanelActive = false; } break; } CurrentPanel = newPanel; } else { Remove(PanelBlocker); PanelBlocker = null; CurrentPanel = -1; } GameFacade.Cursor.SetCursor(CursorType.Normal); }
public void SetInEOD(EODLiveModeOpt options, UIEOD eod) { Invalidate(); //i mean, duh bool eodPresent = (options != null); bool inEOD = eodPresent && !HideEOD; if (ActiveEOD != null) { DynamicOverlay.Remove(ActiveEOD); } LastEODConfig = options; ActiveEOD = eod; /** * Useful values */ bool isTall = inEOD && (options.Height == EODHeight.Tall || options.Height == EODHeight.TallTall); bool isDoubleTall = inEOD && options.Height == EODHeight.TallTall; bool isTrade = inEOD && options.Height == EODHeight.Trade; /** * Reset / hide standard and eod UI */ MoodPanelButton.Position = (eodPresent) ? EODLayout.Baseline + new Vector2(20, 7) : new Vector2(31, 63); EODButtonLayout.Visible = inEOD; EODSub.Visible = inEOD; EODMsgWin.Visible = inEOD && options.Tips != EODTextTips.None; EODHelpButton.Visible = inEOD; EODCloseButton.Visible = inEOD; EODExpandButton.Visible = inEOD && options.Expandable && !options.Expanded; EODContractButton.Visible = inEOD && options.Expandable && options.Expanded; EODExpandBack.Visible = inEOD && options.Expandable; EODButton.Visible = eodPresent; EODTopSub.Visible = inEOD && options.Expandable && options.Expanded; EODTopButtonLayout.Visible = inEOD && options.Expandable && options.Expanded; EODPanel.Visible = inEOD && !isTall && !isTrade; EODPanelTall.Visible = inEOD && isTall; EODDoublePanelTall.Visible = inEOD && isDoubleTall && options.Expanded; EODTimer.Visible = inEOD && options.Timer == EODs.EODTimer.Normal; MsgWinTextEntry.Visible = inEOD && options.Tips != EODTextTips.None; TimerTextEntry.Visible = inEOD && options.Timer != EODs.EODTimer.None; //Cleanup if (EODImage.Texture != null) { EODImage.Texture.Dispose(); } EODImage.Texture = null; //EOD Button EODButton.Selected = inEOD; EODButton.Position = EODLayout.EODButtonPosition; /** * Attach new EOD UI */ if (inEOD) { DynamicOverlay.Add(ActiveEOD); } /** * Position / style EOD specific UI */ if (eodPresent) { EODButtonLayout.Reset(); EODSub.Reset(); EODMsgWin.Reset(); var buttons = new string[] { "None", "One", "Two", "Three" }; // three doesn't work, but at least for now it won't be out of bounds array var buttonLayout = buttons[options.Buttons]; Script.ApplyControlProperties(EODButtonLayout, "EODButtonLayout" + buttonLayout + EODLayout.GetHeightSuffix(options.Height, true)); Script.ApplyControlProperties(EODSub, "EODSub" + options.Length + "Length" + EODLayout.GetHeightSuffix(options.Height, true)); if (options.Length == EODLength.None) { EODSub.Visible = false; } EODButtonLayout.Visible = EODSub.Visible; if (options.Tips != EODTextTips.None) { Script.ApplyControlProperties(EODMsgWin, "EODMsgWin" + options.Tips.ToString()); } var topLeft = EODLayout.GetTopLeft(options.Height); //EOD position ActiveEOD.Position = topLeft + (Vector2)Script.GetControlProperty(isTrade?"EODTradePosition":"EODPosition"); //Close button EODCloseButton.Position = EODLayout.GetChromePosition("EODCloseButton", options.Height); //Help button EODHelpButton.Position = EODLayout.HelpButtonPosition; if (isTrade && !Small800) { //place the close/help button at 1024x768 position EODCloseButton.X += 224; EODHelpButton.X += 224; } //Chrome var chromeOffset = EODLayout.GetChromeOffset(options.Height); EODButtonLayout.Position += chromeOffset; EODSub.Position += chromeOffset; //Message EODMsgWin.Position = EODLayout.GetMessageWindowPosition(options.Height, options.Tips, options.Expanded); EODMsgWin.BlockInput(); MsgWinTextEntry.Position = EODLayout.GetMessageWindowTextPosition(options.Height, options.Expanded); //Timer EODTimer.Position = EODLayout.GetTimerPosition(options.Height, options.Expanded); EODTimer.BlockInput(); EODTimer.Texture = GetTexture(0x0000011300000002); // regular .\uigraphics\ucp\livepanel\eod_timerback.tga, changed for TallTall below TimerTextEntry.Position = EODLayout.GetTimerTextPosition(options.Height, options.Expanded); //Expand / contract EODExpandButton.Position = EODLayout.GetExpandButtonPosition(options.Height); EODContractButton.Position = EODLayout.GetContractButtonPosition(options.Height); EODExpandBack.Position = EODLayout.GetExpandBackPosition(options.Height); //backgrounds EODPanel.Position = EODLayout.GetPanelPosition(EODHeight.Normal); EODPanel.BlockInput(); EODPanelTall.Position = EODLayout.GetPanelPosition(EODHeight.Tall); EODPanelTall.BlockInput(); EODDoublePanelTall.Position = EODLayout.GetPanelPosition(EODHeight.TallTall); EODDoublePanelTall.BlockInput(); if (isTrade) { Size = new Vector2(BackgroundEODTradeImg.Width, BackgroundEODTradeImg.Height); } else { Size = new Vector2(Background.Size.X, ((options.Height == EODHeight.TallTall && options.Expanded) ? (EODDoublePanelTall.Size.Y + (EODDoublePanelTall.Y - EODMsgWin.Y)) : EODPanelTall.Size.Y) - (int)EODMsgWin.Position.Y); } BackOffset = new Point(isTrade?22:0, -(int)EODMsgWin.Position.Y); //Double tall panel chrome if (options.Height == EODHeight.TallTall) { //BackOffset = new Point(0, -(int)EODDoublePanelTall.Y); EODTopSub.Reset(); EODTopButtonLayout.Reset(); var topButtonLayout = buttons[options.TopPanelButtons]; Script.ApplyControlProperties(EODTopButtonLayout, "EODButtonLayout" + topButtonLayout + EODLayout.GetHeightSuffix(EODHeight.Tall)); Script.ApplyControlProperties(EODTopSub, "EODSub" + options.Length + "Length" + EODLayout.GetHeightSuffix(EODHeight.Tall)); EODTopButtonLayout.Position -= new Vector2(0, 155); EODTopSub.Position -= new Vector2(0, 155); if (EODTimer.Visible == true && options.Expanded) // needs to be eod_timerback_straight.tga for TallTall { EODTimer.Texture = GetTexture(0x000001BF00000002); } } var ava = SelectedAvatar; if (ava != null) { var eodConnection = ava.Thread.EODConnection; if (eodConnection != null) { var entity = LotController.vm.GetObjectById(eodConnection.ObjectID); if (entity is VMGameObject) { var objects = entity.MultitileGroup.Objects; ObjectComponent[] objComps = new ObjectComponent[objects.Count]; for (int i = 0; i < objects.Count; i++) { objComps[i] = (ObjectComponent)objects[i].WorldUI; } var thumb = LotController.World.GetObjectThumb(objComps, entity.MultitileGroup.GetBasePositions(), GameFacade.GraphicsDevice); EODImage.Texture = thumb; } } } if (EODImage.Texture != null) { var imgScale = 22f / Math.Max(EODImage.Texture.Width, EODImage.Texture.Height); EODImage.SetSize(EODImage.Texture.Width * imgScale, EODImage.Texture.Height * imgScale); EODImage.Position = EODButton.Position + new Vector2((EODButton.Texture.Width / 4 - EODImage.Width) / 2, (EODButton.Texture.Height - EODImage.Height) / 2); } } else { BackOffset = new Point(0, 0); Size = new Vector2(DefaultBGImage.Width, EODPanelTall.Size.Y); } //this.Y = (inEOD && options.Height == EODHeight.Tall) ? 41: 61; Divider.Visible = !inEOD; MotiveDisplay.Visible = !inEOD; PersonGrid.Visible = !inEOD; MotivesLabel.Visible = !inEOD; PeopleListBg.Visible = !inEOD; PreviousPageButton.Visible = !inEOD; NextPageButton.Visible = !inEOD; Background.Visible = !inEOD || isTrade; PersonGrid.Columns = (eodPresent || Small800) ?4:9; PersonGrid.DrawPage(); PeopleListBg.Texture = (eodPresent && PeopleListEODBackgroundImg != null) ? PeopleListEODBackgroundImg : PeopleListBackgroundImg; PeopleListBg.SetSize(PeopleListBg.Texture.Width, PeopleListBg.Texture.Height); NextPageButton.Position = (eodPresent && !Small800) ? (Vector2)Script.GetControlProperty("NextPageEODButton") : DefaultNextPagePos; Background.Texture = (eodPresent) ? (isTrade? BackgroundEODTradeImg : BackgroundEODImg) : DefaultBGImage; Background.Position = (isTrade) ? new Vector2(-22, -79) : new Vector2(0, 35); Background.SetSize(Background.Texture.Width, Background.Texture.Height); var changeJobY = StatusBarMsgWinStraight.Y != (inEOD ? -18 : 2); var changeJobX = StatusBarMsgWinStraight.X != (eodPresent ? 159 : 383); if (Small800) { changeJobX = false; } if (changeJobX || changeJobY) { //there don't seem to be any UIScript cues for this. var offset = new Vector2(Small800 ? 0 : (800 - 1024), -20); if (!changeJobX) { offset.X = 0; } if (!changeJobY) { offset.Y = 0; } if (!inEOD) { offset.Y *= -1; } if (!eodPresent) { offset.X *= -1; } StatusBarMsgWinStraight.Position += offset; StatusBarMsgWinTextEntry.Position += offset; StatusBarTimerBreakIcon.Position += offset; StatusBarTimerWorkIcon.Position += offset; StatusBarTimerStraight.Position += offset; StatusBarTimerTextEntry.Position += offset; } UpdateThumbPosition(); Common.Utils.GameThread.NextUpdate(x => { Invalidate(); }); }
public void SetInEOD(EODLiveModeOpt options, UIEOD eod) { Invalidate(); //i mean, duh bool eodPresent = (options != null); bool inEOD = eodPresent && !HideEOD; if (ActiveEOD != null) { DynamicOverlay.Remove(ActiveEOD); } LastEODConfig = options; ActiveEOD = eod; /** * Useful values */ bool isTall = inEOD && (options.Height == EODHeight.Tall || options.Height == EODHeight.TallTall); bool isDoubleTall = inEOD && options.Height == EODHeight.TallTall; /** * Reset / hide standard and eod UI */ MoodPanelButton.Position = (eodPresent) ? EODLayout.Baseline + new Vector2(20, 7) : new Vector2(31, 63); EODButtonLayout.Visible = inEOD; EODSub.Visible = inEOD; EODMsgWin.Visible = inEOD && options.Tips != EODTextTips.None; EODHelpButton.Visible = inEOD; EODCloseButton.Visible = inEOD; EODExpandButton.Visible = inEOD && options.Expandable && !options.Expanded; EODContractButton.Visible = inEOD && options.Expandable && options.Expanded; EODExpandBack.Visible = inEOD && options.Expandable; EODButton.Visible = eodPresent; EODTopSub.Visible = inEOD && options.Expandable && options.Expanded; EODTopButtonLayout.Visible = inEOD && options.Expandable && options.Expanded; EODPanel.Visible = inEOD && !isTall; EODPanelTall.Visible = inEOD && isTall; EODDoublePanelTall.Visible = inEOD && isDoubleTall && options.Expanded; EODTimer.Visible = inEOD && options.Timer == EODs.EODTimer.Normal; MsgWinTextEntry.Visible = inEOD && options.Tips != EODTextTips.None; TimerTextEntry.Visible = inEOD && options.Timer != EODs.EODTimer.None; //Cleanup if (EODImage.Texture != null) { EODImage.Texture.Dispose(); } EODImage.Texture = null; //EOD Button EODButton.Selected = inEOD; EODButton.Position = EODLayout.EODButtonPosition; /** * Attach new EOD UI */ if (inEOD) { DynamicOverlay.Add(ActiveEOD); } /** * Position / style EOD specific UI */ if (eodPresent) { EODButtonLayout.Reset(); EODSub.Reset(); EODMsgWin.Reset(); var buttons = new string[] { "None", "One", "Two" }; var buttonLayout = buttons[options.Buttons]; Script.ApplyControlProperties(EODButtonLayout, "EODButtonLayout" + buttonLayout + EODLayout.GetHeightSuffix(options.Height, true)); Script.ApplyControlProperties(EODSub, "EODSub" + options.Length + "Length" + EODLayout.GetHeightSuffix(options.Height, true)); if (options.Tips != EODTextTips.None) { Script.ApplyControlProperties(EODMsgWin, "EODMsgWin" + options.Tips.ToString()); } var topLeft = EODLayout.GetTopLeft(options.Height); //EOD position ActiveEOD.Position = topLeft + (Vector2)Script.GetControlProperty("EODPosition"); //Close button EODCloseButton.Position = EODLayout.GetChromePosition("EODCloseButton", options.Height); //Help button EODHelpButton.Position = EODLayout.HelpButtonPosition; //Chrome var chromeOffset = EODLayout.GetChromeOffset(options.Height); EODButtonLayout.Position += chromeOffset; EODSub.Position += chromeOffset; //Message EODMsgWin.Position = EODLayout.GetMessageWindowPosition(options.Height, options.Tips, options.Expanded); MsgWinTextEntry.Position = EODLayout.GetMessageWindowTextPosition(options.Height, options.Expanded); //Timer EODTimer.Position = EODLayout.GetTimerPosition(options.Height); TimerTextEntry.Position = EODLayout.GetTimerTextPosition(options.Height); //Expand / contract EODExpandButton.Position = EODLayout.GetExpandButtonPosition(options.Height); EODContractButton.Position = EODLayout.GetContractButtonPosition(options.Height); EODExpandBack.Position = EODLayout.GetExpandBackPosition(options.Height); //backgrounds EODPanel.Position = EODLayout.GetPanelPosition(EODHeight.Normal); EODPanelTall.Position = EODLayout.GetPanelPosition(EODHeight.Tall); EODDoublePanelTall.Position = EODLayout.GetPanelPosition(EODHeight.TallTall); Size = new Vector2(Background.Size.X, ((options.Height == EODHeight.TallTall && options.Expanded)? (EODDoublePanelTall.Size.Y + (EODDoublePanelTall.Y - EODMsgWin.Y)) :EODPanelTall.Size.Y) - (int)EODMsgWin.Position.Y); BackOffset = new Point(0, -(int)EODMsgWin.Position.Y); //Double tall panel chrome if (options.Height == EODHeight.TallTall) { //BackOffset = new Point(0, -(int)EODDoublePanelTall.Y); EODTopSub.Reset(); EODTopButtonLayout.Reset(); var topButtonLayout = buttons[options.TopPanelButtons]; Script.ApplyControlProperties(EODTopButtonLayout, "EODButtonLayout" + topButtonLayout + EODLayout.GetHeightSuffix(EODHeight.Tall)); Script.ApplyControlProperties(EODTopSub, "EODSub" + options.Length + "Length" + EODLayout.GetHeightSuffix(EODHeight.Tall)); EODTopButtonLayout.Position -= new Vector2(0, 155); EODTopSub.Position -= new Vector2(0, 155); } var ava = SelectedAvatar; if (ava != null) { var eodConnection = ava.Thread.EODConnection; if (eodConnection != null) { var entity = LotController.vm.GetObjectById(eodConnection.ObjectID); if (entity is VMGameObject) { var objects = entity.MultitileGroup.Objects; ObjectComponent[] objComps = new ObjectComponent[objects.Count]; for (int i = 0; i < objects.Count; i++) { objComps[i] = (ObjectComponent)objects[i].WorldUI; } var thumb = LotController.World.GetObjectThumb(objComps, entity.MultitileGroup.GetBasePositions(), GameFacade.GraphicsDevice); EODImage.Texture = thumb; } } } if (EODImage.Texture != null) { var imgScale = 22f / Math.Max(EODImage.Texture.Width, EODImage.Texture.Height); EODImage.SetSize(EODImage.Texture.Width * imgScale, EODImage.Texture.Height * imgScale); EODImage.Position = EODButton.Position + new Vector2((EODButton.Texture.Width / 4 - EODImage.Width) / 2, (EODButton.Texture.Height - EODImage.Height) / 2); } } else { Size = new Vector2(DefaultBGImage.Width, EODPanelTall.Size.Y); } //this.Y = (inEOD && options.Height == EODHeight.Tall) ? 41: 61; Divider.Visible = !inEOD; MotiveDisplay.Visible = !inEOD; PersonGrid.Visible = !inEOD; MotivesLabel.Visible = !inEOD; PeopleListBg.Visible = !inEOD; PreviousPageButton.Visible = !inEOD; NextPageButton.Visible = !inEOD; Background.Visible = !inEOD; PersonGrid.Columns = (eodPresent || Small800) ?4:9; PersonGrid.DrawPage(); PeopleListBg.Texture = (eodPresent && PeopleListEODBackgroundImg != null) ? PeopleListEODBackgroundImg : PeopleListBackgroundImg; PeopleListBg.SetSize(PeopleListBg.Texture.Width, PeopleListBg.Texture.Height); NextPageButton.Position = (eodPresent && !Small800) ? (Vector2)Script.GetControlProperty("NextPageEODButton") : DefaultNextPagePos; Background.Texture = (eodPresent) ? BackgroundEODImg : DefaultBGImage; Background.SetSize(Background.Texture.Width, Background.Texture.Height); UpdateThumbPosition(); Common.Utils.GameThread.NextUpdate(x => { Invalidate(); }); }
public override void Update(UpdateState state) { base.Update(state); if (Opacity < 1) { if (DynamicOverlay.GetChildren().Count > 0) { DynamicOverlay.Remove(PerformanceBar); Add(PerformanceBar); } } else { if (DynamicOverlay.GetChildren().Count == 0) { Remove(PerformanceBar); DynamicOverlay.Add(PerformanceBar); } } var sel = Game.SelectedAvatar; if (sel == null) { return; } var type = sel.GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.JobType); var level = sel.GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.JobPromotionLevel); var performance = sel.GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.JobPerformance); var job = Content.Get().Jobs.GetJob((ushort)type); if (job == null) { if (LastPerformance != -200) { JobTitle.Caption = "Unemployed"; SalaryTitle.Caption = ""; PerformanceBar.Visible = false; PerformanceTitle.Visible = false; LastJobLevel = null; LastPerformance = -200; } } else { var myLevel = job.JobLevels[level]; if (myLevel != LastJobLevel) { JobTitle.Caption = myLevel.JobName; SalaryTitle.Caption = "Salary: §" + myLevel.Salary + " (" + ToTime(myLevel.StartTime) + "-" + ToTime(myLevel.EndTime) + ")"; LastJobLevel = myLevel; } if (LastPerformance != performance) { PerformanceBar.Visible = true; PerformanceTitle.Visible = true; PerformanceBar.MotiveValue = performance; LastPerformance = performance; } for (int i = 0; i < 6; i++) { Skills[i].Needed = myLevel.MinRequired[i + 1] / 100; } } for (int i = 0; i < 6; i++) { Skills[i].Value = sel.GetPersonData(SkillInd[i]) / 100; } }