private void statusChanged(string pEvent, ARollable pSourceA = null, ARollable pSourceB = null) { //collect info about all the dice info (one level deep) and print it _stringBuilder.Length = 0; if (logEvents) { _stringBuilder.AppendLine(pEvent + (pSourceA == null ? "" : " / " + pSourceA.name) + (pSourceB == null ? "" : " / " + pSourceB.name)); } for (int i = 0; i < _dieCollection.Count; i++) { ARollable die = _dieCollection.Get(i); IRollResult result = die.GetRollResult(); string resultColor = (die.HasEndResult() && result.isExact) ? "green" : "blue"; //only show values if we are NOT rolling OR updating every frame string resultValues = (!die.isRolling || updateEveryFrame) ? result.valuesAsString : "*"; _stringBuilder.AppendFormat("<color={0}>{1}={2}</color> ", resultColor, die.name, resultValues); } _stringBuilder.AppendLine("\nAny dice still rolling? " + (_dieCollection.isRolling ? "Yes (" + _dieCollection.RollingCount + ")" : "No")); IRollResult collectionResult = _dieCollection.GetRollResult(); string collectionResultValues = (!_dieCollection.isRolling || updateEveryFrame) ? collectionResult.valuesAsString : "*"; _stringBuilder.AppendLine("Dice collection value totals:" + collectionResultValues); Debug.Log(_stringBuilder.ToString()); }
private void statusChanged(string pEvent, ARollable pSourceA = null, ARollable pSourceB = null) { if (_dieCollection == null) { return; } if (logEvents && pEvent != null) { Debug.Log(pEvent + (pSourceA == null?"": "/" + pSourceA.name) + (pSourceB == null ? "" : "/" + pSourceB.name)); } int diceTextsCount = Mathf.Min(_diceTexts.Count, _dieCollection.Count); for (int i = 0; i < diceTextsCount; i++) { ARollable die = _dieCollection.Get(i); IRollResult result = die.GetRollResult(); string resultColor = (die.HasEndResult() && result.isExact)?"green":"blue"; //only show values if we are NOT rolling OR updating every frame string resultValues = (!die.isRolling || updateEveryFrame) ? result.valuesAsString : "*"; _diceTexts[i].text = string.Format("<color={0}>{1}={2}</color>", resultColor, die.name, resultValues); } _dieCountText.text = "" + _dieCollection.Count; if (pEvent != null) { _lastEventText.text = pEvent; } _rollingInfoText.text = _dieCollection.isRolling ? ("Yes (" + _dieCollection.RollingCount + ")") : "No"; IRollResult collectionResult = _dieCollection.GetRollResult(); string collectionResultValues = (!_dieCollection.isRolling || updateEveryFrame) ? collectionResult.valuesAsString : "*"; _dieTotalText.text = collectionResultValues; }