コード例 #1
0
    private void Ready_button_process_beginning()
    {
        // Нажата кнопка "готово". Начало создание карты.

        Map_info_Blank Map_info = new Map_info_Blank();

        if (Main.db_data.map_list_count > 0)
        {
            Map_info.id = Main.db_data.map_list.Values.Last().id + 1;
        }
        else
        {
            Map_info.id = 1;
        }

        if (map_name_InputField.text == "")
        {
            map_name_InputField.text = "New Map " + width_InputField.text + " x " + height_InputField.text;
        }

        map_name = "" + Map_info.id;
        list_map_name.Add(map_name);

        Map_info.name = "" + map_name_InputField.text;

        Map_info.map_cell_number = Int32.Parse(size_text.text);
        Map_info.map_width       = Int32.Parse(width_InputField.text);
        Map_info.map_height      = Int32.Parse(height_InputField.text);

        //Debug.Log(map_name);

        Main.Map_info.Add(map_name, Map_info);

        Create_new_map_generation_windows();
    }
コード例 #2
0
    private void OnClick()
    {
        var paths = StandaloneFileBrowser.OpenFilePanel(Title, Directory, Extension, Multiselect);

        if (paths.Length > 0)
        {
            if (File.Exists(paths[0]))
            {
                BinaryFormatter bf   = new BinaryFormatter();
                FileStream      file = File.Open(paths[0], FileMode.Open);

                Map_info_Blank savedMap = (Map_info_Blank)bf.Deserialize(file);

                string map_name = "" + savedMap.id;

                Main.Map_info.Add(map_name, savedMap);

                //Debug.Log(map_name);

                file.Close();

                Main.action_name = "loading_map";

                initial_menu.Next_stage();
            }
            else
            {
                Debug.Log("Map doesn't excist or didn't loaded");
                initial_menu.no_maps_windows.SetActive(true);
            }
        }
    }
コード例 #3
0
    private void Map_loading(string paths)
    {
        map_loading = false;

        if (paths.Length > 0)
        {
            if (File.Exists(paths))
            {
                BinaryFormatter bf   = new BinaryFormatter();
                FileStream      file = File.Open(paths, FileMode.Open);

                Map_info_Blank savedMap = (Map_info_Blank)bf.Deserialize(file);

                string new_map_name = "" + map_num;

                /////////////////////////////////////////////Main.Map_info.Add(map_name, savedMap);
                Story_map_Data new_story_map = new Story_map_Data();

                new_story_map.id = "" + new_map_name;

                //Debug.Log("карта " + "   " + new_map_name + "   " + savedMap.name);

                new_story_map.name            = savedMap.name;
                new_story_map.test_name       = main_map_name + " " + savedMap.name;
                new_story_map.map_cell_number = savedMap.map_cell_number;
                new_story_map.map_height      = savedMap.map_height;
                new_story_map.map_width       = savedMap.map_width;

                new_story_map.protagonist_position_x = savedMap.protagonist_position_x;
                new_story_map.protagonist_position_y = savedMap.protagonist_position_y;


                new_story_map.short_info.relief = savedMap.short_info.relief;

                new_story_map.short_info.dungeon            = savedMap.short_info.dungeon;
                new_story_map.short_info.dungeon_transition = savedMap.short_info.dungeon_transition;

                new_story_map.short_info.region = savedMap.short_info.region;
                new_story_map.short_info.region_teleportation           = savedMap.short_info.region_teleportation;
                new_story_map.short_info.region_dungeon_exit            = savedMap.short_info.region_dungeon_exit;
                new_story_map.short_info.region_protagonist_start_point = savedMap.short_info.region_protagonist_start_point;


                new_story_map.cell_info = savedMap.cell_info;

                Story_info.Map_data.Add(new_map_name, new_story_map);
                //Debug.Log(map_name);

                file.Close();

                map_num = map_num + 1;

                map_loading = true;
            }
            else
            {
                Debug.Log("Map doesn't excist or didn't loaded");
            }
        }

        change_action = true;
    }