Пример #1
0
        public void layout_swap(int _layout1, int _layout2)
        {
            layout_data temp_data = m_layouts_data[_layout1];

            m_layouts_data[_layout1] = m_layouts_data[_layout2];
            m_layouts_data[_layout2] = temp_data;
        }
Пример #2
0
        private layout_screen_data get_layout_screen_data(int _layout_ind, int _scr_pos_x, int _scr_pos_y)
        {
            if (_layout_ind >= 0 && _layout_ind < m_data_mngr.layouts_data_cnt)
            {
                layout_data data = m_data_mngr.get_layout_data(_layout_ind);

                return(data.get_data(_scr_pos_x, _scr_pos_y));
            }

            return(null);
        }
Пример #3
0
        bool check_layouts_screen(int _scr_n, tiles_data _data)
        {
            int layout_n;
            int tiles_data_n;
            int scr_n;
            int curr_common_scr_ind;

            bool res = false;

            layout_data ldata = null;

            int layouts_cnt = m_data_sets.layouts_data_cnt;

            int bank_id = Convert.ToInt32(_data.name);

            // calc common screen index
            int common_scr_ind = _scr_n;

            for (tiles_data_n = 0; tiles_data_n < bank_id; tiles_data_n++)
            {
                common_scr_ind += m_data_sets.get_tiles_data(tiles_data_n).screen_data_cnt();
            }

            // check duplicate(s)
            for (scr_n = 0; scr_n < _scr_n; scr_n++)
            {
                if (_data.get_screen_data(scr_n).equal(_data.get_screen_data(_scr_n)) == true)
                {
                    curr_common_scr_ind = scr_n;

                    for (tiles_data_n = 0; tiles_data_n < bank_id; tiles_data_n++)
                    {
                        curr_common_scr_ind += m_data_sets.get_tiles_data(tiles_data_n).screen_data_cnt();
                    }

                    // remove duplicate(s)
                    for (layout_n = 0; layout_n < layouts_cnt; layout_n++)
                    {
                        ldata = m_data_sets.get_layout_data(layout_n);

                        ldata.get_raw_data().ForEach(delegate(List <layout_screen_data> _list)
                        {
                            _list.ForEach(delegate(layout_screen_data _scr_data)
                            {
                                if (_scr_data.m_scr_ind == common_scr_ind)
                                {
                                    _scr_data.m_scr_ind = curr_common_scr_ind;
                                }
                            });
                        });
                    }
                }
            }

            for (layout_n = 0; layout_n < layouts_cnt; layout_n++)
            {
                ldata = m_data_sets.get_layout_data(layout_n);

                ldata.get_raw_data().ForEach(delegate(List <layout_screen_data> _list)
                {
                    _list.ForEach(delegate(layout_screen_data _scr_data)
                    {
                        if (_scr_data.m_scr_ind == common_scr_ind)
                        {
                            res = true;

                            return;
                        }
                    });

                    if (res)
                    {
                        return;
                    }
                });
            }

            return(res);
        }
Пример #4
0
        public layout_data copy()
        {
            layout_data new_data = new layout_data();

            new_data.m_layout.Clear();

            m_layout.ForEach(delegate(List <layout_screen_data> _list)
            {
                new_data.m_layout.Add(new List <layout_screen_data>());

                _list.ForEach(delegate(layout_screen_data _data)
                {
                    new_data.m_layout[new_data.m_layout.Count - 1].Add(_data.copy());
                });
            });

            // copy targets
            {
                int scr_y;
                int scr_x;
                int ent_n;
                int targ_scr_y;
                int targ_scr_x;
                int targ_ent_n;

                bool target_find;

                entity_instance ent;
                entity_instance targ_ent;

                List <entity_instance> ents;
                List <entity_instance> targ_ents;

                for (scr_y = 0; scr_y < m_layout.Count; scr_y++)
                {
                    for (scr_x = 0; scr_x < m_layout[scr_y].Count; scr_x++)
                    {
                        ents = m_layout[scr_y][scr_x].m_ents;

                        for (ent_n = 0; ent_n < ents.Count; ent_n++)
                        {
                            ent = ents[ent_n];

                            if (ent.target_uid >= 0)
                            {
                                target_find = false;

                                // get target id and screen pos
                                for (targ_scr_y = 0; targ_scr_y < m_layout.Count; targ_scr_y++)
                                {
                                    for (targ_scr_x = 0; targ_scr_x < m_layout[targ_scr_y].Count; targ_scr_x++)
                                    {
                                        targ_ents = m_layout[targ_scr_y][targ_scr_x].m_ents;

                                        for (targ_ent_n = 0; targ_ent_n < targ_ents.Count; targ_ent_n++)
                                        {
                                            targ_ent = targ_ents[targ_ent_n];

                                            if (ent.target_uid == targ_ent.uid)
                                            {
                                                new_data.m_layout[scr_y][scr_x].m_ents[ent_n].target_uid = new_data.m_layout[targ_scr_y][targ_scr_x].m_ents[targ_ent_n].uid;

                                                target_find = true;

                                                break;
                                            }
                                        }

                                        if (target_find)
                                        {
                                            break;
                                        }
                                    }

                                    if (target_find)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            new_data.set_start_screen_ind(get_start_screen_ind());

            return(new_data);
        }