gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
помоги с рефакторингом public class ErrorCounter : MonoBehaviour, IDisposable {…
- User
помоги с рефакторингом public class ErrorCounter : MonoBehaviour, IDisposable { [SerializeField] private TextMeshProUGUI textCurrentCounter; [SerializeField] private TextMeshProUGUI textMaxErrorCounter; [SerializeField] private Image slashIcon; [SerializeField] private Image errorIcon;
[Inject] private ISubscriber subscriber; private int error = 0; private int errorMax = 0; private bool isExam = false; private Color ColorNoError = new Color(54f / 255f, 185f / 255f, 98f / 255f); private Color ColorErrors = new Color(255f / 255f, 161f / 255f, 19f / 255f); private Color ColorСriticalErrors = new Color(255f / 255f, 84f / 255f, 83f / 255f); public event Action OnMaxErrors; public int GetError() { return error; } public void ResetError() { error = 0; textCurrentCounter.text = error.ToString(); } public void Initialization(int errorMax, bool isExam) { this.isExam = isExam; this.errorMax = errorMax; subscriber.Subscribe<ViolationMessage>(IncreaseValueErrors); SwitchExamMode(); textMaxErrorCounter.text = errorMax.ToString(); } private void SwitchExamMode() { if (isExam) { slashIcon.Active(); textMaxErrorCounter.Active(); errorIcon.color = ColorNoError; } else { slashIcon.Deactive(); textMaxErrorCounter.Deactive(); } } private void IncreaseValueErrors(ViolationMessage message) { error++; textCurrentCounter.text = error.ToString(); if (isExam) { errorIcon.color = ColorErrors; } if (isExam && error >= errorMax) { errorIcon.color = ColorСriticalErrors; OnMaxErrors?.Invoke(); } } public void Dispose() { subscriber?.UnSubscribe<ViolationMessage>(IncreaseValueErrors); } private void OnDestroy() { Dispose(); } } - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.