예제 #1
0
    public void LoadLevel(int nSceneID, NFMsg.AckMiningTitle strData)
    {
        mnSceneID = nSceneID;

        NFRender.Instance.SetMainRoleAgentState(false);

        mnProgress = 0;
        NFrame.NFIElement xElement = NFrame.NFCKernelModule.Instance.GetElementModule().GetElement(nSceneID.ToString());
        if (null != xElement)
        {
            string strName   = xElement.QueryString("SceneName");
            string strUIName = xElement.QueryString("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");
            }

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

        //NFRender.Instance.SetMainRoleAgentState(true);
    }
예제 #2
0
    void PlaySceneMusic(int nSceneID)
    {
        NFrame.NFIElement xElement = NFrame.NFCKernelModule.Instance.GetElementModule().GetElement(nSceneID.ToString());
        if (null != xElement)
        {
            string   strName = xElement.QueryString("SoundList");
            string[] sArray  = strName.Split(',');
            if (sArray.Length > 0)
            {
                //随机播放一个
                int nIndex = Random.Range(0, (int)sArray.Length);
                if (nIndex >= 0 && nIndex < sArray.Length)
                {
                    string strMusicName = sArray[nIndex];
                    if (mstrLastMusicName != strMusicName)
                    {
                        mstrLastMusicName = strMusicName;

                        AudioClip xAudioClip = GameObject.Instantiate(Resources.Load(strMusicName)) as AudioClip;

                        mxAudioSource.clip        = xAudioClip;
                        mxAudioSource.rolloffMode = AudioRolloffMode.Custom;
                        mxAudioSource.volume      = fVolume;
                        mxAudioSource.loop        = true;
                        mxAudioSource.Play();
                        //mxAudioSource.PlayDelayed(fStartDelayTime);
                    }
                }
            }
        }
    }
예제 #3
0
        public override Int64 QueryPropertyInt(string strConfigName, string strPropertyName)
        {
            NFIElement xElement = GetElement(strConfigName);

            if (null != xElement)
            {
                return(xElement.QueryInt(strPropertyName));
            }

            return(0);
        }
예제 #4
0
        public override bool AddElement(string strName, NFIElement xElement)
        {
            if (!mhtObject.ContainsKey(strName))
            {
                mhtObject.Add(strName, xElement);

                return(true);
            }

            return(false);
        }
예제 #5
0
        public override string QueryPropertyString(string strConfigName, string strPropertyName)
        {
            NFIElement xElement = GetElement(strConfigName);

            if (null != xElement)
            {
                return(xElement.QueryString(strPropertyName));
            }

            return(NFIDataList.NULL_STRING);
        }
예제 #6
0
        public override double QueryPropertyFloat(string strConfigName, string strPropertyName)
        {
            NFIElement xElement = GetElement(strConfigName);

            if (null != xElement)
            {
                return(xElement.QueryFloat(strPropertyName));
            }

            return(0.0);
        }
예제 #7
0
        public override bool AddElement(string strName, NFIElement xElement)
        {
            if (!mhtObject.ContainsKey(strName))
            {
                mhtObject.Add(strName, xElement);

                return true;
            }

            return false;
        }
예제 #8
0
 public abstract bool AddElement(string strName, NFIElement xElement);
예제 #9
0
 public abstract bool AddElement(string strName, NFIElement xElement);
예제 #10
0
        private void LoadInstanceElement(NFILogicClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;

            strLogicPath += xLogicClass.GetInstance();

            XmlDocument xmldoc = new XmlDocument();

            if (xLogicClass.GetEncrypt())
            {
                ///////////////////////////////////////////////////////////////////////////////////////
                StreamReader cepherReader = new StreamReader(strLogicPath);;
                string       strContent   = cepherReader.ReadToEnd();
                cepherReader.Close();

                byte[] data = Convert.FromBase64String(strContent);

                string res = System.Text.ASCIIEncoding.Default.GetString(data);

                xmldoc.LoadXml(res);
                /////////////////////////////////////////////////////////////////
            }
            else
            {
                xmldoc.Load(strLogicPath);
            }

            XmlNode xRoot = xmldoc.SelectSingleNode("XML");

            XmlNodeList xNodeList = xRoot.SelectNodes("Object");

            for (int i = 0; i < xNodeList.Count; ++i)
            {
                //NFCLog.Instance.Log("Class:" + xLogicClass.GetName());

                XmlNode      xNodeClass = xNodeList.Item(i);
                XmlAttribute strID      = xNodeClass.Attributes["Id"];

                //NFCLog.Instance.Log("ClassID:" + strID.Value);

                NFIElement xElement = GetElement(strID.Value);
                if (null == xElement)
                {
                    xElement = new NFCElement();
                    AddElement(strID.Value, xElement);
                    xLogicClass.AddConfigName(strID.Value);

                    XmlAttributeCollection xCollection = xNodeClass.Attributes;
                    for (int j = 0; j < xCollection.Count; ++j)
                    {
                        XmlAttribute xAttribute = xCollection[j];
                        NFIProperty  xProperty  = xLogicClass.GetPropertyManager().GetProperty(xAttribute.Name);
                        if (null != xProperty)
                        {
                            NFIDataList.VARIANT_TYPE eType = xProperty.GetType();
                            switch (eType)
                            {
                            case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddInt(int.Parse(xAttribute.Value));
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddFloat(float.Parse(xAttribute.Value));
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddString(xAttribute.Value);
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddObject(new NFGUID(0, int.Parse(xAttribute.Value)));
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
예제 #11
0
        private void LoadInstanceElement(NFIClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;

            strLogicPath += xLogicClass.GetInstance();

            strLogicPath = strLogicPath.Replace(".xml", "");

            TextAsset textAsset = (TextAsset)Resources.Load(strLogicPath);

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.LoadXml(textAsset.text);
            XmlNode xRoot = xmldoc.SelectSingleNode("XML");

            XmlNodeList xNodeList = xRoot.SelectNodes("Object");

            for (int i = 0; i < xNodeList.Count; ++i)
            {
                //NFCLog.Instance.Log("Class:" + xLogicClass.GetName());

                XmlNode      xNodeClass = xNodeList.Item(i);
                XmlAttribute strID      = xNodeClass.Attributes["Id"];

                //NFCLog.Instance.Log("ClassID:" + strID.Value);

                NFIElement xElement = GetElement(strID.Value);
                if (null == xElement)
                {
                    xElement = new NFCElement();
                    AddElement(strID.Value, xElement);
                    xLogicClass.AddConfigName(strID.Value);

                    XmlAttributeCollection xCollection = xNodeClass.Attributes;
                    for (int j = 0; j < xCollection.Count; ++j)
                    {
                        XmlAttribute xAttribute = xCollection[j];
                        NFIProperty  xProperty  = xLogicClass.GetPropertyManager().GetProperty(xAttribute.Name);
                        if (null != xProperty)
                        {
                            NFDataList.VARIANT_TYPE eType = xProperty.GetType();
                            switch (eType)
                            {
                            case NFDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                NFDataList xValue = new NFDataList();
                                xValue.AddInt(int.Parse(xAttribute.Value));
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_FLOAT:
                            {
                                NFDataList xValue = new NFDataList();
                                xValue.AddFloat(float.Parse(xAttribute.Value));
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                NFDataList xValue = new NFDataList();
                                xValue.AddString(xAttribute.Value);
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_OBJECT:
                            {
                                NFDataList xValue = new NFDataList();
                                xValue.AddObject(new NFGUID(0, int.Parse(xAttribute.Value)));
                                NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                property.SetUpload(xProperty.GetUpload());
                            }
                            break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }