예제 #1
0
    public void LoadLevel(int nSceneID, Vector3 vector)
    {
        mnSceneID      = nSceneID;
        bar.fillAmount = 0;

        mnProgress = 0;
        NFSDK.NFIElement xElement = mElementModule.GetElement(nSceneID.ToString());
        if (null != xElement)
        {
            string strName   = xElement.QueryString(NFrame.Scene.SceneName);
            string strUIName = xElement.QueryString(NFrame.Scene.LoadingUI);

            UnityEngine.SceneManagement.Scene xSceneInfo = SceneManager.GetActiveScene();
            if (xSceneInfo.name == strName)
            {
                //Debug.LogWarning ("begin the same scene" + strSceneID);
                //SceneManager.LoadScene (xSceneInfo.buildIndex);
                //Debug.LogWarning ("end the same scene" + strSceneID);
                //load a empty scene then load this scene asy

                //SceneManager.LoadScene ("EmptyScene");
            }

            //Debug.Log("mnProgress----start " + mnProgress + " " + Time.time);

            StartCoroutine(LoadLevel(nSceneID, strName, vector, strUIName));
        }
        else
        {
            //Debug.LogError ("LoadLevel error: " + nSceneID);
        }

        //NFRender.Instance.SetMainRoleAgentState(true);
    }
예제 #2
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;
        }
    }