using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; public class EventGatherCoreTest : MonoBehaviour { /* [SerializeField] private int TotalTestCount = 5000; [SerializeField] private float Interval = 0.0002f; private EventGatherCoreData _data; private EventGatherCoreTableContext _ctx; private void Start() { _data = EventGatherCoreData.CreateNew(); _ctx = EventGatherCoreTableContext.GetTestSample(); } private void Update() { if (Input.GetKeyDown(KeyCode.T)) RunSingleTest(); if (Input.GetKeyDown(KeyCode.S)) StartCoroutine(RunStatisticTest()); } private bool RunSingleTest() { var rewardIdx = EventGatherCoreSystem.PickRandomRewardIdx(); // Debug.Log($"[EventGatherCore] Draw Reward Idx: {rewardIdx}, Reward Id: {_data.StageData.RewardIdList[rewardIdx]}"); _data.StageData.SetRewardClaimed(rewardIdx); var rewardId = _data.StageData.RewardIdList[rewardIdx]; if (_ctx.IsCoreItem(rewardId)) { // Debug.Log($"[EventGatherCore] {rewardId} is core Item."); _data.StageData.AddCoreItem(); } // Debug.Log($"[EventGatherCore] CoreItemCount: {_data.StageData.CoreItemReceivedCount}."); if (_data.StageData.IsStageCleared(_ctx, _data.RoundCount)) { Debug.Log($"[EventGatherCore] Stage Cleared."); _data.MoveToNextStage(); return true; } return false; } private IEnumerator RunStatisticTest() { int i = 0; Dictionary> res = new Dictionary>(); res[0] = new Dictionary(); res[1] = new Dictionary(); res[2] = new Dictionary(); res[3] = new Dictionary(); res[4] = new Dictionary(); Debug.Log($"[EventGatherCore] Running like hell..."); yield return new WaitForSeconds(Interval); while (i < TotalTestCount) { var playTimeCount = 1; while (RunSingleTest() == false) { playTimeCount++; } if (res[i % 5].ContainsKey(playTimeCount)) res[i % 5][playTimeCount]++; else res[i % 5].Add(playTimeCount, 1); i++; yield return new WaitForSeconds(Interval); } int sum; foreach (var kv in res.OrderBy(x => x.Key)) { sum = 0; Debug.Log($"[EventGatherCore] Stage{kv.Key + 1}: "); foreach (var kv2 in kv.Value.OrderBy(x => x.Key)) { Debug.Log($"[EventGatherCore] Play Count {kv2.Key}: {kv2.Value}"); sum += kv2.Value * kv2.Key; } Debug.Log($"[EventGatherCore] Average: {sum / (float)TotalTestCount * 5}"); } } */}