private static string Scripts(string ls) { if (ls == "sp") { Accumulator <string> acc = new Accumulator <string>(); for (int i = 0; i < SceneManager.sceneCount; i++) { Scene scene = SceneManager.GetSceneAt(i); foreach (GameObject obj in scene.GetRootGameObjects()) { Transform[] trans = obj.GetComponentsInChildren <Transform>(); foreach (Transform tran in trans) { Component[] monos = tran.gameObject.GetComponents <Component>(); foreach (Component mono in monos) { if (mono != null) { if (HasEnabled(mono)) { acc.AddKey(mono.GetType().Name); } } } } } } List <string> list = new List <string>(); foreach (string name in acc.KeysSortedByValue()) { list.Add(name + "=" + acc.GetCount(name)); } return(string.Join("\n", list.ToArray())); } return(null); }
public override void DoAction(IEventArgs args) { if (remove) { args.GameContext.sceneObject.DestroyAllEntities(); } else { Accumulator <string> acc = new Accumulator <string>(); if (MapConfigPoints.current != null) { foreach (MapConfigPoints.ID_Point point in MapConfigPoints.current.IDPints) { List <ItemDrop> list = FreeItemDrop.GetDropItems(point.ID); foreach (ItemDrop item in list) { acc.AddKey(string.Format("{0}_{1}", item.cat, item.id), 1); } TimerGameAction timer = new TimerGameAction(); timer.time = "200"; timer.count = list.Count.ToString(); timer.SetAction(new RefreshItemAction(list)); timer.Act(args); } } List <string> items = new List <string>(); foreach (string key in acc.KeysSortedByValue()) { items.Add(string.Format("{0}={1}", key, acc.GetCount(key))); } Debug.LogFormat("items:\n{0}", string.Join("\n", items.ToArray())); } }