namespace DrawXXL { using UnityEngine; public class UtilitiesDXXL_CharsAndIcons { ///Symbol definition format: //a jagged array of Vector2 arrays, //each Vector2 array describes a stringLine of points, //multiple stringLine of points describe a symbol. //(actually Vector3, but z-component is ignored) //saving GC.Alloc and ctor's: static Vector3 deletedMarkupStroke_lineStart = new Vector2(0.0f, 0.375f); static Vector3 deletedMarkupStroke_lineEnd = new Vector2(1.0f, 0.375f); static Vector3 underlinedMarkupStroke_lineStart = new Vector2(0.0f, -0.25f); static Vector3 underlinedMarkupStroke_lineEnd = new Vector2(1.0f, -0.25f); public static string GetIconAsMarkupString(DrawBasics.IconType requestedIcon) { switch (requestedIcon) { case DrawBasics.IconType.profileFoto: return ""; case DrawBasics.IconType.imageLandscape: return ""; case DrawBasics.IconType.homeHouse: return ""; case DrawBasics.IconType.dataDisc: return ""; case DrawBasics.IconType.saveData: return ""; case DrawBasics.IconType.loadData: return ""; case DrawBasics.IconType.speechBubble: return ""; case DrawBasics.IconType.speechBubbleEmpty: return ""; case DrawBasics.IconType.thumbUp: return ""; case DrawBasics.IconType.thumbDown: return ""; case DrawBasics.IconType.lightBulbOn: return ""; case DrawBasics.IconType.lightBulbOff: return ""; case DrawBasics.IconType.videoCamera: return ""; case DrawBasics.IconType.camera: return ""; case DrawBasics.IconType.music: return ""; case DrawBasics.IconType.audioSpeaker: return ""; case DrawBasics.IconType.microphone: return ""; case DrawBasics.IconType.wlan_wifi: return ""; case DrawBasics.IconType.share: return ""; case DrawBasics.IconType.timeClock: return ""; case DrawBasics.IconType.telephone: return ""; case DrawBasics.IconType.doorOpen: return ""; case DrawBasics.IconType.doorEnter: return ""; case DrawBasics.IconType.doorLeave: return ""; case DrawBasics.IconType.locationPin: return ""; case DrawBasics.IconType.folder: return ""; case DrawBasics.IconType.saveToFolder: return ""; case DrawBasics.IconType.loadFromFolder: return ""; case DrawBasics.IconType.optionsSettingsGear: return ""; case DrawBasics.IconType.adjustOptionsSettings: return ""; case DrawBasics.IconType.pen: return ""; case DrawBasics.IconType.questionMark: return ""; case DrawBasics.IconType.exclamationMark: return ""; case DrawBasics.IconType.shoppingCart: return ""; case DrawBasics.IconType.checkmarkChecked: return ""; case DrawBasics.IconType.checkmarkUnchecked: return ""; case DrawBasics.IconType.battery: return ""; case DrawBasics.IconType.cloud: return ""; case DrawBasics.IconType.magnifier: return ""; case DrawBasics.IconType.magnifierPlus: return ""; case DrawBasics.IconType.magnifierMinus: return ""; case DrawBasics.IconType.timeHourglassCursor: return ""; case DrawBasics.IconType.cursorHand: return ""; case DrawBasics.IconType.cursorPointer: return ""; case DrawBasics.IconType.trashcan: return ""; case DrawBasics.IconType.switchOnOff: return ""; case DrawBasics.IconType.playButton: return ""; case DrawBasics.IconType.pauseButton: return ""; case DrawBasics.IconType.stopButton: return ""; case DrawBasics.IconType.playPauseButton: return ""; case DrawBasics.IconType.heart: return ""; case DrawBasics.IconType.coin: return ""; case DrawBasics.IconType.coins: return ""; case DrawBasics.IconType.moneyBills: return ""; case DrawBasics.IconType.moneyBag: return ""; case DrawBasics.IconType.chestTreasureBox_closed: return ""; case DrawBasics.IconType.lootbox: return ""; case DrawBasics.IconType.crown: return ""; case DrawBasics.IconType.trophy: return ""; case DrawBasics.IconType.awardMedal: return ""; case DrawBasics.IconType.sword: return ""; case DrawBasics.IconType.shield: return ""; case DrawBasics.IconType.gun: return ""; case DrawBasics.IconType.bullet: return ""; case DrawBasics.IconType.rocket: return ""; case DrawBasics.IconType.crosshair: return ""; case DrawBasics.IconType.arrow: return ""; case DrawBasics.IconType.arrowBow: return ""; case DrawBasics.IconType.bomb: return ""; case DrawBasics.IconType.shovel: return ""; case DrawBasics.IconType.hammer: return ""; case DrawBasics.IconType.axe: return ""; case DrawBasics.IconType.magnet: return ""; case DrawBasics.IconType.compass: return ""; case DrawBasics.IconType.fuelStation: return ""; case DrawBasics.IconType.fuelCan: return ""; case DrawBasics.IconType.lockLocked: return ""; case DrawBasics.IconType.lockUnlocked: return ""; case DrawBasics.IconType.key: return ""; case DrawBasics.IconType.gemDiamond: return ""; case DrawBasics.IconType.gold: return ""; case DrawBasics.IconType.potion: return ""; case DrawBasics.IconType.presentGift: return ""; case DrawBasics.IconType.death: return ""; case DrawBasics.IconType.map: return ""; case DrawBasics.IconType.mushroom: return ""; case DrawBasics.IconType.star: return ""; case DrawBasics.IconType.pill: return ""; case DrawBasics.IconType.health: return ""; case DrawBasics.IconType.foodPlate: return ""; case DrawBasics.IconType.foodMeat: return ""; case DrawBasics.IconType.flag: return ""; case DrawBasics.IconType.flagChequered: return ""; case DrawBasics.IconType.ball: return ""; case DrawBasics.IconType.dice: return ""; case DrawBasics.IconType.joystick: return ""; case DrawBasics.IconType.gamepad: return ""; case DrawBasics.IconType.jigsawPuzzle: return ""; case DrawBasics.IconType.fish: return ""; case DrawBasics.IconType.car: return ""; case DrawBasics.IconType.tree: return ""; case DrawBasics.IconType.palm: return ""; case DrawBasics.IconType.leaf: return ""; case DrawBasics.IconType.nukeNuclearWarning: return ""; case DrawBasics.IconType.biohazardWarning: return ""; case DrawBasics.IconType.fireWarning: return ""; case DrawBasics.IconType.warning: return ""; case DrawBasics.IconType.emergencyExit: return ""; case DrawBasics.IconType.sun: return ""; case DrawBasics.IconType.rain: return ""; case DrawBasics.IconType.wind: return ""; case DrawBasics.IconType.snow: return ""; case DrawBasics.IconType.lightning: return ""; case DrawBasics.IconType.fire: return ""; case DrawBasics.IconType.unitSquare: return ""; case DrawBasics.IconType.unitSquareIncl1Right: return ""; case DrawBasics.IconType.unitSquareIncl2Right: return ""; case DrawBasics.IconType.unitSquareIncl3Right: return ""; case DrawBasics.IconType.unitSquareIncl4Right: return ""; case DrawBasics.IconType.unitSquareIncl5Right: return ""; case DrawBasics.IconType.unitSquareIncl6Right: return ""; case DrawBasics.IconType.unitSquareCrossed: return ""; case DrawBasics.IconType.unitCircle: return ""; case DrawBasics.IconType.animal: return ""; case DrawBasics.IconType.bird: return ""; case DrawBasics.IconType.humanMale: return ""; case DrawBasics.IconType.humanFemale: return ""; case DrawBasics.IconType.bombExplosion: return ""; case DrawBasics.IconType.tower: return ""; case DrawBasics.IconType.circleDotFilled: return ""; case DrawBasics.IconType.circleDotUnfilled: return ""; case DrawBasics.IconType.logMessage: return ""; case DrawBasics.IconType.logMessageError: return ""; case DrawBasics.IconType.logMessageException: return ""; case DrawBasics.IconType.logMessageAssertion: return ""; case DrawBasics.IconType.up_oneStroke: return ""; case DrawBasics.IconType.up_twoStroke: return ""; case DrawBasics.IconType.up_threeStroke: return ""; case DrawBasics.IconType.down_oneStroke: return ""; case DrawBasics.IconType.down_twoStroke: return ""; case DrawBasics.IconType.down_threeStroke: return ""; case DrawBasics.IconType.left_oneStroke: return ""; case DrawBasics.IconType.left_twoStroke: return ""; case DrawBasics.IconType.left_threeStroke: return ""; case DrawBasics.IconType.right_oneStroke: return ""; case DrawBasics.IconType.right_twoStroke: return ""; case DrawBasics.IconType.right_threeStroke: return ""; case DrawBasics.IconType.fist: return ""; case DrawBasics.IconType.boxingGlove: return ""; case DrawBasics.IconType.stars5Rate: return ""; case DrawBasics.IconType.stars3: return ""; case DrawBasics.IconType.shootingStar: return ""; case DrawBasics.IconType.moonHalf: return ""; case DrawBasics.IconType.moonFullPlanet: return ""; case DrawBasics.IconType.leftHandRule: return ""; case DrawBasics.IconType.rightHandRule: return ""; case DrawBasics.IconType.megaphone: return ""; case DrawBasics.IconType.arrowLeft: return ""; case DrawBasics.IconType.arrowRight: return ""; case DrawBasics.IconType.arrowUp: return ""; case DrawBasics.IconType.arrowDown: return ""; case DrawBasics.IconType.healthBox: return ""; case DrawBasics.IconType.iceIcicle: return ""; case DrawBasics.IconType.pickAxe: return ""; case DrawBasics.IconType.audioSpeakerMute: return ""; case DrawBasics.IconType.chestTreasureBox_open: return ""; case DrawBasics.IconType.doorClosed: return ""; default: Debug.LogError("Icon '" + requestedIcon + "' not implemented."); return ""; } } public static void RefillCurrPrintedCharDef(InternalDXXL_CharConfig charToFillIn, out bool charIsMissing) { Vector3[][] charDefinition; if (charToFillIn.isIcon) { charDefinition = DrawXXL_LinesManager.instance.GetPointsArray(charToFillIn.iconString, out charIsMissing); } else { charDefinition = DrawXXL_LinesManager.instance.GetPointsArray(charToFillIn.character, out charIsMissing); } int addionalMarkupStrokes = 0; if (charToFillIn.deleted) { addionalMarkupStrokes++; } if (charToFillIn.underlined) { addionalMarkupStrokes++; } DrawXXL_LinesManager.instance.numberOfStrokes_forCurrUsedChar = charDefinition.Length + addionalMarkupStrokes; for (int i_stroke = 0; i_stroke < charDefinition.Length; i_stroke++) { DrawXXL_LinesManager.instance.numberOfPointsForEachStroke_forCurrUsedChar[i_stroke] = charDefinition[i_stroke].Length; for (int i_point = 0; i_point < charDefinition[i_stroke].Length; i_point++) { DrawXXL_LinesManager.instance.currPrinted_charDef[i_stroke][i_point] = charDefinition[i_stroke][i_point]; } } int curr_stroke = charDefinition.Length; if (charToFillIn.deleted) { DrawXXL_LinesManager.instance.numberOfPointsForEachStroke_forCurrUsedChar[curr_stroke] = 2; DrawXXL_LinesManager.instance.currPrinted_charDef[curr_stroke][0] = deletedMarkupStroke_lineStart; DrawXXL_LinesManager.instance.currPrinted_charDef[curr_stroke][1] = deletedMarkupStroke_lineEnd; curr_stroke++; } if (charToFillIn.underlined) { DrawXXL_LinesManager.instance.numberOfPointsForEachStroke_forCurrUsedChar[curr_stroke] = 2; DrawXXL_LinesManager.instance.currPrinted_charDef[curr_stroke][0] = underlinedMarkupStroke_lineStart; DrawXXL_LinesManager.instance.currPrinted_charDef[curr_stroke][1] = underlinedMarkupStroke_lineEnd; curr_stroke++; } } static Vector3 offset_toShiftIconsCenterToZero = new Vector3(-0.5f, -0.5f, 0.0f); public static void RefillCurrPrintedCharDefWithZeroCenteredIcon(DrawBasics.IconType iconToFillIn) { Vector3[][] charDefinition = DrawXXL_LinesManager.instance.GetPointsArray(iconToFillIn); DrawXXL_LinesManager.instance.numberOfStrokes_forCurrUsedChar = charDefinition.Length; for (int i_stroke = 0; i_stroke < charDefinition.Length; i_stroke++) { DrawXXL_LinesManager.instance.numberOfPointsForEachStroke_forCurrUsedChar[i_stroke] = charDefinition[i_stroke].Length; for (int i_point = 0; i_point < charDefinition[i_stroke].Length; i_point++) { DrawXXL_LinesManager.instance.currPrinted_charDef[i_stroke][i_point] = charDefinition[i_stroke][i_point] + offset_toShiftIconsCenterToZero; } } } public static void DrawAllIconsWithTheirNames(Vector3 position, Color iconsColor, Color textColor, bool displayNameTexts, float sizeOfIconWall) { if (DXXLWrapperForUntiysBuildInDrawLines.CheckIfDrawingIsCurrentlySkipped()) { return; } iconsColor = UtilitiesDXXL_Colors.OverwriteDefaultColor(iconsColor, Color.white); textColor = UtilitiesDXXL_Colors.OverwriteDefaultColor(textColor, Color.black); sizeOfIconWall = Mathf.Max(sizeOfIconWall, 1.0f); Vector3 positionOfNextThemeBlock = position; positionOfNextThemeBlock = DrawIconThemeBlock(positionOfNextThemeBlock, "System / Operate", 0, 37, iconsColor, textColor, sizeOfIconWall, displayNameTexts, (-1)); positionOfNextThemeBlock = DrawIconThemeBlock(positionOfNextThemeBlock, "Human", 38, 45, iconsColor, textColor, sizeOfIconWall, displayNameTexts, (-1)); positionOfNextThemeBlock = DrawIconThemeBlock(positionOfNextThemeBlock, "Nature / Weather", 46, 63, iconsColor, textColor, sizeOfIconWall, displayNameTexts, (-1)); positionOfNextThemeBlock = DrawIconThemeBlock(positionOfNextThemeBlock, "Games", 64, 113, iconsColor, textColor, sizeOfIconWall, displayNameTexts, (-1)); positionOfNextThemeBlock = DrawIconThemeBlock(positionOfNextThemeBlock, "Tools / Weapons", 114, 124, iconsColor, textColor, sizeOfIconWall, displayNameTexts, (-1)); positionOfNextThemeBlock = DrawIconThemeBlock(positionOfNextThemeBlock, "Signs / Warning", 125, 133, iconsColor, textColor, sizeOfIconWall, displayNameTexts, (-1)); positionOfNextThemeBlock = DrawIconThemeBlock(positionOfNextThemeBlock, "Basics", 134, 164, iconsColor, textColor, sizeOfIconWall, displayNameTexts, 158); positionOfNextThemeBlock = DrawIconThemeBlock(positionOfNextThemeBlock, "Miscellaneous", 165, 166, iconsColor, textColor, sizeOfIconWall, displayNameTexts, (-1)); } static Vector3 DrawIconThemeBlock(Vector3 startPos, string headline, int i_startIcon, int i_endIcon, Color iconsColor, Color textColor, float sizeOfWholeIconWall, bool displayNameTexts, int newLineForEveryIconAfterThisIconI) { Vector3 currPosOfLineStart = startPos; float iconSize = 0.1f * sizeOfWholeIconWall; float lineHeight = 1.8f * iconSize; UtilitiesDXXL_Text.Write(headline + ":", currPosOfLineStart + Vector3.left * 0.5f * iconSize, iconsColor, 0.65f * iconSize, Vector3.right, Vector3.up, DrawText.TextAnchorDXXL.MiddleLeft, DrawBasics.LineStyle.invisible, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, true, 0.0f, false, false, false, true); currPosOfLineStart = currPosOfLineStart + Vector3.down * lineHeight; int i_line = 0; int i_ofIconInsideLine = 0; int iconsPerLine = 10; bool hasAlreadyDrawnAnIconInCurrLine = false; Quaternion rotation = Quaternion.LookRotation(Vector3.forward, Vector3.up); for (int i_icon = i_startIcon; i_icon <= i_endIcon; i_icon++) { Vector3 currIconPosition = currPosOfLineStart + Vector3.right * 1.8f * iconSize * i_ofIconInsideLine; string text = ((DrawBasics.IconType)i_icon).ToString(); UtilitiesDXXL_DrawBasics.Icon(currIconPosition, (DrawBasics.IconType)i_icon, iconsColor, iconSize, displayNameTexts ? DrawText.MarkupColor(text, textColor) : null, rotation, 0, false, 0.0f, false, 0.1f, 0.004f, true); hasAlreadyDrawnAnIconInCurrLine = true; i_ofIconInsideLine++; if (i_icon == newLineForEveryIconAfterThisIconI) { iconsPerLine = 1; } if (i_ofIconInsideLine >= iconsPerLine) { i_ofIconInsideLine = 0; i_line++; currPosOfLineStart = currPosOfLineStart + Vector3.down * lineHeight; hasAlreadyDrawnAnIconInCurrLine = false; } } Vector3 positionOfNextThemeBlock = currPosOfLineStart + 0.65f * Vector3.down * lineHeight; if (hasAlreadyDrawnAnIconInCurrLine) { positionOfNextThemeBlock = positionOfNextThemeBlock + Vector3.down * lineHeight; } return positionOfNextThemeBlock; } } }