public void setHover(IB2Panel parentPanel, int x, int y) { //int Width = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Width; //int Height = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Height; float xMod = (gv.screenWidth / 1920f); float yMod = (gv.screenHeight / 1080f); float adustXForArrows = 0f; if (this.tag != "btnToggleArrows") { xMod = gv.screenDensity; yMod = gv.screenDensity; adustXForArrows = 0; } if (this.tag == "ctrlUpArrow" || this.tag == "ctrlDownArrow" || this.tag == "ctrlLeftArrow" || this.tag == "ctrlRightArrow" || this.tag == "btnWait") { xMod = (gv.screenWidth / 1920f); } if (show) { glowOn = false; if (this.tag == "ctrlUpArrow" || this.tag == "ctrlDownArrow" || this.tag == "ctrlLeftArrow" || this.tag == "ctrlRightArrow" || this.tag == "btnWait") { if ((x >= (int)((X + adustXForArrows) * gv.screenDensity + parentPanel.currentLocX * xMod)) && (x <= (int)((X + adustXForArrows + Width) * gv.screenDensity + parentPanel.currentLocX * xMod))) { if ((y >= (int)((parentPanel.currentLocY + Y + gv.oYshift) * yMod)) && (y <= (int)((parentPanel.currentLocY + Y + gv.oYshift + Height) * yMod))) { if (!playedHoverSound) { playedHoverSound = true; gv.playerButtonEnter.Play(); } glowOn = true; } } } else { if ((x >= (int)((parentPanel.currentLocX + X + adustXForArrows) * xMod)) && (x <= (int)((parentPanel.currentLocX + X + Width + adustXForArrows) * xMod))) { if ((y >= (int)((parentPanel.currentLocY + Y + gv.oYshift) * yMod)) && (y <= (int)((parentPanel.currentLocY + Y + gv.oYshift + Height) * yMod))) { if (!playedHoverSound) { playedHoverSound = true; gv.playerButtonEnter.Play(); } glowOn = true; } } } playedHoverSound = false; } }
public bool getImpact(IB2Panel parentPanel, int x, int y) { //int Width = gv.cc.GetFromBitmapList(ImgOnFilename).PixelSize.Width; //int Height = gv.cc.GetFromBitmapList(ImgOnFilename).PixelSize.Height; if (show) { if ((x >= (int)((parentPanel.currentLocX + X) * gv.screenDensity)) && (x <= (int)((parentPanel.currentLocX + X + Width) * gv.screenDensity))) { if ((y >= (int)((parentPanel.currentLocY + Y + gv.oYshift) * gv.screenDensity)) && (y <= (int)((parentPanel.currentLocY + Y + gv.oYshift + Height) * gv.screenDensity))) { return(true); } } } return(false); }
public void Draw(IB2Panel parentPanel) { if (show) { IbRect src = new IbRect(0, 0, gv.cc.GetFromBitmapList(ImgOnFilename).PixelSize.Width, gv.cc.GetFromBitmapList(ImgOnFilename).PixelSize.Height); IbRect dst = new IbRect(0, 0, 0, 0); if (gv.mod.useMinimalisticUI) { dst = new IbRect((int)((parentPanel.currentLocX + this.X - 2 * gv.pS) * gv.screenDensity + gv.pS), (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + gv.pS), (int)((float)Width * gv.screenDensity) - 2 * gv.pS, (int)((float)Height * gv.screenDensity) - 2 * gv.pS); } else { dst = new IbRect((int)((parentPanel.currentLocX + this.X) * gv.screenDensity), (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity), (int)((float)Width * gv.screenDensity), (int)((float)Height * gv.screenDensity)); } if (toggleOn) { if (gv.mod.useMinimalisticUI) { IbRect src2 = new IbRect(0, 0, 100, 100); IbRect dst2 = new IbRect((int)((parentPanel.currentLocX + this.X - 2 * gv.pS) * gv.screenDensity), (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity), (int)((float)Width * gv.screenDensity), (int)((float)Height * gv.screenDensity)); gv.DrawBitmap(gv.cc.GetFromBitmapList("tgl_bg"), src2, dst2, -0.01f, false, 0.75f, true); } gv.DrawBitmap(gv.cc.GetFromBitmapList(ImgOnFilename), src, dst, -0.01f, false, 1f, true); } else { if (gv.mod.useMinimalisticUI) { IbRect src2 = new IbRect(0, 0, 100, 100); IbRect dst2 = new IbRect((int)((parentPanel.currentLocX + this.X - 2 * gv.pS) * gv.screenDensity), (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity), (int)((float)Width * gv.screenDensity), (int)((float)Height * gv.screenDensity)); gv.DrawBitmap(gv.cc.GetFromBitmapList("tgl_bg"), src2, dst2, -0.01f, false, 0.75f, true); } gv.DrawBitmap(gv.cc.GetFromBitmapList(ImgOffFilename), src, dst, -0.01f, false, 1f, true); } } }
public void onDrawLogBox(IB2Panel parentPanel) { //ratio of #lines to #pixels float ratio = (float)(logLinesList.Count) / (float)(tbHeight * gv.screenDensity); if (ratio < 1.0f) { ratio = 1.0f; } if (moveDeltaY != 0) { int lineMove = (startY + moveDeltaY) * (int)ratio; SetCurrentTopLineAbsoluteIndex(lineMove); } //only draw lines needed to fill textbox float xLoc = 0.0f; float yLoc = 3.0f; int maxLines = 0; if (gv.screenType.Equals("combat") && (gv.mod.useMinimalisticUI)) { numberOfLinesToShow = 20; } if (gv.screenType.Equals("combat") && (gv.screenCombat.showIniBar) && (!gv.mod.useMinimalisticUI)) { numberOfLinesToShow = 22; } if (gv.screenType.Equals("combat") && (!gv.screenCombat.showIniBar) && (!gv.mod.useMinimalisticUI)) { numberOfLinesToShow = 26; } if (!gv.screenType.Equals("combat")) { numberOfLinesToShow = 22; } maxLines = currentTopLineIndex + numberOfLinesToShow; if (maxLines > logLinesList.Count) { maxLines = logLinesList.Count; } for (int i = currentTopLineIndex; i < maxLines; i++) { //loop through each line and print each word foreach (FormattedWord word in logLinesList[i].wordsList) { if (gv.textFormat != null) { gv.textFormat.Dispose(); gv.textFormat = null; } if (gv.textLayout != null) { gv.textLayout.Dispose(); gv.textLayout = null; } gv.textFormat = new SharpDX.DirectWrite.TextFormat(gv.factoryDWrite, gv.family.Name, gv.CurrentFontCollection, word.fontWeight, word.fontStyle, FontStretch.Normal, word.fontSize) { TextAlignment = TextAlignment.Leading, ParagraphAlignment = ParagraphAlignment.Near }; gv.textLayout = new SharpDX.DirectWrite.TextLayout(gv.factoryDWrite, word.text + " ", gv.textFormat, gv.Width, gv.Height); int difYheight = logLinesList[i].lineHeight - (int)word.fontSize; if (word.underlined) { gv.textLayout.SetUnderline(true, new TextRange(0, word.text.Length - 1)); } int xLoc2 = (int)((parentPanel.currentLocX * gv.screenDensity + xLoc)); int yLoc2 = (int)((parentPanel.currentLocY * gv.screenDensity + yLoc + difYheight)); int logOpac = (int)(255f * gv.mod.logOpacity); word.color.A = (byte)(logOpac); int yPositionModifier = 0; if (gv.mod.useComplexCoordinateSystem && !gv.screenType.Equals("combat")) { yPositionModifier = gv.squareSize - gv.pS; } if (gv.screenType.Equals("combat") && (!gv.mod.useMinimalisticUI) && (gv.screenCombat.showIniBar)) { yPositionModifier = gv.squareSize + 4 * gv.pS; } DrawString(word.text + " ", xLoc2, yLoc2 + yPositionModifier, word.fontWeight, word.fontStyle, word.color, word.fontSize, word.underlined); xLoc += gv.textLayout.Metrics.WidthIncludingTrailingWhitespace; } xLoc = 0; yLoc += logLinesList[i].lineHeight; } //draw border for debug info //gv.DrawRectangle(new IbRect(parentPanel.currentLocX + tbXloc, parentPanel.currentLocY + tbYloc, tbWidth, tbHeight), SharpDX.Color.DimGray, 1); }
public void Update(int elapsed, IB2Panel parentPanel) { //animate button? }
public void Draw(IB2Panel parentPanel) { if (!gv.mod.currentArea.isOverviewMap) { if (gv.mod.currentArea.overviewOwnZoneMapExists && gv.mod.currentArea.showOverviewButtonOwnZoneMap && this.tag == "btnOwnZoneMap") { this.show = true; } else if (this.tag == "btnOwnZoneMap") { this.show = false; } if (gv.mod.currentArea.overviewMotherZoneMapExists && gv.mod.currentArea.showOverviewButtonMotherZoneMap && this.tag == "btnMotherZoneMap") { this.show = true; } else if (this.tag == "btnMotherZoneMap") { this.show = false; } if (gv.mod.currentArea.overviewGrandMotherZoneMapExists && gv.mod.currentArea.showOverviewButtonGrandMotherZoneMap && this.tag == "btnGrandMotherZoneMap") { this.show = true; } else if (this.tag == "btnGrandMotherZoneMap") { this.show = false; } } else { foreach (Area a in gv.mod.moduleAreasObjects) { if (a.filenameOfGrandMotherZoneMap == gv.mod.overviewReturnAreaName) { if (a.overviewOwnZoneMapExists && a.showOverviewButtonOwnZoneMap && this.tag == "btnOwnZoneMap") { this.show = true; } else if (this.tag == "btnOwnZoneMap") { this.show = false; } if (a.overviewMotherZoneMapExists && a.showOverviewButtonMotherZoneMap && this.tag == "btnMotherZoneMap") { this.show = true; } else if (this.tag == "btnMotherZoneMap") { this.show = false; } if (a.overviewGrandMotherZoneMapExists && a.showOverviewButtonGrandMotherZoneMap && this.tag == "btnGrandMotherZoneMap") { this.show = true; } else if (this.tag == "btnGrandMotherZoneMap") { this.show = false; } } } } if (gv.mod.currentArea.isOverviewMap && (this.tag == "btnRation" || this.tag == "btnTorch" || this.tag == "btnZoom")) { this.show = false; } else if (this.tag == "btnRation" || this.tag == "btnTorch" || this.tag == "btnZoom") { this.show = true; } if (!gv.mod.useComplexCoordinateSystem && (this.tag == "btnZoom" || this.tag == "btnTorch" || this.tag == "btnRation")) { this.show = false; } if (!gv.mod.useRationSystem && this.tag == "btnRation") { this.show = false; } if (!gv.mod.useLightSystem && this.tag == "btnTorch") { this.show = false; } /* * if (gv.mod.currentArea.isOverviewMap && (this.tag == "btnRation" || this.tag == "btnTorch"|| this.tag == "btnZoom")) * { * this.show = false; * } * else if (this.tag == "btnRation" || this.tag == "btnTorch" || this.tag == "btnZoom") * { * this.show = true; * } */ string timeOfDay = "none"; //iddo if (this.tag == "btnZoom") { //int timeofday = gv.mod.WorldTime % (24 * 60); //int hour = timeofday / 60; //int minute = timeofday % 60; //string sMinute = minute + ""; //if (minute < 10) //{ //sMinute = "0" + minute; //} int dawn = 5 * 60; int sunrise = 6 * 60; int day = 7 * 60; int sunset = 17 * 60; int dusk = 18 * 60; int night = 20 * 60; int time = gv.mod.WorldTime % 1440; //bool consumeLightEnergy = false; if ((time >= dawn) && (time < sunrise)) { timeOfDay = "dawnButton"; //gv.DrawBitmap(gv.cc.tint_dawn, src, dst, 0, false, 1.0f / flickerReduction * flicker / 100f); //gv.DrawBitmap(gv.cc.tint_dawn, src, dst, 0, false, 1.0f); } else if ((time >= sunrise) && (time < day)) { timeOfDay = "sunriseButton"; //gv.DrawBitmap(gv.cc.tint_sunrise, src, dst, 0, false, 1.0f); } else if ((time >= day) && (time < sunset)) { timeOfDay = "dayButton"; //no tint for day } else if ((time >= sunset) && (time < dusk)) { timeOfDay = "sunsetButton"; //gv.DrawBitmap(gv.cc.tint_sunset, src, dst, 0, false, 1.0f); } else if ((time >= dusk) && (time < night)) { timeOfDay = "duskButton"; //gv.DrawBitmap(gv.cc.tint_dusk, src, dst, 0, false, 1.0f); } else if ((time >= night) || (time < dawn)) { timeOfDay = "nightButton"; //berlin //consumeLightEnergy = true; } this.ImgFilename = timeOfDay; ImgFilename = timeOfDay; ImgOnFilename = timeOfDay; Img2Filename = timeOfDay; Img2OffFilename = timeOfDay; Img3Filename = timeOfDay; ImgOffFilename = timeOfDay; } if (show) { float xMod = (gv.screenWidth / 1920f); float yMod = (gv.screenHeight / 1080f); float adustXForArrows = 0f; if (this.tag != "btnToggleArrows") { xMod = gv.screenDensity; yMod = gv.screenDensity; adustXForArrows = 0; } if (this.tag == "ctrlUpArrow" || this.tag == "ctrlDownArrow" || this.tag == "ctrlLeftArrow" || this.tag == "ctrlRightArrow" || this.tag == "btnWait") { xMod = (gv.screenWidth / 1920f); } int pH = (int)((float)gv.screenHeight / 200.0f); int pW = (int)((float)gv.screenHeight / 200.0f); float fSize = (float)(gv.squareSize / 4) * scaler; //int Width = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Width; //int Height = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Height; IbRect src = new IbRect(0, 0, Width, Height); //IbRect dst = new IbRect((int)((parentPanel.currentLocX + this.X) * gv.screenDensity), (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity), (int)((float)Width * gv.screenDensity), (int)((float)Height * gv.screenDensity)); IbRect dst = new IbRect((int)((parentPanel.currentLocX + this.X + adustXForArrows) * xMod), (int)((parentPanel.currentLocY + this.Y) * yMod), (int)((float)Width * gv.screenDensity), (int)((float)Height * gv.screenDensity)); if (this.tag == "ctrlUpArrow" || this.tag == "ctrlDownArrow" || this.tag == "ctrlLeftArrow" || this.tag == "ctrlRightArrow" || this.tag == "btnWait") { dst = new IbRect((int)((this.X + adustXForArrows) * gv.screenDensity + (parentPanel.currentLocX * xMod)), (int)((parentPanel.currentLocY + this.Y) * yMod), (int)((float)Width * gv.screenDensity), (int)((float)Height * gv.screenDensity)); } IbRect srcGlow = new IbRect(0, 0, Width, Height); IbRect dstGlow = new IbRect((int)((parentPanel.currentLocX + this.X + adustXForArrows) * xMod) - (int)(7 * xMod), (int)((parentPanel.currentLocY + this.Y) * yMod) - (int)(7 * yMod), (int)((float)Width * gv.screenDensity) + (int)(15 * gv.screenDensity), (int)((float)Height * gv.screenDensity) + (int)(15 * gv.screenDensity)); if (this.tag == "ctrlUpArrow" || this.tag == "ctrlDownArrow" || this.tag == "ctrlLeftArrow" || this.tag == "ctrlRightArrow" || this.tag == "btnWait") { dstGlow = new IbRect((int)((this.X + adustXForArrows) * gv.screenDensity + parentPanel.currentLocX * xMod) - (int)(7 * xMod), (int)((parentPanel.currentLocY + this.Y) * yMod) - (int)(7 * yMod), (int)((float)Width * gv.screenDensity) + (int)(15 * gv.screenDensity), (int)((float)Height * gv.screenDensity) + (int)(15 * gv.screenDensity)); } //draw glow first if on if (glowOn) { gv.DrawBitmap(gv.cc.GetFromBitmapList(GlowFilename), srcGlow, dstGlow, -0.01f, false, 1.0f, true); // gv.DrawBitmap(gv.cc.GetFromBitmapList("tgl_bg"), src2, dst2, -0.01f, false, 0.75f, true); } //draw the proper button State if (btnState == buttonState.On) { gv.DrawBitmap(gv.cc.GetFromBitmapList(ImgOnFilename), src, dst, -0.01f, false, 1.0f, true); } else if (btnState == buttonState.Off) { gv.DrawBitmap(gv.cc.GetFromBitmapList(ImgOffFilename), src, dst, -0.01f, false, 1.0f, true); } else { gv.DrawBitmap(gv.cc.GetFromBitmapList(ImgFilename), src, dst, -0.01f, false, 1.0f, true); } //draw the standard overlay image if has one if ((btnState == buttonState.Off) && (!Img2OffFilename.Equals(""))) { gv.DrawBitmap(gv.cc.GetFromBitmapList(Img2OffFilename), src, dst, -0.01f, false, 1.0f, true); } else if (!Img2Filename.Equals("")) { gv.DrawBitmap(gv.cc.GetFromBitmapList(Img2Filename), src, dst, -0.01f, false, 1.0f, true); } //draw the notification image if turned on (like a level up or additional convo nodes image) if ((btnNotificationOn) && (!Img3Filename.Equals(""))) { gv.DrawBitmap(gv.cc.GetFromBitmapList(Img3Filename), src, dst, -0.01f, false, 1.0f, true); } float thisFontHeight = gv.drawFontRegHeight; if (scaler > 1.05f) { thisFontHeight = gv.drawFontLargeHeight; } else if (scaler < 0.95f) { thisFontHeight = gv.drawFontSmallHeight; } // DRAW TEXT float stringSize = gv.cc.MeasureString(Text, SharpDX.DirectWrite.FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, thisFontHeight); //place in the center float ulX = ((Width * xMod) - stringSize) / 2; if (this.tag == "btnWait") { ulX = ((Width * gv.screenDensity) - stringSize) / 2; } float ulY = ((Height * yMod) - thisFontHeight) / 2; if (scaler == 0.4f) { ulY = ((Height * gv.screenDensity)); } if (this.tag == "btnZoom") { int timeofday = gv.mod.WorldTime % (24 * 60); int hour = timeofday / 60; int minute = timeofday % 60; string sMinute = minute + ""; if (minute < 10) { sMinute = "0" + minute; } int txtH = (int)gv.drawFontRegHeight; //Text = hour + ":" + sMinute; Text = ""; } if (this.tag == "btnTorch") { int numberOfLightSources = 0; foreach (ItemRefs ir in gv.mod.partyInventoryRefsList) { if (ir.isLightSource) { numberOfLightSources += ir.quantity; } } Text = numberOfLightSources.ToString(); } int xLoc1 = (int)((parentPanel.currentLocX + this.X) * xMod + ulX); if (this.tag == "btnWait") { xLoc1 = (int)((this.X) * gv.screenDensity + parentPanel.currentLocX * xMod + ulX); } int yLoc1 = (int)((parentPanel.currentLocY + this.Y) * yMod + ulY); if (Text.Contains("green") && Text.Contains("Ld")) { int length = Text.Length; string text2 = ""; //Ld 13green:10 //ld 7green:9 if (length == 10) { text2 = Text.Remove(5); } if (length == 9) { text2 = Text.Remove(4); } // DRAW TEXT stringSize = gv.cc.MeasureString(text2, SharpDX.DirectWrite.FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, thisFontHeight); //place in the center ulX = ((Width * xMod) - stringSize) / 2; ulY = ((Height * yMod) - thisFontHeight) / 2; if (scaler == 0.4f) { ulY = ((Height * gv.screenDensity)); } xLoc1 = (int)((parentPanel.currentLocX + this.X) * xMod + ulX); yLoc1 = (int)((parentPanel.currentLocY + this.Y) * yMod + ulY); gv.DrawTextOutlined(text2, xLoc1, yLoc1, scaler, Color.Lime); } else { gv.DrawTextOutlined(Text, xLoc1, yLoc1, scaler, Color.White); } // DRAW QUANTITY stringSize = gv.cc.MeasureString(Quantity, SharpDX.DirectWrite.FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, thisFontHeight); //place in the bottom right quadrant ulX = (((Width * xMod) - stringSize) / 8) * 7; ulY = (((Height * yMod) - thisFontHeight) / 8) * 7; if (this.tag == "btnZoom") { //Quantity = gv.mod.timePerStepAfterSpeedCalc + " min"; int timeofday = gv.mod.WorldTime % (24 * 60); int hour = timeofday / 60; int minute = timeofday % 60; string sMinute = minute + ""; if (minute < 10) { sMinute = "0" + minute; } int txtH = (int)gv.drawFontRegHeight; //Text = hour + ":" + sMinute; Quantity = hour + ":" + sMinute + " "; } if (this.tag == "btnTorch") { Quantity = gv.mod.currentLightUnitsLeft.ToString(); } if (this.tag == "btnRation") { Quantity = gv.mod.numberOfRationsRemaining.ToString(); } /* * for (int x = -1; x <= 1; x++) * { * for (int y = -1; y <= 1; y++) * { * if (x != 0 || y != 0) * { * int xLoc = (int)((parentPanel.currentLocX + this.X) * gv.screenDensity + ulX + x); * int yLoc = 0; * if (this.tag == "btnZoom") * { * xLoc = (int)((parentPanel.currentLocX + this.X) * gv.screenDensity + ulX + x - 3 * pW); * yLoc = (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + ulY + y) - pW; * } * else * { * yLoc = (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + ulY + y); * } * //int yLoc = (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + ulY + y); * gv.DrawText(Quantity, xLoc, yLoc, scaler, Color.Black); * } * } * } */ int xLoc2 = (int)((parentPanel.currentLocX + this.X) * xMod + ulX); int yLoc2 = 0; if (this.tag == "btnZoom") { xLoc2 = (int)((parentPanel.currentLocX + this.X) * xMod + ulX - 3 * pW); yLoc2 = (int)((parentPanel.currentLocY + this.Y) * yMod + ulY) - pW; } else { yLoc2 = (int)((parentPanel.currentLocY + this.Y) * yMod + ulY); } //int yLoc2 = (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + ulY); if (this.tag == "btnTorch" && gv.mod.partyLightOn) { int dawn = 5 * 60; int sunrise = 6 * 60; int day = 7 * 60; int sunset = 17 * 60; int dusk = 18 * 60; int night = 20 * 60; int time = gv.mod.WorldTime % 1440; bool consumeLightEnergy = false; if ((time >= dawn) && (time < sunrise)) { //gv.DrawBitmap(gv.cc.tint_dawn, src, dst, 0, false, 1.0f / flickerReduction * flicker / 100f); //gv.DrawBitmap(gv.cc.tint_dawn, src, dst, 0, false, 1.0f); } else if ((time >= sunrise) && (time < day)) { //gv.DrawBitmap(gv.cc.tint_sunrise, src, dst, 0, false, 1.0f); } else if ((time >= day) && (time < sunset)) { //no tint for day } else if ((time >= sunset) && (time < dusk)) { //gv.DrawBitmap(gv.cc.tint_sunset, src, dst, 0, false, 1.0f); } else if ((time >= dusk) && (time < night)) { //gv.DrawBitmap(gv.cc.tint_dusk, src, dst, 0, false, 1.0f); } else if ((time >= night) || (time < dawn)) { //berlin consumeLightEnergy = true; } if (!gv.mod.currentArea.UseDayNightCycle) { consumeLightEnergy = true; } if (!gv.mod.currentArea.useLightSystem) { consumeLightEnergy = false; } if (gv.mod.currentArea.useSimpleDarkness) { consumeLightEnergy = true; } if (consumeLightEnergy) { gv.DrawTextOutlined(Quantity, xLoc2, yLoc2, scaler, Color.Yellow); } else { gv.DrawTextOutlined(Quantity, xLoc2, yLoc2, scaler, Color.White); } } else { gv.DrawTextOutlined(Quantity, xLoc2, yLoc2, scaler, Color.White); } // DRAW HOTKEY if (gv.showHotKeys) { stringSize = gv.cc.MeasureString(HotKey, SharpDX.DirectWrite.FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, thisFontHeight); //place in the bottom center ulX = ((Width * xMod) - stringSize) / 2; ulY = (((Height * yMod) - thisFontHeight) / 4) * 3; /* * for (int x = -1; x <= 1; x++) * { * for (int y = -1; y <= 1; y++) * { * if (x != 0 || y != 0) * { * int xLoc = (int)((parentPanel.currentLocX + this.X) * gv.screenDensity + ulX + x); * int yLoc = (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + ulY + y); * gv.DrawText(HotKey, xLoc, yLoc, scaler, Color.Black); * } * } * } */ int xLoc3 = (int)((parentPanel.currentLocX + this.X) * xMod + ulX); int yLoc3 = (int)((parentPanel.currentLocY + this.Y) * yMod + ulY); gv.DrawTextOutlined(HotKey, xLoc3, yLoc3, scaler, Color.Red); } } }
public bool getImpact(IB2Panel parentPanel, int x, int y) { //int Width = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Width; //int Height = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Height; float xMod = (gv.screenWidth / 1920f); float yMod = (gv.screenHeight / 1080f); float adustXForArrows = 0f; if (this.tag != "btnToggleArrows") { xMod = gv.screenDensity; yMod = gv.screenDensity; adustXForArrows = 0; } if (this.tag == "ctrlUpArrow" || this.tag == "ctrlDownArrow" || this.tag == "ctrlLeftArrow" || this.tag == "ctrlRightArrow" || this.tag == "btnWait") { xMod = (gv.screenWidth / 1920f); } /* * if (this.tag == "ctrlUpArrow" || this.tag == "ctrlDownArrow" || this.tag == "ctrlLeftArrow" || this.tag == "ctrlRightArrow" || this.tag == "btnWait") * { * dst = new IbRect((int)((this.X + adustXForArrows) * gv.screenDensity + (parentPanel.currentLocX * xMod)), (int)((parentPanel.currentLocY + this.Y) * yMod), (int)((float)Width * gv.screenDensity), (int)((float)Height * gv.screenDensity)); * } */ if (show) { if (this.tag == "ctrlUpArrow" || this.tag == "ctrlDownArrow" || this.tag == "ctrlLeftArrow" || this.tag == "ctrlRightArrow" || this.tag == "btnWait") { if ((x >= (int)((X + adustXForArrows) * gv.screenDensity + parentPanel.currentLocX * xMod)) && (x <= (int)((X + adustXForArrows + Width) * gv.screenDensity + parentPanel.currentLocX * xMod))) { if ((y >= (int)((parentPanel.currentLocY + Y + gv.oYshift) * yMod)) && (y <= (int)((parentPanel.currentLocY + Y + gv.oYshift + Height) * yMod))) { if (!playedHoverSound) { playedHoverSound = true; gv.playerButtonEnter.Play(); } return(true); } } } else { if ((x >= (int)((parentPanel.currentLocX + X + adustXForArrows) * xMod)) && (x <= (int)((parentPanel.currentLocX + X + Width + adustXForArrows) * xMod))) { if ((y >= (int)((parentPanel.currentLocY + Y + gv.oYshift) * yMod)) && (y <= (int)((parentPanel.currentLocY + Y + gv.oYshift + Height) * yMod))) { if (!playedHoverSound) { playedHoverSound = true; gv.playerButtonEnter.Play(); } return(true); } } } playedHoverSound = false; } return(false); }
public void setHover(IB2Panel parentPanel, int x, int y) { //int Width = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Width; //int Height = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Height; float xMod = (gv.screenWidth / 1920f); float yMod = (gv.screenHeight / 1080f); int spacing = 0; if (gv.screenType == "main") { if (this.tag == "port0") { spacing = (int)(7f * yMod); } if (this.tag == "port1") { spacing = (int)(14f * yMod); } if (this.tag == "port2") { spacing = (int)(21f * yMod); } if (this.tag == "port3") { spacing = (int)(28f * yMod); } if (this.tag == "port4") { spacing = (int)(35f * yMod); } if (this.tag == "port5") { spacing = (int)(42f * yMod); } } else if (gv.screenType == "combat") { if (this.tag == "port0") { spacing = (int)(-28f * yMod); } if (this.tag == "port1") { spacing = (int)(-21f * yMod); } if (this.tag == "port2") { spacing = (int)(-14f * yMod); } if (this.tag == "port3") { spacing = (int)(-7f * yMod); } if (this.tag == "port4") { spacing = (int)(0f * yMod); } if (this.tag == "port5") { spacing = (int)(7f * yMod); } } if (gv.screenType == "main") { if (parentPanel.Height <= (6 * this.Height + 42f * yMod)) { spacing = 0; } } if (gv.screenType == "combat") { if (parentPanel.Height <= (6 * this.Height + 7f * yMod)) { spacing = 0; } } if (show) { glowOn = false; if ((x >= (int)((parentPanel.currentLocX + X) * xMod)) && (x <= (int)((parentPanel.currentLocX + X + Width) * xMod))) { if ((y >= (int)((parentPanel.currentLocY + Y + gv.oYshift) * yMod) + spacing) && (y <= (int)((parentPanel.currentLocY + Y + gv.oYshift + Height) * yMod) + spacing)) { if (!playedHoverSound) { playedHoverSound = true; gv.playerButtonEnter.Play(); } glowOn = true; } } playedHoverSound = false; } }
public void Draw(IB2Panel parentPanel) { if (show) { float thisFontHeight = gv.drawFontRegHeight; if (scaler > 1.05f) { thisFontHeight = gv.drawFontLargeHeight; } else if (scaler < 0.95f) { thisFontHeight = gv.drawFontSmallHeight; } int numberOfLinesOnPortrait = (int)((Height * gv.screenDensity) / thisFontHeight); int pixPerLine = (int)((Height * gv.screenDensity) / numberOfLinesOnPortrait); float xMod = (gv.screenWidth / 1920f); float yMod = (gv.screenHeight / 1080f); int spacing = 0; if (gv.screenType == "main") { if (this.tag == "port0") { spacing = (int)(7f * yMod); } if (this.tag == "port1") { spacing = (int)(14f * yMod); } if (this.tag == "port2") { spacing = (int)(21f * yMod); } if (this.tag == "port3") { spacing = (int)(28f * yMod); } if (this.tag == "port4") { spacing = (int)(35f * yMod); } if (this.tag == "port5") { spacing = (int)(42f * yMod); } } else if (gv.screenType == "combat") { if (this.tag == "port0") { spacing = (int)(-28f * yMod); } if (this.tag == "port1") { spacing = (int)(-21f * yMod); } if (this.tag == "port2") { spacing = (int)(-14f * yMod); } if (this.tag == "port3") { spacing = (int)(-7f * yMod); } if (this.tag == "port4") { spacing = (int)(0f * yMod); } if (this.tag == "port5") { spacing = (int)(7f * yMod); } } if (gv.screenType == "main") { if (parentPanel.Height <= (6 * this.Height + 42f * yMod)) { spacing = 0; } } if (gv.screenType == "combat") { if (parentPanel.Height <= (6 * this.Height + 7f * yMod)) { spacing = 0; } } //this.tag int pH = (int)((float)gv.screenHeight / 200.0f); int pW = (int)((float)gv.screenHeight / 200.0f); float fSize = (float)(gv.squareSize / 4) * scaler; //int Width = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Width; //int Height = gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Height; IbRect src = new IbRect(0, 0, gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Width, gv.cc.GetFromBitmapList(ImgFilename).PixelSize.Height); IbRect srcBG = new IbRect(0, 0, gv.cc.GetFromBitmapList(ImgBGFilename).PixelSize.Width, gv.cc.GetFromBitmapList(ImgBGFilename).PixelSize.Height); //IbRect dst = new IbRect((int)((parentPanel.currentLocX + this.X) * gv.screenDensity), (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity), (int)((float)Width * gv.screenDensity), (int)((float)Height * gv.screenDensity)); IbRect dst = new IbRect((int)((parentPanel.currentLocX + this.X) * xMod), (int)((parentPanel.currentLocY + this.Y) * yMod + spacing), (int)((float)Width * gv.screenDensity), (int)((float)Height * gv.screenDensity)); IbRect dstBG = new IbRect((int)((parentPanel.currentLocX + this.X) * xMod) - (int)(3 * xMod), (int)((parentPanel.currentLocY + this.Y) * yMod) - (int)(3 * yMod) + spacing, (int)((float)Width * gv.screenDensity) + (int)(6 * gv.screenDensity), (int)((float)Height * gv.screenDensity) + (int)(6 * gv.screenDensity)); IbRect srcGlow = new IbRect(0, 0, gv.cc.GetFromBitmapList(GlowFilename).PixelSize.Width, gv.cc.GetFromBitmapList(GlowFilename).PixelSize.Height); IbRect dstGlow = new IbRect((int)((parentPanel.currentLocX + this.X) * xMod) - (int)(7 * xMod), (int)((parentPanel.currentLocY + this.Y) * yMod) - (int)(7 * yMod) + spacing, (int)((float)Width * gv.screenDensity) + (int)(15 * gv.screenDensity), (int)((float)Height * gv.screenDensity) + (int)(15 * gv.screenDensity)); gv.DrawBitmap(gv.cc.GetFromBitmapList(ImgBGFilename), src, dstBG, -0.01f, false, 1.0f, true); if (glowOn) { gv.DrawBitmap(gv.cc.GetFromBitmapList(GlowFilename), srcGlow, dstGlow, -0.01f, false, 1.0f, true); } if (!ImgFilename.Equals("")) { gv.DrawBitmap(gv.cc.GetFromBitmapList(ImgFilename), src, dst, -0.01f, false, 1.0f, true); } if (!ImgLUFilename.Equals("")) { if (levelUpOn) { gv.DrawBitmap(gv.cc.GetFromBitmapList(ImgLUFilename), src, dst, -0.01f, false, 1.0f, true); } } if (gv.mod.useUIBackground) { IbRect srcFrame = new IbRect(0, 0, gv.cc.ui_portrait_frame.PixelSize.Width, gv.cc.ui_portrait_frame.PixelSize.Height); IbRect dstFrame = new IbRect((int)((parentPanel.currentLocX + this.X) * xMod) - (int)(5 * xMod), (int)((parentPanel.currentLocY + this.Y) * yMod) - (int)(5 * yMod) + spacing, (int)((float)Width * gv.screenDensity) + (int)(10 * gv.screenDensity), (int)((float)Height * gv.screenDensity) + (int)(10 * gv.screenDensity)); gv.DrawBitmap(gv.cc.ui_portrait_frame, srcFrame, dstFrame, -0.01f, false, 1.0f, true); } //DRAW HP/HPmax // Measure string. //SizeF stringSize = gv.cc.MeasureString(TextHP, thisFont, this.Width); //float stringSize = gv.cc.MeasureString(TextHP, SharpDX.DirectWrite.FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, thisFontHeight); //int ulX = ((int)(this.Width) / 2) - ((int)stringSize / 2); //int ulY = ((int)(this.Height / 2) / 2) + ((int)thisFontHeight / 2); int ulX = pW * 0; int ulY = (int)(Height * yMod) - ((int)thisFontHeight * 2); /* * for (int x = -1; x <= 1; x++) * { * for (int y = -1; y <= 1; y++) * { * if (x != 0 || y != 0) * { * int xLoc = (int)((parentPanel.currentLocX + this.X) * gv.screenDensity + ulX + x); * int yLoc = (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + ulY - pH + y); * gv.DrawText(TextHP, xLoc, yLoc, scaler, Color.Black); * } * } * } */ //(int)((parentPanel.currentLocY + this.Y) * yMod + spacing) int xLoc1 = (int)((parentPanel.currentLocX + this.X) * xMod + ulX); int yLoc1 = (int)((parentPanel.currentLocY + this.Y) * yMod + spacing + (Height * gv.screenDensity) - pixPerLine * 2); gv.DrawTextOutlined(TextHP, xLoc1, yLoc1, scaler, Color.Lime); //DRAW SP/SPmax // Measure string. //stringSize = gv.cc.MeasureString(TextSP, thisFont, this.Width); //stringSize = gv.cc.MeasureString(TextSP, SharpDX.DirectWrite.FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, thisFontHeight); //ulX = ((int)(this.Width / 2)) - ((int)stringSize); //ulY = ((int)(this.Height / 2)); ulX = pW * 1; ulY = (int)(Height * yMod) - ((int)thisFontHeight * 1); /* * for (int x = -1; x <= 1; x++) * { * for (int y = -1; y <= 1; y++) * { * if (x != 0 || y != 0) * { * int xLoc = (int)((parentPanel.currentLocX + this.X) * gv.screenDensity + ulX - pW + x); * int yLoc = (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + ulY - pH + y); * gv.DrawText(TextSP, xLoc, yLoc, scaler, Color.Black); * } * } * } */ int xLoc2 = (int)((parentPanel.currentLocX + this.X) * xMod + ulX - pW); int yLoc2 = (int)((parentPanel.currentLocY + this.Y) * yMod + spacing + (Height * gv.screenDensity) - pixPerLine); gv.DrawTextOutlined(TextSP, xLoc2, yLoc2, scaler, Color.Yellow); //gv.DrawTextOutlined(TextSP, xLoc2, yLoc2, gv.FontWeight.Normal, scaler, Color.Yellow); //DrawText(text, xLoc, yLoc, FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, scaler, fontColor, false); //better reoute all to drawtext and from the to draw outlined //draw level up symbol //ulX = (int)(110 * gv.screenDensity) - pW * 9; //ulX = (int)(110 * xMod) - pW * 24; ulX = (int)(110 * 0.05f); ulY = (int)(Height * yMod) - ((int)thisFontHeight * 7) + pH; /* * for (int x = -1; x <= 1; x++) * { * for (int y = -1; y <= 1; y++) * { * if (x != 0 || y != 0) * { * int xLoc = (int)((parentPanel.currentLocX + this.X) * gv.screenDensity + ulX - pW + x); * int yLoc = (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + ulY - pH + y); * gv.DrawText(levelUpSymbol, xLoc, yLoc, scaler * 1.2f, Color.Black); * } * } * } */ int xLoc3 = (int)((parentPanel.currentLocX + this.X) * xMod + ulX); int yLoc3 = (int)((parentPanel.currentLocY + this.Y) * yMod + ulY - pH + spacing); gv.DrawTextOutlined(levelUpSymbol, xLoc3, yLoc3, scaler * 1.2f, Color.CornflowerBlue); //draw chat symbol //int ulX5 = (int)(110 * xMod) - pW * 24; //int ulY5 = (int)(Height * gv.screenDensity) - ((int)thisFontHeight * 7) + 2*pH; int ulX5 = (int)(110 * 0.05f); int ulY5 = (int)(Height * yMod) - ((int)thisFontHeight * 6) + 3 * pH; /* * for (int x = -1; x <= 1; x++) * { * for (int y = -1; y <= 1; y++) * { * if (x != 0 || y != 0) * { * int xLoc = (int)((parentPanel.currentLocX + this.X) * gv.screenDensity + ulX5 - pW + x); * int yLoc = (int)((parentPanel.currentLocY + this.Y) * gv.screenDensity + ulY5 - pH + y); * gv.DrawText(chatSymbol, xLoc, yLoc, scaler * 0.5f, Color.Black); * } * } * } */ int xLoc4 = (int)((parentPanel.currentLocX + this.X) * xMod + ulX5 - pW); int yLoc4 = (int)((parentPanel.currentLocY + this.Y) * yMod + ulY5 - pH + spacing); gv.DrawTextOutlined(chatSymbol, xLoc4, yLoc4, scaler * 0.25f, Color.Azure); //effects on portrait int effectCounter = 0; foreach (Effect ef in gv.mod.playerList[playerNumber].effectsList) { if ((!ef.isPermanent) && (ef.spriteFilename != "none") && (ef.spriteFilename != "") && (ef.spriteFilename != "None")) { //float ggh = Width * gv.screenDensity; Bitmap fx = gv.cc.LoadBitmap(ef.spriteFilename); src = new IbRect(0, 0, fx.PixelSize.Width, fx.PixelSize.Width); IbRect dst2 = new IbRect(dst.Left + (int)((Width * gv.screenDensity) / 3f * 2f), dst.Top, (int)((Width * gv.screenDensity) / 3f), (int)((Width * gv.screenDensity) / 3f)); effectCounter++; if (effectCounter == 2) { dst2 = new IbRect(dst.Left + (int)((Width * gv.screenDensity) / 3f * 2f), dst.Top + (int)((Width * gv.screenDensity) / 3f * 1f), (int)((Width * gv.screenDensity) / 3f), (int)((Width * gv.screenDensity) / 3f)); } if (effectCounter == 3) { dst2 = new IbRect(dst.Left + (int)((Width * gv.screenDensity) / 3f * 2f), dst.Top + (int)((Width * gv.screenDensity) / 3f * 2f), (int)((Width * gv.screenDensity) / 3f), (int)((Width * gv.screenDensity) / 3f)); } if (effectCounter == 4) { dst2 = new IbRect(dst.Left + (int)((Width * gv.screenDensity) / 3f * 1f), dst.Top, (int)((Width * gv.screenDensity) / 3f), (int)((Width * gv.screenDensity) / 3f)); } if (effectCounter == 5) { dst2 = new IbRect(dst.Left + (int)((Width * gv.screenDensity) / 3f * 1f), dst.Top + (int)((Width * gv.screenDensity) / 3f * 1f), (int)((Width * gv.screenDensity) / 3f), (int)((Width * gv.screenDensity) / 3f)); } if (effectCounter == 6) { dst2 = new IbRect(dst.Left + (int)((Width * gv.screenDensity) / 3f * 1f), dst.Top + (int)((Width * gv.screenDensity) / 3f * 2f), (int)((Width * gv.screenDensity) / 3f), (int)((Width * gv.screenDensity) / 3f)); } if (effectCounter == 7) { dst2 = new IbRect(dst.Left, dst.Top, (int)((Width * gv.screenDensity) / 3f), (int)((Width * gv.screenDensity) / 3f)); } if (effectCounter == 8) { dst2 = new IbRect(dst.Left, dst.Top + (int)((Width * gv.screenDensity) / 3f * 1f), (int)((Width * gv.screenDensity) / 3f), (int)((Width * gv.screenDensity) / 3f)); } if (effectCounter == 9) { dst2 = new IbRect(dst.Left, dst.Top + (int)((Width * gv.screenDensity) / 3f * 2f), (int)((Width * gv.screenDensity) / 3f), (int)((Width * gv.screenDensity) / 3f)); } gv.DrawBitmap(fx, src, dst2, -0.01f, false, 1.0f, true); gv.cc.DisposeOfBitmap(ref fx); } } } //draw level up symbol }