public BlueTextureWrapper this[LightTexture textureType]
 {
     get
     {
         return this.textures[textureType];
     }
 }
Example #2
0
 public BlueTextureWrapper this[LightTexture textureType]
 {
     get
     {
         return(this.textures[textureType]);
     }
 }
Example #3
0
    public static void SetMaterial(int id, Material material, Camera camera, LightTexture lightTexture)
    {
        float ratio = (float)camera.pixelRect.width / camera.pixelRect.height;

        material.SetTexture("_Cam" + id + "_Texture", lightTexture.renderTexture);

        material.SetFloat("_Cam" + id + "_Position_X", camera.transform.position.x);
        material.SetFloat("_Cam" + id + "_Position_Y", camera.transform.position.y);

        material.SetFloat("_Cam" + id + "_Size_X", camera.orthographicSize * ratio * 2);
        material.SetFloat("_Cam" + id + "_Size_Y", camera.orthographicSize * 2);

        material.SetFloat("_Cam" + id + "_Size_Rotation", camera.transform.eulerAngles.z * Mathf.Deg2Rad);
    }
Example #4
0
 public BlueTextureWrapper AddTexture(Image bmp, int width, int height, LightTexture textureType)
 {
     this.textures[textureType] = BuildTexture(bmp, height, width);
     return(this.textures[textureType]);
 }
Example #5
0
        private static void CleanUp()
        {
            if (Sprite != null)
            {
                if (!Sprite.Disposed)
                {
                    Sprite.Dispose();
                }

                Sprite = null;
            }

            if (Line != null)
            {
                if (!Line.Disposed)
                {
                    Line.Dispose();
                }

                Line = null;
            }

            if (CurrentSurface != null)
            {
                if (!CurrentSurface.Disposed)
                {
                    CurrentSurface.Dispose();
                }

                CurrentSurface = null;
            }

            if (PoisonDotBackground != null)
            {
                if (!PoisonDotBackground.Disposed)
                {
                    PoisonDotBackground.Dispose();
                }

                PoisonDotBackground = null;
            }

            if (RadarTexture != null)
            {
                if (!RadarTexture.Disposed)
                {
                    RadarTexture.Dispose();
                }

                RadarTexture = null;
            }

            if (FloorTexture != null)
            {
                if (!FloorTexture.Disposed)
                {
                    FloorTexture.Dispose();
                }

                DXManager.FloorTexture = null;
                GameScene.Scene.MapControl.FloorValid = false;

                if (DXManager.FloorSurface != null && !DXManager.FloorSurface.Disposed)
                {
                    DXManager.FloorSurface.Dispose();
                }

                DXManager.FloorSurface = null;
            }

            if (LightTexture != null)
            {
                if (!LightTexture.Disposed)
                {
                    LightTexture.Dispose();
                }

                DXManager.LightTexture = null;

                if (DXManager.LightSurface != null && !DXManager.LightSurface.Disposed)
                {
                    DXManager.LightSurface.Dispose();
                }

                DXManager.LightSurface = null;
            }

            if (Lights != null)
            {
                for (int i = 0; i < Lights.Count; i++)
                {
                    if (!Lights[i].Disposed)
                    {
                        Lights[i].Dispose();
                    }
                }
                Lights.Clear();
            }

            for (int i = TextureList.Count - 1; i >= 0; i--)
            {
                MImage m = TextureList[i];

                if (m == null)
                {
                    continue;
                }

                m.DisposeTexture();
            }
            TextureList.Clear();


            for (int i = ControlList.Count - 1; i >= 0; i--)
            {
                MirControl c = ControlList[i];

                if (c == null)
                {
                    continue;
                }

                c.DisposeTexture();
            }
            ControlList.Clear();
        }
 public BlueTextureWrapper this[LightTexture textureType] => this.textures[textureType];
 public BlueTextureWrapper AddTexture(Image bmp, int width, int height, LightTexture textureType)
 {
     this.textures[textureType] = BuildTexture(bmp, height, width);
     return this.textures[textureType];
 }
Example #8
0
        public static void LoadMap(ClientMapInfo MI)
        {
            if (MapInfo == MI)
            {
                return;
            }

            if (FloorTexture != null && !FloorTexture.Disposed)
            {
                FloorTexture.Dispose();
            }
            if (LightTexture != null && !LightTexture.Disposed)
            {
                LightTexture.Dispose();
            }

            if (MI == null)
            {
                M2CellInfo = null;
                return;
            }

            ObjectList.Add(MapObject.User);
            MapInfo = MI;

            try
            {
                string FileName = Path.Combine(Settings.MapPath, MapInfo.FileName + ".map");
                if (File.Exists(FileName))
                {
                    int          OffSet = 21;
                    Mir2CellInfo CI;
                    byte[]       FileBytes = File.ReadAllBytes(FileName);
                    int          W         = BitConverter.ToInt16(FileBytes, OffSet); OffSet += 2;
                    int          Xor       = BitConverter.ToInt16(FileBytes, OffSet); OffSet += 2;
                    int          H         = BitConverter.ToInt16(FileBytes, OffSet); OffSet += 2;
                    MapSize    = new Size((short)W ^ (short)Xor, H ^ Xor);
                    M2CellInfo = new Mir2CellInfo[MapSize.Width, MapSize.Height];

                    OffSet = 54;

                    for (int X = 0; X < MapSize.Width; X++)
                    {
                        for (int Y = 0; Y < MapSize.Height; Y++)
                        {
                            CI = new Mir2CellInfo
                            {
                                BackImage      = (int)(BitConverter.ToInt32(FileBytes, OffSet) ^ 0xAA38AA38),
                                MiddleImage    = (short)(BitConverter.ToInt16(FileBytes, OffSet += 4) ^ Xor),
                                FrontImage     = (short)(BitConverter.ToInt16(FileBytes, OffSet += 2) ^ Xor),
                                DoorIndex      = FileBytes[OffSet += 2],
                                DoorOffset     = FileBytes[++OffSet],
                                AnimationFrame = FileBytes[++OffSet],
                                AnimationTick  = FileBytes[++OffSet],
                                FileIndex      = FileBytes[++OffSet],
                                Light          = FileBytes[++OffSet],
                                Unknown        = FileBytes[++OffSet],
                            };
                            OffSet++;

                            M2CellInfo[X, Y] = CI;
                        }
                    }
                }
                else
                {
                    M2CellInfo = null;
                }
            }
            catch (Exception Ex)
            {
                if (Settings.LogErrors)
                {
                    Main.SaveError(Ex.ToString());
                }
            }
        }