예제 #1
0
        public void DoArrayListLastIndex()
        {
            if (!isProxyValid())
            {
                return;
            }

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

            int index = -1;

            try{
                if (startIndex.Value == 0 && count.Value == 0)
                {
                    index = PlayMakerUtils_Extensions.LastIndexOf(proxy.arrayList, item);
                }
                else if (count.Value == 0)
                {
                    if (startIndex.Value < 0 || startIndex.Value >= proxy.arrayList.Count)
                    {
                        Debug.LogError("start index out of range");
                        return;
                    }
                    index = PlayMakerUtils_Extensions.LastIndexOf(proxy.arrayList, item, startIndex.Value);
                }
                else
                {
                    if (startIndex.Value < 0 || startIndex.Value >= (proxy.arrayList.Count - count.Value))
                    {
                        Debug.LogError("start index and count out of range");
                        return;
                    }
                    index = PlayMakerUtils_Extensions.LastIndexOf(proxy.arrayList, item, startIndex.Value, count.Value);
                }
            }catch (System.Exception e) {
                Debug.LogError(e.Message + " on " + Fsm.GameObjectName + "\nFsm: " + Fsm.Name + "\nState: " + Fsm.ActiveStateName);
                Fsm.Event(failureEvent);
                return;
            }

            lastIndexOf.Value = index;
            if (index == -1)
            {
                Fsm.Event(itemNotFound);
            }
            else
            {
                Fsm.Event(itemFound);
            }
        }
 public static int LastIndexOf(ArrayList target, Object value, int startIndex)
 {
     return(PlayMakerUtils_Extensions.LastIndexOf(target, value, startIndex, startIndex + 1));
 }
 public static int LastIndexOf(ArrayList target, Object value)
 {
     return(PlayMakerUtils_Extensions.LastIndexOf(target, value, target.Count - 1, target.Count));
 }