Exemplo n.º 1
0
 public static void PreLoadTextureHook(On.RoomCamera.orig_PreLoadTexture orig, RoomCamera rCam, Room room, int camPos)
 {
     if (!ShouldScroll(room))
     {
         orig(rCam, room, camPos);
         return;
     }
     rCam.quenedTexture = WorldLoader.FindRoomFileDirectory(room.abstractRoom.name, true) + ".png";
     rCam.www           = new WWW(rCam.quenedTexture);
     orig(rCam, room, 0);
 }
Exemplo n.º 2
0
        private static void RoomCamera_PreLoadTexture(On.RoomCamera.orig_PreLoadTexture orig, RoomCamera self, Room room, int camPos)
        {
            if (self.quenedTexture == string.Empty)
            {
                string requestedTexture = WorldLoader.FindRoomFileDirectory(room.abstractRoom.name, true) + "_" + camPos + 1 + ".png";
                string path             = requestedTexture;

                string delimitator = "file:///";
                int    index       = path.IndexOf(delimitator) + delimitator.Length;
                path = path.Substring(index);

                //CustomWorldMod.CustomWorldLog($"Custom regions: PreloadTexture path [{path}] Exists [{File.Exists(path)}]");
                if (!File.Exists(path))
                {
                    self.quenedTexture = FindCameraTexturePath(requestedTexture);
                    self.www           = new WWW(self.quenedTexture);
                }
            }

            orig(self, room, camPos);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads vanilla room setting if there is no custom one.
        /// </summary>
        private static void RoomSettings_Load(On.RoomSettings.orig_Load orig, RoomSettings self, int playerChar)
        {
            // CHECK IF THIS WORKS
            // if (!self.isTemplate)
            // {
            string path = WorldLoader.FindRoomFileDirectory(self.name, false) + "_Settings.txt";

            CustomWorldMod.Log($"Custom Regions: Loading room settings for [{self.name}] at [{path}]");

            if (File.Exists(path))
            {
                self.filePath = path;
            }
            else
            {
                self.filePath = FindVanillaRoom(self.name, false) + "_Settings.txt";
            }
            //}


            orig(self, playerChar);
        }
 public void ctor(string name, Region region, bool template, bool firstTemplate, int playerChar)
 {
     this.name            = name;
     this.effects         = new List <RoomSettings.RoomEffect>();
     this.ambientSounds   = new List <AmbientSound>();
     this.placedObjects   = new List <PlacedObject>();
     this.triggers        = new List <EventTrigger>();
     this.isTemplate      = template;
     this.isFirstTemplate = firstTemplate;
     if (name == "RootTemplate")
     {
         this.filePath = string.Empty;
         return;
     }
     if (template)
     {
         this.filePath = string.Concat(new object[]
         {
             Custom.RootFolderDirectory(),
             "World",
             Path.DirectorySeparatorChar,
             "Regions",
             Path.DirectorySeparatorChar,
             region.name,
             Path.DirectorySeparatorChar,
             name,
             ".txt"
         });
     }
     else
     {
         this.filePath = WorldLoader.FindRoomFileDirectory(name, false) + "_Settings.txt";
     }
     this.Reset();
     this.FindParent(region);
     this.Load(playerChar);
 }