public void RemoveRowAt()
        {
            if (!UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject)))
            {
                Debug.Log("ArrayListTable not found for " + PlayMakerUtils.LogFullPathToAction(this));
                Fsm.Event(failureEvent);
                return;
            }

            _at    = this.cachedComponent as ArrayListTable;
            _error = string.Empty;
            _index = rowIndex.Value >= 0 ? rowIndex.Value : _at.ColumnData [0].arrayList.Count;


            if (_index < 0 || _index >= _at.ColumnData [0].arrayList.Count)
            {
                Debug.Log("Row index out of range for " + PlayMakerUtils.LogFullPathToAction(this));
                Fsm.Event(failureEvent);
                return;
            }

            try{
                int i = 0;
                foreach (PlayMakerArrayListProxy _column in _at.ColumnData)
                {
                    _column.arrayList.RemoveAt(_index);
                    i++;
                }
            }catch (System.Exception e) {
                Debug.Log(e.Message);
                Fsm.EventData.StringData = _error;
                Fsm.Event(failureEvent);
                return;
            }
        }
Пример #2
0
        public void AddNewRow()
        {
            if (!UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject)))
            {
                Debug.Log("ArrayListTable not found for " + PlayMakerUtils.LogFullPathToAction(this));
                Fsm.Event(failureEvent);
                return;
            }

            _at    = this.cachedComponent as ArrayListTable;
            _error = string.Empty;

            if (newRow.Length != _at.ColumnData.Length)
            {
                Debug.Log("Column count not matching the newRow count for " + PlayMakerUtils.LogFullPathToAction(this));
                Fsm.Event(failureEvent);
                return;
            }

            try{
                int i = 0;
                foreach (PlayMakerArrayListProxy _column in _at.ColumnData)
                {
                    _column.arrayList.Add(newRow.Values[i]);
                    i++;
                }
            }catch (System.Exception e) {
                Debug.Log(e.Message);
                Fsm.EventData.StringData = _error;
                Fsm.Event(failureEvent);
                return;
            }
        }
Пример #3
0
        public void GetRowAtIndex()
        {
            string _error = string.Empty;

            try{
                GameObject _go = Fsm.GetOwnerDefaultTarget(gameObject);

                if (_go != null)
                {
                    _at = _go.GetComponent <ArrayListTable>();
                }

                if (_at == null)
                {
                    Debug.Log("ArrayListTable not found for " + PlayMakerUtils.LogFullPathToAction(this));
                    Fsm.Event(failureEvent);
                    return;
                }

                // now we check the target is defined as well
                if (!SetUpHashTableProxyPointer(Fsm.GetOwnerDefaultTarget(gameObjectTarget), referenceTarget.Value))
                {
                    Debug.Log("ArrayList target not found for " + PlayMakerUtils.LogFullPathToAction(this));
                    Fsm.Event(failureEvent);
                    return;
                }

                if (!isProxyValid())
                {
                    Debug.Log("ArrayList proxy  not valid for " + PlayMakerUtils.LogFullPathToAction(this));
                    Fsm.Event(failureEvent);
                    return;
                }

                if (atRowIndex.Value < 0 || (atRowIndex.Value + 1) > _at.ColumnData[0].arrayList.Count)
                {
                    _error = "Row index out of range";
                    throw new UnityException(_error + " for " + PlayMakerUtils.LogFullPathToAction(this));
                }


                proxy.hashTable.Clear();

                int i = 0;
                foreach (PlayMakerArrayListProxy _column in _at.ColumnData)
                {
                    proxy.hashTable.Add(
                        _at.HeaderProxy.arrayList[i],
                        _column.arrayList[atRowIndex.Value]
                        );
                    i++;
                }
            }catch (System.Exception e) {
                Debug.Log(e.Message);
                Fsm.EventData.StringData = _error;
                Fsm.Event(failureEvent);
                return;
            }
        }
Пример #4
0
        public void ExecuteAction()
        {
            if (!UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject)))
            {
                Debug.Log("ArrayListTable not found for " + PlayMakerUtils.LogFullPathToAction(this));
                Fsm.Event(failureEvent);
                return;
            }

            ArrayListTable _at = this.cachedComponent as ArrayListTable;

            PlayMakerUtils.RefreshValueFromFsmVar(this.Fsm, value);

            int _column_i = 0;

            foreach (PlayMakerArrayListProxy _p in _at.ColumnData)
            {
                if (_p.arrayList.Contains(value.GetValue()))
                {
                    if (!rowIndexResult.IsNone)
                    {
                        rowIndexResult.Value = _p.arrayList.IndexOf(value.GetValue());
                    }
                    if (!columnIndexResult.IsNone)
                    {
                        columnIndexResult.Value = _column_i;
                    }
                    if (!columnNameResult.IsNone)
                    {
                        columnNameResult.Value = _at.GetColumnHeader(_column_i);
                    }

                    if (!isContained.IsNone)
                    {
                        isContained.Value = true;
                    }

                    Fsm.Event(isContainedEvent);

                    return;
                }
                _column_i++;
            }

            if (!isContained.IsNone)
            {
                isContained.Value = true;
            }

            Fsm.Event(isNotContainedEvent);
        }
Пример #5
0
        public void SetItemAtIndex()
        {
            if (!UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject)))
            {
                Debug.Log("ArrayListTable not found for " + PlayMakerUtils.LogFullPathToAction(this));
                Fsm.Event(failureEvent);
                return;
            }

            ArrayListTable _at = this.cachedComponent as ArrayListTable;

            int index = 0;

            string _error = string.Empty;

            try{
                if (UseColumnHeader)
                {
                    if (_at.HeaderProxy == null)
                    {
                        _error = "Header Proxy not defined";

                        throw new UnityException(_error + " for " + PlayMakerUtils.LogFullPathToAction(this));
                    }

                    index = _at.HeaderProxy.arrayList.IndexOf(atColumn.Value);

                    if (index < 0 || (index + 1) > _at.ColumnData.Length)
                    {
                        _error = "Header Column index out of range";
                        throw new UnityException(_error + " for " + PlayMakerUtils.LogFullPathToAction(this));
                    }
                }
                else
                {
                    index = atColumnIndex.Value;

                    if (index < 0 || (index + 1) > _at.ColumnData.Length)
                    {
                        _error = "Column index out of range";
                        throw new UnityException(_error + " for " + PlayMakerUtils.LogFullPathToAction(this));
                    }
                }

                if (atRowIndex.Value < 0 || (atRowIndex.Value + 1) > _at.ColumnData[atColumnIndex.Value].arrayList.Count)
                {
                    _error = "Row index out of range";
                    throw new UnityException(_error + " for " + PlayMakerUtils.LogFullPathToAction(this));
                }

                PlayMakerArrayListProxy _column = _at.ColumnData[index];
                if (_column == null)
                {
                    _error = "Column index not found";
                    throw new UnityException(_error + " for " + PlayMakerUtils.LogFullPathToAction(this));
                }

                _column._arrayList[atRowIndex.Value] = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, value);
            }catch (System.Exception e) {
                Debug.Log(e.Message);
                Fsm.EventData.StringData = _error;
                Fsm.Event(failureEvent);
                return;
            }
        }