コード例 #1
0
        // Set save information
        public void Save()
        {
            // Record game stats we must save (listed at top of file)
            log_text      = UIManager.ui_manager.log_text.text;
            current_scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;

            //current_conversation = VNSceneManager.current_conversation;
            current_conv      = SaveManager.GetGameObjectPath(VNSceneManager.current_conversation.transform);
            current_conv_node = VNSceneManager.current_conversation.cur_node;

            time_saved  = DateTime.Now;
            time_played = VNSceneManager.scene_manager.play_time;

            //bg_music = AudioManager.audio_manager.background_music_audio_source.clip.;

            // Save the actors on the scene

            /*
             * foreach (Actor a in ActorManager.left_actors)
             * {
             *  left_actors.Add(a.actor_name);
             *
             *  // Check if they have been flipped to face the other way
             *  if (Mathf.Sign(a.transform.localScale.x) == -1f)
             *      flipped_actors.Add(a.actor_name);
             * }
             * foreach (Actor a in ActorManager.right_actors)
             * {
             *  right_actors.Add(a.actor_name);
             *
             *  // Check if they have been flipped to face the other way
             *  if (Mathf.Sign(a.transform.localScale.x) == -1f)
             *      flipped_actors.Add(a.actor_name);
             * }
             * foreach (Actor a in ActorManager.center_actors)
             * {
             *  center_actors.Add(a.actor_name);
             *
             *  // Check if they have been flipped to face the other way
             *  if (Mathf.Sign(a.transform.localScale.x) == -1f)
             *      flipped_actors.Add(a.actor_name);
             * }*/


            // Record all remaining conversations (deleted ones will not be recorded)
            ConversationManager[] convs = (ConversationManager[])UnityEngine.Object.FindObjectsOfType(typeof(ConversationManager)) as ConversationManager[];
            foreach (ConversationManager c in convs)
            {
                remaining_conversations.Add(SaveManager.GetGameObjectPath(c.transform));
            }

            // Save stats
            saved_boolean_stats  = StatsManager.boolean_stats;
            saved_numbered_stats = StatsManager.numbered_stats;
            saved_string_stats   = StatsManager.string_stats;
            saved_items          = StatsManager.items;


            // Features to save, like static images, background and foreground
            if (UIManager.ui_manager.canvas != null)
            {
                FeatureToSave[] features = UIManager.ui_manager.canvas.GetComponentsInChildren <FeatureToSave>();
                foreach (FeatureToSave f in features)
                {
                    Nodes_to_Execute_on_Load.Add(f.Type_of_Node_to_Execute.GetType() + feature_save_separation_character + f.Node_to_Execute);
                    Debug.Log(f.Node_to_Execute);
                }
            }
            else
            {
                Debug.LogError("UIManager.ui_manager.canvas is not set. Features to save not saved");
            }

            // Save our log text
            log_categories = VNSceneManager.text_logs;
            log_text       = VNSceneManager.scene_manager.Conversation_log;

            //<< MODIFY THIS SECTION TO SAVE THINGS SPECIFIC TO YOUR GAME >>//



            //<< MODIFY THE ABOVE SECTION TO SAVE THINGS SPECIFIC TO YOUR GAME >>//



            SaveManager.AddNewSave(this);
        }