//-------Trile Sets------- public static void LoadTrileSet(string toLoad) { if (IsSetLoaded(toLoad)) { return; } string filePathXNB = OutputPath.OutputPathDir + "trile sets/" + toLoad + ".xnb"; if (!File.Exists(filePathXNB)) { Debug.LogError("No model!"); return; } //---Set loader--- TrileSet loadedSet = (TrileSet)FmbUtil.ReadObject(filePathXNB); loadedSet.TextureAtlas.filterMode = FilterMode.Point; /*//---Image loader--- * Texture2D tilesetTexture = new Texture2D(1, 1); * byte[] image = File.ReadAllBytes(texturePath); * * tilesetTexture.LoadImage(image); * tilesetTexture.filterMode=FilterMode.Point; * * //Assign texture to set * //TODO, add materials somehow so we don't always need new ones * loadedSet.TextureAtlas=tilesetTexture;*/ loadedSets.Add(toLoad, loadedSet); }
public void LoadSet() { //Load the trile set if (s == null) { s = FmbUtil.ReadObject <TrileSet>(OutputPath.OutputPathDir + "trile sets/" + setName.ToLower() + ".xnb"); } else if (s.Name != setName) { s = FmbUtil.ReadObject <TrileSet>(OutputPath.OutputPathDir + "trile sets/" + setName.ToLower() + ".xnb"); } LoadSetMeshes(); }
public void LoadLevel(string name) { loaded = FmbUtil.ReadObject <Level>(OutputPath.OutputPathDir + "levels/" + name.ToLower() + ".xnb"); //Load the trile set s = FmbUtil.ReadObject <TrileSet>(OutputPath.OutputPathDir + "trile sets/" + loaded.TrileSetName.ToLower() + ".xnb"); LoadUsedArtObjects(); //Create meshes for triles LoadSetMeshes(); LoadAOMeshes(); StartCoroutine(LoadLevelCoroutine()); ListTrilesUnderUI(); }
public void LoadLevel(string name) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); if (isFMB) { loaded = FmbUtil.ReadObject <Level>("F:/Fezzer 2/FZ2 Export/" + levelName + ".fmb"); } else { loaded = FmbUtil.ReadObject <Level>(OutputPath.OutputPathDir + "levels/" + levelName + ".xnb"); } //Load the trile set if (s == null) { s = FmbUtil.ReadObject <TrileSet>(OutputPath.OutputPathDir + "trile sets/" + loaded.TrileSetName.ToLower() + ".xnb"); } else if (s.Name != loaded.TrileSetName) { s = FmbUtil.ReadObject <TrileSet>(OutputPath.OutputPathDir + "trile sets/" + loaded.TrileSetName.ToLower() + ".xnb"); } sw.Stop(); Debug.Log("Level loaded in about " + sw.ElapsedMilliseconds.ToString() + " ms"); currTrileID = s.Triles.Keys.First(); LoadUsedArtObjects(); //Create meshes for triles LoadSetMeshes(); LoadAOMeshes(); StartCoroutine(LoadLevelCoroutine()); ListTrilesUnderUI(); ListAOUnderUI(); SkyColorManager.Instance.Load(); }
private static void Print(object obj) { Console.WriteLine("Asset type: " + obj.GetType().FullName); if (obj is TrileSet) { TrileSet ts = (TrileSet)obj; Console.WriteLine("TrileSet name: " + ts.Name); Console.WriteLine("Trile count: " + ts.Triles.Count); foreach (Trile trile in ts.Triles.Values) { Console.WriteLine(trile.Id + " Name: " + trile.Name); Console.WriteLine(trile.Id + " SurfaceType: " + trile.SurfaceType); } } if (obj is ArtObject) { ArtObject ao = (ArtObject)obj; Console.WriteLine("ArtObject name: " + ao.Name); Console.WriteLine("ActorType: " + ao.ActorType); } if (obj is Sky) { Sky sky = (Sky)obj; Console.WriteLine("Sky name: " + sky.Name); Console.WriteLine("Background: " + sky.Background); Console.WriteLine("Stars: " + sky.Stars); Console.WriteLine("Layer count: " + sky.Layers.Count); for (int i = 0; i < sky.Layers.Count; i++) { Console.WriteLine(i + ": " + sky.Layers[i].Name); } } }
protected override void LoadContent() { TrileSet trileSet = this.CMProvider.Global.Load <TrileSet>("Trile Sets/LOADING"); float viewAspect = 1.777778f; LoadingScreen loadingScreen = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured(); litTextured1.Specular = true; litTextured1.AlphaIsEmissive = true; litTextured1.Emissive = 0.5f; litTextured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f)); litTextured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); DefaultEffect.LitTextured litTextured2 = litTextured1; mesh2.Effect = (BaseEffect)litTextured2; mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending); mesh1.SamplerState = SamplerState.PointClamp; mesh1.AlwaysOnTop = false; mesh1.DepthWrites = true; mesh1.Texture = (Dirtyable <Texture>)((Texture)trileSet.TextureAtlas); mesh1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float)Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f); mesh1.Position = new Vector3(5.5f * viewAspect, -4.5f, 0.0f); Mesh mesh3 = mesh1; loadingScreen.mesh = mesh3; Group group = this.mesh.AddGroup(); ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry = trileSet.Triles[0].Geometry; group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(Enumerable.ToArray <VertexPositionNormalTextureInstance>((IEnumerable <VertexPositionNormalTextureInstance>)geometry.Vertices), geometry.Indices, geometry.PrimitiveType); group.Scale = new Vector3(0.95f); this.starBack = this.CMProvider.Global.Load <Texture2D>("Other Textures/hud/starback"); this.sDrone = this.CMProvider.Global.Load <SoundEffect>("Sounds/Intro/FezLogoDrone"); ServiceHelper.AddComponent((IGameComponent)(this.fakeDot = new FakeDot(ServiceHelper.Game))); this.LevelManager.LevelChanged += (Action)(() => { lock (LoadingScreen.EffectRefreshMutex) { if (this.mesh.Effect != null) { this.mesh.Effect.Dispose(); } if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha) { Mesh temp_131 = this.mesh; DefaultEffect.Textured temp_135 = new DefaultEffect.Textured() { AlphaIsEmissive = true }; temp_131.Effect = (BaseEffect)temp_135; } else { Mesh temp_179 = this.mesh; DefaultEffect.LitTextured temp_187 = new DefaultEffect.LitTextured() { Specular = true, Emissive = 0.5f, AlphaIsEmissive = true }; temp_179.Effect = (BaseEffect)temp_187; } this.mesh.Effect.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f)); this.mesh.Effect.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); this.mesh.TextureMatrix.Dirty = true; } }); }