コード例 #1
0
    public static int IndexOf(ArrayList target, Object value, int startIndex)
    {
        if (startIndex > target.Count)
        {
            throw new ArgumentOutOfRangeException("startIndex", "ArgumentOutOfRange_Index");
        }

        return(PlayMakerUtils_Extensions.IndexOf(target, value, startIndex, target.Count - startIndex));
    }
コード例 #2
0
        public void DoArrayListIndexOf()
        {
            if (!isProxyValid())
            {
                return;
            }

            object item = PlayMakerUtils.GetValueFromFsmVar(Fsm, variable);

            int indexOfResult = -1;

            try{
                if (startIndex.IsNone)
                {
                    UnityEngine.Debug.Log("hello");
                    indexOfResult = PlayMakerUtils_Extensions.IndexOf(proxy.arrayList, item);
                }
                else if (count.IsNone || count.Value == 0)
                {
                    if (startIndex.Value < 0 || startIndex.Value >= proxy.arrayList.Count)
                    {
                        LogError("start index out of range");
                        return;
                    }
                    indexOfResult = PlayMakerUtils_Extensions.IndexOf(proxy.arrayList, item);
                }
                else
                {
                    if (startIndex.Value < 0 || startIndex.Value >= (proxy.arrayList.Count - count.Value))
                    {
                        LogError("start index and count out of range");
                        return;
                    }
                    indexOfResult = PlayMakerUtils_Extensions.IndexOf(proxy.arrayList, item);
                }
            }catch (System.Exception e) {
                Debug.LogError(e.Message);
                Fsm.Event(failureEvent);
                return;
            }


            indexOf.Value = indexOfResult;
            if (indexOfResult == -1)
            {
                Fsm.Event(itemNotFound);
            }
            else
            {
                Fsm.Event(itemFound);
            }
        }
コード例 #3
0
 public static int IndexOf(ArrayList target, Object value)
 {
     return(PlayMakerUtils_Extensions.IndexOf(target, value, 0, target.Count));
 }