Ejemplo n.º 1
0
        public static void CreateThumbnail()
        {
            string localSlotPath = SaveSlotUtils.GetLocalSlotPath();

            if (!Directory.Exists(localSlotPath))
            {
                Directory.CreateDirectory(localSlotPath);
            }
            string        path          = localSlotPath + "thumb.png";
            RenderTexture targetTexture = LocalPlayer.MainCam.targetTexture;
            RenderTexture active        = RenderTexture.active;
            int           num           = 250;
            int           num2          = 175;
            RenderTexture renderTexture = new RenderTexture(num, num2, 24);

            LocalPlayer.MainCam.targetTexture = renderTexture;
            Texture2D texture2D = new Texture2D(num, num2, TextureFormat.RGB24, false);
            Vector3   b         = LocalPlayer.MainCamTr.forward * 3f / 4f;

            LocalPlayer.MainCamTr.position += b;
            LocalPlayer.MainCam.Render();
            LocalPlayer.MainCamTr.position -= b;
            RenderTexture.active            = renderTexture;
            texture2D.ReadPixels(new Rect(0f, 0f, (float)num, (float)num2), 0, 0);
            LocalPlayer.MainCam.targetTexture = targetTexture;
            RenderTexture.active = active;
            UnityEngine.Object.Destroy(renderTexture);
            byte[] array = texture2D.EncodeToPNG();
            File.WriteAllBytes(path, array);
            CoopSteamCloud.CloudSave(SaveSlotUtils.GetCloudSlotPath() + "thumb.png", array);
        }
Ejemplo n.º 2
0
 public static string GetLocalSlotPath(PlayerModes mode, Slots slot)
 {
     return(string.Concat(new object[]
     {
         SaveSlotUtils.GetUserPath(),
         mode,
         "/",
         slot,
         "/"
     }));
 }
Ejemplo n.º 3
0
 public static string GetLocalSlotPath(TitleScreen.GameSetup.PlayerModes mode, TitleScreen.GameSetup.Slots slot)
 {
     return(string.Concat(new object[]
     {
         SaveSlotUtils.GetUserPath(),
         mode,
         "/",
         slot,
         "/"
     }));
 }
Ejemplo n.º 4
0
 private static void DeleteDirectory(string target_dir)
 {
     string[] files       = Directory.GetFiles(target_dir);
     string[] directories = Directory.GetDirectories(target_dir);
     foreach (string path in files)
     {
         File.SetAttributes(path, FileAttributes.Normal);
         File.Delete(path);
     }
     foreach (string target_dir2 in directories)
     {
         SaveSlotUtils.DeleteDirectory(target_dir2);
     }
     Directory.Delete(target_dir, false);
 }
Ejemplo n.º 5
0
        public static HashSet <string> GetPreviouslyPlayedServers()
        {
            HashSet <string> hashSet           = new HashSet <string>();
            string           mpClientLocalPath = SaveSlotUtils.GetMpClientLocalPath();

            if (!Directory.Exists(mpClientLocalPath))
            {
                Directory.CreateDirectory(mpClientLocalPath);
            }
            foreach (string path in Directory.GetFiles(mpClientLocalPath))
            {
                hashSet.Add(Path.GetFileName(path));
            }
            return(hashSet);
        }
Ejemplo n.º 6
0
        public static HashSet <string> GetPreviouslyPlayedServers()
        {
            HashSet <string> hashSet           = new HashSet <string>();
            string           mpClientLocalPath = SaveSlotUtils.GetMpClientLocalPath();

            if (!Directory.Exists(mpClientLocalPath))
            {
                Directory.CreateDirectory(mpClientLocalPath);
            }
            string[] files = Directory.GetFiles(mpClientLocalPath);
            for (int i = 0; i < files.Length; i++)
            {
                string path = files[i];
                hashSet.Add(Path.GetFileName(path));
            }
            return(hashSet);
        }
Ejemplo n.º 7
0
        public static void DeleteSlot(PlayerModes mode, Slots slot)
        {
            string localSlotPath = SaveSlotUtils.GetLocalSlotPath(mode, slot);

            if (Directory.Exists(localSlotPath))
            {
                SaveSlotUtils.DeleteDirectory(localSlotPath);
            }
            string[] array         = CoopSteamCloud.ListFiles();
            string   cloudSlotPath = SaveSlotUtils.GetCloudSlotPath(mode, slot);

            for (int i = 0; i < array.Length; i++)
            {
                if (array[i].StartsWith(cloudSlotPath))
                {
                    CoopSteamCloud.CloudDelete(array[i]);
                }
            }
        }
Ejemplo n.º 8
0
 private static void DeleteDirectory(string target_dir)
 {
     string[] files       = Directory.GetFiles(target_dir);
     string[] directories = Directory.GetDirectories(target_dir);
     string[] array       = files;
     for (int i = 0; i < array.Length; i++)
     {
         string path = array[i];
         File.SetAttributes(path, FileAttributes.Normal);
         File.Delete(path);
     }
     string[] array2 = directories;
     for (int j = 0; j < array2.Length; j++)
     {
         string target_dir2 = array2[j];
         SaveSlotUtils.DeleteDirectory(target_dir2);
     }
     Directory.Delete(target_dir, false);
 }
Ejemplo n.º 9
0
        private void OnSerializing()
        {
            this._stats._day = Clock.Day;
            string localSlotPath = SaveSlotUtils.GetLocalSlotPath();
            string path          = localSlotPath + "info";
            string filename      = SaveSlotUtils.GetCloudSlotPath() + "info";

            if (!Directory.Exists(localSlotPath))
            {
                Directory.CreateDirectory(localSlotPath);
            }
            IFormatter formatter = new BinaryFormatter();

            byte[] array;
            using (MemoryStream memoryStream = new MemoryStream())
            {
                formatter.Serialize(memoryStream, this._stats);
                array = memoryStream.ToArray();
            }
            File.WriteAllBytes(path, array);
            CoopSteamCloud.CloudSave(filename, array);
        }
Ejemplo n.º 10
0
        public static bool HasLocalFile(Slots slot, string filename)
        {
            string localSlotPath = SaveSlotUtils.GetLocalSlotPath(slot);

            return(File.Exists(localSlotPath + filename));
        }
Ejemplo n.º 11
0
 public static string GetCloudSlotPath(Slots slot)
 {
     return(SaveSlotUtils.GetCloudSlotPath(GameSetup.Mode, slot));
 }
Ejemplo n.º 12
0
 public static string GetCloudSlotPath()
 {
     return(SaveSlotUtils.GetCloudSlotPath(GameSetup.Slot));
 }
Ejemplo n.º 13
0
 public static string GetMpClientLocalPath()
 {
     return(SaveSlotUtils.GetUserPath() + PlayerModes.Multiplayer + "/cs/");
 }
Ejemplo n.º 14
0
 public static string GetCloudSlotPath(TitleScreen.GameSetup.Slots slot)
 {
     return(SaveSlotUtils.GetCloudSlotPath(TitleScreen.StartGameSetup.Mode, slot));
 }
Ejemplo n.º 15
0
 public static string GetMpClientLocalPath()
 {
     return(SaveSlotUtils.GetUserPath() + TitleScreen.GameSetup.PlayerModes.Multiplayer + "/cs/");
 }
Ejemplo n.º 16
0
 public static string GetLocalSlotPath()
 {
     return(SaveSlotUtils.GetLocalSlotPath(TitleScreen.StartGameSetup.Slot));
 }