private void Selecteble() { Camera c = Camera.main; var v1 = c.ScreenToViewportPoint(StartPos); var v2 = c.ScreenToViewportPoint(EndPos); Vector3 min = Vector3.Min(v1, v2); Vector3 max = Vector3.Max(v1, v2); min.z = c.nearClipPlane; max.z = c.farClipPlane; Bounds bounds = new Bounds(); bounds.SetMinMax(min, max); list.ForEach(v => { if (v.Enum.Command == Command && bounds.Contains(c.WorldToViewportPoint(v.transform.position))) { v.IsSelect = true; } else { v.IsSelect = false; } }); }
static int ForEach(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); System.Collections.Generic.List <string> obj = (System.Collections.Generic.List <string>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <string>)); System.Action <string> arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (System.Action <string>)ToLua.CheckObject(L, 2, typeof(System.Action <string>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <string>), func) as System.Action <string>; } obj.ForEach(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void ReadCSV() { string path = Application.persistentDataPath + "/animali.csv"; StreamReader sr = new StreamReader(path); System.Collections.Generic.List <Animal> animals = new System.Collections.Generic.List <Animal>(); string s; bool firstLine = true; while ((s = sr.ReadLine()) != null) { if (firstLine) { firstLine = false; continue; } string[] cells = s.Split(','); Animal animal; animal.name = cells[0]; animal.strength = int.Parse(cells[1]); animal.life = int.Parse(cells[2]); animals.Add(animal); } sr.Close(); // Log the result animals.ForEach(x => Debug.Log(x)); }
static void Main() { var baseDate = new DateTime(2020, 1, 1); var list = new System.Collections.Generic.List <DateTime>() { baseDate.AddHours(200), baseDate.AddHours(100), baseDate.AddHours(300) }; list.Sort(); list.ForEach((c) => Console.WriteLine(c)); }
static public int ForEach(IntPtr l) { try { System.Collections.Generic.List <UnityEngine.GameObject> self = (System.Collections.Generic.List <UnityEngine.GameObject>)checkSelf(l); System.Action <UnityEngine.GameObject> a1; LuaDelegation.checkDelegate(l, 2, out a1); self.ForEach(a1); return(0); } catch (Exception e) { return(error(l, e)); } }
static public int ForEach(IntPtr l) { try { System.Collections.Generic.List <System.Int32> self = (System.Collections.Generic.List <System.Int32>)checkSelf(l); System.Action <System.Int32> a1; LuaDelegation.checkDelegate(l, 2, out a1); self.ForEach(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int ForEach(IntPtr l) { try { System.Collections.Generic.List <UnityEngine.Vector3> self = (System.Collections.Generic.List <UnityEngine.Vector3>)checkSelf(l); System.Action <UnityEngine.Vector3> a1; checkDelegate(l, 2, out a1); self.ForEach(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int ForEach(IntPtr l) { try { System.Collections.Generic.List <System.Int32> self = (System.Collections.Generic.List <System.Int32>)checkSelf(l); System.Action <System.Int32> a1; LuaDelegation.checkDelegate(l, 2, out a1); self.ForEach(a1); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static int ForEach(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); System.Collections.Generic.List <string> obj = (System.Collections.Generic.List <string>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <string>)); System.Action <string> arg0 = (System.Action <string>)ToLua.CheckDelegate <System.Action <string> >(L, 2); obj.ForEach(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
// Update is called once per frame void Update() { // ↑キー/スペースが押されたら、ステートを次に送る処理 if (Input.GetKeyDown("up") || Input.GetButton("Jump")) { // ブーリアンNextをtrueにする anim.SetBool("Next", true); addAnims.ForEach(a => a.SetBool("Next", true)); } // ↓キーが押されたら、ステートを前に戻す処理 if (Input.GetKeyDown("down")) { // ブーリアンBackをtrueにする anim.SetBool("Back", true); addAnims.ForEach(a => a.SetBool("Back", true)); } // "Next"フラグがtrueの時の処理 if (anim.GetBool("Next")) { // 現在のステートをチェックし、ステート名が違っていたらブーリアンをfalseに戻す currentState = anim.GetCurrentAnimatorStateInfo(0); if (previousState.nameHash != currentState.nameHash) { anim.SetBool("Next", false); addAnims.ForEach(a => a.SetBool("Next", false)); previousState = currentState; } } // "Back"フラグがtrueの時の処理 if (anim.GetBool("Back")) { // 現在のステートをチェックし、ステート名が違っていたらブーリアンをfalseに戻す currentState = anim.GetCurrentAnimatorStateInfo(0); if (previousState.nameHash != currentState.nameHash) { anim.SetBool("Back", false); addAnims.ForEach(a => a.SetBool("Back", false)); previousState = currentState; } } }
static int ForEach(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> obj = (System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>)); System.Action <UnityEngine.EventSystems.RaycastResult> arg0 = (System.Action <UnityEngine.EventSystems.RaycastResult>)ToLua.CheckDelegate <System.Action <UnityEngine.EventSystems.RaycastResult> >(L, 2); obj.ForEach(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static void Main() { var baseDate = new DateTime(2020, 1, 1); var list = new System.Collections.Generic.List <DateTime>() { baseDate.AddHours(200), baseDate.AddHours(100), baseDate.AddHours(300) }; list.Sort((x, y) => { if (x.Year != y.Year) { return(x.Year - y.Year); } if (x.Month != y.Month) { return(x.Month - y.Month); } if (x.Day != y.Day) { return(x.Day - y.Day); } if (x.Hour != y.Hour) { return(x.Hour - y.Hour); } if (x.Minute != y.Minute) { return(x.Minute - y.Minute); } if (x.Second != y.Second) { return(x.Second - y.Second); } return(x.Millisecond - y.Millisecond); }); list.ForEach((c) => Console.WriteLine(c)); }