public void Change()
 {
     LightmapData[] lightmapDataArray = new LightmapData[this.light.Length];
     for (int index = 0; index < lightmapDataArray.Length; ++index)
     {
         LightmapData lightmapData = new LightmapData();
         lightmapData.set_lightmapDir(this.dir[index]);
         lightmapData.set_lightmapColor(this.light[index]);
         lightmapDataArray[index] = lightmapData;
     }
     LightmapSettings.set_lightmaps(lightmapDataArray);
     LightmapSettings.set_lightProbes(this.lightProbes);
     LightmapSettings.set_lightmapsMode(this.lightmapsMode);
     if (Object.op_Inequality((Object)this.cubemap, (Object)null))
     {
         RenderSettings.set_customReflection(this.cubemap);
         RenderSettings.set_defaultReflectionMode((DefaultReflectionMode)1);
     }
     else
     {
         RenderSettings.set_defaultReflectionMode((DefaultReflectionMode)0);
     }
     if (this.fog != null)
     {
         this.fog.Change();
     }
     OutputLog.Log("LightMapChange", true, "Log");
 }
Ejemplo n.º 2
0
 public void Apply()
 {
     //IL_0066: Unknown result type (might be due to invalid IL or missing references)
     //IL_006b: Expected O, but got Unknown
     //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
     if (lightProbes != null)
     {
         LightmapSettings.set_lightProbes(lightProbes);
         ShaderGlobal.lightProbe = true;
     }
     else
     {
         ShaderGlobal.lightProbe = false;
     }
     if (lightmapsFar != null && lightmapsFar.Length > 0)
     {
         LightmapData[] array = (LightmapData[])new LightmapData[lightmapsFar.Length];
         int            i     = 0;
         for (int num = lightmapsFar.Length; i < num; i++)
         {
             array[i] = new LightmapData();
             array[i].set_lightmapFar(lightmapsFar[i]);
             if (i < lightmapsNear.Length)
             {
                 array[i].set_lightmapNear(lightmapsNear[i]);
             }
         }
         LightmapSettings.set_lightmapsMode(lightmapMode);
         LightmapSettings.set_lightmaps(array);
     }
 }
        public override void OnInspectorGUI()
        {
            if (GUILayout.Button("Render Settings"))
            {
                var objs = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(target));
                foreach (var obj in objs)
                {
                    if (obj is RenderSettings)
                    {
                        Selection.activeObject = obj;
                    }
                }
            }

            if (GUILayout.Button("Lightmap Settings"))
            {
                var objs = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(target));
                foreach (var obj in objs)
                {
                    if (obj is LightmapSettings)
                    {
                        Selection.activeObject = obj;
                    }
                }
            }

            EditorGUILayout.Space();

            if (GUILayout.Button("Copy Lighting Settings to Active Scene"))
            {
                RenderSettings   rs = null;
                LightmapSettings ls = null;
                var objs            = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(target));
                foreach (var obj in objs)
                {
                    if (obj is RenderSettings)
                    {
                        rs = (RenderSettings)obj;
                    }
                    else
                    if (obj is LightmapSettings)
                    {
                        ls = (LightmapSettings)obj;
                    }
                }

                if (rs && ls)
                {
                    CopyLightingSettings.CopySettings(rs, ls);
                    CopyLightingSettings.PasteSettings();
                    CopyLightingSettings.ResetStoredData();
                }
            }
        }
Ejemplo n.º 4
0
    public static void UpdateLightmap(int sceneId)
    {
        string text  = null;
        Scene  scene = DataReader <Scene> .Get(sceneId);

        if (scene == null)
        {
            return;
        }
        if (!string.IsNullOrEmpty(scene.lightmap))
        {
            text = scene.lightmap;
        }
        else
        {
            string[] array = scene.path.Split(new char[]
            {
                '/'
            });
            if (array.Length > 0)
            {
                text = array[array.Length - 1];
            }
        }
        if (string.IsNullOrEmpty(text))
        {
            return;
        }
        string pathOfPrefab = FileSystem.GetPathOfPrefab(text);

        if (string.IsNullOrEmpty(pathOfPrefab))
        {
            return;
        }
        GameObject gameObject = AssetManager.AssetOfNoPool.LoadAssetNowNoAB(pathOfPrefab, typeof(Object)) as GameObject;

        if (gameObject != null)
        {
            PrefabLightmap component = gameObject.GetComponent <PrefabLightmap>();
            if (component == null)
            {
                return;
            }
            LightmapData[] array2 = new LightmapData[component.lightmap_far.get_Count()];
            for (int i = 0; i < array2.Length; i++)
            {
                array2[i] = new LightmapData();
                array2[i].set_lightmapFar(component.lightmap_far.get_Item(i));
            }
            LightmapSettings.set_lightmaps(array2);
            LightmapSettings.set_lightmapsMode(0);
        }
    }
Ejemplo n.º 5
0
 public static void PasteSettings(RenderSettings rs, LightmapSettings ls)
 {
     using (var srcSO = new SerializedObject(renderSettings))
         using (var dstSO = new SerializedObject(rs))
         {
             dstSO.CopySerializedObject(srcSO, new string[1] {
                 "m_Sun"
             });
         }
     using (var srcSO = new SerializedObject(lightmapSettings))
         using (var dstSO = new SerializedObject(ls))
         {
             dstSO.CopySerializedObject(srcSO, new string[1] {
                 "m_LightingDataAsset"
             });
         }
 }
Ejemplo n.º 6
0
    public static int constructor(IntPtr l)
    {
        int result;

        try
        {
            LightmapSettings o = new LightmapSettings();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Ejemplo n.º 7
0
    static int _CreateLightmapSettings(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            LightmapSettings obj = new LightmapSettings();
            LuaScriptMgr.Push(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: LightmapSettings.New");
        }

        return(0);
    }
        void ExtractProbeData()
        {
            bool validFolder = AssetDatabase.IsValidFolder("Assets/LightingData");

            if (!validFolder)
            {
                AssetDatabase.CreateFolder("Assets", "LightingData");
            }

            string            sceneName      = EditorSceneManager.GetActiveScene().name;
            string            probeAssetPath = "Assets/LightingData/" + sceneName + ".probes.asset";
            LightingDataAsset lightingAsset  = Lightmapping.lightingDataAsset;

            if (lightingAsset != null)
            {
                AssetDatabase.CreateAsset(LightmapSettings.Instantiate(LightmapSettings.lightProbes), probeAssetPath);
            }
        }
Ejemplo n.º 9
0
 public override void OnActivate()
 {
     this.Sequence.Scene = (GameObject)null;
     LightmapSettings.set_lightmapsMode((LightmapsMode)0);
     if (!string.IsNullOrEmpty(this.SceneID))
     {
         if (this.FadeIn)
         {
             GameUtility.FadeOut(0.0f);
         }
         SceneAwakeObserver.AddListener(new SceneAwakeObserver.SceneEvent(this.OnSceneLoad));
         CriticalSection.Enter(CriticalSections.SceneChange);
         this.mAsyncOp = AssetManager.LoadSceneAsync(this.SceneID, true);
     }
     else
     {
         if (!Object.op_Inequality((Object)this.Sequence.Scene, (Object)null))
         {
             return;
         }
         this.Sequence.Scene = (GameObject)null;
         this.ActivateNext();
     }
 }
Ejemplo n.º 10
0
 private void ResetSettings(object userData, string[] options, int selected)
 {
     RenderSettings.Reset();
     LightmapEditorSettings.Reset();
     LightmapSettings.Reset();
 }
Ejemplo n.º 11
0
 private void OnDisable()
 {
     LightmapSettings.set_lightmaps((LightmapData[])null);
     LightmapSettings.set_lightProbes(null);
 }
Ejemplo n.º 12
0
    private IEnumerator LoadStageCoroutine(string id)
    {
        isLoadingStage     = true;
        insideColliderData = null;
        isValidInside      = false;
        UnloadStage();
        Input.get_gyro().set_enabled(false);
        currentStageName = id;
        StageTable.StageData data = null;
        if (!string.IsNullOrEmpty(id))
        {
            if (!Singleton <StageTable> .IsValid())
            {
                yield break;
            }
            data = Singleton <StageTable> .I.GetData(id);

            if (data == null)
            {
                yield break;
            }
            LoadingQueue load_queue   = new LoadingQueue(this);
            AssetBundle  asset_bundle = null;
            EffectObject.wait = true;
            string load_scene_name = data.scene;
            if (ResourceManager.internalMode)
            {
                load_scene_name = $"internal__STAGE_SCENE__{load_scene_name}";
            }
            else if (ResourceManager.isDownloadAssets)
            {
                load_queue.Load(RESOURCE_CATEGORY.STAGE_SCENE, data.scene, null, true);
                yield return((object)load_queue.Wait());

                PackageObject package = MonoBehaviourSingleton <ResourceManager> .I.cache.PopCachedPackage(RESOURCE_CATEGORY.STAGE_SCENE.ToAssetBundleName(data.scene));

                asset_bundle = ((package == null) ? null : (package.obj as AssetBundle));
            }
            AsyncOperation ao = SceneManager.LoadSceneAsync(load_scene_name);
            ResourceManager.enableCache = false;
            LoadObject lo_sky = null;
            if (!string.IsNullOrEmpty(data.sky))
            {
                lo_sky = load_queue.Load(RESOURCE_CATEGORY.STAGE_SKY, data.sky, false);
            }
            ResourceManager.enableCache = true;
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, data.cameraLinkEffect);
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, data.cameraLinkEffectY0);
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, data.rootEffect);
            for (int i = 0; i < 8; i++)
            {
                load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, data.useEffects[i]);
            }
            if (load_queue.IsLoading())
            {
                yield return((object)load_queue.Wait());
            }
            while (!ao.get_isDone())
            {
                yield return((object)null);
            }
            EffectObject.wait = false;
            if (asset_bundle != null)
            {
                asset_bundle.Unload(false);
            }
            if (MonoBehaviourSingleton <SceneSettingsManager> .IsValid())
            {
                stageObject = MonoBehaviourSingleton <SceneSettingsManager> .I.get_transform();

                stageObject.set_parent(base._transform);
            }
            if (lo_sky != null)
            {
                skyObject = ResourceUtility.Realizes(lo_sky.loadedObject, base._transform, -1);
            }
            bool is_field_stage = id.StartsWith("FI");
            if (stageObject != null && is_field_stage && (!MonoBehaviourSingleton <SceneSettingsManager> .IsValid() || !MonoBehaviourSingleton <SceneSettingsManager> .I.forceFogON))
            {
                ChangeLightShader(base._transform);
            }
            cameraLinkEffect   = EffectManager.GetCameraLinkEffect(data.cameraLinkEffect, false, base._transform);
            cameraLinkEffectY0 = EffectManager.GetCameraLinkEffect(data.cameraLinkEffectY0, true, base._transform);
            rootEffect         = EffectManager.GetEffect(data.rootEffect, base._transform);
            if (MonoBehaviourSingleton <SceneSettingsManager> .IsValid())
            {
                MonoBehaviourSingleton <SceneSettingsManager> .I.attributeID = data.attributeID;
                SceneParameter sp = MonoBehaviourSingleton <SceneSettingsManager> .I.GetComponent <SceneParameter>();

                if (sp != null)
                {
                    sp.Apply();
                }
                if (is_field_stage && !MonoBehaviourSingleton <SceneSettingsManager> .I.forceFogON)
                {
                    ShaderGlobal.fogColor     = (MonoBehaviourSingleton <SceneSettingsManager> .I.fogColor = new Color(0f, 0f, 0f, 0f));
                    ShaderGlobal.fogNear      = (MonoBehaviourSingleton <SceneSettingsManager> .I.linearFogStart = 0f);
                    ShaderGlobal.fogFar       = (MonoBehaviourSingleton <SceneSettingsManager> .I.linearFogEnd = 3.40282347E+38f);
                    ShaderGlobal.fogNearLimit = (MonoBehaviourSingleton <SceneSettingsManager> .I.limitFogStart = 0f);
                    ShaderGlobal.fogFarLimit  = (MonoBehaviourSingleton <SceneSettingsManager> .I.limitFogEnd = 1f);
                }
                if (MonoBehaviourSingleton <SceneSettingsManager> .I.saveInsideCollider && MonoBehaviourSingleton <SceneSettingsManager> .I.insideColliderData != null && (MonoBehaviourSingleton <SceneSettingsManager> .I.insideColliderData.minX != 0 || MonoBehaviourSingleton <SceneSettingsManager> .I.insideColliderData.maxX != 0 || MonoBehaviourSingleton <SceneSettingsManager> .I.insideColliderData.minZ != 0 || MonoBehaviourSingleton <SceneSettingsManager> .I.insideColliderData.maxZ != 0))
                {
                    isValidInside = true;
                }
                if (isValidInside)
                {
                    insideColliderData = MonoBehaviourSingleton <SceneSettingsManager> .I.insideColliderData;
                }
            }
        }
        else if (MonoBehaviourSingleton <SceneSettingsManager> .IsValid())
        {
            ShaderGlobal.lightProbe = true;
        }
        ShaderGlobal.lightProbe = (LightmapSettings.get_lightProbes() != null);
        currentStageData        = data;
        if (MonoBehaviourSingleton <SceneSettingsManager> .IsValid())
        {
            WeatherController weatherController = MonoBehaviourSingleton <SceneSettingsManager> .I.weatherController;
            if (cameraLinkEffect != null)
            {
                cameraLinkEffect.get_gameObject().SetActive(!weatherController.cameraLinkEffectEnable);
            }
            if (cameraLinkEffectY0 != null)
            {
                cameraLinkEffectY0.get_gameObject().SetActive(!weatherController.cameraLinkEffectY0Enable);
            }
        }
        isLoadingStage = false;
    }
Ejemplo n.º 13
0
 public static void ResetStoredData()
 {
     renderSettings   = null;
     lightmapSettings = null;
 }
Ejemplo n.º 14
0
 public static void CopySettings(RenderSettings rs, LightmapSettings ls)
 {
     renderSettings   = rs;
     lightmapSettings = ls;
 }
Ejemplo n.º 15
0
        private static Object ReadAsset(AssetStream stream, AssetInfo assetInfo, long offset, int size)
        {
            Object asset;

            switch (assetInfo.ClassID)
            {
            case ClassIDType.GameObject:
                asset = new GameObject(assetInfo);
                break;

            case ClassIDType.Transform:
                asset = new Transform(assetInfo);
                break;

            case ClassIDType.Camera:
                asset = new Camera(assetInfo);
                break;

            case ClassIDType.Material:
                asset = new Material(assetInfo);
                break;

            case ClassIDType.MeshRenderer:
                asset = new MeshRenderer(assetInfo);
                break;

            case ClassIDType.Texture2D:
                asset = new Texture2D(assetInfo);
                break;

            case ClassIDType.SceneSettings:
                asset = new OcclusionCullingSettings(assetInfo);
                break;

            case ClassIDType.MeshFilter:
                asset = new MeshFilter(assetInfo);
                break;

            case ClassIDType.OcclusionPortal:
                asset = new OcclusionPortal(assetInfo);
                break;

            case ClassIDType.Mesh:
                asset = new Mesh(assetInfo);
                break;

            case ClassIDType.Shader:
                asset = new Shader(assetInfo);
                break;

            case ClassIDType.TextAsset:
                asset = new TextAsset(assetInfo);
                break;

            case ClassIDType.Rigidbody2D:
                asset = new Rigidbody2D(assetInfo);
                break;

            case ClassIDType.Rigidbody:
                asset = new Rigidbody(assetInfo);
                break;

            case ClassIDType.CircleCollider2D:
                asset = new CircleCollider2D(assetInfo);
                break;

            case ClassIDType.PolygonCollider2D:
                asset = new PolygonCollider2D(assetInfo);
                break;

            case ClassIDType.BoxCollider2D:
                asset = new BoxCollider2D(assetInfo);
                break;

            case ClassIDType.PhysicsMaterial2D:
                asset = new PhysicsMaterial2D(assetInfo);
                break;

            case ClassIDType.MeshCollider:
                asset = new MeshCollider(assetInfo);
                break;

            case ClassIDType.BoxCollider:
                asset = new BoxCollider(assetInfo);
                break;

            case ClassIDType.SpriteCollider2D:
                asset = new CompositeCollider2D(assetInfo);
                break;

            case ClassIDType.EdgeCollider2D:
                asset = new EdgeCollider2D(assetInfo);
                break;

            case ClassIDType.CapsuleCollider2D:
                asset = new CapsuleCollider2D(assetInfo);
                break;

            case ClassIDType.AnimationClip:
                asset = new AnimationClip(assetInfo);
                break;

            case ClassIDType.AudioListener:
                asset = new AudioListener(assetInfo);
                break;

            case ClassIDType.AudioSource:
                asset = new AudioSource(assetInfo);
                break;

            case ClassIDType.AudioClip:
                asset = new AudioClip(assetInfo);
                break;

            case ClassIDType.RenderTexture:
                asset = new RenderTexture(assetInfo);
                break;

            case ClassIDType.Cubemap:
                asset = new Cubemap(assetInfo);
                break;

            case ClassIDType.Avatar:
                asset = new Avatar(assetInfo);
                break;

            case ClassIDType.AnimatorController:
                asset = new AnimatorController(assetInfo);
                break;

            case ClassIDType.GUILayer:
                asset = new GUILayer(assetInfo);
                break;

            case ClassIDType.Animator:
                asset = new Animator(assetInfo);
                break;

            case ClassIDType.RenderSettings:
                asset = new RenderSettings(assetInfo);
                break;

            case ClassIDType.Light:
                asset = new Light(assetInfo);
                break;

            case ClassIDType.Animation:
                asset = new Animation(assetInfo);
                break;

            case ClassIDType.MonoScript:
                asset = new MonoScript(assetInfo);
                break;

            case ClassIDType.NewAnimationTrack:
                asset = new NewAnimationTrack(assetInfo);
                break;

            case ClassIDType.FlareLayer:
                asset = new FlareLayer(assetInfo);
                break;

            case ClassIDType.Font:
                asset = new Font(assetInfo);
                break;

            case ClassIDType.PhysicMaterial:
                asset = new PhysicMaterial(assetInfo);
                break;

            case ClassIDType.SphereCollider:
                asset = new SphereCollider(assetInfo);
                break;

            case ClassIDType.CapsuleCollider:
                asset = new CapsuleCollider(assetInfo);
                break;

            case ClassIDType.SkinnedMeshRenderer:
                asset = new SkinnedMeshRenderer(assetInfo);
                break;

            case ClassIDType.BuildSettings:
                asset = new BuildSettings(assetInfo);
                break;

            case ClassIDType.AssetBundle:
                asset = new AssetBundle(assetInfo);
                break;

            case ClassIDType.WheelCollider:
                asset = new WheelCollider(assetInfo);
                break;

            case ClassIDType.MovieTexture:
                asset = new MovieTexture(assetInfo);
                break;

            case ClassIDType.TerrainCollider:
                asset = new TerrainCollider(assetInfo);
                break;

            case ClassIDType.TerrainData:
                asset = new TerrainData(assetInfo);
                break;

            case ClassIDType.LightmapSettings:
                asset = new LightmapSettings(assetInfo);
                break;

            case ClassIDType.OcclusionArea:
                asset = new OcclusionArea(assetInfo);
                break;

            case ClassIDType.NavMeshSettings:
                asset = new NavMeshSettings(assetInfo);
                break;

            case ClassIDType.ParticleSystem:
                asset = new ParticleSystem(assetInfo);
                break;

            case ClassIDType.ParticleSystemRenderer:
                asset = new ParticleSystemRenderer(assetInfo);
                break;

            case ClassIDType.SpriteRenderer:
                asset = new SpriteRenderer(assetInfo);
                break;

            case ClassIDType.Sprite:
                asset = new Sprite(assetInfo);
                break;

            case ClassIDType.Terrain:
                asset = new Terrain(assetInfo);
                break;

            case ClassIDType.AnimatorOverrideController:
                asset = new AnimatorOverrideController(assetInfo);
                break;

            case ClassIDType.CanvasRenderer:
                asset = new CanvasRenderer(assetInfo);
                break;

            case ClassIDType.Canvas:
                asset = new Canvas(assetInfo);
                break;

            case ClassIDType.RectTransform:
                asset = new RectTransform(assetInfo);
                break;

            case ClassIDType.NavMeshData:
                asset = new NavMeshData(assetInfo);
                break;

            case ClassIDType.OcclusionCullingData:
                asset = new OcclusionCullingData(assetInfo);
                break;

            case ClassIDType.SceneAsset:
                asset = new SceneAsset(assetInfo);
                break;

            case ClassIDType.LightmapParameters:
                asset = new LightmapParameters(assetInfo);
                break;

            case ClassIDType.SpriteAtlas:
                asset = new SpriteAtlas(assetInfo);
                break;

            default:
                return(null);
            }

            stream.BaseStream.Position = offset;
            if (Config.IsGenerateGUIDByContent)
            {
                byte[] data = stream.ReadBytes(size);
                asset.Read(data);

                using (MD5 md5 = MD5.Create())
                {
                    byte[] md5Hash = md5.ComputeHash(data);
                    assetInfo.GUID = new UtinyGUID(md5Hash);
                }
            }
            else
            {
                stream.AlignPosition = offset;
                asset.Read(stream);
                long read = stream.BaseStream.Position - offset;
                if (read != size)
                {
                    throw new Exception($"Read {read} but expected {size} for object {asset.GetType().Name}");
                }
            }
            return(asset);
        }