Exemplo n.º 1
0
    private void DestroyObject(int row)
    {
        int nIndex = -1;

        for (int i = 0; i < _data.Count; ++i)
        {
            NFRecordRowData rowData = _data[i];
            if (rowData.row == row)
            {
                nIndex = i;
                break;
            }
        }

        if (nIndex >= 0)
        {
            _data.RemoveAt(nIndex);
        }

        NFRecordRowView[] rowViews = this.GetComponentsInChildren <NFRecordRowView>();
        for (int i = 0; i < rowViews.Length; ++i)
        {
            NFRecordRowData rowData = rowViews[i].GetData();
            if (rowData != null &&
                rowData.row == row)
            {
                GameObject.Destroy(rowViews[i].gameObject);
                break;
            }
        }
    }
Exemplo n.º 2
0
 public void ClickEvent(NFRecordRowData data)
 {
     for (int i = 0; i < clickEventHandler.Count; ++i)
     {
         NFRecordRowView.RowClickEventHandler handler = clickEventHandler [i];
         handler(data);
     }
 }
Exemplo n.º 3
0
 public void UpEvent(NFRecordRowData data)
 {
     for (int i = 0; i < pressUpEventHandler.Count; ++i)
     {
         NFRecordRowView.RowPressUpEventHandler handler = pressUpEventHandler[i];
         handler(data);
     }
 }
Exemplo n.º 4
0
    private IEnumerator CreateObject(NFGUID self, NFRecordRowView go, NFRecordRowData rowData)
    {
        NFRecordRowView rowObject = GameObject.Instantiate(rowViewItem);

        if (rowObject)
        {
            rowObject.transform.parent = this.transform;
            rowObject.SetData(self, recordName, this, rowData);
        }

        yield return(0);
    }
Exemplo n.º 5
0
    private IEnumerator CreateObject(NFGUID self, NFRecordRowView go, NFRecordRowData rowData)
    {
        yield return(0);

        NFRecordRowView rowObject = GameObject.Instantiate(go);

        if (rowObject)
        {
            rowObject.transform.SetParent(this.transform);
            rowObject.transform.localScale = Vector3.one;
            rowObject.SetData(self, recordName, this, rowData);
        }
    }
Exemplo n.º 6
0
    public void SetData(NFGUID xGUID, string strRecordName, NFRecordController xController, NFRecordRowData xData)
    {
        data       = xData;
        controller = xController;

        if (data != null)
        {
            foreach (KeyValuePair <int, NFRecordColView> entry in colViewList)
            {
                NFIRecord xRecord = mkernelModule.FindRecord(xGUID, strRecordName);

                entry.Value.Refresh(xGUID, xRecord.QueryRowCol(data.row, entry.Key));
            }

            xController.UpdateEvent(xData.id, xData.recordName, xData.row, this);
        }
    }
Exemplo n.º 7
0
    void RecordEventHandler(NFGUID self, string strRecordName, NFIRecord.ERecordOptype eType, int nRow, int nCol, NFDataList.TData oldVar, NFDataList.TData newVar)
    {
        if (ColValueCondition)
        {
            if (ColConditionNum >= 0 && ColConditionContent.Length > 0)
            {
                NFIRecord xRecord = mkernelModule.FindRecord(self, recordName);
                if (xRecord != null)
                {
                    if (xRecord.GetCols() > ColConditionNum)
                    {
                        switch (xRecord.GetColType(ColConditionNum))
                        {
                        case NFDataList.VARIANT_TYPE.VTYPE_INT:
                        {
                            long value = xRecord.QueryInt(nRow, ColConditionNum);
                            if (value.ToString() != ColConditionContent)
                            {
                                return;
                            }
                        }
                        break;

                        case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                        {
                            string value = xRecord.QueryString(nRow, ColConditionNum);
                            if (value != ColConditionContent)
                            {
                                return;
                            }
                        }
                        break;

                        default:
                            break;
                        }
                    }
                }
            }
        }

        if (ColPropertyCondition)
        {
            if (ColConditionNum >= 0 && ColConditionPropertyName.Length > 0 && ColConditionPropertyValue.Length > 0)
            {
                NFIRecord xRecord = mkernelModule.FindRecord(self, recordName);
                if (xRecord != null)
                {
                    if (xRecord.GetCols() > ColConditionNum)
                    {
                        switch (xRecord.GetColType(ColConditionNum))
                        {
                        case NFDataList.VARIANT_TYPE.VTYPE_INT:
                        {
                            long       value    = xRecord.QueryInt(nRow, ColConditionNum);
                            NFIElement xElement = mElementModule.GetElement(value.ToString());
                            if (xElement == null)
                            {
                                Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value.ToString());
                                return;
                            }

                            NFIProperty xProperty = xElement.GetPropertyManager().GetProperty(ColConditionPropertyName);
                            if (xProperty == null)
                            {
                                Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value.ToString() + " Property:" + ColConditionPropertyName);
                                return;
                            }

                            if (xProperty.GetData() != null)
                            {
                                switch (xProperty.GetData().GetType())
                                {
                                case NFDataList.VARIANT_TYPE.VTYPE_INT:
                                {
                                    if (xProperty.QueryInt().ToString() != ColConditionPropertyValue)
                                    {
                                        return;
                                    }
                                }
                                break;

                                case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                                {
                                    if (xProperty.QueryString() != ColConditionPropertyValue)
                                    {
                                        return;
                                    }
                                }
                                break;
                                }
                            }
                        }
                        break;

                        case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                        {
                            string     value    = xRecord.QueryString(nRow, ColConditionNum);
                            NFIElement xElement = mElementModule.GetElement(value);
                            if (xElement == null)
                            {
                                Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value);
                                return;
                            }

                            NFIProperty xProperty = xElement.GetPropertyManager().GetProperty(ColConditionPropertyName);
                            if (xProperty == null)
                            {
                                Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value + " Property:" + ColConditionPropertyName);
                                return;
                            }

                            if (xProperty.GetData() != null)
                            {
                                switch (xProperty.GetData().GetType())
                                {
                                case NFDataList.VARIANT_TYPE.VTYPE_INT:
                                {
                                    if (xProperty.QueryInt().ToString() != ColConditionPropertyValue)
                                    {
                                        return;
                                    }
                                }
                                break;

                                case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                                {
                                    if (xProperty.QueryString() != ColConditionPropertyValue)
                                    {
                                        return;
                                    }
                                }
                                break;
                                }
                            }
                        }
                        break;

                        default:
                            break;
                        }
                    }
                }
            }
        }

        switch (eType)
        {
        case NFIRecord.ERecordOptype.Add:
        {
            NFRecordRowData rowData = new NFRecordRowData();
            rowData.row        = nRow;
            rowData.recordName = strRecordName;
            rowData.id         = self;

            _data.Add(rowData);

            StartCoroutine(CreateObject(self, rowViewItem, rowData));
        }
        break;

        case NFIRecord.ERecordOptype.Del:
        {
            int nIndex = -1;
            for (int i = 0; i < _data.Count; ++i)
            {
                NFRecordRowData rowData = _data[i];
                if (rowData.row == nRow)
                {
                    nIndex = nRow;
                    break;
                }
            }

            if (nIndex >= 0)
            {
                _data.RemoveAt(nIndex);
            }

            NFRecordRowView[] rowViews = this.GetComponentsInChildren <NFRecordRowView>();
            for (int i = 0; i < rowViews.Length; ++i)
            {
                NFRecordRowData rowData = rowViews[i].GetData();
                if (rowData != null &&
                    rowData.row == nRow)
                {
                    GameObject.Destroy(rowViews[i].gameObject);
                    break;
                }
            }
        }
        break;

        case NFIRecord.ERecordOptype.Update:
        {
            NFRecordRowView[] rowViews = this.GetComponentsInChildren <NFRecordRowView>();
            for (int i = 0; i < rowViews.Length; ++i)
            {
                NFRecordRowData rowData = rowViews[i].GetData();
                if (rowData != null &&
                    rowData.row == nRow)
                {
                    rowViews[i].SetData(self, recordName, this, rowData);
                    break;
                }
            }
        }
        break;

        case NFIRecord.ERecordOptype.Create:
            break;

        case NFIRecord.ERecordOptype.Cleared:
            _data.Clear();
            break;

        default:
            break;
        }
    }