Esempio 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);
        }
Esempio n. 2
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]);
                }
            }
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
 public static string GetCloudSlotPath(Slots slot)
 {
     return(SaveSlotUtils.GetCloudSlotPath(GameSetup.Mode, slot));
 }
Esempio n. 5
0
 public static string GetCloudSlotPath()
 {
     return(SaveSlotUtils.GetCloudSlotPath(GameSetup.Slot));
 }
Esempio n. 6
0
 public static string GetCloudSlotPath(TitleScreen.GameSetup.Slots slot)
 {
     return(SaveSlotUtils.GetCloudSlotPath(TitleScreen.StartGameSetup.Mode, slot));
 }