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(); }); }