public static string List2Str<T>(IEnumerable<T> list) { string str = ""; string suffix = "-"; foreach (var item in list) { str += item + suffix; } //移除掉最后末尾那个"-" str = str.Remove(str.Length-1, 1); return str; } } } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10...
Find(i => { if (i >= 3) return true; else return false; }); //i是代指list中的每个元素,也就形参名,可以自定义 2.String容器: 本质上是char数组 常用方法: //初始化 string s = "123456"; //转为char数组 char[] c = s.ToCharArray(); //字符串长度 int l = s.Length; //字符串...
protectedintm_length;// 存放的单元个数 protectedintm_mayIdleID;// 可能空闲的单元下标 protectedIEnumerator[] m_enumerators;//枚举器组 protectedbool[] m_enumStates;//枚举器组当前占用状态 publicAB_List() { init(5); } publicAB_List(intcapacity,intenumCount=5) { init(enumCount); } protecte...
写法1 public void Bubble1(int[] a) { bool b; int tmp; for (int i = 0; i < a.Length; i++) { b = false; for (int j = i+1; j < a.Length ; j++) { if (a[j] > a[i]) { tmp = a[j]; a[j] = a[i]; a[i] = tmp; b = true; } } if(!b)break; } }...
Length; i++) { } stopWatch.Stop(); UnityEngine.Debug.Log("Time Taken By Array "+stopWatch.ElapsedMilliseconds + "ms"); stopWatch.Reset(); #endregion #region LIST_ITERATION stopWatch.Start(); for (int i = 0; i < intList.Count; i++) { } stopWatch.Stop(); UnityEngine.Debug....
//这是一个数据bundle,用来表示多行/列的数据publicclassViewCellBundle<TCell>:IPoolObjectwhereTCell:MonoBehaviour{publicintindex;publicVector2position;publicTCell[]Cells{get;privateset;}publicintCellCapacity=>Cells.Length;publicViewCellBundle(intgameObjectCapacity){Cells=newTCell[gameObjectCapacity];}public...
在框选时,还需要清除上一次框选的内容,因此我们使用一个List列表来记录当前框选的战斗单位,框选前遍历该列表来清除框选记录,完整代码如下: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 publicclassExample:MonoBehaviour{//光线渲染器组件privateLineRenderer lineRenderer;//屏幕坐标系起始点privateVector3 scre...
Material[] list = go.renderer.materials; #else Material[] list = go.renderer.sharedMaterials; #endif for(inti = 0; i < list.Length; i++) { list[i].SetFloat("_MinX", m_MinX); list[i].SetFloat("_MinY", m_MinY); list[i].SetFloat("_MaxX", m_MaxX); ...
public List<Vector3> anchors = new List<Vector3>(); Vector3[] curveAnchors; public int PointCount; public Action PathChanged;//path curve changed /// /// max anchor count /// public int MaxAnchor = 10; /// /// smoothy
后来发现直接用List好像也行,后面的Buff就使用了List来存储叠加的情况; [CreateAssetMenu(menuName="Create SkillTemp")] publicclassSkillTemp:ScriptableObject { public Skill skill = new Skill();/// 技能类型,可用 | 拼接>public DamageType[] damageType; } 继承了ScriptableObject...