private void printPointData(PointCalculator.Point point, ref float y, float windowWidth, bool onlyCalculation) { if (!onlyCalculation) { float columnWidth = (windowWidth - 2f * 5f) / 5f; long objectiveId = point.id; if (objectiveId == -1L) { bool hasThreshold = point.threshold != -1L; // Amount bool hasOwnAmount = point.hasOwnAmountCalculation(); float ownAmount = point.getOwnAmount(); GUIStyle style = textStyle; GUIStyle styleRight = textStyleRight; if (hasOwnAmount && (ownAmount == 0f || ownAmount == -1f) || point.amount == 0f) { style = textNoPointsStyle; styleRight = textNoPointsStyleRight; } // Point label GUI.Label(new Rect(5f, y, 2f * columnWidth, style.fontSize + 6f), point.label, style); if (hasOwnAmount) { if (ownAmount != -1f) { GUI.Label(new Rect(5f + 2f * columnWidth, y, columnWidth, styleRight.fontSize + 6f), Misc.maxDecimals(ownAmount) + "x ", styleRight); } } else if (hasThreshold) { GUI.Label(new Rect(5f + 2f * columnWidth, y, columnWidth, styleRight.fontSize + 6f), Mathf.FloorToInt(point.amount / point.threshold) + "x ", styleRight); } else { GUI.Label(new Rect(5f + 2f * columnWidth, y, columnWidth, styleRight.fontSize + 6f), Misc.maxDecimals(point.amount) + "x ", styleRight); } // Point per amount if (ownAmount != -1f) { GUI.Label(new Rect(5f + 2f * (2 * columnWidth), y, columnWidth, styleRight.fontSize + 6f), "" + point.value, style); } // Total points GUI.Label(new Rect(windowWidth - 5f - columnWidth, y, columnWidth, styleRight.fontSize + 6f), "" + point.calculatedValue, styleRight); } else { GUIStyle style = textStyle; GUIStyle styleRight = textStyleRight; if (point.calculatedValue == 0f && point.amount == 0f) { style = textNoPointsStyle; styleRight = textNoPointsStyleRight; } // Objective label string objectiveLabel = point.label; if (objectiveLabel == null) { objectiveLabel = summary.objectives.get(objectiveId).label; } GUI.Label(new Rect(5f, y, 4f * columnWidth, textStyle.fontSize + 6f), objectiveLabel, style); // Total points GUI.Label(new Rect(windowWidth - 5f - columnWidth, y, columnWidth, textStyleRight.fontSize + 6f), "" + point.calculatedValue, styleRight); } } y += textStyle.fontSize + 6f; }
private float drawSummaryInnerContents(float popupWidth, bool onlyCalculation = false) { float pointY = 0; printTitle("Points:", ref pointY, popupWidth, subtitleStyle, onlyCalculation); int points = summary.pointsBefore; // Present included points foreach (PointCalculator.Point point in summary.alreadyIncluded) { printPointData(point, ref pointY, popupWidth, onlyCalculation); } // Present each "not yet included" points foreach (PointCalculator.Point point in summary.notYetIncluded) { printPointData(point, ref pointY, popupWidth, onlyCalculation); points += point.calculatedValue; } // Present total points PointCalculator.Point totalPoints = new PointCalculator.Point(PointCalculator.Point.TYPE_TOTAL_POINTS, "Total", points); if (!onlyCalculation) { EditorGUIx.DrawLine(new Vector2(5f, 4f + pointY), new Vector2(popupWidth - 5f, 4f + pointY), 2f); } pointY += 7f; printPointData(totalPoints, ref pointY, popupWidth, onlyCalculation); if (!summary.failedMission) { drawStars(summary.numberOfStars, ref pointY, popupWidth, onlyCalculation: onlyCalculation); } if (summary.newHighscore) { drawHighscoreStamp(ref pointY, popupWidth, onlyCalculation); if (!onlyCalculation) { if (!summary.havePlayedHighscoreSound) { summary.havePlayedHighscoreSound = true; GenericSoundEffects.playHighscoreSerenade(); } } } if (summary.failedMission) { drawFailedStamp(ref pointY, popupWidth, onlyCalculation); if (!onlyCalculation) { if (!summary.havePlayedFailedSound) { summary.havePlayedFailedSound = true; GenericSoundEffects.playFailSound(); } } } return(pointY); }