示例#1
0
        /// <summary>
        /// 加载地图包
        /// </summary>
        /// <param name="ScenePack">地图包</param>
        IEnumerator ILoadScenePack(ScenePack scenePack)
        {
            if (SceneManager.GetActiveScene().name != "2")
            {
                SceneManager.LoadScene("2", LoadSceneMode.Single);//打开level
            }
            yield return(null);

            loadScenePack(scenePack);
        }
示例#2
0
 void loadScenePack(ScenePack scenePack)
 {
     hideFloorBig();
     ReadSceneSetting(scenePack);
     try { GetComponent <MeshMod>().ReadScene(scenePack); } catch { }
     try { GetComponent <TriggerMod>().ReadScene(scenePack); } catch { }
     try { GetComponent <CubeMod>().ReadScene(scenePack); } catch { }
     try { GetComponent <WaterMod>().ReadScene(scenePack); } catch { }
     try { GetComponent <CloudMod>().ReadScene(scenePack); } catch { }
     try { GetComponent <SnowMod>().ReadScene(scenePack); } catch { }
     try { GetComponent <SkyMod>().ReadScene(scenePack); } catch { }
 }
示例#3
0
    static int set_abNames(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ScenePack obj  = (ScenePack)o;
            string[]  arg0 = ToLua.CheckStringArray(L, 2);
            obj.abNames = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index abNames on a nil value"));
        }
    }
示例#4
0
    static int get_abNames(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ScenePack obj = (ScenePack)o;
            string[]  ret = obj.abNames;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index abNames on a nil value"));
        }
    }
示例#5
0
    static int get_sceneName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ScenePack obj = (ScenePack)o;
            string    ret = obj.sceneName;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index sceneName on a nil value"));
        }
    }
示例#6
0
    static int _CreateScenePack(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                ScenePack obj = new ScenePack();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: ScenePack.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#7
0
        /// <summary>
        /// 加载地图包 多人模式下
        /// </summary>
        /// <param name="ScenePack">地图包</param>
        IEnumerator ILoadScenePack_Multiplayer(ScenePack scenePack)
        {
            yield return(null);

            loadScenePack(scenePack);
        }
示例#8
0
//        //读取地图地图设定 参数:地图包

//        public void ReadSceneSetting(ScenePack scenePack)
//        {
//            Resources.UnloadUnusedAssets();


//            try
//            {
//#if DEBUG
//                GeoTools.Log(Application.dataPath);
//#endif
//                if (!File.Exists(scenePack.SettingFilePath))
//                {
//                    GeoTools.Log("Error! Scene File not exists!");
//                    return;
//                }

//                FileStream fs = new FileStream(scenePack.SettingFilePath, FileMode.Open);
//                //打开数据文件
//                StreamReader srd = new StreamReader(fs, Encoding.Default);

//                while (srd.Peek() != -1)
//                {
//                    string str = srd.ReadLine();
//                    string[] chara = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
//                    if (chara.Length > 2)
//                    {
//                        #region Camera
//                        if (chara[0] == "Camera")
//                        {
//                            if (chara[1] == "farClipPlane")
//                            {
//                                try
//                                {
//                                    GameObject.Find("Main Camera").GetComponent<Camera>().farClipPlane = Convert.ToInt32(chara[2]);
//                                }
//                                catch (Exception ex)
//                                {
//                                    GeoTools.Log("farClipPlane Error");
//                                    GeoTools.Log(ex.ToString());
//                                }
//                            }
//                            else if (chara[1] == "focusLerpSmooth")
//                            {
//                                try
//                                {
//                                    if (chara[2] == "Infinity")
//                                    {
//                                        GameObject.Find("Main Camera").GetComponent<MouseOrbit>().focusLerpSmooth = float.PositiveInfinity;
//                                    }
//                                    else
//                                    {
//                                        GameObject.Find("Main Camera").GetComponent<MouseOrbit>().focusLerpSmooth = Convert.ToSingle(chara[2]);
//                                    }
//                                }
//                                catch (Exception ex)
//                                {
//                                    GeoTools.Log("focusLerpSmooth Error");
//                                    GeoTools.Log(ex.ToString());
//                                }
//                            }
//                            else if (chara[1] == "fog")
//                            {
//                                try
//                                {
//                                    GameObject.Find("Fog Volume").transform.localScale = new Vector3(0, 0, 0);
//                                }
//                                catch
//                                {
//                                    try
//                                    {
//                                        GameObject.Find("Fog Volume Dark").transform.localScale = new Vector3(0, 0, 0);
//                                    }
//                                    catch
//                                    {
//                                        GeoTools.Log("fog error");
//                                    }
//                                }
//                            }
//                            else if (chara[1] == "SSAO")
//                            {
//                                //if (chara[2] == "OFF")
//                                //{
//                                //    GeoTools.Log("SSAO OFF");
//                                //    OptionsMaster.SSAO = true;
//                                //    FindObjectOfType<ToggleAO>().Set();
//                                //}
//                                //else if (chara[2] == "ON")
//                                //{
//                                //    GeoTools.Log("SSAO ON");
//                                //    OptionsMaster.SSAO = false;
//                                //    FindObjectOfType<ToggleAO>().Set();
//                                //}

//                            }

//                        }
//                        #endregion
//                    }
//                }
//                srd.Close();

//                GeoTools.Log("ReadSceneUI Completed!");
//            }
//            catch (Exception ex)
//            {
//                GeoTools.Log("ReadSceneUI Failed!");
//                GeoTools.Log(ex.ToString());
//                return;
//            }
//        }



        //读取地图地图设定 参数:地图包
        public void ReadSceneSetting(ScenePack scenePack)
        {
            Resources.UnloadUnusedAssets();

            SceneSetting SS = new SceneSetting();

            try
            {
#if DEBUG
                GeoTools.Log(Application.dataPath);
#endif
                if (!File.Exists(scenePack.SettingFilePath))
                {
                    GeoTools.Log("Error! Scene File not exists!");
                    return;
                }

                FileStream fs = new FileStream(scenePack.SettingFilePath, FileMode.Open);
                //打开数据文件
                StreamReader srd = new StreamReader(fs, Encoding.Default);

                while (srd.Peek() != -1)
                {
                    string   str   = srd.ReadLine();
                    string[] chara = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    if (chara.Length > 2)
                    {
                        #region Camera
                        if (chara[0] == nameof(Camera))
                        {
                            if (chara[1] == nameof(Camera.farClipPlane))
                            {
                                try
                                {
                                    GameObject.Find("Main Camera").GetComponent <Camera>().farClipPlane = Convert.ToInt32(chara[2]);
                                }
                                catch (Exception ex)
                                {
                                    GeoTools.Log("farClipPlane Error");
                                    GeoTools.Log(ex.ToString());
                                }
                            }
                            else if (chara[1] == nameof(SS.focusLerpSmooth))
                            {
                                try
                                {
                                    if (chara[2] == "Infinity")
                                    {
                                        GameObject.Find("Main Camera").GetComponent <MouseOrbit>().focusLerpSmooth = float.PositiveInfinity;
                                    }
                                    else
                                    {
                                        GameObject.Find("Main Camera").GetComponent <MouseOrbit>().focusLerpSmooth = Convert.ToSingle(chara[2]);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GeoTools.Log("focusLerpSmooth Error");
                                    GeoTools.Log(ex.ToString());
                                }
                            }
                            else if (chara[1] == nameof(SS.fog))
                            {
                                try
                                {
                                    GameObject.Find("Fog Volume").transform.localScale = new Vector3(0, 0, 0);
                                }
                                catch
                                {
                                    try
                                    {
                                        GameObject.Find("Fog Volume Dark").transform.localScale = new Vector3(0, 0, 0);
                                    }
                                    catch
                                    {
                                        GeoTools.Log("fog error");
                                    }
                                }
                            }
                            else if (chara[1] == nameof(SceneSetting.SSAO))
                            {
                                //if (chara[2] == "OFF")
                                //{
                                //    GeoTools.Log("SSAO OFF");
                                //    OptionsMaster.SSAO = true;
                                //    FindObjectOfType<ToggleAO>().Set();
                                //}
                                //else if (chara[2] == "ON")
                                //{
                                //    GeoTools.Log("SSAO ON");
                                //    OptionsMaster.SSAO = false;
                                //    FindObjectOfType<ToggleAO>().Set();
                                //}
                            }
                        }
                        #endregion
                    }
                }
                srd.Close();

                GeoTools.Log("ReadSceneSetting Completed!");
            }
            catch (Exception ex)
            {
                GeoTools.Log("ReadSceneSetting Failed!");
                GeoTools.Log(ex.ToString());
                return;
            }
        }